🐞 fix(guild): 捐赠宝箱重复领取&领取之后展示问题修复
This commit is contained in:
@@ -8,6 +8,7 @@ import { gameData } from '../pubUtils/data';
|
||||
import { shouldRefresh } from '../pubUtils/util';
|
||||
import { recordGuildFund } from './activity/timeLimitRankService';
|
||||
import { pushGuildInfoUpdate } from './guildService';
|
||||
import { getArmyDonateBoxBaseById, getArmyDonateBoxBaseByLvAndIndex } from '../pubUtils/data';
|
||||
/**
|
||||
* 获得军团捐献,并检查是否刷新捐献数据
|
||||
* @param code
|
||||
@@ -65,4 +66,23 @@ export async function addFund(code: string, serverId: number, fund: number) {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将已经领取的其他等级捐赠宝箱id转为donationLv对应等级相同index的宝箱id
|
||||
*
|
||||
* @export
|
||||
* @param {number[]} receiveBoxs 已领取的宝箱id
|
||||
* @param {number} donationLv 当前捐赠等级
|
||||
*/
|
||||
export function changeReceiveBoxIdByLvAndIndex(receiveBoxs: number[], donationLv: number) {
|
||||
let haveGotBoxIds: number[] = [];
|
||||
receiveBoxs.forEach((boxId) => {
|
||||
// 获取已领取箱子的index
|
||||
let { index } = getArmyDonateBoxBaseById(boxId);
|
||||
// 获取donationLv等级,第index个箱子的id
|
||||
let { id } = getArmyDonateBoxBaseByLvAndIndex(donationLv, index);
|
||||
haveGotBoxIds.push(id);
|
||||
});
|
||||
return haveGotBoxIds;
|
||||
}
|
||||
Reference in New Issue
Block a user