活动:签到添加补签的规则
This commit is contained in:
@@ -4,7 +4,7 @@ import { addItems, createHeroes } from './rewardService';
|
||||
import { RewardParam } from '../domain/activityField/rewardField';
|
||||
import { CreateHeroParam } from '../domain/roleField/hero';
|
||||
import { DicGiftPackage } from '../pubUtils/dictionary/DicGiftPackage';
|
||||
import { RewardInter } from '../pubUtils/interface';
|
||||
import { ItemInter, RewardInter } from '../pubUtils/interface';
|
||||
import { decodeArrayListStr } from '../pubUtils/util';
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ function randomSelectedData(count: number) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
//数据格式转换'类型&id&数量|类型&id&数量|' ->> Array<RewardParam>
|
||||
//数据格式转换'类型&id&数量|类型&id&数量|' ->> Array<RewardParam> 活动奖励
|
||||
export function stringToRewardParam(rewardStr: string): Array<RewardParam> {
|
||||
let result = new Array<{ type: number, id: number, count: number }>();
|
||||
if (!rewardStr) return result;
|
||||
@@ -128,4 +128,18 @@ export function stringToRewardParam(rewardStr: string): Array<RewardParam> {
|
||||
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
//数据格式转换'类型&id&数量|类型&id&数量|' ->> Array<ItemInter> 资源消耗
|
||||
export function stringToConsumeParam(rewardStr: string): Array<ItemInter> {
|
||||
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');
|
||||
}
|
||||
result.push({ type: parseInt(type), id: parseInt(id), count: parseInt(count) });
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user