代码提交

This commit is contained in:
wong
2025-07-11 16:34:50 +08:00
parent 894efc20ff
commit 9193004c54
2 changed files with 109 additions and 13 deletions

View File

@@ -205,7 +205,7 @@ class AutomaticAssign extends BaseController
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求
$url = $this->baseUrl . 'api/WechatFriend/allot?wechatFriendId='.$wechatFriendId.'&notifyReceiver='.$notifyReceiver.'&comment='.$comment.'&toAccountId='.$toAccountId.'&optFrom='.$optFrom;
$result = requestCurl($url, [], 'PUT', $header, 'json');
@@ -231,4 +231,45 @@ class AutomaticAssign extends BaseController
}
}
}
public function multiAllotFriendToAccount($data = []){
// 获取授权token
$authorization = $this->authorization;
if (empty($authorization)) {
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}
$wechatFriendIds = !empty($data['wechatFriendIds']) ? $data['wechatFriendIds'] : input('wechatFriendIds', []);
$toAccountId = !empty($data['toAccountId']) ? $data['toAccountId'] : input('toAccountId', 0);
$notifyReceiver = !empty($data['notifyReceiver']) ? $data['notifyReceiver'] : input('notifyReceiver', false);
// 参数验证
if (empty($wechatFriendId)) {
return errorJson('微信好友ID不能为空');
}
if (empty($toAccountId)) {
return errorJson('目标账号ID不能为空');
}
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求
$url = $this->baseUrl . 'api/WechatFriend/multiAllotFriendToAccount?wechatFriendIds='.$wechatFriendIds.'&toAccountId='.$toAccountId.'&notifyReceiver='.$notifyReceiver;
$result = requestCurl($url, [], 'PUT', $header, 'json');
if (empty($result)) {
return json_encode(['code'=>200,'msg'=>'微信好友分配成功']);
} else {
return json_encode(['code'=>500,'msg'=> $result]);
}
}
}