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

Method loginByWxCode

wxapp/lvbizi.js:198–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196 }
197
198 async loginByWxCode() {
199 try {
200 const code = await this.getWxCode();
201 const data = await this.request({
202 method: "POST",
203 apiPath: "wscshop/weapp/authorize.json",
204 skipToken: true,
205 data: {
206 appId: MINI_APP_ID,
207 clientId: CLIENT_ID,
208 clientSecret: CLIENT_SECRET,
209 grantType: GRANT_TYPE,
210 code,
211 },
212 });
213 this.token = data || {};
214 this.saveCachedToken();
215 $.log(`账号[${this.index}] 登录成功: ${data?.nick_name || data?.nickName || ""} ${maskPhone(data?.mobile)}`);
216 } catch (e) {
217 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
218 }
219 }
220
221 async checkToken() {
222 try {

Callers 1

runMethod · 0.95

Calls 5

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

Tested by

no test coverage detected