diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index dc3c37fc..79bcdc42 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -1772,5 +1772,22 @@ namespace BBWY.Server.Business res.Json = JObject.Parse(res.Body); return (JArray)res.Json["jingdong_ware_read_findWareById_responce"]; } + + + public override JToken GetAttrsByCategoryId(GetAttrsByCategoryIdRequest request) + { + var jdClient = GetJdClient(request.AppKey, request.AppSecret); + var req = new CategoryReadFindAttrsByCategoryIdUnlimitCateRequest() { cid=request.CatId}; + + if(request.AttributeType!=null) + req.attributeType = request.AttributeType; + if (request.Field != null) + req.field = request.Field; + + var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime()); + if (res.Json == null) + res.Json = JObject.Parse(res.Body); + return (JArray)res.Json["jingdong_category_read_findAttrsByCategoryIdUnlimitCate_responce"]["findattrsbycategoryidunlimitcate_result"]; + } } } diff --git a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs index 23b63707..e14733f7 100644 --- a/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/PlatformSDKBusiness.cs @@ -281,5 +281,10 @@ namespace BBWY.Server.Business { throw new NotImplementedException(); } + + public virtual JToken GetAttrsByCategoryId(GetAttrsByCategoryIdRequest request) + { + throw new NotImplementedException(); + } } } diff --git a/BBWY.Server.Model/Dto/Request/JD/GetAttrsByCategoryIdRequest.cs b/BBWY.Server.Model/Dto/Request/JD/GetAttrsByCategoryIdRequest.cs new file mode 100644 index 00000000..5fddbf71 --- /dev/null +++ b/BBWY.Server.Model/Dto/Request/JD/GetAttrsByCategoryIdRequest.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BBWY.Server.Model.Dto.Request.JD +{ + public class GetAttrsByCategoryIdRequest : PlatformRequest + { + /// + ///spu 类目id + /// + public long CatId { get; set; } + + /// + /// 属性类型 1.关键属性 3.可变属性 4.销售属性 + /// + public int? AttributeType { get; set; } + + /// + /// 查询对应的字段数据 + /// + public string Field { get; set; } + } +} diff --git a/JD.API/Controllers/PlatformSDKController.cs b/JD.API/Controllers/PlatformSDKController.cs index 62736558..4b650cd0 100644 --- a/JD.API/Controllers/PlatformSDKController.cs +++ b/JD.API/Controllers/PlatformSDKController.cs @@ -471,5 +471,16 @@ namespace JD.API.API.Controllers { return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetProductById(request); } + + /// + /// 通过商品类目Id 获取类目的属性列表(材质,适用年龄等...) + /// + /// + /// + [HttpPost] + public JToken GetAttrsByCategoryId([FromBody] GetAttrsByCategoryIdRequest request) + { + return platformSDKBusinessList.FirstOrDefault(p => p.Platform == request.Platform).GetAttrsByCategoryId(request); + } } }