32 lines
948 B
TypeScript
32 lines
948 B
TypeScript
import { Service } from 'egg';
|
|
import { STATUS } from '@consts';
|
|
import { SearchLogParam, SearchUserLogParam } from '@domain/backEndField/search';
|
|
import { GMRecordModel } from '@db/GMRecord';
|
|
import { UserLogModel } from '@db/UserLog';
|
|
|
|
/**
|
|
* Test Service
|
|
*/
|
|
export default class Log extends Service {
|
|
|
|
/**
|
|
* 获取后台操作日志
|
|
*/
|
|
public async getGmLog(page: number, pageSize: number, form: SearchLogParam) {
|
|
const {ctx} = this;
|
|
|
|
let list = await GMRecordModel.findByCondition(page, pageSize, form);
|
|
return ctx.service.utils.resResult(STATUS.SUCCESS, { list });
|
|
}
|
|
|
|
/**
|
|
* 获取玩家日志
|
|
*/
|
|
public async getUserLog(page: number, pageSize: number, form: SearchUserLogParam) {
|
|
const {ctx} = this;
|
|
|
|
let list = await UserLogModel.findByCondition(page, pageSize, form);
|
|
return ctx.service.utils.resResult(STATUS.SUCCESS, { list: list.map(cur => ({...cur, env: ctx.app.config.realEnv})) });
|
|
}
|
|
}
|