军团:bug修复
This commit is contained in:
@@ -5,7 +5,7 @@ import { WishPoolReportModel } from '../../../db/WishPoolReport';
|
||||
import { resResult, genCode } from '../../../pubUtils/util';
|
||||
import { STATUS } from '../../../consts';
|
||||
import { getArmyWishPoolBaseByLv, getGoodById } from '../../../pubUtils/data';
|
||||
import { addItems, checkGoods } from '../../../services/rewardService';
|
||||
import { addItems, checkGoods, checkHeroes } from '../../../services/rewardService';
|
||||
import { IT_TYPE } from '../../../consts/constModules/itemConst';
|
||||
import { GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
|
||||
import { refreshUserGuild, getWishPool, getUserGuildWithRefActive } from '../../../services/guildService';
|
||||
@@ -14,6 +14,7 @@ import { RoleModel } from '../../../db/Role';
|
||||
import { getRoleOnlineInfo } from '../../../services/redisService';
|
||||
import { ARMY } from '../../../pubUtils/dicParam';
|
||||
import { guildInter } from '../../../pubUtils/interface';
|
||||
import { getSeconds, nowSeconds } from '../../../pubUtils/timeUtil';
|
||||
export default function(app: Application) {
|
||||
return new WishPoolHandler(app);
|
||||
}
|
||||
@@ -50,7 +51,7 @@ export class WishPoolHandler {
|
||||
let result = await checkGoods(roleId, [goodId]);
|
||||
if (!result) {
|
||||
if (goodInfo.itid == IT_TYPE.HERO_PIECE ) {
|
||||
result = await checkGoods(roleId, [goodInfo.hid]);
|
||||
result = await checkHeroes(roleId, [goodInfo.hid]);
|
||||
if (!result)
|
||||
return resResult(STATUS.GUILD_WISH_POOL_NOT_OWN_HERO);
|
||||
} else if (goodInfo.itid == IT_TYPE.EQUIP_PIECE ) {
|
||||
@@ -59,7 +60,8 @@ export class WishPoolHandler {
|
||||
return resResult(STATUS.GUILD_WISH_POOL_NOT_OWN_EQUIP);
|
||||
}
|
||||
}
|
||||
const { guildCode: code, wishGoods } = userGuild;
|
||||
const { guildCode: code, wishGoods, receivedWishPool, createdAt } = userGuild;
|
||||
|
||||
let { structure } = await GuildModel.findGuild(code, serverId, 'structure');
|
||||
let { lv } = findWhere(structure, {id: GUILD_STRUCTURE.WISH_POOL});
|
||||
let { wishGoodsEquips, wishGoodsHeros } = getArmyWishPoolBaseByLv(lv);
|
||||
@@ -68,6 +70,9 @@ export class WishPoolHandler {
|
||||
if (resType == type)
|
||||
len++;
|
||||
});
|
||||
if(receivedWishPool.indexOf(type) != -1 && getSeconds(createdAt) > nowSeconds()) {
|
||||
return resResult(STATUS.HAS_REACH_WISH_COUNT_LIMIT);
|
||||
}
|
||||
if (len >= ARMY.ARMY_WISH_TIMES) //今日已经许愿过
|
||||
return resResult(STATUS.HAS_REACH_WISH_COUNT_LIMIT);
|
||||
if (type == 1) {
|
||||
@@ -135,7 +140,7 @@ export class WishPoolHandler {
|
||||
let userGuild = await refreshUserGuild(myUserGuild, roleId);
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { wishGoods } = userGuild;
|
||||
const { wishGoods, receivedWishPool } = userGuild;
|
||||
let index = findIndex(wishGoods, { id });
|
||||
if (index == -1)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
@@ -143,7 +148,9 @@ export class WishPoolHandler {
|
||||
if (drawCnt <= 0)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
wishGoods[index].drawCnt = 0;
|
||||
let result = await UserGuildModel.updateInfo(roleId, { wishGoods }, {});
|
||||
if(receivedWishPool.indexOf(wishGoods[index].type) == -1) receivedWishPool.push(wishGoods[index].type);
|
||||
|
||||
let result = await UserGuildModel.updateInfo(roleId, { wishGoods, receivedWishPool }, {});
|
||||
if (!result)
|
||||
resResult(STATUS.INTERNAL_ERR);
|
||||
let goods = await addItems(roleId, roleName, sid, [{ id : goodId, count: drawCnt }]);
|
||||
|
||||
Reference in New Issue
Block a user