结算获取消耗品和金币
This commit is contained in:
@@ -2,7 +2,6 @@ import { UserModel } from '@db/User';
|
||||
import { RoleModel } from '@db/Role';
|
||||
import { HeroModel } from '@db/Hero';
|
||||
import { EquipModel } from '@db/Equip';
|
||||
import { ItemModel } from '@db/Item';
|
||||
import { CounterModel } from '@db/Counter';
|
||||
import { ActionPointModel } from '@db/ActionPoint';
|
||||
import { BattleDropModel } from '@db/BattleDrop';
|
||||
@@ -15,8 +14,6 @@ import { ExpeditionRecordModel } from '@db/ExpeditionRecord';
|
||||
import { ExpeditionWarRecordModel } from '@db/ExpeditionWarRecord';
|
||||
import { HangUpRecordModel } from '@db/HangUpRecord';
|
||||
import { HangUpSpdUpRecModel } from '@db/HangUpSpdUpRec';
|
||||
import { HeroSoulModel } from '@db/HeroSoul';
|
||||
import { ScriptItemModel } from '@db/ScriptItem';
|
||||
import { SearchRecordModel } from '@db/SearchRecord';
|
||||
import { TowerRecordModel } from '@db/TowerRecord';
|
||||
import { TowerTaskRecModel } from '@db/TowerTaskRec';
|
||||
@@ -24,6 +21,8 @@ import { TowerTaskRecModel } from '@db/TowerTaskRec';
|
||||
import { Service } from 'egg';
|
||||
import Counter from '@db/Counter';
|
||||
import { STATUS } from '@consts/statusCode';
|
||||
import { getGoodById } from '@pubUtils/gamedata';
|
||||
import { ITID } from '@consts/consts';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -107,10 +106,7 @@ export default class GMUsers extends Service {
|
||||
await HangUpSpdUpRecModel.deleteAccount(roleId);
|
||||
await HangUpRecordModel.deleteAccount(roleId);
|
||||
await HeroModel.deleteAccount(roleId);
|
||||
await HeroSoulModel.deleteAccount(roleId);
|
||||
await ItemModel.deleteAccount(roleId);
|
||||
await RoleModel.deleteAccount(roleId);
|
||||
await ScriptItemModel.deleteAccount(roleId);
|
||||
await SearchRecordModel.deleteAccount(roleId);
|
||||
await TowerTaskRecModel.deleteAccount(roleId);
|
||||
await TowerRecordModel.deleteAccount(roleId);
|
||||
@@ -161,11 +157,11 @@ export default class GMUsers extends Service {
|
||||
for(let role of roles) {
|
||||
let heroCount = await HeroModel.count({roleId: role.roleId}).lean();
|
||||
let equipCount = await EquipModel.count({roleId: role.roleId}).lean();
|
||||
let itemCount = await ItemModel.count({roleId: role.roleId}).lean();
|
||||
let {roleId, roleName, serverId, lv, vLv} = role;
|
||||
let itemCount = (role.consumeGoods?role.consumeGoods.length: 0) + (role.souls?role.souls.length:0);
|
||||
let {roleId, roleName, serverId, lv, vLv, gold, coin} = role;
|
||||
let {uid, tel} = role.userInfo;
|
||||
result.push({
|
||||
key: roleId, roleId, roleName, serverId, lv, vLv, uid, tel, heroCount, equipCount, itemCount
|
||||
key: roleId, roleId, roleName, serverId, lv, vLv, uid, tel, heroCount, equipCount, itemCount, gold, coin
|
||||
});
|
||||
}
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, { list: result });
|
||||
@@ -274,32 +270,12 @@ export default class GMUsers extends Service {
|
||||
let itemid = parseInt(_itemid);
|
||||
let itemcount = parseInt(_itemcount);
|
||||
if(isNaN(itemid) || isNaN(itemcount)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
console.log('gm createEquip');
|
||||
let dicGoods = getGoodById(itemid);
|
||||
let itidObj = ITID.get(dicGoods.itid);
|
||||
|
||||
let flag = 0;
|
||||
for(let roleId of uids) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
if(role) {
|
||||
let item = await ItemModel.findbyItemid(itemid, roleId);
|
||||
if(item) {
|
||||
await ItemModel.changeItemCount(item.seqId, itemcount);
|
||||
} else {
|
||||
const seqId = await CounterModel.getNewCounter('itemid')||-1;
|
||||
const itemInfo = {
|
||||
roleId,
|
||||
roleName: role.roleName,
|
||||
itemid,
|
||||
itemName: '包子',
|
||||
seqId,
|
||||
type: 1,
|
||||
count: itemcount
|
||||
}
|
||||
await ItemModel.createItem(itemInfo);
|
||||
}
|
||||
} else {
|
||||
flag = 1;
|
||||
}
|
||||
await RoleModel.addItems(roleId, itidObj?itidObj.field||'':'', itemid, itemcount);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@db/*": ["app/db/*"],
|
||||
"@consts/*": ["app/consts/*"]
|
||||
"@consts/*": ["app/consts/*"],
|
||||
"@pubUtils/*": ["app/pubUtils/*"]
|
||||
},
|
||||
},
|
||||
"exclude": [
|
||||
|
||||
Reference in New Issue
Block a user