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

Function getWxCode

wxapp/skyworth.js:116–127  ·  view source on GitHub ↗
(openid)

Source from the content-addressed store, hash-verified

114}
115
116async function getWxCode(openid) {
117 if (!WX_AUTH) throw new Error("未配置 wx_auth,无法从 wx_server 获取 code");
118 const { status, data } = await request({
119 method: "POST",
120 url: `${WX_SERVER_URL}/wx/code`,
121 headers: { auth: WX_AUTH },
122 data: { appid: MINI_APP_ID, openid },
123 });
124 const code = data?.data?.code || data?.code;
125 if (status !== 200 || !code) throw new Error(`获取 code 失败 HTTP ${status}: ${short(data)}`);
126 return code;
127}
128
129class Skyworth {
130 constructor(rawAccount, index) {

Callers 1

loginMethod · 0.70

Calls 2

requestFunction · 0.70
shortFunction · 0.70

Tested by

no test coverage detected