Merge branch 'develop' into yongpxu-dev

# Conflicts:
#	Server/application/cunkebao/controller/plan/PostCreateAddFriendPlanV1Controller.php   resolved by develop version
#	Server/application/cunkebao/controller/plan/PostUpdateAddFriendPlanV1Controller.php   resolved by develop version
This commit is contained in:
笔记本里的永平
2025-07-17 10:20:28 +08:00
8 changed files with 437 additions and 111 deletions

View File

@@ -46,28 +46,28 @@ class AutomaticAssign extends BaseController
}
$params = [
'accountKeyword' => '',
'addFrom' => [],
'allotAccountId' => '',
'containAllLabel' => false,
'containSubDepartment' => false,
'departmentId' => '',
'extendFields' => [],
'friendKeyword' => '',
'friendPhoneKeyword' => '',
'friendPinYinKeyword' => '',
'friendRegionKeyword' => '',
'friendRemarkKeyword' => '',
'gender' => '',
'groupId' => null,
'isByRule' => false,
'accountKeyword' => !empty($data['accountKeyword']) ? $data['accountKeyword'] : '',
'addFrom' => !empty($data['addFrom']) ? $data['addFrom'] : [],
'allotAccountId' => !empty($data['allotAccountId']) ? $data['allotAccountId'] : '',
'containAllLabel' => !empty($data['containAllLabel']) ? $data['containAllLabel'] : false,
'containSubDepartment' => !empty($data['containSubDepartment']) ? $data['containSubDepartment'] : false,
'departmentId' => !empty($data['departmentId']) ? $data['departmentId'] : '',
'extendFields' => !empty($data['extendFields']) ? $data['extendFields'] : [],
'friendKeyword' => !empty($data['friendKeyword']) ? $data['friendKeyword'] : '',
'friendPhoneKeyword' => !empty($data['friendPhoneKeyword']) ? $data['friendPhoneKeyword'] : '',
'friendPinYinKeyword' => !empty($data['friendPinYinKeyword']) ? $data['friendPinYinKeyword'] : '',
'friendRegionKeyword' => !empty($data['friendRegionKeyword']) ? $data['friendRegionKeyword'] : '',
'friendRemarkKeyword' => !empty($data['friendRemarkKeyword']) ? $data['friendRemarkKeyword'] : '',
'gender' => !empty($data['gender']) ? $data['gender'] : '',
'groupId' => !empty($data['groupId']) ? $data['groupId'] : null,
'isByRule' => !empty($data['isByRule']) ? $data['isByRule'] : false,
'isDeleted' => $isDeleted,
'isPass' => true,
'keyword' => '',
'labels' => [],
'pageIndex' => 0,
'pageSize' => 100,
'preFriendId' => '',
'isPass' => !empty($data['isPass']) ? $data['isPass'] : true,
'keyword' => !empty($data['keyword']) ? $data['keyword'] : '',
'labels' => !empty($data['labels']) ? $data['labels'] : [],
'pageIndex' => !empty($data['pageIndex']) ? $data['pageIndex'] : 0,
'pageSize' => !empty($data['pageSize']) ? $data['pageSize'] : 100,
'preFriendId' => !empty($data['preFriendId']) ? $data['preFriendId'] : '',
'toAccountId' => $toAccountId,
'wechatAccountKeyword' => $wechatAccountKeyword
];
@@ -282,4 +282,64 @@ class AutomaticAssign extends BaseController
}
/**
* 分配搜索结果
* @param array $data 请求参数
* @return \think\response\Json
*/
public function allotSearchResult($data = [])
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}
try {
$params = [
'accountKeyword' => !empty($data['accountKeyword']) ? $data['accountKeyword'] : '',
'addFrom' => !empty($data['addFrom']) ? $data['addFrom'] : [],
'allotAccountId' => !empty($data['allotAccountId']) ? $data['allotAccountId'] : '',
'containAllLabel' => !empty($data['containAllLabel']) ? $data['containAllLabel'] : false,
'containSubDepartment' => !empty($data['containSubDepartment']) ? $data['containSubDepartment'] : false,
'departmentId' => !empty($data['departmentId']) ? $data['departmentId'] : '',
'extendFields' => !empty($data['extendFields']) ? json_encode($data['extendFields']) : json_encode([]),
'friendKeyword' => !empty($data['friendKeyword']) ? $data['friendKeyword'] : '',
'friendPhoneKeyword' => !empty($data['friendPhoneKeyword']) ? $data['friendPhoneKeyword'] : '',
'friendPinYinKeyword' => !empty($data['friendPinYinKeyword']) ? $data['friendPinYinKeyword'] : '',
'friendRegionKeyword' => !empty($data['friendRegionKeyword']) ? $data['friendRegionKeyword'] : '',
'friendRemarkKeyword' => !empty($data['friendRemarkKeyword']) ? $data['friendRemarkKeyword'] : '',
'gender' => !empty($data['gender']) ? $data['gender'] : '',
'groupId' => !empty($data['groupId']) ? $data['groupId'] : null,
'isByRule' => !empty($data['isByRule']) ? $data['isByRule'] : false,
'isDeleted' => !empty($data['isDeleted']) ? $data['isDeleted'] : false,
'isPass' => !empty($data['isPass']) ? $data['isPass'] : true,
'keyword' => !empty($data['keyword']) ? $data['keyword'] : '',
'labels' => !empty($data['labels']) ? $data['labels'] : [],
'pageIndex' => !empty($data['pageIndex']) ? $data['pageIndex'] : 0,
'pageSize' => !empty($data['pageSize']) ? $data['pageSize'] : 20,
'preFriendId' => !empty($data['preFriendId']) ? $data['preFriendId'] : '',
'toAccountId' => !empty($data['toAccountId']) ? $data['toAccountId'] : '',
'wechatAccountKeyword' => !empty($data['wechatAccountKeyword']) ? $data['wechatAccountKeyword'] : ''
];
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求
$result = requestCurl($this->baseUrl . 'api/WechatFriend/allotSearchResult', $params, 'POST', $header, 'json');
$response = handleApiResponse($result);
if($response){
return json_encode(['code'=>200,'msg'=>'分配成功']);
}else{
return json_encode(['code'=>500,'msg'=>$response]);
}
} catch (\Exception $e) {
return json_encode(['code'=>500,'msg'=>'微信好友分配失败:' . $e->getMessage()]);
}
}
}