diff --git a/doc/3.9.2.26.md b/doc/3.9.2.26.md index dadc6ae..394dbe8 100644 --- a/doc/3.9.2.26.md +++ b/doc/3.9.2.26.md @@ -41,6 +41,8 @@ 62.发送公众号消息 63.转发公众号消息 64.发送小程序 +65.退款 +66.下载头像 ### 接口文档: @@ -1923,7 +1925,7 @@ > 收到转账消息后,自动退款。type=49 即是转账消息。 ###### 接口地址 -> [/api/?type=45](/api/?type=65) +> [/api/?type=65](/api/?type=65) ###### HTTP请求方式 > POST JSON @@ -1956,4 +1958,44 @@ 响应: ``` javascript {"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"} ``` \ No newline at end of file diff --git a/src/api_route.h b/src/api_route.h index 893770f..346ca94 100644 --- a/src/api_route.h +++ b/src/api_route.h @@ -79,6 +79,7 @@ typedef enum HTTP_API_ROUTE { WECHAT_FORWARD_PUBLIC_MSG_BY_SVRID, WECHAT_SEND_APP_MSG, WECHAT_REFUSE, + WECHAT_GET_HEAD_IMG, } WECHAT_HTTP_APIS, *PWECHAT_HTTP_APIS; diff --git a/src/contact_mgr.cc b/src/contact_mgr.cc index 1bc4e77..3db9694 100644 --- a/src/contact_mgr.cc +++ b/src/contact_mgr.cc @@ -255,4 +255,30 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) { success = 1; 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 \ No newline at end of file diff --git a/src/contact_mgr.h b/src/contact_mgr.h index 6a630f8..b212495 100644 --- a/src/contact_mgr.h +++ b/src/contact_mgr.h @@ -16,6 +16,7 @@ class ContactMgr : public BaseMgr { int AddFriendByWxid(wchar_t* wxid,wchar_t* msg); 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); }; } // namespace wxhelper diff --git a/src/http_handler.cc b/src/http_handler.cc index fed25df..11b9250 100644 --- a/src/http_handler.cc +++ b/src/http_handler.cc @@ -429,9 +429,9 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) { wstring wxid = GetWStringParam(j_param, "wxid"); wstring transcationid = GetWStringParam(j_param, "transcationId"); 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)); - json ret_data = {{"msg", response}, {"result", "OK"}}; + json ret_data = {{"code", success}, {"result", "OK"}}; ret = ret_data.dump(); break; } @@ -654,9 +654,17 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) { wstring wxid = GetWStringParam(j_param, "wxid"); wstring transcationid = GetWStringParam(j_param, "transcationId"); 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)); - 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(); break; } diff --git a/src/wechat_function.h b/src/wechat_function.h index e5d6358..b8751d3 100644 --- a/src/wechat_function.h +++ b/src/wechat_function.h @@ -26,7 +26,9 @@ // sendMessageMgr #define WX_SEND_MESSAGE_MGR_OFFSET 0x768be0 // shareRecordMgr -#define WX_SHARE_RECORD_MGR_OFFSET 0x78d5f0 +#define WX_SHARE_RECORD_MGR_OFFSET 0x78d5f0 +// headImageMgr +#define WX_HEAD_IMAGE_MGR_OFFSET 0x808850 // setChatMsgValue @@ -203,6 +205,8 @@ #define FREE_WA_UPDATABLE_MSG_INFO_OFFSET 0x79d4c0 #define SEND_APP_MSG_OFFSET 0xfe8e40 +// query head image then download +#define QUERY_THEN_DOWNLOAD_OFFSET 0xc642f0 /*******************hook*********************************************/