feat: 修改好友备注

This commit is contained in:
hugy 2023-06-08 00:29:52 +08:00
parent 9b541f993e
commit 6d254c5f82
6 changed files with 74 additions and 0 deletions

View File

@ -50,6 +50,7 @@
64.发送小程序
65.退款
66.下载头像
67.修改好友备注
### 接口文档:
@ -2007,6 +2008,48 @@
```
#### 67.修改好友备注**
###### 接口功能
> 修改好友备注
###### 接口地址
> [/api/?type=67](/api/?type=67)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|wxid|string|微信id|
|remark|string|备注内容|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功|
|result|string|成功提示|
###### 接口示例
入参:
``` javascript
{
"wxid":"wxid_agz5q76f11112",
"remark":"123"
}
```
响应:
``` javascript
{"code":1,"result":"OK"}
```
#### 感谢
https://github.com/ljc545w/ComWeChatRobot

View File

@ -80,6 +80,7 @@ typedef enum HTTP_API_ROUTE {
WECHAT_SEND_APP_MSG,
WECHAT_REFUSE,
WECHAT_GET_HEAD_IMG,
WECHAT_MOD_CONTACT_REMARK,
} WECHAT_HTTP_APIS,
*PWECHAT_HTTP_APIS;

View File

@ -285,4 +285,24 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
success = 1;
return success;
}
int ContactMgr::ModifyContactRemark(wchar_t* wxid,wchar_t* remark){
int success = -1;
WeChatString contact(wxid);
WeChatString content(remark);
DWORD mod__addr = base_addr_ + WX_MOD_REMARK_OFFSET;
__asm{
PUSHAD
PUSHFD
LEA EAX,content
PUSH EAX
LEA EAX,contact
PUSH EAX
CALL mod__addr
POPFD
POPAD
}
success = 1;
return success;
}
} // namespace wxhelper

View File

@ -17,6 +17,7 @@ class ContactMgr : public BaseMgr {
int VerifyApply(wchar_t *v3, wchar_t *v4,int permission);
int GetContactByWxid(wchar_t* wxid,ContactProfile& profile);
int GetHeadImage(wchar_t* wxid,wchar_t* url);
int ModifyContactRemark(wchar_t* wxid,wchar_t* remark);
};
} // namespace wxhelper

View File

@ -677,6 +677,14 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
ret = ret_data.dump();
break;
}
case WECHAT_MOD_CONTACT_REMARK:{
wstring wxid = GetWStringParam(j_param, "wxid");
wstring remark = GetWStringParam(j_param, "remark");
int success =g_context.contact_mgr->ModifyContactRemark(WS2LPWS(wxid), WS2LPWS(remark));
json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump();
break;
}
default:
json ret_data = {{"result", "ERROR"}, {"msg", "not support api"}};
ret = ret_data.dump();

View File

@ -86,6 +86,7 @@
#define WX_VERIFY_OK_OFFSET 0xa18bd0
#define WX_NEW_ADD_FRIEND_HELPER_OFFSET 0xa17d50
#define WX_FREE_ADD_FRIEND_HELPER_OFFSET 0xa17e70
#define WX_MOD_REMARK_OFFSET 0xbfd5e0
// pushAttachTask