商店:玩家等级限制

This commit is contained in:
luying
2022-04-20 16:48:42 +08:00
parent d9956a5754
commit ce20af43c5
4 changed files with 118 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import { SHOP } from "../../../pubUtils/dicParam";
import { HeroModel } from "../../../db/Hero";
import { getShopListById } from "../../../services/shopService";
import { RewardInter } from "../../../pubUtils/interface";
import { RoleModel } from "../../../db/Role";
export default function(app: Application) {
return new ShopHandler(app);
@@ -54,6 +55,12 @@ export class ShopHandler {
return resResult(STATUS.GUILD_LV_LIMIT);
}
}
if(dicShopItem.lvlimit) {
let role = await RoleModel.findByRoleId(roleId, 'lv');
if(role.lv < dicShopItem.lvlimit) {
return resResult(STATUS.LV_LIMIT);
}
}
let userShop = await UserShopModel.findByRoleAndItem(roleId, dicShopItem.id);
if(dicShopItem.purchaseLimit != -1) {