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

Method login

wxapp/ctrip.js:246–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244 }
245
246 async login() {
247 const op = await this.getOperateData();
248 const wxLogin = await gateway("soa2/14553/wechatLogin.json", {
249 AccountHead: {},
250 Data: {
251 authCode: op.code,
252 thirdConfigCode: ACCESS_CODE,
253 Context: {},
254 },
255 });
256 if (!wxLogin?.wechatCode || wxLogin?.resultStatus?.returnCode !== 0) {
257 throw new Error(`wechatLogin未返回wechatCode: ${JSON.stringify(wxLogin)}`);
258 }
259
260 const auth = await gateway("soa2/14553/authenticate.json", {
261 AccountHead: {},
262 Data: {
263 authCode: wxLogin.wechatCode,
264 thirdType: "wechat_app",
265 thirdConfigCode: ACCESS_CODE,
266 context: {
267 encryptedData: op.encryptedData,
268 iv: op.iv,
269 uuid: "",
270 },
271 },
272 });
273 if (!auth?.token || auth?.resultStatus?.returnCode !== 0) {
274 throw new Error(`authenticate未返回第三方token: ${JSON.stringify(auth)}`);
275 }
276
277 const login = await gateway("soa2/12559/thirdPartyLogin.json", {
278 AccountHead: {},
279 Data: {
280 accountHead: {
281 locale: "zh_CN",
282 platform: "MINIAPP",
283 },
284 token: auth.token,
285 extendedProperties: {
286 clientID: CLIENT_ID,
287 page_id: "",
288 Url: "",
289 thirdConfigCode: ACCESS_CODE,
290 deviceName: "Windows PC",
291 OsType: "windows",
292 },
293 },
294 });
295 if (!login?.ticket || login?.resultStatus?.returnCode !== 0) {
296 throw new Error(`thirdPartyLogin未返回ticket: ${JSON.stringify(login)}`);
297 }
298
299 this.ticket = login.ticket;
300 this.duid = login.duid || login.extendedProperties?.duid || "";
301 this.udl = login.udl || "";
302 this.uid = login.uid || "";
303 this.saveCache({ isNewUser: login.extendedProperties?.isNewUser || "" });

Callers 1

ensureLoginMethod · 0.95

Calls 5

getOperateDataMethod · 0.95
saveCacheMethod · 0.95
gatewayFunction · 0.85
maskFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected