Parcourir la source

激活推送mq

lcl il y a 9 mois
Parent
commit
423fffbcdf
3 fichiers modifiés avec 40 ajouts et 0 suppressions
  1. 1 0
      Util/HaoDa/ActiveRewardService.cs
  2. 2 0
      Util/HaoDa/HaoDaExtQueryAuthHelper.cs
  3. 37 0
      Util/Utils.cs

+ 1 - 0
Util/HaoDa/ActiveRewardService.cs

@@ -53,6 +53,7 @@ namespace MySystem
                 {
                     edit.Status = 2;
                     db.SaveChanges();
+                    Utils.Instance.SendActData(db.MerchantInfo.FirstOrDefault(m => m.Id == edit.MerchantId) ?? new MerchantInfo(), 4);
                 }
             }
             db.Dispose();

+ 2 - 0
Util/HaoDa/HaoDaExtQueryAuthHelper.cs

@@ -69,6 +69,7 @@ public class HaoDaExtQueryAuthHelper
                     if(merchant.Status < 2 && merchant.QueryCount < 2)
                     {
                         RedisDbconn.Instance.AddList("MpMerchantActQueue", "{\"userId\":\"" + merchant.UserId + "\",\"statDate\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"statMonth\":\"" + DateTime.Now.ToString("yyyyMM") + "\"}");
+                        Utils.Instance.SendActData(merchant);
                     }
                     info.Status = 2;
                     merchant.Status = 2;
@@ -151,6 +152,7 @@ public class HaoDaExtQueryAuthHelper
                     if(merchant.Status < 2 && merchant.QueryCount < 2)
                     {
                         RedisDbconn.Instance.AddList("MpMerchantActQueue", "{\"userId\":\"" + merchant.UserId + "\",\"statDate\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"statMonth\":\"" + DateTime.Now.ToString("yyyyMM") + "\"}");
+                        Utils.Instance.SendActData(merchant);
                     }
                     info.QueryCount = 2;
                     merchant.QueryCount = 2;

+ 37 - 0
Util/Utils.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Library;
+using MySystem.Models.Main;
+
+namespace MySystem
+{
+    public class Utils
+    {
+        public readonly static Utils Instance = new Utils();
+        private Utils()
+        { }
+
+        #region 推送激活数据信息
+
+        public void SendActData(MerchantInfo pos, int actType = 3)
+        {
+            string data = "{";
+            data += "\"userId\":\"" + pos.UserId + "\",";
+            data += "\"brandId\":\"2\",";
+            data += "\"actTime\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\",";
+            data += "\"bindTime\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\",";
+            data += "\"sn\":\"\",";
+            data += "\"actType\":\"" + actType + "\"";
+            data += "}";
+            function.WriteLog(DateTime.Now.ToString() + "\n" + data, "订单推送MQ日志");
+            RedisDbconn.Instance.AddList("KxsOrderQueue", data);
+        }
+
+        #endregion 
+    
+    
+    
+    
+    }
+}