From 6f16a23cd9a6468d5b8c19c2f5f5eeb9e3534895 Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Sun, 4 Jun 2023 22:54:31 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Middlewares/ClientVersionValidationMiddleWare.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BBWYB.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs b/BBWYB.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs index cdd75c1..42e3bba 100644 --- a/BBWYB.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs +++ b/BBWYB.Server.API/Middlewares/ClientVersionValidationMiddleWare.cs @@ -31,11 +31,11 @@ namespace BBWYB.Server.API.Middlewares if (apiRequirement != null) { if (!context.Request.Headers.TryGetValue("ClientVersion", out StringValues clientVersionStr)) - throw new BusinessException("未读取到ClientVersion"); + throw new BusinessException("缺少版本信息,请更新步步为盈"); if (!int.TryParse(clientVersionStr, out int clientVersion)) - throw new BusinessException("非法ClientVersion"); + throw new BusinessException("版本信息不正确,请更新步步为盈"); if (clientVersion < apiRequirement.MinimumVersion) - throw new BusinessException("当前ClientVersion低于接口最低要求,请升级到最新版"); + throw new BusinessException("当前请求需更新步步为盈~!"); } await _next(context); //调用管道执行下一个中间件 } From 7a21bb4adafb527893fb1de221a51ae21bab657f Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Mon, 5 Jun 2023 11:46:57 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=8B=B3=E6=8E=A2=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BB=85=E9=99=90bbwyc=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Request/Order/QuanTan_Supplier_QueryOrderReuqest.cs | 5 +++++ SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/QuanTan.SDK/Models/Supplier/Request/Order/QuanTan_Supplier_QueryOrderReuqest.cs b/QuanTan.SDK/Models/Supplier/Request/Order/QuanTan_Supplier_QueryOrderReuqest.cs index 0557545..0954b6a 100644 --- a/QuanTan.SDK/Models/Supplier/Request/Order/QuanTan_Supplier_QueryOrderReuqest.cs +++ b/QuanTan.SDK/Models/Supplier/Request/Order/QuanTan_Supplier_QueryOrderReuqest.cs @@ -32,5 +32,10 @@ /// 订单Id /// public string orderId { get; set; } + + /// + /// 下单来源 0、拳探平台 1、步步为赢C端 + /// + public int source { get; set; } } } diff --git a/SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs b/SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs index d505966..d8d8589 100644 --- a/SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs +++ b/SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs @@ -89,7 +89,8 @@ namespace SDKAdapter.OperationPlatform.Client order = request.SortTimeField == AdapterEnums.SortTimeField.Modify ? "update_time" : "create_time", orderBy = request.SortType == AdapterEnums.SortType.Asc ? "asc" : "desc", page = request.PageIndex, - pageSize = request.PageSize + pageSize = request.PageSize, + source = 1 }; if (request.SortTimeField == AdapterEnums.SortTimeField.Modify) { From f9505a77430d9cf7a02cfb5b580388435987d661 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Mon, 5 Jun 2023 13:42:38 +0800 Subject: [PATCH 3/8] =?UTF-8?q?UPC=E4=BF=AE=E6=94=B9=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- U/WebView2Manager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/U/WebView2Manager.cs b/U/WebView2Manager.cs index 7d2241f..91ab8b7 100644 --- a/U/WebView2Manager.cs +++ b/U/WebView2Manager.cs @@ -18,7 +18,7 @@ namespace U if (wb2 == null) { wb2 = new WebView2(); - var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WebView2UserData")).Result; + var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "UPC_WebView2UserData")).Result; wb2.EnsureCoreWebView2Async(wb2Setting); wb2.CoreWebView2InitializationCompleted += Wb2_CoreWebView2InitializationCompleted; wb2.NavigationCompleted += Wb2_NavigationCompleted; From a24a04d82a8fa9a8b8e3913f7b99fc076567324f Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Mon, 5 Jun 2023 13:49:40 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=9D=A1=E7=A0=81=2010001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- U/MainWindow.xaml | 2 +- U/U.csproj | 5 +++++ U/tiaoma1.ico | Bin 0 -> 137750 bytes 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 U/tiaoma1.ico diff --git a/U/MainWindow.xaml b/U/MainWindow.xaml index 7e721be..1012111 100644 --- a/U/MainWindow.xaml +++ b/U/MainWindow.xaml @@ -18,7 +18,7 @@ - + diff --git a/U/U.csproj b/U/U.csproj index 3a5cddf..28267ea 100644 --- a/U/U.csproj +++ b/U/U.csproj @@ -5,8 +5,13 @@ net6.0-windows enable true + tiaoma1.ico + + + + diff --git a/U/tiaoma1.ico b/U/tiaoma1.ico new file mode 100644 index 0000000000000000000000000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WeNR%X8q47`~RknKgN3eHOAx5Yx}zj`!AWdQ2WEP9)D|3yT;#}fH(fmX?)ChwYbmY zv$&Ue$o}~wmtO=A+FFfwx-^gZcR>A`>Y)!kOKHrcv98}_mhOq8w%ghgrSa+LUSsA< zf#$P{Y2|{cKzdMJOhQ)ApNEj=X?;CQqLqgoRFZwHE;L`TWyX$)>t^g|D}gD4bqV;V zD4NN4i1jVvd49P0D~=ylx_5Ypr+DjWQqvOcpfpc0i5u_NpX-o~G?$%=k=Ol-LQZF= z6k~I*IJ1DlEFR?{r!l?Keg^3IdLy_BoN)BQEW{KP(Es{KPo$;tG`|OwuxJqo(2AI3v;&ibFa Date: Mon, 5 Jun 2023 15:51:05 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D1688=20=E7=9A=84skuid=20?= =?UTF-8?q?=E8=A2=AB=E4=B8=8B=E6=9E=B6=E9=85=8D=E7=BD=AE=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UpdatePurchaseTaskViewModel.cs | 26 ++++++++++++++----- BBWYB.Client/appsettings.json | 4 +-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs b/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs index 04763d1..beed8bb 100644 --- a/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs +++ b/BBWYB.Client/ViewModels/PackPurchaseTask/UpdatePurchaseTaskViewModel.cs @@ -304,7 +304,7 @@ namespace BBWYB.Client.ViewModels SetCertificateCommand = new RelayCommand(SetCertificate); LookBarCommand = new RelayCommand(LookBar); LookCerCommand = new RelayCommand(LookCer); - + IncreateList = new ObservableCollection(); foreach (var item in increates) { @@ -501,12 +501,17 @@ namespace BBWYB.Client.ViewModels var list = purchaseService.GetPurchaseSkuBasicInfo(item.PurchaseProductId); if (list == null) continue; var skuItem = list.Data.ItemList.FirstOrDefault(f => f.PurchaseSkuId == item.PurchaseSkuId); + if (skuItem == null) + { + MessageBox.Show($"{item.PurchaseProductId}采购商品列表不存在skuid:{item.PurchaseSkuId},sku商品可能被下架了."); + //return false; + } App.Current.Dispatcher.Invoke(new Action(() => { PurchaseSkuList.Add(new Models.PackPurchaseTask.PurchaseSku { - Logo = skuItem.Logo, - Title = skuItem.Title, + Logo = skuItem?.Logo, + Title = skuItem?.Title, IsNeedCer = item.IsNeedCer, PurchaseSkuId = item.PurchaseSkuId, CerDTO = item.CerDTO, @@ -530,13 +535,13 @@ namespace BBWYB.Client.ViewModels //MarkMessage = config.MarkMessage; CertificatePosition = config.CertificatePosition == null ? CertificatePosition.无 : (CertificatePosition)config.CertificatePosition.Value; // Increment1 = config.Increment1; - + IsNeedBarCode = config.NeedBar ? Need.需要 : Need.不需要; IsNeedCertificateModel = config.NeedCer ? Need.需要 : Need.不需要; IsSetBarCode = !config.NeedBar; IsSetCertificate = !config.NeedCer; - + string[] increateDatas = config.Increment1?.Split(','); bool isSelected = false; @@ -618,7 +623,7 @@ namespace BBWYB.Client.ViewModels BasicPack = BasicPack.快递袋; SkuPurchaseSchemeId = ""; SkuTitle = ""; - BarCodeModel= null; + BarCodeModel = null; OriginShopName = ""; // Availability = (TaskState.)config.Availability; @@ -716,7 +721,14 @@ namespace BBWYB.Client.ViewModels } if (IsNeedCertificateModel == Need.需要) { - var cerList = purchaseSkuList.Where(p => p.IsNeedCer&&p.CerDTO!=null).Select(p => p.CerDTO).Select(c => c.Id).Where(c => c > 0).ToList(); + + if (purchaseSkuList.Any(p => p.IsNeedCer && p.CerDTO == null)) + { + MessageBox.Show("有未设置的合格证,请设置完所有的合格证再保存"); + return; + } + + var cerList = purchaseSkuList.Where(p => p.IsNeedCer).Select(p => p.CerDTO).Select(c => c.Id).Where(c => c > 0).ToList(); if (purchaseSkuList.Count() <= 0 || cerList.Count <= 0) { MessageBox.Show("请设置合格证模板"); diff --git a/BBWYB.Client/appsettings.json b/BBWYB.Client/appsettings.json index 80bdfe4..cd45795 100644 --- a/BBWYB.Client/appsettings.json +++ b/BBWYB.Client/appsettings.json @@ -3,6 +3,6 @@ "BBWYApiHost": "http://bbwyb.qiyue666.com", "MDSApiHost": "http://mdsapi.qiyue666.com", "BBWYCApiHost": "http://bbwytest.qiyue666.com", - //"QKApiHost": "http://localhost:8080" - "QKApiHost": "http://qiku.qiyue666.com" + "QKApiHost": "http://localhost:8080" + // "QKApiHost": "http://qiku.qiyue666.com" } \ No newline at end of file From 7a62c80f4c5a5491ee5daf5982b0cb8981cf4a72 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Mon, 5 Jun 2023 17:35:05 +0800 Subject: [PATCH 6/8] 1 --- U/App.xaml.cs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/U/App.xaml.cs b/U/App.xaml.cs index 8401209..7bc161c 100644 --- a/U/App.xaml.cs +++ b/U/App.xaml.cs @@ -30,23 +30,23 @@ namespace U Environment.Exit(Environment.ExitCode); } - var gl = new GlobalContext(); - string userToken = string.Empty; -#if DEBUG - //齐越山鸡 - userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; -#else +// var gl = new GlobalContext(); +// string userToken = string.Empty; +//#if DEBUG +// //齐越山鸡 +// userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; +//#else - var tokenResult = ReadMMF(); - if (tokenResult.isOk) - userToken = tokenResult.content; - else - { - MessageBox.Show($"读取内存数据失败\r\n{tokenResult.content}", "提示"); - Environment.Exit(0); - } -#endif - gl.UserToken = userToken; +// var tokenResult = ReadMMF(); +// if (tokenResult.isOk) +// userToken = tokenResult.content; +// else +// { +// MessageBox.Show($"读取内存数据失败\r\n{tokenResult.content}", "提示"); +// Environment.Exit(0); +// } +//#endif +// gl.UserToken = userToken; From b97d3d6984133cc5b18e57cfee9a322435b699cb Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Tue, 6 Jun 2023 15:49:43 +0800 Subject: [PATCH 7/8] WebTest --- WebTest/APIServices/BaseApiService.cs | 58 +++++ WebTest/APIServices/MdsApiService.cs | 108 +++++++++ WebTest/APIServices/ShopService.cs | 39 ++++ WebTest/App.xaml | 28 +++ WebTest/App.xaml.cs | 50 ++++ WebTest/AssemblyInfo.cs | 10 + WebTest/GlobalContext.cs | 26 +++ WebTest/MainWindow.xaml | 29 +++ WebTest/MainWindow.xaml.cs | 220 ++++++++++++++++++ .../APIModel/Shop/PurchaseAccountResponse.cs | 19 ++ WebTest/Models/APIModel/Shop/ShopResponse.cs | 86 +++++++ .../Models/APIModel/User/MDSUserResponse.cs | 17 ++ WebTest/Models/Enums.cs | 18 ++ WebTest/Models/MappingProfile.cs | 21 ++ WebTest/Models/NotifyObject.cs | 23 ++ WebTest/Models/Shop/Department.cs | 37 +++ WebTest/Models/Shop/PurchaseAccount.cs | 28 +++ WebTest/Models/Shop/Shop.cs | 89 +++++++ WebTest/Models/User/User.cs | 33 +++ WebTest/WebTest.csproj | 32 +++ WebTest/WebView2Manager.cs | 69 ++++++ WebTest/appSettings.json | 4 + bbwyb.sln | 12 +- 23 files changed, 1055 insertions(+), 1 deletion(-) create mode 100644 WebTest/APIServices/BaseApiService.cs create mode 100644 WebTest/APIServices/MdsApiService.cs create mode 100644 WebTest/APIServices/ShopService.cs create mode 100644 WebTest/App.xaml create mode 100644 WebTest/App.xaml.cs create mode 100644 WebTest/AssemblyInfo.cs create mode 100644 WebTest/GlobalContext.cs create mode 100644 WebTest/MainWindow.xaml create mode 100644 WebTest/MainWindow.xaml.cs create mode 100644 WebTest/Models/APIModel/Shop/PurchaseAccountResponse.cs create mode 100644 WebTest/Models/APIModel/Shop/ShopResponse.cs create mode 100644 WebTest/Models/APIModel/User/MDSUserResponse.cs create mode 100644 WebTest/Models/Enums.cs create mode 100644 WebTest/Models/MappingProfile.cs create mode 100644 WebTest/Models/NotifyObject.cs create mode 100644 WebTest/Models/Shop/Department.cs create mode 100644 WebTest/Models/Shop/PurchaseAccount.cs create mode 100644 WebTest/Models/Shop/Shop.cs create mode 100644 WebTest/Models/User/User.cs create mode 100644 WebTest/WebTest.csproj create mode 100644 WebTest/WebView2Manager.cs create mode 100644 WebTest/appSettings.json diff --git a/WebTest/APIServices/BaseApiService.cs b/WebTest/APIServices/BaseApiService.cs new file mode 100644 index 0000000..693541b --- /dev/null +++ b/WebTest/APIServices/BaseApiService.cs @@ -0,0 +1,58 @@ +using BBWYB.Common.Http; +using BBWYB.Common.Models; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Net.Http; + +namespace WebTest.APIServices +{ + public class BaseApiService + { + private RestApiService restApiService; + + protected GlobalContext globalContext; + + public BaseApiService(RestApiService restApiService, GlobalContext globalContext) + { + this.restApiService = restApiService; + this.globalContext = globalContext; + } + + protected ApiResponse SendRequest(string apiHost, + string apiPath, + object param, + IDictionary headers, + HttpMethod httpMethod, + string contentType = RestApiService.ContentType_Json, + ParamPosition paramPosition = ParamPosition.Body, + bool enableRandomTimeStamp = false) + { + try + { + if (headers == null) + headers = new Dictionary(); + if (!headers.ContainsKey("ClientCode")) + headers.Add("ClientCode", "U"); + if (!headers.ContainsKey("ClientVersion")) + headers.Add("ClientVersion", "10000"); + if (!headers.ContainsKey("Authorization") && !string.IsNullOrEmpty(globalContext.UserToken)) + headers.Add("Authorization", $"Bearer {globalContext.UserToken}"); + if (!headers.ContainsKey("qy")) + headers.Add("qy", "qy"); + + var result = restApiService.SendRequest(apiHost, apiPath, param, headers, httpMethod, contentType, paramPosition, enableRandomTimeStamp); + if (result.StatusCode != System.Net.HttpStatusCode.OK && + result.Content.Contains("\"Success\"") && + result.Content.Contains("\"Msg\"") && + result.Content.Contains("\"Data\"")) + throw new BusinessException($"{result.StatusCode} {result.Content}") { Code = (int)result.StatusCode }; + return JsonConvert.DeserializeObject>(result.Content); + } + catch (Exception ex) + { + return ApiResponse.Error((ex is BusinessException) ? (ex as BusinessException).Code : 0, ex.Message); + } + } + } +} diff --git a/WebTest/APIServices/MdsApiService.cs b/WebTest/APIServices/MdsApiService.cs new file mode 100644 index 0000000..3bab3f2 --- /dev/null +++ b/WebTest/APIServices/MdsApiService.cs @@ -0,0 +1,108 @@ +using BBWYB.Common.Http; +using BBWYB.Common.Models; +using Newtonsoft.Json.Linq; +using WebTest.Models; +using System; +using System.Collections.Generic; +using System.Net.Http; + +namespace WebTest.APIServices +{ + public class MdsApiService : BaseApiService, IDenpendency + { + public MdsApiService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) + { + + } + + public ApiResponse GetUserInfo(string userToken) + { + return SendRequest(globalContext.MDSApiHost, + "/TaskList/User/GetUserInfo", + null, + new Dictionary() + { + { "Authorization", $"Bearer {userToken}" } + }, HttpMethod.Get); + } + + + + //public ApiResponse> GetShopsByUserTeam(long userId) + //{ + // return SendRequest>(globalContext.MDSApiHost, "TaskList/Shop/GetShopsByUserTeam", $"userId={userId}", null, System.Net.Http.HttpMethod.Get); + //} + + public ApiResponse> GetShopDetailList() + { + var response = new ApiResponse>(); + var response2 = SendRequest(globalContext.MDSApiHost, "TaskList/UserDepartment/GetShopDetailList", null, null, HttpMethod.Get); + if (!response.Success) + { + response.Code = response2.Code; + response.Msg = response2.Msg; + return response; + } + + response.Data = new List(); + foreach (var jDepartment in response2.Data) + { + var jayShops = jDepartment.Value("ShopList"); + if (jayShops == null || !jayShops.HasValues) + continue; //排除空店部门 + var d = new Department() + { + Id = jDepartment.Value("Id"), + Name = jDepartment.Value("DepartmentName") + }; + response.Data.Add(d); + foreach (var jShop in jayShops) + { + if (jShop.Value("ShopId") == null || string.IsNullOrEmpty(jShop.Value("AppToken"))) + continue; //排除未授权 + try + { + var shop = new Shop() + { + ShopId = jShop.Value("ShopId"), + AppKey = jShop.Value("AppKey"), + AppSecret = jShop.Value("AppSecret"), + AppToken = jShop.Value("AppToken"), + ManagePwd = jShop.Value("ManagePwd"), + Platform = (Platform)jShop.Value("PlatformId"), + PlatformCommissionRatio = jShop.Value("PlatformCommissionRatio") ?? 0.05M, + ShopName = jShop.Value("ShopName"), + VenderType = jShop.Value("ShopType"), + TeamId = jShop.Value("TeamId") + }; + d.ShopList.Add(shop); + //var jayAccounts = jShop.Value("AccountList"); + //if (jayAccounts == null || !jayAccounts.HasValues) + // continue; + //shop.PurchaseAccountList = new List(); + //foreach (var jPurchaseAccount in jayAccounts) + //{ + // shop.PurchaseAccountList.Add(new PurchaseAccount() + // { + // Id = jPurchaseAccount.Value("Id"), + // AccountName = jPurchaseAccount.Value("AccountName"), + // AppKey = jPurchaseAccount.Value("AppKey"), + // AppSecret = jPurchaseAccount.Value("AppSecret"), + // AppToken = jPurchaseAccount.Value("AppToken"), + // ShopId = shop.ShopId + // //PurchasePlatformId = jPurchaseAccount.Value() + // }); + //} + } + catch (Exception ex) + { + Console.WriteLine(jShop.ToString()); + throw; + } + } + } + + return response; + } + } +} diff --git a/WebTest/APIServices/ShopService.cs b/WebTest/APIServices/ShopService.cs new file mode 100644 index 0000000..10e7309 --- /dev/null +++ b/WebTest/APIServices/ShopService.cs @@ -0,0 +1,39 @@ +using BBWYB.Common.Models; +using WebTest.Models; +using System.Collections.Generic; +using System.Net.Http; +using BBWYB.Common.Http; + +namespace WebTest.APIServices +{ + public class ShopService : BaseApiService, IDenpendency + { + public ShopService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } + + + /// + /// 获取部门及下属店铺 + /// + /// + public ApiResponse> GetDepartmentList() + { + return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null, + new Dictionary() + { + { "bbwyTempKey", "21jfhayu27q" } + }, HttpMethod.Get); + } + + public ApiResponse> GetShopListByIds(IList shopIds) + { + return SendRequest>(globalContext.BBYWApiHost, "api/vender/GetShopListByShopIds", new + { + shopIds + }, new Dictionary() + { + { "bbwyTempKey", "21jfhayu27q" } + }, HttpMethod.Post); + } + + } +} diff --git a/WebTest/App.xaml b/WebTest/App.xaml new file mode 100644 index 0000000..a7e754c --- /dev/null +++ b/WebTest/App.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + diff --git a/WebTest/App.xaml.cs b/WebTest/App.xaml.cs new file mode 100644 index 0000000..0425e36 --- /dev/null +++ b/WebTest/App.xaml.cs @@ -0,0 +1,50 @@ +using BBWYB.Common.Extensions; +using BBWYB.Common.Http; +using BBWYB.Common.Models; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.IO; +using System.Reflection; +using System.Windows; +using WebTest.Models; + +namespace WebTest +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + public IServiceProvider ServiceProvider { get; private set; } + public IConfiguration Configuration { get; private set; } + + protected override void OnStartup(StartupEventArgs e) + { + var gl = new GlobalContext(); + string userToken = string.Empty; + + //齐越山鸡 + userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; + + gl.UserToken = userToken; + + + var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("appSettings.json", false, true); + Configuration = builder.Build(); + + gl.BBYWApiHost = Configuration.GetSection("BBWYApiHost").Value; + gl.MDSApiHost = Configuration.GetSection("MDSApiHost").Value; + IServiceCollection serviceCollection = new ServiceCollection(); + serviceCollection.AddHttpClient(); + + serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(gl); + serviceCollection.BatchRegisterServices(new Assembly[] { Assembly.Load("WebTest") }, typeof(IDenpendency)); + serviceCollection.AddMapper(new MappingProfile()); + ServiceProvider = serviceCollection.BuildServiceProvider(); + base.OnStartup(e); + } + } +} diff --git a/WebTest/AssemblyInfo.cs b/WebTest/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/WebTest/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WebTest/GlobalContext.cs b/WebTest/GlobalContext.cs new file mode 100644 index 0000000..f8b1d1b --- /dev/null +++ b/WebTest/GlobalContext.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; +using System.Runtime.InteropServices; + +namespace WebTest +{ + [ClassInterface(ClassInterfaceType.AutoDual)] + [ComVisible(true)] + public class GlobalContext + { + public User User { get; set; } + + public string UserToken { get; set; } + + + #region APIHost + public string BBYWApiHost { get; set; } + + public string MDSApiHost { get; set; } + #endregion + + public string GetUserString() + { + return JsonConvert.SerializeObject(User); + } + } +} \ No newline at end of file diff --git a/WebTest/MainWindow.xaml b/WebTest/MainWindow.xaml new file mode 100644 index 0000000..b7269aa --- /dev/null +++ b/WebTest/MainWindow.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + diff --git a/WebTest/MainWindow.xaml.cs b/WebTest/MainWindow.xaml.cs new file mode 100644 index 0000000..fcaaf54 --- /dev/null +++ b/WebTest/MainWindow.xaml.cs @@ -0,0 +1,220 @@ +using BBWYB.Common.Extensions; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Web.WebView2.Core; +using SJ.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using WebTest.APIServices; + +namespace WebTest +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : BWindow + { + private GlobalContext globalContext; + private WebView2Manager w2m; + private bool isNavigated; + + + private IList managerDepartment = new List() { "董事办", "财务部", "技术部", "总经办" }; + private MdsApiService mdsApiService; + private ShopService shopService; + + public MainWindow() + { + InitializeComponent(); + this.Loaded += MainWindow_Loaded; + } + + private bool CheckWebview2Runtime() + { + bool isInstall = false; + try + { + isInstall = !string.IsNullOrEmpty(CoreWebView2Environment.GetAvailableBrowserVersionString()); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + return isInstall; + } + + private void MainWindow_Loaded(object sender, System.Windows.RoutedEventArgs e) + { + if (!CheckWebview2Runtime()) + { + MessageBox.Show("缺少webview2 runtime,请下载安装之后再运行评价助手"); + //下载webview2 runtime + //Task.Factory.StartNew(DownloadWebview2Runtime); + var webview2RuntimeUrl = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/238fc310-c6c1-4a3e-a806-4a7c3c17b377/MicrosoftEdgeWebView2RuntimeInstallerX64.exe"; + try + { + System.Diagnostics.Process.Start("explorer.exe", webview2RuntimeUrl); + Thread.Sleep(1000); + } + catch (Exception ex) + { + Clipboard.SetText(webview2RuntimeUrl); + MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); + } + finally + { + Environment.Exit(Environment.ExitCode); + } + } + + var sp = (App.Current as App).ServiceProvider; + using (var s = sp.CreateScope()) + { + w2m = s.ServiceProvider.GetRequiredService(); + globalContext = s.ServiceProvider.GetRequiredService(); + mdsApiService = s.ServiceProvider.GetRequiredService(); + shopService = s.ServiceProvider.GetRequiredService(); + } + + Login(); + w2m.CoreWebView2InitializationCompleted = (e) => + { + w2m.wb2.CoreWebView2.AddHostObjectToScript("webTestContext", this.globalContext); + //isNavigated = true; + //w2m.wb2.CoreWebView2.Navigate(url); + }; + + w2m.Init(); + w2m.wb2.SetValue(Grid.RowProperty, 2); + w2m.wb2.Margin = new Thickness(1, 0, 1, 0); + grid.Children.Add(w2m.wb2); + + + + //if (w2m.IsInitializationCompleted && !isNavigated) + //{ + // w2m.wb2.CoreWebView2.Navigate(url); + // //w2m.wb2.CoreWebView2.NavigateToString(content); + // isNavigated = true; + //} + } + + private void Login() + { + try + { + var mdsUserResponse = mdsApiService.GetUserInfo(globalContext.UserToken); + if (!mdsUserResponse.Success) + throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}"); + + globalContext.User = mdsUserResponse.Data.Map(); + globalContext.User.Token = globalContext.UserToken; + globalContext.User.SonDepartmentNames = string.Empty; + if (mdsUserResponse.Data.SonDepartmentList != null && mdsUserResponse.Data.SonDepartmentList.Count > 0) + globalContext.User.SonDepartmentNames = string.Join(',', mdsUserResponse.Data.SonDepartmentList.Select(sd => sd.DepartmentName)); + + IList departmentList = null; + if (globalContext.User.TeamName == "刷单组" || + managerDepartment.Contains(globalContext.User.TeamName) || + managerDepartment.Any(m => globalContext.User.SonDepartmentNames.Contains(m))) + { + var response = shopService.GetDepartmentList(); + if (!response.Success) + throw new Exception(response.Msg); + departmentList = response.Data.Map>(); + } + else + { + var response = mdsApiService.GetShopDetailList(); + if (!response.Success) + throw new Exception(response.Msg); + departmentList = response.Data; + if (departmentList.Count == 0) + throw new Exception("缺少有效的部门数据"); + + var shopIds = new List(); + foreach (var d in departmentList) + { + if (d.ShopList != null && d.ShopList.Count > 0) + { + foreach (var s in d.ShopList) + shopIds.Add(s.ShopId.ToString()); + } + } + + var shopList2Res = shopService.GetShopListByIds(shopIds); + if (shopList2Res.Success && shopList2Res.Data != null && shopList2Res.Data.Count() > 0) + { + foreach (var d in departmentList) + { + foreach (var shop in d.ShopList) + { + var s2 = shopList2Res.Data.FirstOrDefault(s => s.ShopId == shop.ShopId); + if (s2 != null) + { + shop.DingDingKey = s2.DingDingKey; + shop.DingDingWebHook = s2.DingDingWebHook; + shop.SkuSafeTurnoverDays = s2.SkuSafeTurnoverDays; + shop.SiNanPolicyLevel = s2.SiNanPolicyLevel; + shop.SiNanDingDingKey = s2.SiNanDingDingKey; + shop.SiNanDingDingWebHook = s2.SiNanDingDingWebHook; + shop.AppKey2 = s2.AppKey2; + shop.AppSecret2 = s2.AppSecret2; + shop.AppToken2 = s2.AppToken2; + } + } + } + } + } + for (var i = 0; i < departmentList.Count(); i++) + { + var d = departmentList[i]; + for (var j = 0; j < d.ShopList.Count(); j++) + { + var shop = d.ShopList[j]; + if (string.IsNullOrEmpty(shop.AppToken2)) + { + d.ShopList.RemoveAt(j); + j--; + } + } + if (d.ShopList == null || d.ShopList.Count() == 0) + { + departmentList.RemoveAt(i); + i--; + } + + } + globalContext.User.DepartmentList = departmentList; + + } + catch (Exception ex) + { + App.Current.Dispatcher.Invoke(() => + { + MessageBox.Show(ex.Message, "登录失败"); + }); + Environment.Exit(Environment.ExitCode); + } + + } + + private void btn_navigation_Click(object sender, RoutedEventArgs e) + { + if (string.IsNullOrEmpty(txtUrl.Text)) + { + MessageBox.Show("地址不能为空", "提示"); + return; + } + if (!txtUrl.Text.StartsWith("http")) + { + MessageBox.Show("地址需要携带协议头", "提示"); + return; + } + w2m.wb2.CoreWebView2.Navigate(txtUrl.Text); + } + } +} diff --git a/WebTest/Models/APIModel/Shop/PurchaseAccountResponse.cs b/WebTest/Models/APIModel/Shop/PurchaseAccountResponse.cs new file mode 100644 index 0000000..8d77f1f --- /dev/null +++ b/WebTest/Models/APIModel/Shop/PurchaseAccountResponse.cs @@ -0,0 +1,19 @@ +namespace WebTest.Models +{ + public class PurchaseAccountResponse + { + public long Id { get; set; } + + public string AccountName { get; set; } + + public long ShopId { get; set; } + + public Platform PurchasePlatformId { get; set; } + + public string AppKey { get; set; } + + public string AppSecret { get; set; } + + public string AppToken { get; set; } + } +} diff --git a/WebTest/Models/APIModel/Shop/ShopResponse.cs b/WebTest/Models/APIModel/Shop/ShopResponse.cs new file mode 100644 index 0000000..90bd153 --- /dev/null +++ b/WebTest/Models/APIModel/Shop/ShopResponse.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; + +namespace WebTest.Models +{ + public class ShopResponse + { + public string Id { get; set; } + + public Platform PlatformId { get; set; } + + public long? ShopId { get; set; } + + public string ShopName { get; set; } + + public string ShopType { get; set; } + + public string AppKey { get; set; } + + public string AppSecret { get; set; } + + public string AppToken { get; set; } + + public string AppKey2 { get; set; } + + public string AppSecret2 { get; set; } + + public string AppToken2 { get; set; } + + //public IList PurchaseList { get; set; } + + public string ManagePwd { get; set; } + + public decimal? PlatformCommissionRatio { get; set; } + + public string TeamId { get; set; } + + public string TeamName { get; set; } + + public string DingDingWebHook { get; set; } + + public string DingDingKey { get; set; } + + public int SkuSafeTurnoverDays { get; set; } + + /// + /// 司南策略等级 + /// + public int SiNanPolicyLevel { get; set; } + + /// + /// 司南钉钉WebHook地址 + /// + public string SiNanDingDingWebHook { get; set; } + + /// + /// 司南钉钉密钥 + /// + public string SiNanDingDingKey { get; set; } + + /// + /// U钉钉WebHook地址 + /// + public string UDingDingWebHook { get; set; } + + /// + /// U钉钉密钥 + /// + public string UDingDingKey { get; set; } + } + + public class DepartmentResponse + { + public string Id { get; set; } + + public string Name { get; set; } + + public IList ShopList { get; set; } + } + + public class DepartmentResponse2 + { + public string DepartmentId { get; set; } + + public string DepartmentName { get; set; } + } +} diff --git a/WebTest/Models/APIModel/User/MDSUserResponse.cs b/WebTest/Models/APIModel/User/MDSUserResponse.cs new file mode 100644 index 0000000..d5eaee5 --- /dev/null +++ b/WebTest/Models/APIModel/User/MDSUserResponse.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace WebTest.Models +{ + public class MDSUserResponse + { + public long Id { get; set; } + public string DepartmentName { get; set; } + public string DepartmentId { get; set; } + + public string UserName { get; set; } + + public string UserNick { get; set; } + + public IList SonDepartmentList { get; set; } + } +} diff --git a/WebTest/Models/Enums.cs b/WebTest/Models/Enums.cs new file mode 100644 index 0000000..b5e90c3 --- /dev/null +++ b/WebTest/Models/Enums.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebTest.Models +{ + /// + /// 电商平台 + /// + public enum Platform + { + 淘宝 = 0, + 京东 = 1, + 阿里巴巴 = 2, + 拼多多 = 3, + 微信 = 4 + } +} diff --git a/WebTest/Models/MappingProfile.cs b/WebTest/Models/MappingProfile.cs new file mode 100644 index 0000000..ed10fd5 --- /dev/null +++ b/WebTest/Models/MappingProfile.cs @@ -0,0 +1,21 @@ +using AutoMapper; + +namespace WebTest.Models +{ + public class MappingProfile : Profile + { + public MappingProfile() + { + CreateMap().ForMember(t => t.TeamId, opt => opt.MapFrom(f => f.DepartmentId)) + .ForMember(t => t.TeamName, opt => opt.MapFrom(f => f.DepartmentName)) + .ForMember(t => t.Name, opt => opt.MapFrom(f => f.UserName)); + + CreateMap().ForMember(t => t.VenderType, opt => opt.MapFrom(f => f.ShopType)) + .ForMember(t => t.Platform, opt => opt.MapFrom(f => f.PlatformId)); + //.ForMember(t => t.PurchaseAccountList, opt => opt.MapFrom(f => f.PurchaseList)); + + CreateMap(); + CreateMap(); + } + } +} diff --git a/WebTest/Models/NotifyObject.cs b/WebTest/Models/NotifyObject.cs new file mode 100644 index 0000000..e5b6e1b --- /dev/null +++ b/WebTest/Models/NotifyObject.cs @@ -0,0 +1,23 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace WebTest +{ + public class NotifyObject : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + protected void OnPropertyChanged([CallerMemberName]string propertyName = "") + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + protected bool Set(ref T oldValue, T newValue, [CallerMemberName]string propertyName = "") + { + if (Equals(oldValue, newValue)) + return false; + oldValue = newValue; + OnPropertyChanged(propertyName); + return true; + } + } +} diff --git a/WebTest/Models/Shop/Department.cs b/WebTest/Models/Shop/Department.cs new file mode 100644 index 0000000..af0a369 --- /dev/null +++ b/WebTest/Models/Shop/Department.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace WebTest +{ + public class Department : NotifyObject + { + private bool isSelected; + + public string Id { get; set; } + + public string Name { get; set; } + + public IList ShopList { get; set; } + public bool IsSelected + { + get => isSelected; + set + { + if (Set(ref isSelected, value)) + OnIsSelectedChanged?.Invoke(); + } + } + + public Department() + { + ShopList = new List(); + } + + public Action OnIsSelectedChanged { get; set; } + + public override string ToString() + { + return this.Name; + } + } +} diff --git a/WebTest/Models/Shop/PurchaseAccount.cs b/WebTest/Models/Shop/PurchaseAccount.cs new file mode 100644 index 0000000..a5d4689 --- /dev/null +++ b/WebTest/Models/Shop/PurchaseAccount.cs @@ -0,0 +1,28 @@ +using WebTest.Models; +using System; + +namespace WebTest +{ + public class PurchaseAccount : NotifyObject,ICloneable + { + private string accountName; + private Platform purchasePlatformId; + private string appKey; + private string appSecret; + private string appToken; + + public long Id { get; set; } + + public long ShopId { get; set; } + public string AccountName { get => accountName; set { Set(ref accountName, value); } } + public Platform PurchasePlatformId { get => purchasePlatformId; set { Set(ref purchasePlatformId, value); } } + public string AppKey { get => appKey; set { Set(ref appKey, value); } } + public string AppSecret { get => appSecret; set { Set(ref appSecret, value); } } + public string AppToken { get => appToken; set { Set(ref appToken, value); } } + + public object Clone() + { + return this.MemberwiseClone(); + } + } +} diff --git a/WebTest/Models/Shop/Shop.cs b/WebTest/Models/Shop/Shop.cs new file mode 100644 index 0000000..7092872 --- /dev/null +++ b/WebTest/Models/Shop/Shop.cs @@ -0,0 +1,89 @@ +using WebTest.Models; +using System.Collections.Generic; + +namespace WebTest +{ + public class Shop : NotifyObject + { + private bool isSelected; + private string shopName; + + public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } + /// + /// 店铺Id + /// + public long ShopId { get; set; } + + /// + /// 商家类型 + /// + public string VenderType { get; set; } + + /// + /// 店铺平台 + /// + public Platform Platform { get; set; } + + public string AppKey { get; set; } + + public string AppSecret { get; set; } + + public string AppToken { get; set; } + + public string AppKey2 { get; set; } + + public string AppSecret2 { get; set; } + + public string AppToken2 { get; set; } + + public string ShopName { get => shopName; set { Set(ref shopName, value); } } + + //public IList PurchaseAccountList { get; set; } + + public string ManagePwd { get; set; } + /// + /// 店铺扣点 + /// + public decimal? PlatformCommissionRatio { get; set; } + + public string TeamId { get; set; } + + public string TeamName { get; set; } + + public string DingDingWebHook { get; set; } + + public string DingDingKey { get; set; } + + public int SkuSafeTurnoverDays { get; set; } + + /// + /// 司南策略等级 + /// + public int SiNanPolicyLevel { get; set; } + + /// + /// 司南钉钉WebHook地址 + /// + public string SiNanDingDingWebHook { get; set; } + + /// + /// 司南钉钉密钥 + /// + public string SiNanDingDingKey { get; set; } + + /// + /// U钉钉WebHook地址 + /// + public string UDingDingWebHook { get; set; } + + /// + /// U钉钉密钥 + /// + public string UDingDingKey { get; set; } + + public override string ToString() + { + return ShopName; + } + } +} diff --git a/WebTest/Models/User/User.cs b/WebTest/Models/User/User.cs new file mode 100644 index 0000000..e06a5b5 --- /dev/null +++ b/WebTest/Models/User/User.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace WebTest +{ + public class User : NotifyObject + { + //private string name; + + private Shop shop; + + public long Id { get; set; } + + public string Name { get; set; } + + public string TeamId { get; set; } + + public string TeamName { get; set; } + + public string SonDepartmentNames { get; set; } + + public Shop Shop { get => shop; set { Set(ref shop, value); } } + + public IList DepartmentList { get; set; } + + /// + /// 店铺列表 (暂时只有刷单组才需要) + /// + public IList ShopList { get; set; } + + public string Token { get; set; } + + } +} diff --git a/WebTest/WebTest.csproj b/WebTest/WebTest.csproj new file mode 100644 index 0000000..8d4029b --- /dev/null +++ b/WebTest/WebTest.csproj @@ -0,0 +1,32 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + diff --git a/WebTest/WebView2Manager.cs b/WebTest/WebView2Manager.cs new file mode 100644 index 0000000..5faa032 --- /dev/null +++ b/WebTest/WebView2Manager.cs @@ -0,0 +1,69 @@ +using BBWYB.Common.Models; +using Microsoft.Web.WebView2.Core; +using Microsoft.Web.WebView2.Wpf; +using System; +using io = System.IO; + +namespace WebTest +{ + public class WebView2Manager : IDenpendency + { + public WebView2 wb2 { get; private set; } + //public WebView2Manager() + //{ + // Init(); + //} + public void Init() + { + if (wb2 == null) + { + wb2 = new WebView2(); + var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "UPC_WebView2UserData")).Result; + wb2.EnsureCoreWebView2Async(wb2Setting); + wb2.CoreWebView2InitializationCompleted += Wb2_CoreWebView2InitializationCompleted; + wb2.NavigationCompleted += Wb2_NavigationCompleted; + wb2.WebMessageReceived += Wb2_WebMessageReceived; + } + } + + public Action OnWebMessageReceived; + public Action OnNavigationCompleted; + public Action CoreWebView2InitializationCompleted; + public bool IsInitializationCompleted { get ; private set; } + + private void Wb2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e) + { + OnWebMessageReceived?.Invoke(e); + } + + private void Wb2_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) + { + OnNavigationCompleted?.Invoke(e); + } + + private void Wb2_CoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e) + { + CoreWebView2InitializationCompleted?.Invoke(e); + IsInitializationCompleted = true; + } + + public void Close() + { + if (wb2 != null && wb2.CoreWebView2 != null) + { + IsInitializationCompleted = false; + wb2.CoreWebView2InitializationCompleted -= Wb2_CoreWebView2InitializationCompleted; + wb2.NavigationCompleted -= Wb2_NavigationCompleted; + wb2.WebMessageReceived -= Wb2_WebMessageReceived; + var udf = wb2.CoreWebView2.Environment.UserDataFolder; + wb2.Dispose(); + wb2 = null; + try + { + io.Directory.Delete(udf, true); + } + catch { } + } + } + } +} diff --git a/WebTest/appSettings.json b/WebTest/appSettings.json new file mode 100644 index 0000000..a0d1691 --- /dev/null +++ b/WebTest/appSettings.json @@ -0,0 +1,4 @@ +{ + "BBWYApiHost": "http://bbwytest.qiyue666.com", + "MDSApiHost": "http://mdsapi.qiyue666.com" +} \ No newline at end of file diff --git a/bbwyb.sln b/bbwyb.sln index 83bdda8..a8c631b 100644 --- a/bbwyb.sln +++ b/bbwyb.sln @@ -44,7 +44,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{878D0106 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "U", "U", "{D34B0974-D525-4BD1-90DE-B2CF5FE47AA4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "U", "U\U.csproj", "{FE3D9812-2D75-4850-8AEA-CE88BAF2F17A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "U", "U\U.csproj", "{FE3D9812-2D75-4850-8AEA-CE88BAF2F17A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebTest", "WebTest\WebTest.csproj", "{EFCA7129-3069-4F92-A0BD-663D014B82AD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{97653DB2-605C-4582-AC6E-2A09D2E8EB44}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -96,6 +100,10 @@ Global {FE3D9812-2D75-4850-8AEA-CE88BAF2F17A}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE3D9812-2D75-4850-8AEA-CE88BAF2F17A}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE3D9812-2D75-4850-8AEA-CE88BAF2F17A}.Release|Any CPU.Build.0 = Release|Any CPU + {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EFCA7129-3069-4F92-A0BD-663D014B82AD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -115,6 +123,8 @@ Global {A4C4F802-D298-42DE-B410-50C8C87EFFAA} = {B4ED118A-2CFF-4E8F-B395-608E90C6D0C2} {D34B0974-D525-4BD1-90DE-B2CF5FE47AA4} = {878D0106-F55F-4813-9158-F2729D460F9C} {FE3D9812-2D75-4850-8AEA-CE88BAF2F17A} = {D34B0974-D525-4BD1-90DE-B2CF5FE47AA4} + {EFCA7129-3069-4F92-A0BD-663D014B82AD} = {97653DB2-605C-4582-AC6E-2A09D2E8EB44} + {97653DB2-605C-4582-AC6E-2A09D2E8EB44} = {878D0106-F55F-4813-9158-F2729D460F9C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0D069898-04B7-4D24-A6A4-D7C703B8BFFC} From 969ef3518a7ff9b1eda1456b7c39a507f95e34c6 Mon Sep 17 00:00:00 2001 From: shanji <18996038927@163.com> Date: Tue, 6 Jun 2023 16:56:04 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseOrder/PurchaseOrderBusiness.cs | 59 ++++++++++++------- .../AssocationOrderCostDetailRequest.cs | 7 --- .../Client/Impl/PP_1688Client.cs | 2 + .../Order/PP_QueryOrderDetailResponse.cs | 10 ++++ 4 files changed, 50 insertions(+), 28 deletions(-) diff --git a/BBWYB.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs b/BBWYB.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs index a641609..54c20be 100644 --- a/BBWYB.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs +++ b/BBWYB.Server.Business/PurchaseOrder/PurchaseOrderBusiness.cs @@ -492,24 +492,10 @@ namespace BBWYB.Server.Business throw new BusinessException("关联采购单时不能包含历史采购单"); #region 读取采购单中的采购账号/采购方案 - IList schemeIdList = new List(); IList purchaseAccountIdList = request.AssociationPurchaseOrderList.Select(x => string.IsNullOrEmpty(x.PurchaseAccountId) ? x.PurchaseAccountName : x.PurchaseAccountId).Distinct().ToList(); - IList purchaseSchemeSkuList = null; IList dbPurchaseAccountList = null; - foreach (var purchaseOrder in request.AssociationPurchaseOrderList) - { - foreach (var assOrderCostDetail in purchaseOrder.AssocationOrderCostDetailList) - { - if (assOrderCostDetail.PurchaseSchemeId != null) - schemeIdList.Add(assOrderCostDetail.PurchaseSchemeId.Value); - } - } - if (schemeIdList.Count() > 0) - { - purchaseSchemeSkuList = fsql.Select().Where(pss => schemeIdList.Contains(pss.SkuPurchaseSchemeId)).ToList(); - } if (purchaseAccountIdList.Count() > 0) { dbPurchaseAccountList = fsqlManager.MDSfsql.Select().Where(pa => purchaseAccountIdList.Contains(pa.Id) || @@ -543,13 +529,8 @@ namespace BBWYB.Server.Business var dbPurchaserOrder = dbPurchaseOrderList.FirstOrDefault(x => x.PurchaseOrderId == purchaseOrder.PurchaseOrderId); if (dbPurchaserOrder == null) { - if (dbPurchaserOrder.PurchasePlatform == Enums.Platform.阿里巴巴) + if (purchaseOrder.PurchasePlatform == Enums.Platform.阿里巴巴) { - #region 验证新采购单是否具备完整的采购方案 - if (purchaseOrder.AssocationOrderCostDetailList.Any(x => x.PurchaseSchemeId == null)) - throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId}缺少采购方案"); - #endregion - #region 补齐采购SKU var purchaseAccount = dbPurchaseAccountList.FirstOrDefault(pa => pa.Id == purchaseOrder.PurchaseAccountId || pa.AccountName == purchaseOrder.PurchaseAccountName); @@ -565,6 +546,42 @@ namespace BBWYB.Server.Business OrderId = purchaseOrder.PurchaseOrderId }); + #region 处理采购商Id + var purchaserId = purchaseOrderSimpleInfo.PurchaserId; + if (!string.IsNullOrEmpty(purchaserId)) + throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId}缺少采购商Id"); + purchaserId = purchaserId.Replace("b2b-", string.Empty); + var purchaserId2 = purchaserId.Substring(0, purchaserId.Length - 5); + var purchaserIds = new List() { purchaserId, purchaserId2 }; + var dbPurchaser = fsql.Select().Where(p => p.Platform == Enums.Platform.阿里巴巴 && purchaserIds.Contains(p.Id)).ToOne(); + if (dbPurchaser == null) + throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId}缺少有效采购商"); + purchaserId = dbPurchaser.Id; + #endregion + + #region 匹配采购方案 + var skuIds = purchaseOrder.AssocationOrderCostDetailList.Select(ocd => ocd.SkuId).ToList(); + var purchaseSchemeSkuList = fsql.Select() + .InnerJoin((p, ps, pss) => p.Id == ps.PurchaserId) + .InnerJoin((p, ps, pss) => ps.Id == pss.SkuPurchaseSchemeId) + .Where((p, ps, pss) => p.Id == purchaserId) + .Where((p, ps, pss) => ps.PurchasePlatform == Enums.Platform.阿里巴巴) + .Where((p, ps, pss) => skuIds.Contains(pss.SkuId)) + .ToList((p, ps, pss) => new + { + pss.Id, + pss.SkuId, + pss.ProductId, + pss.PurchaseProductId, + pss.PurchaseSkuId, + pss.PurchaseSkuSpecId, + pss.SkuPurchaseSchemeId + }); + if(purchaseSchemeSkuList.Count()==0) + throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId} 采购商Id{purchaserId} 未匹配到采购方案"); + #endregion + + foreach (var purchaseOrderSku in purchaseOrderSimpleInfo.ItemList) { var orderPurchaseSkuInfo = new OrderPurchaseSkuInfo() @@ -586,7 +603,7 @@ namespace BBWYB.Server.Business { var currentPurchaseSchemeSkuList = purchaseSchemeSkuList.Where(x => x.SkuId == assOrderCostDetail.SkuId).ToList(); if (currentPurchaseSchemeSkuList == null || currentPurchaseSchemeSkuList.Count() == 0) - throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId} Sku{assOrderCostDetail.SkuId}缺少采购方案"); + throw new BusinessException($"采购单{purchaseOrder.PurchaseOrderId} 采购商Id {purchaserId} Sku{assOrderCostDetail.SkuId}缺少采购方案"); var dbOrderSku = dbOrderSkuList.FirstOrDefault(osku => osku.SkuId == assOrderCostDetail.SkuId); foreach (var currentPurchaseSchemeSku in currentPurchaseSchemeSkuList) diff --git a/BBWYB.Server.Model/Dto/Request/PurchaseOrder/AssocationOrderCostDetailRequest.cs b/BBWYB.Server.Model/Dto/Request/PurchaseOrder/AssocationOrderCostDetailRequest.cs index 3b0ef13..bec6e2e 100644 --- a/BBWYB.Server.Model/Dto/Request/PurchaseOrder/AssocationOrderCostDetailRequest.cs +++ b/BBWYB.Server.Model/Dto/Request/PurchaseOrder/AssocationOrderCostDetailRequest.cs @@ -9,13 +9,6 @@ public string SkuId { get; set; } - /// - /// 采购方案Id - ///如果属于新增采购单, 则此参数必填 - ///如果采购单已存在,则此参数留空 - /// - public long? PurchaseSchemeId { get; set; } - /// /// 采购货款 /// diff --git a/SDKAdapter/PurchasePlatform/Client/Impl/PP_1688Client.cs b/SDKAdapter/PurchasePlatform/Client/Impl/PP_1688Client.cs index 6ab56fa..9897b46 100644 --- a/SDKAdapter/PurchasePlatform/Client/Impl/PP_1688Client.cs +++ b/SDKAdapter/PurchasePlatform/Client/Impl/PP_1688Client.cs @@ -236,6 +236,8 @@ namespace SDKAdapter.PurchasePlatform.Client FreightAmount = result["result"]["baseInfo"].Value("shippingFee"), ProductAmount = result["result"]["baseInfo"].Value("totalAmount") - result["result"]["baseInfo"].Value("shippingFee"), TotalAmount = result["result"]["baseInfo"].Value("totalAmount"), + PurchaserId = result["result"]["baseInfo"].Value("sellerID"), + PurchaserName = result["result"]["baseInfo"].Value("sellerLoginId"), ItemList = result["result"]["productItems"].Select(itemJToken => new PP_QueryOrderDetailSkuResponse() { ProductId = itemJToken.Value("productID"), diff --git a/SDKAdapter/PurchasePlatform/Models/Response/Order/PP_QueryOrderDetailResponse.cs b/SDKAdapter/PurchasePlatform/Models/Response/Order/PP_QueryOrderDetailResponse.cs index 471b663..055371c 100644 --- a/SDKAdapter/PurchasePlatform/Models/Response/Order/PP_QueryOrderDetailResponse.cs +++ b/SDKAdapter/PurchasePlatform/Models/Response/Order/PP_QueryOrderDetailResponse.cs @@ -22,6 +22,16 @@ /// public decimal FreightAmount { get; set; } + /// + /// 商家Id + /// + public string PurchaserId { get; set; } + + /// + /// 商家名称 + /// + public string PurchaserName { get; set; } + /// /// 订单Sku明细列表 ///