Skip to content

Commit

Permalink
fix: 部分 API 随机种子处理异常
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyJan committed Jul 2, 2024
1 parent 15f55c5 commit 5aff457
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
17 changes: 7 additions & 10 deletions model/kuroApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default class kuroApi {
* @returns {JSON|string} code=200 时接口返回的原始 json 或者报错信息
*/
async sdkLogin(data) {
return this.getData('sdkLogin', null, data)
return this.getData('sdkLogin', '1', data)
}

/**
Expand Down Expand Up @@ -380,30 +380,27 @@ export default class kuroApi {

/**
* 鸣潮抽卡记录
* @param {string} kuroUid 库洛 ID, 传 0 即可
* @param {object} data 传入 data.cardPoolId 卡池 id data.cardPoolType 卡池类型 data.playerId 游戏 uid data.recordId 记录 id data.serverId 服务器 id
* @returns {JSON|string} code=0 时接口返回的原始 json 或者报错信息
*/
async mcGachaRecord(kuroUid, data) {
return this.getData('mcGachaRecord', kuroUid, data)
async mcGachaRecord(data) {
return this.getData('mcGachaRecord', '1', data)
}

/**
* 从插件服务器获取库街区登录通信 token
* @param {string} kuroUid 库洛 ID, 传 0 即可
* @returns {JSON|string} code=0 时接口返回的原始 json 或者报错信息
*/
async getPluginServerKuroBbsLoginAuth(kuroUid) {
return this.getData('getPluginServerKuroBbsLoginAuth', kuroUid, {})
async getPluginServerKuroBbsLoginAuth() {
return this.getData('getPluginServerKuroBbsLoginAuth', '1', {})
}

/**
* 从插件服务器获取库街区 token
* @param {string} kuroUid 库洛 ID, 传 0 即可
* @params {object} data 传入 data.token 通信 token
* @returns {JSON|string} code=0 时接口返回的原始 json 或者报错信息
*/
async getPluginServerKuroBbsLoginToken(kuroUid, data) {
return this.getData('getPluginServerKuroBbsLoginToken', kuroUid, data)
async getPluginServerKuroBbsLoginToken(data) {
return this.getData('getPluginServerKuroBbsLoginToken', '1', data)
}
}
3 changes: 1 addition & 2 deletions model/kuroBBSLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class kuroBBSLogin {
async onlineLogin() {
let kuroapi = new kuroApi(this.e.user_id)
let rsp_getPluginServerKuroBbsLoginAuth =
await kuroapi.getPluginServerKuroBbsLoginAuth(0)
await kuroapi.getPluginServerKuroBbsLoginAuth()
kuroLogger.debug(
'rsp_getPluginServerKuroBbsLoginAuth:',
JSON.stringify(rsp_getPluginServerKuroBbsLoginAuth)
Expand Down Expand Up @@ -170,7 +170,6 @@ export default class kuroBBSLogin {
while (i < 36) {
await sleepAsync(5000)
let rsp_onlineLogin = await kuroapi.getPluginServerKuroBbsLoginToken(
0,
{
token: rsp_getPluginServerKuroBbsLoginAuth.token,
}
Expand Down
6 changes: 3 additions & 3 deletions model/mcGachaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default class mcGachaData {

// 发送请求
let kuroapi = new kuroApi(qq)
let rsp_mcGachaRecord = await kuroapi.mcGachaRecord(0, {
let rsp_mcGachaRecord = await kuroapi.mcGachaRecord({
cardPoolId,
cardPoolType: 7,
playerId,
Expand Down Expand Up @@ -259,7 +259,7 @@ export default class mcGachaData {
curCardPoolToFetch <= 7;
curCardPoolToFetch++
) {
let rsp_mcGachaRecord = await kuroapi.mcGachaRecord(0, {
let rsp_mcGachaRecord = await kuroapi.mcGachaRecord({
cardPoolId,
cardPoolType: curCardPoolToFetch,
playerId,
Expand All @@ -268,7 +268,7 @@ export default class mcGachaData {
})
if (typeof rsp_mcGachaRecord === 'string')
// 失败重试一次
rsp_mcGachaRecord = await kuroapi.mcGachaRecord(0, {
rsp_mcGachaRecord = await kuroapi.mcGachaRecord({
cardPoolId,
cardPoolType: curCardPoolToFetch,
playerId,
Expand Down
4 changes: 4 additions & 0 deletions model/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export function generateUUID(inputString) {
* @returns {string} 固定字符串
*/
export function generateFixedString(inputString, length = 40) {
if (!inputString) {
kuroLogger.warn('生成固定字符串输入为空, 使用默认值 1')
inputString = '1'
}
if (length > 64) {
length = 64
kuroLogger.warn(
Expand Down

0 comments on commit 5aff457

Please sign in to comment.