Browse Source

设置小程序版本号

lcl 4 tháng trước cách đây
mục cha
commit
af9d03188c

+ 9 - 9
AppStart/Helper/LeaderCompPrize2Helper.cs

@@ -53,18 +53,18 @@ namespace MySystem
 
         public void ListenTest()//启动
         {
-            string check = function.ReadInstance("/LeaderComp/Repeat/202502.txt");
+            string check = function.ReadInstance("/LeaderComp/Repeat/202505.txt");
             if (string.IsNullOrEmpty(check))
             {
-                function.WritePage("/LeaderComp/Repeat/", "202502.txt", DateTime.Now.ToString());
-                Ready("202502");
-            }
-            check = function.ReadInstance("/LeaderComp/Repeat/202503.txt");
-            if (string.IsNullOrEmpty(check))
-            {
-                function.WritePage("/LeaderComp/Repeat/", "202503.txt", DateTime.Now.ToString());
-                Ready("202503");
+                function.WritePage("/LeaderComp/Repeat/", "202505.txt", DateTime.Now.ToString());
+                Ready("202505");
             }
+            // check = function.ReadInstance("/LeaderComp/Repeat/202503.txt");
+            // if (string.IsNullOrEmpty(check))
+            // {
+            //     function.WritePage("/LeaderComp/Repeat/", "202503.txt", DateTime.Now.ToString());
+            //     Ready("202503");
+            // }
         }
 
         public void Ready(string curMonth)

+ 55 - 0
AppStart/Helper/MiniSetVersionService.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using Library;
+using LitJson;
+using System.Linq;
+using System.Data;
+using System.Threading;
+using MySystem.PxcModels;
+
+namespace MySystem
+{
+    public class MiniSetVersionService
+    {
+        public readonly static MiniSetVersionService Instance = new MiniSetVersionService();
+        private MiniSetVersionService()
+        { }
+
+
+        public void Start()
+        {
+            Thread th = new Thread(StartListen);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void StartListen()
+        {
+            while(true)
+            {
+                try
+                {
+                    string content = RedisDbconn.Instance.RPop<string>("MiniSetVersionQueue");
+                    if(!string.IsNullOrEmpty(content))
+                    {
+                        StartListenDo(content);
+                    }
+                    else
+                    {
+                        Thread.Sleep(10000);
+                    }
+                }
+                catch
+                {
+                    Thread.Sleep(600000);
+                }
+            }
+        }
+
+        public void StartListenDo(string Id)
+        {
+            string conn = Library.ConfigurationManager.AppSettings["MiniSqlConnStr"].ToString();
+            CustomerSqlConn.op("update ProjectVersion set VersionNo=VersionNo+1 where ProjectId=" + Id + " and UserId=1", conn);
+        }
+    }
+}

+ 1 - 0
Startup.cs

@@ -170,6 +170,7 @@ namespace MySystem
                 RecommandKing2Helper.Instance.Start(); //推荐王
                 // AddSourcePosSnHelper.Instance.Start(); //补来源机具
             // }
+            MiniSetVersionService.Instance.Start();
             
 
             // LeaderCompPrize2Helper.Instance.StartTest();