红点:抽卡推送修改
This commit is contained in:
@@ -4,7 +4,7 @@ import { STATUS, GACHA_ID, HERO_QUALITY_TYPE, TASK_TYPE, REFRESH_TIME, TIME_OUTP
|
||||
import { gameData } from "../../../pubUtils/data";
|
||||
import { GachaListReturn, GachaResult, GachaData } from "../../../domain/activityField/gachaField";
|
||||
import { UserGachaModel } from "../../../db/UserGacha";
|
||||
import { refreshGacha, getFloorResult, getResultFromContentId, getGachaList } from "../../../services/gachaService";
|
||||
import { refreshGacha, getFloorResult, getResultFromContentId, getGachaList, getVisitedHeroList, getAllHeroByQuality } from "../../../services/gachaService";
|
||||
import { RoleModel } from "../../../db/Role";
|
||||
import { HeroModel } from "../../../db/Hero";
|
||||
import { RewardInter } from "../../../pubUtils/interface";
|
||||
@@ -14,7 +14,6 @@ import { UserGachaRecModel } from "../../../db/UserGachaRec";
|
||||
import { ActivityModel } from "../../../db/Activity";
|
||||
import { checkActivityTask, checkTask } from "../../../services/taskService";
|
||||
import { RECRUIT } from "../../../pubUtils/dicParam";
|
||||
import { getAllHeroByQuality } from "../../../services/gachaService";
|
||||
import { transPiece } from "../../../pubUtils/itemUtils";
|
||||
import { CreateHeroParam } from "../../../domain/roleField/hero";
|
||||
|
||||
@@ -291,10 +290,7 @@ export class GachaHandler {
|
||||
async getVisitedHero(msg: {}, session: BackendSession) {
|
||||
const roleId: string = session.get('roleId');
|
||||
|
||||
let { visitedHero, refVisitedTime } = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL, 0);
|
||||
if (shouldRefresh(refVisitedTime, new Date())) {
|
||||
visitedHero = [];
|
||||
}
|
||||
let visitedHero = await getVisitedHeroList(roleId);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
hids: visitedHero
|
||||
|
||||
@@ -19,7 +19,7 @@ import { getAllAssistCnt } from './comBattleService';
|
||||
import { getDungeonData } from './dungeonService';
|
||||
import { PvpSeasonResultModel } from '../db/PvpSeasonResult';
|
||||
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
|
||||
import { getGachaList } from './gachaService';
|
||||
import { getGachaList, getVisitedHeroList } from './gachaService';
|
||||
import { getSchoolList } from './roleService';
|
||||
import { addRoleToGuildChannel } from './chatChannelService';
|
||||
import { getMyGuildInfo, getGuildWithRefActive, getUserGuildWithRefActive, getWishPool } from './guildService';
|
||||
@@ -98,7 +98,9 @@ export async function pushData(role: RoleType, session: FrontendOrBackendSession
|
||||
case 'pvp': // pvp
|
||||
return await getPvpEntryData(roleId);
|
||||
case 'gacha':
|
||||
return await getGachaList(roleId);
|
||||
const gachalist = await getGachaList(roleId);
|
||||
const visitList = await getVisitedHeroList(roleId);
|
||||
return { gachalist, visitList }
|
||||
case 'school':
|
||||
return await getSchoolList(roleId);
|
||||
case 'guild':
|
||||
|
||||
@@ -69,6 +69,17 @@ export async function refreshGacha(dicGacha: DicGacha, userGacha: UserGachaType)
|
||||
return userGacha
|
||||
}
|
||||
|
||||
|
||||
export async function getVisitedHeroList(roleId: string) {
|
||||
|
||||
let { visitedHero, refVisitedTime } = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL, 0);
|
||||
if (shouldRefresh(refVisitedTime, new Date())) {
|
||||
visitedHero = [];
|
||||
}
|
||||
|
||||
return visitedHero;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获得保底结果
|
||||
* @param gachaId 招募表id
|
||||
|
||||
@@ -41,10 +41,10 @@ export default class Game extends Service {
|
||||
|
||||
public async getServerList() {
|
||||
const { ctx } = this;
|
||||
const { page, pageSize, sortField, sortOrder, id, serverId, name, groupName, groupId, serverType } = ctx.request.body;
|
||||
const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
|
||||
|
||||
const list = await ServerlistModel.findByCondition(page, pageSize, sortField, sortOrder, id, serverId, name, groupName, groupId, serverType);
|
||||
const total = await ServerlistModel.countByCondition( id, serverId, name, groupName, groupId, serverType)
|
||||
const list = await ServerlistModel.findByCondition(page, pageSize, sortField, sortOrder, form);
|
||||
const total = await ServerlistModel.countByCondition( form )
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list, total
|
||||
});
|
||||
|
||||
@@ -92,15 +92,20 @@ export default class Serverlist extends BaseModel {
|
||||
return server;
|
||||
}
|
||||
|
||||
public static async findByCondition(page: number, pageSize: number, sortField: string, sortOrder: string, id: number, serverId: string|number, name: string, groupName: string, groupId: number, serverType: string) {
|
||||
|
||||
private static getSearchObj(form: { id?: number, serverId?: string|number, name?: string, groupName?: string, groupId?: number, serverType?: string }) {
|
||||
let searchObj = {};
|
||||
if (id != undefined) searchObj['id'] = id;
|
||||
if (serverId != undefined) searchObj['groupId'] = groupId;
|
||||
if (name != undefined) searchObj['name'] = name;
|
||||
if (groupName != undefined) searchObj['groupName'] = groupName;
|
||||
if (serverType != undefined) searchObj['serverType'] = serverType;
|
||||
if (form.id != undefined) searchObj['id'] = form.id;
|
||||
if (form.serverId != undefined) searchObj['groupId'] = form.groupId;
|
||||
if (form.name != undefined) searchObj['name'] = { $regex: new RegExp(form.name.toString(), 'i') };
|
||||
if (form.groupName != undefined) searchObj['groupName'] = { $regex: new RegExp(form.groupName.toString(), 'i') };
|
||||
if (form.serverType != undefined) searchObj['serverType'] = form.serverType;
|
||||
return searchObj
|
||||
}
|
||||
|
||||
public static async findByCondition(page: number, pageSize: number, sortField: string, sortOrder: string, form: { id?: number, serverId?: string|number, name?: string, groupName?: string, groupId?: number, serverType?: string } = {}) {
|
||||
|
||||
let searchObj = ServerlistModel.getSearchObj(form);
|
||||
console.log(searchObj, form)
|
||||
let sort = {};
|
||||
if(sortField && sortOrder) {
|
||||
if(sortOrder == 'ascend') {
|
||||
@@ -114,14 +119,9 @@ export default class Serverlist extends BaseModel {
|
||||
|
||||
}
|
||||
|
||||
public static async countByCondition(id: number, serverId: string|number, name: string, groupName: string, groupId: number, serverType: string) {
|
||||
let searchObj = {};
|
||||
if (id != undefined) searchObj['id'] = id;
|
||||
if (serverId != undefined) searchObj['groupId'] = groupId;
|
||||
if (name != undefined) searchObj['name'] = name;
|
||||
if (groupName != undefined) searchObj['groupName'] = groupName;
|
||||
if (serverType != undefined) searchObj['serverType'] = serverType;
|
||||
public static async countByCondition(form: { id?: number, serverId?: string|number, name?: string, groupName?: string, groupId?: number, serverType?: string } = {}) {
|
||||
|
||||
let searchObj = ServerlistModel.getSearchObj(form);
|
||||
const result = await ServerlistModel.count(searchObj);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user