xiaogang 4 tahun lalu
induk
melakukan
3a1644f63c

+ 9 - 7
app/Http/Controllers/Api/AuthorizationsController.php

xqd xqd xqd xqd 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];
@@ -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();
         }
 
@@ -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,
@@ -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("该手机号码已使用");
         }
 
@@ -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("该手机号码已使用");
             }
             //邀请码设置

+ 4 - 1
app/Http/Controllers/Api/SmsController.php

xqd
@@ -34,6 +34,9 @@ class SmsController extends Controller
             return $this->response->errorForbidden($result['error']);
         }
 
-        return $this->response->array(['verifyKey' => $result['verifyKey'],'code'=>$result['code']]);
+        return $this->response->array([
+            'verifyKey' => $result['verifyKey']
+//            ,'code'=>$result['code']
+        ]);
     }
 }

+ 1 - 1
app/Models/User.php

xqd
@@ -20,7 +20,7 @@ class User extends Authenticatable implements JWTSubject
      * @var array
      */
     protected $fillable = [
-        'mobile', 'password', 'pid', 'tencent_im_user_id','sex','status','is_vip','is_auth','remember_token','ycode','latitude','longitude','online','notice_status','like_num','like_me_num','look_num','lock_pass'
+        'mobile', 'password', 'pid', 'tencent_im_user_id','sex','status','is_vip','is_auth','remember_token','ycode','latitude','longitude','online','notice_status','like_num','like_me_num','look_num','lock_pass','is_distory'
     ];
 
     /**

+ 2 - 1
app/Services/HomeService.php

xqd
@@ -30,7 +30,8 @@ class HomeService
         $query = User::query()
             ->leftJoin("users_info",'users.id','=','users_info.user_id')
             ->select(['users.id','users.is_vip','users.tencent_im_user_id','users.sex','users.is_auth','users.latitude','users.longitude','users.online','users_info.avatar','users_info.nickname','users_info.area','users_info.birthday','users_info.height','users_info.weight'])
-            ->addSelect(DB::raw("acos(cos(" .$param['latitude'] . "*pi()/180)*cos(cl_users.latitude*pi()/180)*cos(" . $param['longitude'] . "*pi()/180-cl_users.longitude*pi()/180)+sin(" . $param['latitude'] . "*pi()/180)*sin(cl_users.latitude * pi()/180)) * 6367000 AS distance"));
+            ->addSelect(DB::raw("acos(cos(" .$param['latitude'] . "*pi()/180)*cos(cl_users.latitude*pi()/180)*cos(" . $param['longitude'] . "*pi()/180-cl_users.longitude*pi()/180)+sin(" . $param['latitude'] . "*pi()/180)*sin(cl_users.latitude * pi()/180)) * 6367000 AS distance"))
+            ->where('users.is_distory','=','0');