后台:礼包码
This commit is contained in:
@@ -152,7 +152,9 @@ export class ItemHandler {
|
||||
if(!giftCode) {
|
||||
return resResult(STATUS.GIFT_CODE_NOT_FOUND);
|
||||
}
|
||||
|
||||
if(giftCode.generateType == GIFT_GENERATE_TYPE.ONE_TO_ONE) { // 一人一条,单条不能被多人使用
|
||||
if(giftCodeDetail.usedNum > 0) return resResult(STATUS.GIFT_CODE_USED_NUM_MAX);
|
||||
}
|
||||
if(!giftCode.isEnable) return resResult(STATUS.GIFT_CODE_HAS_EXPIRED);
|
||||
if (giftCode.beginTime > nowSeconds()) return resResult(STATUS.GIFT_CODE_NOT_START);
|
||||
if (giftCode.endTime < nowSeconds()) return resResult(STATUS.GIFT_CODE_HAS_EXPIRED);
|
||||
@@ -161,6 +163,12 @@ export class ItemHandler {
|
||||
return resResult(STATUS.YOU_HAVE_USED_THIS_CODE);
|
||||
}
|
||||
|
||||
let checkHasUse = await GiftCodeDetailModel.checkHasUsed(roleId, giftCodeDetail.giftId)
|
||||
if(checkHasUse) {
|
||||
return resResult(STATUS.YOU_HAVE_USED_THIS_CODE);
|
||||
}
|
||||
|
||||
|
||||
await GiftCodeDetailModel.increaseUsedNum(code, roleId, roleName, serverId);
|
||||
await GiftCodeModel.increaseUsedNum(giftCode.id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user