添加debug接口

This commit is contained in:
luying
2021-03-05 11:45:33 +08:00
parent 8a122b6a4d
commit b1ceb1b695
5 changed files with 126 additions and 2 deletions
@@ -2,7 +2,7 @@ import { STATUS } from '../../../consts/statusCode';
import { RoleModel } from './../../../db/Role';
import { HeroModel } from '../../../db/Hero';
import { resResult, decodeIdCntArrayStr, parseGoodStr } from '../../../pubUtils/util';
import {Application, BackendSession} from 'pinus';
import {Application, BackendSession, pinus} from 'pinus';
import { handleCost } from '../../../services/rewardService';
import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp } from '../../../pubUtils/data';
import { SCHOOL, SCROLL } from '../../../pubUtils/dicParam';
@@ -358,4 +358,50 @@ export class RoleHandler {
});
}
async debugPlayerTime(msg: { type: number }, session: BackendSession) {
let { type } = msg;
let roleId = session.get('roleId');
let sid = session.get('sid');
if(type == 1) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
isGuest: true,
guestTime: 60 * 60, // 游客已体验时间
hasAuthenticated: false, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 60 * 60, // 今天已游戏时长
type: 1
} ), [{uid: roleId, sid: sid}]);
} else if (type == 2) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
isGuest: false,
guestTime: 0, // 游客已体验时间
hasAuthenticated: true, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 60 * 60, // 今天已游戏时长
type: 2
} ), [{uid: roleId, sid: sid}]);
} else if (type == 3) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
isGuest: false,
guestTime: 0, // 游客已体验时间
hasAuthenticated: true, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 3 * 60 * 60, // 今天已游戏时长
type: 3
} ), [{uid: roleId, sid: sid}]);
} else if (type == 4) {
pinus.app.channelService.pushMessageByUids('onPlayTime', resResult(STATUS.SUCCESS, {
isGuest: false,
guestTime: 0, // 游客已体验时间
hasAuthenticated: true, // 是否进行过实名认证
isAdult: false, // 是否已成年
todayPlayTime: 1.5 * 60 * 60, // 今天已游戏时长
type: 4
} ), [{uid: roleId, sid: sid}]);
}
return resResult(STATUS.SUCCESS);
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ export async function init() {
// 周功勋结算任务
guildWeeklyJobId = scheduleJob('settleGuildWeekly', '0 0 0 * * 1', settleGuildWeekly);
scheduleJob('reportOnline', '* 0/5 * * * *', reportOnlineSchedule)
scheduleJob('reportOnline', '0 0/5 * * * *', reportOnlineSchedule)
}
function setPvpSeasonSchdule() {
+1
View File
@@ -47,6 +47,7 @@
"redis": "^3.0.2",
"redlock": "^4.2.0",
"reflect-metadata": "^0.1.10",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"source-map-support": "^0.5.0",
"ts-node": "^8.2.0"