修复切换好友无法切换问题
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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user