handleCost方法去掉channelService传参

This commit is contained in:
luying
2020-12-09 14:30:15 +08:00
parent 168e0a8d28
commit dca5ae3d5f
3 changed files with 7 additions and 8 deletions

View File

@@ -3,12 +3,11 @@ import { EquipModel } from './../db/Equip';
import { CounterModel } from './../db/Counter';
import { decodeStr, resResult } from '../pubUtils/util';
import { getGoodById } from '../pubUtils/gamedata';
import Role, { RoleModel } from '../db/Role';
import { RoleModel } from '../db/Role';
import { setAp } from './actionPointService';
import { ItemModel } from '../db/Item';
import { ChannelService } from 'pinus';
import { isRegExp } from 'util';
import { STATUS } from '../consts/statusCode';
import { pinus } from 'pinus';
export async function handleFixedReward(roleId: string, roleName: string, rewardStr: string, multi: number) {
let reward = decodeStr('fixReward', rewardStr);
@@ -124,7 +123,7 @@ async function rewardCurrency (roleId: string, dicGood: any, data: {id:number,cn
return goods;
}
export async function handleCost(channelService: ChannelService, roleId: string, sid: string, goods: Array<{id: number, count: number}>) {
export async function handleCost(roleId: string, sid: string, goods: Array<{id: number, count: number}>) {
// 检查道具数量
let role, costGold = 0, costCoin = 0, items = new Array<{id: number, count: number}>(), ids = new Array<number>() ;
for(let {id, count} of goods) {
@@ -173,7 +172,7 @@ export async function handleCost(channelService: ChannelService, roleId: string,
}
let uids = [{uid: roleId, sid}];
channelService.pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: resultGoods, gold, coin} ), uids);
pinus.app.get('channelService').pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: resultGoods, gold, coin} ), uids);
return true
}