添加domain文件夹

This commit is contained in:
luying
2021-02-01 17:10:14 +08:00
parent 67668097d6
commit 39b68de801
23 changed files with 299 additions and 161 deletions
@@ -9,7 +9,8 @@ import { ARMY } from '../../../pubUtils/dicParam';
import { handleCost, addItems } from '../../../services/rewardService';
import { getGoldObject } from '../../../pubUtils/itemUtils';
import { nowSeconds, getBeforeDaySeconds, getSeconds } from '../../../pubUtils/timeUtil';
import { GuildListInfo, GuildRankParam, GuildLeader } from '../../../pubUtils/interface';
import { GuildListInfo } from '../../../domain/battleField/guild';
import { GuildRankParam, GuildLeader } from '../../../domain/rank';
import { UserGuildApplyModel } from '../../../db/UserGuildApply';
import { hasStructureConsume, getStructureConsume, gameData } from '../../../pubUtils/data';
import { GuildRecModel } from '../../../db/GuildRec';
@@ -7,7 +7,9 @@ import { STATUS } from '../../../consts/statusCode';
import { resResult, genCode } from '../../../pubUtils/util';
import { PvpDefenseModel, OppPlayers } from '../../../db/PvpDefense';
import { pvpEndParamInter, RankParam, PlayerDetail, PlayerDetailHero } from '../../../pubUtils/interface';
import { pvpEndParamInter } from '../../../pubUtils/interface';
import { RankParam } from '../../../domain/rank';
import { PlayerDetail, PlayerDetailHero } from '../../../domain/battleField/guild';
import { PVP_HERO_POS, REDIS_KEY } from '../../../consts';
import { PVP } from '../../../pubUtils/dicParam';
import { addItems } from '../../../services/rewardService';
@@ -12,7 +12,7 @@ import { calcuHangUpReward, checkTaskConditions, checkHangUpSpdUpCnt, createCurT
import { handleFixedReward, addItems, handleCost } from '../../../services/rewardService';
import { checkBattleHeroes } from '../../../services/normalBattleService';
import { getRank, setRank, existsRank, initSingleRankWithServer } from '../../../services/redisService';
import { RankParam } from '../../../pubUtils/interface';
import { RankParam } from '../../../domain/rank';
import { getGoldObject } from '../../../pubUtils/itemUtils';
export default function(app: Application) {
@@ -14,7 +14,7 @@ import { chackFunOpenWhenLogin } from '../../../services/funcSwitchService';
import { loginRefresh } from '../../../services/playerEventService';
import { nowSeconds } from '../../../pubUtils/timeUtil';
import { getRedis, setRedis, delRedis, rmRoleFromQueue } from '../../../services/redisService';
import { GuildModel } from '../../../db/Guild';
export default function (app: Application) {
return new EntryHandler(app);
}
@@ -0,0 +1,29 @@
import { Application, BackendSession } from "pinus";
import { resResult, getRandEelm } from "../../../pubUtils/util";
import { STATUS, ROLE } from "../../../consts";
import { RoleModel } from "../../../db/Role";
import { getBeforeDaySeconds } from "../../../pubUtils/timeUtil";
export default function (app: Application) {
return new FriendHandler(app);
}
export class FriendHandler {
constructor(private app: Application) {
}
// 获取推荐好友列表
public async getRecommend(msg: { }, session: BackendSession) {
let roleId: string = session.get('roleId');
const day = getBeforeDaySeconds(1);
const { lv } = await RoleModel.findByRoleId(roleId, ROLE.GET_LV);
const allList = await RoleModel.getRecommedList(lv - 5, lv + 5, day);
let list = getRandEelm(allList, 10);
if(!list.length) list = allList;
return resResult(STATUS.SUCCESS, { list });
}
}