|
|
@ -29,7 +29,16 @@ namespace BBWY.Server.Business |
|
|
|
#region 赠品模板
|
|
|
|
public void AddOrEditGiftTemplate(AddOrEditGiftTemplateRequest request) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(request.TemplateName)) |
|
|
|
throw new BusinessException("缺少模板名称"); |
|
|
|
if (string.IsNullOrEmpty(request.GiftSkus)) |
|
|
|
throw new BusinessException("缺少赠品SKU"); |
|
|
|
|
|
|
|
var giftCount = request.GiftSkus.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Count(); |
|
|
|
|
|
|
|
if (giftCount == 0) |
|
|
|
throw new BusinessException("缺少赠品SKU"); |
|
|
|
|
|
|
|
if (request.Id == 0) |
|
|
|
{ |
|
|
|
var giftTemplate = new GiftTemplate() |
|
|
@ -69,6 +78,24 @@ namespace BBWY.Server.Business |
|
|
|
#region 评价助手任务
|
|
|
|
public void AddOrEditPromotionTask(AddOrEditPromotionTaskRequest request) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(request.MainProductSpu)) |
|
|
|
throw new BusinessException("缺少主商品SPU"); |
|
|
|
|
|
|
|
if (request.MotherTemplateId == 0 && string.IsNullOrEmpty(request.MainProductSku)) |
|
|
|
throw new BusinessException("奶妈模板和主商品SKU至少具备一个"); |
|
|
|
|
|
|
|
if (request.GiftTemplateId == 0 && string.IsNullOrEmpty(request.MainProductGiftSku)) |
|
|
|
throw new BusinessException("赠品模板和主商品赠品SKU至少具备一个"); |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.SimpleTitle) || string.IsNullOrEmpty(request.FullTitle)) |
|
|
|
throw new BusinessException("缺少精简标题或完整标题"); |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.ActivityName)) |
|
|
|
throw new BusinessException("缺少活动名称"); |
|
|
|
|
|
|
|
if (request.ActivityName.Length > 10) |
|
|
|
throw new BusinessException("活动名称不能超过10个字"); |
|
|
|
|
|
|
|
if (request.Id == 0) |
|
|
|
{ |
|
|
|
var relayAPIHost = GetPlatformRelayAPIHost(Enums.Platform.京东); |
|
|
@ -122,7 +149,7 @@ namespace BBWY.Server.Business |
|
|
|
|
|
|
|
request.Map(dbPromotionTask); |
|
|
|
fsql.Update<PromotionTask>().SetSource(dbPromotionTask) |
|
|
|
.IgnoreColumns(new string[] { "UpdateSortTime", "Sort", "Status", "CreateTime" }) |
|
|
|
.IgnoreColumns(new string[] { "UpdateSortTime", "Sort", "Status", "CreateTime", "SpuLogo", "SpuPublishTime", "StartTime", "EndTime" }) |
|
|
|
.ExecuteAffrows(); |
|
|
|
} |
|
|
|
} |
|
|
@ -153,9 +180,26 @@ namespace BBWY.Server.Business |
|
|
|
/// <param name="request"></param>
|
|
|
|
public void EditPromotionTaskSort(EditPromotionTaskSortRequest request) |
|
|
|
{ |
|
|
|
fsql.Update<PromotionTask>(request.Id).Set(pt => pt.Sort + request.MoveType) |
|
|
|
.Set(pt => pt.UpdateSortTime, DateTime.Now) |
|
|
|
.ExecuteAffrows(); |
|
|
|
var dbPromotionTask = fsql.Select<PromotionTask>(request.Id).ToOne(); |
|
|
|
PromotionTask oldDbPromotionTask = null; |
|
|
|
if (request.MoveType == 1) |
|
|
|
oldDbPromotionTask = fsql.Select<PromotionTask>().Where(pt => pt.Sort > dbPromotionTask.Sort).OrderBy(pt => pt.Sort).ToOne(); |
|
|
|
else |
|
|
|
oldDbPromotionTask = fsql.Select<PromotionTask>().Where(pt => pt.Sort < dbPromotionTask.Sort).OrderByDescending(pt => pt.Sort).ToOne(); |
|
|
|
|
|
|
|
|
|
|
|
if (oldDbPromotionTask != null) |
|
|
|
{ |
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
fsql.Update<PromotionTask>(dbPromotionTask.Id).Set(pt => pt.Sort, oldDbPromotionTask.Sort) |
|
|
|
.Set(pt => pt.UpdateSortTime, DateTime.Now) |
|
|
|
.ExecuteAffrows(); |
|
|
|
fsql.Update<PromotionTask>(oldDbPromotionTask.Id).Set(pt => pt.Sort, dbPromotionTask.Sort) |
|
|
|
.Set(pt => pt.UpdateSortTime, DateTime.Now) |
|
|
|
.ExecuteAffrows(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -188,8 +232,6 @@ namespace BBWY.Server.Business |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|