From afabe2c87f1f643eb6e581499f421352971ee177 Mon Sep 17 00:00:00 2001 From: sanji Date: Sun, 18 Feb 2024 23:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=91=E9=BC=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Server.Business/PlatformSDK/JDBusiness.cs | 13 +++++++++++++ .../PlatformSDK/PlatformSDKBusiness.cs | 5 +++++ .../Dto/Request/JD/GetCategoryInfoByIdRequest.cs | 11 +++++++++++ JD.API/Controllers/PlatformSDKController.cs | 13 ++++++++++++- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 BBWY.Server.Model/Dto/Request/JD/GetCategoryInfoByIdRequest.cs diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index b8cfa63d..28988eda 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -2097,5 +2097,18 @@ namespace BBWY.Server.Business // throw new BusinessException($"设置全国仓库存失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}"); } } + + public override JToken GetCategoryInfoById(GetCategoryInfoByIdRequest request) + { + var jdClient = GetJdClient(request.AppKey, request.AppSecret); + var req = new CategoryReadFindByIdRequest(); + req.cid = request.CategoryId; + req.field = "id,fid,name,lev"; + + var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); + if (res.Json == null) + res.Json = JObject.Parse(res.Body); + return res.Json["jingdong_category_read_findById_responce"]["category"]; + } } } diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs index d4024b1c..3461ee95 100644 --- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs @@ -304,5 +304,10 @@ namespace BBWY.Server.Business { throw new NotImplementedException(); } + + public virtual JToken GetCategoryInfoById(GetCategoryInfoByIdRequest request) + { + throw new NotImplementedException(); + } } } diff --git a/BBWY.Server.Model/Dto/Request/JD/GetCategoryInfoByIdRequest.cs b/BBWY.Server.Model/Dto/Request/JD/GetCategoryInfoByIdRequest.cs new file mode 100644 index 00000000..5c02b87b --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/JD/GetCategoryInfoByIdRequest.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Server.Model.Dto.Request.JD +{ + public class GetCategoryInfoByIdRequest:PlatformRequest + { + public int CategoryId { get; set; } + } +} diff --git a/JD.API/Controllers/PlatformSDKController.cs b/JD.API/Controllers/PlatformSDKController.cs index 5920eb90..5f04d3a9 100644 --- a/JD.API/Controllers/PlatformSDKController.cs +++ b/JD.API/Controllers/PlatformSDKController.cs @@ -498,9 +498,20 @@ namespace JD.API.API.Controllers /// /// [HttpPost] - public void SetSkuStockNum([FromBody]SetSkuStockNumRequest request) + public void SetSkuStockNum([FromBody] SetSkuStockNumRequest request) { platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).SetSkuStockNum(request); } + + /// + /// 获取类目信息 + /// + /// + /// + [HttpPost] + public JToken GetCategoryInfoById([FromBody] GetCategoryInfoByIdRequest request) + { + return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetCategoryInfoById(request); + } } }