소스 검색

商户获取token接口

xialei 1 년 전
부모
커밋
9188b8333a
2개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 19 0
      app/controller/merchant/system/admin/Login.php
  2. 2 0
      route/merchant.php

+ 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 61
      * @param LoginValidate $validate
43 62
      * @return mixed

+ 2 - 0
route/merchant.php

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