活动:新手限定礼包

This commit is contained in:
qiaoxin
2021-05-11 17:03:59 +08:00
parent b268c85fa2
commit df13e8181e
26 changed files with 412 additions and 154 deletions

View File

@@ -9,7 +9,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
export default class ActivitySelfServiceShop extends BaseModel {
@prop({ required: true })
acvitityId: number; // 活动Id
activityId: number; // 活动Id
@prop({ required: true })
roundIndex: number; // 活动第几周期 从1开始根据活动开始时间计算
@prop({ required: true })
@@ -24,33 +24,33 @@ export default class ActivitySelfServiceShop extends BaseModel {
goods: string; // 商品信息
//添加购买记录
public static async addBuyRecord(acvitityId: number, roleId: string, roundIndex: number, index: number, price: number, priceType: number, goods: string) {
public static async addBuyRecord(activityId: number, roleId: string, roundIndex: number, index: number, price: number, priceType: number, goods: string) {
await ActivitySelfServiceShopModel.insertMany([
{ roleId, acvitityId, roundIndex, index, price, priceType, goods }
{ roleId, activityId, roundIndex, index, price, priceType, goods }
])
}
//根据活动id查询活动数据
public static async findData(acvitityId: number, roleId: string, roundIndex: number, lean = true) {
let result: ActivitySelfServiceShopModelType[] = await ActivitySelfServiceShopModel.find({ roleId, acvitityId, roundIndex }).lean(lean);
public static async findData(activityId: number, roleId: string, roundIndex: number, lean = true) {
let result: ActivitySelfServiceShopModelType[] = await ActivitySelfServiceShopModel.find({ roleId, activityId, roundIndex }).lean(lean);
return result;
}
//查询第几个货架数据
public static async findDataByIndex(acvitityId: number, roleId: string, roundIndex: number, index: number, lean = true) {
let result: ActivitySelfServiceShopModelType[] = await ActivitySelfServiceShopModel.find({ roleId, acvitityId, roundIndex, index }).lean(lean);
public static async findDataByIndex(activityId: number, roleId: string, roundIndex: number, index: number, lean = true) {
let result: ActivitySelfServiceShopModelType[] = await ActivitySelfServiceShopModel.find({ roleId, activityId, roundIndex, index }).lean(lean);
return result;
}
//查询购买价格类型的数据
public static async findDataByPriceType(acvitityId: number, roleId: string, roundIndex: number, priceType: number, lean = true) {
let result: ActivitySelfServiceShopModelType[] = await ActivitySelfServiceShopModel.find({ roleId, acvitityId, priceType, roundIndex }).lean(lean);
public static async findDataByPriceType(activityId: number, roleId: string, roundIndex: number, priceType: number, lean = true) {
let result: ActivitySelfServiceShopModelType[] = await ActivitySelfServiceShopModel.find({ roleId, activityId, priceType, roundIndex }).lean(lean);
return result;
}
//删除活动领取记录
public static async deleteActivity(acvitityId: number, roleId: string, roundIndex: number, index: number,) {
await ActivitySelfServiceShopModel.deleteMany({ roleId, acvitityId, index, roundIndex });
public static async deleteActivity(activityId: number, roleId: string, roundIndex: number, index: number,) {
await ActivitySelfServiceShopModel.deleteMany({ roleId, activityId, index, roundIndex });
}
}