dodo hold 1 年之前
父節點
當前提交
57064ffdb4

+ 0 - 30
molilian.api/Controllers/public/TaskController.cs

@@ -47,36 +47,6 @@ namespace molilian.api.Controllers
             return new APIResult(new { success = true, count });
         }
 
-        [HttpGet]
-        public async Task<ActionResult> testReloadPushReortData()
-        {
-            PushDataReportCore core = new();
-            DateTime sdate = DateTime.Parse("2025-01-01");
-            DateTime edate = DateTime.Now.Date;
-            int count = 0;
-            while (sdate < edate)
-            {
-                count += await core.FillParseData(sdate.Date);
-                sdate = sdate.AddDays(1);
-            }
-            return new APIResult(new { success = true, count });
-        }
-        [HttpGet]
-        public async Task<ActionResult> testPushReportData()
-        {
-            PushDataReportCore core = new();
-            DateTime sdate = DateTime.Parse("2025-01-01");
-            DateTime edate = DateTime.Parse("2025-03-24");
-            int count = 0;
-            while (sdate < edate)
-            {
-
-                count += await core.PushReportData(sdate, true);
-                sdate = sdate.AddDays(1);
-            }
-
-            return new APIResult(new { success = true, count });
-        }
 
 
         [HttpGet]

+ 1 - 1
molilian.api/Controllers/public/TkActivityController.cs

@@ -73,7 +73,7 @@ namespace molilian.api.Controllers
                 _ => "top",
             };
 
-            return await TkActivityCore.ParseAsync(page_id, prefix, item_id, ip, oaid, strategy_id);
+            return await TkActivityCore.ParseAsync(page_id, prefix, item_id, strategy_id, ip, oaid);
         }
 
 

文件差異過大導致無法顯示
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 2 - 2
molilian.api/Properties/launchSettings.json

@@ -4,7 +4,7 @@
       "commandName": "Project",
       "launchBrowser": true,
       "launchUrl": "swagger",
-      "environmentVariables2": {
+      "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development",
         "EndPoint": "coupon",
         "NtfyServer": "https://ntfy.yunhui800.com/vozQub8a78ABLqqY",
@@ -16,7 +16,7 @@
         "CenterDB": "",
         "CenterRedis": ""
       },
-      "environmentVariables": {
+      "environmentVariables2": {
         "ASPNETCORE_ENVIRONMENT": "Development",
         "EndPoint": "bj",
         "NtfyServer": "https://ntfy.yunhui800.com/5Sq9BytXXM5WDY3G",

+ 7 - 3
molilian.core/Core/PushDataReport/PushDataReportCore.cs

@@ -62,14 +62,15 @@ namespace molilian.core
                     new() { channel_id = 3,  push_channel_id = 9, channel_name = "pdd" }
                 };
 
-
-                int data_type = 1; //转链数据
-                int sub_type = 100000;
                 int count = 0;
                 foreach (var p in platform_list)
                 {
                     int platform = p.channel_id;
                     string channel_name = p.channel_name;
+
+
+                    int data_type = 1; //转链数据
+                    int sub_type = 100000;
                     if ("tbdp".Equals(channel_name))
                     {
                         data_type = 3;
@@ -237,6 +238,9 @@ namespace molilian.core
                 {
                     if (deeplink.push_channel_id == 0) continue;
 
+                    //先跳过百度网盘的数据处理
+                    if(deeplink.channel_id== 102) continue;
+
                     string[] flags = ["none", "home", "success", "fail"];
                     int all_total = 0;
                     int success_total = 0;

+ 11 - 35
molilian.core/Core/taoke/RiskControlCore.cs

@@ -35,50 +35,26 @@ namespace molilian.core
         internal static async Task CallsIncrByAsync(TkChannelEnum channel, int accountId, string flag, int expire = 259200)
         {
             string key = $"{channel}:{accountId}:{flag}";
-            if (_calls.ContainsKey(key))
+            if (_calls.TryGetValue(key, out int value))
             {
-                _calls[key] += 1;
+                _calls[key] = ++value;
             }
             else
             {
                 _calls[key] = 1;
             }
-            string cache_key = $"RiskControl:{key}:calls:{flag}";
+            string cache_key = $":RiskControl:calls:{key}";
             await RedisKit.IncrByAsync(cache_key);
             await RedisKit.ExpireAsync(cache_key, expire);
-        }
 
-        internal static async Task CallsIncrByAsync(TkChannelEnum channel, int accountId, string flag, double expire)
-        {
-            string key = $"{channel}:{accountId}:{flag}";
-            if (_calls.ContainsKey(key))
-            {
-                _calls[key] += 1;
-            }
-            else
-            {
-                _calls[key] = 1;
-            }
-            string cache_key = $"RiskControl:{key}:calls:{flag}";
-            await RedisKit.IncrByAsync(cache_key);
-            await RedisKit.ExpireAsync(cache_key, expire);
         }
 
-
-
         internal static async Task SetCallsAsync(TkChannelEnum channel, int accountId, string flag, int val)
         {
             string key = $"{channel}:{accountId}:{flag}";
-            if (_calls.ContainsKey(key))
-            {
-                _calls[key] = val;
-            }
-            else
-            {
-                _calls[key] = val;
-            }
-            string cache_key = $"RiskControl:{key}:calls:{flag}";
-            await RedisHelper.IncrByAsync(cache_key);
+            _calls.TryAdd(key, val);
+            string cache_key = $":RiskControl:calls:{key}";
+            await RedisHelper.SetAsync(cache_key, val);
             await RedisHelper.ExpireAsync(cache_key, 3 * 86400);
         }
         public static async Task<int> GetAllNodesCallsAsync(TkChannelEnum channel, int accountId, string flag)
@@ -95,7 +71,7 @@ namespace molilian.core
                             var redisServer = EndPointCore.GetRedisServer(node);
                             if (string.IsNullOrEmpty(redisServer)) return 0;
 
-                            var cacheKey = $"RiskControl:{key}:calls:{flag}";
+                            var cacheKey = $":RiskControl:calls:{key}";
                             using var scope = await RedisClientFactory.CreateScopeAsync(redisServer);
                             int count = await scope.Client.GetAsync<int>(cacheKey);
                             return count;
@@ -128,7 +104,7 @@ namespace molilian.core
             {
                 _calls[key] = val;
             }
-            string cache_key = $"RiskControl:{key}:calls:{flag}";
+            string cache_key = $":RiskControl:calls:{key}";
             await RedisHelper.IncrByAsync(cache_key);
             await RedisHelper.ExpireAsync(cache_key, 3 * 86400);
         }
@@ -148,7 +124,7 @@ namespace molilian.core
                             var redisServer = EndPointCore.GetRedisServer(node);
                             if (string.IsNullOrEmpty(redisServer)) return 0;
 
-                            string cacheKey = $"RiskControl:{key}:calls:{flag}";
+                            string cacheKey = $":RiskControl:calls:{key}";
                             using var scope = await RedisClientFactory.CreateScopeAsync(redisServer);
                             return await scope.Client.GetAsync<int>(cacheKey);
                         }
@@ -175,7 +151,7 @@ namespace molilian.core
                 string key = $"{channel}:{accountId}:{flag}";
                 if (_calls.ContainsKey(key)) return _calls[key];
 
-                string cache_key = $"RiskControl:{key}:calls:{flag}";
+                string cache_key = $"RiskControl:calls:{key}";
                 int num = RedisHelper.Get<int>(cache_key);
                 _calls.TryAdd(key, num);
                 return num;
@@ -228,7 +204,7 @@ namespace molilian.core
                 string key = $"{channel}:{accountName}:{DateTime.Now:yyyyMMdd}";
                 if (_incomeAmt.ContainsKey(key)) return _incomeAmt[key];
 
-                string cache_key = $"RiskControl:{key}:income_amt";
+                string cache_key = $":RiskControl:{key}:income_amt";
                 return RedisHelper.Get<decimal>(cache_key);
             }
             catch (Exception ex) { return 0; }

+ 1 - 1
molilian.core/Core/taoke/TkPoolCore.cs

@@ -65,7 +65,7 @@ namespace molilian.core
             // 获取所有账号(包括离线账号)
             var allAccounts = await AllListAsync().ConfigureAwait(false);
             if (allAccounts == null)
-                allAccounts = list; // 如果获取失败,至少使用在线账号列表
+                return null;
 
             if (!string.IsNullOrEmpty(strategy_id))
             {

+ 14 - 2
molilian.core/Core/taoke/UnionParseCore/UnionParseCore.cs

@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Mvc;
 using System.Diagnostics;
 using System.Text.RegularExpressions;
+using System.Threading.Channels;
 using YunhuiKit;
 
 
@@ -27,7 +28,7 @@ namespace molilian.core
             return channel switch
             {
                 "wemeet" => await WemeetParseAsync(content, ip, oaid),
-                "bdpan" => PanParse(content, ip, oaid),
+                "bdpan" => await PanParseAsync(content, ip, oaid),
                 "jd" => await JdParseAsync(content, commerceType, ip, oaid, riskStrategy, launchScene, accountid, clickId),
                 "ks" => await KsParseAsync(content, commerceType, ip, oaid, accountid),
                 "dy" => await DyParseAsync(content, commerceType, ip, oaid),
@@ -79,8 +80,18 @@ namespace molilian.core
             }, result.success ? APIResultCodeEnum.OK : APIResultCodeEnum.NotAcceptable);
         }
 
-        public static APIResult PanParse(string content, string ip, string oaid)
+        public static async Task<ActionResult> PanParseAsync(string content, string ip, string oaid)
         {
+
+            string pattern = ".*(https://snsyun\\.baidu\\.com/sl/[A-Za-z0-9?=]+).*";
+            var regex = new Regex(pattern);
+            var match = regex.Match(content);
+            if (match.Success)
+            {
+                return await DeeplinkParseCore.ParseAsync(content, "bdpan", ip, oaid);
+            }
+
+
             var result = ToolParsePlus.GetFormattedObject(TkChannelEnum.bdpan, content, ip, oaid);
             content = content.UrlDecode();
             result.rawContent = content;
@@ -387,6 +398,7 @@ namespace molilian.core
                 result.accountId = account.id;
                 result.accountName = account.company;
 
+
                 alimama = new AlimamaPlus(account);
 
 

+ 2 - 1
molilian.core/Core/tool/TestParseCore.cs

@@ -6,7 +6,8 @@ namespace molilian.core
         public static List<string> _test_oaid = [
             "C712574A37194CC8AA2C94F4E94BF632069e05173327fe9168cc3829a5a22820",
             "E5519EE0E4724362BD71D42F8D5CD0200b57296c00ba6e16d2b0ff67abb97a87",
-            "8E61FDE9411443F9A3642A6ACAD42747EC7D424979CC9C51CB1670D630EE7D8F"
+            "8E61FDE9411443F9A3642A6ACAD42747EC7D424979CC9C51CB1670D630EE7D8F",
+            "FF29AB4ECA4E42A7A4E90DD266AE7B94c4e39ff01b38641d1738a7d57e83511b"
             ];
 
         public static bool InWhitelist(string ip, string oaid)

部分文件因文件數量過多而無法顯示