群创建 代码优化

This commit is contained in:
wong
2025-08-29 09:51:00 +08:00
parent e050da41e5
commit 26e519bec0
6 changed files with 570 additions and 82 deletions

View File

@@ -13,16 +13,12 @@ class WechatChatroomController extends BaseController
* 获取微信群聊列表
* @return \think\response\Json
*/
public function getlist($pageIndex = '',$pageSize = '',$isInner = false, $isDel = '')
public function getlist($data = [],$isInner = false, $isDel = '')
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
$authorization = $this->authorization;
if (empty($authorization)) {
if($isInner){
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}else{
return errorJson('缺少授权信息');
}
}
try {
@@ -36,15 +32,15 @@ class WechatChatroomController extends BaseController
// 构建请求参数
$params = [
'keyword' => $this->request->param('keyword', ''),
'wechatAccountKeyword' => $this->request->param('wechatAccountKeyword', ''),
'isDeleted' => $this->request->param('isDeleted', $isDeleted),
'allotAccountId' => $this->request->param('allotAccountId', ''),
'groupId' => $this->request->param('groupId', ''),
'wechatChatroomId' => $this->request->param('wechatChatroomId', 0),
'memberKeyword' => $this->request->param('memberKeyword', ''),
'pageIndex' => !empty($pageIndex) ? $pageIndex : input('pageIndex', 0),
'pageSize' => !empty($pageSize) ? $pageSize : input('pageSize', 20)
'keyword' => $data['keyword'] ?? '',
'wechatAccountKeyword' => $data['wechatAccountKeyword'] ?? '',
'isDeleted' => $data['isDeleted'] ?? $isDeleted ,
'allotAccountId' => $data['allotAccountId'] ?? '',
'groupId' => $data['groupId'] ?? '',
'wechatChatroomId' => $data['wechatChatroomId'] ?? '',
'memberKeyword' => $data['memberKeyword'] ?? '',
'pageIndex' => $data['pageIndex'] ?? 1,
'pageSize' => $data['pageSize'] ?? 20
];
// 设置请求头