活动:寻宝骑兵活动接口
This commit is contained in:
@@ -9,6 +9,9 @@ export class ShopItem {
|
||||
reward: string; //任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品
|
||||
countMax: number = 0; //可购买的最大次数,0表示不限制
|
||||
name: string; //名字
|
||||
price: number; //价格
|
||||
productID: string; //商品id
|
||||
imageName: string;
|
||||
|
||||
buyCount: number = 0; //购买过的次数
|
||||
|
||||
@@ -17,6 +20,10 @@ export class ShopItem {
|
||||
this.reward = data.reward;
|
||||
this.countMax = data.countMax;
|
||||
this.name = data.name;
|
||||
this.price = data.price;
|
||||
this.productID = data.productID;
|
||||
this.imageName = data.imageName;
|
||||
this.buyCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
139
shared/domain/activityField/treasureHuntField.ts
Normal file
139
shared/domain/activityField/treasureHuntField.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { UserOrderModelType } from '../../db/UserOrder';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
/************************************************************/
|
||||
//购买价格
|
||||
export class ConsumeData {
|
||||
count: number; // 第几次购买,1开始
|
||||
consume: string; //消耗资源 "2&31002&400"
|
||||
|
||||
constructor(data: any) {
|
||||
this.count = data.count;
|
||||
this.consume = data.consume;
|
||||
}
|
||||
}
|
||||
|
||||
// 商品的数据
|
||||
export class TreasureHuntShopItem {
|
||||
cellIndex: number; // 第几个,从1开始
|
||||
name: string; //名称
|
||||
price: number; // 价格RMB 每次购买价格不变
|
||||
productID: string; // 商品id
|
||||
reward: string; //奖励
|
||||
countMax: number; //最大购买次数
|
||||
imageName: string;
|
||||
consume: ConsumeData[]; //每次购买价格不同
|
||||
|
||||
buyCount: number = 0; //购买过的次数
|
||||
|
||||
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.data) {
|
||||
this.consume.push(new ConsumeData(obj))
|
||||
}
|
||||
this.buyCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 商店数据
|
||||
export class TreasureHuntShopData {
|
||||
name: string = '';//页签名字
|
||||
list: Array<TreasureHuntShopItem> = [];//商品
|
||||
|
||||
public initData(data: any) {
|
||||
this.name = data.name;
|
||||
let arr = data.data;
|
||||
for (let obj of arr) {
|
||||
console.log(JSON.stringify(obj))
|
||||
this.list.push(new TreasureHuntShopItem(obj))
|
||||
}
|
||||
}
|
||||
|
||||
constructor(data: any) {
|
||||
this.initData(data)
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
||||
// 寻宝备战的数据
|
||||
// export class TreasureHuntShopItem {
|
||||
// cellIndex: number; // 第几个,从1开始
|
||||
// name: string; //名称
|
||||
// price: number; // 价格RMB 每次购买价格不变
|
||||
// productID: string; // 商品id
|
||||
// reward: string; //奖励
|
||||
// countMax: number; //最大购买次数
|
||||
// imageName: string;
|
||||
// consume: ConsumeData[]; //每次购买价格不同
|
||||
|
||||
// buyCount: number = 0; //购买过的次数
|
||||
|
||||
// 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;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 寻宝备战数据
|
||||
// export class TreasureHuntShopData {
|
||||
// name: string = '';//页签名字
|
||||
// index: number = 0;//下标
|
||||
// list: Array<TreasureHuntShopItem> = [];//商品
|
||||
|
||||
// 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))
|
||||
// }
|
||||
// }
|
||||
|
||||
// constructor(data: any) {
|
||||
// this.initData(data)
|
||||
// }
|
||||
// }
|
||||
|
||||
/************************************************************/
|
||||
|
||||
// 商店数据
|
||||
export class TreasureHuntData extends ActivityBase {
|
||||
name: string = '';//活动名字
|
||||
day: string = '';//活动持续时间
|
||||
roundIndex = 0;//周期数
|
||||
shop: TreasureHuntShopData = null;
|
||||
|
||||
public initData(data: any) {
|
||||
let dataObj = JSON.parse(data);
|
||||
this.name = dataObj.name;
|
||||
this.day = dataObj.day;
|
||||
|
||||
let arr = dataObj.data;
|
||||
this.shop = new TreasureHuntShopData(arr[0]);
|
||||
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType) {
|
||||
super(activityData)
|
||||
this.initData(activityData.data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user