feat: add 新增二维码登录地址

This commit is contained in:
MiaoWoo 2023-05-25 10:09:48 +08:00
parent 83d779c072
commit bce8ec25af
4 changed files with 10 additions and 1 deletions

View File

@ -181,6 +181,11 @@ int AccountMgr::GetSelfInfo(SelfInfoInner &out) {
return 1; return 1;
} }
string AccountMgr::GetLoginUrl() {
DWORD login_url_addr = base_addr_ + WX_LOGIN_URL_OFFSET;
return "http://weixin.qq.com/x/" + std::string(reinterpret_cast<char*>(*(DWORD*)login_url_addr));
}
int AccountMgr::CheckLogin() { int AccountMgr::CheckLogin() {
int success = -1; int success = -1;
DWORD accout_service_addr = base_addr_ + WX_ACCOUNT_SERVICE_OFFSET; DWORD accout_service_addr = base_addr_ + WX_ACCOUNT_SERVICE_OFFSET;

View File

@ -8,6 +8,9 @@ namespace wxhelper{
public: public:
explicit AccountMgr(DWORD base); explicit AccountMgr(DWORD base);
~AccountMgr(); ~AccountMgr();
std::string GetLoginUrl();
int GetSelfInfo(SelfInfoInner& out); int GetSelfInfo(SelfInfoInner& out);
int CheckLogin(); int CheckLogin();

View File

@ -94,7 +94,7 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
case WECHAT_IS_LOGIN: { case WECHAT_IS_LOGIN: {
int success = -1; int success = -1;
success = g_context.account_mgr->CheckLogin(); success = g_context.account_mgr->CheckLogin();
json ret_data = {{"result", "OK"}, {"code", success}}; json ret_data = {{"result", "OK"}, {"code", success}, {"login_url", g_context.account_mgr->GetLoginUrl()}};
ret = ret_data.dump(); ret = ret_data.dump();
break; break;
} }

View File

@ -116,6 +116,7 @@
//login //login
#define WX_LOGIN_URL_OFFSET 0x3040DE8
#define WX_LOGOUT_OFFSET 0xe58870 #define WX_LOGOUT_OFFSET 0xe58870
#define WX_ACCOUNT_SERVICE_OFFSET 0x768c80 #define WX_ACCOUNT_SERVICE_OFFSET 0x768c80
#define WX_GET_APP_DATA_SAVE_PATH_OFFSET 0xf3a610 #define WX_GET_APP_DATA_SAVE_PATH_OFFSET 0xf3a610