🐞 fix(礼包码): 停止使用礼包码的record字段
This commit is contained in:
@@ -2,7 +2,6 @@ import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
|
||||
import { GIFT_GENERATE_TYPE } from '../consts';
|
||||
import { GiftCodeModel, GiftCodeType } from './GiftCode';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { SearchGiftCodeDetailParam } from '../domain/backEndField/search';
|
||||
|
||||
@@ -55,7 +54,7 @@ export default class GiftCodeDetail extends BaseModel {
|
||||
|
||||
// 根据code
|
||||
public static async findByCode(code: string) {
|
||||
let result: GiftCodeDetailType = await GiftCodeDetailModel.findOne({ code }).lean(true);
|
||||
let result: GiftCodeDetailType = await GiftCodeDetailModel.findOne({ code }).select('-record').lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -78,11 +77,10 @@ export default class GiftCodeDetail extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async increaseUsedNum(code: string, roleId: string, roleName: string, serverId: number, orderId?: string) {
|
||||
let result: GiftCodeDetailType = await GiftCodeDetailModel.findOneAndUpdate({ code }, {
|
||||
$inc: { usedNum: 1 }, $push: { roleIds: roleId, record: { roleId, roleName, serverId, time: nowSeconds(), orderId } }
|
||||
public static async increaseUsedNum(code: string) {
|
||||
await GiftCodeDetailModel.updateOne({ code }, {
|
||||
$inc: { usedNum: 1 }
|
||||
}, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async generateMany(giftCode: GiftCodeType, count = 1, uid = 1) {
|
||||
|
||||
Reference in New Issue
Block a user