Browse Source

上架赠品sku默认不使用时效模板Id

AddValidOverTime
彭聪 2 years ago
parent
commit
1dd04ebcb7
  1. 2
      BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs
  2. 32
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs

2
BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs

@ -42,7 +42,7 @@ namespace Jd.Api.Request
public List<SkuWriteUpdateSkusItemSaleAttrs> multiCateProps { get; set; } public List<SkuWriteUpdateSkusItemSaleAttrs> multiCateProps { get; set; }
public int promiseId { get; set; } public int? promiseId { get; set; }
} }
public class SkuWriteUpdateSkusItemSaleAttrs public class SkuWriteUpdateSkusItemSaleAttrs

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

@ -1007,8 +1007,8 @@ namespace BBWY.Server.Business
attrValues = new List<string>() { colorProperty.Value<string>("id") }, attrValues = new List<string>() { colorProperty.Value<string>("id") },
index = takeColorIndex index = takeColorIndex
} }
}, }
promiseId = 30603710 //固定时效模板Id 48小时发货 //promiseId = 30603710 //固定时效模板Id 48小时发货
}; };
p.multiCateProps = new List<SkuWriteUpdateSkusItemSaleAttrs>(); p.multiCateProps = new List<SkuWriteUpdateSkusItemSaleAttrs>();
@ -1066,14 +1066,28 @@ namespace BBWY.Server.Business
res.Json = JObject.Parse(res.Body); res.Json = JObject.Parse(res.Body);
if (res.IsError) if (res.IsError)
{ {
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, null, request.MainProductSpu, request.FullTitle, brandName, false); var errorMsg = res.Body.Contains("en_desc") ?
res.Json["error_response"].Value<string>("en_desc") :
if (res.Body.Contains("en_desc")) (string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg);
throw new BusinessException($"上架sku失败-{res.Json["error_response"].Value<string>("en_desc")}"); if (errorMsg.Contains("此类目发货时效必填"))
{
foreach (var skuParam in req.skus)
skuParam.promiseId = 30603710;
res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());
if (res.IsError)
{
errorMsg = res.Body.Contains("en_desc") ?
res.Json["error_response"].Value<string>("en_desc") :
(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg);
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, null, request.MainProductSpu, request.FullTitle, brandName, false);
throw new BusinessException($"上架sku失败-{errorMsg}");
}
}
else else
throw new BusinessException($"上架sku失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); {
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, null, request.MainProductSpu, request.FullTitle, brandName, false);
/*{"error_response":{"code":"501","en_desc":"com.jd.bk.saf.exception.SafJosException:京东价超出该类目允许范围:12.15-39437元!#821c1c3b382f476abeb21f1f515274c7(Solution reference: https://jos.jd.com/commondoc?listId=171)","zh_desc":"调用参数错误(解决方案参考: https://jos.jd.com/commondoc?listId=171)"}}*/ throw new BusinessException($"上架sku失败-{errorMsg}");
}
} }
var newSkuList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value<string>("skuId")).ToList(); var newSkuList = res.Json["jingdong_sku_write_updateSkus_responce"]["skuList"].ToList().Select(x => x.Value<string>("skuId")).ToList();

Loading…
Cancel
Save