Browse Source

1

AddValidOverTime
sanji 2 years ago
parent
commit
5635987d19
  1. 6
      BBWY.Server.API/Controllers/TestController.cs
  2. 2
      BBWY.Server.API/Properties/launchSettings.json
  3. 49
      BBWY.Server.Business/TestBusiness.cs

6
BBWY.Server.API/Controllers/TestController.cs

@ -30,5 +30,11 @@ namespace BBWY.Server.API.Controllers
{
testBusiness.RepairSkuDetailAndSkuGriooProfit(request);
}
[HttpPost]
public void DeleteJDTask()
{
testBusiness.DeleteJDTask();
}
}
}

2
BBWY.Server.API/Properties/launchSettings.json

@ -21,7 +21,7 @@
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "http://localhost:5000",
"applicationUrl": "http://localhost:5002",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

49
BBWY.Server.Business/TestBusiness.cs

@ -12,6 +12,9 @@ using System.IO;
using System.Linq;
using System.Threading;
using BBWY.Server.Business.Extensions;
using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;
namespace BBWY.Server.Business
{
@ -21,18 +24,21 @@ namespace BBWY.Server.Business
private VenderBusiness venderBusiness;
private IFreeSql fsql;
private OrderSyncBusiness orderSyncBusiness;
private TaskSchedulerManager taskSchedulerManager;
public TestBusiness(RestApiService restApiService,
IOptions<GlobalConfig> options,
FreeSqlMultiDBManager freeSqlMultiDBManager,
VenderBusiness venderBusiness,
YunDingBusiness yunDingBusiness,
IFreeSql fsql,
OrderSyncBusiness orderSyncBusiness) : base(restApiService, options, yunDingBusiness)
OrderSyncBusiness orderSyncBusiness,
TaskSchedulerManager taskSchedulerManager) : base(restApiService, options, yunDingBusiness)
{
this.freeSqlMultiDBManager = freeSqlMultiDBManager;
this.venderBusiness = venderBusiness;
this.fsql = fsql;
this.orderSyncBusiness = orderSyncBusiness;
this.taskSchedulerManager = taskSchedulerManager;
}
public void SyncVenderId()
@ -164,15 +170,18 @@ namespace BBWY.Server.Business
"瑞源玩具专营店"
};
var shopList = venderBusiness.GetShopList(request.ShopId, Enums.Platform.);
var shopIndex = 0;
//var shopIndex = 0;
foreach (var shop in shopList)
{
shopIndex++;
Console.WriteLine($"shopProgress {shopIndex}/{shopList.Count()}");
Task.Factory.StartNew(() =>
{
Console.WriteLine(shop.ShopName);
//shopIndex++;
//Console.WriteLine($"shopProgress {shopIndex}/{shopList.Count()}");
var shopId = long.Parse(shop.ShopId);
if (banedList.Contains(shop.ShopName))
continue;
return;
var orderIdList = fsql.Select<Order>()
.Where(o => o.ShopId == shopId &&
o.OrderState != Enums.OrderState. &&
@ -195,7 +204,7 @@ namespace BBWY.Server.Business
{
var orderId = orderIdList[i];
orderSyncBusiness.SyncOrder(shop, orderId);
Console.WriteLine($"shopProgress {shopIndex}/{shopList.Count()} {shop.ShopName},orderProgress {i + 1}/{orderIdList.Count()}");
Console.WriteLine($"SyncOrder {shop.ShopName},orderProgress {i + 1}/{orderIdList.Count()}");
}
// foreach (var orderId in orderIdList)
// {
@ -213,7 +222,7 @@ namespace BBWY.Server.Business
foreach (var order in orderList)
{
orderIndex++;
Console.WriteLine($"shopProgress {shopIndex}/{shopList.Count()}, orderProgress {orderIndex}/{orderList.Count()}");
Console.WriteLine($"Calculation {shop.ShopName}, orderProgress {orderIndex}/{orderList.Count()}");
var currentOrderCostDetailList = orderCostDetailList.Where(ocd => ocd.OrderId == order.Id).ToList();
@ -257,7 +266,33 @@ namespace BBWY.Server.Business
}
}
}, CancellationToken.None, TaskCreationOptions.LongRunning, taskSchedulerManager.SyncOrderTaskScheduler);
}
}
public void DeleteJDTask()
{
var appKey = "E1AA9247D5583A6D87449CE6AB290185";
var appSecret = "e479558ddd9e40f8929cfc00c6cbbc9c";
var appToken = "578d4074d5c04272af72de7f5fbe0ff2qwnz";
var promotionId = 6106235467;
var httpResult = restApiService.SendRequest(GetPlatformRelayAPIHost(Enums.Platform.),
"api/platformsdk/DeleteJDPromotionTask",
new DeleteJDPromotionTaskRequest()
{
AppKey = appKey,
AppSecret = appSecret,
AppToken = appToken,
Platform = Enums.Platform.,
PromotionId = promotionId
},
GetYunDingRequestHeader(),
HttpMethod.Post);
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
throw new BusinessException(httpResult.Content);
var response = JsonConvert.DeserializeObject<ApiResponse>(httpResult.Content);
if (!response.Success)
throw new BusinessException(response.Msg);
}
}

Loading…
Cancel
Save