Prechádzať zdrojové kódy

增加客小爽订单,来客吧激活推送

lcl 1 rok pred
rodič
commit
0d8836ce79

+ 47 - 0
AppStart/Service/KxsOrderService.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using Library;
+using System.Linq;
+using System.Threading;
+using RabbitMQ.Client;
+using System.Text;
+
+namespace MySystem
+{
+    public class KxsOrderService
+    {
+        public readonly static KxsOrderService Instance = new KxsOrderService();
+        private KxsOrderService()
+        { }
+
+        public void Start()
+        {
+            Thread th = new Thread(dosomething);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void dosomething()
+        {
+            while (true)
+            {
+                string content = MpRedisDbconn.Instance.RPop<string>("KxsOrderQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        RabbitMQClient.Instance.SendMsg2(content, "QUEUE_KXS_ORDER_DIVISION");
+                    }
+                    catch (Exception ex)
+                    {                        
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "客小爽订单推送异常");
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(500);
+                }
+            }
+        }
+    }
+}

+ 47 - 0
AppStart/Service/MpMerchantActService.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using Library;
+using System.Linq;
+using System.Threading;
+using RabbitMQ.Client;
+using System.Text;
+
+namespace MySystem
+{
+    public class MpMerchantActService
+    {
+        public readonly static MpMerchantActService Instance = new MpMerchantActService();
+        private MpMerchantActService()
+        { }
+
+        public void Start()
+        {
+            Thread th = new Thread(dosomething);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void dosomething()
+        {
+            while (true)
+            {
+                string content = MpRedisDbconn.Instance.RPop<string>("MpMerchantActQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        RabbitMQClient.Instance.SendMsg2(content, "QUEUE_LKB_ACT_DIVISION");
+                    }
+                    catch (Exception ex)
+                    {                        
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "商家激活异常");
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(500);
+                }
+            }
+        }
+    }
+}

+ 1 - 1
AppStart/Service/MpOrderService.cs

@@ -34,7 +34,7 @@ namespace MySystem
                     }
                     catch (Exception ex)
                     {                        
-                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "设置激活奖励异常");
+                        function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "来客吧订单推送异常");
                     }
                 }
                 else

+ 2 - 0
Startup.cs

@@ -137,6 +137,8 @@ namespace MySystem
             RabbitMQClient.Instance.StartReceive("QUEUE_GD_ACT_DIVISION");
             RabbitMQClient.Instance.CreateConn2("QUEUE_LKB_TRADE_DIVISION");
             MpOrderService.Instance.Start();
+            MpMerchantActService.Instance.Start();
+            KxsOrderService.Instance.Start();
         }
     }
 }