| xqd
@@ -116,7 +116,7 @@ class AuthorizationsController extends Controller
|
|
|
//登录操作
|
|
|
public function do_login($mobile,$password=null){
|
|
|
if(!empty($password)){
|
|
|
- if (!$user=User::query()->where(['mobile' => $mobile])->whereNull('deleted_at')->first()) {
|
|
|
+ if (!$user=User::query()->where(['mobile' => $mobile,'is_distory'=>0])->whereNull('deleted_at')->first()) {
|
|
|
throw new Exception("用户不存在");
|
|
|
}
|
|
|
$credentials = ['mobile'=>$mobile,'password'=>$password];
|
| xqd
@@ -125,9 +125,11 @@ class AuthorizationsController extends Controller
|
|
|
throw new Exception("用户名或密码错误");
|
|
|
}
|
|
|
}else{
|
|
|
- User::firstOrCreate([
|
|
|
- 'mobile' => $mobile,
|
|
|
- ]);
|
|
|
+ if(!User::query()->where(['mobile'=>$mobile,'is_distory'=>0])->first()){
|
|
|
+ User::query()->create([
|
|
|
+ 'mobile' => $mobile,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
$user = User::query()->where(['mobile'=>$mobile])->whereNull('deleted_at')->first();
|
|
|
}
|
|
|
|
| xqd
@@ -135,7 +137,7 @@ class AuthorizationsController extends Controller
|
|
|
$user->ycode = $this->create_code();
|
|
|
}
|
|
|
if(!UserInfoModel::query()->where('user_id',$user->id)->first()){
|
|
|
- UserInfoModel::query()->firstOrCreate([
|
|
|
+ UserInfoModel::query()->create([
|
|
|
'user_id'=>$user->id,
|
|
|
'avatar'=>"https://zhengda.oss-cn-chengdu.aliyuncs.com/chengluApp/default.jpg",
|
|
|
'nickname'=>"用户".$user->mobile,
|
| xqd
@@ -208,7 +210,7 @@ class AuthorizationsController extends Controller
|
|
|
if ($validator->fails()){
|
|
|
return $this->response()->errorForbidden($validator->messages()->first());
|
|
|
}
|
|
|
- if(User::where(['mobile'=>$request->mobile])->first()){
|
|
|
+ if(User::where(['mobile'=>$request->mobile,'is_distory'=>0])->first()){
|
|
|
return $this->response->errorForbidden("该手机号码已使用");
|
|
|
}
|
|
|
|
| xqd
@@ -245,7 +247,7 @@ class AuthorizationsController extends Controller
|
|
|
//验证短信验证码
|
|
|
SmsService::checkSmsCodeByVerifyKey($request->verifyKey, $request->smsCode);
|
|
|
|
|
|
- if(User::where(['mobile'=>$request->mobile])->first()){
|
|
|
+ if(User::where(['mobile'=>$request->mobile,'is_distory'=>0])->first()){
|
|
|
throw new Exception("该手机号码已使用");
|
|
|
}
|
|
|
//邀请码设置
|