活动:签到添加vip标识
This commit is contained in:
@@ -71,7 +71,7 @@ export class SignInHandler {
|
||||
}
|
||||
let openTime = SERVER_OPEN_TIME;
|
||||
//开服第一个月可以签到之前未领取的奖励,下个月只能签到当天奖励
|
||||
if (moment(openTime).diff(moment(), 'months') != 1 && (dayIndex != todayIndex)) {
|
||||
if (moment().diff(moment(openTime).startOf('months'), 'months') != 0 && (dayIndex != todayIndex)) {
|
||||
return resResult(STATUS.ACTIVITY_SIGNIN_EXPIRE);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export class SignInHandler {
|
||||
if (!canBuyVip(lv))
|
||||
return resResult(STATUS.ACTIVITY_SIGNIN_VIP_CONDITION);
|
||||
|
||||
if (!await ActivitySignInModel.isBuyVip(activityId, roleId, roundIndex)) {
|
||||
if (!playerData.isVip) {
|
||||
return resResult(STATUS.ACTIVITY_SIGNIN_VIP_CONDITION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ export class SignInItem {
|
||||
isReceive: boolean = false; //是否领取
|
||||
|
||||
constructor(data: any) {
|
||||
console.log('dddddddddd', data)
|
||||
this.dayIndex = data.dayIndex;
|
||||
this.reward = data.reward;
|
||||
}
|
||||
@@ -52,6 +51,9 @@ export class SignInData extends ActivityBase {
|
||||
list: Array<SignInItem> = [];
|
||||
roundIndex: number = 0;//活动周期
|
||||
todayIndex: number = 0;//本月第几天
|
||||
price: number = 0;//vip价格,普通签到为0
|
||||
productID: string = '';//商品ID
|
||||
isVip: boolean = false;//是否购买了当前的vip活动
|
||||
|
||||
//第几天的签到奖励
|
||||
public findDayItem(dayIndex: number) {
|
||||
@@ -67,15 +69,20 @@ export class SignInData extends ActivityBase {
|
||||
obj.isReceive = data[index].isReceive;
|
||||
}
|
||||
}
|
||||
|
||||
let isBuy = data.findIndex(obj => { return obj.dayIndex == 0 });
|
||||
this.isVip = (isBuy != -1)
|
||||
}
|
||||
|
||||
public initData(data: string) {
|
||||
let arr = JSON.parse(data);
|
||||
|
||||
this.roundIndex = moment(this.beginTime).diff(moment(), 'months');
|
||||
let dataObj = JSON.parse(data);
|
||||
this.price = dataObj.price;
|
||||
this.productID = dataObj.productID;
|
||||
this.roundIndex = moment().diff(moment(this.beginTime).startOf('months'), 'months') + 1;
|
||||
console.log('dddddddddddd', this.roundIndex);
|
||||
this.todayIndex = moment(Date.now()).date();
|
||||
|
||||
let arr = dataObj.data
|
||||
for (let obj of arr) {
|
||||
console.log('obj', obj)
|
||||
this.list.push(new SignInItem(obj))
|
||||
|
||||
Reference in New Issue
Block a user