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

Method getUserToken

wxapp/musi.js:69–105  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

67 }
68 }
69 async getUserToken(code) {
70 const timestamp = new Date().getTime();
71 let options = {
72 method: 'POST',
73 url: `https://atom.musiyoujia.com/user/wechatlogin/applets`,
74 headers: {
75 'Content-Type': 'application/x-www-form-urlencoded',
76 'User-Agent': defaultUserAgent,
77 "api_client_code": "65",
78 "api_version": "1.0.0",
79 'api_timestamp': timestamp,
80 'api_token': '',
81
82 'api_sign': this.MD5_Encrypt(`api_client_code=65&api_version=1.0.0&api_timestamp=${timestamp}`)?.toUpperCase()
83
84 }
85 ,
86 data:
87 {
88 'appId': 'wx03527497c5369a2c',
89 'appType': 'WECHAT_MINI_PROGRAM',
90 'code': '' + code,
91 'systemCode': '65'
92 }
93 }
94 let {
95 data: result
96 } = await axios.request(options);
97
98 if (result?.code == '0') {
99 this.openId = result.data.openId
100 this.activedAuthToken = result.data.token
101 $.log(`🌸账号[${this.index}] 获取用户Token成功:${this.activedAuthToken}`)
102 } else {
103 $.log(`🌸账号[${this.index}] 获取用户Token-失败:${result.msg}❌`)
104 }
105 }
106
107
108

Callers 1

runMethod · 0.95

Calls 4

MD5_EncryptMethod · 0.95
getTimeMethod · 0.80
requestMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected