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

Function getWxCode

wxapp/fhxmh.js:71–82  ·  view source on GitHub ↗
(appid, openid)

Source from the content-addressed store, hash-verified

69}
70
71async function getWxCode(appid, openid) {
72 if (!WX_AUTH) throw new Error("未配置 wx_auth");
73 const { status, data } = await request({
74 method: "POST",
75 url: `${WX_SERVER_URL}/wx/code`,
76 headers: { auth: WX_AUTH, "content-type": "application/json" },
77 data: { appid, openid },
78 });
79 const code = data?.code || data?.data?.code || data?.phoneCode || data?.data?.phoneCode;
80 if (status !== 200 || !code) throw new Error(`获取code失败 HTTP ${status}: ${short(data)}`);
81 return code;
82}
83
84class FeiheMom {
85 constructor(openid) {

Callers 1

loginMethod · 0.70

Calls 2

requestFunction · 0.70
shortFunction · 0.70

Tested by

no test coverage detected