Kaynağa Gözat

商户获取token接口

xialei 1 yıl önce
ebeveyn
işleme
9188b8333a

+ 19 - 0
app/controller/merchant/system/admin/Login.php

@@ -38,6 +38,25 @@ class Login extends BaseController
38
     {
38
     {
39
     }
39
     }
40
 
40
 
41
+    public function getPhpToken()
42
+    {
43
+        $merId = $this->request->param('merId');
44
+        $adminInfo = $this->repository->merIdByAdmin($merId);
45
+        if (!$adminInfo) return app('json')->fail('数据不存在');
46
+        $tokenInfo = $this->repository->createToken($adminInfo);
47
+        $admin = $adminInfo->toArray();
48
+        unset($admin['pwd']);
49
+        $data = [
50
+            'token' => $tokenInfo['token'],
51
+            'exp' => $tokenInfo['out'],
52
+            'admin' => $admin,
53
+            'url' => '/' . config('admin.merchant_prefix')
54
+        ];
55
+        return app('json')->success($data);
56
+    }
57
+
58
+    
59
+
41
     /**
60
     /**
42
      * @param LoginValidate $validate
61
      * @param LoginValidate $validate
43
      * @return mixed
62
      * @return mixed

+ 2 - 0
route/merchant.php

@@ -605,6 +605,8 @@ Route::group(config('admin.api_merchant_prefix') . '/', function () {
605
     Route::group(function () {
605
     Route::group(function () {
606
         Route::get('test', 'merchant.system.admin.Login/test');
606
         Route::get('test', 'merchant.system.admin.Login/test');
607
 
607
 
608
+        Route::post('getPhpToken', 'merchant.system.admin.Login/getPhpToken');
609
+
608
         //验证码
610
         //验证码
609
         Route::get('captcha', 'merchant.system.admin.Login/getCaptcha');
611
         Route::get('captcha', 'merchant.system.admin.Login/getCaptcha');
610
         //登录
612
         //登录