Browse Source

1

AddValidOverTime
shanji 2 years ago
parent
commit
4c40ca8179
  1. 45
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs

45
BBWY.Server.Business/PlatformSDK/JDBusiness.cs

@ -853,7 +853,6 @@ namespace BBWY.Server.Business
public override StartPromotionTaskResponse StartJDPromotionTask(StartPromotionTaskRequest2 request) public override StartPromotionTaskResponse StartJDPromotionTask(StartPromotionTaskRequest2 request)
{ {
var stepText = string.Empty; var stepText = string.Empty;
//stepText.AppendLine($"任务Id {request.Id} 店铺Id {request.ShopId}");
try try
{ {
var jdClient = GetJdClient(request.AppKey, request.AppSecret); var jdClient = GetJdClient(request.AppKey, request.AppSecret);
@ -921,9 +920,6 @@ namespace BBWY.Server.Business
if (giftSkuList != null && giftSkuList.Any(s => s.ProductId != request.MainProductSpu)) if (giftSkuList != null && giftSkuList.Any(s => s.ProductId != request.MainProductSpu))
throw new BusinessException("主商品赠品SKU归属有误"); throw new BusinessException("主商品赠品SKU归属有误");
//stepText = "添加赠品SKU";
//AddJDPromotionSku(jdClient, request.AppToken, promotionId, skuList, true);
} }
#endregion #endregion
@ -949,7 +945,6 @@ namespace BBWY.Server.Business
stepText = "设置精简标题"; stepText = "设置精简标题";
var req = new WareWriteUpdateWareTitleRequest(); var req = new WareWriteUpdateWareTitleRequest();
req.wareId = wareId; req.wareId = wareId;
//req.title = request.SimpleTitle;
if (string.IsNullOrEmpty(request.SimpleTitle) || !request.SimpleTitle.StartsWith(brandName)) if (string.IsNullOrEmpty(request.SimpleTitle) || !request.SimpleTitle.StartsWith(brandName))
req.title = $"{brandName}{request.SimpleTitle}"; req.title = $"{brandName}{request.SimpleTitle}";
else else
@ -975,9 +970,6 @@ namespace BBWY.Server.Business
var response = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); var response = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());
if (response.Json == null) if (response.Json == null)
response.Json = JObject.Parse(response.Body); response.Json = JObject.Parse(response.Body);
//nLogManager.Default().Info($"获取销售属性 任务Id {request.Id} 返回内容 {response.Body} 模板sku数量 {request.GiftTemplateSkuList.Count()}");
var colorProperty = response.Json["jingdong_category_read_findAttrsByCategoryIdUnlimitCate_responce"]["findattrsbycategoryidunlimitcate_result"].FirstOrDefault(j => j.Value<string>("name") == "颜色"); var colorProperty = response.Json["jingdong_category_read_findAttrsByCategoryIdUnlimitCate_responce"]["findattrsbycategoryidunlimitcate_result"].FirstOrDefault(j => j.Value<string>("name") == "颜色");
if (colorProperty == null) if (colorProperty == null)
{ {
@ -1008,34 +1000,23 @@ namespace BBWY.Server.Business
{ {
type = "com.jd.pop.ware.ic.api.domain.Sku", type = "com.jd.pop.ware.ic.api.domain.Sku",
wareId = wareId, wareId = wareId,
//skuId = long.Parse(sku.Id),
jdPrice = giftSku.Price ?? 0, jdPrice = giftSku.Price ?? 0,
stockNum = 9999, stockNum = 9999,
barCode = request.MainProductBarCode, barCode = request.MainProductBarCode,
outerId = $"{request.OuterId}{(i + 1).ToString().PadLeft(3, '0')}", outerId = $"{request.OuterId}{(i + 1).ToString().PadLeft(3, '0')}",
saleAttrs = new List<SkuWriteUpdateSkusItemSaleAttrs>() saleAttrs = new List<SkuWriteUpdateSkusItemSaleAttrs>()
{ {
//new SkuWriteUpdateSkusItemSaleAttrs()
//{
// type = "com.jd.pop.ware.ic.api.domain.Prop",
// attrId = colorProperty.Value<string>("attId"),
// attrValues = new List<string>() { colorProperty.Value<string>("id") },
// index = takeColorIndex,
// attrValuesSeqNo = new List<int?>(){ takeColorIndex }
//}
new SkuWriteUpdateSkusItemSaleAttrs() new SkuWriteUpdateSkusItemSaleAttrs()
{ {
type = "com.jd.pop.ware.ic.api.domain.Prop", type = "com.jd.pop.ware.ic.api.domain.Prop",
attrId = colorPropertyValue.Value<string>("attId"), attrId = colorPropertyValue.Value<string>("attId"),
//attrValues = new List<string>() { colorPropertyValue.Value<string>("id") }, attrValueAlias = new List<string>(){ giftSku.Title },
attrValueAlias = new List<string>(){ giftSku.Title }, // colorPropertyValue.Value<string>("name")
index = takeColorIndex, index = takeColorIndex,
attrValuesSeqNo = new List<int?>(){ takeColorIndex } attrValuesSeqNo = new List<int?>(){ takeColorIndex }
} }
}, },
saleAttrTemplateId = "POP_MODEL" saleAttrTemplateId = "POP_MODEL"
//promiseId = 30603710 //固定时效模板Id 48小时发货
}; };
p.multiCateProps = new List<SkuWriteUpdateSkusItemSaleAttrs>(); p.multiCateProps = new List<SkuWriteUpdateSkusItemSaleAttrs>();
@ -1051,27 +1032,6 @@ namespace BBWY.Server.Business
} }
} }
////修改标题参数
//updateSkuTitleParamList.Add(new WareWriteUpdateWareSaleAttrvalueAliasRequestItem()
//{
// attrId = p.saleAttrs[0].attrId,
// attrValues = p.saleAttrs[0].attrValues,
// attrValueAlias = new List<string>() { giftSku.Title }
//});
////修改商品细节图参数
//var imgUrlBuilder = new StringBuilder();
//var imgIndexBuilder = new StringBuilder();
//imgUrlBuilder.Append($"{giftSku.Logo.Substring(giftSku.Logo.IndexOf("jfs"))},");
//imgIndexBuilder.Append("1,");
//imageWriteUpdateRequestList.Add(new ImageWriteUpdateRequest()
//{
// wareId = wareId,
// colorId = colorProperty.Value<string>("id"),
// imgUrl = imgUrlBuilder.ToString().Trim(','),
// imgIndex = imgIndexBuilder.ToString().Trim(',')
//});
takeColorIndex--; takeColorIndex--;
skusParamList.Add(p); skusParamList.Add(p);
} }
@ -1101,6 +1061,7 @@ namespace BBWY.Server.Business
int? promiseId = null; int? promiseId = null;
#region 查询时效模板 #region 查询时效模板
{ {
stepText = "查询时效模板";
var shixiaoReq = new SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryRequest(); var shixiaoReq = new SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryRequest();
shixiaoReq.categoryId = int.Parse(request.MainProductCategoryId); shixiaoReq.categoryId = int.Parse(request.MainProductCategoryId);
shixiaoReq.dzSku = true; shixiaoReq.dzSku = true;
@ -1121,7 +1082,7 @@ namespace BBWY.Server.Business
promiseId = shixiaoJToken.Value<int>("templateId"); promiseId = shixiaoJToken.Value<int>("templateId");
} }
#endregion #endregion
stepText = "再次上架sku";
foreach (var skuParam in req.skus) foreach (var skuParam in req.skus)
skuParam.promiseId = promiseId; skuParam.promiseId = promiseId;
res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());

Loading…
Cancel
Save