feat:收藏
This commit is contained in:
1 parent
0593dbe79e
commit
427b43304c
6 files changed
+231
No files matched your search
@@ -450,6 +450,23 @@ std::string HttpDispatch(struct mg_connection *c, struct mg_http_message *hm) {
|
||||
{"code", success}, {"msg", "success"}, {"data", {}}};
|
||||
ret = ret_data.dump();
|
||||
return ret;
|
||||
} else if (mg_http_match_uri(hm, "/api/addFavFromMsg")) {
|
||||
UINT64 msg_id = GetUINT64Param(j_param, "msgId");
|
||||
INT64 success =
|
||||
wxhelper::GlobalContext::GetInstance().mgr->AddFavFromMsg(msg_id);
|
||||
nlohmann::json ret_data = {
|
||||
{"code", success}, {"msg", "success"}, {"data", {}}};
|
||||
ret = ret_data.dump();
|
||||
return ret;
|
||||
} else if (mg_http_match_uri(hm, "/api/addFavFromImage")) {
|
||||
std::wstring wxid = GetWStringParam(j_param, "wxid");
|
||||
std::wstring image_path = GetWStringParam(j_param, "imagePath");
|
||||
INT64 success = wxhelper::GlobalContext::GetInstance().mgr->AddFavFromImage(
|
||||
wxid, image_path);
|
||||
nlohmann::json ret_data = {
|
||||
{"code", success}, {"msg", "success"}, {"data", {}}};
|
||||
ret = ret_data.dump();
|
||||
return ret;
|
||||
} else {
|
||||
nlohmann::json ret_data = {
|
||||
{"code", 200}, {"data", {}}, {"msg", "not support url"}};
|
||||
|
||||
@@ -629,4 +629,58 @@ INT64 Manager::GetSNSNextPage(UINT64 sns_id) {
|
||||
success = sns_next_page(mgr, sns_id);
|
||||
return success;
|
||||
}
|
||||
|
||||
INT64 Manager::AddFavFromMsg(UINT64 msg_id) {
|
||||
INT64 success = -1;
|
||||
UINT64 get_chat_mgr_addr = base_addr_ + offset::kGetChatMgr;
|
||||
UINT64 get_by_local_id_addr = base_addr_ + offset::kGetMgrByPrefixLocalId;
|
||||
UINT64 add_fav_addr = base_addr_ + offset::kAddFavFromMsg;
|
||||
UINT64 get_favorite_mgr_addr = base_addr_ + offset::kGetFavoriteMgr;
|
||||
UINT64 free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
|
||||
func::__GetMgrByPrefixLocalId get_by_local_id = (func::__GetMgrByPrefixLocalId)get_by_local_id_addr;
|
||||
UINT64 new_chat_msg_addr = base_addr_ + offset::kChatMsgInstanceCounter;
|
||||
|
||||
func::__AddFavFromMsg add_fav = (func::__AddFavFromMsg)add_fav_addr;
|
||||
func::__GetChatMgr get_chat_mgr = (func::__GetChatMgr)get_chat_mgr_addr;
|
||||
func::__GetFavoriteMgr get_favorite_mgr = (func::__GetFavoriteMgr)get_favorite_mgr_addr;
|
||||
func::__FreeChatMsg free_chat_msg = (func::__FreeChatMsg)free_chat_msg_addr;
|
||||
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
|
||||
|
||||
INT64 index = 0;
|
||||
INT64 local_id = DB::GetInstance().GetLocalIdByMsgId(msg_id, index);
|
||||
if (local_id <= 0 || index >> 32 == 0) {
|
||||
success = -2;
|
||||
return success;
|
||||
}
|
||||
char chat_msg[0x460]= {0};
|
||||
LARGE_INTEGER l;
|
||||
l.HighPart = index >> 32;
|
||||
l.LowPart = (DWORD)local_id;
|
||||
UINT64 p_chat_msg = new_chat_msg(reinterpret_cast<UINT64>(&chat_msg));
|
||||
|
||||
get_chat_mgr();
|
||||
get_by_local_id(l.QuadPart,p_chat_msg);
|
||||
UINT64 mgr = get_favorite_mgr();
|
||||
success = add_fav(mgr,p_chat_msg);
|
||||
free_chat_msg(p_chat_msg);
|
||||
return success;
|
||||
}
|
||||
|
||||
INT64 Manager::AddFavFromImage(const std::wstring &wxid,
|
||||
const std::wstring &image_path) {
|
||||
INT64 success = -1;
|
||||
UINT64 get_favorite_mgr_addr = base_addr_ + offset::kGetFavoriteMgr;
|
||||
UINT64 add_fav_from_image_addr = base_addr_ + offset::kAddFavFromImage;
|
||||
prototype::WeChatString *send_id = BuildWechatString(wxid);
|
||||
prototype::WeChatString *path = BuildWechatString(image_path);
|
||||
func::__GetFavoriteMgr get_favorite_mgr =
|
||||
(func::__GetFavoriteMgr)get_favorite_mgr_addr;
|
||||
func::__AddFavFromImage add_fav_from_image =
|
||||
(func::__AddFavFromImage)add_fav_from_image_addr;
|
||||
UINT64 mgr = get_favorite_mgr();
|
||||
success = add_fav_from_image(mgr, reinterpret_cast<UINT64>(path),
|
||||
reinterpret_cast<UINT64>(send_id));
|
||||
return success;
|
||||
}
|
||||
|
||||
} // namespace wxhelper
|
||||
@@ -34,6 +34,9 @@ class Manager {
|
||||
INT64 ForwardMsg(UINT64 msg_id, const std::wstring& wxid);
|
||||
INT64 GetSNSFirstPage();
|
||||
INT64 GetSNSNextPage(UINT64 sns_id);
|
||||
INT64 AddFavFromMsg(UINT64 msg_id);
|
||||
INT64 AddFavFromImage(const std::wstring& wxid,
|
||||
const std::wstring& image_path);
|
||||
|
||||
private:
|
||||
UINT64 base_addr_;
|
||||
|
||||
@@ -246,6 +246,11 @@ typedef UINT64 (*__GetSNSNextPageScene)(UINT64,UINT64);
|
||||
|
||||
typedef UINT64 (*__GetSNSDataMgr)();
|
||||
typedef UINT64 (*__GetSnsTimeLineMgr)();
|
||||
typedef UINT64 (*__GetMgrByPrefixLocalId)(UINT64,UINT64);
|
||||
typedef UINT64 (*__AddFavFromMsg)(UINT64,UINT64);
|
||||
typedef UINT64 (*__GetChatMgr)();
|
||||
typedef UINT64 (*__GetFavoriteMgr)();
|
||||
typedef UINT64 (*__AddFavFromImage)(UINT64,UINT64,UINT64);
|
||||
|
||||
|
||||
} // namespace function
|
||||
@@ -358,6 +363,11 @@ const UINT64 kSNSGetFirstPage = 0x1a51dd0;
|
||||
const UINT64 kSNSGetNextPageScene = 0x1a77240;
|
||||
const UINT64 kSNSDataMgr = 0xeebda0;
|
||||
const UINT64 kSNSTimeLineMgr = 0x19e83a0;
|
||||
const UINT64 kGetMgrByPrefixLocalId = 0xe4add0;
|
||||
const UINT64 kAddFavFromMsg = 0x1601520;
|
||||
const UINT64 kGetChatMgr = 0x8f0400;
|
||||
const UINT64 kGetFavoriteMgr = 0x8c69b0;
|
||||
const UINT64 kAddFavFromImage = 0x160b920;
|
||||
|
||||
} // namespace offset
|
||||
} // namespace V3_9_5_81
|
||||
|
||||
Reference in new issue
Block a user