import { ActivityPopUpShopModelType } from "../../db/ActivityPopUpShop"; // 弹框商店 export class PopUpShopData { activityId: number; // 活动id id: number; // 第几个,从1开始 name: string; //名字 consume: string; //消耗资源(这里优先rmb的price价格,其次资源消耗) price: number; // 商品价格 productID: string; // 商品id支付时使用 reward: string; //任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品 rebate: number; // 折扣用于显示 duration: number; // 持续时间,单位小时 taskType: number; // 任务类型 taskParam: number; // 任务参数 condition: number; // 任务条件 totalCount: number; //一共完成次数 isBuy: boolean = false; //购买过 beginTime: Date = null;//开始时间 endTime: Date = null;//结束时间 //解析玩家购买记录 public setPlayerRecords(data: ActivityPopUpShopModelType) { if (!data) { return; } this.isBuy = data.isBuy ? data.isBuy : false; this.beginTime = data.beginTime; this.endTime = data.endTime; this.totalCount = data.totalCount; } public initData(data: any) { this.id = data.id; this.reward = data.reward; this.consume = data.consume ? data.consume : ''; this.price = data.price ? data.price : 0; this.productID = data.productID ? data.productID : ''; this.name = data.name; this.rebate = data.rebate; this.duration = data.duration; this.taskType = data.taskType; this.taskParam = data.taskParam; this.condition = data.condition; this.isBuy = false; this.beginTime = null; this.endTime = null; this.totalCount = 0; } constructor(activityData: any, activityId: number) { this.activityId = activityId; this.initData(activityData) } }