【操盘手】 优化点赞方案

This commit is contained in:
wong
2025-05-28 15:44:21 +08:00
parent ffbc6d5e77
commit f5ea0add60
2 changed files with 14 additions and 13 deletions

View File

@@ -57,25 +57,25 @@ class WebSocketController extends BaseController
$this->authorized = $cachedToken;
$this->accountId = $userData['accountId'];
} else {
$params = [
'grant_type' => 'password',
'username' => $userData['userName'],
'password' => $userData['password']
];
// 调用登录接口获取token
$params = [
'grant_type' => 'password',
'username' => $userData['userName'],
'password' => $userData['password']
];
// 调用登录接口获取token
$headerData = ['client:kefu-client'];
$header = setHeader($headerData, '', 'plain');
$header = setHeader($headerData, '', 'plain');
$result = requestCurl('https://kf.quwanzhi.com:9991/token', $params, 'POST', $header);
$result_array = handleApiResponse($result);
$result_array = handleApiResponse($result);
if (isset($result_array['access_token']) && !empty($result_array['access_token'])) {
if (isset($result_array['access_token']) && !empty($result_array['access_token'])) {
$this->authorized = $result_array['access_token'];
$this->accountId = $userData['accountId'];
$this->accountId = $userData['accountId'];
// 将token存入缓存有效期5分钟
Cache::set($cacheKey, $this->authorized, 300);
} else {
} else {
return json_encode(['code'=>400,'msg'=>'获取系统授权信息失败']);
}
}

View File

@@ -30,4 +30,5 @@ return [
'workbench:autoLike' => 'app\command\WorkbenchAutoLikeCommand', // 工作台自动点赞任务
'workbench:moments' => 'app\command\WorkbenchMomentsCommand', // 工作台朋友圈同步任务
'sync:wechatData' => 'app\command\SyncWechatDataToCkbTask', // 同步微信数据到存客宝
'sync:allFriends' => 'app\command\SyncAllFriendsCommand', // 同步所有在线好友
];