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

Method loginByWxCode

wxapp/yunduodingding.js:197–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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