feat: 支持商品自动流拍

This commit is contained in:
橙子
2024-11-14 20:30:48 +08:00
parent 02d45bb6a7
commit 05ca1aa224
2 changed files with 7 additions and 1 deletions

View File

@@ -20,6 +20,11 @@ public class AutoPassInGoodsJob: QuartzBackgroundWorkerBase
//每小时,第10分钟执行一次
Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoPassInGoodsJob))
// .WithSimpleSchedule((builer) =>
// {
// builer.WithIntervalInHours(10);
// })
// .StartNow()
.WithCronSchedule("0 10 * * * ?")
.Build();
}

View File

@@ -41,13 +41,14 @@ public class MarketManager : DomainService
//下架3天前的商品
var endTine = DateTime.Now.AddDays(-autoPassInGoodsDay);
//获取所有需要下架商品
var marketGoods = await _marketGoodsRepository._DbQueryable.Where(x => x.CreationTime >= endTine).ToListAsync();
var marketGoods = await _marketGoodsRepository._DbQueryable.Where(x => x.CreationTime <= endTine).ToListAsync();
//单独处理每一个下架的商品
foreach (var goods in marketGoods)
{
//用户库存
var userStore = await _collectiblesUserStoreRepository._DbQueryable
.Where(x=>x.UserId==goods.SellUserId)
.Where(x => x.CollectiblesId == goods.CollectiblesId)
.Where(x => x.IsAtMarketing == true).FirstAsync();
if (userStore is not null)