新增修改群昵称

This commit is contained in:
hugy 2023-01-31 16:10:58 +08:00
parent c05e9ce303
commit c508ae30f8
5 changed files with 84 additions and 1 deletions

View File

@ -19,6 +19,7 @@ release编译好的dll。
3.接口的url为http://127.0.0.1:19088注入成功后直接进行调用即可。
4.特别注意数据库查询接口需要先调用获取到句柄之后,才能进行查询。
5.相关功能只在win11环境下进行简单测试其他环境无法保证。
6.注意个别接口在3.8.0.41版本没有实现,具体参考源码。
#### 编译环境
@ -74,6 +75,8 @@ vcpkg
2022-12-29 新增提取文字功能。
2022-01-02 退出微信登录。
2022-01-31 新增修改群昵称仅支持3.8.1.26)。
### 接口文档:
#### 0.检查微信登录**
@ -499,6 +502,43 @@ vcpkg
```
#### 31.修改自身群昵称**
###### 接口功能
> 增加群成员
###### 接口地址
> [/api/?type=31](/api/?type=31)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|chatRoomId |ture |string| 群id |
|wxid |ture |string| 自己的id只能修改自己的群名片 |
|nickName |ture |string| 修改的昵称 |
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功, 0失败|
|result|string|成功提示|
###### 接口示例
入参:
``` javascript
{
"chatRoomId":"34932563384@chatroom",
"wxid":"wxid_272211111121112",
"nickName":"昵称test"
}
```
响应:
``` javascript
{"code":1,"result":"OK"}
```

Binary file not shown.

View File

@ -381,6 +381,12 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) {
break;
}
case WECHAT_CHATROOM_SET_SELF_NICKNAME: {
wstring room_id = get_http_req_param(hm, j_param, "chatRoomId", is_post);
wstring wxid = get_http_req_param(hm, j_param, "wxid", is_post);
wstring nick = get_http_req_param(hm, j_param, "nickName", is_post);
int success = ModChatRoomMemberNickName(WS2LW(room_id),WS2LW(wxid),WS2LW(nick));
json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump();
break;
}
case WECHAT_DATABASE_GET_HANDLES: {

View File

@ -15,6 +15,7 @@
#define WX_GET_MEMBER_FROM_CHAT_ROOM_OFFSET 0xa749b0
#define WX_INIT_CHAT_ROOM_OFFSET 0xd04d80
#define WX_FREE_CHAT_ROOM_OFFSET 0xa7c620
#define WX_MOD_CHAT_ROOM_MEMBER_NICK_NAME_OFFSET 0xa6f8f0
int GetChatRoomDetailInfo(wchar_t* chat_room_id, ChatRoomInfoInner& room_info) {
int success = 0;
@ -182,3 +183,38 @@ int GetMemberFromChatRoom(wchar_t* chat_room_id,ChatRoomInner & out){
}
return success;
}
int ModChatRoomMemberNickName(wchar_t* chat_room_id,wchar_t* wxid,wchar_t * nick){
int success = 0;
WeChatString chat_room(chat_room_id);
WeChatString self_wxid(wxid);
WeChatString new_nick(nick);
DWORD base = GetWeChatWinBase();
DWORD get_chat_room_mgr_addr = base + WX_CHAT_ROOM_MGR_OFFSET;
DWORD mod_member_nick_name_addr = base + WX_MOD_CHAT_ROOM_MEMBER_NICK_NAME_OFFSET;
DWORD init_chat_msg_addr = base + WX_INIT_CHAT_MSG_OFFSET;
__asm{
PUSHAD
CALL get_chat_room_mgr_addr
SUB ESP,0x14
MOV ECX,ESP
LEA EDI,new_nick
PUSH EDI
CALL init_chat_msg_addr
SUB ESP,0x14
LEA EAX,self_wxid
MOV ECX,ESP
PUSH EAX
CALL init_chat_msg_addr
SUB ESP,0x14
LEA EAX,chat_room
MOV ECX,ESP
PUSH EAX
CALL init_chat_msg_addr
CALL mod_member_nick_name_addr
MOVZX EAX,AL
MOV success,EAX
POPAD
}
return success;
}

View File

@ -7,4 +7,5 @@ int DelMemberFromChatRoom(wchar_t* chat_room_id,wchar_t** wxids,int len);
int AddMemberToChatRoom(wchar_t* chat_room_id, wchar_t** wxids,int len);
int GetMemberFromChatRoom(wchar_t* chat_room_id,ChatRoomInner & out);
int ModChatRoomMemberNickName(wchar_t* chat_room_id,wchar_t* wxid,wchar_t * nick);
#endif