|
|
@ -1532,5 +1532,58 @@ namespace BBWY.Server.Business |
|
|
|
Task.Factory.StartNew(() => SyncOrder(shop, string.Empty, isAuto: true), System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.SyncOrderTaskScheduler); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void SyncJDRefundOrder(JArray orderTokenJArray, long shopId) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void SyncRefundOrder(ShopResponse shop, string orderId, DateTime? startTime = null, DateTime? endTime = null, bool isAuto = false) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
logger.Info($"退款订单同步 {shop.ShopName} isAuto {isAuto}"); |
|
|
|
if (!syncOrderMethodDic.ContainsKey(shop.PlatformId)) |
|
|
|
throw new Exception("不支持的平台"); |
|
|
|
var shopId = long.Parse(shop.ShopId); |
|
|
|
var relayAPIHost = GetPlatformRelayAPIHost(shop.PlatformId); |
|
|
|
var refundOrderListApiResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/GetRefundList", new SearchRefundPlatformOrderRequest() |
|
|
|
{ |
|
|
|
StartDate = startTime ?? DateTime.Now.Date.AddDays(-1), |
|
|
|
EndDate = endTime ?? DateTime.Now, |
|
|
|
AppKey = shop.AppKey, |
|
|
|
AppSecret = shop.AppSecret, |
|
|
|
AppToken = shop.AppToken, |
|
|
|
PageIndex = 1, |
|
|
|
PageSize = 50, |
|
|
|
Platform = shop.PlatformId, |
|
|
|
SaveResponseLog = true, |
|
|
|
OrderId = orderId |
|
|
|
}, null, HttpMethod.Post); |
|
|
|
if (refundOrderListApiResult.StatusCode != System.Net.HttpStatusCode.OK) |
|
|
|
throw new Exception($"获取退款订单失败 {refundOrderListApiResult.Content}"); |
|
|
|
|
|
|
|
var refundOrderListResponse = JsonConvert.DeserializeObject<ApiResponse<JArray>>(refundOrderListApiResult.Content); |
|
|
|
if (!refundOrderListResponse.Success) |
|
|
|
throw new Exception($"获取退款订单失败 {refundOrderListApiResult.Content}"); |
|
|
|
|
|
|
|
if (refundOrderListResponse.Data == null || refundOrderListResponse.Data.Count == 0) |
|
|
|
return; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
var shopData = JsonConvert.SerializeObject(shop); |
|
|
|
logger.Error(ex, $"SyncRefundOrder ShopData:{shopData}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void SyncAllShopRefundOrder() |
|
|
|
{ |
|
|
|
var shopList = venderBusiness.GetShopList(); |
|
|
|
foreach (var shop in shopList) |
|
|
|
{ |
|
|
|
Task.Factory.StartNew(() => SyncRefundOrder(shop, string.Empty, isAuto: true), System.Threading.CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.SyncRefundOrderTaskScheduler); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|