This commit is contained in:
parent
3b18140992
commit
be9cb8cf38
|
@ -10,6 +10,8 @@ export default class MysApi {
|
|||
* @param cookie 米游社cookie
|
||||
* @param option 其他参数
|
||||
* @param option.log 是否显示日志
|
||||
* @param isSr 是否星铁
|
||||
* @param device 设备device_id
|
||||
*/
|
||||
constructor (uid, cookie, option = {}, isSr = false, device = '') {
|
||||
this.uid = uid
|
||||
|
@ -37,12 +39,12 @@ export default class MysApi {
|
|||
let urlMap = this.apiTool.getUrlMap({ ...data, deviceId: this.device })
|
||||
if (!urlMap[type]) return false
|
||||
|
||||
let { url, query = '', body = '', sign = '' } = urlMap[type]
|
||||
let { url, query = '', body = '' } = urlMap[type]
|
||||
|
||||
if (query) url += `?${query}`
|
||||
if (body) body = JSON.stringify(body)
|
||||
|
||||
let headers = this.getHeaders(query, body, sign)
|
||||
let headers = this.getHeaders(query, body)
|
||||
|
||||
return { url, headers, body }
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ export default class MysInfo {
|
|||
// ck对应MysUser对象
|
||||
this.ckUser = null
|
||||
this.auth = ['dailyNote', 'bbs_sign_info', 'bbs_sign_home', 'bbs_sign', 'ys_ledger', 'compute', 'avatarSkill', 'detail', 'blueprint', 'UserGame', 'deckList', 'avatar_cardList', 'action_cardList', 'avatarInfo']
|
||||
|
||||
this.gtest = false
|
||||
}
|
||||
|
||||
static async init (e, api) {
|
||||
|
@ -161,15 +163,15 @@ export default class MysInfo {
|
|||
let user = e.user?.getMysUser()
|
||||
let mysApi = new MysApi(mysInfo.uid, mysInfo.ckInfo.ck, option, e.isSr, user.device)
|
||||
|
||||
let device_fp = ''
|
||||
let devicefp = ''
|
||||
if (!data?.headers?.['x-rpc-device_fp'] && api !== 'getFp') {
|
||||
device_fp = (await mysApi.getData('getFp')).data?.device_fp
|
||||
devicefp = (await mysApi.getData('getFp')).data?.device_fp
|
||||
if (data?.headers) {
|
||||
data.headers['x-rpc-device_fp'] = device_fp
|
||||
data.headers['x-rpc-device_fp'] = devicefp
|
||||
} else {
|
||||
if (!data) data = {}
|
||||
data.headers = {
|
||||
'x-rpc-device_fp': device_fp
|
||||
'x-rpc-device_fp': devicefp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,11 +183,11 @@ export default class MysInfo {
|
|||
for (let i in api) {
|
||||
if (!api[i]?.headers?.['x-rpc-device_fp']) {
|
||||
if (api[i]?.headers) {
|
||||
api[i].headers['x-rpc-device_fp'] = device_fp
|
||||
api[i].headers['x-rpc-device_fp'] = devicefp
|
||||
} else {
|
||||
if (!api[i]) api[i] = {}
|
||||
api[i].headers = {
|
||||
'x-rpc-device_fp': device_fp
|
||||
'x-rpc-device_fp': devicefp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +206,7 @@ export default class MysInfo {
|
|||
|
||||
for (let i in res) {
|
||||
res[i] = await mysInfo.checkCode(res[i], res[i].api, mysApi, api[res[i].api])
|
||||
mysInfo.gtest = true
|
||||
|
||||
if (res[i]?.retcode === 0) continue
|
||||
|
||||
|
@ -417,8 +420,7 @@ export default class MysInfo {
|
|||
break
|
||||
case 1034:
|
||||
try {
|
||||
let Validate = (await import(`file://${process.cwd()}/plugins/loveMys-plugin/model/mys/mysApi.js`)).default
|
||||
res = await Validate.getvali(mysApi, type, data)
|
||||
res = await Gtest.getvali(mysApi, type, data, this.gtest)
|
||||
} catch (error) { }
|
||||
|
||||
if (!res || res?.retcode == 1034) {
|
||||
|
|
Loading…
Reference in New Issue