Bladeren bron

增加dp参数

dodo hold 1 jaar geleden
bovenliggende
commit
1f7ef15442
33 gewijzigde bestanden met toevoegingen van 285 en 246 verwijderingen
  1. 2 0
      molilian.api/Controllers/admin/DataReportController.cs
  2. 6 1
      molilian.api/Controllers/admin/JdUnionController.cs
  3. 79 37
      molilian.api/Controllers/public/TaskController.cs
  4. 6 3
      molilian.api/Controllers/public/TkController.cs
  5. 0 0
      molilian.api/Properties/PublishProfiles/latest.pubxml.user
  6. 8 0
      molilian.core/Core/PushDataReport/PushDataReportDTO.cs
  7. 1 1
      molilian.core/Core/cps/UnionCpsCore.cs
  8. 18 7
      molilian.core/Core/jd/JdPoolCore.cs
  9. 2 2
      molilian.core/Core/log/deeplink.cs
  10. 13 1
      molilian.core/Core/log/jd.cs
  11. 9 4
      molilian.core/Core/log/pdd.cs
  12. 2 1
      molilian.core/Core/log/promotion.cs
  13. 22 81
      molilian.core/Core/log/taobao.cs
  14. 2 75
      molilian.core/Core/log/tool.cs
  15. 13 1
      molilian.core/Core/pdd/PddPoolCore.cs
  16. 13 10
      molilian.core/Core/taoke/TkPoolCore.cs
  17. 66 1
      molilian.core/Core/taoke/UnionParseCore.cs
  18. 1 1
      molilian.core/Core/tool/DeeplinkParseCore.cs
  19. 6 9
      molilian.core/Core/tool/TestParseCore.cs
  20. 1 0
      molilian.core/DTO/alimama/TkDataDTO.cs
  21. 1 0
      molilian.core/DTO/alimama/TkPoolDTO.cs
  22. 1 0
      molilian.core/DTO/jd/JdDataDTO.cs
  23. 2 0
      molilian.core/DTO/jd/JdPoolDTO.cs
  24. 1 0
      molilian.core/DTO/pdd/PddDataDTO.cs
  25. 1 0
      molilian.core/DTO/pdd/PddPoolDTO.cs
  26. 1 4
      molilian.core/Plus/Alimama/parse.cs
  27. 1 0
      molilian.core/Plus/Alimama/parse_2.cs
  28. 1 1
      molilian.core/Plus/JDUnion/EstimateComm.cs
  29. 1 1
      molilian.core/Plus/JDUnion/SpreadEffect.cs
  30. 2 2
      molilian.core/Plus/JDUnion/amount.cs
  31. 1 1
      molilian.core/Plus/JDUnion/base.cs
  32. 1 1
      molilian.core/Plus/ks/base.cs
  33. 1 1
      molilian.core/Plus/pdd/base.cs

+ 2 - 0
molilian.api/Controllers/admin/DataReportController.cs

@@ -181,6 +181,8 @@ namespace molilian.api.Controllers
                 update.Loader<int>("sub_type");
                 update.Loader<int>("platform");
                 update.Loader<string>("platform_name");
+                update.Loader<string>("adId");
+                update.Loader<string>("adzoneId");
                 update.Loader<int>("distribution");
                 update.Loader<int>("req_count");
                 update.Loader<int>("dp_transition_succ_count");

+ 6 - 1
molilian.api/Controllers/admin/JdUnionController.cs

@@ -365,18 +365,23 @@ namespace molilian.api.Controllers
             cookie = cookie.Replace("\r", "").Replace("\n", "").Trim();
             if (!cookie.EndsWith(";")) cookie += ";";
 
+            string union_cookies = form.Read<string>("union_cookies", string.Empty);
+            union_cookies = union_cookies.Replace("\r", "").Replace("\n", "").Trim();
+            if (!union_cookies.EndsWith(";")) union_cookies += ";";
+
             string[] parts = h5st.Split(';');
             h5st = string.Join(";", parts.Take(8));
             h5st = h5st.Trim();
 
 
             user_agent = user_agent.Trim();
-            var accountId = JdPoolCore.UpdateCookies(cookie, user_agent, h5st);
+            var accountId = JdPoolCore.UpdateCookies(cookie, union_cookies, user_agent, h5st);
             bool success = accountId > 0;
             if (success)
             {
                 //string desc = ObjectComparer.PrintCompareToString(old, form).Trim();
                 OperationLogCore.LogOperation(token.AccessKey, clientIp, $"jd_pool:{accountId}:cookie", string.Empty, cookie);
+                OperationLogCore.LogOperation(token.AccessKey, clientIp, $"jd_pool:{accountId}:union_cookies", string.Empty, union_cookies);
             }
             return new APIResult(new
             {

+ 79 - 37
molilian.api/Controllers/public/TaskController.cs

@@ -491,6 +491,16 @@ namespace molilian.api.Controllers
                         DBContext.Execute(sql, null);
                         sql = $"CREATE TABLE IF NOT EXISTS pdd_parse_logs_{table_suffix} LIKE pdd_parse_logs;";
                         DBContext.Execute(sql, null);
+
+                        sql = $"CREATE TABLE IF NOT EXISTS tool_parse_logs_{table_suffix} LIKE tool_parse_logs_template;";
+                        DBContext.Execute(sql, null);
+                        sql = $"CREATE TABLE IF NOT EXISTS tk_dp_logs_{table_suffix} LIKE tk_dp_logs;";
+                        DBContext.Execute(sql, null);
+                        sql = $"CREATE TABLE IF NOT EXISTS pdd_dp_logs_{table_suffix} LIKE pdd_dp_logs;";
+                        DBContext.Execute(sql, null);
+                        sql = $"CREATE TABLE IF NOT EXISTS jd_dp_logs_{table_suffix} LIKE jd_dp_logs;";
+                        DBContext.Execute(sql, null);
+
                     }
                     else
                     {
@@ -666,42 +676,7 @@ namespace molilian.api.Controllers
 
                     string lockKey = $"lock:exception:sleep:jd_{account.id}";
                     if (!string.IsNullOrEmpty(RedisHelper.Get(lockKey))) continue;
-
-
-
-                    if (!string.IsNullOrEmpty(account.cookies))
-                    {
-                        try
-                        {
-                            var plus = new JdUnionPlus(account);
-                            var data = await plus.queryTodaySpreadEffectData();
-                            account.today_clickNum = data.clickNum;
-                            account.today_cosFee = data.cosFee;
-                            account.today_cosPrice = data.cosPrice;
-                            account.today_finishCosFee = data.finishCosFee;
-                            account.today_finishCosPrice = data.finishCosPrice;
-                            account.today_finishOrderNum = data.finishOrderNum;
-                            account.today_orderNum = data.orderNum;
-
-                            changed = true;
-                            any_jd_changed = true;
-                        }
-                        catch (Exception ex)
-                        {
-                            if (ex.Message.Contains("no login"))
-                            {
-                                account.status = false;
-                                _ = JdPoolCore.DisabledAsync(account.id, account.name, ex.Message);
-                            }
-                            else
-                            {
-                                RedisHelper.Set(lockKey, 1, 3600);
-                            }
-                            message = $"【JD报表接口异常】{account.id}:{account.name}\tqueryTodaySpreadEffectData\n{ex.Message}\n{ex.StackTrace}";
-                            NotifyCore.Notify(message);
-                            continue;
-                        }
-                    }
+                     
                     if (changed) JdPoolCore.Update(account);
                 }
                 if (any_jd_changed) JdPoolCore.Refresh();
@@ -776,6 +751,73 @@ namespace molilian.api.Controllers
             return new APIResult(new { success = true, message = "ok" });
         }
 
+
+
+        [HttpGet]
+        public async Task<ActionResult> jdQuerySpreadEffectData(string ignore = "")
+        {
+            string message = string.Empty;
+
+             
+            string filter = "";
+#if DEBUG
+            filter = "id IN (37, 15)";
+#endif
+            var jd_list = new DBContext.Table("jd_pool").Where(filter, null).Select<JdPoolDTO>();
+
+            if (!ignore.Contains("jd") && jd_list != null)
+            {
+                bool any_jd_changed = false;
+                foreach (var account in jd_list)
+                {
+                    bool changed = false;
+                    if (!account.status) continue;
+
+                    string lockKey = $"lock:exception:sleep:jd_{account.id}";
+                    if (!string.IsNullOrEmpty(RedisHelper.Get(lockKey))) continue;
+
+                    if (!string.IsNullOrEmpty(account.union_cookies))
+                    {
+                        try
+                        {
+                            var plus = new JdUnionPlus(account);
+                            var data = await plus.queryTodaySpreadEffectData();
+                            account.today_clickNum = data.clickNum;
+                            account.today_cosFee = data.cosFee;
+                            account.today_cosPrice = data.cosPrice;
+                            account.today_finishCosFee = data.finishCosFee;
+                            account.today_finishCosPrice = data.finishCosPrice;
+                            account.today_finishOrderNum = data.finishOrderNum;
+                            account.today_orderNum = data.orderNum;
+
+                            changed = true;
+                            any_jd_changed = true;
+                        }
+                        catch (Exception ex)
+                        {
+                            if (ex.Message.Contains("no login"))
+                            {
+                                account.status = false;
+                                _ = JdPoolCore.DisabledAsync(account.id, account.name, ex.Message);
+                            }
+                            else
+                            {
+                                RedisHelper.Set(lockKey, 1, 3600);
+                            }
+                            message = $"【JD报表接口异常】{account.id}:{account.name}\tqueryTodaySpreadEffectData\n{ex.Message}\n{ex.StackTrace}";
+                            NotifyCore.Notify(message);
+                            continue;
+                        }
+                    }
+                    if (changed) JdPoolCore.Update(account);
+                }
+                if (any_jd_changed) JdPoolCore.Refresh();
+            }
+            return new APIResult(new { success = true, message = "ok" });
+        }
+
+
+
         [HttpGet]
         public async Task<ActionResult> SaveReport()
         {
@@ -839,7 +881,7 @@ namespace molilian.api.Controllers
 #endif
                     if (account.is_hide) continue;
 
-                    if (!string.IsNullOrEmpty(account.cookies))
+                    if (!string.IsNullOrEmpty(account.union_cookies))
                     {
                         try
                         {

+ 6 - 3
molilian.api/Controllers/public/TkController.cs

@@ -48,6 +48,7 @@ namespace molilian.api.Controllers
             var channel = form.Read("c", string.Empty);
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
+            var type = form.Read("type", string.Empty);
             var clickId = form.Read("clickId", string.Empty);
             var commerceType = form.Read<int>("commerceType", 0);
             var riskStrategy = form.Read("riskStrategy", string.Empty);
@@ -77,7 +78,7 @@ namespace molilian.api.Controllers
             {
                 return new APIResult(new { success = false, message = "验证错误4" }, APIResultCodeEnum.Unauthorized);
             }
-            return await UnionParseCore.UnionParseAsync(content, channel, commerceType, ip, oaid, riskStrategy, launchScene, 0, clickId);
+            return await UnionParseCore.UnionParseAsync(content, channel, commerceType, ip, oaid, riskStrategy, launchScene, 0, clickId, type);
         }
 
         [HttpPost]
@@ -88,6 +89,7 @@ namespace molilian.api.Controllers
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
             var clickId = form.Read("clickId", string.Empty);
+            var type = form.Read("type", string.Empty);
             int accountid = form.Read("aid", 0);
             var commerceType = form.Read<int>("commerceType", 0);
             var riskStrategy = form.Read("riskStrategy", string.Empty);
@@ -97,7 +99,7 @@ namespace molilian.api.Controllers
             //ip = "127.0.0.1";
             //oaid = "test-oaid";
 #endif
-            return await UnionParseCore.UnionParseAsync(content, channel, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId);
+            return await UnionParseCore.UnionParseAsync(content, channel, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId, type);
         }
 
 
@@ -109,6 +111,7 @@ namespace molilian.api.Controllers
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
             var clickId = form.Read("clickId", string.Empty);
+            var type = form.Read("type", string.Empty);
             int accountid = form.Read("aid", 0);
             int count = form.Read("count", 0);
             var commerceType = form.Read<int>("commerceType", 0);
@@ -122,7 +125,7 @@ namespace molilian.api.Controllers
 #endif
             for (int i = 0; i < count; i++)
             {
-                _ = await UnionParseCore.UnionParseAsync(content[i], channel, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId);
+                _ = await UnionParseCore.UnionParseAsync(content[i], channel, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId, type);
             }
             return new APIResult(new { msg = "ok" });
         }

File diff suppressed because it is too large
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 8 - 0
molilian.core/Core/PushDataReport/PushDataReportDTO.cs

@@ -176,4 +176,12 @@ public class PushDataReportDTO
     public DateTime last_push_time { get; set; } = DateTime.Now;
     [JsonIgnore]
     public int status { get; set; } = 0;
+
+    public string adzoneId { get; set; } = string.Empty;
+
+    public string adId { get; set; } = string.Empty;
+    
+
+
+
 }

+ 1 - 1
molilian.core/Core/cps/UnionCpsCore.cs

@@ -450,7 +450,7 @@ namespace molilian.core
                 // IP和流量控制
                 string ignorePercentageCity = config.cpsIgnorePercentageCity;
                 string? ipInfo = IP2RegionPlus.Search(ip);
-                if (AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
+                if (!TestParseCore.InWhitelist(ip, oaid) && AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
                 {
                     reason = $"地区控制:{regionInfo}";
                     return true;

+ 18 - 7
molilian.core/Core/jd/JdPoolCore.cs

@@ -70,21 +70,30 @@ namespace molilian.core
             return eligibleItems.OrderBy(l => Guid.NewGuid()).FirstOrDefault();
         }
 
-        public static async Task<JdPoolDTO?> GetOneAsync(JdAction action, string riskStrategy, int launchScene, bool? is_numeric)
+        public static async Task<JdPoolDTO?> GetOneAsync(JdAction action, string riskStrategy, int launchScene, bool? is_numeric, string parse_type = "")
         {
             var list = await ListAsync();
             if (!list.Any()) return null;
 
-
-            if ("brw".Equals(riskStrategy) && launchScene != 0)
+            if ("dp".Equals(parse_type))
             {
-                list = list.Where(item => "brw".Equals(item.riskStrategy) && item.launchScene == launchScene).ToList();
+
+                list = list.Where(item => "dp".Equals(item.parse_type)).ToList();
                 if (!list.Any()) return null;
             }
             else
             {
-                list = list.Where(item => !"brw".Equals(item.riskStrategy)).ToList();
-                if (!list.Any()) return null;
+                if ("brw".Equals(riskStrategy) && launchScene != 0)
+                {
+                    list = list.Where(item => string.IsNullOrEmpty(item.parse_type) && "brw".Equals(item.riskStrategy) && item.launchScene == launchScene).ToList();
+                    if (!list.Any()) return null;
+                }
+                else
+                {
+                    list = list.Where(item => string.IsNullOrEmpty(item.parse_type) && !"brw".Equals(item.riskStrategy)).ToList();
+                    if (!list.Any()) return null;
+                }
+
             }
 
             var eligibleItems = new List<JdPoolDTO>();
@@ -285,7 +294,7 @@ namespace molilian.core
 
 
 
-        public static int UpdateCookies(string cookies, string user_agent, string h5st)
+        public static int UpdateCookies(string cookies, string union_cookies, string user_agent, string h5st)
         {
             if (string.IsNullOrEmpty(cookies)) return 0;
             string pin = cookies.GetContentPart("pin=", ";");
@@ -304,6 +313,7 @@ namespace molilian.core
                 var update = new DBContext.Table("jd_pool")
                     .Add("pin", pin)
                     .Add("cookies", cookies)
+                    .Add("union_cookies", union_cookies)
                     .Add("status", status)
                     .Add("last_time", DateTime.Now)
                     .Add("login_time", DateTime.Now)
@@ -322,6 +332,7 @@ namespace molilian.core
                     .Add("company", pin)
                     .Add("description", "由cookies上报创建此记录")
                     .Add("cookies", cookies)
+                    .Add("union_cookies", union_cookies)
                     .Add("create_time", DateTime.Now)
                     .Add("last_time", DateTime.Now)
                     .Add("login_time", DateTime.Now)

+ 2 - 2
molilian.core/Core/log/deeplink.cs

@@ -42,7 +42,7 @@ namespace molilian.core
 
                         if (data.success)
                         {
-                            save_dp_parse_logs(data, "deeplink_parse_logs_success", connection, transaction);
+                            //save_dp_parse_logs(data, "deeplink_parse_logs_success", connection, transaction);
                         }
                         else
                         {
@@ -100,7 +100,7 @@ namespace molilian.core
 
                         if (data.success)
                         {
-                            save_dp_parse_logs(data, "deeplink_parse_logs_success", connection, transaction);
+                            //save_dp_parse_logs(data, "deeplink_parse_logs_success", connection, transaction);
                         }
                         else
                         {

+ 13 - 1
molilian.core/Core/log/jd.cs

@@ -31,8 +31,18 @@ namespace molilian.core
                     }
                     else
                     {
-                        //save_jd_parse_logs(data, "jd_parse_logs", connection, transaction);
+                        if ("dp".Equals(data.parse_type))
+                        {
+                            string daily_table = $"jd_dp_logs_{data.create_time:yyyyMMdd}";
+                            save_jd_parse_logs(data, daily_table, connection, transaction);
+
+                            if (data.success)
+                            {
+                                save_jd_parse_logs(data, "jd_dp_logs_success", connection, transaction);
+                            }
+                        }
 
+                        //save_jd_parse_logs(data, "jd_parse_logs", connection, transaction);
                         //if (save_dailys_log)
                         {
                             string daily_table = $"jd_parse_logs_{data.create_time:yyyyMMdd}";
@@ -43,6 +53,7 @@ namespace molilian.core
                         {
                             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);
@@ -261,6 +272,7 @@ namespace molilian.core
                 .Add("riskStrategy", data.riskStrategy)
                 .Add("launchScene", data.launchScene)
                 .Add("create_time", data.create_time)
+                .Add("parse_type", data.parse_type)
                 .Create(DBContext.InsertType.NORMAL, transaction);
         }
 

+ 9 - 4
molilian.core/Core/log/pdd.cs

@@ -23,19 +23,23 @@ namespace molilian.core
                     var data = await redis.LPopAsync<PddDataDTO>(queue_parse_pdd_key);
                     if (data == null) break;
 
-
                     if (TestParseCore.InWhitelist(data.ip, data.oaid))
                     {
                         save_pdd_parse_logs(data, "pdd_parse_logs_test", connection, transaction);
+
                     }
                     else
                     {
-                        //save_pdd_parse_logs(data, "pdd_parse_logs", connection, transaction);
-                        //if (save_dailys_log)
+                        string daily_table;
+                        if ("dp".Equals(data.parse_type))
                         {
-                            string daily_table = $"pdd_parse_logs_{data.create_time:yyyyMMdd}";
+                            daily_table = $"pdd_dp_logs_{data.create_time:yyyyMMdd}";
                             save_pdd_parse_logs(data, daily_table, connection, transaction);
                         }
+
+                        daily_table = $"pdd_parse_logs_{data.create_time:yyyyMMdd}";
+                        save_pdd_parse_logs(data, daily_table, connection, transaction);
+
                         if (!data.success)
                         {
                             save_pdd_parse_logs(data, "pdd_parse_logs_fail", connection, transaction);
@@ -183,6 +187,7 @@ namespace molilian.core
                 .Add("ip", data.ip)
                 .Add("oaid", data.oaid)
                 .Add("create_time", data.create_time)
+                .Add("parse_type", data.parse_type)
                 .Create(DBContext.InsertType.NORMAL, transaction);
 
         }

+ 2 - 1
molilian.core/Core/log/promotion.cs

@@ -103,7 +103,8 @@ namespace molilian.core
                     .Add("accountName", data.accountName)
                     .Add("proxy_node", data.proxy_node)
                     .Add("proxy_nodename", data.proxy_nodename)
-                    .Add("img", data.img)
+                    //.Add("img", data.img)
+                    .Add("img", string.Empty)
                     .Add("ip", data.ip)
                     .Add("oaid", data.oaid)
                     .Add("scene", data.scene)

+ 22 - 81
molilian.core/Core/log/taobao.cs

@@ -29,7 +29,17 @@ namespace molilian.core
                     }
                     else
                     {
-                        //data.id = save_tk_parse_logs(data, "tk_parse_logs", connection, transaction);
+                        if ("dp".Equals(data.parse_type))
+                        {
+                            string daily_table = $"tk_dp_logs_{data.create_time:yyyyMMdd}";
+                            save_tk_parse_logs(data, daily_table, connection, transaction);
+
+                            if (data.success)
+                            {
+                                save_tk_parse_logs(data, "tk_dp_logs_success", connection, transaction);
+                            }
+                        }
+
 
                         ////每日分表
                         //if (save_dailys_log)
@@ -42,97 +52,30 @@ namespace molilian.core
                         {
                             save_tk_parse_logs(data, "tk_parse_logs_test", connection, transaction);
                         }
-                        if (data.success)
+
+                        if (data.reason.Contains("初步筛选2") && !data.rawContent.Contains("I:/kWqN5t623Hx"))
                         {
-                            save_tk_parse_logs(data, "tk_success_parse_logs", connection, transaction);
+                            save_tk_parse_logs(data, "tk_parse_logs_test2", connection, transaction);
                         }
-                        if (!string.IsNullOrEmpty(data.itemId)) TkOrderTrackingCore.SaveLinkSummary(data);
-                    }
 
-                    if (data.reason.Contains("初步筛选2") && !data.rawContent.Contains("I:/kWqN5t623Hx"))
-                    {
-                        save_tk_parse_logs(data, "tk_parse_logs_test2", connection, transaction);
-                    }
-
-                    if (data.reason.Contains("初步筛选1.5"))
-                    {
-                        save_tk_parse_logs(data, "tk_parse_logs_multi_token", connection, transaction);
-                    }
-                    if (data.reason.Contains("霸下验证码"))
-                    {
-                        save_tk_parse_logs(data, "tk_parse_logs_captcha", connection, transaction);
-                    }
-                    total++;
-                }
-                transaction.Commit();
-            }
-            catch (Exception ex)
-            {
-                transaction.Rollback();
-                new LoggerLibrary("TkLogCore_error", "task_insert_parse_tb_logs")
-                      .Info(ex.Message, ex.StackTrace)
-                      .SaveAsync();
-                throw;
-            }
-            finally
-            {
-                connection.Close();
-            }
-            return total;
-        }
-
-        public static int task_insert_parse_tb_logs(int limit, CSRedisClient redis)
-        {
-            int total = 0;
-            using var connection = DBContext.GetOpenConnection();
-            connection.Open();
-            using var transaction = connection.BeginTransaction();
-            try
-            {
-                for (int i = 0; i < limit; i++)
-                {
-                    var data = redis.LPop<TkDataDTO>(queue_parse_tb_key);
-                    if (data == null) break;
-
-                    if (TestParseCore.InWhitelist(data.ip, data.oaid))
-                    {
-                        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 (save_dailys_log)
+                        if (data.reason.Contains("初步筛选1.5"))
                         {
-                            string daily_table = $"tk_parse_logs_{data.create_time:yyyyMMdd}";
-                            save_tk_parse_logs(data, daily_table, connection, transaction);
+                            save_tk_parse_logs(data, "tk_parse_logs_multi_token", connection, transaction);
                         }
-
-                        if (data.elapsedTime > 1000)
+                        if (data.reason.Contains("霸下验证码"))
                         {
-                            save_tk_parse_logs(data, "tk_parse_logs_test", connection, transaction);
+                            save_tk_parse_logs(data, "tk_parse_logs_captcha", connection, transaction);
                         }
+
                         if (data.success)
                         {
                             save_tk_parse_logs(data, "tk_success_parse_logs", connection, transaction);
                         }
-                        if (!string.IsNullOrEmpty(data.itemId)) TkOrderTrackingCore.SaveLinkSummary(data);
-                    }
+                        //data.id = save_tk_parse_logs(data, "tk_parse_logs", connection, transaction);
 
-                    if (data.reason.Contains("初步筛选2") && !data.rawContent.Contains("I:/kWqN5t623Hx"))
-                    {
-                        save_tk_parse_logs(data, "tk_parse_logs_test2", connection, transaction);
+                        if (!string.IsNullOrEmpty(data.itemId)) TkOrderTrackingCore.SaveLinkSummary(data);
                     }
 
-                    if (data.reason.Contains("初步筛选1.5"))
-                    {
-                        save_tk_parse_logs(data, "tk_parse_logs_multi_token", connection, transaction);
-                    }
-                    if (data.reason.Contains("霸下验证码"))
-                    {
-                        save_tk_parse_logs(data, "tk_parse_logs_captcha", connection, transaction);
-                    }
                     total++;
                 }
                 transaction.Commit();
@@ -154,9 +97,6 @@ namespace molilian.core
 
         public static async Task ParseLogAsync(TkDataDTO response, AlimamaPlus? alimamaPlus = null)
         {
-#if DEBUG
-            //return;
-#endif
             try
             {
                 var ts = DateTime.Now - response.create_time;
@@ -252,6 +192,7 @@ namespace molilian.core
                 .Add("item_deeplink_url", data.item_deeplink_url)
 
                 .Add("create_time", data.create_time)
+                .Add("parse_type", data.parse_type)
                 .Create(DBContext.InsertType.NORMAL, transaction);
         }
 

+ 2 - 75
molilian.core/Core/log/tool.cs

@@ -45,7 +45,8 @@ namespace molilian.core
                     }
                     else
                     {
-                        new DBContext.Table(connection, "tool_parse_logs")
+                        string daily_table = $"tool_parse_logs_{data.create_time:yyyyMMdd}";
+                        new DBContext.Table(connection, daily_table)
                             .Add("end_point", data.end_point)
                             .Add("channel", (int)data.channel)
                             .Add("rawContent", data.rawContent)
@@ -81,80 +82,6 @@ namespace molilian.core
             return total;
         }
 
-
-        public static int task_insert_parse_tool_logs(int limit, CSRedisClient redis)
-        {
-            int total = 0;
-
-            using var connection = DBContext.GetOpenConnection();
-            connection.Open();
-            using var transaction = connection.BeginTransaction();
-            try
-            {
-                for (int i = 0; i < limit; i++)
-                {
-                    var data = redis.LPop<ToolParseDataDTO>(queue_parse_tool_key);
-                    if (data == null) break;
-
-
-                    if (TestParseCore.InWhitelist(data.ip, data.oaid))
-                    {
-                        new DBContext.Table(connection, "tool_parse_logs_test")
-                            .Add("end_point", data.end_point)
-                            .Add("channel", (int)data.channel)
-                            .Add("rawContent", data.rawContent)
-                            .Add("success", data.success)
-                            .Add("message", data.message)
-                            .Add("reason", data.reason)
-                            .Add("content", data.content)
-                            .Add("taoToken", data.taoToken)
-                            .Add("shortLinkurl", data.shortLinkurl)
-                            .Add("deeplink_url", data.deeplink_url)
-                            .Add("elapsedTime", data.elapsedTime)
-                            .Add("ip", data.ip)
-                            .Add("oaid", data.oaid)
-                            .Add("create_time", data.create_time)
-                            .Create(DBContext.InsertType.NORMAL, transaction);
-                    }
-                    else
-                    {
-                        new DBContext.Table(connection, "tool_parse_logs")
-                            .Add("end_point", data.end_point)
-                            .Add("channel", (int)data.channel)
-                            .Add("rawContent", data.rawContent)
-                            .Add("success", data.success)
-                            .Add("message", data.message)
-                            .Add("reason", data.reason)
-                            .Add("content", data.content)
-                            .Add("taoToken", data.taoToken)
-                            .Add("shortLinkurl", data.shortLinkurl)
-                            .Add("deeplink_url", data.deeplink_url)
-                            .Add("elapsedTime", data.elapsedTime)
-                            .Add("ip", data.ip)
-                            .Add("oaid", data.oaid)
-                            .Add("create_time", data.create_time)
-                            .Create(DBContext.InsertType.NORMAL, transaction);
-                    }
-                    total++;
-                }
-                transaction.Commit();
-            }
-            catch (Exception ex)
-            {
-                transaction.Rollback();
-                new LoggerLibrary("TkLogCore_error", "task_insert_parse_tool_logs")
-                      .Info(ex.Message, ex.StackTrace)
-                      .SaveAsync();
-                throw;
-            }
-            finally
-            {
-                connection.Close();
-            }
-            return total;
-        }
-
-
         public static async Task ParseLogAsync(ToolParseDataDTO response)
         {
             try

+ 13 - 1
molilian.core/Core/pdd/PddPoolCore.cs

@@ -35,10 +35,22 @@ namespace molilian.core
             _end_point = Environment.GetEnvironmentVariable("EndPoint");
         }
 
-        public static PddPoolDTO? GetOne(PddUnionWorkMode mode, int accountid = 0)
+        public static PddPoolDTO? GetOne(PddUnionWorkMode mode, int accountid = 0, string parse_type = "")
         {
             var list = List();
             if (!list.Any()) return null;
+            if ("dp".Equals(parse_type))
+            {
+                list = list.Where(item => "dp".Equals(item.parse_type)).ToList();
+                if (!list.Any()) return null;
+            }
+            else
+            {
+                list = list.Where(item => string.IsNullOrEmpty(item.parse_type)).ToList();
+                if (!list.Any()) return null;
+
+            }
+
             return list.Where(e => IsMatch(e, mode, accountid)).OrderBy(l => Guid.NewGuid()).FirstOrDefault();
         }
 

+ 13 - 10
molilian.core/Core/taoke/TkPoolCore.cs

@@ -48,31 +48,34 @@ namespace molilian.core
             }
             return null;
         }
-        public static async Task<TkPoolDTO> GetOneAsync(TkAction action, bool isTaobaoUrl, string riskStrategy, int launchScene)
+        public static async Task<TkPoolDTO> GetOneAsync(TkAction action, bool isTaobaoUrl, string riskStrategy, int launchScene, string parse_type = "")
         {
             var list = await ListAsync().ConfigureAwait(false);
             if (!list.Any())
                 return null;
 
-#if DEBUG
-            list = list.Where(e => e.id != 50).ToList();
-
-
-#endif
             // 获取所有账号(包括离线账号)
             var allAccounts = await AllListAsync().ConfigureAwait(false);
             if (allAccounts == null)
                 allAccounts = list; // 如果获取失败,至少使用在线账号列表
 
-            if ("brw".Equals(riskStrategy) && launchScene != 0)
+            if ("dp".Equals(parse_type))
             {
-                list = list.Where(item => "brw".Equals(item.riskStrategy) && item.launchScene == launchScene).ToList();
+                list = list.Where(item => "dp".Equals(item.parse_type)).ToList();
                 if (!list.Any()) return null;
             }
             else
             {
-                list = list.Where(item => !"brw".Equals(item.riskStrategy)).ToList();
-                if (!list.Any()) return null;
+                if ("brw".Equals(riskStrategy) && launchScene != 0)
+                {
+                    list = list.Where(item => string.IsNullOrEmpty(item.parse_type) && "brw".Equals(item.riskStrategy) && item.launchScene == launchScene).ToList();
+                    if (!list.Any()) return null;
+                }
+                else
+                {
+                    list = list.Where(item => string.IsNullOrEmpty(item.parse_type) && !"brw".Equals(item.riskStrategy)).ToList();
+                    if (!list.Any()) return null;
+                }
             }
 
 

File diff suppressed because it is too large
+ 66 - 1
molilian.core/Core/taoke/UnionParseCore.cs


+ 1 - 1
molilian.core/Core/tool/DeeplinkParseCore.cs

@@ -94,7 +94,7 @@ namespace molilian.core
             {
                 // IP和流量控制
                 string? ipInfo = IP2RegionPlus.Search(ip);
-                if (AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
+                if (!TestParseCore.InWhitelist(ip, oaid) && AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
                 {
                     reason = $"地区控制:{regionInfo}";
                     return true;

+ 6 - 9
molilian.core/Core/tool/TestParseCore.cs

@@ -1,21 +1,18 @@
 
-using dodohold.core;
-using Microsoft.AspNetCore.Mvc;
-using Sayaka.Common;
-using System.Text.Json;
-using System.Text.RegularExpressions;
-using System.Web;
 namespace molilian.core
 {
     public partial class TestParseCore
     {
-        public static string _test_oaid = "C712574A37194CC8AA2C94F4E94BF632069e05173327fe9168cc3829a5a22820";
+        public static List<string> _test_oaid = [
+            "C712574A37194CC8AA2C94F4E94BF632069e05173327fe9168cc3829a5a22820",
+            "E5519EE0E4724362BD71D42F8D5CD0200b57296c00ba6e16d2b0ff67abb97a87",
+            "8E61FDE9411443F9A3642A6ACAD42747EC7D424979CC9C51CB1670D630EE7D8F"
+            ];
 
         public static bool InWhitelist(string ip, string oaid)
         {
-            if (_test_oaid.Equals(oaid, StringComparison.OrdinalIgnoreCase)) return true;
+            if (_test_oaid.Any(e => e.ToLower().Equals(oaid.ToLower()))) return true;
             if (!string.IsNullOrEmpty(ip) && ip.StartsWith("127.0.0")) return true;
-
             return false;
         }
     }

+ 1 - 0
molilian.core/DTO/alimama/TkDataDTO.cs

@@ -121,6 +121,7 @@ namespace molilian.core
         public TkSubCodeEnum subCode { get; set; } = TkSubCodeEnum.Other;
         public string riskStrategy { get; set; } = string.Empty;
         public int launchScene { get; set; } = 0;
+        public string parse_type { get; set; } = string.Empty;
         public string item_url { get; set; } = string.Empty;
         public string item_deeplink_url { get; set; } = string.Empty;
 

+ 1 - 0
molilian.core/DTO/alimama/TkPoolDTO.cs

@@ -67,6 +67,7 @@
         public string riskStrategy { get; set; } = string.Empty;
         public int launchScene { get; set; } = 0;
         public bool useCouponLinkFirst { get; set; } = true;
+        public string parse_type { get; set; } = string.Empty;
 
     }
 }

+ 1 - 0
molilian.core/DTO/jd/JdDataDTO.cs

@@ -32,6 +32,7 @@
         public string end_point { get; set; } = string.Empty;
         public int subCode { get; set; } = 0;
         public string riskStrategy { get; set; } = string.Empty;
+        public string parse_type { get; set; } = string.Empty;
         public int launchScene { get; set; } = 0;
     }
 

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

@@ -26,6 +26,7 @@
         public JdUnionWorkMode work_mode { get; set; } = JdUnionWorkMode.SiteApi;
         public string user_agent { get; set; } = string.Empty;
         public string cookies { get; set; } = string.Empty;
+        public string union_cookies { get; set; } = string.Empty;
         public string h5st { get; set; } = string.Empty;
 
         public string nodeName { get; set; } = string.Empty;
@@ -59,6 +60,7 @@
         public string riskStrategy { get; set; } = string.Empty;
 
         public int launchScene { get; set; } = 0;
+        public string parse_type { get; set; } = string.Empty;
 
 
     }

+ 1 - 0
molilian.core/DTO/pdd/PddDataDTO.cs

@@ -34,6 +34,7 @@
         public string end_point { get; set; } = string.Empty;
         public int subCode { get; set; } = 0;
         public string accessto { get; set; } = string.Empty;
+        public string parse_type { get; set; } = string.Empty;
     }
 
 }

+ 1 - 0
molilian.core/DTO/pdd/PddPoolDTO.cs

@@ -47,5 +47,6 @@ namespace molilian.core
         public bool enable_sync_order { get; set; } = false;
         public bool is_hide { get; set; } = true;
         public bool enable_call_stats { get; set; } = true;
+        public string parse_type { get; set; } = string.Empty;
     }
 }

+ 1 - 4
molilian.core/Plus/Alimama/parse.cs

@@ -155,10 +155,7 @@ namespace molilian.core
 
             //2025-02-06 增加重试机制
             int try_count = 0;
-#if DEBUG
-            _config.tk_parse_retry_count = 3;
 
-#endif
             while (try_count == 0 || try_count <= _config.tk_parse_retry_count)
             {
                 if (try_count >= 3) break;
@@ -545,7 +542,7 @@ namespace molilian.core
                 var config = TkConfigCore.Get();
                 string ignorePercentageCity = config.ignorePercentageCity;
                 string? ipInfo = IP2RegionPlus.Search(ip);
-                if (IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
+                if (!TestParseCore.InWhitelist(ip, oaid) && IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
                 {
                     reason = $"地区控制:{regionInfo}";
                     return true;

+ 1 - 0
molilian.core/Plus/Alimama/parse_2.cs

@@ -75,6 +75,7 @@ namespace molilian.core
             if (url.Contains("//item.taobao.com/item.htm?") ||
                 url.Contains("//pages-g.m.taobao.com/wow/z/app/detail-next/item/index?") ||
                 url.Contains("//main.m.taobao.com/detail/index.html?") ||
+                url.Contains("//main.m.taobao.com/security-h5-detail/home?") ||
                 url.Contains("//h5.m.taobao.com/awp/core/detail.htm?") ||
                 url.Contains("//new.m.taobao.com/detail.htm?") ||
                 url.Contains("//outfliggys.m.taobao.com/app/trip/rx-travel-detail") ||

+ 1 - 1
molilian.core/Plus/JDUnion/EstimateComm.cs

@@ -12,7 +12,7 @@ namespace molilian.core
             List<DateTime> changed_dates = new List<DateTime>();
 
             var ts = DateTime.Now.Convert2UnixTimestamp(true);
-            string cookies = _account.cookies;
+            string cookies = _account.union_cookies;
 
             string useragent = _account.user_agent;
             if (string.IsNullOrEmpty(useragent)) useragent = ProviderFakeUserAgent.RandomComputer;

+ 1 - 1
molilian.core/Plus/JDUnion/SpreadEffect.cs

@@ -11,7 +11,7 @@ namespace molilian.core
             List<DateTime> changed_dates = new List<DateTime>();
 
             var ts = DateTime.Now.Convert2UnixTimestamp(true);
-            string cookies = _account.cookies;
+            string cookies = _account.union_cookies;
 
             string useragent = _account.user_agent;
             if (string.IsNullOrEmpty(useragent)) useragent = ProviderFakeUserAgent.RandomComputer;

+ 2 - 2
molilian.core/Plus/JDUnion/amount.cs

@@ -31,7 +31,7 @@ namespace molilian.core
         {
             SpreadReportInfoDTO result = null;
             var ts = DateTime.Now.Convert2UnixTimestamp(true);
-            string cookies = _account.cookies;
+            string cookies = _account.union_cookies;
 
             string useragent = _account.user_agent;
             if (string.IsNullOrEmpty(useragent)) useragent = ProviderFakeUserAgent.RandomComputer;
@@ -47,7 +47,7 @@ namespace molilian.core
                     proCont = "",
                     promotionId = "",
                     sourceEmt = "",
-                    pageNo = 0,
+                    pageNo = 1,
                     pageSize = 20
                 },
             };

+ 1 - 1
molilian.core/Plus/JDUnion/base.cs

@@ -118,7 +118,7 @@ namespace molilian.core
                 // IP和流量控制
                 string ignorePercentageCity = config.jdIgnorePercentageCity;
                 string? ipInfo = IP2RegionPlus.Search(ip);
-                if (AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
+                if (!TestParseCore.InWhitelist(ip, oaid) && AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
                 {
                     reason = $"地区控制:{regionInfo}";
                     return true;

+ 1 - 1
molilian.core/Plus/ks/base.cs

@@ -44,7 +44,7 @@ namespace molilian.core
                 // IP和流量控制
                 string ignorePercentageCity = config.ksIgnorePercentageCity;
                 string? ipInfo = IP2RegionPlus.Search(ip);
-                if (AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
+                if (!TestParseCore.InWhitelist(ip, oaid) && AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
                 {
                     reason = $"地区控制:{regionInfo}";
                     return true;

+ 1 - 1
molilian.core/Plus/pdd/base.cs

@@ -57,7 +57,7 @@ namespace molilian.core
                 // IP和流量控制
                 string ignorePercentageCity = config.pddIgnorePercentageCity;
                 string? ipInfo = IP2RegionPlus.Search(ip);
-                if (AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
+                if (!TestParseCore.InWhitelist(ip, oaid) && AlimamaPlus.IgnoreRegionIncluded(ignorePercentageCity, ipInfo, out string regionInfo))
                 {
                     reason = $"地区控制:{regionInfo}";
                     return true;

Some files were not shown because too many files changed in this diff