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

Method loginByWxCode

wxapp/jyxe.js:153–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151 }
152
153 async loginByWxCode() {
154 try {
155 const code = await this.getLoginCode();
156 const res = await this.request("/api/login/getWxMiniProgramSessionKey", {
157 code,
158 gdtVid: "",
159 }, { noauth: true });
160 const data = res.data || {};
161 this.session = {
162 token: data.token || res.token || "",
163 userInfo: data.personInfo || {},
164 newOrder: data.newOrder || null,
165 };
166 if (!this.session.token) throw new Error("登录未返回token");
167 this.saveCachedToken();
168 $.log(`账号[${this.index}] 登录成功`);
169 } catch (e) {
170 $.log(`账号[${this.index}] 登录失败: ${e.message || e}`);
171 }
172 }
173
174 async checkToken() {
175 try {

Callers 1

runMethod · 0.95

Calls 4

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

Tested by

no test coverage detected