临时修改一个引用

This commit is contained in:
liangtongchuan
2022-03-15 23:39:32 +08:00
parent e70b60f182
commit d777efd61e
2 changed files with 17 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import { ActivityModelType } from "../../db/Activity";
import { ActivityPopUpShopModelType, PopUpShopItem as ActivityPopUpShopItem } from "../../db/ActivityPopUpShop";
import { RewardInter } from "../../pubUtils/interface";
import { parseNumberList } from "../../pubUtils/util";
import { stringToRewardInter } from "../../services/activity/giftPackageService";
import { stringToRewardInter } from "../../pubUtils/util";
import { ActivityBase } from './activityField';
// 数据库格式

View File

@@ -12,6 +12,7 @@ import { findIndex } from 'underscore';
import { getTimeFunM } from './timeUtil';
import { Floor } from '../domain/activityField/gachaField';
import { WhiteListModel } from '../db/RegionWhiteList';
import { RewardInter } from './interface';
const randomName = require("chinese-random-name");
const moment = require('moment');
const crypto = require('crypto');
@@ -772,4 +773,18 @@ export function getWarTypeName(warType: number) {
total -= rand;
}
return { arr, remain: total }
}
}
//数据格式转换'id&数量|id&数量|' ->> Array<RewardInter> 老资源格式
export function stringToRewardInter(rewardStr: string): Array<RewardInter> {
let result = new Array<{ id: number, count: number }>();
if (!rewardStr) return result;
let decodeArr = decodeArrayListStr(rewardStr);
for (let [id, count] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(count))) {
throw new Error('data table format wrong');
}
result.push({ id: parseInt(id), count: parseInt(count) });
}
return result
}