优化验证码获取逻辑

Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
vilson 2019-02-13 22:08:16 +08:00
parent 0ab700ebf8
commit 4290688db0

View File

@ -118,15 +118,17 @@ class Login extends BasicApi
{ {
$mobile = $this->request->post('mobile', ''); $mobile = $this->request->post('mobile', '');
$code = RandomService::numeric(6); $code = RandomService::numeric(6);
$sms = new Sms(); if (config('sms.debug')) {
$result = $sms->vSend($mobile, [ $sms = new Sms();
'data' => [ $result = $sms->vSend($mobile, [
'project' => 'DWYsW1', 'data' => [
'code' => $code 'project' => 'DWYsW1',
], 'code' => $code
]); ],
if (isError($result)) { ]);
$this->error('系统繁忙'); if (isError($result)) {
$this->error('系统繁忙');
}
} }
session('captcha', $code); session('captcha', $code);
$this->success('', config('sms.debug') ? $code : ''); $this->success('', config('sms.debug') ? $code : '');