feat(后台gm): 新增后台宝物查询功能
This commit is contained in:
@@ -86,6 +86,12 @@ export default class UserController extends Controller {
|
|||||||
ctx.body = await ctx.service.users.getItemList(page, pageSize, sortField, sortOrder, form);
|
ctx.body = await ctx.service.users.getItemList(page, pageSize, sortField, sortOrder, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getArtifactList() {
|
||||||
|
const { ctx } = this;
|
||||||
|
const { form } = ctx.request.body;
|
||||||
|
ctx.body = await ctx.service.users.getArtifactList(form);
|
||||||
|
}
|
||||||
|
|
||||||
public async getGuildList() {
|
public async getGuildList() {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
|
const { page, pageSize, sortField, sortOrder, form } = ctx.request.body;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ export default (app: Application) => {
|
|||||||
router.post('/api/users/setcreatetime', tokenParser, controller.users.setCreateTime);
|
router.post('/api/users/setcreatetime', tokenParser, controller.users.setCreateTime);
|
||||||
router.post('/api/users/getherolist', tokenParser,controller.users.getHeroList);
|
router.post('/api/users/getherolist', tokenParser,controller.users.getHeroList);
|
||||||
router.post('/api/users/getitemlist', tokenParser, controller.users.getItemList);
|
router.post('/api/users/getitemlist', tokenParser, controller.users.getItemList);
|
||||||
|
router.post('/api/users/getartifactlist', tokenParser, controller.users.getArtifactList);
|
||||||
|
|
||||||
router.post('/api/users/getguildlist', tokenParser, controller.users.getGuildList);
|
router.post('/api/users/getguildlist', tokenParser, controller.users.getGuildList);
|
||||||
router.post('/api/users/getmembersbyguildcode', tokenParser, controller.users.getMembersByGuildCode);
|
router.post('/api/users/getmembersbyguildcode', tokenParser, controller.users.getMembersByGuildCode);
|
||||||
router.post('/api/users/deleteitem', tokenParser, controller.users.deleteItem);
|
router.post('/api/users/deleteitem', tokenParser, controller.users.deleteItem);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import GiftCodeDetail, { GiftCodeDetailModel } from '@db/GiftCodeDetail';
|
|||||||
import { deletRole } from '@pubUtils/roleUtil';
|
import { deletRole } from '@pubUtils/roleUtil';
|
||||||
import { RScriptRecordModel } from '@db/RScriptRecord';
|
import { RScriptRecordModel } from '@db/RScriptRecord';
|
||||||
import { DicWar } from '@pubUtils/dictionary/DicWar';
|
import { DicWar } from '@pubUtils/dictionary/DicWar';
|
||||||
import { SearchHeroParam, SearchUserParam, SearchGiftCodeParam, SearchGiftCodeDetailParam, SearchItemParam, SearchGuildParam, SearchRoleParam } from '@domain/backEndField/search';
|
import { SearchHeroParam, SearchUserParam, SearchGiftCodeParam, SearchGiftCodeDetailParam, SearchItemParam, SearchGuildParam, SearchRoleParam, SearchArtifactParam } from '@domain/backEndField/search';
|
||||||
import { CreateGiftCode, UpdateGiftCode } from '@domain/backEndField/params';
|
import { CreateGiftCode, UpdateGiftCode } from '@domain/backEndField/params';
|
||||||
import { isNumber } from 'util';
|
import { isNumber } from 'util';
|
||||||
import { GuildModel } from '@db/Guild';
|
import { GuildModel } from '@db/Guild';
|
||||||
@@ -24,6 +24,7 @@ import { nowSeconds } from '@pubUtils/timeUtil';
|
|||||||
import { RoleCeModel, RoleCeType } from '@db/RoleCe';
|
import { RoleCeModel, RoleCeType } from '@db/RoleCe';
|
||||||
import { HangUpRecordModel } from '@db/HangUpRecord';
|
import { HangUpRecordModel } from '@db/HangUpRecord';
|
||||||
import { UserOrderModel } from '@db/UserOrder';
|
import { UserOrderModel } from '@db/UserOrder';
|
||||||
|
import { ArtifactModel } from '@db/Artifact';
|
||||||
const Excel = require('exceljs');
|
const Excel = require('exceljs');
|
||||||
|
|
||||||
// import { resResult } from '@pubUtils/util';
|
// import { resResult } from '@pubUtils/util';
|
||||||
@@ -488,6 +489,26 @@ export default class GMUsers extends Service {
|
|||||||
return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total })
|
return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async getArtifactList(form: SearchArtifactParam) {
|
||||||
|
const { ctx } = this;
|
||||||
|
|
||||||
|
let artifact = await ArtifactModel.findByRoleIdAndIsShowDel(form)
|
||||||
|
if (artifact && artifact.length > 0) {
|
||||||
|
artifact.forEach((ele) => {
|
||||||
|
let dicArtifact = gameData.artifact.get(ele.artifactId);
|
||||||
|
ele.artifactName = dicArtifact.name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const total = await ArtifactModel.countByCondition(form)
|
||||||
|
|
||||||
|
let list = artifact.map(cur => {
|
||||||
|
return { ...cur, env: ctx.app.config.realEnv }
|
||||||
|
})
|
||||||
|
|
||||||
|
return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total })
|
||||||
|
}
|
||||||
|
|
||||||
public async getGuildList(page: number, pageSize: number, sortField: string, sortOrder: string, form: SearchGuildParam) {
|
public async getGuildList(page: number, pageSize: number, sortField: string, sortOrder: string, form: SearchGuildParam) {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
let redisClient: RedisClient = ctx.app.context.redisClient;
|
let redisClient: RedisClient = ctx.app.context.redisClient;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import BaseModel from './BaseModel';
|
|||||||
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
|
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
|
||||||
import { RoleModel } from './Role';
|
import { RoleModel } from './Role';
|
||||||
import { genCode } from '../pubUtils/util';
|
import { genCode } from '../pubUtils/util';
|
||||||
|
import { SearchArtifactParam } from '../domain/backEndField/search';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 宝物
|
* 宝物
|
||||||
@@ -115,9 +116,35 @@ export default class Artifact extends BaseModel {
|
|||||||
let result: ArtifactModelType[] = await ArtifactModel.find({ batchCode, status: 1 }).lean();
|
let result: ArtifactModelType[] = await ArtifactModel.find({ batchCode, status: 1 }).lean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static getSearchObj(form: SearchArtifactParam) {
|
||||||
|
let { roleId, isShowDel } = form
|
||||||
|
let searchObj = {};
|
||||||
|
if (form.roleId) searchObj['roleId'] = roleId;
|
||||||
|
if (isShowDel && isShowDel == 1) {
|
||||||
|
searchObj['status'] = 1
|
||||||
}
|
}
|
||||||
|
return searchObj
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async countByCondition(form: SearchArtifactParam = {}) {
|
||||||
|
let searchObj = this.getSearchObj(form);
|
||||||
|
const result = await ArtifactModel.count(searchObj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async findByRoleIdAndIsShowDel(form) {
|
||||||
|
let searchObj = this.getSearchObj(form);
|
||||||
|
//.select("roleId roleName id artifactId artifactName lv quality qualityStage status")
|
||||||
|
const result: ArtifactModelType[] = await ArtifactModel.find(searchObj).lean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const ArtifactModel = getModelForClass(Artifact);
|
export const ArtifactModel = getModelForClass(Artifact);
|
||||||
|
|
||||||
export interface ArtifactModelType extends Pick<DocumentType<Artifact>, keyof Artifact> { }
|
export interface ArtifactModelType extends Pick<DocumentType<Artifact>, keyof Artifact> {
|
||||||
|
artifactName: string;
|
||||||
|
}
|
||||||
export type ArtifactModelUpdate = Partial<ArtifactModelType>; // 将所有字段变成可选项
|
export type ArtifactModelUpdate = Partial<ArtifactModelType>; // 将所有字段变成可选项
|
||||||
@@ -38,6 +38,11 @@ export interface SearchItemParam {
|
|||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SearchArtifactParam {
|
||||||
|
roleId?: string;
|
||||||
|
isShowDel?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SearchGuildParam {
|
export interface SearchGuildParam {
|
||||||
serverId?: number;
|
serverId?: number;
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|||||||
@@ -1006,5 +1006,12 @@
|
|||||||
"name": "上传excel",
|
"name": "上传excel",
|
||||||
"module": "server",
|
"module": "server",
|
||||||
"type": "update"
|
"type": "update"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 145,
|
||||||
|
"api": "/api/users/getartifactlist",
|
||||||
|
"name": "宝物查询",
|
||||||
|
"module": "user",
|
||||||
|
"type": "find"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user