🎈 perf(活动): 神州探秘购买添加次数参数

This commit is contained in:
luying
2022-11-18 14:46:46 +08:00
parent 966ecd3818
commit 90a9eca039
9 changed files with 51 additions and 37 deletions
@@ -183,17 +183,19 @@ export function stringToRewardParam(rewardStr: string): Array<RewardParam> {
}
//数据格式转换'类型&id&数量|类型&id&数量|' ->> Array<ItemInter> 资源消耗
export function stringToConsumeParam(rewardStr: string) {
export function stringToConsumeParam(...rewardStrs: string[]) {
let result = new Array<{ type: number, id: number, count: number }>();
if (!rewardStr) return result;
let decodeArr = decodeArrayListStr(rewardStr);
for (let [type, id, count] of decodeArr) {
if (isNaN(parseInt(type)) || isNaN(parseInt(id)) || isNaN(parseInt(count))) {
throw new Error('data table format wrong');
for(let rewardStr of rewardStrs) {
if(!rewardStr) continue;
let decodeArr = decodeArrayListStr(rewardStr);
for (let [type, id, count] of decodeArr) {
if (isNaN(parseInt(type)) || isNaN(parseInt(id)) || isNaN(parseInt(count))) {
throw new Error('data table format wrong');
}
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
}
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
}
return result
}
return combineItems(result);
}
//数据格式转换'id&数量|id&数量|' ->> Array<RewardInter> 老资源格式