using BBWY._1688SDK.entity.Order; using BBWY.Common.Models; using BBWY.Server.Business; using BBWY.Server.Model.Db; using com.alibaba.openapi.client; using com.alibaba.openapi.client.policy; using Jd.Api; using Jd.Api.Request; using Jd.Api.Response; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.Http; using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Security.Policy; using System.Text; using System.Threading; namespace BBWY.Test { internal class Program { private static IJdClient GetJdClient(string appKey, string appSecret) { return new DefaultJdClient("https://api.jd.com/routerjson", appKey, appSecret); } public static string Md5Encrypt(string originStr) { using (var md5 = MD5.Create()) { return string.Join(string.Empty, md5.ComputeHash(Encoding.UTF8.GetBytes(originStr)).Select(x => x.ToString("x2"))); } } private static SyncAPIClient GetSyncAPIClient(string appKey, string appSecret) { var sercvice = new ServiceCollection(); sercvice.AddHttpClient(); var servicePriovder = sercvice.BuildServiceProvider(); return new SyncAPIClient(appKey, appSecret, new Common.Http.RestApiService(servicePriovder.GetRequiredService())); } static void Main(string[] args) { var appkey = "E1AA9247D5583A6D87449CE6AB290185"; var appSecret = "e479558ddd9e40f8929cfc00c6cbbc9c"; // var appkey = "120EA9EC65AB017567D78CC1139EEEA5"; // var appSecret = "8a42bc2301e8439b896e99f5475e0a9b"; ////0e61c4a8ec3e4df4b5836e10884db9220yth 齐盛 var token = "8404898e42d04358879785f0e576019cwndg"; //爱维亲玩具专营店 //布莱特玩具 //var token = "01f5be2cb4d741dda66bce2356941597mdfm"; //布莱特玩具 token2 //var token = "01dc6f6e7fc34dcd99090d690312556cmdfk"; //齐盛 //var token = "9fffa982da23446fb035499ae5622f49odjk"; //腾奇 //var token = "c22ff4d37b6c4bbd82cd9e8d0dab42dbziyz"; //森王车品 //var token = "44c19a1c1fbd4641957e6e8985ed1358jmtl"; //森王玩具 //var token = "4a0ddc095e054c7aa90adcaccb14f83cwzgr"; //可比车品 //var token = "50a4c0f5c55848b5a8a715709e8d6fe0jntb"; //卿卿玩具专营店 var fsql = new FreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.MySql, "data source=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;port=3306;user id=qyroot;password=kaicn1132+-;initial catalog=bbwy_test;charset=utf8;sslmode=none;").Build(); //var sercvice = new ServiceCollection(); //sercvice.AddHttpClient(); //var servicePriovder = sercvice.BuildServiceProvider(); //var restApiService = new Common.Http.RestApiService(servicePriovder.GetRequiredService()); //var files = System.IO.Directory.GetFiles(@"C:\Users\pengcong001\Desktop\bbwylog"); //var startTime = DateTime.Parse("2023-10-16"); //var endTime = DateTime.Parse("2023-11-22"); //foreach (var file in files) //{ // var fileName = file.Substring(file.LastIndexOf("\\") + 1); // Console.WriteLine(file); // var lines = System.IO.File.ReadAllLines(file); // var priceModifyMsgList = lines.Where(l => !string.IsNullOrEmpty(l) && l.Contains("ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY")).ToList(); // var orderIndex = 0; // foreach (var priceModifyMsg in priceModifyMsgList) // { // orderIndex++; // var poId = JObject.Parse(priceModifyMsg)["data"]["orderId"].ToString(); // var orderDropshipping = fsql.Select().Where(o => o.PurchaseOrderId == poId).ToOne(); // if (orderDropshipping == null) // continue; // var orderId = orderDropshipping.OrderId; // var shopId = orderDropshipping.ShopId; // var result = restApiService.SendRequest("http://bbwytest.qiyue666.com/", "api/test/RepairSkuDetailAndSkuGriooProfit", new // { // StartTime = startTime, // EndTime = endTime, // ShopId = shopId, // OrderId = orderId, // OrderIdList = new List() // }, null, HttpMethod.Post); // Console.WriteLine($"{DateTime.Now} {fileName} {orderIndex}/{priceModifyMsgList.Count()} HttpResult{result.StatusCode}"); // Thread.Sleep(2000); // } // try // { // System.IO.File.Delete(file); // } // catch { } //} Console.ReadKey(); } static string tomMd5(string str) { using (var md5 = MD5.Create()) { return string.Join(string.Empty, md5.ComputeHash(Encoding.UTF8.GetBytes(str)).Select(x => x.ToString("x2"))); } } } }