From 81e3724d2a4ddf7a2218562b9a43922c3533378b Mon Sep 17 00:00:00 2001
From: shanj <18996038927@163.com>
Date: Fri, 22 Sep 2023 15:53:40 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=9E=E4=BD=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Db/Product/Skuoptimizationhistory.cs | 39 ++++++++++
.../Db/Product/Skutotalsaleinfo.cs | 74 +++++++++++++++++++
WebTest/WebTest.csproj | 2 +-
WebTest/WebView2Manager.cs | 21 +++++-
4 files changed, 134 insertions(+), 2 deletions(-)
create mode 100644 BBWYB.Server.Model/Db/Product/Skuoptimizationhistory.cs
create mode 100644 BBWYB.Server.Model/Db/Product/Skutotalsaleinfo.cs
diff --git a/BBWYB.Server.Model/Db/Product/Skuoptimizationhistory.cs b/BBWYB.Server.Model/Db/Product/Skuoptimizationhistory.cs
new file mode 100644
index 0000000..dd3bf12
--- /dev/null
+++ b/BBWYB.Server.Model/Db/Product/Skuoptimizationhistory.cs
@@ -0,0 +1,39 @@
+using FreeSql.DataAnnotations;
+
+namespace BBWYB.Server.Model.Db
+{
+
+ ///
+ /// Sku历史优化表
+ ///
+ [Table(Name = "skuoptimizationhistory", DisableSyncStructure = true)]
+ public partial class SkuOptimizationHistory
+ {
+
+ [Column(DbType = "bigint", IsPrimary = true)]
+ public long Id { get; set; }
+
+ ///
+ /// 优化时间
+ ///
+ [Column(DbType = "datetime")]
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 优化率
+ ///
+ [Column(DbType = "decimal(18,2)")]
+ public decimal? OptimizationRatio { get; set; }
+
+ [Column(StringLength = 50)]
+ public string ProductId { get; set; }
+
+ [Column(DbType = "bigint")]
+ public long? ShopId { get; set; }
+
+ [Column(StringLength = 50)]
+ public string SkuId { get; set; }
+
+ }
+
+}
diff --git a/BBWYB.Server.Model/Db/Product/Skutotalsaleinfo.cs b/BBWYB.Server.Model/Db/Product/Skutotalsaleinfo.cs
new file mode 100644
index 0000000..09f8db9
--- /dev/null
+++ b/BBWYB.Server.Model/Db/Product/Skutotalsaleinfo.cs
@@ -0,0 +1,74 @@
+using FreeSql.DatabaseModel;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using FreeSql.DataAnnotations;
+
+namespace BBWYB.Server.Model.Db
+{
+
+ ///
+ /// Sku总销量表
+ ///
+ [Table(Name = "skutotalsaleinfo", DisableSyncStructure = true)]
+ public partial class SkuTotalSaleInfo
+ {
+
+ ///
+ /// Sku
+ ///
+ [Column(StringLength = 50, IsPrimary = true, IsNullable = false)]
+ public string SkuId { get; set; }
+
+ [Column(DbType = "datetime")]
+ public DateTime? CreateTime { get; set; }
+
+ ///
+ /// 是否有效
+ ///
+
+ public bool? IsEnabled { get; set; } = false;
+
+ ///
+ /// 是否需要议价
+ ///
+
+ public bool? IsNeedOptimization { get; set; } = false;
+
+ ///
+ /// 销量,销售件数
+ ///
+ [Column(DbType = "bigint")]
+ public long? ItemCount { get; set; }
+
+ ///
+ /// 上次优化时的销量
+ ///
+ [Column(DbType = "bigint")]
+ public long? LastOptimizationItemCount { get; set; }
+
+ ///
+ /// 上次优化时间
+ ///
+ [Column(DbType = "datetime")]
+ public DateTime? LastOptimizationTime { get; set; }
+
+ ///
+ /// Spu
+ ///
+ [Column(StringLength = 50)]
+ public string ProductId { get; set; }
+
+ [Column(DbType = "bigint")]
+ public long? ShopId { get; set; }
+
+ [Column(DbType = "datetime")]
+ public DateTime? UpdateTime { get; set; }
+
+ }
+
+}
diff --git a/WebTest/WebTest.csproj b/WebTest/WebTest.csproj
index 8d4029b..f9e32d0 100644
--- a/WebTest/WebTest.csproj
+++ b/WebTest/WebTest.csproj
@@ -1,7 +1,7 @@
- WinExe
+ Exe
net6.0-windows
enable
true
diff --git a/WebTest/WebView2Manager.cs b/WebTest/WebView2Manager.cs
index 5c75417..2569d68 100644
--- a/WebTest/WebView2Manager.cs
+++ b/WebTest/WebView2Manager.cs
@@ -46,9 +46,28 @@ namespace WebTest
OnNavigationCompleted?.Invoke(e);
}
- private void Wb2_CoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e)
+ private async void Wb2_CoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e)
{
+ wb2.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All);
wb2.CoreWebView2.WebResourceRequested += CoreWebView2_WebResourceRequested;
+
+ //Mozilla/5.0 (Linux; Android 11; M2006J10C Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36 T7/13.8 SP-engine/2.46.0 baiduboxapp/13.8.1.10 (Baidu; P1 11) NABar/1.0 Edg/117.0.0.0
+ //Mozilla/5.0 (Linux; Android 12; PEDM00 Build/SKQ1.210216.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36 T7/12.29 SP-engine/2.38.0 other/12.29.5.10 (Baidu; P1 12) NABar/1.0
+ var platform = "Android";
+ var userAgent = "Mozilla/5.0 (Linux; Android 12; PEDM00 Build/SKQ1.210216.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36 T7/12.29 SP-engine/2.38.0 other/12.29.5.10 (Baidu; P1 12) NABar/1.0";
+
+ await wb2.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(
+ "(() => {" +
+ $"const platform = \"{platform}\";" +
+ $"const userAgent = \"{userAgent}\";" +
+ "if (platform || userAgent) {" +
+ "const navigator = window.navigator;" +
+ "if (platform) Object.defineProperty(navigator, \"platform\", { value: platform, configurable: false, enumerable: true, writable: false });" +
+ "if (userAgent) Object.defineProperty(navigator, \"userAgent\", { value: userAgent, configurable: false, enumerable: true, writable: false });" +
+ "}" +
+ "})();");
+
+
CoreWebView2InitializationCompleted?.Invoke(e);
IsInitializationCompleted = true;
}