|
|
@ -938,6 +938,23 @@ namespace BBWYB.Server.Business |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(request.ProductId) || string.IsNullOrEmpty(request.SkuId) || request.ShopId == 0) |
|
|
|
throw new BusinessException("参数无效"); |
|
|
|
|
|
|
|
var spuSaleInfo = fsql.Select<SpuTotalSaleInfo>(request.ProductId).ToOne(); |
|
|
|
if (spuSaleInfo == null) |
|
|
|
throw new BusinessException($"未找到spu{request.ProductId}销量"); |
|
|
|
|
|
|
|
var updateSpuSaleInfo = fsql.Update<SpuTotalSaleInfo>(request.ProductId) |
|
|
|
.SetIf(spuSaleInfo.IsFirstPurchaseCompleted == false, s => s.IsFirstPurchaseCompleted, true) |
|
|
|
.SetIf(spuSaleInfo.IsFirstPurchaseCompleted == false, s => s.FirstPurchaseCompletedItemCount == s.ItemCount) |
|
|
|
.SetIf(spuSaleInfo.IsFirstPurchaseCompleted == true && |
|
|
|
spuSaleInfo.IsFirstOptimizationCompleted == false, s => s.IsFirstOptimizationCompleted, true) |
|
|
|
.SetIf(spuSaleInfo.IsFirstPurchaseCompleted == true && |
|
|
|
spuSaleInfo.IsFirstOptimizationCompleted == false, s => s.FirstOptimizationCompletedItemCount == s.ItemCount) |
|
|
|
.Set(s => s.LastOptimizationItemCount == s.ItemCount) |
|
|
|
.Set(s => s.LastOptimizationTime, DateTime.Now) |
|
|
|
.Set(s => s.UpdateTime, DateTime.Now); |
|
|
|
|
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
fsql.Update<OrderSku>().Set(osku => osku.IsOptimizationCompleted, 1) |
|
|
@ -956,10 +973,11 @@ namespace BBWYB.Server.Business |
|
|
|
t.TaskType == Enums.TimeLimitTaskType.待议价任务) |
|
|
|
.ExecuteAffrows(); |
|
|
|
|
|
|
|
fsql.Update<SpuTotalSaleInfo>(request.ProductId).Set(s => s.LastOptimizationItemCount == s.ItemCount) |
|
|
|
.Set(s => s.LastOptimizationTime, DateTime.Now) |
|
|
|
.Set(s => s.UpdateTime, DateTime.Now) |
|
|
|
.ExecuteAffrows(); |
|
|
|
//fsql.Update<SpuTotalSaleInfo>(request.ProductId).Set(s => s.LastOptimizationItemCount == s.ItemCount)
|
|
|
|
// .Set(s => s.LastOptimizationTime, DateTime.Now)
|
|
|
|
// .Set(s => s.UpdateTime, DateTime.Now)
|
|
|
|
// .ExecuteAffrows();
|
|
|
|
updateSpuSaleInfo?.ExecuteAffrows(); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|