Browse Source

查询时效模板

AddValidOverTime
shanji 2 years ago
parent
commit
a6ab8cf21f
  1. 21
      BBWY.JDSDK/Request/SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryRequest.cs
  2. 11
      BBWY.JDSDK/Response/SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryResponse.cs
  3. 27
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs

21
BBWY.JDSDK/Request/SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryRequest.cs

@ -0,0 +1,21 @@
using BBWY.JDSDK.Response;
using Jd.Api;
using System.Collections.Generic;
namespace BBWY.JDSDK.Request
{
public class SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryRequest : JdRequestBase<SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryResponse>
{
public override string ApiName => "jingdong.seller.delivery.SendPromiseTemplateJsfService.querySendTemplateByCategory";
public int categoryId { get; set; }
public bool dzSku { get; set; }
protected override void PrepareParam(IDictionary<string, object> paramters)
{
paramters.Add("categoryId", this.categoryId);
paramters.Add("dzSku", this.dzSku);
}
}
}

11
BBWY.JDSDK/Response/SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryResponse.cs

@ -0,0 +1,11 @@
using Jd.Api;
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.JDSDK.Response
{
public class SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryResponse: JdResponse
{
}
}

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

@ -1,5 +1,6 @@
using BBWY.Common.Extensions;
using BBWY.Common.Models;
using BBWY.JDSDK.Request;
using BBWY.Server.Model;
using BBWY.Server.Model.Dto;
using Jd.ACES;
@ -1071,8 +1072,32 @@ namespace BBWY.Server.Business
(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg);
if (errorMsg.Contains("此类目发货时效必填"))
{
int? promiseId = null;
#region 查询时效模板
{
var shixiaoReq = new SellerDeliverySendPromiseTemplateJsfServiceQuerySendTemplateByCategoryRequest();
shixiaoReq.categoryId = int.Parse(request.MainProductCategoryId);
shixiaoReq.dzSku = true;
var shixiaoRes = jdClient.Execute(shixiaoReq, request.AppToken, DateTime.Now.ToLocalTime());
if (shixiaoRes.IsError)
{
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, null, request.MainProductSpu, request.FullTitle, brandName, false);
throw new BusinessException($"查询时效模板失败-{(string.IsNullOrEmpty(shixiaoRes.ErrorMsg) ? shixiaoRes.ErrMsg : shixiaoRes.ErrorMsg)}");
}
if (shixiaoRes.Json == null)
shixiaoRes.Json = JObject.Parse(shixiaoRes.Body);
var shixiaoJToken = shixiaoRes.Json["jingdong_seller_delivery_SendPromiseTemplateJsfService_querySendTemplateByCategory_responce"]["returnType"]["bizResponse"]["promiseTemplateDtoList"].Children().FirstOrDefault();
if (shixiaoJToken == null)
{
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, null, request.MainProductSpu, request.FullTitle, brandName, false);
throw new BusinessException($"查询时效模板失败-未查询到时效模板");
}
promiseId = shixiaoJToken.Value<int>("templateId");
}
#endregion
foreach (var skuParam in req.skus)
skuParam.promiseId = 30603710;
skuParam.promiseId = promiseId;
res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());
if (res.IsError)
{

Loading…
Cancel
Save