|
@@ -66,6 +66,10 @@ class AuthorizationsController extends Controller
|
|
if (!$user->tencent_im_user_id) {
|
|
if (!$user->tencent_im_user_id) {
|
|
$user->tencent_im_user_id = $this->tencentImAccountService->accountImport($user);
|
|
$user->tencent_im_user_id = $this->tencentImAccountService->accountImport($user);
|
|
}
|
|
}
|
|
|
|
+ if($user->status!=1){
|
|
|
|
+ return $this->response->errorForbidden("用户已被禁用,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+
|
|
$user->save();
|
|
$user->save();
|
|
$token = Auth::guard('api')->fromUser($user);
|
|
$token = Auth::guard('api')->fromUser($user);
|
|
self::updateLastLogin($user, $token);
|
|
self::updateLastLogin($user, $token);
|
|
@@ -74,6 +78,15 @@ class AuthorizationsController extends Controller
|
|
$resdata['sex'] = $user->sex;
|
|
$resdata['sex'] = $user->sex;
|
|
$resdata['password'] = $user->password?1:0;
|
|
$resdata['password'] = $user->password?1:0;
|
|
$resdata['tencent_im_user_id'] =$user->tencent_im_user_id;
|
|
$resdata['tencent_im_user_id'] =$user->tencent_im_user_id;
|
|
|
|
+ $resdata['mobile'] =$user->mobile;
|
|
|
|
+ $resdata['lock_pass'] =$user->lock_pass?$user->lock_pass:false;
|
|
|
|
+ $resdata['status'] =$user->status;
|
|
|
|
+ $resdata['is_auth'] =$user->is_auth;
|
|
|
|
+ $resdata['ycode'] =$user->ycode;
|
|
|
|
+ $resdata['online'] =$user->online;
|
|
|
|
+ $resdata['notice_status'] =$user->notice_status;
|
|
|
|
+
|
|
|
|
+
|
|
return response()->json($resdata);
|
|
return response()->json($resdata);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -113,12 +126,15 @@ class AuthorizationsController extends Controller
|
|
return $this->response()->errorForbidden($validator->messages()->first());
|
|
return $this->response()->errorForbidden($validator->messages()->first());
|
|
}
|
|
}
|
|
if (!$user=User::where(['mobile' => $request->mobile])->first()) {
|
|
if (!$user=User::where(['mobile' => $request->mobile])->first()) {
|
|
- return $this->response->errorNotFound('用户不存在!');
|
|
|
|
|
|
+ return $this->response->errorForbidden('用户不存在!');
|
|
}
|
|
}
|
|
$credentials = $request->only('mobile', 'password');
|
|
$credentials = $request->only('mobile', 'password');
|
|
|
|
|
|
if (!$token = auth('api')->attempt($credentials)) {
|
|
if (!$token = auth('api')->attempt($credentials)) {
|
|
- return $this->response->errorUnauthorized ('用户名或密码错误');
|
|
|
|
|
|
+ return $this->response->errorForbidden ('用户名或密码错误');
|
|
|
|
+ }
|
|
|
|
+ if($user->status!=1){
|
|
|
|
+ return $this->response->errorForbidden("用户已被禁用,请联系管理员");
|
|
}
|
|
}
|
|
|
|
|
|
if (!$user->ycode) {
|
|
if (!$user->ycode) {
|
|
@@ -128,13 +144,21 @@ class AuthorizationsController extends Controller
|
|
if (!$user->tencent_im_user_id) {
|
|
if (!$user->tencent_im_user_id) {
|
|
$user->tencent_im_user_id = $this->tencentImAccountService->accountImport($user);
|
|
$user->tencent_im_user_id = $this->tencentImAccountService->accountImport($user);
|
|
}
|
|
}
|
|
|
|
+
|
|
$user->save();
|
|
$user->save();
|
|
self::updateLastLogin($user, $token);
|
|
self::updateLastLogin($user, $token);
|
|
|
|
|
|
- $resdata['token'] ="Bearer ".$token;
|
|
|
|
|
|
+ $resdata['token'] = "Bearer ".$token;
|
|
$resdata['sex'] = $user->sex;
|
|
$resdata['sex'] = $user->sex;
|
|
$resdata['password'] = $user->password?1:0;
|
|
$resdata['password'] = $user->password?1:0;
|
|
$resdata['tencent_im_user_id'] =$user->tencent_im_user_id;
|
|
$resdata['tencent_im_user_id'] =$user->tencent_im_user_id;
|
|
|
|
+ $resdata['mobile'] =$user->mobile;
|
|
|
|
+ $resdata['lock_pass'] =$user->lock_pass?$user->lock_pass:false;
|
|
|
|
+ $resdata['status'] =$user->status;
|
|
|
|
+ $resdata['is_auth'] =$user->is_auth;
|
|
|
|
+ $resdata['ycode'] =$user->ycode;
|
|
|
|
+ $resdata['online'] =$user->online;
|
|
|
|
+ $resdata['notice_status'] =$user->notice_status;
|
|
return response()->json($resdata);
|
|
return response()->json($resdata);
|
|
}
|
|
}
|
|
|
|
|