Revert "✨ feat(db): 修改对item表的数据库操作方式"
This reverts commit 97a36fda70fc1ccbb7f310b04d149f46f997a614.
This commit is contained in:
@@ -4,7 +4,7 @@ import Hero from '@db/Hero';
|
||||
|
||||
import { Service } from 'egg';
|
||||
import { STATUS, REDIS_KEY, WAR_TYPE } from '@consts';
|
||||
import Item from '@db/Item';
|
||||
import { ItemModel } from '@db/Item';
|
||||
import { gameData } from '@pubUtils/data';
|
||||
import { smsModel } from '@db/Sms';
|
||||
import { isString } from 'underscore';
|
||||
@@ -139,7 +139,7 @@ export default class GMUsers extends Service {
|
||||
let list = [];
|
||||
for (let role of roles) {
|
||||
let heroCount = await Hero.countByCondition({ roleId: role.roleId });
|
||||
let itemCount = await Item.countByCondition({ roleId: role.roleId });
|
||||
let itemCount = await ItemModel.count({ roleId: role.roleId }).lean();
|
||||
|
||||
let { roleId, roleName, serverId, lv, gold, coin, ce, blockType = 0, blockReason = '', fixedIpLocation, ip, ipLocation, totalPay } = role;
|
||||
let { uid, tel } = role.userInfo;
|
||||
@@ -368,7 +368,7 @@ export default class GMUsers extends Service {
|
||||
}
|
||||
|
||||
for (let [roleId, ids] of map) {
|
||||
await Item.deletebyRoleAndIds(roleId, ids);
|
||||
await ItemModel.deletebyRoleAndIds(roleId, ids);
|
||||
}
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
@@ -393,7 +393,7 @@ export default class GMUsers extends Service {
|
||||
// }
|
||||
|
||||
// for (let [roleId, ids] of map) {
|
||||
// await Item.updateCountByRoleAndIds(roleId, ids, count);
|
||||
// await ItemModel.updateCountByRoleAndIds(roleId, ids, count);
|
||||
// }
|
||||
|
||||
// return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
@@ -478,8 +478,8 @@ export default class GMUsers extends Service {
|
||||
public async getItemList(page: number, pageSize: number, sortField: string, sortOrder: string, form: SearchItemParam) {
|
||||
const { ctx } = this;
|
||||
|
||||
const items = await Item.findByCondition(page, pageSize, sortField, sortOrder, form);
|
||||
const total = await Item.countByCondition( form )
|
||||
const items = await ItemModel.findByCondition(page, pageSize, sortField, sortOrder, form);
|
||||
const total = await ItemModel.countByCondition( form )
|
||||
|
||||
let list = items.map(cur => {
|
||||
return {...cur, env: ctx.app.config.realEnv}
|
||||
|
||||
Reference in New Issue
Block a user