MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / getWxCode

Function getWxCode

wxapp/txdt.js:110–121  ·  view source on GitHub ↗
(openid)

Source from the content-addressed store, hash-verified

108}
109
110async function getWxCode(openid) {
111 if (!WX_AUTH) throw new Error("未配置 wx_auth,无法从 wx_server 获取 code");
112 const { status, data } = await request({
113 method: "POST",
114 url: `${WX_SERVER_URL}/wx/code`,
115 headers: { auth: WX_AUTH, "content-type": "application/json" },
116 data: { appid: APP.appid, openid },
117 });
118 const code = data?.data?.code || data?.code;
119 if (status !== 200 || !code) throw new Error(`获取code失败 HTTP ${status}: ${short(data)}`);
120 return code;
121}
122
123function loginSign({ appId, sessionId = "-1", openId, userId, postBody }) {
124 const reqId = md5(`${Math.random()} ${Date.now()}`);

Callers 1

miniLoginMethod · 0.70

Calls 2

requestFunction · 0.70
shortFunction · 0.70

Tested by

no test coverage detected