diff --git a/game-server/app/services/timeTaskService.ts b/game-server/app/services/timeTaskService.ts index 094d8d542..43534fcd6 100644 --- a/game-server/app/services/timeTaskService.ts +++ b/game-server/app/services/timeTaskService.ts @@ -8,7 +8,7 @@ import { getPvpGkWarIds, getPvpRankRewards, getPvpHeroRewards, getResultMaxRank import { deepCopy, getRandomArr, resResult, shouldRefresh } from '../pubUtils/util'; import { getLvByScore } from './pvpService'; import { getMyRank, setRank, resetPvpRanks, getAllOnlineRoles } from './redisService'; -import { MAIL_TYPE, REDIS_KEY, ADULT_AGE, GUEST_MAX_TIME } from '../consts'; +import { MAIL_TYPE, REDIS_KEY, ADULT_AGE, GUEST_MAX_TIME, ADDICTION_PREVENTION_CODE } from '../consts'; import { RankParam } from '../domain/rank'; import { RoleModel } from '../db/Role'; import { MailModel, MailType } from '../db/Mail'; @@ -280,8 +280,8 @@ export async function reportOnlineSchedule() { let age = getAge(birthday); let isAdult = age >= ADULT_AGE; - // TODO 将code含义写入const - if(result.code != 1) { // 未成年人防沉迷 + + if(result.code != ADDICTION_PREVENTION_CODE.SUCCESS) { // 未成年人防沉迷 pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, { isGuest, guestTime, // 游客已体验时间 @@ -303,7 +303,7 @@ export async function reportOnlineSchedule() { hasAuthenticated, // 是否进行过实名认证 isAdult, // 是否已成年 todayPlayTime: result.total, // 今天已游戏时长 - type: 1 + type: ADDICTION_PREVENTION_CODE.GUEST, } ), [{uid: roleId, sid: sid}]); } } diff --git a/shared/consts/constModules/sysConst.ts b/shared/consts/constModules/sysConst.ts index f1eefd137..e04498be2 100644 --- a/shared/consts/constModules/sysConst.ts +++ b/shared/consts/constModules/sysConst.ts @@ -399,4 +399,13 @@ export enum BLOCK_OPEATE { export enum TIME_FORMAT { TYPE_SLASH = 1 +} + +export enum ADDICTION_PREVENTION_CODE { + FAIL = -1, + SUCCESS = 1, // 接口的返回 + GUEST = 1, // 返回给客户端时,游客时间超时 + CURFEW = 2, // 每日22时至次日8时,未成年禁止游戏 + HOLIDAY = 3, // 法定节假日每日累计不得超过3小时 + WORKDAY = 4, // 非法定节假日每日累计不得超过1.5小时 } \ No newline at end of file