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

Method getWxCode

wxapp/junpinhui.js:213–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211 }
212
213 async getWxCode() {
214 if (!this.openid) throw new Error("缺少 openid,无法自动登录");
215 const { data } = await wechat.getCode(this.openid);
216 if (!data?.status) throw new Error(data?.message || "wx_server 获取 code 失败");
217 const code = data.data?.code || data.code;
218 if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`);
219 return code;
220 }
221
222 async login() {
223 const code = await this.getWxCode();

Callers 1

loginMethod · 0.95

Calls 1

getCodeMethod · 0.45

Tested by

no test coverage detected