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

Function getWxCode

wxapp/ztkd.js:97–108  ·  view source on GitHub ↗
(openid)

Source from the content-addressed store, hash-verified

95}
96
97async function getWxCode(openid) {
98 if (!WX_AUTH) throw new Error("未配置 wx_auth,无法从 wx_server 获取 code");
99 const { status, data } = await request({
100 method: "POST",
101 url: `${WX_SERVER_URL}/wx/code`,
102 headers: { auth: WX_AUTH, "content-type": "application/json" },
103 data: { appid: APP.appid, openid },
104 });
105 const code = data?.data?.code || data?.code;
106 if (status !== 200 || !code) throw new Error(`获取code失败 HTTP ${status}: ${short(data)}`);
107 return code;
108}
109
110class ZtoExpress {
111 constructor(account, index) {

Callers 1

loginMethod · 0.70

Calls 2

requestFunction · 0.70
shortFunction · 0.70

Tested by

no test coverage detected