|
|
|
@ -135,7 +135,7 @@ class User extends Common |
|
|
|
|
$this->error('您已登录,不需要重新登录'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$params = $this->request->only(['mobile', 'code']); |
|
|
|
|
$params = $this->request->only(['mobile', 'code', 'user_code']); |
|
|
|
|
$this->svalidate($params, '.smsLogin'); |
|
|
|
|
if (!Sms::check($params['mobile'], $params['code'], 'mobilelogin')) { |
|
|
|
|
$this->error(__('Captcha is incorrect')); |
|
|
|
@ -145,6 +145,15 @@ class User extends Common |
|
|
|
|
if ($user->status != 'normal') { |
|
|
|
|
$this->error(__('Account is locked')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//登录注册根据注册码绑定上级 |
|
|
|
|
if (!empty($params['user_code'])) { |
|
|
|
|
$parent_user_id = UserModel::where('user_code', $params['user_code'])->value('id'); |
|
|
|
|
if (empty($parent_user_id)) { |
|
|
|
|
$user->parent_user_id = $parent_user_id; |
|
|
|
|
$user->save(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//如果已经有账号则直接登录 |
|
|
|
|
$ret = $this->auth->direct($user->id); |
|
|
|
|
}else { |
|
|
|
|