活动:糜家商队

This commit is contained in:
qiaoxin
2021-06-08 17:36:44 +08:00
parent c51997299c
commit cc218151e4
12 changed files with 659 additions and 361 deletions

View File

@@ -1,5 +1,8 @@
import moment = require('moment');
import { SERVER_OPEN_TIME } from '../../consts';
import { ActivityModelType } from '../../db/Activity';
import { ActivitySelfServiceShopModelType } from '../../db/ActivitySelfServiceShop';
import { deltaDays } from '../../pubUtils/util';
import { ActivityBase } from './activityField';
// 自助商店数据坑位数据
@@ -21,7 +24,9 @@ export class SelfServiceShopItem {
name: string; //名称
countMax: number = 0; // 最大可购买次数 0表示无限
price: number; //价格
priceType: number; //价格类型 ACTIVITY_RESOURCES_TYPE 2.物品表 3.RMB
productID: string; //商品id
consume: string; //消耗其他资源
data: Array<SelfServiceShopItemInfo> = [];
buyCount: number = 0; //已经购买次数
@@ -31,7 +36,8 @@ export class SelfServiceShopItem {
this.name = cellData.name;
this.countMax = cellData.countMax;
this.price = cellData.price;
this.priceType = cellData.priceType;
this.productID = cellData.productID;
this.consume = cellData.consume;
this.data = [];
for (let obj of cellData.data) {
this.data.push(new SelfServiceShopItemInfo(obj))
@@ -43,8 +49,22 @@ export class SelfServiceShopItem {
export class SelfServiceShopData extends ActivityBase {
list: Array<SelfServiceShopItem> = [];//货架
days: number = 20;//刷新周期天数
name: string = '';
count: number = 1;//每天可挑战次数胜利,才会统计
warid: string = '';//可挑战关卡
unitPrice: string = '';//元宝购买代币价格
unitCountMax: number = 0;//元宝购买代币最大次数
unitReward: string = '';//购买获得代币资源
unitBuyCount: number = 0;//元宝购买代币次数
roundIndex: number = 0; //第几周期 从1开始
public getItemByProductID(productID: string): SelfServiceShopItem {
let listIndex = this.list.findIndex(obj => { return obj.productID == productID });
return (listIndex != -1) ? this.list[listIndex] : null;
}
public getItem(index: number) {
let listIndex = this.list.findIndex(obj => { return obj.index == index });
return (listIndex != -1) ? this.list[listIndex] : null;
@@ -59,14 +79,21 @@ export class SelfServiceShopData extends ActivityBase {
}
public initData(data: string) {
console.log('ddddddd', data)
let dataObj = JSON.parse(data);
this.days = dataObj.days;
this.name = dataObj.name;
this.count = dataObj.count;
this.warid = dataObj.warid;
this.unitPrice = dataObj.unitPrice;
this.unitCountMax = dataObj.unitCountMax;
this.unitReward = dataObj.unitReward;
let arr = dataObj.data;
for (let obj of arr) {
this.list.push(new SelfServiceShopItem(obj))
}
this.todayIndex = deltaDays(moment(SERVER_OPEN_TIME).startOf('d').toDate(), new Date) + 1;
this.roundIndex = Math.ceil(this.todayIndex / this.days);
}

View File

@@ -1,15 +1,16 @@
import { ActivityModelType } from '../../db/Activity';
import { ActivityBase } from './activityField';
import { TASK_TYPE } from '../../consts';
import { ACTIVITY_TYPE, SERVER_OPEN_TIME, TASK_TYPE } from '../../consts';
import { ActivityGrowthModelType } from '../../db/ActivityGrowth';
import { ActivityGrowthPointModelType } from '../../db/ActivityGrowthPoint';
import { HeroType } from '../../db/Hero';
import { RoleModel } from '../../db/Role';
import { splitString } from '../../pubUtils/util';
import { deltaDays, splitString } from '../../pubUtils/util';
import { ActivityDailyGiftsModelType } from '../../db/ActivityDailyGifts';
import { parseResStr } from '../../pubUtils/util';
import { ConsumeResParam } from '../activityField/consumeField';
import { ActivityDailyChallengesModelType } from '../../db/ActivityDailyChallenges';
import moment = require('moment');
// 今日挑战的每日配置数据
export class SevenDaysDailyItem {
@@ -318,6 +319,13 @@ export class SevenDaysData extends ActivityBase {
this.dailyGift = new SevenDaysDailyGiftsData(objData.dailyGift)
this.dailyChallenge = new SevenDaysDailyChallengesData(objData.dailyChallenge)
if (this.type === ACTIVITY_TYPE.SEVEN_DAY) {
this.todayIndex = deltaDays(moment(SERVER_OPEN_TIME).startOf('d').toDate(), new Date) + 1;
} else if (this.type === ACTIVITY_TYPE.FOURTEEN_DAY) {
this.todayIndex = deltaDays(moment(SERVER_OPEN_TIME).startOf('d').toDate(), new Date) + 1 - 7;
} else if (this.type === ACTIVITY_TYPE.COMMON_SEVEN_DAY) {
}
}
constructor(activityData: ActivityModelType) {

View File

@@ -13,6 +13,7 @@ export class TreasureHuntFirstPageData {
name: string = '';//页签名字
index: number = 0;//下标
reward: string = '';//奖励
imageName: string = '';
isReceive: boolean = false;//是否领取
@@ -28,6 +29,7 @@ export class TreasureHuntFirstPageData {
this.name = data.name;
this.index = data.index;
this.reward = data.reward;
this.imageName = data.imageName;
this.isReceive = false;
}
@@ -204,6 +206,7 @@ export class TreasureHuntChallengeData {
warid: string = '';//随机的关卡号
fixReward: string = '';//客户端显示奖励
jackpotReward: string = '';//客户端显示奖励
imageName: string = '';
public randomGK() {
let gkArray = splitString(this.warid, '&');
@@ -218,6 +221,7 @@ export class TreasureHuntChallengeData {
this.warid = data.warid;
this.fixReward = data.fixReward;
this.jackpotReward = data.jackpotReward;
this.imageName = data.imageName;
}
constructor(data: any) {