Browse Source

商家登录新增shop_name

zhangchangchun 6 years ago
parent
commit
c3d437c22f
1 changed files with 12 additions and 1 deletions
  1. 12 1
      app/Http/Controllers/V1/AuthController.php

+ 12 - 1
app/Http/Controllers/V1/AuthController.php

@@ -70,7 +70,18 @@ class AuthController extends Controller {
             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).config('customer.jwt_secret')],'type'=>2]);
+            $factory = JWTFactory::customClaims(
+                [
+                    'shop'=>[
+                        'uid'=>$shopAccount->id,
+                        'username'=>$shopAccount->account,
+                        'shop_id'=>$shopAccount->shop_id,
+                        'shop_name'=>$shop->shop_name,
+                        'sign'=>md5($shopAccount->id).config('customer.jwt_secret')
+                    ],
+                        'type'=>2
+                    ]
+            );
             $payload = $factory->make();
             $token = JWTAuth::encode($payload);
             $shopAccount->token = $token;