🐞 fix(礼包码): 停止使用礼包码的record字段

This commit is contained in:
luying
2023-06-01 17:19:54 +08:00
parent 2f0e5d672f
commit e58ac6c4e5
4 changed files with 67 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ import { GiftCodeType, GiftCodeModel } from "../../../db/GiftCode";
import { nowSeconds } from "../../../pubUtils/timeUtil";
import { AP } from "../../../pubUtils/dicParam";
import { GiftPackageFloorModel } from "../../../db/GiftPackageFloor";
import { UserGiftCodeDetailModel } from "../../../db/UserGiftCodeDetail";
export default function (app: Application) {
new HandlerService(app, {});
@@ -187,17 +188,17 @@ export class ItemHandler {
return resResult(STATUS.GIFT_CODE_CHANNEL_ERR);
}
if (giftCodeDetail.roleIds.indexOf(roleId) != -1) {
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);
}
let checkHasUse2 = await UserGiftCodeDetailModel.checkHasUsed(roleId, giftCodeDetail.giftId)
if(checkHasUse2) {
return resResult(STATUS.YOU_HAVE_USED_THIS_CODE);
}
await GiftCodeDetailModel.increaseUsedNum(code, roleId, roleName, serverId);
await UserGiftCodeDetailModel.record(roleId, roleName, serverId, giftCodeDetail.giftId, code);
await GiftCodeDetailModel.increaseUsedNum(code);
await GiftCodeModel.increaseUsedNum(giftCode.id);
let goods = await addItems(roleId, roleName, sid, giftCode.goods, ITEM_CHANGE_REASON.USE_GIFT_CODE);