MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / getWxCode

Function getWxCode

wxapp/oppo.js:99–114  ·  view source on GitHub ↗
(openid)

Source from the content-addressed store, hash-verified

97}
98
99async function getWxCode(openid) {
100 if (!WX_AUTH) throw new Error("未配置 wx_auth,无法从 wx_server 获取 code");
101 const { status, data } = await request({
102 method: "POST",
103 url: `${WX_SERVER_URL}/wx/code`,
104 headers: {
105 auth: WX_AUTH,
106 "content-type": "application/json",
107 Referer: `https://servicewechat.com/${APP.appid}/${APP.version}/page-frame.html`,
108 },
109 data: { appid: APP.appid, openid },
110 });
111 const code = data?.data?.code || data?.code;
112 if (status !== 200 || !code) throw new Error(`获取 code 失败 HTTP ${status}: ${short(data)}`);
113 return code;
114}
115
116class OppoTask {
117 constructor(rawAccount, index) {

Callers 1

loginMethod · 0.70

Calls 2

requestFunction · 0.70
shortFunction · 0.70

Tested by

no test coverage detected