活动:刷新商店支持根据权重筛选商品
This commit is contained in:
@@ -16,6 +16,17 @@ export class BuyRecord {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 可购买商品
|
||||
*/
|
||||
|
||||
export class GoodsInfo {
|
||||
@prop({ required: true })
|
||||
pageIndex: number; //第几页
|
||||
@prop({ required: true })
|
||||
id: number; //物品id标识
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动系统 - 新手限定、每日限购、每周限购
|
||||
*/
|
||||
@@ -30,6 +41,8 @@ export default class Activity_Refresh_Shop extends BaseModel {
|
||||
roundIndex: number; // 第几个周期,从1开始
|
||||
@prop({ required: true })
|
||||
records: BuyRecord[]; // 购买记录
|
||||
@prop({ required: true })
|
||||
goods: GoodsInfo[]; // 可购买商品
|
||||
|
||||
//购买领取奖励的记录
|
||||
public static async addRecord(activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number) {
|
||||
@@ -38,6 +51,13 @@ export default class Activity_Refresh_Shop extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
//购买领取奖励的记录
|
||||
public static async createShop(activityId: number, roleId: string, roundIndex: number, goods: GoodsInfo[]) {
|
||||
let result: ActivityRefreshShopModelType = await ActivityRefreshShopModel.findOneAndUpdate({ roleId, activityId, roundIndex },
|
||||
{ $push: { goods: { $each: goods } } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动id查询活动数据
|
||||
public static async findData(activityId: number, roleId: string, roundIndex: number) {
|
||||
let result: ActivityRefreshShopModelType = await ActivityRefreshShopModel.findOne({ roleId, activityId, roundIndex }).lean(true);
|
||||
|
||||
Reference in New Issue
Block a user