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

Method loginByWxCode

wxapp/casetify.js:181–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179 }
180
181 async loginByWxCode() {
182 try {
183 const code = await this.getLoginCode();
184 const result = await this.request("GET", `estore/member/onLogin/${code}/${WECHAT_ID}`, {}, { auth: true });
185 const user = result.data || {};
186 this.applyToken({
187 token: user.token,
188 memberId: user.id,
189 customerNo: user.customerNo,
190 phone: user.phone,
191 levels: user.levels,
192 });
193 this.saveCachedToken();
194 $.log(`账号[${this.index}] 登录成功: ${this.levels || "会员"} ${this.customerNo || this.memberId || ""}`);
195 } catch (e) {
196 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
197 }
198 }
199
200 async checkToken() {
201 try {

Callers 1

runMethod · 0.95

Calls 5

getLoginCodeMethod · 0.95
requestMethod · 0.95
applyTokenMethod · 0.95
saveCachedTokenMethod · 0.95
logMethod · 0.45

Tested by

no test coverage detected