From 34db7035c9c7880e00b9328d022be65a29c62cb2 Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期一, 31 七月 2023 10:40:56 +0800
Subject: [PATCH] Merge branch 'feature/v1.1.5接口' into develop

---
 application/common/controller/Api.php |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/application/common/controller/Api.php b/application/common/controller/Api.php
index 39dbe02..d0070a1 100644
--- a/application/common/controller/Api.php
+++ b/application/common/controller/Api.php
@@ -110,12 +110,26 @@
         $token = $this->request->server('HTTP_TOKEN', $this->request->request('token', \think\Cookie::get('token')));
 
         $path = str_replace('.', '/', $controllername) . '/' . $actionname;
+        $hasInit=false;
         // 璁剧疆褰撳墠璇锋眰鐨刄RI
         $this->auth->setRequestUri($path);
         // 妫�娴嬫槸鍚﹂渶瑕侀獙璇佺櫥褰�
         if (!$this->auth->match($this->noNeedLogin)) {
             //鍒濆鍖�
-            $this->auth->init($token);
+            if(empty($token))
+            {//token涓虹┖锛屽垽鏂璼essionkey
+                $sessionkey= $this->request->server('HTTP_DFGSESSIONKEY', $this->request->request('dfgsessionkey', \think\Cookie::get('dfgsessionkey')));
+                if(!empty($sessionkey))
+                {//鏍¢獙sessionkey
+                    $paramsArr=$this->request->post(false);
+                    $this->auth->initSession($sessionkey,$paramsArr);
+                    $hasInit=true;
+                }
+            }
+            if(!$hasInit)
+            {
+                $this->auth->init($token);
+            }
             //妫�娴嬫槸鍚︾櫥褰�
             if (!$this->auth->isLogin()) {
                 $this->error(__('Please login first'), [], 401);

--
Gitblit v1.9.3