Browse Source

轻会员-联调部分开发和配置

lvle 1 year ago
parent
commit
d95959f252

File diff suppressed because it is too large
+ 830 - 823
PDF Office/App.xaml.cs


+ 2 - 2
PDF Office/Helper/ConverterHelper.cs

@@ -623,11 +623,11 @@ namespace PDF_Master.Helper
         {
             if (Settings.Default.AppProperties.culture == "zh-CN")
             {
-                Process.Start(new ProcessStartInfo("https://www.pdfreaderpro.com/zh-cn/windows/store"));
+                Process.Start(new ProcessStartInfo("http://test-pdf-pro.kdan.cn:3021/windows/store/master-subscription?email=" + Settings.Default.UserDate.Email));
             }
             else
             {
-                Process.Start(new ProcessStartInfo("https://www.pdfreaderpro.com/windows/store"));
+                Process.Start(new ProcessStartInfo("http://test-pdf-pro.kdan.cn:3021/windows/store/master-subscriptionr?email=" + Settings.Default.UserDate.Email));
             }
         }
 

+ 45 - 21
PDF Office/Helper/ServiceHelper.cs

@@ -1244,46 +1244,70 @@ namespace PDF_Master.Helper
 
         }
         //监听订阅行为
-        public static void ListenerSubscription()
+        public static async Task ListenerSubscriptionAsync()
         {
             string url = "http://127.0.0.1:5544/"; // 监听的URL地址
 
             using (HttpListener listener = new HttpListener())
             {
-                listener.Prefixes.Add(url); // 添加要监听的前缀
 
+                listener.Prefixes.Add(url); // 添加要监听的前缀
                 listener.Start(); // 启动监听
-
                 Console.WriteLine("Listening for GET requests on {0}", url);
-
+                bool isProcessingRequest = false;
                 while (true)
                 {
-                    HttpListenerContext context = listener.GetContext();
-
-                    // 处理GET请求
-                    if (context.Request.HttpMethod == "GET")
+                    try
                     {
-                        // 获取请求的路径和查询参数
-                        string path = context.Request.Url.AbsolutePath;
-                        string query = context.Request.Url.Query;
+                        HttpListenerContext context = await listener.GetContextAsync();
 
-                        // 构建响应内容
-                        string responseText = $"Received GET request on {path}{query}";
+                        // 如果已经在处理请求,则忽略新的请求
+                        if (isProcessingRequest)
+                        {
+                            context.Response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
+                            context.Response.Close();
+                            continue;
+                        }
 
-                        byte[] responseBytes = System.Text.Encoding.UTF8.GetBytes(responseText);
-                        context.Response.ContentLength64 = responseBytes.Length;
+                        // 设置标志变量为 true,表示正在处理请求
+                        isProcessingRequest = true;
 
-                        // 发送响应
-                        context.Response.OutputStream.Write(responseBytes, 0, responseBytes.Length);
-                    }
+                        // 处理GET请求
+                        if (context.Request.HttpMethod == "GET")
+                        {
+                            // 获取请求的路径和查询参数
+                            string path = context.Request.Url.AbsolutePath;
+                            string query = context.Request.Url.Query;
+
+                            // 构建响应内容
+                            string responseText = $"Received GET request on {path}{query}";
 
-                    // 关闭响应
-                    context.Response.Close();
+                            byte[] responseBytes = System.Text.Encoding.UTF8.GetBytes(responseText);
+                            context.Response.ContentLength64 = responseBytes.Length;
+
+                            // 发送响应
+                            await context.Response.OutputStream.WriteAsync(responseBytes, 0, responseBytes.Length);
+                        }
+
+                        // 关闭响应
+                        context.Response.Close();
+
+                        // 将标志变量重置为 false,表示已完成请求处理
+                        isProcessingRequest = false;
+                    }
+                    catch (Exception ex)
+                    {
+                        // 处理异常
+                        Console.WriteLine("Error occurred: {0}", ex.Message);
+                        // 在此处可以添加适当的异常处理逻辑
+                    }
                 }
+
             }
         }
+        }
 
 
-    }
+    
 }
 

+ 3 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/RegisterOKRegionViewModel.cs

@@ -1,5 +1,6 @@
 using PDF_Master.Helper;
 using PDF_Master.Model;
+using PDF_Master.Properties;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
@@ -125,7 +126,8 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
         private void Linkstore()
         {
 
-            Process.Start(new ProcessStartInfo("https://www.pdfreaderpro.com/windows/store/permanent"));
+            Process.Start(new ProcessStartInfo("http://test-pdf-pro.kdan.cn:3021/windows/store/master?email=" + Settings.Default.UserDate.Email));
+
         }
 
         public void Close()

+ 1 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/SubscriptionDialogViewModel.cs

@@ -168,7 +168,7 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
 
 
 
-        private string _uristore = "https://www.pdfreaderpro.com/windows/store/permanent";
+        private string _uristore = "http://test-pdf-pro.kdan.cn:3021/windows/store/master?email=" + Settings.Default.UserDate.Email;
         public string Uristore
         {
             get { return _uristore; }

+ 1 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/UserDialogViewModel.cs

@@ -305,7 +305,7 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
             get { return _Subscriptionauto; }
             set { _Subscriptionauto = value; }
         }
-        private string _uristore = "https://www.pdfreaderpro.com/windows/store/permanent";
+        private string _uristore = "http://test-pdf-pro.kdan.cn:3021/windows/account/master-subscription?appid=16&productId=22&token=" + Settings.Default.AppProperties.LoginToken;
         public string Uristore
         {
             get { return _uristore; }

+ 1 - 1
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -419,7 +419,7 @@ namespace PDF_Master.ViewModels
         private void Upgradelink()
         {
             DataTrackingHelper.SendEvent(DataTrackingHelper.EventType.Tbr, "Tbr_Btn", "Btn_Tbr_Upgrade");
-            Process.Start(new ProcessStartInfo("http://test-pdf-pro.kdan.cn:3021/master/checkout?email="+Settings.Default.UserDate.Email));
+            Process.Start(new ProcessStartInfo("http://test-pdf-pro.kdan.cn:3021/windows/store/master?email=" + Settings.Default.UserDate.Email));
         }
         //显示新手引导弹窗
         private bool ShowGuidDialog()

+ 12 - 0
PDF Office/Views/MainWindow.xaml.cs

@@ -121,6 +121,18 @@ namespace PDF_Master.Views
                         WindowState = WindowState.Normal;
                     }
                     Activate();
+                if (App.IswithparametersOpen == true)
+                    {
+                        if (App.IsLogin == true)
+                        {
+                            App.mainWindowViewModel.OpenUser();
+                        }
+                        else
+                        {
+                            App.mainWindowViewModel.OpenLogin();
+                            App.IswithparametersOpen = false;
+                        }
+                    }
                     handled = true;
                 }
                 catch