Selaa lähdekoodia

允许后台编辑配置项;
调整转链相关业务参数;
增加pdd签名接口;

dodo hold 2 vuotta sitten
vanhempi
sitoutus
29ba08633d

+ 72 - 0
molilian.api/Controllers/admin/ConfigController.cs

@@ -0,0 +1,72 @@
+using molilian.core;
+using dodohold.core;
+using Microsoft.AspNetCore.Mvc;
+using Org.BouncyCastle.Ocsp;
+using System.Text.Json;
+using System.Runtime.InteropServices;
+using TencentCloud.Scf.V20180416.Models;
+using Quartz.Impl.AdoJobStore.Common;
+using TencentCloud.Gaap.V20180529.Models;
+using System.Net;
+using TencentCloud.Ie.V20200304.Models;
+using TencentCloud.Soe.V20180724.Models;
+
+namespace molilian.api.Controllers
+{
+    [ApiController]
+    [MyAuthorize("admin")]
+    [Route("api/[controller]/[action]")]
+    public class ConfigController : ControllerBase
+    {
+        readonly IAuthorizationProvider provider = new AdminProvider();
+        protected IHttpContextAccessor _accessor;
+        public ConfigController(IHttpContextAccessor accessor)
+        {
+            _accessor = accessor;
+        }
+
+        [HttpGet]
+        public ActionResult get()
+        {
+            var data = new DBContext.Table("tk_config").Get<TkConfigDTO>("id>0", new { });
+            return new APIResult(new { data });
+        }
+
+
+        [HttpPost]
+        public async Task<ActionResult> Update([FromBody] TkConfigDTO form)
+        {
+            var clientIp = _accessor.HttpContext.GetUserIp();
+            var token = provider.Get(_accessor.HttpContext);
+
+
+            string content = "【3瓶】恩威万蓝莓叶黄素酯软糖儿童成人上班族如酸涩肿胀可服用,<z5TYWAblvTw >:// HU7709,打開/";
+            try
+            {
+                var arr = form.tk_whitelist_regular.Split('\n')
+                            .Where(line => !string.IsNullOrWhiteSpace(line))
+                            .ToList();
+
+                var arr2 = form.tk_blacklist_regular.Split('\n')
+                            .Where(line => !string.IsNullOrWhiteSpace(line))
+                            .ToList();
+                bool is_tao_token = AlimamaPlus.MatchRegexes(content, arr);
+                bool is_other = AlimamaPlus.MatchOtherInfo(content, arr2);
+            }
+            catch (Exception ex)
+            {
+                return new APIResult(new { msg = $"正则异常${ex.Message}", success = false });
+            }
+            using var conn = DBContext.GetOpenConnection();
+
+            var old = new DBContext.Table(conn, "tk_config").Get<TkConfigDTO>("id>0", new { });
+            int result = await conn.UpdateAsync<TkConfigDTO>(form);
+
+            string desc = ObjectComparer.PrintCompareToString(old, form).Trim();
+            OperationLogCore.LogOperation(token.AccessKey, clientIp, "config", old.Convert2Json(), desc);
+            EndPointCore.NotifyReload();
+            return new APIResult(new { msg = "更新成功", success = result > 0 });
+        }
+
+    }
+}

+ 106 - 71
molilian.api/Controllers/admin/TaobaoController.cs

@@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Mvc;
 using System.Text.Json;
 using System.Net;
 using static QRCoder.PayloadGenerator;
+using MySqlX.XDevAPI;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
 namespace molilian.api.Controllers
 {
     [ApiController]
@@ -21,9 +23,18 @@ namespace molilian.api.Controllers
         [HttpPost]
         public async Task<ActionResult> updateCookies([FromBody] JsonElement form)
         {
-            string cookie = form.Read<string>("cookie", string.Empty);
+            var clientIp = _accessor.HttpContext.GetUserIp();
+            var token = provider.Get(_accessor.HttpContext);
             string user_agent = _accessor.HttpContext.Request.UserAgent();
+
+
+            string cookie = form.Read<string>("cookie", string.Empty);
             var success = TkPoolCore.UpdateCookies(cookie, user_agent);
+            if (success)
+            {
+                //string desc = ObjectComparer.PrintCompareToString(old, form).Trim();
+                OperationLogCore.LogOperation(token.AccessKey, clientIp, "tk_pool:cookie", string.Empty, cookie);
+            }
             return new APIResult(new
             {
                 data = new { success, msg = success ? "更新成功" : "更新失败,请检查输入的cookie" },
@@ -34,6 +45,9 @@ namespace molilian.api.Controllers
         [HttpPost]
         public async Task<ActionResult> update([FromBody] JsonElement form)
         {
+            var clientIp = _accessor.HttpContext.GetUserIp();
+            var token = provider.Get(_accessor.HttpContext);
+
             int id = form.Read<int>("id", 0);
             string name = form.Read<string>("name", string.Empty);
             string val = form.Read<string>("val", string.Empty);
@@ -61,7 +75,13 @@ namespace molilian.api.Controllers
                     return new APIResult(new { data = new { success = false, msg = "更新失败,未授权操作" } });
             }
             bool success = result > 0;
-            if (success) await EndPointCore.NotifyReload(true);
+            if (success)
+            {
+                //string desc = ObjectComparer.PrintCompareToString(old, form).Trim();
+                OperationLogCore.LogOperation(token.AccessKey, clientIp, $"tk_pool:{name}", string.Empty, val);
+                await EndPointCore.NotifyReload(true);
+
+            }
             return new APIResult(new
             {
                 data = new { success, msg = success ? "更新成功" : "更新失败,请检查输入信息" },
@@ -139,7 +159,7 @@ namespace molilian.api.Controllers
 
             foreach (var item in result.List)
             {
-                item.current_amt = Math.Round(TkPoolCore.GetIncomeAmt(item.name), 2);
+                item.current_amt = Math.Round(TkPoolCore.GetIncomeAmt($"{item.id}"), 2);
                 item.cookies = string.Empty;
             }
             return new APIResult(new { data = result });
@@ -201,57 +221,68 @@ namespace molilian.api.Controllers
                 if (item.total_count == 0)
                 {
                     item.total_count = TkLogCore.GetTotal($":total:tb:{item.report_date:yyyyMMdd}");
-                    if (item.total_count == 0) continue;
-                    item.success_count = TkLogCore.GetTotal($":total:tb:success:{item.report_date:yyyyMMdd}");
-                    item.abandon_count = TkLogCore.GetTotal($":total:tb:放弃转链:{item.report_date:yyyyMMdd}");
                     if (item.total_count > 0)
                     {
-                        item.success_percentage = $"{item.success_count / (double)item.total_count * 100:f2}%";
-                        item.abandon_percentage = $"{item.abandon_count / (double)item.total_count * 100:f2}%";
+                        item.success_count = TkLogCore.GetTotal($":total:tb:success:{item.report_date:yyyyMMdd}");
+                        item.abandon_count = TkLogCore.GetTotal($":total:tb:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.total_count > 0)
+                        {
+                            item.success_percentage = $"{item.success_count / (double)item.total_count * 100:f2}%";
+                            item.abandon_percentage = $"{item.abandon_count / (double)item.total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.parse_total_count == 0)
                 {
                     item.parse_total_count = TkLogCore.GetTotal($":parse_total:tb:{item.report_date:yyyyMMdd}");
-                    if (item.parse_total_count == 0) continue;
-                    item.parse_success_count = TkLogCore.GetTotal($":parse_total:tb:success:{item.report_date:yyyyMMdd}");
-                    item.parse_abandon_count = TkLogCore.GetTotal($":parse_total:tb:放弃转链:{item.report_date:yyyyMMdd}");
                     if (item.parse_total_count > 0)
                     {
-                        item.parse_success_percentage = $"{item.parse_success_count / (double)item.parse_total_count * 100:f2}%";
-                        item.parse_abandon_percentage = $"{item.parse_abandon_count / (double)item.parse_total_count * 100:f2}%";
+                        item.parse_success_count = TkLogCore.GetTotal($":parse_total:tb:success:{item.report_date:yyyyMMdd}");
+                        item.parse_abandon_count = TkLogCore.GetTotal($":parse_total:tb:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.parse_total_count > 0)
+                        {
+                            item.parse_success_percentage = $"{item.parse_success_count / (double)item.parse_total_count * 100:f2}%";
+                            item.parse_abandon_percentage = $"{item.parse_abandon_count / (double)item.parse_total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.coupon_total_count == 0)
                 {
                     item.coupon_total_count = TkLogCore.GetTotal($":coupon_total:tb:{item.report_date:yyyyMMdd}");
-                    if (item.coupon_total_count == 0) continue;
-                    item.coupon_success_count = TkLogCore.GetTotal($":coupon_total:tb:success:{item.report_date:yyyyMMdd}");
-                    item.coupon_abandon_count = TkLogCore.GetTotal($":coupon_total:tb:放弃转链:{item.report_date:yyyyMMdd}");
                     if (item.coupon_total_count > 0)
                     {
-                        item.coupon_success_percentage = $"{item.coupon_success_count / (double)item.coupon_total_count * 100:f2}%";
-                        item.coupon_abandon_percentage = $"{item.coupon_abandon_count / (double)item.coupon_total_count * 100:f2}%";
+                        item.coupon_success_count = TkLogCore.GetTotal($":coupon_total:tb:success:{item.report_date:yyyyMMdd}");
+                        item.coupon_abandon_count = TkLogCore.GetTotal($":coupon_total:tb:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.coupon_total_count > 0)
+                        {
+                            item.coupon_success_percentage = $"{item.coupon_success_count / (double)item.coupon_total_count * 100:f2}%";
+                            item.coupon_abandon_percentage = $"{item.coupon_abandon_count / (double)item.coupon_total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.tool_total_count == 0)
                 {
                     item.tool_total_count = TkLogCore.GetTotal($":parse_total:tool:{item.report_date:yyyyMMdd}");
-                    if (item.tool_total_count == 0) continue;
-                    item.tool_success_count = TkLogCore.GetTotal($":parse_total:tool:success:{item.report_date:yyyyMMdd}");
-                    item.tool_abandon_count = TkLogCore.GetTotal($":parse_total:tool:放弃转链:{item.report_date:yyyyMMdd}");
-
                     if (item.tool_total_count > 0)
                     {
-                        item.tool_success_percentage = $"{item.tool_success_count / (double)item.tool_total_count * 100:f2}%";
-                        item.tool_abandon_percentage = $"{item.tool_abandon_count / (double)item.tool_total_count * 100:f2}%";
+                        item.tool_success_count = TkLogCore.GetTotal($":parse_total:tool:success:{item.report_date:yyyyMMdd}");
+                        item.tool_abandon_count = TkLogCore.GetTotal($":parse_total:tool:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.tool_total_count > 0)
+                        {
+                            item.tool_success_percentage = $"{item.tool_success_count / (double)item.tool_total_count * 100:f2}%";
+                            item.tool_abandon_percentage = $"{item.tool_abandon_count / (double)item.tool_total_count * 100:f2}%";
+                        }
+
                     }
                 }
             }
-            return new APIResult(new { data = result });
+            return new APIResult(new
+            {
+                data = result
+            });
         }
 
         [HttpPost]
@@ -322,62 +353,66 @@ namespace molilian.api.Controllers
                 if (item.total_count == 0)
                 {
                     item.total_count = TkLogCore.GetTotal($":total:{accountName}:{item.report_date:yyyyMMdd}");
-                    if (item.total_count == 0)
+                    if (item.total_count > 0)
                     {
                         //todo  过度用, 0613 跑两天就可以删掉
                         accountName = item.accountName;
                         item.total_count = TkLogCore.GetTotal($":total:{accountName}:{item.report_date:yyyyMMdd}");
                     }
-                    if (item.total_count == 0) continue;
-                    item.success_count = TkLogCore.GetTotal($":total:{accountName}:success:{item.report_date:yyyyMMdd}");
-                    item.abandon_count = TkLogCore.GetTotal($":total:{accountName}:放弃转链:{item.report_date:yyyyMMdd}");
-
                     if (item.total_count > 0)
                     {
-                        item.success_percentage = $"{item.success_count / (double)item.total_count * 100:f2}%";
-                        item.abandon_percentage = $"{item.abandon_count / (double)item.total_count * 100:f2}%";
+                        item.success_count = TkLogCore.GetTotal($":total:{accountName}:success:{item.report_date:yyyyMMdd}");
+                        item.abandon_count = TkLogCore.GetTotal($":total:{accountName}:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.total_count > 0)
+                        {
+                            item.success_percentage = $"{item.success_count / (double)item.total_count * 100:f2}%";
+                            item.abandon_percentage = $"{item.abandon_count / (double)item.total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.parse_total_count == 0)
                 {
                     item.parse_total_count = TkLogCore.GetTotal($":parse_total:{accountName}:{item.report_date:yyyyMMdd}");
-                    if (item.parse_total_count == 0) continue;
-                    item.parse_success_count = TkLogCore.GetTotal($":parse_total:{accountName}:success:{item.report_date:yyyyMMdd}");
-                    item.parse_abandon_count = TkLogCore.GetTotal($":parse_total:{accountName}:放弃转链:{item.report_date:yyyyMMdd}");
-
                     if (item.parse_total_count > 0)
                     {
-                        item.parse_success_percentage = $"{item.parse_success_count / (double)item.parse_total_count * 100:f2}%";
-                        item.parse_abandon_percentage = $"{item.parse_abandon_count / (double)item.parse_total_count * 100:f2}%";
+                        item.parse_success_count = TkLogCore.GetTotal($":parse_total:{accountName}:success:{item.report_date:yyyyMMdd}");
+                        item.parse_abandon_count = TkLogCore.GetTotal($":parse_total:{accountName}:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.parse_total_count > 0)
+                        {
+                            item.parse_success_percentage = $"{item.parse_success_count / (double)item.parse_total_count * 100:f2}%";
+                            item.parse_abandon_percentage = $"{item.parse_abandon_count / (double)item.parse_total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.coupon_total_count == 0)
                 {
                     item.coupon_total_count = TkLogCore.GetTotal($":coupon_total:{accountName}:{item.report_date:yyyyMMdd}");
-                    if (item.coupon_total_count == 0) continue;
-                    item.coupon_success_count = TkLogCore.GetTotal($":coupon_total:{accountName}:success:{item.report_date:yyyyMMdd}");
-                    item.coupon_abandon_count = TkLogCore.GetTotal($":coupon_total:{accountName}:放弃转链:{item.report_date:yyyyMMdd}");
-
                     if (item.coupon_total_count > 0)
                     {
-                        item.coupon_success_percentage = $"{item.coupon_success_count / (double)item.coupon_total_count * 100:f2}%";
-                        item.coupon_abandon_percentage = $"{item.coupon_abandon_count / (double)item.coupon_total_count * 100:f2}%";
+                        item.coupon_success_count = TkLogCore.GetTotal($":coupon_total:{accountName}:success:{item.report_date:yyyyMMdd}");
+                        item.coupon_abandon_count = TkLogCore.GetTotal($":coupon_total:{accountName}:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.coupon_total_count > 0)
+                        {
+                            item.coupon_success_percentage = $"{item.coupon_success_count / (double)item.coupon_total_count * 100:f2}%";
+                            item.coupon_abandon_percentage = $"{item.coupon_abandon_count / (double)item.coupon_total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.tool_total_count == 0)
                 {
                     item.tool_total_count = TkLogCore.GetTotal($":parse_total:tool:{item.report_date:yyyyMMdd}");
-                    if (item.tool_total_count == 0) continue;
-                    item.tool_success_count = TkLogCore.GetTotal($":parse_total:tool:success:{item.report_date:yyyyMMdd}");
-                    item.tool_abandon_count = TkLogCore.GetTotal($":parse_total:tool:放弃转链:{item.report_date:yyyyMMdd}");
-
                     if (item.tool_total_count > 0)
                     {
-                        item.tool_success_percentage = $"{item.tool_success_count / (double)item.tool_total_count * 100:f2}%";
-                        item.tool_abandon_percentage = $"{item.tool_abandon_count / (double)item.tool_total_count * 100:f2}%";
+                        item.tool_success_count = TkLogCore.GetTotal($":parse_total:tool:success:{item.report_date:yyyyMMdd}");
+                        item.tool_abandon_count = TkLogCore.GetTotal($":parse_total:tool:放弃转链:{item.report_date:yyyyMMdd}");
+                        if (item.tool_total_count > 0)
+                        {
+                            item.tool_success_percentage = $"{item.tool_success_count / (double)item.tool_total_count * 100:f2}%";
+                            item.tool_abandon_percentage = $"{item.tool_abandon_count / (double)item.tool_total_count * 100:f2}%";
+                        }
                     }
                 }
             }
@@ -453,7 +488,6 @@ namespace molilian.api.Controllers
                     if (item.total_count == 0) continue;
                     item.success_count = TkLogCore.GetTotal($":total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
                     item.abandon_count = TkLogCore.GetTotal($":total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
-
                     if (item.total_count > 0)
                     {
                         item.success_percentage = $"{item.success_count / (double)item.total_count * 100:f2}%";
@@ -464,44 +498,45 @@ namespace molilian.api.Controllers
                 if (item.parse_total_count == 0)
                 {
                     item.parse_total_count = TkLogCore.GetTotal($":parse_total:{accountName}:{item.report_date:yyyyMMddHH}");
-                    if (item.parse_total_count == 0) continue;
-                    item.parse_success_count = TkLogCore.GetTotal($":parse_total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
-                    item.parse_abandon_count = TkLogCore.GetTotal($":parse_total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
-
                     if (item.parse_total_count > 0)
                     {
-                        item.parse_success_percentage = $"{item.parse_success_count / (double)item.parse_total_count * 100:f2}%";
-                        item.parse_abandon_percentage = $"{item.parse_abandon_count / (double)item.parse_total_count * 100:f2}%";
+                        item.parse_success_count = TkLogCore.GetTotal($":parse_total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
+                        item.parse_abandon_count = TkLogCore.GetTotal($":parse_total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
+                        if (item.parse_total_count > 0)
+                        {
+                            item.parse_success_percentage = $"{item.parse_success_count / (double)item.parse_total_count * 100:f2}%";
+                            item.parse_abandon_percentage = $"{item.parse_abandon_count / (double)item.parse_total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.coupon_total_count == 0)
                 {
                     item.coupon_total_count = TkLogCore.GetTotal($":coupon_total:{accountName}:{item.report_date:yyyyMMddHH}");
-
-                    if (item.coupon_total_count == 0) continue;
-                    item.coupon_success_count = TkLogCore.GetTotal($":coupon_total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
-                    item.coupon_abandon_count = TkLogCore.GetTotal($":coupon_total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
-
                     if (item.coupon_total_count > 0)
                     {
-                        item.coupon_success_percentage = $"{item.coupon_success_count / (double)item.coupon_total_count * 100:f2}%";
-                        item.coupon_abandon_percentage = $"{item.coupon_abandon_count / (double)item.coupon_total_count * 100:f2}%";
+                        item.coupon_success_count = TkLogCore.GetTotal($":coupon_total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
+                        item.coupon_abandon_count = TkLogCore.GetTotal($":coupon_total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
+                        if (item.coupon_total_count > 0)
+                        {
+                            item.coupon_success_percentage = $"{item.coupon_success_count / (double)item.coupon_total_count * 100:f2}%";
+                            item.coupon_abandon_percentage = $"{item.coupon_abandon_count / (double)item.coupon_total_count * 100:f2}%";
+                        }
                     }
                 }
 
                 if (item.tool_total_count == 0)
                 {
                     item.tool_total_count = TkLogCore.GetTotal($":tool_total:{accountName}:{item.report_date:yyyyMMddHH}");
-
-                    if (item.tool_total_count == 0) continue;
-                    item.tool_success_count = TkLogCore.GetTotal($":tool_total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
-                    item.tool_abandon_count = TkLogCore.GetTotal($":tool_total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
-
                     if (item.tool_total_count > 0)
                     {
-                        item.tool_success_percentage = $"{item.tool_success_count / (double)item.tool_total_count * 100:f2}%";
-                        item.tool_abandon_percentage = $"{item.tool_abandon_count / (double)item.tool_total_count * 100:f2}%";
+                        item.tool_success_count = TkLogCore.GetTotal($":tool_total:{item.accountName}:success:{item.report_date:yyyyMMddHH}");
+                        item.tool_abandon_count = TkLogCore.GetTotal($":tool_total:{item.accountName}:放弃转链:{item.report_date:yyyyMMddHH}");
+                        if (item.tool_total_count > 0)
+                        {
+                            item.tool_success_percentage = $"{item.tool_success_count / (double)item.tool_total_count * 100:f2}%";
+                            item.tool_abandon_percentage = $"{item.tool_abandon_count / (double)item.tool_total_count * 100:f2}%";
+                        }
                     }
                 }
             }

+ 51 - 13
molilian.api/Controllers/public/H5Controller.cs

@@ -9,6 +9,7 @@ using System.Security.Cryptography;
 using Microsoft.AspNetCore.Authentication;
 using TencentCloud.Ecm.V20190719.Models;
 using Dataoke;
+using System.Web;
 
 namespace molilian.api.Controllers
 {
@@ -58,22 +59,59 @@ namespace molilian.api.Controllers
             });
         }
 
-        /*
+        [HttpPost]
+        public ActionResult ddsign([FromBody] JsonElement form)
+        {
 
-                var api = DataokeCore.GetOne();
-                if (api == null)
+            var api = PddPoolCore.GetOne();
+            if (api == null)
+            {
+                return new APIResult(new
                 {
-                    result.success = false;
-                    result.message = "内部错误";
-                    result.reason = "没有匹配账号"; 
-                    result.rawContent = content;
-                    result.rawContent2 = content2;
-                    TkLogCore.Log(result);
-                    return new APIResult(result);
-                } 
-                result = DataokeCore.JdParse(result, api, account, content);
+                    success = false,
+                    message = "没有可用签名账户"
+                });
             }
-         */
 
+            string ts = DateTime.Now.Convert2UnixTimestamp().ToString();
+            string url = $"https://gw-api.pinduoduo.com/api/router";
+
+            Dictionary<string, string> args = new Dictionary<string, string>
+            {
+                { "client_id", api.app_key },
+                { "timestamp", ts }
+            };
+
+            // 提取客户端的业务参数并排除 "client_id" 和 "timestamp"
+            foreach (JsonProperty prop in form.EnumerateObject())
+            {
+                if (prop.Name != "client_id" && prop.Name != "timestamp")
+                {
+                    args.Add(prop.Name, prop.Value.GetString());
+                }
+            }
+
+
+            ////其他业务参数接收客户端的form,记得排除client_id 和 timestamp
+            //args.Add("type", "pdd.ddk.goods.recommend.get");
+            //args.Add("data_type", "JSON");
+            //args.Add("custom_parameters", "5");
+
+
+            args = PddPoolCore.GenerateSignature(api, args);
+            string queryString = string.Join("&", args.Select(kv => $"{HttpUtility.UrlEncode(kv.Key)}={HttpUtility.UrlEncode(kv.Value)}"));
+            string sign_url = $"{url}?{queryString}";
+            return new APIResult(new
+            {
+                success = true,
+                message = "ok",
+                sign_url
+            });
+
+            //WebClientUtility client = new WebClientUtility();
+            //var response = client.Request(url);
+            //var body = response.Body();
+            //return Content(body);
+        }
     }
 }

+ 4 - 1
molilian.api/Controllers/public/TaskController.cs

@@ -247,7 +247,7 @@ namespace molilian.api.Controllers
         }
 
         [HttpGet]
-        public ActionResult FastReport()
+        public async Task<ActionResult> FastReport()
         {
             var list = TkPoolCore.List();
             if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
@@ -274,6 +274,8 @@ namespace molilian.api.Controllers
                     continue;
                 }
             }
+            await EndPointCore.NotifyReload(true);
+
             return new APIResult(new { success = true, message = "ok" });
         }
 
@@ -382,6 +384,7 @@ namespace molilian.api.Controllers
             ApiAccountCore.Refresh();
             DataokeCore.Refresh();
             JdPoolCore.Refresh();
+            PddPoolCore.Refresh();
             PangolinPoolCore.Refresh();
 
             return new APIResult(new

+ 87 - 0
molilian.api/Controllers/public/TestController.cs

@@ -6,6 +6,9 @@ using System.Text.Json;
 using System.Runtime.InteropServices;
 using System.Net;
 using System.Threading;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using TencentCloud.Soe.V20180724.Models;
+using static dodohold.core.ZTOExpress.CreateOrderArgs;
 
 namespace molilian.api.Controllers
 {
@@ -33,6 +36,90 @@ namespace molilian.api.Controllers
             });
         }
 
+
+        [HttpPost]
+        public async Task<ActionResult> testreg([FromBody] JsonElement form)
+        {
+            var content = form.Read("s", string.Empty);
+
+            string shortLinkurl = AlimamaPlus.GetTaobaoLink(content);
+            bool is_tao_token = AlimamaPlus.MatchRegexes(content, []);
+            bool is_other = AlimamaPlus.MatchOtherInfo(content, []);
+
+            return new APIResult(new
+            {
+                shortLinkurl,
+                is_tao_token,
+                is_other
+            });
+
+
+        }
+        //[HttpGet]
+        //public async Task<ActionResult> comparison_tk([FromQuery] int count = 100)
+        //{
+        //    string cacheKey = ":lock_key:comparison_tk_logs";
+        //    int last_id = RedisHelper.Get<int>(cacheKey);
+
+        //    string filter = "id>@last_id";
+        //    var result = new DBContext.Table("comparison_tk_logs")
+        //        .Where(filter, new { last_id })
+        //        .Page(count, 1)
+        //        .Order("ID")
+        //        .PageList<TkDataDTO>(false);
+
+        //    var ip = "127.0.0.1";
+        //    var oaid = "test-comparison_tk_logs";
+        //    foreach (var item in result.List)
+        //    {
+        //        await UnionParseCore.TaobaoParseAsync(item.rawContent, ip, oaid);
+        //        RedisHelper.Set(cacheKey, item.id, 10 * 86400);
+        //    }
+        //    if (result.Count < count)
+        //    {
+        //        cacheKey = ":lock_key:start_comparison_tk";
+        //        RedisHelper.Set(cacheKey, 1, 600);
+        //    }
+        //    return new APIResult(new
+        //    {
+        //        success = true,
+        //        message = "ok"
+        //    });
+        //}
+
+        //[HttpGet]
+        //public async Task<ActionResult> comparison_tk_raw([FromQuery] int count = 100)
+        //{
+        //    string cacheKey = ":lock_key:comparison_tk_logs_raw";
+        //    int last_id = RedisHelper.Get<int>(cacheKey);
+
+        //    string filter = "id>@last_id";
+        //    var result = new DBContext.Table("comparison_tk_logs")
+        //        .Where(filter, new { last_id })
+        //        .Page(count, 1)
+        //        .Order("ID")
+        //        .PageList<TkDataDTO>(false);
+
+        //    var ip = "127.0.0.1";
+        //    var oaid = "test-comparison_tk_logs_raw";
+        //    foreach (var item in result.List)
+        //    {
+        //        await UnionParseCore.TaobaoParseAsync(item.rawContent, ip, oaid);
+        //        RedisHelper.Set(cacheKey, item.id, 10 * 86400);
+        //    }
+        //    if (result.Count < count)
+        //    {
+        //        cacheKey = ":lock_key:start_comparison_tk";
+        //        RedisHelper.Set(cacheKey, 1, 600);
+        //    }
+        //    return new APIResult(new
+        //    {
+        //        success = true,
+        //        message = "ok"
+        //    });
+        //}
+
+
         [HttpGet]
         public async Task<ActionResult> testTask()
         {

+ 2 - 1
molilian.api/Controllers/public/TkController.cs

@@ -246,6 +246,7 @@ namespace molilian.api.Controllers
                 }
 
                 result.accountId = account.id;
+                result.accountName = account.company;
                 account_name = account.name;
                 alimama = new AlimamaPlus(account);
 
@@ -286,7 +287,7 @@ namespace molilian.api.Controllers
                     //.SaveAsync();
                     NotifyCore.Notify(new NifyMessage
                     {
-                        message = $"【转链接口异常】{account_name}\n{content}\n{content2}\n{body}\n\n{ex.Message}\n{ex.StackTrace}",
+                        message = $"【转链接口异常】{result.accountName}\n{content}\n{content2}\n{body}\n\n{ex.Message}\n{ex.StackTrace}",
                         priority = NifyMessagePriority.high,
                         tags = ["red_circle"]
                     });

+ 12 - 0
molilian.api/Dockerfile

@@ -6,6 +6,12 @@ WORKDIR /app
 EXPOSE 8080
 EXPOSE 8081
 
+# 设置区域设置和字符编码
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+
+
 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
 ARG BUILD_CONFIGURATION=Release
 WORKDIR /src
@@ -23,6 +29,12 @@ FROM base AS final
 WORKDIR /app
 COPY --from=publish /app/publish .
 
+
+# 设置区域设置和字符编码
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+
 # 设置时区
 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 RUN echo "Asia/Shanghai" > /etc/timezone

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
molilian.api/Properties/PublishProfiles/https___ccr.ccs.tencentyun.com_shaobin.pubxml.user


+ 1 - 1
molilian.api/molilian.api.csproj

@@ -9,7 +9,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="dodohold.core" Version="1.0.1.12" />
+    <PackageReference Include="dodohold.core" Version="1.0.1.13" />
     <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.0-Preview.1" />
     <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
   </ItemGroup>

+ 49 - 0
molilian.core/Core/admin/OperationLogCore.cs

@@ -0,0 +1,49 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using dodohold.core;
+using Dataoke;
+
+
+namespace molilian.core
+{
+    [Table("admin_logs")]
+    public class OperationLog
+    {
+        [Key]
+        public int Id { get; set; }
+        public string Operator { get; set; } = string.Empty;
+        public string OperatorIp { get; set; } = string.Empty;
+        public string TargetObject { get; set; } = string.Empty;
+        public string BeforeValue { get; set; } = string.Empty;
+        public string ChangeValue { get; set; } = string.Empty;
+        public DateTime OperationTime { get; set; } = DateTime.Now;
+    }
+    public partial class OperationLogCore
+    {
+
+        public static void LogOperation(string operatorName, string operatorIp, string targetObject,
+            string beforeValue, string changeValue)
+        {
+            var log = new OperationLog
+            {
+                Operator = operatorName,
+                OperatorIp = operatorIp,
+                TargetObject = targetObject,
+                BeforeValue = beforeValue,
+                ChangeValue = changeValue,
+                OperationTime = DateTime.Now
+            };
+
+            using var conn = DBContext.GetOpenConnection();
+            conn.Insert(log);
+        }
+
+    }
+
+
+}

+ 101 - 0
molilian.core/Core/taoke/PddPoolCore.cs

@@ -0,0 +1,101 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using dodohold.core;
+using Dataoke;
+using Google.Protobuf.WellKnownTypes;
+using System.Diagnostics;
+using System.Text.Json;
+using TencentCloud.Tcm.V20210413.Models;
+using System.Security.Cryptography;
+
+
+namespace molilian.core
+{
+    public partial class PddPoolCore
+    {
+        private static readonly object _lockObj = new();
+        private static IEnumerable<PddPoolDTO> _cached;
+        public static PddPoolDTO? GetOne()
+        {
+            var list = List();
+            if (!list.Any()) return null;
+            return list.OrderBy(l => Guid.NewGuid()).FirstOrDefault();
+        }
+
+        public static IEnumerable<PddPoolDTO> List(bool force = false)
+        {
+            if (!force && _cached != null) return _cached;
+
+            string cache_key = $"cache:pdd_pool";
+            var list = RedisHelper.Get<IEnumerable<PddPoolDTO>>(cache_key);
+            if (force || list == null)
+            {
+                lock (_lockObj)
+                {
+                    list = new DBContext.Table("pdd_pool")
+                        .Where("status=@status", new { status = 1 })
+                        .Select<PddPoolDTO>();
+                    if (list == null) return default;
+                    RedisHelper.Set(cache_key, list, 30 * 86400);
+                }
+            }
+            _cached = list;
+            return list;
+        }
+        public static void Refresh()
+        {
+            _ = List(true);
+        }
+
+        public static void Disabled(string name)
+        {
+            string cache_key = $"cache:pdd_pool:{name}:disabled";
+            long count = RedisHelper.IncrBy(cache_key);
+            RedisHelper.Expire(cache_key, 10);
+            if (count > 1) return;
+
+            new DBContext.Table("pdd_pool")
+                .Add("status", 0)
+                .Where("name=@name", new { name })
+                .Update();
+            _ = List(true);
+
+            NotifyCore.Notify(new NifyMessage
+            {
+                message = $"【多多:{name}】调用异常",
+                priority = NifyMessagePriority.high,
+                tags = ["red_circle"]
+            });
+        }
+
+
+        public static Dictionary<string, string> GenerateSignature(PddPoolDTO account, Dictionary<string, string> args)
+        {
+            if (args.ContainsKey("sign")) args.Remove("sign");
+            // 对参数进行ASCII升序排序
+            var sortedArgs = args.OrderBy(kv => kv.Key).ToDictionary(kv => kv.Key, kv => kv.Value);
+
+            // 拼接排序后的参数
+            StringBuilder stringBuilder = new StringBuilder();
+            foreach (var kv in sortedArgs)
+            {
+                stringBuilder.Append(kv.Key).Append(kv.Value);
+            }
+
+            // 在头部和尾部分别拼接client_secret
+            string signString = account.app_secret + stringBuilder.ToString() + account.app_secret;
+            signString = signString.MD5(false, false);
+
+            if (!args.TryAdd("sign", signString))
+            {
+                args["sign"] = signString;
+            }
+            return args;
+        }
+    }
+}

+ 100 - 159
molilian.core/Core/taoke/TkLogCore.cs

@@ -14,6 +14,9 @@ using System.Xml.Linq;
 using static QRCoder.PayloadGenerator;
 using TencentCloud.Ssl.V20191205.Models;
 using CSRedis;
+using System.Data;
+using TencentCloud.Omics.V20221128.Models;
+using TencentCloud.Csip.V20221121.Models;
 
 
 namespace molilian.core
@@ -41,6 +44,63 @@ namespace molilian.core
             return result.Sum();
         }
 
+        private static int save_tk_log(TkDataDTO data, string tablename, IDbConnection connection, IDbTransaction transaction)
+        {
+            return new DBContext.Table(connection, tablename)
+                  .Add("end_point", data.end_point)
+                  .Add("channel", (int)data.channel)
+                  .Add("accountId", data.accountId)
+                  .Add("accountName", data.accountName)
+                  .Add("rawContent", data.rawContent)
+                  .Add("rawContent2", data.rawContent2)
+                  .Add("success", data.success)
+                  .Add("message", data.message)
+                  .Add("reason", data.reason)
+                  .Add("content", data.content)
+                  .Add("couponAmount", data.couponAmount)
+                  .Add("itemId", data.itemId)
+                  .Add("itemName", data.itemName)
+                  .Add("pic", data.pic)
+                  .Add("promotionPrice", data.promotionPrice)
+                  .Add("taoToken", data.taoToken)
+                  .Add("shortLinkurl", data.shortLinkurl)
+                  .Add("deeplink_url", data.deeplink_url)
+                  .Add("num_iid", data.num_iid)
+                  .Add("elapsedTime", data.elapsedTime)
+                  .Add("ip", data.ip)
+                  .Add("oaid", data.oaid)
+                  .Add("create_time", data.create_time)
+                  .Create(DBContext.InsertType.NORMAL, transaction);
+        }
+        private static int save_tk_parse_logs(TkDataDTO data, string tablename, IDbConnection connection, IDbTransaction transaction)
+        {
+            return new DBContext.Table(connection, tablename)
+                .Add("end_point", data.end_point)
+                .Add("channel", (int)data.channel)
+                .Add("accountId", data.accountId)
+                .Add("accountName", data.accountName)
+                .Add("rawContent", data.rawContent)
+                .Add("success", data.success)
+                .Add("message", data.message)
+                .Add("reason", data.reason)
+                .Add("content", data.content)
+                .Add("itemId", data.itemId)
+                .Add("itemName", data.itemName)
+                .Add("pic", data.pic)
+                .Add("couponAmount", data.couponAmount)
+                .Add("promotionPrice", data.promotionPrice)
+                .Add("taoToken", data.taoToken)
+                .Add("shortLinkurl", data.shortLinkurl)
+                .Add("deeplink_url", data.deeplink_url)
+                .Add("num_iid", data.num_iid)
+                .Add("elapsedTime", data.elapsedTime)
+                .Add("elapsedTime2", data.elapsedTime2)
+                .Add("elapsedTime3", data.elapsedTime3)
+                .Add("ip", data.ip)
+                .Add("oaid", data.oaid)
+                .Add("create_time", data.create_time)
+                .Create(DBContext.InsertType.NORMAL, transaction);
+        }
 
         public static int BatchInsertLogDB(int limit, CSRedisClient redis)
         {
@@ -48,6 +108,12 @@ namespace molilian.core
             using var connection = DBContext.GetOpenConnection();
             connection.Open();
             using var transaction = connection.BeginTransaction();
+
+
+            string cacheKey = ":lock_key:start_comparison_tk";
+            bool start_comparison_tk = RedisHelper.Get<int>(cacheKey) > 0;
+
+
             try
             {
                 for (int i = 0; i < limit; i++)
@@ -56,88 +122,22 @@ namespace molilian.core
                     if (data == null) break;
                     if ("127.0.0.1".Equals(data.ip) || data.elapsedTime > 2000)
                     {
-                        new DBContext.Table(connection, "tk_logs_test")
-                            .Add("end_point", data.end_point)
-                            .Add("channel", (int)data.channel)
-                            .Add("accountId", data.accountId)
-                            .Add("accountName", data.accountName)
-                            .Add("rawContent", data.rawContent)
-                            .Add("rawContent2", data.rawContent2)
-                            .Add("success", data.success)
-                            .Add("message", data.message)
-                            .Add("reason", data.reason)
-                            .Add("content", data.content)
-                            .Add("couponAmount", data.couponAmount)
-                            .Add("itemId", data.itemId)
-                            .Add("itemName", data.itemName)
-                            .Add("pic", data.pic)
-                            .Add("promotionPrice", data.promotionPrice)
-                            .Add("taoToken", data.taoToken)
-                            .Add("shortLinkurl", data.shortLinkurl)
-                            .Add("deeplink_url", data.deeplink_url)
-                            .Add("num_iid", data.num_iid)
-                            .Add("elapsedTime", data.elapsedTime)
-                            .Add("ip", data.ip)
-                            .Add("oaid", data.oaid)
-                            .Add("create_time", data.create_time)
-                            .Create(DBContext.InsertType.NORMAL, transaction);
+                        save_tk_log(data, "tk_logs_test", connection, transaction);
                     }
                     else
                     {
-                        data.id = new DBContext.Table(connection, "tk_logs")
-                            .Add("end_point", data.end_point)
-                            .Add("channel", (int)data.channel)
-                            .Add("accountId", data.accountId)
-                            .Add("accountName", data.accountName)
-                            .Add("rawContent", data.rawContent)
-                            .Add("rawContent2", data.rawContent2)
-                            .Add("success", data.success)
-                            .Add("message", data.message)
-                            .Add("reason", data.reason)
-                            .Add("content", data.content)
-                            .Add("couponAmount", data.couponAmount)
-                            .Add("itemId", data.itemId)
-                            .Add("itemName", data.itemName)
-                            .Add("pic", data.pic)
-                            .Add("promotionPrice", data.promotionPrice)
-                            .Add("taoToken", data.taoToken)
-                            .Add("shortLinkurl", data.shortLinkurl)
-                            .Add("deeplink_url", data.deeplink_url)
-                            .Add("num_iid", data.num_iid)
-                            .Add("elapsedTime", data.elapsedTime)
-                            .Add("ip", data.ip)
-                            .Add("oaid", data.oaid)
-                            .Add("create_time", data.create_time)
-                            .Create(DBContext.InsertType.NORMAL, transaction);
-
+                        data.id = save_tk_log(data, "tk_logs", connection, transaction);
                         if (data.success)
                         {
-                            new DBContext.Table(connection, "tk_success_logs")
-                                .Add("end_point", data.end_point)
-                                .Add("channel", (int)data.channel)
-                                .Add("accountId", data.accountId)
-                                .Add("accountName", data.accountName)
-                                .Add("rawContent", data.rawContent)
-                                .Add("rawContent2", data.rawContent2)
-                                .Add("success", data.success)
-                                .Add("message", data.message)
-                                .Add("reason", data.reason)
-                                .Add("content", data.content)
-                                .Add("couponAmount", data.couponAmount)
-                                .Add("itemId", data.itemId)
-                                .Add("itemName", data.itemName)
-                                .Add("pic", data.pic)
-                                .Add("promotionPrice", data.promotionPrice)
-                                .Add("taoToken", data.taoToken)
-                                .Add("shortLinkurl", data.shortLinkurl)
-                                .Add("deeplink_url", data.deeplink_url)
-                                .Add("num_iid", data.num_iid)
-                                .Add("elapsedTime", data.elapsedTime)
-                                .Add("ip", data.ip)
-                                .Add("oaid", data.oaid)
-                                .Add("create_time", data.create_time)
-                                .Create(DBContext.InsertType.NORMAL, transaction);
+                            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);
                     }
 
@@ -173,100 +173,41 @@ 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 ("127.0.0.1".Equals(data.ip) || data.elapsedTime > 2000)
                     {
-                        new DBContext.Table(connection, "tk_parse_logs_test")
-                            .Add("end_point", data.end_point)
-                            .Add("channel", (int)data.channel)
-                            .Add("accountId", data.accountId)
-                            .Add("accountName", data.accountName)
-                            .Add("rawContent", data.rawContent)
-                            .Add("success", data.success)
-                            .Add("message", data.message)
-                            .Add("reason", data.reason)
-                            .Add("content", data.content)
-                            .Add("itemId", data.itemId)
-                            .Add("itemName", data.itemName)
-                            .Add("pic", data.pic)
-                            .Add("couponAmount", data.couponAmount)
-                            .Add("promotionPrice", data.promotionPrice)
-                            .Add("taoToken", data.taoToken)
-                            .Add("shortLinkurl", data.shortLinkurl)
-                            .Add("deeplink_url", data.deeplink_url)
-                            .Add("num_iid", data.num_iid)
-                            .Add("elapsedTime", data.elapsedTime)
-                            .Add("elapsedTime2", data.elapsedTime2)
-                            .Add("elapsedTime3", data.elapsedTime3)
-                            .Add("ip", data.ip)
-                            .Add("oaid", data.oaid)
-                            .Add("create_time", data.create_time)
-                            .Create(DBContext.InsertType.NORMAL, transaction);
+                        save_tk_parse_logs(data, "tk_parse_logs_test", connection, transaction);
 
                     }
                     else
                     {
-
-                        data.id = new DBContext.Table(connection, "tk_parse_logs")
-                        .Add("end_point", data.end_point)
-                        .Add("channel", (int)data.channel)
-                        .Add("accountId", data.accountId)
-                        .Add("accountName", data.accountName)
-                        .Add("rawContent", data.rawContent)
-                        .Add("success", data.success)
-                        .Add("message", data.message)
-                        .Add("reason", data.reason)
-                        .Add("content", data.content)
-                        .Add("itemId", data.itemId)
-                        .Add("itemName", data.itemName)
-                        .Add("pic", data.pic)
-                        .Add("couponAmount", data.couponAmount)
-                        .Add("promotionPrice", data.promotionPrice)
-                        .Add("taoToken", data.taoToken)
-                        .Add("shortLinkurl", data.shortLinkurl)
-                        .Add("deeplink_url", data.deeplink_url)
-                        .Add("num_iid", data.num_iid)
-                        .Add("elapsedTime", data.elapsedTime)
-                        .Add("elapsedTime2", data.elapsedTime2)
-                        .Add("elapsedTime3", data.elapsedTime3)
-                        .Add("ip", data.ip)
-                        .Add("oaid", data.oaid)
-                        .Add("create_time", data.create_time)
-                        .Create(DBContext.InsertType.NORMAL, transaction);
-
+                        data.id = save_tk_parse_logs(data, "tk_parse_logs", connection, transaction);
                         if (data.success)
                         {
-                            new DBContext.Table(connection, "tk_success_parse_logs")
-                                .Add("end_point", data.end_point)
-                                .Add("channel", (int)data.channel)
-                                .Add("accountId", data.accountId)
-                                .Add("accountName", data.accountName)
-                                .Add("rawContent", data.rawContent)
-                                .Add("success", data.success)
-                                .Add("message", data.message)
-                                .Add("reason", data.reason)
-                                .Add("content", data.content)
-                                .Add("itemId", data.itemId)
-                                .Add("itemName", data.itemName)
-                                .Add("pic", data.pic)
-                                .Add("couponAmount", data.couponAmount)
-                                .Add("promotionPrice", data.promotionPrice)
-                                .Add("taoToken", data.taoToken)
-                                .Add("shortLinkurl", data.shortLinkurl)
-                                .Add("deeplink_url", data.deeplink_url)
-                                .Add("num_iid", data.num_iid)
-                                .Add("elapsedTime", data.elapsedTime)
-                                .Add("elapsedTime2", data.elapsedTime2)
-                                .Add("elapsedTime3", data.elapsedTime3)
-                                .Add("ip", data.ip)
-                                .Add("oaid", data.oaid)
-                                .Add("create_time", data.create_time)
-                                .Create(DBContext.InsertType.NORMAL, transaction);
+                            save_tk_parse_logs(data, "tk_success_parse_logs", 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);
+                    }
                     total++;
                 }
 
+
                 for (int i = 0; i < limit; i++)
                 {
                     var data = redis.LPop<JdDataDTO>(queue_parse_jd_key);
@@ -414,7 +355,7 @@ namespace molilian.core
                                     (bool success, string message) = alimamaPlus.RenewCookie();
                                     if (success) return;
                                 }
-                                TkPoolCore.Disabled(response.accountName, $"{response.rawContent}\n{response.rawContent2}");
+                                TkPoolCore.Disabled(response.accountId, response.accountName, $"{response.rawContent}\n{response.rawContent2}");
                             });
                             break;
                     }
@@ -459,7 +400,7 @@ namespace molilian.core
                                     (bool success, string message) = alimamaPlus.RenewCookie();
                                     if (success) return;
                                 }
-                                TkPoolCore.Disabled(response.accountName, $"{response.rawContent}");
+                                TkPoolCore.Disabled(response.accountId, response.accountName, $"{response.rawContent}");
                             }); break;
                     }
                 }
@@ -494,7 +435,7 @@ namespace molilian.core
                                     (bool success, string message) = alimamaPlus.RenewCookie();
                                     if (success) return;
                                 }
-                                TkPoolCore.Disabled(response.accountName, $"{response.rawContent}");
+                                TkPoolCore.Disabled(response.accountId, response.accountName, $"{response.rawContent}");
                             }); break;
                     }
                 }

+ 39 - 23
molilian.core/Core/taoke/TkPoolCore.cs

@@ -57,7 +57,13 @@ namespace molilian.core
                 _incomeAmt.Add(key, income_amt);
             }
             string cache_key = $"cache:tk_pool:{key}:income_amt";
-            RedisHelper.Set(cache_key, income_amt, 3 * 86400);
+
+            var result = EndPointCore.ProcessEndPointNodes<bool>(node =>
+            {
+                if (!node.is_public_api) return true;
+                var redis = RedisClientManager.GetRedisClient(node.redis_server);
+                return redis.Set(cache_key, income_amt, 3 * 86400);
+            });
         }
         public static decimal GetIncomeAmt(string accountName)
         {
@@ -89,7 +95,7 @@ namespace molilian.core
             }
 
             if (item.daily_income_limit == 0) return true;
-            decimal income_amt = GetIncomeAmt(item.name);
+            decimal income_amt = GetIncomeAmt($"{item.id}");
             return income_amt < item.daily_income_limit;
         }
 
@@ -127,30 +133,36 @@ namespace molilian.core
             _ = List(true);
         }
 
-        public static void Disabled(string name, string content)
+        public static void Disabled(int accountId, string name, string content)
         {
 #if DEBUG
 #else
 #endif
-            string cache_key = $"cache:tk_pool:{name}:disabled";
+            string cache_key = $"cache:tk_pool:{accountId}:disabled";
             long count = RedisHelper.IncrBy(cache_key);
             RedisHelper.Expire(cache_key, 10);
             if (count > 1) return;
 
-            new DBContext.Table("tk_pool")
-                .Add("status", 0)
-                .Where("name=@name", new { name })
-                .Update();
+            var update = new DBContext.Table("tk_pool").Add("status", 0);
+            if (accountId > 0)
+            {
+                update.Where("id=@accountId", new { accountId }).Update();
+            }
+            else
+            {
+                update.Where("name=@name", new { name }).Update();
+            }
+
             _ = List(true);
 
             NotifyCore.Notify(new NifyMessage
             {
-                message = $"【淘宝联盟:{name}】cookie 掉线\n\n{content}",
+                message = $"【淘客{accountId}:{name}】cookie 掉线\n\n{content}",
                 priority = NifyMessagePriority.high,
                 tags = ["red_circle"]
             });
 
-            NotifyCore.AnPushNotify("掉线", $"【淘宝联盟:{name}】cookie 掉线");
+            NotifyCore.AnPushNotify("掉线", $"【淘客{accountId}:{name}】cookie 掉线");
             EndPointCore.NotifyReload(true);
         }
 
@@ -159,28 +171,32 @@ namespace molilian.core
             if (string.IsNullOrEmpty(cookies)) return false;
             cookies += ";";
             string dnk = cookies.GetContentPart("dnk=", ";");
+            string company = dnk;
+            int accountId = 0;
             string tb_token = cookies.GetContentPart("_tb_token_=", ";");
             if (string.IsNullOrEmpty(dnk) || string.IsNullOrEmpty(tb_token)) return false;
-            var exist = new DBContext.Table("tk_pool").Fields("id, name, refpid, status").Get<dynamic>("name=@dnk", new { dnk });
+            var exist = new DBContext.Table("tk_pool").Fields("id, name, company, refpid, status").Get<dynamic>("name=@dnk", new { dnk });
             if (exist != null)
             {
                 int status = exist.status;
                 string refpid = exist.refpid;
+                company = exist.company;
+                accountId = exist.id;
                 if (!string.IsNullOrEmpty(refpid)) status = 1;
                 new DBContext.Table("tk_pool")
-                    .Add("name", dnk)
-                    .Add("tb_token", tb_token)
-                    .Add("cookies", cookies)
-                    .Add("user_agent", user_agent)
-                    .Add("status", status)
-                    .Add("last_time", DateTime.Now)
-                    .Where("id=@id", new { exist.id })
-                    .Update();
+                   .Add("name", dnk)
+                   .Add("tb_token", tb_token)
+                   .Add("cookies", cookies)
+                   .Add("user_agent", user_agent)
+                   .Add("status", status)
+                   .Add("last_time", DateTime.Now)
+                   .Where("id=@id", new { exist.id })
+                   .Update();
                 if (status == 1) _ = List(true);
             }
             else
             {
-                new DBContext.Table("tk_pool")
+                accountId = new DBContext.Table("tk_pool")
                     .Add("name", dnk)
                     .Add("description", "由cookies上报创建此记录")
                     .Add("tb_token", tb_token)
@@ -195,7 +211,7 @@ namespace molilian.core
 
             NotifyCore.Notify(new NifyMessage
             {
-                message = $"【淘宝联盟:{dnk}】cookie 上线",
+                message = $"【淘客{accountId}:{company}】cookie 上线",
                 tags = ["green_circle"]
             });
             EndPointCore.NotifyReload(true);
@@ -211,11 +227,11 @@ namespace molilian.core
             RedisHelper.Expire(cache_key, 3600);
             NotifyCore.Notify(new NifyMessage
             {
-                message = $"【淘宝联盟】没有匹配账号",
+                message = $"【淘】没有匹配账号",
                 priority = NifyMessagePriority.high,
                 tags = ["red_circle"]
             });
-            NotifyCore.AnPushNotify("没账号", $"【淘宝联盟】没有匹配账号");
+            NotifyCore.AnPushNotify("没账号", $"【淘】没有匹配账号");
         }
     }
 

+ 104 - 444
molilian.core/Core/taoke/UnionParseCore.cs

@@ -18,6 +18,8 @@ using TencentCloud.Tcm.V20210413.Models;
 using System.Diagnostics;
 using System.Threading;
 using TencentCloud.Soe.V20180724.Models;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System.Runtime.Intrinsics.Arm;
 
 
 namespace molilian.core
@@ -27,6 +29,7 @@ namespace molilian.core
 
         public static async Task<ActionResult> UnionParseAsync(string content, string channel, string ip, string oaid, int accountid = 0)
         {
+            content = content.Trim();
             return channel switch
             {
                 "wemeet" => await WemeetParseAsync(content, ip, oaid),
@@ -73,7 +76,7 @@ namespace molilian.core
                 result.shortLinkurl,
                 result.deeplink_url,
                 result.itemName,
-            });
+            }, result.success ? APIResultCodeEnum.OK : APIResultCodeEnum.NotAcceptable);
         }
 
         public static APIResult PanParse(string content, string ip, string oaid)
@@ -111,7 +114,7 @@ namespace molilian.core
                 result.shortLinkurl,
                 result.deeplink_url,
                 result.itemName,
-            }, result.success ? APIResultCodeEnum.OK : APIResultCodeEnum.NotAcceptable);
+            }, !string.IsNullOrEmpty(result.deeplink_url) ? APIResultCodeEnum.OK : APIResultCodeEnum.NotAcceptable);
         }
 
 
@@ -146,210 +149,74 @@ namespace molilian.core
             try
             {
                 string reason = string.Empty;
-                //============================== 放弃转链-地区过滤 ==============================
-                bool is_ignore2 = AlimamaPlus.ShouldIgnoreRequest(ip, oaid, out reason);
-
-                if (is_ignore2)
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.itemName = "点击打开淘宝APP";
-                    result.reason = reason;
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return TaobaoParseOutput(result, swData, new
-                    {
-                        result.success,
-                        result.message,
-                        result.content,
-                        result.itemName,
-                        result.deeplink_url,
-                    });
-                }
-
-
-
-
-                //============================== 放弃转链-初步筛选 ==============================
-                bool is_ignore = AlimamaPlus.FirstFilterIgnoreRequest(content, out reason);
-
-                if (string.IsNullOrEmpty(result.shortLinkurl) && is_ignore)
-                {
-
-                    //没有短链接都放弃
+                //============================== 放弃转链-平台错误 ==============================
+                //bool is_other = await AlimamaPlus.OtherPlatformAsync(content);
+                //if (is_other)
+                //{
+                //    result.success = false;
+                //    result.message = "放弃转链";
+                //    result.reason = "初步筛选";
+                //    result.itemName = "";
+                //    result.deeplink_url = "";
+
+                //    _ = TkLogCore.ParseLogAsync(result);
+                //    return TaobaoParseOutput(result, swData, new
+                //    {
+                //        result.success,
+                //        result.message,
+                //        result.content,
+                //        result.itemName,
+                //        result.deeplink_url,
+                //    });
+                //}
+
+
+
+                ////一眼要排除
+                //if (content.Contains("bmlxkyy.com"))
+                //{
+                //    result.success = false;
+                //    result.message = "放弃转链";
+                //    result.reason = "初步筛选";
+                //    result.itemName = "";
+                //    result.deeplink_url = "";
+
+                //    _ = TkLogCore.ParseLogAsync(result);
+                //    return TaobaoParseOutput(result, swData, new
+                //    {
+                //        result.success,
+                //        result.message,
+                //        result.content,
+                //        result.itemName,
+                //        result.deeplink_url,
+                //    });
+                //}
+
+                var config = TkConfigCore.Get();
+                var arr = config.tk_whitelist_regular.Split('\n')
+                    .Where(line => !string.IsNullOrWhiteSpace(line))
+                    .ToList();
+
+                var arr2 = config.tk_blacklist_regular.Split('\n')
+                    .Where(line => !string.IsNullOrWhiteSpace(line))
+                    .ToList();
+
+                bool is_tao_url = !string.IsNullOrEmpty(result.shortLinkurl);
+                bool is_tao_token = AlimamaPlus.MatchRegexes(content, arr);
+                bool is_other = AlimamaPlus.MatchOtherInfo(content, arr2);
+
+
+                //============================== 放弃转链-初步筛选1 ==============================
+                if (!is_tao_url && !is_tao_token || is_other)
+                {
+                    //没有链接都放弃
                     result.success = false;
                     result.message = "放弃转链";
-                    result.itemName = "点击打开淘宝APP";
-                    result.reason = "初步筛选";
+                    result.reason = "初步筛选1";
+                    result.itemName = "";
+                    result.deeplink_url = "";
                     _ = TkLogCore.ParseLogAsync(result);
 
-                    //0621 临时增加
-                    if (content.Contains("bmlxkyy.com"))
-                    {
-                        result.itemName = "";
-                        result.deeplink_url = "";
-                    }
-
-                    return TaobaoParseOutput(result, swData, new
-                    {
-                        result.success,
-                        result.message,
-                        result.content,
-                        result.itemName,
-                        result.deeplink_url,
-                    });
-                }
-
-                //============================== 放弃转链-没有匹配账号 ==============================
-                TkPoolDTO? account = accountid > 0 ?
-                    TkPoolCore.GetOne(accountid) :
-                    TkPoolCore.GetOne(TkPoolCore.TkAction.parse);
-                if (account == null)
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "没有匹配账号";
-                    result.itemName = "点击打开淘宝APP";
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return TaobaoParseOutput(result, swData, new
-                    {
-                        result.success,
-                        result.message,
-                        result.content,
-                        result.couponAmount,
-                        result.taoToken,
-                        result.shortLinkurl,
-                        result.deeplink_url,
-                    });
-                }
-                result.accountId = account.id;
-
-                alimama = new AlimamaPlus(account);
-                result.accountName = account.company;
-
-
-                int timeout = alimama._config.rt_max;
-                using var cts = new CancellationTokenSource();
-                cts.CancelAfter(timeout);
-
-
-                var requestTask = Task.Run(() => alimama.UnionParse2Async(content, result, cts.Token, swData), cts.Token);
-                var delayTask = Task.Delay(timeout, cts.Token);
-                var completedTask = await Task.WhenAny(requestTask, delayTask);
-                if (completedTask == requestTask)
-                {
-                    result = await requestTask;
-                }
-                else
-                {
-                    //============================== 放弃转链-请求超时 ==============================
-                    cts.Cancel();
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "请求超时";
-                    result.itemName = "点击打开淘宝APP";
-                }
-
-                result.accountName = account.company;
-                //result = await alimama.UnionParse2Async(content, result);
-            }
-            catch (Exception ex)
-            {
-                //============================== 放弃转链-请求超时 ==============================
-                if (ex.Message.Contains("was canceled"))
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "请求超时";
-                    result.itemName = "点击打开淘宝APP";
-                }
-                else
-                {
-                    //============================== 转链接口异常 ==============================
-                    _ = new LoggerLibrary("unionParse", "tb_error")
-                        .Info(ip, oaid)
-                        .Info(content)
-                        .Info(ex.Message, ex.StackTrace)
-                        .SaveAsync();
-
-                    NotifyCore.Notify(new NifyMessage
-                    {
-                        message = $"【转链异常TB】\n{content}\n\n{ex.Message}\n{ex.StackTrace}",
-                        priority = NifyMessagePriority.high,
-                        tags = ["red_circle"]
-                    });
-                    result.success = false;
-                    result.message = "转链接口异常";
-                    result.itemName = "点击打开淘宝APP";
-                }
-            }
-            _ = TkLogCore.ParseLogAsync(result, alimama);
-
-            return TaobaoParseOutput(result, swData, new
-            {
-                result.success,
-                result.message,
-                link_type = result.link_type.ToString(),
-                channel = result?.channel.ToString(),
-                result.channel_type,
-                result.itemId,
-                result.itemName,
-                result.pic,
-                result.promotionPrice,
-                result.couponAmount,
-                result.couponEffectiveStartTime,
-                result?.couponEffectiveEndTime,
-                result.shortLinkurl,
-                result.deeplink_url,
-                result.content,
-                result.taoToken,
-            });
-        }
-
-        public static async Task<APIResult> TaobaoParseAsync11(string content,
-            string ip = "", string oaid = "",
-            int accountid = 0)
-        {
-            AlimamaPlus alimama = null;
-            content = content.UrlDecode();
-            content = content[..Math.Min(1000, content.Length)];
-            var result = AlimamaPlus.GetFormattedObject(content, ip, oaid);
-
-            Dictionary<string, long> swData = new();
-            swData.Add("StartNew", 0);
-            Stopwatch stopwatch = Stopwatch.StartNew();
-
-            result.rawContent = content;
-            try
-            {
-                bool is_other = await AlimamaPlus.OtherPlatformAsync(content);
-                stopwatch.Stop();
-                swData.Add("OtherPlatform", stopwatch.ElapsedMilliseconds);
-
-                if (is_other)
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "平台错误";
-
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return TaobaoParseOutput(result, swData, new
-                    {
-                        channel = result?.channel.ToString(),
-                        result.success,
-                        result.message,
-                        result.shortLinkurl,
-                        result.deeplink_url,
-                    }, APIResultCodeEnum.NotAcceptable);
-                }
-
-
-                if (!string.IsNullOrEmpty(result.shortLinkurl) && result.shortLinkurl.Contains("bmlxkyy.com"))
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.itemName = "点击打开淘宝APP";
-                    result.reason = "初步筛选";
-                    _ = TkLogCore.ParseLogAsync(result);
                     return TaobaoParseOutput(result, swData, new
                     {
                         result.success,
@@ -360,21 +227,18 @@ namespace molilian.core
                     });
                 }
 
-                stopwatch.Reset();
-                stopwatch.Start();
-                string reason = string.Empty;
-                bool is_ignore = AlimamaPlus.FirstFilterIgnoreRequest(content, out reason);
-                stopwatch.Stop();
-                swData.Add("FirstFilterIgnoreRequest", stopwatch.ElapsedMilliseconds);
-
-                if (string.IsNullOrEmpty(result.shortLinkurl) && is_ignore)
+                //============================== 放弃转链-初步筛选2 ==============================
+                bool is_aff_link = false;
+                if (!string.IsNullOrEmpty(result.shortLinkurl)) is_aff_link = AlimamaPlus.IsAffLink(result.shortLinkurl);
+                if ((!is_tao_url && is_tao_token) || is_aff_link)
                 {
                     //没有短链接都放弃
                     result.success = false;
                     result.message = "放弃转链";
+                    result.reason = "初步筛选2";
                     result.itemName = "点击打开淘宝APP";
-                    result.reason = "初步筛选";
                     _ = TkLogCore.ParseLogAsync(result);
+
                     return TaobaoParseOutput(result, swData, new
                     {
                         result.success,
@@ -385,15 +249,9 @@ namespace molilian.core
                     });
                 }
 
-
-                stopwatch.Reset();
-                stopwatch.Start();
+                //============================== 放弃转链-地区过滤 ==============================
                 bool is_ignore2 = AlimamaPlus.ShouldIgnoreRequest(ip, oaid, out reason);
-                stopwatch.Stop();
-                swData.Add("ShouldIgnoreRequest", stopwatch.ElapsedMilliseconds);
 
-#if DEBUG
-#else
                 if (is_ignore2)
                 {
                     result.success = false;
@@ -410,17 +268,33 @@ namespace molilian.core
                         result.deeplink_url,
                     });
                 }
-#endif
 
-                stopwatch.Reset();
-                stopwatch.Start();
+                ////============================== 放弃转链-初步筛选 ==============================
+                //bool is_ignore = AlimamaPlus.FirstFilterIgnoreRequest(content, out reason);
+
+                //if (string.IsNullOrEmpty(result.shortLinkurl) && is_ignore)
+                //{
+                //    //没有短链接都放弃
+                //    result.success = false;
+                //    result.message = "放弃转链";
+                //    result.itemName = "点击打开淘宝APP";
+                //    result.reason = "初步筛选";
+                //    _ = TkLogCore.ParseLogAsync(result);
+
+                //    return TaobaoParseOutput(result, swData, new
+                //    {
+                //        result.success,
+                //        result.message,
+                //        result.content,
+                //        result.itemName,
+                //        result.deeplink_url,
+                //    });
+                //}
+
+                //============================== 放弃转链-没有匹配账号 ==============================
                 TkPoolDTO? account = accountid > 0 ?
                     TkPoolCore.GetOne(accountid) :
                     TkPoolCore.GetOne(TkPoolCore.TkAction.parse);
-
-                stopwatch.Stop();
-                swData.Add("GetOne", stopwatch.ElapsedMilliseconds);
-
                 if (account == null)
                 {
                     result.success = false;
@@ -440,21 +314,15 @@ namespace molilian.core
                     });
                 }
                 result.accountId = account.id;
+                result.accountName = account.company;
 
-                stopwatch.Reset();
-                stopwatch.Start();
                 alimama = new AlimamaPlus(account);
-                result.accountName = account.company;
 
-                stopwatch.Stop();
-                swData.Add("AlimamaPlus", stopwatch.ElapsedMilliseconds);
 
                 int timeout = alimama._config.rt_max;
                 using var cts = new CancellationTokenSource();
                 cts.CancelAfter(timeout);
 
-                stopwatch.Reset();
-                stopwatch.Start();
 
                 var requestTask = Task.Run(() => alimama.UnionParse2Async(content, result, cts.Token, swData), cts.Token);
                 var delayTask = Task.Delay(timeout, cts.Token);
@@ -465,6 +333,7 @@ namespace molilian.core
                 }
                 else
                 {
+                    //============================== 放弃转链-请求超时 ==============================
                     cts.Cancel();
                     result.success = false;
                     result.message = "放弃转链";
@@ -472,13 +341,12 @@ namespace molilian.core
                     result.itemName = "点击打开淘宝APP";
                 }
 
-                stopwatch.Stop();
-                swData.Add("UnionParse2Async", stopwatch.ElapsedMilliseconds);
                 result.accountName = account.company;
                 //result = await alimama.UnionParse2Async(content, result);
             }
             catch (Exception ex)
             {
+                //============================== 放弃转链-请求超时 ==============================
                 if (ex.Message.Contains("was canceled"))
                 {
                     result.success = false;
@@ -488,6 +356,7 @@ namespace molilian.core
                 }
                 else
                 {
+                    //============================== 转链接口异常 ==============================
                     _ = new LoggerLibrary("unionParse", "tb_error")
                         .Info(ip, oaid)
                         .Info(content)
@@ -501,8 +370,7 @@ namespace molilian.core
                         tags = ["red_circle"]
                     });
                     result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "转链接口异常";
+                    result.message = "转链接口异常";
                     result.itemName = "点击打开淘宝APP";
                 }
             }
@@ -529,214 +397,6 @@ namespace molilian.core
             });
         }
 
-        public static async Task<APIResult> TaobaoParseAsync222(string content,
-            string ip = "", string oaid = "")
-        {
-            AlimamaPlus alimama = null;
-            content = content.UrlDecode();
-            content = content[..Math.Min(1000, content.Length)];
-            var result = AlimamaPlus.GetFormattedObject(content, ip, oaid);
-
-            LoggerLibrary log = new("debug", "stopwatch");
-            log.Info($"StartNew", content);
-            Stopwatch stopwatch = Stopwatch.StartNew();
-
-            result.rawContent = content;
-            try
-            {
-                bool is_other = await AlimamaPlus.OtherPlatformAsync(content);
-                stopwatch.Stop();
-                log.Info($"AlimamaPlus.OtherPlatform\t{stopwatch.ElapsedMilliseconds}");
-
-                if (is_other)
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "平台错误";
-
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return new APIResult(new
-                    {
-                        channel = result?.channel.ToString(),
-                        result.success,
-                        result.message,
-                        result.shortLinkurl,
-                        result.deeplink_url,
-                    }, APIResultCodeEnum.NotAcceptable);
-                }
-                if (string.IsNullOrEmpty(result.shortLinkurl) && AlimamaPlus.FirstFilterIgnoreRequest(content, out reason))
-                {
-                    //没有短链接都放弃
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.itemName = "点击打开淘宝APP";
-                    result.reason = "初步筛选";
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return new APIResult(new
-                    {
-                        result.success,
-                        result.message,
-                        result.content,
-                        result.itemName,
-                        result.deeplink_url,
-                    });
-                }
-
-                if (AlimamaPlus.ShouldIgnoreRequest(ip, oaid, out reason))
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.itemName = "点击打开淘宝APP";
-                    result.reason = reason;
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return new APIResult(new
-                    {
-                        result.success,
-                        result.message,
-                        result.content,
-                        result.itemName,
-                        result.deeplink_url,
-                    });
-                }
-                var account = TkPoolCore.GetOne(TkPoolCore.TkAction.parse);
-                if (account == null)
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "没有匹配账号";
-                    result.itemName = "点击打开淘宝APP";
-                    _ = TkLogCore.ParseLogAsync(result);
-                    return new APIResult(new
-                    {
-                        result.success,
-                        result.message,
-                        result.content,
-                        result.couponAmount,
-                        result.taoToken,
-                        result.shortLinkurl,
-                        result.deeplink_url,
-                    });
-                }
-                result.accountId = account.id;
-                alimama = new AlimamaPlus(account);
-                int timeout = alimama._config.rt_max;
-
-                using var cts = new CancellationTokenSource();
-                cts.CancelAfter(timeout);
-                var requestTask = Task.Run(() => alimama.UnionParse2Async(content, result, cts.Token), cts.Token);
-                var delayTask = Task.Delay(timeout, cts.Token);
-                var completedTask = await Task.WhenAny(requestTask, delayTask);
-                if (completedTask == requestTask)
-                {
-                    result = await requestTask;
-                }
-                else
-                {
-                    cts.Cancel();
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "请求超时";
-                    result.itemName = "点击打开淘宝APP";
-                }
-                //result = await alimama.UnionParse2Async(content, result);
-                result.accountName = account.company;
-            }
-            catch (Exception ex)
-            {
-                if (ex.Message.Contains("was canceled"))
-                {
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "请求超时";
-                    result.itemName = "点击打开淘宝APP";
-                }
-                else
-                {
-                    _ = new LoggerLibrary("unionParse", "tb_error")
-                        .Info(ip, oaid)
-                        .Info(content)
-                        .Info(ex.Message, ex.StackTrace)
-                        .SaveAsync();
-
-                    NotifyCore.Notify(new NifyMessage
-                    {
-                        message = $"【转链异常TB】\n{content}\n\n{ex.Message}\n{ex.StackTrace}",
-                        priority = NifyMessagePriority.high,
-                        tags = ["red_circle"]
-                    });
-                    result.success = false;
-                    result.message = "放弃转链";
-                    result.reason = "转链接口异常";
-                    result.itemName = "点击打开淘宝APP";
-                }
-            }
-            _ = TkLogCore.ParseLogAsync(result, alimama);
-
-            return new APIResult(new
-            {
-                result.success,
-                result.message,
-                link_type = result.link_type.ToString(),
-                channel = result?.channel.ToString(),
-                result.channel_type,
-                result.itemId,
-                result.itemName,
-                result.pic,
-                result.promotionPrice,
-                result.couponAmount,
-                result.couponEffectiveStartTime,
-                result?.couponEffectiveEndTime,
-                result.shortLinkurl,
-                result.deeplink_url,
-                result.content,
-                result.taoToken,
-            });
-        }
-
-        //public static TkDataDTO testTaobaoParseAsync(string content, string ip = "", string oaid = "")
-        //{
-        //    var result = AlimamaPlus.GetFormattedObject(content, ip, oaid);
-        //    content = content.UrlDecode();
-        //    content = content[..Math.Min(1000, content.Length)];
-        //    result.rawContent = content;
-        //    try
-        //    {
-        //        if (AlimamaPlus.OtherPlatform(content))
-        //        {
-        //            result.success = false;
-        //            result.message = "放弃转链";
-        //            result.reason = "平台错误";
-        //            return result;
-        //        }
-        //        string reason = string.Empty;
-        //        if (string.IsNullOrEmpty(result.shortLinkurl) && AlimamaPlus.FirstFilterIgnoreRequest(content, out reason))
-        //        {
-        //            //没有短链接都放弃
-        //            result.success = false;
-        //            result.message = "放弃转链";
-        //            result.itemName = "点击打开淘宝APP";
-        //            result.reason = "初步筛选";
-        //            return result;
-        //        }
-
-        //        if (AlimamaPlus.ShouldIgnoreRequest(ip, oaid, out reason))
-        //        {
-        //            result.success = false;
-        //            result.message = "放弃转链";
-        //            result.itemName = "点击打开淘宝APP";
-        //            result.reason = reason;
-        //            return result;
-        //        }
-        //        result.success = true;
-        //        return result;
-        //    }
-        //    catch (Exception ex)
-        //    {
-        //        result.success = false;
-        //        return result;
-        //    }
-        //}
-
         public static async Task<APIResult> JdParseAsync(string content, string ip, string oaid, CancellationToken cancellationToken = default)
         {
             var result = JdUnionPlus.GetFormattedObject(content, ip, oaid);

+ 8 - 1
molilian.core/DTO/alimama/TkConfigDTO.cs

@@ -1,7 +1,12 @@
-namespace molilian.core
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace molilian.core
 {
+    [Table("tk_config")]
     public class TkConfigDTO
     {
+        [Key]
         public int id { get; set; }
         public int ignorePercentage { get; set; } = 0;
         public int jdIgnorePercentage { get; set; } = 0;
@@ -11,5 +16,7 @@
         public int fake_click_max { get; set; }
         public int fake_click_ttl { get; set; } = 86400;
         public int rt_max { get; set; } = 0;
+        public string tk_whitelist_regular { get; set; } = string.Empty;
+        public string tk_blacklist_regular { get; set; } = string.Empty;
     }
 }

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

@@ -0,0 +1,15 @@
+namespace molilian.core
+{
+    public class PddPoolDTO
+    {
+        public int id { get; set; }
+        public string name { get; set; } = string.Empty;
+        public string description { get; set; } = string.Empty;
+        public string app_key { get; set; } = string.Empty;
+        public string app_secret { get; set; } = string.Empty;
+        public DateTime create_time { get; set; }
+        public DateTime last_time { get; set; }
+        public bool status { get; set; }
+
+    }
+}

+ 1 - 1
molilian.core/Plus/Alimama/account.cs

@@ -214,7 +214,7 @@ namespace molilian.core
 
                 NotifyCore.Notify(new NifyMessage
                 {
-                    message = $"【淘宝联盟:{_accountName}】cookie 续期",
+                    message = $"【淘客{_accountId}:{_accountName}】cookie 续期",
                     tags = ["green_circle"]
                 });
                 EndPointCore.NotifyReload(true);

+ 1 - 1
molilian.core/Plus/Alimama/bills.cs

@@ -64,7 +64,7 @@ namespace molilian.core
                         (success, string message) = RenewCookie();
                         if (!success)
                         {
-                            TkPoolCore.Disabled(_accountName, $"{body}");
+                            TkPoolCore.Disabled(_accountId, _accountName, $"{body}");
                         }
                         return 0;
                     }

+ 2 - 2
molilian.core/Plus/Alimama/crawler.cs

@@ -355,8 +355,8 @@ ON DUPLICATE KEY UPDATE
                 DateTime report_date = date.Date;
                 if (report_date == DateTime.Now.Date)
                 {
-                    TkPoolCore.SaveIncomeAmt(_accountId.ToString(), result.eff_tk_disp_tfee);
-                    TkPoolCore.SaveIncomeAmt(_accountName, result.eff_tk_disp_tfee);
+                    TkPoolCore.SaveIncomeAmt($"{_accountId}", result.eff_tk_disp_tfee);
+                    //TkPoolCore.SaveIncomeAmt(_accountName, result.eff_tk_disp_tfee);
                     EachSaveReportOverview(report_date.AddHours(DateTime.Now.Hour), "tk_report_hourtrend", result);
                     EachSaveReportOverview(report_date, "tk_report", result);
                 }

+ 1 - 1
molilian.core/Plus/Alimama/orders.cs

@@ -194,7 +194,7 @@ SET tr.order_ord_amt_14 = sub.order_ord_amt, tr.order_ord_tfee_14 = sub.order_or
                         (success, string message) = RenewCookie();
                         if (!success)
                         {
-                            TkPoolCore.Disabled(_accountName, $"{body}");
+                            TkPoolCore.Disabled(_accountId, _accountName, $"{body}");
                         }
                         return (0, DateTime.MinValue, new List<DateTime>());
                     }

+ 83 - 24
molilian.core/Plus/Alimama/parse.cs

@@ -2,6 +2,7 @@
 using dodohold.core;
 using System.Text.RegularExpressions;
 using System.Net;
+using System.Linq;
 using System.Security.Cryptography;
 using TencentCloud.Ecm.V20190719.Models;
 using System.Diagnostics;
@@ -149,7 +150,8 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content) || string.IsNullOrEmpty(shortLink)) return content;
             string result = content;
-            string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            string pattern = @"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
 
             Regex regex = new(pattern);
             MatchCollection matches = regex.Matches(content);
@@ -157,7 +159,9 @@ namespace molilian.core
             foreach (Match m in matches.Cast<Match>())
             {
                 string url = m.Value;
-                if (url.Contains("https://m.tb.cn/") ||
+                if (url.Contains("https://s.tb.cn/") ||
+                    url.Contains("http://s.tb.cn/") ||
+                    url.Contains("http://m.tb.cn/") ||
                     url.Contains("http://m.tb.cn/"))
                 {
                     result = result.Replace(url, shortLink);
@@ -170,8 +174,8 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content)) return content;
             string result = content;
-            string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
-            //string pattern = @"https?:\/\/[\da-z\.-]+\.[a-z]{2,6}(:\d{1,5})?(\/[\w\.-]*)*";
+            //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            string pattern = @"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
             Regex regex = new(pattern);
             MatchCollection matches = regex.Matches(content);
 
@@ -187,7 +191,7 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content)) return content;
             string result = content;
-            string pattern = @"(https?://(?:[\w-]+\.)*(?:tb\.cn|taobao\.com|juhuasuan.com|tmall\.com|tmall\.hk)(?:/[^\s]*)?)";
+            string pattern = @"(https?://(?:[\w-]+\.)*(?:tb\.cn|taobao\.com|juhuasuan\.com|tmall\.com|tmall\.hk)(?:/[a-zA-Z0-9\-\._~:/?#[\]@!$&'()*+,;=%]*)?)";
             Regex regex = new(pattern);
             MatchCollection matches = regex.Matches(content);
 
@@ -272,35 +276,90 @@ namespace molilian.core
                 string url = JdUnionPlus.GetLink(content);
                 var urlType = JdUnionPlus.GetLinkType(url, out _, out _);
                 if (urlType != LinkTypeEnum.unknown) return true;
+
+
+                //DY
+                url = DyUnionPlus.GetLink(content);
+                urlType = DyUnionPlus.GetLinkType(content, url);
+                if (urlType != LinkTypeEnum.unknown) return true;
             }
             catch { }
             return false;
         }
 
-        public static bool MatchRegexes(string text)
-        {
-            string regex1 = @"(.*?\d{2}\s[a-zA-Z]{2}\d{4}\s.*?[$¥🗝₴€₤£₳✔《💰🔑🎵✔💲🔐📲]+[a-zA-Z0-9\s]+[$¥🗝₴€₤£₳✔《💰🔑🎵✔💲🔐📲]).* [$¥🗝₴€₤£₳✔《💰🔑🎵✔💲🔐📲]+[a-zA-Z0-9\s]+[$¥🗝₴€₤£₳✔《💰🔑🎵✔💲🔐📲](\s*(https?://[^\s]+)?)?\s*([a-zA-Z]{2}\d{4})?\s*(.*)";
-            Regex r1 = new(regex1);
-            bool match1 = r1.IsMatch(text);
-            return match1;
-        }
-        public static bool FirstFilterIgnoreRequest(string content, out string reason)
+        public static bool MatchRegexes(string text, List<string> extended)
         {
-            reason = string.Empty;
-            try
+            string special_symbols = $"\\$\\(\\)\\/\\#\\&\\<\\>฿¢¥¥$🗝₰₵₲¤₪₴€₤£₳《¢💰🔑🎵✔💲🔐📲";
+
+            string[] base_patterns =
+            [
+                $@"(.*?\d{{2}}\s[a-zA-Z]{{2}}\d{{4}}\s.*?[{special_symbols}]+[a-zA-Z0-9\s]+[{special_symbols}]).*",
+                $@"[{special_symbols}]+\s*([a-zA-Z]{{1,2}}\d{{2,4}}\s[a-zA-Z0-9]{{11}}|[a-zA-Z0-9]{{11}}[a-zA-Z]{{1,2}}\d{{2,4}}\s|[a-zA-Z0-9]{{11}})\s*[{special_symbols}]+",
+                @"🍑♭ɑ◑下单|Tao宝"
+            ];
+            List<string> mergedArray = base_patterns.Union(extended).ToList();
+
+            /*
+            (.*?\\d{2}\\s[a-zA-Z]{2}\\d{4}\\s.*?[\\$\\(\\)\\/\\#\\&\\<\\>฿¢¥¥$🗝₰₵₲¤₪₴€₤£₳《¢💰🔑🎵✔💲🔐📲]+[a-zA-Z0-9\\s]+[\\$\\(\\)\\/\\#\\&\\<\\>฿¢¥¥$🗝₰₵₲¤₪₴€₤£₳《¢💰🔑🎵✔💲🔐📲])).*\n[\\$\\(\\)\\/\\#\\&\\<\\>฿¢¥¥$🗝₰₵₲¤₪₴€₤£₳《¢💰🔑🎵✔💲🔐📲]+\\s*([a-zA-Z]{1,2}\\d{2,4}\\s[a-zA-Z0-9]{11}|[a-zA-Z0-9]{11}[a-zA-Z]{1,2}\\d{2,4}\\s|[a-zA-Z0-9]{11})\\s*[\\$\\(\\)\\/\\#\\&\\<\\>฿¢¥¥$🗝₰₵₲¤₪₴€₤£₳《¢💰🔑🎵✔💲🔐📲]+\n🍑♭ɑ◑下单|Tao宝
+            
+             
+            【3瓶】恩威万蓝莓叶黄素酯软糖儿童成人上班族如酸涩肿胀可服用,<z5TYWAblvTw >:// HU7709,打開/
+置顶小助手,方便下次查询\r\n1★【劵】无\r\n2★【返.佣】 0.29圆 \r\n3★【付款.价】24.9 圆\r\n \r\n 1 ¢HZv5WAboi0D¢(/:/ HU8866\r\
+            n长按覆制本内容,打开TaoBao/\r\n-\r\n返佣是指商家的推广佣.金\r\n通过我回复的口令下単收货后,我
+            会微信红.苞返给你!!\r\n\r\n有疑问可回复“人工”咨询客服*/
+
+            //🍑🔗上 水和肌精华水& CZ0 VWdCWC2gj97&,
+            //6฿04ZDWzrwxjN)/ CA97
+            //1😘  腹制这条(CZ00 iHvtWzrXa7O(:/
+            //¥EC8DG4Zj0dhd8DOw¥MF6563 oIo0WzOF1Cp##X-PyVpHiPlyj1OP##
+            //6.6₵vU2jWzIW3Qx₲/ CZ5224
+            //$F56nWzIDSFZ$
+            //0復製这条口令( CZ00 D0M4WzI0jFJ¢,📱咑開[Tao宝]就可下单:/
+            //8fuzhi本条消息:¤ CZ3458 JSR1WzrPCBU¤,打开🍑♭ɑ◑下单/
+            //5€Lz6SWzrkLDw¥:// CZ13
+            //3₲Igq3Wzkc5np₳:// CZ15
+            //9.9🎈【康师傅易拉罐6罐】口伶:6₰TnxKWzr0wff₪:// CZ69
+            //4₲99Y0WzJdK6S₳:// CZ46
+            //4fuzhi本条消息:¤ CZ0002 WVCSWzrk6Ix¤,打开🍑♭ɑ◑下单/
+            bool anyMatch = false;
+            foreach (string pattern in mergedArray)
             {
-                // 正则过滤
-                var matchResult = MatchRegexes(content);
-                if (matchResult) return false;
-                reason = "初步筛选";
-                return true;
+                if (Regex.IsMatch(text, pattern))
+                {
+                    anyMatch = true;
+                }
             }
-            catch (Exception ex)
+            return anyMatch;
+        }
+        public static bool MatchOtherInfo(string text, List<string> extended)
+        {
+            string[] base_patterns =
+            [
+                "[ďȌƯƔɪƝɖƟɏƖԂȎȗϓɫɧơȲǏđǫƲƳɨǹƊȮǚƴɬɲƿȖȳɳɗʮϔӢǙɦɒɎƥʘưΊƞǪȈʠΌǓϒίȠƠƱƗǸþŌŬÿĩŅÞÓũŸÎŎûįŇĎÖÙŷÏňÜÝÍñĎÒüŶľńĎ0ųŷÏŇdǒǔyí℡抖yí℡ÞŐûŷÌñ]{6}",
+                @"(?:.+)极速版(?:口令|搜索)",
+                @"##[a-zA-Z0-9]+##\[抖音(?:极速版)?(?:口令|搜索)\]",
+                @"岽|亰|菄|京东|婛",
+                "打开【剪映】",
+                "weishi://|baiduhaokan://",
+                "复制打开「UC浏览器」|UC瀏覽器",
+                "番茄免费小说",
+                @"\?chanTag=[^&\s]*口令",
+                @"(https?://pan\.baidu\.com/s/[A-Za-z0-9?\-_=]+)",
+                @"https?:\/\/meeting\.tencent\.com[^\s]*",
+                @"#腾讯会议:(\d{3}-\d{3}-\d{3})"
+            ];
+
+            List<string> mergedArray = base_patterns.Union(extended).ToList();
+
+            bool anyMatch = false;
+            foreach (string pattern in mergedArray)
             {
-                reason = "配置异常";
-                return true;
+                if (Regex.IsMatch(text, pattern))
+                {
+                    anyMatch = true;
+                }
             }
-
+            return anyMatch;
         }
 
         public static bool ShouldIgnoreRequest(string ip, string oaid, out string reason)

+ 16 - 53
molilian.core/Plus/Alimama/parse_2.cs

@@ -101,6 +101,7 @@ namespace molilian.core
             }
 
             if (url.Contains("//item.taobao.com/item.htm?") ||
+                url.Contains("//main.m.taobao.com/detail/index.html?") ||
                 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") ||
@@ -124,7 +125,7 @@ namespace molilian.core
         /// </summary>
         /// <param name="url"></param>
         /// <returns></returns>
-        static bool IsAffLink(string url)
+        public static bool IsAffLink(string url)
         {
             if (!url.StartsWith("https://") || !url.StartsWith("https://")) url = "https://" + url;
             Uri uri = new(url);
@@ -161,7 +162,7 @@ namespace molilian.core
         public TimeSpan GetRequestTimeout(int deduction = 0)
         {
 #if DEBUG
-            //return TimeSpan.FromMilliseconds(10 * 1000);
+            return TimeSpan.FromMilliseconds(10 * 1000);
 #endif
             int min = (int)(_config.rt_max * 0.3);
             if (_config.rt_max == 0) return TimeSpan.FromMilliseconds(1000);
@@ -188,9 +189,8 @@ namespace molilian.core
             string result;
             try
             {
-                Uri uri = new(url);
-
-                if (!uri.Host.Equals("m.tb.cn", StringComparison.OrdinalIgnoreCase)) return (false, "不是淘宝短网址");
+                if (!url.Contains("m.tb.cn") && !url.Contains("s.tb.cn"))
+                    return (false, "不是淘宝短网址");
 
                 string desiredUrlPattern = "var url = '(.*?)'";
                 WebClientUtility client = new()
@@ -217,6 +217,8 @@ namespace molilian.core
                             result = match.Groups[1].Value; // 返回匹配的 URL
 
                             if (string.IsNullOrEmpty(result)) return (false, "没有匹配的URL");
+                            if (result.StartsWith("//"))
+                                result = "https:" + result;
                             return (true, result);
                         }
                     }
@@ -249,9 +251,8 @@ namespace molilian.core
             string result;
             try
             {
-                Uri uri = new(url);
-
-                if (!uri.Host.Equals("m.tb.cn", StringComparison.OrdinalIgnoreCase)) return (false, "不是淘宝短网址");
+                if (!url.Contains("m.tb.cn") && !url.Contains("s.tb.cn"))
+                    return (false, "不是淘宝短网址");
 
                 string desiredUrlPattern = "var url = '(.*?)'";
                 WebClientUtility client = new()
@@ -478,6 +479,12 @@ namespace molilian.core
                     }
                 }
 
+                if ((result.content.Contains("")))
+                {
+                    //触发验证码
+
+                }
+
                 link_type = GetLinkType(url);
 
                 result.success = false;
@@ -512,51 +519,7 @@ namespace molilian.core
             result.link_type = LinkTypeEnum.other_aff;
             result.shortLinkurl = null;
             return result;
-        }
-        private (bool, string, LinkTypeEnum, string) InternalTextProcessing222(string content)
-        {
-            bool success;
-            string result;
-            LinkTypeEnum link_type = LinkTypeEnum.unknown;
-
-            string url = GetLink(content);
-            if (!string.IsNullOrEmpty(url))
-            {
-                //排除已知的淘客链接
-                if (IsAffLink(url)) return (false, "排除淘客链接", LinkTypeEnum.other_aff, url);
-
-                //直接提取
-                (success, result) = IsTaobaoUrl(url);
-                if (success) return (true, result, LinkTypeEnum.goods, result);
-                //https://uland.taobao.com/coupon/edetail?af=4&e=%2B0aTAvEt16MoRnbUfHBdCarU9683KT3AsB67n92UtFJMmdsrkidbOWBzzpT26idJbwZX%2BHY%2B8QD9zJXNeOSc1euXSPKeLUBBWr02LqsxPV8Bf6pSMNy5GSw6iqMObXLLk3toOSlQXmUUcLJJYP0Uq5lvDADUDTeHRiuxU0i9W%2BtrC8Oh6piEfdwyUIuKQbeM8rUgQejRG616MoRnbUfHBdCarU9683KT3AsB67n92UtFv6uIFQszbmWWPZ8ka7%2BkV5xXydLt%2FcnuZ4%2BBFYnwwiUaCWC3TckcCwMW8xe3XqOGsb8uv9wbhxdkKJ0hxTrTkj7DNgliTXDluAYBRglsbQ%3D%3D&traceId=212cbaa417178512249145009e05a8&union_lens=lensId%3APUB%401717851219%402103c04a_0c89_18ff7e96612_9d39%40031w5YJSc7jl3U7gYjdvuCMM%40eyJmbG9vcklkIjo4NTAvEt16MoRnbUfHBdCarU9683JDaxNfPy83okP3kLScwCkGiuMcyC4PcynGV0YWlsX2h0bSIsInNyY0Zsb29ySWQiiOiiI4MDY3NCIsImNyZWF0aXZpdHlHcm91cElkIjowfQieie%3BtkScm%3AselectionPlaza_site_4358%3Bscm%3A1007.30148.329090.pub_search-item_c02df4bb-631f-4cc1-a9d5-abe802b8e134_&un=bfc196d23e155d289f2917200ca32a93&share_crt_v=1&un_site=0&ut_sk=1.utdid_null_1717851225204.TaoPassword-Outside.lianmeng-app&spm=a2159r.13376465.0.0&sp_tk=d2hLeFdDNHpKb3Y%3D&cpp=1&shareurl=true&short_name=h.gVx6mvI
-
-                //从http获取跳转的url
-                (success, result) = GetDesiredUrl(url);
-
-                if (success)
-                {
-                    //排除已知的淘客链接
-                    if (IsAffLink(result)) return (false, "排除淘客链接", LinkTypeEnum.other_aff, url);
-
-                    (success, result) = IsTaobaoUrl(result);
-                    if (success) return (true, result, LinkTypeEnum.goods, result);
-                    link_type = GetLinkType(result);
-                }
-                else
-                {
-                    link_type = GetLinkType(url);
-
-                }
-                return (false, result, link_type, url);
-            }
-
-            //判断淘客的¥羊角符号
-            if (ContainsSpecialFormat(content)) return (false, "排除淘口令", LinkTypeEnum.other_aff, null);
-
-            //todo 临时应急  0614
-            //return (false, "纯口令 没链接", link_type, null);
-            return (false, "纯口令 没链接", LinkTypeEnum.other_aff, null);
-        }
+        } 
 
         private LinkTypeEnum GetLinkType(string url)
         {

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

@@ -33,7 +33,8 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content)) return content;
             string result = content;
-            string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            string pattern = @"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
             Regex regex = new(pattern);
             MatchCollection matches = regex.Matches(content);
 

+ 3 - 2
molilian.core/Plus/Pangolin/DyUnion/DyUnionPlus.cs

@@ -71,7 +71,7 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content)) return false;
 
-            string pattern = "##[a-zA-Z0-9]+##\\[抖音(?:极速版)?口令\\]";
+            string pattern = "([ďȌƯƔɪƝɖƟɏƖԂȎȗϓɫɧơȲǏđǫƲƳɨǹƊȮǚƴɬɲƿȖȳɳɗʮϔӢǙɦɒɎƥʘưΊƞǪȈʠΌǓϒίȠƠƱƗǸĎÕŮÝÌŇ]{6}(?:极速版)?(?:口令|搜索))|##[a-zA-Z0-9]+##\\[抖音(?:极速版)?口令\\]";
             Regex regex = new(pattern);
 
             Match match = Regex.Match(content, pattern);
@@ -103,7 +103,8 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content)) return content;
             string result = content;
-            string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            string pattern = @"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
             Regex regex = new(pattern);
             MatchCollection matches = regex.Matches(content);
 

+ 6 - 5
molilian.core/Plus/Tool/ToolParsePlus.cs

@@ -34,7 +34,8 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(content)) return content;
             string result = content;
-            string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            //string pattern = @"https?:\/\/?([\da-z\.-]+)\.([a-z]{2,6})(:\d{1,5})?([\/\w\.-]*)*\/?(#[\S]+)?(\?[\S]+)?";
+            string pattern = @"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]";
             Regex regex = new(pattern);
             MatchCollection matches = regex.Matches(content);
 
@@ -120,9 +121,9 @@ namespace molilian.core
             string message = "OK";
             string surl = string.Empty, pwd = string.Empty;
             string shortLinkurl = GetPanLink(content, ref surl, ref pwd);
-            var deeplink_url = $"bdnetdisk://n/action.SHARE_LINK?surl={surl}&pwd={pwd}";
             result.shortLinkurl = shortLinkurl;
-            result.deeplink_url = deeplink_url;
+            result.deeplink_url = string.IsNullOrEmpty(shortLinkurl) ? "" : "bdnetdisk://n/action.EXTERNAL_ACTIVITY";
+
             if (string.IsNullOrEmpty(surl))
             {
                 result.channel = TkChannelEnum.bdpan;
@@ -133,6 +134,7 @@ namespace molilian.core
                 return;
             }
 
+            result.deeplink_url = $"bdnetdisk://n/action.SHARE_LINK?surl={surl}&pwd={pwd}";
             result.channel = TkChannelEnum.bdpan;
             result.content = content;
             result.success = true;
@@ -143,7 +145,7 @@ namespace molilian.core
         {
             string message = "OK";
             string wemeetId = await GetWemeetIdAsync(content);
-            var deeplink_url = "wemeet://launch";
+            var deeplink_url = "";
             result.deeplink_url = deeplink_url;
             if (!string.IsNullOrEmpty(wemeetId))
             {
@@ -177,7 +179,6 @@ namespace molilian.core
         {
             string pattern = @"https?:\/\/meeting\.tencent\.com[^\s]*";
 
-
             Regex regex = new Regex(pattern);
             Match match = regex.Match(content);
             string url = string.Empty;

+ 1 - 1
molilian.core/molilian.core.csproj

@@ -13,7 +13,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="dodohold.core" Version="1.0.1.12" />
+    <PackageReference Include="dodohold.core" Version="1.0.1.13" />
     <PackageReference Include="FakeUserAgent" Version="1.0.2" />
     <PackageReference Include="IP2Region.Net" Version="2.0.2" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä