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

Function wxServerCode

wxapp/wps.js:199–213  ·  view source on GitHub ↗
(openid, appid)

Source from the content-addressed store, hash-verified

197}
198
199async function wxServerCode(openid, appid) {
200 const { data } = await axios.post(
201 `${wechat.serverUrl}/wx/code`,
202 { appid, openid },
203 {
204 headers: { auth: wechat.auth },
205 timeout: 30000,
206 validateStatus: () => true,
207 }
208 );
209 if (!data?.status) throw new Error(data?.message || "wx_server 获取 code 失败");
210 const code = data.data?.code || data.code;
211 if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`);
212 return code;
213}
214
215async function accountRequest(method, urlPath, { data = null, cookies = {}, secret = "" } = {}) {
216 const url = `${ACCOUNT_BASE}${urlPath}`;

Callers 2

loginMethod · 0.85
getMainCodeMethod · 0.85

Calls 1

postMethod · 0.45

Tested by

no test coverage detected