feat(37需求): 礼包码的使用限制通过order_id判断

This commit is contained in:
luying
2023-04-10 10:38:40 +08:00
parent 2ce30ee807
commit 06c03ed709
3 changed files with 10 additions and 7 deletions

View File

@@ -63,6 +63,12 @@ export default class GiftCodeDetail extends BaseModel {
return result;
}
public static async checkOrderHasUsed(id: number, orderId: string) {
let result = await GiftCodeDetailModel.exists({ giftId: id, 'record.orderId': orderId });
return result;
}
public static async findAllCodeByGiftId(id: number, cnt: number) {
let n = Math.ceil(cnt/1000);
let result: GiftCodeDetailType[] = [];