diff --git a/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs b/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs index 39107390..bcb47afe 100644 --- a/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs +++ b/BBWY.JDSDK/Request/SkuWriteUpdateSkusRequest.cs @@ -41,6 +41,8 @@ namespace Jd.Api.Request public string outerId { get; set; } public List multiCateProps { get; set; } + + public int promiseId { get; set; } } public class SkuWriteUpdateSkusItemSaleAttrs diff --git a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs index 0f42c6d3..d1986733 100644 --- a/BBWY.Server.Business/PlatformSDK/JDBusiness.cs +++ b/BBWY.Server.Business/PlatformSDK/JDBusiness.cs @@ -999,15 +999,16 @@ namespace BBWY.Server.Business barCode = request.MainProductBarCode, outerId = $"{request.OuterId}{(i + 1).ToString().PadLeft(3, '0')}", saleAttrs = new List() - { - new SkuWriteUpdateSkusItemSaleAttrs() { - type = "com.jd.pop.ware.ic.api.domain.Prop", - attrId = colorProperty.Value("attId"), - attrValues = new List() { colorProperty.Value("id") }, - index = takeColorIndex - } - } + new SkuWriteUpdateSkusItemSaleAttrs() + { + type = "com.jd.pop.ware.ic.api.domain.Prop", + attrId = colorProperty.Value("attId"), + attrValues = new List() { colorProperty.Value("id") }, + index = takeColorIndex + } + }, + promiseId = 30603710 //固定时效模板Id 48小时发货 }; p.multiCateProps = new List(); diff --git a/BBWY.Test/BBWY.Test.csproj b/BBWY.Test/BBWY.Test.csproj index 697cb8ee..bd90d253 100644 --- a/BBWY.Test/BBWY.Test.csproj +++ b/BBWY.Test/BBWY.Test.csproj @@ -5,10 +5,23 @@ netcoreapp3.1 + + + + + + + PreserveNewest + true + PreserveNewest + + + + diff --git a/BBWY.Test/NLog.config b/BBWY.Test/NLog.config new file mode 100644 index 00000000..8405deac --- /dev/null +++ b/BBWY.Test/NLog.config @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/BBWY.Test/Program.cs b/BBWY.Test/Program.cs index b0c69686..0197f527 100644 --- a/BBWY.Test/Program.cs +++ b/BBWY.Test/Program.cs @@ -1,5 +1,6 @@ using BBWY._1688SDK.entity.Order; using BBWY.Common.Models; +using BBWY.Server.Business; using com.alibaba.openapi.client; using com.alibaba.openapi.client.policy; using Jd.Api; @@ -63,50 +64,11 @@ namespace BBWY.Test { - var request = new { AppKey = "1074007", AppSecret = "0r9u4Fc9zK", AppToken = "8093fdc5-6adc-46c7-b640-87218c1dcccd" }; - var client = GetSyncAPIClient(request.AppKey, request.AppSecret); - RequestPolicy reqPolicy = new RequestPolicy(); - reqPolicy.HttpMethod = "POST"; - reqPolicy.NeedAuthorization = false; - reqPolicy.RequestSendTimestamp = false; - reqPolicy.UseHttps = false; - reqPolicy.UseSignture = true; - reqPolicy.AccessPrivateApi = false; - - Request _request = new Request(); - APIId apiId = new APIId - { - Name = "alibaba.trade.pay.protocolPay.preparePay", - NamespaceValue = "com.alibaba.trade", - Version = 1 - }; - _request.ApiId = apiId; - - //var param = new - //{ - // orderId = 3494275885416167358 - //}; - - //var param = new tradeWithholdPreparePayParam() - //{ - // orderId = 3494275885416167358 - //}; - - var param = new - { - tradeWithholdPreparePayParam = new - { - orderId = 3494275885416167358 - } - }; - _request.RequestEntity = param; - if (!string.IsNullOrEmpty(request.AppToken)) - _request.AccessToken = request.AppToken; - var result = client.NewRequest(_request, reqPolicy); - if (result.Value("success") != true) - throw new BusinessException(result.Value("message")); - - Console.WriteLine(JsonConvert.SerializeObject(result)); + var nNogManager = new NLogManager(); + var pid = Process.GetCurrentProcess().Id; + var message = $"{pid}-{Guid.NewGuid()}"; + Console.WriteLine(message); + nNogManager.GetLogger(pid.ToString()).Info(message); } Console.ReadKey(); diff --git a/BBWY.Test/Properties/NLogManager.cs b/BBWY.Test/Properties/NLogManager.cs new file mode 100644 index 00000000..9da4b3f5 --- /dev/null +++ b/BBWY.Test/Properties/NLogManager.cs @@ -0,0 +1,35 @@ +using NLog; +using System.Collections.Concurrent; +using System.Collections.Generic; + +namespace BBWY.Server.Business +{ + public class NLogManager + { + private ConcurrentDictionary loggerDictionary; + private string defaultLoggerName = "default"; + + public NLogManager() + { + loggerDictionary = new ConcurrentDictionary(); + loggerDictionary.TryAdd("default", NLog.LogManager.GetLogger(defaultLoggerName)); + } + + public ILogger Default() + { + return loggerDictionary[defaultLoggerName]; + } + + public ILogger GetLogger(string loggerName) + { + if (string.IsNullOrEmpty(loggerName)) + return Default(); + if (!loggerDictionary.TryGetValue(loggerName, out ILogger logger)) + { + logger = NLog.LogManager.GetLogger(loggerName); + loggerDictionary.TryAdd(loggerName, logger); + } + return logger; + } + } +}