微信分组及消息置顶

This commit is contained in:
wong
2025-12-02 17:47:22 +08:00
parent 5f5b567749
commit 242065d298
5 changed files with 316 additions and 19 deletions

View File

@@ -36,6 +36,7 @@ class DataProcessing extends BaseController
'CmdChatroomOperate', //修改群信息 {chatroomName群名、announce公告、extra公告、wechatAccountId、wechatChatroomId}
'CmdNewMessage', //接收消息
'CmdSendMessageResult', //更新消息状态
'CmdPinToTop', //置顶
];
if (empty($type) || empty($wechatAccountId)) {
@@ -164,6 +165,41 @@ class DataProcessing extends BaseController
$msg = '更新消息状态成功';
break;
case 'CmdPinToTop': //置顶
$wechatFriendId = $this->request->param('wechatFriendId', 0);
$wechatChatroomId = $this->request->param('wechatChatroomId', 0);
$isTop = $this->request->param('isTop', null);
if ($isTop === null) {
return ResponseHelper::error('isTop不能为空');
}
if (empty($wechatFriendId) && empty($wechatChatroomId)) {
return ResponseHelper::error('wechatFriendId或chatroomId至少提供一个');
}
if (!empty($wechatFriendId)){
$data = WechatFriendModel::where(['id' => $wechatFriendId,'wechatAccountId' => $wechatAccountId])->find();
$msg = $isTop == 1 ? '已置顶' : '取消置顶';
if(empty($data)){
return ResponseHelper::error('好友不存在');
}
}
if (!empty($wechatChatroomId)){
$data = WechatChatroomModel::where(['id' => $wechatChatroomId,'wechatAccountId' => $wechatAccountId])->find();
$msg = $isTop == 1 ? '已置顶' : '取消置顶';
if(empty($data)){
return ResponseHelper::error('群聊不存在');
}
}
$data->updateTime = time();
$data->isTop = $isTop;
$data->save();
break;
}
return ResponseHelper::success('',$msg,$codee);
}