|
@@ -53,15 +53,15 @@ class AuthController extends Controller {
|
|
|
'password' => 'required|max:32',
|
|
|
]);
|
|
|
if ($validator->fails()) {
|
|
|
- return $this->jsonError($validator->errors()->first());
|
|
|
+ return $this->response->error($validator->errors()->first(), 500);
|
|
|
}
|
|
|
$account = ShopAccount::where(['account'=>$data['account'],'status'=>1])->first();
|
|
|
if(!$account){
|
|
|
- return $this->jsonError('登录失败,请重试');
|
|
|
+ return $this->response->error('登录失败,请重试', 500);
|
|
|
}
|
|
|
$token = Auth::attempt(['mobile'=>$request->get('mobile'),'password'=>$request->get('password')]);
|
|
|
if(!$token){
|
|
|
- return $this->jsonError('登陆失败');
|
|
|
+ return $this->response->error('登陆失败', 500);
|
|
|
}else{
|
|
|
$shopAccount = Auth::user();
|
|
|
$factory = JWTFactory::customClaims(['shop'=>['uid'=>$shopAccount->id,'username'=>$shopAccount->account,'shop_id'=>$shopAccount->shop_id,'sign'=>md5($shopAccount->id).env('JWT_SECRET')],'type'=>2]);
|
|
@@ -75,7 +75,7 @@ class AuthController extends Controller {
|
|
|
$res = new Item($shopAccount,new LoginTransformer());
|
|
|
$array = $fractal->createData($res)->toArray();
|
|
|
//日志
|
|
|
- return $this->jsonSuccess($array);
|
|
|
+ return $array;
|
|
|
}
|
|
|
}
|
|
|
|