活动:添加通用签到活动

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

@@ -115,7 +115,8 @@ export async function newPlayerSignInActivity(serverId: number, roleId: string)
*/
export async function getPlayerSignInData(activityId: number, serverId: number, roleId: string) {
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
if (activityData.type !== ACTIVITY_TYPE.SIGN_IN_VIP && activityData.type !== ACTIVITY_TYPE.SIGN_IN && activityData.type !== ACTIVITY_TYPE.NEW_PLAYER_SIGN_IN) {
if (activityData.type !== ACTIVITY_TYPE.SIGN_IN_VIP && activityData.type !== ACTIVITY_TYPE.SIGN_IN && activityData.type !== ACTIVITY_TYPE.NEW_PLAYER_SIGN_IN
&& activityData.type !== ACTIVITY_TYPE.COMMON_SIGN_IN) {
return null;
}
let playerData = new SignInData(activityData);

View File

@@ -48,6 +48,7 @@ export enum ACTIVITY_TYPE {
REFRESH_SHOP = 33, // 通用的刷新商店分页可刷新限制购买次数支持rmb与资源兑换
REFRESH_TASK = 34, // 通用的刷新任务(分页,可刷新,限制领取次数)
MONOPOLY = 35, //大富翁游戏
COMMON_SIGN_IN = 36, //通用签到
}
/**

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) {