diff --git a/game-server/app/services/signInService.ts b/game-server/app/services/signInService.ts index 95a2a409d..929859d29 100644 --- a/game-server/app/services/signInService.ts +++ b/game-server/app/services/signInService.ts @@ -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); diff --git a/shared/consts/constModules/activityConst.ts b/shared/consts/constModules/activityConst.ts index 98a89544d..cc619cfa9 100644 --- a/shared/consts/constModules/activityConst.ts +++ b/shared/consts/constModules/activityConst.ts @@ -48,6 +48,7 @@ export enum ACTIVITY_TYPE { REFRESH_SHOP = 33, // 通用的刷新商店(分页,可刷新,限制购买次数,支持rmb与资源兑换) REFRESH_TASK = 34, // 通用的刷新任务(分页,可刷新,限制领取次数) MONOPOLY = 35, //大富翁游戏 + COMMON_SIGN_IN = 36, //通用签到 } /** diff --git a/shared/domain/activityField/signInField.ts b/shared/domain/activityField/signInField.ts index d757b49ce..f2e23ee60 100644 --- a/shared/domain/activityField/signInField.ts +++ b/shared/domain/activityField/signInField.ts @@ -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) {