活动:寻宝骑兵领取奖励接口
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityTreasureHuntShopModelType } from '../../db/ActivityTreasureHuntShop';
|
||||
import { ActivityTreasureHuntTaskModelType } from '../../db/ActivityTreasureHuntTask';
|
||||
import { ActivityTreasureHuntTreasureShopModelType } from '../../db/ActivityTreasureHuntTreasureShop';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
/************************************************************/
|
||||
@@ -50,6 +52,7 @@ export class TreasureHuntShopItem {
|
||||
|
||||
// 商店数据
|
||||
export class TreasureHuntShopData {
|
||||
index: number = 0;//下标
|
||||
name: string = '';//页签名字
|
||||
list: Array<TreasureHuntShopItem> = [];//商品
|
||||
|
||||
@@ -58,7 +61,7 @@ export class TreasureHuntShopData {
|
||||
return (index != -1) ? this.list[index] : null;
|
||||
}
|
||||
|
||||
public setPlayerRecords(record: ActivityTreasureHuntShopModelType) {
|
||||
public setPlayerShopRecords(record: ActivityTreasureHuntShopModelType) {
|
||||
if (!record) {
|
||||
return;
|
||||
}
|
||||
@@ -68,7 +71,9 @@ export class TreasureHuntShopData {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public initData(data: any) {
|
||||
this.index = data.index;
|
||||
this.name = data.name;
|
||||
let arr = data.data;
|
||||
for (let obj of arr) {
|
||||
@@ -84,63 +89,168 @@ export class TreasureHuntShopData {
|
||||
/************************************************************/
|
||||
|
||||
// 寻宝备战的数据
|
||||
// export class TreasureHuntShopItem {
|
||||
// cellIndex: number; // 第几个,从1开始
|
||||
// name: string; //名称
|
||||
// price: number; // 价格RMB 每次购买价格不变
|
||||
// productID: string; // 商品id
|
||||
// reward: string; //奖励
|
||||
// countMax: number; //最大购买次数
|
||||
// imageName: string;
|
||||
// consume: ConsumeData[]; //每次购买价格不同
|
||||
export class TreasureHuntTaskItem {
|
||||
cellIndex: number; // 第几个,从1开始
|
||||
name: string; //名称
|
||||
taskType: number; // 任务类型
|
||||
taskParam: string; // 任务参数
|
||||
condition: number; //任务条件数据
|
||||
reward: string; //奖励
|
||||
fragment: number; //碎片
|
||||
|
||||
// buyCount: number = 0; //购买过的次数
|
||||
totalCount: number = 0; //任务统计
|
||||
isReceive: boolean = false; //是否领取奖励
|
||||
|
||||
// constructor(data: any) {
|
||||
// this.cellIndex = data.cellIndex;
|
||||
// this.name = data.name;
|
||||
// this.price = data.price;
|
||||
// this.productID = data.productID;
|
||||
// this.reward = data.reward;
|
||||
// this.countMax = data.countMax;
|
||||
// this.imageName = data.imageName;
|
||||
// this.consume = [];
|
||||
// for (let obj of data.imageName) {
|
||||
// this.consume.push(new ConsumeData(obj))
|
||||
// }
|
||||
// this.buyCount = 0;
|
||||
// }
|
||||
// }
|
||||
constructor(data: any) {
|
||||
this.cellIndex = data.cellIndex;
|
||||
this.name = data.name;
|
||||
this.taskType = data.taskType;
|
||||
this.taskParam = data.taskParam;
|
||||
this.condition = data.condition;
|
||||
this.reward = data.reward;
|
||||
this.fragment = data.fragment;
|
||||
this.totalCount = 0;
|
||||
this.isReceive = false;
|
||||
}
|
||||
}
|
||||
|
||||
// // 寻宝备战数据
|
||||
// export class TreasureHuntShopData {
|
||||
// name: string = '';//页签名字
|
||||
// index: number = 0;//下标
|
||||
// list: Array<TreasureHuntShopItem> = [];//商品
|
||||
// 寻宝备战数据
|
||||
export class TreasureHuntTaskData {
|
||||
name: string = '';//页签名字
|
||||
index: number = 0;//下标
|
||||
reward: string = '';//奖励
|
||||
fragment: number = 0;//碎片需求量
|
||||
list: Array<TreasureHuntTaskItem> = [];//任务
|
||||
|
||||
// public initData(data: any) {
|
||||
// this.name = data.name;
|
||||
// this.index = data.index;
|
||||
// let arr = data.data;
|
||||
// for (let obj of arr) {
|
||||
// this.list.push(new TreasureHuntShopItem(obj))
|
||||
// }
|
||||
// }
|
||||
public getItem(cellIndex: number): TreasureHuntTaskItem {
|
||||
let index = this.list.findIndex(obj => { return obj && obj.cellIndex === cellIndex });
|
||||
return (index != -1) ? this.list[index] : null
|
||||
}
|
||||
|
||||
// constructor(data: any) {
|
||||
// this.initData(data)
|
||||
// }
|
||||
// }
|
||||
public setPlayerTaskRecords(record: ActivityTreasureHuntTaskModelType[]) {
|
||||
for (let item of this.list) {
|
||||
let index = record.findIndex(obj => { return obj.cellIndex === item.cellIndex && obj.type === item.taskType });
|
||||
if (index != -1) {
|
||||
item.totalCount = record[index].totalCount;
|
||||
item.isReceive = record[index].receiveRewardCount ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public initData(data: any) {
|
||||
this.name = data.name;
|
||||
this.index = data.index;
|
||||
this.reward = data.reward;
|
||||
this.fragment = data.fragment;
|
||||
let arr = data.data;
|
||||
for (let obj of arr) {
|
||||
this.list.push(new TreasureHuntTaskItem(obj))
|
||||
}
|
||||
}
|
||||
|
||||
constructor(data: any) {
|
||||
this.initData(data)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
||||
// 商店数据
|
||||
// 寻宝大冒险的数据
|
||||
export class TreasureHuntChallengeData {
|
||||
name: string = '';//页签名字
|
||||
index: number = 0;//下标
|
||||
consume: string = '';//消耗
|
||||
count: number = 0;//碎片需求量
|
||||
fixReward: string = '';//消耗
|
||||
jackpotReward: string = '';//消耗
|
||||
|
||||
public initData(data: any) {
|
||||
this.name = data.name;
|
||||
this.index = data.index;
|
||||
this.consume = data.consume;
|
||||
this.count = data.count;
|
||||
this.fixReward = data.fixReward;
|
||||
this.jackpotReward = data.jackpotReward;
|
||||
}
|
||||
|
||||
constructor(data: any) {
|
||||
this.initData(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
|
||||
//天子宝库
|
||||
// 商品的数据
|
||||
export class TreasureHuntTreasureShopItem {
|
||||
cellIndex: number; // 第几个,从1开始
|
||||
name: string; //名称
|
||||
reward: string; //奖励
|
||||
countMax: number; //最大购买次数
|
||||
imageName: string;
|
||||
consume: ""; //购买价格
|
||||
|
||||
buyCount: number = 0; //购买过的次数
|
||||
|
||||
constructor(data: any) {
|
||||
this.cellIndex = data.cellIndex;
|
||||
this.name = data.name;
|
||||
this.reward = data.reward;
|
||||
this.countMax = data.countMax;
|
||||
this.imageName = data.imageName;
|
||||
this.consume = data.consume;
|
||||
this.buyCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 天子宝库商店数据
|
||||
export class TreasureHuntTreasureShopData {
|
||||
index: number = 0;//下标
|
||||
name: string = '';//页签名字
|
||||
list: Array<TreasureHuntTreasureShopItem> = [];//商品
|
||||
|
||||
public getItem(cellIndex: number): TreasureHuntTreasureShopItem {
|
||||
let index = this.list.findIndex(obj => { return obj && obj.cellIndex === cellIndex })
|
||||
return (index != -1) ? this.list[index] : null;
|
||||
}
|
||||
|
||||
public setPlayerTreasureShopRecords(record: ActivityTreasureHuntTreasureShopModelType) {
|
||||
if (!record) {
|
||||
return;
|
||||
}
|
||||
for (let item of this.list) {
|
||||
let buyRecords = record.records.filter(obj => { return obj.id === item.cellIndex });
|
||||
item.buyCount = buyRecords.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public initData(data: any) {
|
||||
this.index = data.index;
|
||||
this.name = data.name;
|
||||
let arr = data.data;
|
||||
for (let obj of arr) {
|
||||
this.list.push(new TreasureHuntTreasureShopItem(obj))
|
||||
}
|
||||
}
|
||||
|
||||
constructor(data: any) {
|
||||
this.initData(data)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
||||
// 寻宝骑兵活动数据
|
||||
export class TreasureHuntData extends ActivityBase {
|
||||
name: string = '';//活动名字
|
||||
day: string = '';//活动持续时间
|
||||
roundIndex = 0;//周期数
|
||||
shop: TreasureHuntShopData = null;
|
||||
|
||||
shop: TreasureHuntShopData = null; //每日物资
|
||||
tasks: TreasureHuntTaskData = null; //寻宝备战
|
||||
challenge: TreasureHuntChallengeData = null;//寻宝大冒险
|
||||
treasureShop: TreasureHuntTreasureShopData = null; //天子宝库(商店)
|
||||
|
||||
|
||||
public initData(data: any) {
|
||||
@@ -150,7 +260,9 @@ export class TreasureHuntData extends ActivityBase {
|
||||
|
||||
let arr = dataObj.data;
|
||||
this.shop = new TreasureHuntShopData(arr[0]);
|
||||
|
||||
this.tasks = new TreasureHuntTaskData(arr[1]);
|
||||
this.challenge = new TreasureHuntChallengeData(arr[2]);
|
||||
this.treasureShop = new TreasureHuntTreasureShopData(arr[3]);
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType) {
|
||||
|
||||
Reference in New Issue
Block a user