feat: 支持商品自动流拍
This commit is contained in:
@@ -20,6 +20,11 @@ public class AutoPassInGoodsJob: QuartzBackgroundWorkerBase
|
|||||||
|
|
||||||
//每小时,第10分钟执行一次
|
//每小时,第10分钟执行一次
|
||||||
Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoPassInGoodsJob))
|
Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoPassInGoodsJob))
|
||||||
|
// .WithSimpleSchedule((builer) =>
|
||||||
|
// {
|
||||||
|
// builer.WithIntervalInHours(10);
|
||||||
|
// })
|
||||||
|
// .StartNow()
|
||||||
.WithCronSchedule("0 10 * * * ?")
|
.WithCronSchedule("0 10 * * * ?")
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,13 +41,14 @@ public class MarketManager : DomainService
|
|||||||
//下架3天前的商品
|
//下架3天前的商品
|
||||||
var endTine = DateTime.Now.AddDays(-autoPassInGoodsDay);
|
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)
|
foreach (var goods in marketGoods)
|
||||||
{
|
{
|
||||||
//用户库存
|
//用户库存
|
||||||
var userStore = await _collectiblesUserStoreRepository._DbQueryable
|
var userStore = await _collectiblesUserStoreRepository._DbQueryable
|
||||||
|
.Where(x=>x.UserId==goods.SellUserId)
|
||||||
.Where(x => x.CollectiblesId == goods.CollectiblesId)
|
.Where(x => x.CollectiblesId == goods.CollectiblesId)
|
||||||
.Where(x => x.IsAtMarketing == true).FirstAsync();
|
.Where(x => x.IsAtMarketing == true).FirstAsync();
|
||||||
if (userStore is not null)
|
if (userStore is not null)
|
||||||
|
|||||||
Reference in New Issue
Block a user