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

Method loginByCode

wxapp/feihe.js:196–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194 }
195
196 async loginByCode() {
197 const code = await this.getWxCode();
198 const result = await this.request({
199 apiPath: "/api/starMember/getUserToken",
200 query: { code },
201 token: "",
202 });
203 const data = result.data || {};
204 this.token = result.token || data.token || "";
205 this.userInfo = {
206 crmId: data.crmId,
207 openId: data.openId,
208 unionId: data.unionId,
209 loginStatus: data.loginStatus,
210 expireTime: data.expireTime,
211 };
212 if (!this.token) throw new Error(`登录成功但未返回token: ${JSON.stringify(result)}`);
213 this.saveCachedToken();
214 $.log(`账号[${this.index}] code登录成功: ${data.crmId || data.openId || ""} token=${maskToken(this.token)}`);
215 }
216
217 async checkToken() {
218 try {

Callers 1

runMethod · 0.95

Calls 5

getWxCodeMethod · 0.95
requestMethod · 0.95
saveCachedTokenMethod · 0.95
maskTokenFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected