feat: 头像

This commit is contained in:
hugy 2023-06-02 14:28:25 +08:00
parent 1b8c3a851c
commit 63ac97c864
6 changed files with 88 additions and 6 deletions

View File

@ -41,6 +41,8 @@
62.发送公众号消息 62.发送公众号消息
63.转发公众号消息 63.转发公众号消息
64.发送小程序 64.发送小程序
65.退款
66.下载头像
### 接口文档: ### 接口文档:
@ -1923,7 +1925,7 @@
> 收到转账消息后自动退款。type=49 即是转账消息。 > 收到转账消息后自动退款。type=49 即是转账消息。
###### 接口地址 ###### 接口地址
> [/api/?type=45](/api/?type=65) > [/api/?type=65](/api/?type=65)
###### HTTP请求方式 ###### HTTP请求方式
> POST JSON > POST JSON
@ -1957,3 +1959,43 @@
``` javascript ``` javascript
{"code":1,"result":"OK"} {"code":1,"result":"OK"}
``` ```
#### 66.查询或下载头像**
###### 接口功能
> 暂时没用的功能
###### 接口地址
> [/api/?type=66](/api/?type=66)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
|wxid|string|微信id|
|imageUrl|string|头像地址|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,1成功|
|result|string|成功提示|
###### 接口示例
入参:
``` javascript
{
"wxid":"wxid_agz5q76f11112",
"imageUrl":""
}
```
响应:
``` javascript
{"code":1,"result":"OK"}
```

View File

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

View File

@ -255,4 +255,30 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) {
success = 1; success = 1;
return success; return success;
} }
int ContactMgr::GetHeadImage(wchar_t* wxid,wchar_t* url){
int success = -1;
WeChatString contact(wxid);
WeChatString img_url(url);
DWORD head_image_mgr_addr = base_addr_ + WX_HEAD_IMAGE_MGR_OFFSET;
DWORD get_img_download_addr = base_addr_ + QUERY_THEN_DOWNLOAD_OFFSET;
char temp[0x8] ={0};
__asm{
PUSHAD
PUSHFD
CALL head_image_mgr_addr
LEA ECX,img_url
PUSH ECX
LEA ECX,contact
PUSH ECX
LEA ECX,temp
PUSH ECX
MOV ECX,EAX
CALL get_img_download_addr
POPFD
POPAD
}
success = 1;
return success;
}
} // namespace wxhelper } // namespace wxhelper

View File

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

View File

@ -429,9 +429,9 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
wstring wxid = GetWStringParam(j_param, "wxid"); wstring wxid = GetWStringParam(j_param, "wxid");
wstring transcationid = GetWStringParam(j_param, "transcationId"); wstring transcationid = GetWStringParam(j_param, "transcationId");
wstring transferid = GetWStringParam(j_param, "transferId"); wstring transferid = GetWStringParam(j_param, "transferId");
BOOL response =g_context.misc_mgr->DoConfirmReceipt( int success =g_context.misc_mgr->DoConfirmReceipt(
WS2LPWS(wxid), WS2LPWS(transcationid), WS2LPWS(transferid)); WS2LPWS(wxid), WS2LPWS(transcationid), WS2LPWS(transferid));
json ret_data = {{"msg", response}, {"result", "OK"}}; json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump(); ret = ret_data.dump();
break; break;
} }
@ -654,9 +654,17 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
wstring wxid = GetWStringParam(j_param, "wxid"); wstring wxid = GetWStringParam(j_param, "wxid");
wstring transcationid = GetWStringParam(j_param, "transcationId"); wstring transcationid = GetWStringParam(j_param, "transcationId");
wstring transferid = GetWStringParam(j_param, "transferId"); wstring transferid = GetWStringParam(j_param, "transferId");
BOOL response =g_context.misc_mgr->DoRefuseReceipt( int success =g_context.misc_mgr->DoRefuseReceipt(
WS2LPWS(wxid), WS2LPWS(transcationid), WS2LPWS(transferid)); WS2LPWS(wxid), WS2LPWS(transcationid), WS2LPWS(transferid));
json ret_data = {{"msg", response}, {"result", "OK"}}; json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump();
break;
}
case WECHAT_GET_HEAD_IMG:{
wstring wxid = GetWStringParam(j_param, "wxid");
wstring url = GetWStringParam(j_param, "imageUrl");
int success =g_context.contact_mgr->GetHeadImage(WS2LPWS(wxid), WS2LPWS(url));
json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump(); ret = ret_data.dump();
break; break;
} }

View File

@ -27,6 +27,8 @@
#define WX_SEND_MESSAGE_MGR_OFFSET 0x768be0 #define WX_SEND_MESSAGE_MGR_OFFSET 0x768be0
// shareRecordMgr // shareRecordMgr
#define WX_SHARE_RECORD_MGR_OFFSET 0x78d5f0 #define WX_SHARE_RECORD_MGR_OFFSET 0x78d5f0
// headImageMgr
#define WX_HEAD_IMAGE_MGR_OFFSET 0x808850
// setChatMsgValue // setChatMsgValue
@ -203,6 +205,8 @@
#define FREE_WA_UPDATABLE_MSG_INFO_OFFSET 0x79d4c0 #define FREE_WA_UPDATABLE_MSG_INFO_OFFSET 0x79d4c0
#define SEND_APP_MSG_OFFSET 0xfe8e40 #define SEND_APP_MSG_OFFSET 0xfe8e40
// query head image then download
#define QUERY_THEN_DOWNLOAD_OFFSET 0xc642f0
/*******************hook*********************************************/ /*******************hook*********************************************/