From 8b2d951a88ac8c29a00223c17a6294e80fd20a09 Mon Sep 17 00:00:00 2001 From: kanade Date: Tue, 25 Apr 2023 09:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/crm/controller/Callback.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/application/crm/controller/Callback.php b/application/crm/controller/Callback.php index 4f13f20..23b2a5f 100644 --- a/application/crm/controller/Callback.php +++ b/application/crm/controller/Callback.php @@ -9,6 +9,7 @@ namespace app\crm\controller; use app\common\wework\api\Api; use app\common\wework\callback\WXBizMsgCrypt; +use think\Cache; use think\Controller; use think\Log; use think\Request; @@ -126,16 +127,33 @@ class Callback extends Controller $code = Request::instance()->get('code'); $api = new Api(config('wework.corpId'), config('wework.corpSecret')); $userInfo = $api->getUserInfo($code); + Log::record('用户信息'.json_encode($userInfo)); if (isset($userInfo['userid']) && $userInfo['userid']) { Session::set('wxuser_id', $userInfo['userid']); $adminUser = db('admin_user')->where('wxwork_id', $userInfo['userid'])->find(); if ($adminUser) { Session::set('user_id', $adminUser['id']); + + $info['userInfo'] = $adminUser; + $info['sessionId'] = session_id(); + // $info['_AUTH_LIST_'] = $dataList['rulesList']; + $info['authKey'] = 'wxwork'; + if (!Cache::get('Auth_wxwork')) { + Cache::set('Auth_wxwork', $info); + } return redirect('http://web.lbschem.com:8088/?authkey=wxwork&sessionid='.session_id()); } elseif (Session::get('user_id')) { db('admin_user')->where('id', Session::get('user_id'))->update([ 'wxwork_id' => $userInfo['userid'] ]); + $adminUser = db('admin_user')->where('id', Session::get('user_id'))->find(); + $info['userInfo'] = $adminUser; + $info['sessionId'] = session_id(); + // $info['_AUTH_LIST_'] = $dataList['rulesList']; + $info['authKey'] = 'wxwork'; + if (!Cache::get('Auth_wxwork')) { + Cache::set('Auth_wxwork', $info); + } return redirect('http://web.lbschem.com:8088/?authkey=wxwork&sessionid='.session_id()); } }