🎈 perf(活动): 神州探秘购买添加次数参数
This commit is contained in:
@@ -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> 老资源格式
|
||||
|
||||
@@ -132,7 +132,7 @@ export async function makeLimitPackageReward(roleId: string, roleName: string, s
|
||||
let rewardArray = stringToRewardParam(item.reward)
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardArray, ITEM_CHANGE_REASON.BUY_LIMIT_PACKAGE);
|
||||
|
||||
await ActivityShopModel.addRecord(activityId, roleId, playerData.roundIndex, item.id);
|
||||
await ActivityShopModel.addRecord(activityId, roleId, playerData.roundIndex, item.id, 1);
|
||||
|
||||
item.buyCount += 1;
|
||||
return {
|
||||
|
||||
@@ -109,7 +109,7 @@ export async function makeShop(roleId: string, roleName: string, sid: string, se
|
||||
let cellIndex = item.cellIndex;
|
||||
|
||||
//添加购买记录
|
||||
await ActivityTreasureHuntShopModel.buyShopRecord(activityId, roleId, playerData.roundIndex, playerData.todayIndex, cellIndex);
|
||||
await ActivityTreasureHuntShopModel.buyShopRecord(activityId, roleId, playerData.roundIndex, playerData.todayIndex, cellIndex, 1);
|
||||
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(item.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardParamArr, ITEM_CHANGE_REASON.TREASURE_HUNT_SHOP_BUY)
|
||||
|
||||
@@ -379,7 +379,7 @@ export function checkRouteParam(route: string, msg: any) {
|
||||
}
|
||||
case 'activity.treasureHuntHandler.buyGoods':
|
||||
{
|
||||
if(!checkNaturalNumbers(msg.activityId, msg.cellIndex)) return false;
|
||||
if(!checkNaturalNumbers(msg.activityId, msg.cellIndex, msg.count)) return false;
|
||||
break;
|
||||
}
|
||||
case 'activity.treasureHuntHandler.getTaskReward':
|
||||
@@ -394,7 +394,7 @@ export function checkRouteParam(route: string, msg: any) {
|
||||
}
|
||||
case 'activity.treasureHuntHandler.buyTreasureShopGoods':
|
||||
{
|
||||
if(!checkNaturalNumbers(msg.activityId, msg.cellIndex)) return false;
|
||||
if(!checkNaturalNumbers(msg.activityId, msg.cellIndex, msg.count)) return false;
|
||||
break;
|
||||
}
|
||||
case 'activity.vipRechargeMoneyHandler.getVipRechargeMoneyReward':
|
||||
|
||||
Reference in New Issue
Block a user