Преглед изворни кода

拉卡拉费率单独设置

lcl пре 4 месеци
родитељ
комит
4f2fd7bff8
3 измењених фајлова са 76 додато и 9 уклоњено
  1. 10 9
      AppStart/Helper/SetDepositPostService.cs
  2. 65 0
      AppStart/Helper/SetLklFeeService.cs
  3. 1 0
      Startup.cs

+ 10 - 9
AppStart/Helper/SetDepositPostService.cs

@@ -341,15 +341,16 @@ namespace MySystem
                             }
                             else if((BrandId == 30 || BrandId == 31) && op) //拉卡拉
                             {
-                                string content = PublicImportDataService.Instance.LkLSetFee(MerNo, Fee, addRate);
-                                JsonData obj = JsonMapper.ToObject(content);
-                                if (obj["message"].ToString() == "SUCCESS")
-                                {
-                                }
-                                else
-                                {
-                                    string msg = obj["message"].ToString();
-                                }
+                                RedisDbconn.Instance.AddList("SetLklFeeQueue", MerNo + "|" + Fee + "|" + addRate);
+                                // string content = PublicImportDataService.Instance.LkLSetFee(MerNo, Fee, addRate);
+                                // JsonData obj = JsonMapper.ToObject(content);
+                                // if (obj["message"].ToString() == "SUCCESS")
+                                // {
+                                // }
+                                // else
+                                // {
+                                //     string msg = obj["message"].ToString();
+                                // }
                             }
                             else if((BrandId == 38) && op) //国通星驿付
                             {

+ 65 - 0
AppStart/Helper/SetLklFeeService.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading;
+using MySystem.PxcModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    /// <summary>
+    /// 设置机具费率标记并推送消息
+    /// </summary>
+    public class SetLklFeeService
+    {
+        public readonly static SetLklFeeService Instance = new SetLklFeeService();
+        private SetLklFeeService()
+        { }
+
+        public void Start()
+        {
+            Thread th = new Thread(doSomething);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void doSomething()
+        {
+            while (true)
+            {
+                string content = RedisDbconn.Instance.RPop<string>("SetLklFeeQueue");
+                if (!string.IsNullOrEmpty(content))
+                {
+                    try
+                    {
+                        string[] arr = content.Split('|');
+                        string MerNo = arr[0];
+                        string Fee = arr[1];
+                        string addRate = arr[2];
+                        string back = PublicImportDataService.Instance.LkLSetFee(MerNo, decimal.Parse(Fee), int.Parse(addRate));
+                        JsonData obj = JsonMapper.ToObject(back);
+                        if (obj["message"].ToString() == "SUCCESS")
+                        {
+                        }
+                        else
+                        {
+                            string msg = obj["message"].ToString();
+                        }
+                        Thread.Sleep(1000);
+                    }
+                    catch (Exception ex)
+                    {
+                        Utils.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "单独设置拉卡拉费率异常");
+                        Thread.Sleep(60000);
+                    }
+                }
+                else
+                {
+                    Thread.Sleep(60000);
+                }
+            }
+        }
+    }
+}

+ 1 - 0
Startup.cs

@@ -151,6 +151,7 @@ namespace MySystem
                 SetDepositService.Instance.Start(); //调整费率(通知、标记)
                 SetDepositPostService.Instance.Start(); //提交支付公司设置费率接口
                 SetDepositPostService.Instance.StartKdb(); //监控开店宝费率设置结果
+                SetLklFeeService.Instance.Start(); //单独设置拉卡拉费率
                 ChangePosFeeQueue.Instance.StartEverTime(); //设置服务费
                 // SetSftFeeService.Instance.Start(); //盛付通420天费率加万2