|
|
|
@ -873,8 +873,7 @@ class ApiController extends \yii\web\Controller |
|
|
|
|
if (isset($ret['code']) && $ret['code'] == 200) { |
|
|
|
|
$result['code'] = 0; |
|
|
|
|
$result['msg'] = '短信发送成功'; |
|
|
|
|
$session = Yii::$app->session; |
|
|
|
|
$session->set('hy_vcode_'.$params['mobile'], $code); |
|
|
|
|
Yii::$app->cache->set('hy_vcode_'.$params['mobile'], $code); |
|
|
|
|
} else { |
|
|
|
|
$result['success'] = false; |
|
|
|
|
$result['msg'] = $ret['msg']; |
|
|
|
@ -905,9 +904,9 @@ class ApiController extends \yii\web\Controller |
|
|
|
|
$result['msg'] = '参数错误'; |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
if($code == '' || Yii::$app->session->get('hy_vcode_'.$mobile) != $code){ |
|
|
|
|
if($code == '' || Yii::$app->cache->get('hy_vcode_'.$mobile) != $code){ |
|
|
|
|
$result['code'] = -1; |
|
|
|
|
$result['msg'] = '验证码错误'; |
|
|
|
|
$result['msg'] = '验证码错误,系统保存为'.Yii::$app->cache->get('hy_vcode_'.$mobile); |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
if($user) { |
|
|
|
@ -969,7 +968,7 @@ class ApiController extends \yii\web\Controller |
|
|
|
|
$result['code'] = -1; |
|
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
|
} |
|
|
|
|
Yii::$app->session->remove('hy_vcode_'.$mobile); |
|
|
|
|
Yii::$app->cache->remove('hy_vcode_'.$mobile); |
|
|
|
|
} |
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|