活动:添加通用签到活动

This commit is contained in:
qiaoxin
2021-06-19 16:25:41 +08:00
parent 06d937d8f8
commit 08cc976a9d
3 changed files with 25 additions and 15 deletions

View File

@@ -75,23 +75,31 @@ export class SignInData extends ActivityBase {
this.consume = dataObj.consume;
// this.rebet = dataObj.rebet;
this.startDate = dataObj.startDate ? dataObj.startDate : SIGNIN_OPEN;
this.endDate = dataObj.endDate ? dataObj.endDate : SIGNIN_CLOSE;
this.days = dataObj.days ? dataObj.days : 0;
let date = new Date();
this.beginTime = moment(date.setDate(this.startDate)).startOf('day').add(REFRESH_TIME, 'h').valueOf();
if (this.startDate > this.endDate) {//跨度下个月
this.endTime = moment(date.setDate(this.endDate)).endOf('day').add(REFRESH_TIME, 'h').add(1, 'month').valueOf();
if (this.type === ACTIVITY_TYPE.COMMON_SIGN_IN) {//通用签到
this.beginTime = moment(this.beginTime).startOf('day').add(REFRESH_TIME, 'h').valueOf();
this.endTime = moment(this.endTime).endOf('day').add(REFRESH_TIME, 'h').valueOf();
this.roundIndex = moment(this.beginTime).diff(moment(SERVER_OPEN_TIME).startOf('months'), 'months') + 1;
this.todayIndex = Math.ceil((moment(date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000));
} else {
this.endTime = moment(date.setDate(this.endDate)).endOf('day').add(REFRESH_TIME, 'h').valueOf();
this.startDate = dataObj.startDate ? dataObj.startDate : SIGNIN_OPEN;
this.endDate = dataObj.endDate ? dataObj.endDate : SIGNIN_CLOSE;
this.days = dataObj.days ? dataObj.days : 0;
this.beginTime = moment(date.setDate(this.startDate)).startOf('day').add(REFRESH_TIME, 'h').valueOf();
if (this.startDate > this.endDate) {//跨度下个月
this.endTime = moment(date.setDate(this.endDate)).endOf('day').add(REFRESH_TIME, 'h').add(1, 'month').valueOf();
} else {
this.endTime = moment(date.setDate(this.endDate)).endOf('day').add(REFRESH_TIME, 'h').valueOf();
}
this.roundIndex = moment(this.beginTime).diff(moment(SERVER_OPEN_TIME).startOf('months'), 'months') + 1;
if (this.type === ACTIVITY_TYPE.NEW_PLAYER_SIGN_IN) {
this.roundIndex = 1;
}
this.todayIndex = Math.ceil((moment(date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000));
}
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 = Math.ceil((moment(date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000));
let arr = dataObj.data
for (let obj of arr) {