浏览代码

推送绑定数据逻辑变更

lcl 1 月之前
父节点
当前提交
e27b61a8be

+ 16 - 10
Controllers/HomeController.cs

@@ -213,16 +213,22 @@ namespace MySystem.Controllers
             //     }
             // }
             // db.Dispose();
-            DateTime start = DateTime.Parse("2025-01-01 00:00:00");
-            Models.KxsMain.WebCMSEntities db = new Models.KxsMain.WebCMSEntities();
-            List<Models.KxsMain.ChangeTypes> brands = db.ChangeTypes.ToList();
-            List<Models.KxsMain.UserAccountRecord> records = db.UserAccountRecord.Where(m => m.CreateDate >= start && m.ChangeType > 300).ToList();
-            foreach(Models.KxsMain.UserAccountRecord record in records)
-            {
-                string name = brands.FirstOrDefault(m => m.Id == record.ChangeType).Name;
-                PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), name, record.ChangeType.ToString(), record.ChangeAmount, record.UserId, "{\"brand_id\":101,\"user_id\":" + record.UserId + "}");
-            }
-            db.SaveChanges();
+            // DateTime start = DateTime.Parse("2025-01-01 00:00:00");
+            // Models.KxsMain.WebCMSEntities db = new Models.KxsMain.WebCMSEntities();
+            // List<Models.KxsMain.ChangeTypes> brands = db.ChangeTypes.ToList();
+            // List<Models.KxsMain.UserAccountRecord> records = db.UserAccountRecord.Where(m => m.CreateDate >= start && m.ChangeType > 300).ToList();
+            // foreach(Models.KxsMain.UserAccountRecord record in records)
+            // {
+            //     string name = brands.FirstOrDefault(m => m.Id == record.ChangeType).Name;
+            //     PrizePushHelper.Instance.Do(DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), name, record.ChangeType.ToString(), record.ChangeAmount, record.UserId, "{\"brand_id\":101,\"user_id\":" + record.UserId + "}");
+            // }
+            // db.SaveChanges();
+
+            WebCMSEntities db = new WebCMSEntities();
+            MerchantAddInfo add = db.MerchantAddInfo.FirstOrDefault(m => m.Id == 3335) ?? new MerchantAddInfo();
+            MerchantInfo mer = db.MerchantInfo.FirstOrDefault(m => m.Id == 3335) ?? new MerchantInfo();
+            PosPushDataNewHelper.Bind(add, mer);
+            db.Dispose();
             return "ok";
         }
 

+ 2 - 0
Util/HaoDa/CheckWeChatSignService.cs

@@ -90,6 +90,8 @@ namespace MySystem
                                 {
                                     merchantadd.StoreNo = mainMer.StoreNo;
                                 }
+
+                                PosPushDataNewHelper.Bind(merchantadd, merchant);
                             }
                             else
                             {

+ 4 - 0
Util/HaoDa/HaoDaExtQueryAuthHelper.cs

@@ -80,6 +80,8 @@ public class HaoDaExtQueryAuthHelper
                         RedisDbconn.Instance.AddList("GetTencentAddressInfoQueueHd", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
                     }
                     LogHelper.Instance.WriteLog("startsend", "获取微信商户开户意愿确认状态");
+
+                    PosPushDataNewHelper.Bind(info, merchant);
                 }
             }
             // else
@@ -163,6 +165,8 @@ public class HaoDaExtQueryAuthHelper
                         RedisDbconn.Instance.AddList("GetTencentAddressInfoQueueHd", "{\"MerChantId\":\"" + merchant.Id + "\",\"Address\":\"" + merchant.Areas + merchant.Address + "\"}");
                     }
                     LogHelper.Instance.WriteLog("start1end", "获取支付宝商家认证状态");
+
+                    PosPushDataNewHelper.Bind(info, merchant);
                 }
                 // else
                 // {

+ 32 - 24
Util/PosPushDataNewHelper.cs

@@ -13,26 +13,34 @@ namespace MySystem
         { }
 
         //绑定数据
-        // public static void Bind(MerchantAddInfo mer, PosMachinesTwo pos)
-        // {
-        //     try
-        //     {
-        //         Dictionary<string, object> dataContent = new Dictionary<string, object>();
-        //         dataContent.Add("pos_sn", pos.PosSn); //机具sn
-        //         dataContent.Add("mer_no", mer.MchtNo); //商户号
-        //         dataContent.Add("id_card", mer.IdCardNumber); //商户身份证
-        //         dataContent.Add("mer_name", mer.CertMerchantName); //商户姓名
-        //         dataContent.Add("mer_mobile", mer.MobilePhone); //商户手机号
-        //         dataContent.Add("request_id", getRequestId(mer.Id, "bind")); //流水号
-        //         dataContent.Add("bind_time", mer.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
-        //         dataContent.Add("brand", 101); //品牌
-        //         Push("bind", dataContent);
-        //     }
-        //     catch (Exception ex)
-        //     {
-        //         function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送绑定数据异常");
-        //     }
-        // }
+        public static void Bind(MerchantAddInfo mer, MerchantInfo m)
+        {
+            try
+            {
+                Dictionary<string, object> dataContent = new Dictionary<string, object>();
+                // dataContent.Add("pos_sn", pos.PosSn); //机具sn
+                dataContent.Add("mer_no", mer.MchtNo); //商户号
+                dataContent.Add("id_card", mer.IdCardNumber); //商户身份证
+                dataContent.Add("mer_name", mer.CertMerchantName); //商户姓名
+                dataContent.Add("mer_mobile", mer.MobilePhone); //商户手机号
+                dataContent.Add("request_id", getRequestId(mer.Id, "bind")); //流水号
+                dataContent.Add("bind_time", mer.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
+                if(mer.BrandId == 1)
+                {
+                    dataContent.Add("brand", 29); //品牌
+                }
+                else
+                {
+                    dataContent.Add("brand", 101); //品牌
+                }
+                dataContent.Add("user_id", m.UserId); //创客Id
+                Push("qr_bind", dataContent);
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送绑定数据异常");
+            }
+        }
 
         //交易数据
         public static void Trade(ConsumerOrders trade, MerchantAddInfo mer)
@@ -44,17 +52,17 @@ namespace MySystem
                 List<string> BrandIds = new List<string>();
                 decimal TradeAmount = trade.PayMoney;
                 Dictionary<string, object> dataContent = new Dictionary<string, object>();
-                dataContent.Add("pos_sn", trade.SnNo); //机具sn
+                // dataContent.Add("pos_sn", trade.SnNo); //机具sn
                 dataContent.Add("mer_no", mer.MchtNo); //商户号
                 dataContent.Add("request_id", trade.OrderNo); //流水号
                 dataContent.Add("trade_amount", TradeAmount); //交易金额
                 dataContent.Add("trade_time", trade.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
                 dataContent.Add("brand", 101); //品牌
-                dataContent.Add("card_type", BankCardType); //卡类型
-                dataContent.Add("qr_pay_flag", QrPayFlag); //云闪付标记
+                // dataContent.Add("card_type", BankCardType); //卡类型
+                // dataContent.Add("qr_pay_flag", QrPayFlag); //云闪付标记
                 dataContent.Add("fee_rate", trade.IsAct == 1 ? 0.6M : 0.63M);
                 dataContent.Add("fee_amt", trade.IsAct == 1 ? 0 : 3);
-                Push("trade", dataContent);
+                Push("lkb_trade", dataContent);
             }
             catch (Exception ex)
             {

+ 1 - 0
appsettings.Development.json

@@ -17,6 +17,7 @@
     "KxsSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;",
     "KxsUserSqlConnStr": "server=47.109.61.191;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=kxs_user;charset=utf8;",
     "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=5,poolsize=500,preheat=50,asyncPipeline=true",
+    "KxsRedisConnStr": "47.108.62.166:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "iL9dWgBunZRwGbHQ",