修复切换好友无法切换问题
This commit is contained in:
@@ -172,7 +172,7 @@ class AutomaticAssign extends BaseController
|
||||
* @param int $optFrom 操作来源
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function allotWechatFriend($data = [],$isInner = false)
|
||||
public function allotWechatFriend($data = [],$isInner = false,$errorNum = 0)
|
||||
{
|
||||
// 获取授权token
|
||||
$authorization = $this->authorization;
|
||||
@@ -228,13 +228,20 @@ class AutomaticAssign extends BaseController
|
||||
if($isInner){
|
||||
return json_encode(['code'=>500,'msg'=>'微信好友分配失败:' . $e->getMessage()]);
|
||||
}else{
|
||||
Cache::rm('system_authorization_token');
|
||||
Cache::rm('system_refresh_token');
|
||||
$errorNum ++;
|
||||
if ($errorNum <= 3) {
|
||||
$this->allotWechatFriend($data,$isInner,$errorNum);
|
||||
}
|
||||
return json_encode(['code'=>500,'msg'=> $result]);
|
||||
return errorJson('微信好友分配失败:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function multiAllotFriendToAccount($data = []){
|
||||
public function multiAllotFriendToAccount($data = [],$errorNum = 0){
|
||||
// 获取授权token
|
||||
$authorization = $this->authorization;
|
||||
if (empty($authorization)) {
|
||||
@@ -264,6 +271,12 @@ class AutomaticAssign extends BaseController
|
||||
if (empty($result)) {
|
||||
return json_encode(['code'=>200,'msg'=>'微信好友分配成功']);
|
||||
} else {
|
||||
Cache::rm('system_authorization_token');
|
||||
Cache::rm('system_refresh_token');
|
||||
$errorNum ++;
|
||||
if ($errorNum <= 3) {
|
||||
$this->multiAllotFriendToAccount($data,$errorNum);
|
||||
}
|
||||
return json_encode(['code'=>500,'msg'=> $result]);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ class WebSocketController extends BaseController
|
||||
'username' => $userData['userName'],
|
||||
'password' => $userData['password']
|
||||
];
|
||||
|
||||
|
||||
// 调用登录接口获取token
|
||||
$headerData = ['client:kefu-client'];
|
||||
$headerData = ['client:kefu-client'];
|
||||
$header = setHeader($headerData, '', 'plain');
|
||||
$result = requestCurl('https://kf.quwanzhi.com:9991/token', $params, 'POST', $header);
|
||||
$result = requestCurl('https://kf.quwanzhi.com:9991/token', $params, 'POST', $header);
|
||||
$result_array = handleApiResponse($result);
|
||||
|
||||
if (isset($result_array['access_token']) && !empty($result_array['access_token'])) {
|
||||
|
||||
Reference in New Issue
Block a user