Răsfoiți Sursa

调整京东联盟转链规则;
增加京东联盟后台页面;

dodo hold 2 ani în urmă
părinte
comite
76387d899d

+ 4 - 17
molilian.api/Controllers/admin/JdUnionController.cs

@@ -107,29 +107,20 @@ namespace molilian.api.Controllers
             }
 
             using var conn = DBContext.GetOpenConnection();
-            var result = new DBContext.Table(conn, "tk_pool")
+            var result = new DBContext.Table(conn, "jd_pool")
                 .Where(filter, new { keyword, status, stime, etime })
                 .Page(size, page)
                 .Order(orderBy)
-                .PageList<TkPoolDTO>(getTotal);
+                .PageList<JdPoolDTO>(getTotal);
 
             foreach (var item in result.List)
             {
-                item.current_amt = Math.Round(TkPoolCore.GetIncomeAmt($"{item.id}"), 2);
+                item.app_secret = string.Empty;
                 item.cookies = string.Empty;
             }
             return new APIResult(new { data = result });
         }
 
-         
-        /*
-         {
-	"code": 420,
-	"message": "未登录",
-	"totalNum": 0
-}
-         */
-
         [HttpPost]
         public async Task<ActionResult> update([FromBody] JsonElement form)
         {
@@ -148,11 +139,8 @@ namespace molilian.api.Controllers
             int result;
             switch (name)
             {
-                case "enable_fake_click":
                 case "enable_parse":
                 case "enable_coupon":
-                case "enable_sync_order":
-                case "enable_promotionQuery":
                 case "status":
                     bool bVal = val.Equals("True");
                     result = new DBContext.Table("tk_pool")
@@ -167,8 +155,7 @@ namespace molilian.api.Controllers
             bool success = result > 0;
             if (success)
             {
-                //string desc = ObjectComparer.PrintCompareToString(old, form).Trim();
-                OperationLogCore.LogOperation(token.AccessKey, clientIp, $"tk_pool:{id}:{name}", string.Empty, val);
+                OperationLogCore.LogOperation(token.AccessKey, clientIp, $"jd_pool:{id}:{name}", string.Empty, val);
                 await EndPointCore.NotifyReload(true);
 
             }

+ 46 - 26
molilian.api/Controllers/public/TaskController.cs

@@ -247,13 +247,6 @@ namespace molilian.api.Controllers
         {
             try
             {
-
-                //第三方老的统计
-                JdUnionPlus.DailyLogs(intervalDay);
-                ToolParsePlus.DailyLogs(intervalDay);
-
-
-
                 //本节点统计
                 AlimamaPlus.NodeDailyLogs(intervalDay, "parse_", "tb");
                 AlimamaPlus.NodeDailyLogs(intervalDay, "coupon_", "tb");
@@ -261,6 +254,9 @@ namespace molilian.api.Controllers
 
                 if (CenterHub.IsCenter)
                 {
+                    JdUnionPlus.DailyLogs(intervalDay);
+                    ToolParsePlus.DailyLogs(intervalDay);
+
                     //中心服务器统计
                     AlimamaPlus.AllDailyLogs(intervalDay, "parse_", "tb");
                     AlimamaPlus.AllDailyLogs(intervalDay, "coupon_", "tb");
@@ -344,34 +340,58 @@ namespace molilian.api.Controllers
         [HttpGet]
         public async Task<ActionResult> FastReport()
         {
-            var list = TkPoolCore.List();
-            if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
             string message = string.Empty;
-            foreach (var account in list)
+            var list = TkPoolCore.List();
+            if (list != null)
             {
-                if (!account.enable_sync_order) continue;
-#if DEBUG
-                if (account.id != 5) continue;
-#endif
-                try
+                foreach (var account in list)
                 {
-                    var alimama = new AlimamaPlus(account);
-                    alimama.SaveReportOverview();
+                    if (!account.enable_sync_order) continue;
+                    try
+                    {
+                        var alimama = new AlimamaPlus(account);
+                        alimama.SaveReportOverview();
+                    }
+                    catch (Exception ex)
+                    {
+                        message = $"【报表接口异常】FastReport\n{ex.Message}\n{ex.StackTrace}";
+                        NotifyCore.Notify(new NifyMessage
+                        {
+                            message = message,
+                            priority = NifyMessagePriority.high,
+                            tags = ["red_circle"]
+                        });
+                        continue;
+                    }
                 }
-                catch (Exception ex)
+            }
+            var jd_list = new DBContext.Table("jd_pool").Where("", null).Select<JdPoolDTO>();
+            if (jd_list != null)
+            {
+                foreach (var account in jd_list)
                 {
-                    message = $"【报表接口异常】FastReport\n{ex.Message}\n{ex.StackTrace}";
-                    NotifyCore.Notify(new NifyMessage
+                    try
                     {
-                        message = message,
-                        priority = NifyMessagePriority.high,
-                        tags = ["red_circle"]
-                    });
-                    continue;
+                        account.current_daily_calls = JdPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMdd"));
+                        account.current_hourly_calls = JdPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMddHH"));
+                        JdPoolCore.Update(account);
+                    }
+                    catch (Exception ex)
+                    {
+                        message = $"【JD计数异常】SaveCalls\n{ex.Message}\n{ex.StackTrace}";
+                        NotifyCore.Notify(new NifyMessage
+                        {
+                            message = message,
+                            priority = NifyMessagePriority.high,
+                            tags = ["red_circle"]
+                        });
+                        continue;
+                    }
                 }
+                JdPoolCore.Refresh();
             }
-            await EndPointCore.NotifyReload(true);
 
+            await EndPointCore.NotifyReload(true);
             return new APIResult(new { success = true, message = "ok" });
         }
 

+ 17 - 0
molilian.api/Controllers/public/TkController.cs

@@ -86,6 +86,23 @@ namespace molilian.api.Controllers
             return await UnionParseCore.UnionParseAsync(content, channel, ip, oaid, accountid);
         }
 
+        [HttpGet]
+        public async Task<ActionResult> tesjd(int aid, int num = 100)
+        {
+            var channel = "jd";
+            string ip = "127.0.0.1";
+            string oaid = "test-oaid";
+
+            var list = new DBContext.Table("jd_parse_logs_success").Order("RAND()").Limit(num).Select<dynamic>();
+            foreach (var item in list)
+            {
+                await UnionParseCore.UnionParseAsync(item.rawContent, channel, ip, oaid, aid);
+            }
+            return new APIResult(new { success = true, message = "ok" });
+
+        }
+
+
         //[HttpGet]
         //public async Task<ActionResult> testParse()
         //{

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
molilian.api/Properties/PublishProfiles/https___ccr.ccs.tencentyun.com_shaobin.pubxml.user


+ 136 - 7
molilian.core/Core/taoke/JdPoolCore.cs

@@ -7,7 +7,8 @@ using System.Linq;
 using System.Text;
 using dodohold.core;
 using Dataoke;
-using static molilian.core.TkPoolCore;
+using Google.Protobuf.WellKnownTypes;
+using System.Xml.Linq;
 
 
 namespace molilian.core
@@ -23,6 +24,8 @@ namespace molilian.core
             promotionQuery
         }
         private static string _end_point;
+        private static Dictionary<string, decimal> _incomeAmt = new();
+        private static Dictionary<string, int> _calls = new();
         static JdPoolCore()
         {
             _end_point = Environment.GetEnvironmentVariable("EndPoint");
@@ -51,6 +54,114 @@ namespace molilian.core
             if (!list.Any()) return null;
             return list.Where(e => e.id == id).FirstOrDefault();
         }
+
+        //internal static void SaveIncomeAmt(int accountId, decimal income_amt)
+        //{
+        //    string key = $"{accountId}:{DateTime.Now:yyyyMMdd}";
+        //    if (_incomeAmt.ContainsKey(key))
+        //    {
+        //        _incomeAmt[key] = income_amt;
+        //    }
+        //    else
+        //    {
+        //        _incomeAmt.Add(key, income_amt);
+        //    }
+        //    string cache_key = $"cache:jd_pool:{key}:income_amt";
+
+        //    var result = EndPointCore.ProcessEndPointNodes<bool>(node =>
+        //    {
+        //        if (!node.is_public_api) return true;
+        //        if (string.IsNullOrEmpty(node.redis_server)) return true;
+
+        //        var redis = RedisClientManager.GetRedisClient(node.redis_server);
+        //        return redis.Set(cache_key, income_amt, 3 * 86400);
+        //    });
+        //}
+        //public static decimal GetIncomeAmt(int accountId)
+        //{
+        //    try
+        //    {
+        //        string key = $"{accountId}:{DateTime.Now:yyyyMMdd}";
+        //        if (_incomeAmt.ContainsKey(key)) return _incomeAmt[key];
+
+        //        string cache_key = $"cache:jd_pool:{key}:income_amt";
+        //        return RedisHelper.Get<decimal>(cache_key);
+        //    }
+        //    catch (Exception ex) { return 0; }
+        //}
+
+        internal static void CallsIncrBy(int accountId)
+        {
+            CallsIncrBy(accountId, DateTime.Now.ToString("yyyyMMdd"));
+            CallsIncrBy(accountId, DateTime.Now.ToString("yyyyMMddHH"));
+        }
+
+        internal static void CallsIncrBy(int accountId, string flag)
+        {
+            string key = $"{accountId}:{flag}";
+            if (_calls.ContainsKey(key))
+            {
+                _calls[key] = _calls[key] + 1;
+            }
+            else
+            {
+                _calls[key] = 1;
+            }
+            string cache_key = $"cache:jd_pool:{key}:calls:{flag}";
+            RedisHelper.IncrBy(cache_key);
+            RedisHelper.Expire(cache_key, 3 * 86400);
+        }
+
+        public static int SaveCalls(int accountId, string flag)
+        {
+            string key = $"{accountId}:{flag}";
+            var result = EndPointCore.ProcessEndPointNodes<int>(node =>
+            {
+                if (!node.is_public_api) return 0;
+                if (string.IsNullOrEmpty(node.redis_server)) return 0;
+
+
+#if DEBUG
+                switch (node.name)
+                {
+
+                    case "bj":
+                        node.redis_server = "101.200.46.46:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    case "gz":
+                        node.redis_server = "8.138.110.158:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    case "coupon1":
+                        node.redis_server = "c1api.molilian.com:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    default: return 0;
+                }
+#endif
+
+                string cache_key = $"cache:jd_pool:{key}:calls:{flag}";
+                var redis = RedisClientManager.GetRedisClient(node.redis_server);
+                return redis.Get<int>(cache_key);
+            });
+            int num = result.Sum();
+            _calls.TryAdd(key, num);
+            return num;
+        }
+
+        public static int GetCalls(int accountId, string flag)
+        {
+            try
+            {
+                string key = $"{accountId}:{flag}";
+                if (_calls.ContainsKey(key)) return _calls[key];
+
+                string cache_key = $"cache:jd_pool:{key}:calls:{flag}";
+                int num = RedisHelper.Get<int>(cache_key);
+                _calls.TryAdd(key, num);
+                return num;
+            }
+            catch (Exception ex) { return 0; }
+        }
+
         private static bool IsNotExceedDailyIncomeLimit(JdPoolDTO item, JdAction action)
         {
             if (!string.IsNullOrEmpty(_end_point) && !string.IsNullOrEmpty(item.end_point))
@@ -66,15 +177,21 @@ namespace molilian.core
                     if (!item.enable_coupon) return false;
                     break;
             }
-            return true;
+            //return true;
 
-            //if (item.daily_income_limit == 0) return true;
-            //decimal income_amt = GetIncomeAmt($"{item.id}");
-            //return income_amt < item.daily_income_limit;
+            if (item.daily_calls_limit > 0)
+            {
+                int daily_num = GetCalls(item.id, DateTime.Now.ToString("yyyyMMdd"));
+                if (daily_num >= item.daily_calls_limit) return false;
+            }
+            if (item.hourly_calls_limit > 0)
+            {
+                int hourly_num = GetCalls(item.id, DateTime.Now.ToString("yyyyMMddHH"));
+                if (hourly_num >= item.hourly_calls_limit) return false;
+            }
+            return true;
         }
 
-
-
         public static IEnumerable<JdPoolDTO> List(bool force = false)
         {
             if (!force && _cached != null) return _cached;
@@ -101,6 +218,17 @@ namespace molilian.core
         }
 
 
+        public static int Update(JdPoolDTO account)
+        {
+            return new DBContext.Table("jd_pool")
+                .Add("current_hourly_calls", account.current_hourly_calls)
+                .Add("current_daily_calls", account.current_daily_calls)
+                .Where("id=@id", new { account.id })
+                .Update();
+        }
+
+
+
         public static int UpdateCookies(string cookies, string user_agent)
         {
             if (string.IsNullOrEmpty(cookies)) return 0;
@@ -188,6 +316,7 @@ namespace molilian.core
 
 
 
+
         internal static void AccountExhausted()
         {
             string cache_key = $"cache:tk_pool:account:exhausted";

+ 59 - 35
molilian.core/Core/taoke/TkLogCore.cs

@@ -162,28 +162,25 @@ namespace molilian.core
                 {
                     var data = redis.LPop<TkDataDTO>(queue_tb_key);
                     if (data == null) break;
+
                     if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
-                         data.ip.Contains("127.0.0") || data.elapsedTime > 1000)
+                         data.ip.Contains("127.0.0"))
                     {
                         save_tk_log(data, "tk_logs_test", connection, transaction);
                     }
                     else
                     {
                         data.id = save_tk_log(data, "tk_logs", connection, transaction);
+                        if (data.elapsedTime > 1000)
+                        {
+                            save_tk_log(data, "tk_logs_test", connection, transaction);
+                        }
                         if (data.success)
                         {
                             save_tk_log(data, "tk_success_logs", connection, transaction);
                         }
-                        //if (data.success || data.message.Contains("该链接不支持转化,请更换链接尝试"))
-                        //{
-                        //    if (start_comparison_tk)
-                        //    {
-                        //        save_tk_log(data, "comparison_tk_logs", connection, transaction);
-                        //    }
-                        //}
                         if (!string.IsNullOrEmpty(data.itemId)) TkOrderTrackingCore.SaveLinkSummary(data);
                     }
-
                     total++;
                 }
 
@@ -216,27 +213,18 @@ namespace molilian.core
                     var data = redis.LPop<TkDataDTO>(queue_parse_tb_key);
                     if (data == null) break;
 
-                    //switch (data.oaid)
-                    //{
-                    //    case "test-comparison_tk_logs":
-                    //        save_tk_parse_logs(data, "comparison_tk_parse_logs", connection, transaction);
-                    //        break;
-                    //    case "test-comparison_tk_logs_raw":
-                    //        save_tk_parse_logs(data, "comparison_tk_parse_logs_raw", connection, transaction);
-                    //        break;
-                    //    default:
-                    //        break;
-                    //}
-
                     if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
-                          data.ip.Contains("127.0.0") || data.elapsedTime > 1000)
+                         data.ip.Contains("127.0.0"))
                     {
                         save_tk_parse_logs(data, "tk_parse_logs_test", connection, transaction);
-
                     }
                     else
                     {
                         data.id = save_tk_parse_logs(data, "tk_parse_logs", connection, transaction);
+                        if (data.elapsedTime > 1000)
+                        {
+                            save_tk_parse_logs(data, "tk_parse_logs_test", connection, transaction);
+                        }
                         if (data.success)
                         {
                             save_tk_parse_logs(data, "tk_success_parse_logs", connection, transaction);
@@ -266,15 +254,19 @@ namespace molilian.core
                     var data = redis.LPop<JdDataDTO>(queue_parse_jd_key);
                     if (data == null) break;
 
-                    save_jd_parse_logs(data, "jd_parse_logs", connection, transaction);
 
                     if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
-                       data.ip.Contains("127.0.0") || data.elapsedTime > 1000)
+                         data.ip.Contains("127.0.0"))
                     {
                         save_jd_parse_logs(data, "jd_parse_logs_test", connection, transaction);
                     }
                     else
                     {
+                        save_jd_parse_logs(data, "jd_parse_logs", connection, transaction);
+                        if (data.elapsedTime > 1000)
+                        {
+                            save_jd_parse_logs(data, "jd_parse_logs_test", connection, transaction);
+                        }
                         if (data.success)
                         {
                             save_jd_parse_logs(data, "jd_parse_logs_success", connection, transaction);
@@ -340,16 +332,16 @@ namespace molilian.core
                 {
                     var data = redis.LPop<UnionCouponDTO>(queue_coupon_key);
                     if (data == null) break;
-                    connection.Insert(data);
 
                     if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
-                        data.ip.Contains("127.0.0") || data.elapsedTime > 1000)
+                      data.ip.Contains("127.0.0"))
                     {
                         var test_data = data.Convert2Json().Convert2Object<TestUnionCouponDTO>();
                         connection.Insert(test_data);
                     }
                     else
                     {
+                        connection.Insert(data);
                         if (data.success)
                         {
                             var success_data = data.Convert2Json().Convert2Object<SuccessUnionCouponDTO>();
@@ -412,7 +404,11 @@ namespace molilian.core
                 var ts = DateTime.Now - response.create_time;
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_jd_key, response);
-                saveCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+                }
             }
             catch (Exception ex) { }
         }
@@ -424,7 +420,11 @@ namespace molilian.core
                 var ts = DateTime.Now - response.create_time;
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_tb_key, response);
-                saveCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+                }
 
                 if (!response.success && "nologin".Equals(response.message))
                 {
@@ -470,12 +470,16 @@ namespace molilian.core
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_parse_tb_key, response);
 
+
                 if (response.success)
                 {
                     _ = saveUnionCouponParseCacheAsync(response);
                 }
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+                }
 
-                saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
                 if (!string.IsNullOrEmpty(response.itemId)) TkOrderTrackingCore.SaveLinkSummary(response);
 
                 if (!response.success && "nologin".Equals(response.message))
@@ -512,8 +516,10 @@ namespace molilian.core
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_coupon_key, response);
 
-                saveCouponCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
-
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveCouponCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+                }
                 if (!response.success && "nologin".Equals(response.message))
                 {
                     switch (response.channel)
@@ -547,7 +553,17 @@ namespace molilian.core
                 var ts = DateTime.Now - response.create_time;
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_parse_jd_key, response);
-                saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+                }
+
+                if (response.success || response.message.Equals("转链失败"))
+                {
+                    JdPoolCore.CallsIncrBy(response.accountId);
+                }
+                //CallsIncrBy
 
                 if (response.success) saveClientRequestTotal(response.channel, response.ip, response.oaid);
 
@@ -587,7 +603,11 @@ namespace molilian.core
                 var ts = DateTime.Now - response.create_time;
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_parse_dy_key, response);
-                saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveParseCache(response.channel.ToString(), response.accountId, response.accountName, response.success, response.message, response.reason);
+                }
 
             }
             catch (Exception ex) { }
@@ -599,7 +619,11 @@ namespace molilian.core
                 var ts = DateTime.Now - response.create_time;
                 response.elapsedTime = (int)ts.TotalMilliseconds;
                 _ = RedisHelper.RPushAsync(queue_parse_tool_key, response);
-                saveParseCache(response.channel.ToString(), 0, "tool", response.success, response.message, response.reason);
+
+                if (!response.ip.Contains("127.0.0"))
+                {
+                    saveParseCache(response.channel.ToString(), 0, "tool", response.success, response.message, response.reason);
+                }
             }
             catch (Exception ex) { }
         }

+ 13 - 13
molilian.core/Core/taoke/UnionParseCore.cs

@@ -453,6 +453,7 @@ namespace molilian.core
             {
                 var config = TkConfigCore.Get();
 
+                //============================== 放弃转链-地区过滤 ==============================
                 if (accountid == 0 && JdUnionPlus.ShouldIgnoreRequest(config, ip, oaid, out string reason))
                 {
                     result.success = false;
@@ -462,19 +463,18 @@ namespace molilian.core
                     return JdParseOutput(result);
                 }
 
-                //============================== 放弃转链-地区过滤 ==============================
-                bool is_ignore2 = JdUnionPlus.FlowControlIgnoreRequest(config, out reason);
-#if DEBUG
-                is_ignore2 = false;
-#endif
-                if (accountid == 0 && is_ignore2)
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = reason;
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return JdParseOutput(result);
-                }
+//                bool is_ignore2 = JdUnionPlus.FlowControlIgnoreRequest(config, out reason);
+//#if DEBUG
+//                is_ignore2 = false;
+//#endif
+//                if (accountid == 0 && is_ignore2)
+//                {
+//                    result.success = false;
+//                    result.message = "放弃转链";
+//                    result.reason = reason;
+//                    _ = TkLogCore.ParseLogAsync(result);
+//                    return JdParseOutput(result);
+//                }
 
                 var account = accountid > 0 ? JdPoolCore.GetOne(accountid) : JdPoolCore.GetOne(JdPoolCore.JdAction.parse);
                 if (account == null)

+ 4 - 0
molilian.core/DTO/jd/JdPoolDTO.cs

@@ -30,7 +30,11 @@
         public string nodeName { get; set; } = string.Empty;
         public string end_point { get; set; } = string.Empty;
         public decimal current_amt { get; set; } = 0;
+        public decimal current_daily_calls { get; set; } = 0;
+        public decimal current_hourly_calls { get; set; } = 0;
         public decimal daily_income_limit { get; set; } = 0;
+        public int daily_calls_limit { get; set; } = 0;
+        public int hourly_calls_limit { get; set; } = 0;
         public decimal draw_balance { get; set; } = 0;
         public bool enable_parse { get; set; } = false;
         public bool enable_coupon { get; set; } = false;

+ 7 - 4
molilian.core/Plus/JDUnion/JdDailyLogs.cs

@@ -31,6 +31,9 @@ namespace molilian.core
             DateTime log_date = DateTime.Now.AddDays(-intervalDay).Date;
 
             var accounts = JdPoolCore.List();
+            using var conn = CenterHub.GetOpenConnection();
+
+
             foreach (var account in accounts)
             {
                 int accountId = account.id;
@@ -53,13 +56,13 @@ namespace molilian.core
                     abandon_percentage = $"{abandon_count / (double)total_count * 100:f2}%";
                 }
 
-                var exist = new DBContext.Table("daily_logs")
+                var exist = new DBContext.Table(conn, "center_daily_logs")
                 .Fields("id,log_date")
                      .Get<dynamic>("log_date=@log_date AND channel=@channel AND accountId=@accountId",
                      new { log_date, channel = (int)channelEnum, accountId });
 
 
-                var createArgs = new DBContext.Table("daily_logs")
+                var createArgs = new DBContext.Table(conn, "center_daily_logs")
                     .Add($"jd_parse_total_count", total_count)
                     .Add($"jd_parse_abandon_count", abandon_count)
                     .Add($"jd_parse_abandon_percentage", abandon_percentage)
@@ -93,12 +96,12 @@ namespace molilian.core
                 all_success_percentage = $"{all_success_count / (double)all_total_count * 100:f2}%";
                 all_abandon_percentage = $"{all_abandon_count / (double)all_total_count * 100:f2}%";
             }
-            var exist2 = new DBContext.Table("daily_logs")
+            var exist2 = new DBContext.Table(conn, "center_daily_logs")
             .Fields("id,log_date")
                  .Get<dynamic>("log_date=@log_date AND accountId=@accountId",
                  new { log_date, accountId = 0 });
 
-            var createArgs2 = new DBContext.Table("daily_logs")
+            var createArgs2 = new DBContext.Table(conn, "center_daily_logs")
                 .Add($"jd_parse_total_count", all_total_count)
                 .Add($"jd_parse_abandon_count", all_abandon_count)
                 .Add($"jd_parse_abandon_percentage", all_abandon_percentage)

+ 19 - 2
molilian.core/Plus/JDUnion/JdUnionPlus.cs

@@ -244,14 +244,18 @@ namespace molilian.core
                 result.message = "放弃转链";
                 result.reason = "其他推广链接";
                 result.accountName = string.Empty;
+                result.accountId = 0;
                 result.content = content;
                 result.shortLinkurl = url;
                 result.deeplink_url = GetDeeplink(url);
                 return result;
             }
 
-            if ((!url.StartsWith("https://item.jd.com/") &&
-                !url.StartsWith("https://item.m.jd.com/product/")) || string.IsNullOrEmpty(result.itemId))
+            if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(result.itemId) ||
+                (!url.StartsWith("https://item.jd.com/") &&
+                !url.StartsWith("https://item.m.jd.com/product/") &&
+                !url.StartsWith("http://item.m.jd.com/product/") &&
+                !url.StartsWith("http://item.m.jd.com/product/")))
             {
                 result.success = false;
                 result.link_type = LinkTypeEnum.unknown;
@@ -265,6 +269,19 @@ namespace molilian.core
                 return result;
             }
 
+            if (FlowControlIgnoreRequest(_config, out string reason))
+            {
+                result.success = false;
+                result.link_type = LinkTypeEnum.unknown;
+                result.channel_type = ChannelTypeEnum.jd;
+                result.message = "放弃转链";
+                result.reason = reason;
+                result.accountName = string.Empty;
+                result.content = content;
+                result.shortLinkurl = url;
+                result.deeplink_url = GetDeeplink(url);
+                return result;
+            }
 
             switch (_account.work_mode)
             {

+ 4 - 2
molilian.core/Plus/Tool/ToolDailyLogs.cs

@@ -49,12 +49,14 @@ namespace molilian.core
                 all_abandon_percentage = $"{all_abandon_count / (double)all_total_count * 100:f2}%";
             }
 
-            var exist = new DBContext.Table("daily_logs")
+
+            using var conn = CenterHub.GetOpenConnection();
+            var exist = new DBContext.Table(conn, "center_daily_logs")
             .Fields("id,log_date")
                  .Get<dynamic>("log_date=@log_date AND accountId=@accountId",
                  new { log_date, accountId = 0 });
 
-            var createArgs2 = new DBContext.Table("daily_logs")
+            var createArgs2 = new DBContext.Table(conn, "center_daily_logs")
                 .Add($"tool_total_count", all_total_count)
                 .Add($"tool_abandon_count", all_abandon_count)
                 .Add($"tool_abandon_percentage", all_abandon_percentage)

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff