活动:新手签到活动
This commit is contained in:
@@ -30,6 +30,7 @@ export enum ACTIVITY_TYPE {
|
||||
DAILY_RMB_GIFTS = 22, // 每日特惠RMB购买,一次性购买7天礼包
|
||||
TREASURE_HUNT = 23, // 寻宝骑兵活动
|
||||
POP_UP_SHOP = 24, // 弹出商店
|
||||
NEW_PLAYER_SIGN_IN = 25, // 新手签到活动
|
||||
// FOURTEEN_DAY = 25, // 14天乐活动(虚)
|
||||
// FOURTEEN_DAILY_DISCOUNT_GIFT = 26, // 14天乐活动,每日特惠礼包
|
||||
// FOURTEEN_TASK_GROWTH = 27, // 14天乐成长任务活动
|
||||
@@ -111,4 +112,7 @@ export const DAILYRMBGIFTS_DAYS = 7;//一次性购买*天
|
||||
|
||||
//签到活动开启时间
|
||||
export const SIGNIN_OPEN = 1;//*号0点开启
|
||||
export const SIGNIN_CLOSE = 31;//*号晚上24点结束
|
||||
export const SIGNIN_CLOSE = 31;//*号晚上24点结束
|
||||
|
||||
//新手签到活动持续天数
|
||||
export const NEW_PLAYER_SIGIN_DAYS = 8;//持续8天
|
||||
@@ -1,7 +1,8 @@
|
||||
import moment = require('moment');
|
||||
import { ACTIVITY_RESOURCES_TYPE, SIGNIN_CLOSE, SIGNIN_OPEN } from '../../consts';
|
||||
import { ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE, SERVER_OPEN_TIME, SIGNIN_CLOSE, SIGNIN_OPEN } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivitySignInModelType } from '../../db/ActivitySignIn';
|
||||
import { deltaDays } from '../../pubUtils/util';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
|
||||
@@ -57,25 +58,37 @@ export class SignInData extends ActivityBase {
|
||||
this.isVip = true
|
||||
}
|
||||
|
||||
//设置新手签到时间
|
||||
public setNewPlayerDate(beginTime: Date, endTime: Date) {
|
||||
this.beginTime = moment(beginTime).valueOf();
|
||||
this.endTime = moment(endTime).valueOf();
|
||||
this.roundIndex = 1;
|
||||
this.todayIndex = deltaDays(moment(beginTime).startOf('d').toDate(), new Date) + 1;
|
||||
}
|
||||
|
||||
public initData(data: string) {
|
||||
let dataObj = JSON.parse(data);
|
||||
this.price = dataObj.price;
|
||||
this.productID = dataObj.productID;
|
||||
this.consume = dataObj.consume;
|
||||
|
||||
this.startDate = dataObj.startDate ? dataObj.startDate : SIGNIN_OPEN;
|
||||
this.endDate = dataObj.endDate ? dataObj.endDate : SIGNIN_CLOSE;
|
||||
|
||||
let date = new Date();
|
||||
this.beginTime = moment(date.setDate(this.startDate)).startOf('day').valueOf();
|
||||
this.endTime = moment(date.setDate(this.endDate)).endOf('day').valueOf();
|
||||
|
||||
this.price = dataObj.price;
|
||||
this.productID = dataObj.productID;
|
||||
this.consume = dataObj.consume;
|
||||
this.roundIndex = moment().diff(moment(this.beginTime).startOf('months'), 'months') + 1;
|
||||
this.roundIndex = moment().diff(moment(SERVER_OPEN_TIME).startOf('months'), 'months') + 1;
|
||||
if (this.type === ACTIVITY_TYPE.NEW_PLAYER_SIGN_IN) {
|
||||
this.roundIndex = 1;
|
||||
}
|
||||
this.todayIndex = moment(Date.now()).date() - this.startDate + 1;
|
||||
|
||||
let arr = dataObj.data
|
||||
for (let obj of arr) {
|
||||
this.list.push(new SignInItem(obj))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType) {
|
||||
|
||||
@@ -66,7 +66,7 @@ export class ThirtyDaysItem {
|
||||
reward: string; //任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品
|
||||
point: number; // 任务达成获得的奖励点,只在当前活动中有用,虚拟
|
||||
|
||||
|
||||
totalCount: number = 0; //任务完成次数
|
||||
isComplete: boolean = false; //是否完成任务
|
||||
isReceive: boolean = false; //是否领取过奖励
|
||||
|
||||
@@ -81,6 +81,10 @@ export class ThirtyDaysItem {
|
||||
this.reward = data.reward;
|
||||
this.point = data.point;
|
||||
|
||||
this.totalCount = 0;
|
||||
this.isComplete = false;
|
||||
this.isReceive = false;
|
||||
|
||||
this.taskParamArray = splitString(data.taskParam, '&')
|
||||
}
|
||||
|
||||
@@ -229,6 +233,7 @@ export class ThirtyDaysData extends ActivityBase {
|
||||
let itemData = this.findThirtyDaysItem(record.pageIndex, record.cellIndex, record.tab)
|
||||
if (itemData) {
|
||||
itemData.isReceive = record.isReceive === true;
|
||||
itemData.totalCount = record.totalCount ? record.totalCount : 0;
|
||||
itemData.isComplete = record.totalCount >= itemData.condition;
|
||||
if (itemData.isReceive) {
|
||||
this.totalPoint += itemData.point;
|
||||
|
||||
Reference in New Issue
Block a user