外置插件解决1034

This commit is contained in:
bbaban 2023-10-09 23:11:24 +08:00
parent 0172e7a25e
commit 0232fcf48e
2 changed files with 31 additions and 20 deletions

View File

@ -21,6 +21,7 @@ export default class MysApi {
this.cacheCd = 300 this.cacheCd = 300
this._device = device this._device = device
this.device_fp = ''
this.option = { this.option = {
log: true, log: true,
...option ...option
@ -64,23 +65,24 @@ export default class MysApi {
case '9': case '9':
return this.isSr ? 'prod_official_cht' : 'os_cht' // 港澳台服 return this.isSr ? 'prod_official_cht' : 'os_cht' // 港澳台服
} }
return 'cn_gf01' return this.isSr ? 'prod_gf_cn' : 'cn_gf01'
} }
async getData(type, data = {}, cached = false, isGetFP = false) { async getData(type, data = {}, cached = false, isGetFP = false) {
if (!isGetFP && !data.device_fp) { if (!isGetFP && !this.device_fp && !data?.headers['x-rpc-device_fp']) {
let seed_id = this.generateSeed(16) let seed_id = this.generateSeed(16)
let device_fp = await this.getData('getFp', { let device_fp = await this.getData('getFp', {
seed_id seed_id
}, false, true) }, false, true)
if (!data) { this.device_fp = device_fp?.data?.device_fp
data = {}
} }
if (!isGetFP && this.device_fp && !data?.headers['x-rpc-device_fp']) {
if (data?.headers) { if (data?.headers) {
data.headers['x-rpc-device_fp'] = device_fp?.data?.device_fp data.headers['x-rpc-device_fp'] = this.device_fp
} else { } else {
if (!data) data = {}
data.headers = { data.headers = {
'x-rpc-device_fp': device_fp?.data?.device_fp 'x-rpc-device_fp': this.device_fp
} }
} }
} }

View File

@ -391,8 +391,17 @@ export default class MysInfo {
if (res.api === 'detail') res.retcode = 0 if (res.api === 'detail') res.retcode = 0
break break
case 1034: case 1034:
try {
let Validate = (await import(`file://${process.cwd()}/plugins/loveMys-plugin/model/mys/mysApi.js`)).default
let vali = new Validate(mysApi.uid, mysApi.cookie, mysApi.option, mysApi.isSr ? 'sr' : 'gs', mysApi._device)
res = await vali.getvali(type, data)
} catch (error) {
logger.error(error)
}
if (!res || res?.retcode == 1034) {
logger.mark(`[米游社查询失败][uid:${this.uid}][qq:${this.userId}] 遇到验证码`) logger.mark(`[米游社查询失败][uid:${this.uid}][qq:${this.userId}] 遇到验证码`)
if (!isTask) this.e.reply('米游社查询遇到验证码,请稍后再试') if (!isTask) this.e.reply('米游社查询遇到验证码,请稍后再试')
}
break break
default: default:
if (!isTask) this.e.reply(`米游社接口报错,暂时无法查询:${res.message || 'error'}`) if (!isTask) this.e.reply(`米游社接口报错,暂时无法查询:${res.message || 'error'}`)