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