后台:礼包码区分渠道

This commit is contained in:
luying
2022-04-09 15:20:04 +08:00
parent a23759335e
commit 6b13034c62
9 changed files with 24 additions and 15 deletions

View File

@@ -149,6 +149,7 @@ export class ItemHandler {
const roleName: string = session.get('roleName');
const serverId: number = session.get('serverId');
const sid: string = session.get('sid');
const channel: string = session.get('channel');
const { code } = msg;
let giftCodeDetail = await GiftCodeDetailModel.findByCode(code);
@@ -166,6 +167,10 @@ export class ItemHandler {
if (giftCode.beginTime > nowSeconds()) return resResult(STATUS.GIFT_CODE_NOT_START);
if (giftCode.endTime < nowSeconds()) return resResult(STATUS.GIFT_CODE_HAS_EXPIRED);
if(giftCode.channel.indexOf('all') == -1 && giftCode.channel.indexOf(channel) == -1) {
return resResult(STATUS.GIFT_CODE_CHANNEL_ERR);
}
if (giftCodeDetail.roleIds.indexOf(roleId) != -1) {
return resResult(STATUS.YOU_HAVE_USED_THIS_CODE);
}