فهرست منبع

百度网盘 处理pwd为空的情况。
增加美团、饿了么账号池数据库

dodo hold 2 سال پیش
والد
کامیت
225e6f244c

+ 8 - 1
molilian.api/Controllers/admin/ConfigController.cs

@@ -57,10 +57,17 @@ namespace molilian.api.Controllers
                 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);
 
+            var endpoint = EndPointCore.GetCouponAdmin();
+            if (!string.IsNullOrEmpty(endpoint.db_server))
+            {
+                using var conn2 = EndPointCore.GetDbConnection(endpoint.db_server);
+                _ = await conn2.UpdateAsync<TkConfigDTO>(form);
+            }
+
             string desc = ObjectComparer.PrintCompareToString(old, form).Trim();
             OperationLogCore.LogOperation(token.AccessKey, clientIp, "config", old.Convert2Json(), desc);
             EndPointCore.NotifyReload();

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

@@ -93,7 +93,7 @@ namespace molilian.api.Controllers
             //args.Add("custom_parameters", "5");
 
 
-            args = PddPoolCore.GenerateSignature(api, args);
+            args = PddUnionPlus.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

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

@@ -700,6 +700,9 @@ namespace molilian.api.Controllers
             PddPoolCore.Refresh();
             PangolinPoolCore.Refresh();
 
+            ElePoolCore.Refresh();
+            MeituanPoolCore.Refresh();
+
             return new APIResult(new
             {
                 success = true,
@@ -717,6 +720,9 @@ namespace molilian.api.Controllers
             JdPoolCore.Refresh();
             PddPoolCore.Refresh();
 
+            ElePoolCore.Refresh();
+            MeituanPoolCore.Refresh();
+
             return new APIResult(new
             {
                 success = true,

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

@@ -12,6 +12,7 @@ using COSXML.Network;
 using System.Linq;
 using static dodohold.core.ZTOExpress.CreateOrderArgs;
 using MySqlX.XDevAPI;
+using TencentCloud.Ame.V20190916.Models;
 
 namespace molilian.api.Controllers
 {
@@ -100,6 +101,78 @@ namespace molilian.api.Controllers
                 await UnionParseCore.UnionParseAsync(item.rawContent, channel, ip, oaid, aid);
             }
             return new APIResult(new { success = true, message = "ok" });
+        }
+
+
+        [HttpGet]
+        public async Task<ActionResult> tespdd(int aid, int num = 10, int time = 10)
+        {
+            var channel = "pdd";
+            string ip = "127.0.0.1";
+            string oaid = "test-oaid";
+
+            long[] ids = [202388161458,
+637136869820,
+437298318944,
+450267426247,
+539858704020,
+454418994546,
+333101893158,
+548124555533,
+536810064160,
+394420905274,
+265854971073,
+470187982089,
+460166587606,
+606201132000,
+636576970817,
+503020436844,
+64075414938,
+564823147084,
+400331744081,
+549023673392,
+510533263139,
+426302139303,
+606182099388,
+592309700176,
+509945035718,
+536810064160,
+562434609588,
+210550635424,
+602689684700,
+394649770525,
+295709990348,
+241991260035,
+310685408148,
+636576970817,
+335033136305,
+629347481399,
+437298318944,
+524348092851,
+484213318266,
+397252362715,
+6326358156,
+450204411089,
+616697299054,
+602623733449,
+549023673392,
+367065511257,
+605812755181,
+562434609588,
+265854971073,
+476300076415];
+
+            for (int i = 0; i <= time; i++)
+            {
+                for (int j = 0; j <= num; j++)
+                {
+                    long currentId = ids[j % ids.Length];
+                    string content = $"https://mobile.yangkeduo.com/goods.html?goods_id={currentId}";
+                    _ = UnionParseCore.UnionParseAsync(content, channel, ip, oaid, aid);
+                }
+                Thread.Sleep(1000);
+            }
+            return new APIResult(new { success = true, message = "ok" });
 
         }
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
molilian.api/Properties/PublishProfiles/https___ccr.ccs.tencentyun.com_shaobin.pubxml.user


+ 0 - 1
molilian.core/Core/ConfigCore.cs

@@ -23,7 +23,6 @@ namespace molilian.core
 
             string cache_key = $"cache:tk_config";
 
-
             var item = CenterHub.Redis.Get<TkConfigDTO>(cache_key);
             if (force || item == null)
             {

+ 182 - 0
molilian.core/Core/cps/ElePoolCore.cs

@@ -0,0 +1,182 @@
+using dodohold.core;
+
+namespace molilian.core
+{
+
+    public partial class ElePoolCore
+    {
+        private static string _end_point;
+        private static Dictionary<string, decimal> _incomeAmt = new();
+        private static Dictionary<string, int> _calls = new();
+        static ElePoolCore()
+        {
+            _end_point = Environment.GetEnvironmentVariable("EndPoint");
+        }
+
+        private static readonly object _lockObj = new();
+        private static IEnumerable<ElePoolDTO> _cached;
+    
+        public static ElePoolDTO? GetOne()
+        {
+            var list = List();
+            if (!list.Any()) return null;
+            return list.Where(IsNotExceedDailyIncomeLimit).OrderBy(l => Guid.NewGuid()).FirstOrDefault();
+        }
+
+
+        public static ElePoolDTO? GetOne(int id)
+        {
+            var list = List();
+            if (!list.Any()) return null;
+            return list.Where(e => e.id == id && IsNotExceedDailyIncomeLimit(e)).FirstOrDefault();
+        }
+        internal static void CallsIncrBy(int accountId)
+        {
+            CallsIncrBy(accountId, DateTime.Now.ToString("yyyyMMdd"));
+            CallsIncrBy(accountId, DateTime.Now.ToString("yyyyMMddHH"));
+        }
+
+        internal static void CallsIncrBy(int accountId, string flag)
+        {
+            string key = $"{accountId}:{flag}";
+            if (_calls.ContainsKey(key))
+            {
+                _calls[key] = _calls[key] + 1;
+            }
+            else
+            {
+                _calls[key] = 1;
+            }
+            string cache_key = $"cache:ele_pool:{key}:calls:{flag}";
+            RedisHelper.IncrBy(cache_key);
+            RedisHelper.Expire(cache_key, 3 * 86400);
+        }
+
+        public static int SaveCalls(int accountId, string flag)
+        {
+            string key = $"{accountId}:{flag}";
+            var result = EndPointCore.ProcessEndPointNodes<int>(node =>
+            {
+                if (!node.is_public_api) return 0;
+                if (string.IsNullOrEmpty(node.redis_server)) return 0;
+
+
+#if DEBUG
+                switch (node.name)
+                {
+
+                    case "bj":
+                        node.redis_server = "101.200.46.46:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    case "gz":
+                        node.redis_server = "8.138.110.158:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    case "coupon1":
+                        node.redis_server = "c1api.molilian.com:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=coupon";
+                        break;
+                    default: return 0;
+                }
+#endif
+
+                string cache_key = $"cache:ele_pool:{key}:calls:{flag}";
+                var redis = RedisClientManager.GetRedisClient(node.redis_server);
+                return redis.Get<int>(cache_key);
+            });
+            int num = result.Sum();
+            _calls.TryAdd(key, num);
+            return num;
+        }
+
+        public static int GetCalls(int accountId, string flag)
+        {
+            try
+            {
+                string key = $"{accountId}:{flag}";
+                if (_calls.ContainsKey(key)) return _calls[key];
+
+                string cache_key = $"cache:ele_pool:{key}:calls:{flag}";
+                int num = RedisHelper.Get<int>(cache_key);
+                _calls.TryAdd(key, num);
+                return num;
+            }
+            catch (Exception ex) { return 0; }
+        }
+
+        private static bool IsNotExceedDailyIncomeLimit(ElePoolDTO item)
+        {
+            if (!string.IsNullOrEmpty(_end_point) && !string.IsNullOrEmpty(item.end_point))
+            {
+                if (item.end_point != _end_point) return false;
+            }
+
+            // 使用初始化参数创建工作时间表
+            if (!new WorkSchedule(item.time_range).IsWorkHour()) return false;
+
+            if (item.daily_calls_limit > 0)
+            {
+                int daily_num = GetCalls(item.id, DateTime.Now.ToString("yyyyMMdd"));
+                if (daily_num >= item.daily_calls_limit) return false;
+            }
+            if (item.hourly_calls_limit > 0)
+            {
+                int hourly_num = GetCalls(item.id, DateTime.Now.ToString("yyyyMMddHH"));
+                if (hourly_num >= item.hourly_calls_limit) return false;
+            }
+            return true;
+        }
+
+        public static IEnumerable<ElePoolDTO> List(bool force = false)
+        {
+            if (!force && _cached != null) return _cached;
+
+            string cache_key = $"cache:ele_pool";
+            var list = RedisHelper.Get<IEnumerable<ElePoolDTO>>(cache_key);
+            if (force || list == null)
+            {
+                lock (_lockObj)
+                {
+                    list = new DBContext.Table("ele_pool")
+                        .Where("status=@status", new { status = 1 })
+                        .Select<ElePoolDTO>();
+                    if (list == null) return default;
+
+
+                    _calls = new Dictionary<string, int>();
+                    foreach (var item in list)
+                    {
+                        string key = $"{item.id}:{DateTime.Now:yyyyMMddHH}";
+                        _calls.TryAdd(key, item.current_hourly_calls);
+
+                        key = $"{item.id}:{DateTime.Now:yyyyMMddHH}";
+                        _calls.TryAdd(key, item.current_daily_calls);
+                    }
+                    RedisHelper.Set(cache_key, list, 30 * 86400);
+                }
+            }
+            _cached = list;
+            return list;
+        }
+        public static void Refresh()
+        {
+            _ = List(true);
+        }
+        
+        internal static void AccountExhausted()
+        {
+            string cache_key = $"cache:tk_pool:account:exhausted";
+            long count = RedisHelper.IncrBy(cache_key);
+            if (count > 1) return;
+            RedisHelper.Expire(cache_key, 3600);
+            NotifyCore.Notify(new NifyMessage
+            {
+                message = $"【京东联盟】没有匹配账号",
+                priority = NifyMessagePriority.high,
+                tags = ["red_circle"]
+            });
+            NotifyCore.AnPushNotify("没账号", $"【京东联盟】没有匹配账号");
+        }
+
+    }
+
+
+}

+ 181 - 0
molilian.core/Core/cps/MeituanPoolCore.cs

@@ -0,0 +1,181 @@
+using dodohold.core;
+
+namespace molilian.core
+{
+
+    public partial class MeituanPoolCore
+    {
+        private static string _end_point;
+        private static Dictionary<string, decimal> _incomeAmt = new();
+        private static Dictionary<string, int> _calls = new();
+        static MeituanPoolCore()
+        {
+            _end_point = Environment.GetEnvironmentVariable("EndPoint");
+        }
+        private static readonly object _lockObj = new();
+        private static IEnumerable<MeituanPoolDTO> _cached;
+
+        public static MeituanPoolDTO? GetOne()
+        {
+            var list = List();
+            if (!list.Any()) return null;
+            return list.Where(IsNotExceedDailyIncomeLimit).OrderBy(l => Guid.NewGuid()).FirstOrDefault();
+        }
+
+
+        public static MeituanPoolDTO? GetOne(int id)
+        {
+            var list = List();
+            if (!list.Any()) return null;
+            return list.Where(e => e.id == id && IsNotExceedDailyIncomeLimit(e)).FirstOrDefault();
+        }
+        internal static void CallsIncrBy(int accountId)
+        {
+            CallsIncrBy(accountId, DateTime.Now.ToString("yyyyMMdd"));
+            CallsIncrBy(accountId, DateTime.Now.ToString("yyyyMMddHH"));
+        }
+
+        internal static void CallsIncrBy(int accountId, string flag)
+        {
+            string key = $"{accountId}:{flag}";
+            if (_calls.ContainsKey(key))
+            {
+                _calls[key] = _calls[key] + 1;
+            }
+            else
+            {
+                _calls[key] = 1;
+            }
+            string cache_key = $"cache:meituan_pool:{key}:calls:{flag}";
+            RedisHelper.IncrBy(cache_key);
+            RedisHelper.Expire(cache_key, 3 * 86400);
+        }
+
+        public static int SaveCalls(int accountId, string flag)
+        {
+            string key = $"{accountId}:{flag}";
+            var result = EndPointCore.ProcessEndPointNodes<int>(node =>
+            {
+                if (!node.is_public_api) return 0;
+                if (string.IsNullOrEmpty(node.redis_server)) return 0;
+
+
+#if DEBUG
+                switch (node.name)
+                {
+
+                    case "bj":
+                        node.redis_server = "101.200.46.46:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    case "gz":
+                        node.redis_server = "8.138.110.158:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=webhook";
+                        break;
+                    case "coupon1":
+                        node.redis_server = "c1api.molilian.com:6379,password=pKBiS4ka2IpXayIdcx00,defaultDatabase=0,idleTimeout=20000,preheat=3,tryit=2,ssl=false,prefix=coupon";
+                        break;
+                    default: return 0;
+                }
+#endif
+
+                string cache_key = $"cache:meituan_pool:{key}:calls:{flag}";
+                var redis = RedisClientManager.GetRedisClient(node.redis_server);
+                return redis.Get<int>(cache_key);
+            });
+            int num = result.Sum();
+            _calls.TryAdd(key, num);
+            return num;
+        }
+
+        public static int GetCalls(int accountId, string flag)
+        {
+            try
+            {
+                string key = $"{accountId}:{flag}";
+                if (_calls.ContainsKey(key)) return _calls[key];
+
+                string cache_key = $"cache:meituan_pool:{key}:calls:{flag}";
+                int num = RedisHelper.Get<int>(cache_key);
+                _calls.TryAdd(key, num);
+                return num;
+            }
+            catch (Exception ex) { return 0; }
+        }
+
+        private static bool IsNotExceedDailyIncomeLimit(MeituanPoolDTO item)
+        {
+            if (!string.IsNullOrEmpty(_end_point) && !string.IsNullOrEmpty(item.end_point))
+            {
+                if (item.end_point != _end_point) return false;
+            }
+
+            // 使用初始化参数创建工作时间表
+            if (!new WorkSchedule(item.time_range).IsWorkHour()) return false;
+
+            if (item.daily_calls_limit > 0)
+            {
+                int daily_num = GetCalls(item.id, DateTime.Now.ToString("yyyyMMdd"));
+                if (daily_num >= item.daily_calls_limit) return false;
+            }
+            if (item.hourly_calls_limit > 0)
+            {
+                int hourly_num = GetCalls(item.id, DateTime.Now.ToString("yyyyMMddHH"));
+                if (hourly_num >= item.hourly_calls_limit) return false;
+            }
+            return true;
+        }
+
+        public static IEnumerable<MeituanPoolDTO> List(bool force = false)
+        {
+            if (!force && _cached != null) return _cached;
+
+            string cache_key = $"cache:meituan_pool";
+            var list = RedisHelper.Get<IEnumerable<MeituanPoolDTO>>(cache_key);
+            if (force || list == null)
+            {
+                lock (_lockObj)
+                {
+                    list = new DBContext.Table("meituan_pool")
+                        .Where("status=@status", new { status = 1 })
+                        .Select<MeituanPoolDTO>();
+                    if (list == null) return default;
+
+
+                    _calls = new Dictionary<string, int>();
+                    foreach (var item in list)
+                    {
+                        string key = $"{item.id}:{DateTime.Now:yyyyMMddHH}";
+                        _calls.TryAdd(key, item.current_hourly_calls);
+
+                        key = $"{item.id}:{DateTime.Now:yyyyMMddHH}";
+                        _calls.TryAdd(key, item.current_daily_calls);
+                    }
+                    RedisHelper.Set(cache_key, list, 30 * 86400);
+                }
+            }
+            _cached = list;
+            return list;
+        }
+        public static void Refresh()
+        {
+            _ = List(true);
+        }
+
+        internal static void AccountExhausted()
+        {
+            string cache_key = $"cache:tk_pool:account:exhausted";
+            long count = RedisHelper.IncrBy(cache_key);
+            if (count > 1) return;
+            RedisHelper.Expire(cache_key, 3600);
+            NotifyCore.Notify(new NifyMessage
+            {
+                message = $"【京东联盟】没有匹配账号",
+                priority = NifyMessagePriority.high,
+                tags = ["red_circle"]
+            });
+            NotifyCore.AnPushNotify("没账号", $"【京东联盟】没有匹配账号");
+        }
+
+    }
+
+
+}

+ 38 - 4
molilian.core/Plus/CPS/UnionCpsPlus.cs → molilian.core/Core/cps/UnionCpsCore.cs

@@ -22,10 +22,10 @@ using TencentCloud.Tione.V20211111.Models;
 
 namespace molilian.core
 {
-    public partial class UnionCpsPlus
+    public partial class UnionCpsCore
     {
         private static string _end_point;
-        static UnionCpsPlus()
+        static UnionCpsCore()
         {
             _end_point = Environment.GetEnvironmentVariable("EndPoint");
         }
@@ -64,7 +64,24 @@ namespace molilian.core
                 });
             }
 
-            result.deeplink_url = "eleme://web?action=ali.open.nav&module=h5&packageName=me.ele&bc_fl_src=locallife_wtzt_0-0-ADGROUPID-__REQID__-2&url=https%3A%2F%2Ffc.ele.me%2Fa%2FMWJhZDM1OTY5ZTg5MTFlYzllYWEwMDE2M2UxM2FkMTE%3D%3Fscene%3D8d6c64c7f62c48ea83e88383530edd2b%26o2i_1st_clk%3D__CLICK_ID__&fastmode=1";
+            var account = ElePoolCore.GetOne();
+            if (account == null)
+            {
+                result.success = false;
+                result.message = "放弃转链";
+                result.reason = "没有匹配账号";
+                _ = TkLogCore.CpsLogAsync(result);
+                return new APIResult(new
+                {
+                    result.success,
+                    result.message,
+                    result.reason,
+                    channel = result.channel.ToString(),
+                });
+            }
+            result.accountId = account.id;
+            result.accountName = account.name;
+            result.deeplink_url = account.deeplink;
             result.success = true;
             result.message = "OK";
 
@@ -99,7 +116,24 @@ namespace molilian.core
                 });
             }
 
-            result.deeplink_url = "imeituan://www.meituan.com/web?lch=cps:waimai:3:0f860c7cc90569fb14bc1fc4a4d8c057:001:33:445029&url=https%3A%2F%2Fclick.meituan.com%2Ft%3Ft%3D1%26c%3D2%26p%3DnvaI7r5zjmJB";
+            var account = MeituanPoolCore.GetOne();
+            if (account == null)
+            {
+                result.success = false;
+                result.message = "放弃转链";
+                result.reason = "没有匹配账号";
+                _ = TkLogCore.CpsLogAsync(result);
+                return new APIResult(new
+                {
+                    result.success,
+                    result.message,
+                    result.reason,
+                    channel = result.channel.ToString(),
+                });
+            }
+            result.accountId = account.id;
+            result.accountName = account.name;
+            result.deeplink_url = account.deeplink;
             result.success = true;
             result.message = "OK";
 

+ 0 - 23
molilian.core/Core/pdd/goods.cs

@@ -1,23 +0,0 @@
-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
-    {
-
-    }
-}

+ 0 - 32
molilian.core/Core/pdd/union.cs

@@ -1,32 +0,0 @@
-using System.Text;
-using dodohold.core;
-
-namespace molilian.core
-{
-    public partial class PddPoolCore
-    {
-        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;
-        }
-    }
-}

+ 50 - 23
molilian.core/Core/taoke/TkLogCore.cs

@@ -202,7 +202,7 @@ namespace molilian.core
                     var data = redis.LPop<TkDataDTO>(queue_tb_key);
                     if (data == null) break;
 
-                    if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
                          data.ip.Contains("127.0.0"))
                     {
                         save_tk_log(data, "tk_logs_test", connection, transaction);
@@ -252,7 +252,7 @@ namespace molilian.core
                     var data = redis.LPop<TkDataDTO>(queue_parse_tb_key);
                     if (data == null) break;
 
-                    if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
                          data.ip.Contains("127.0.0"))
                     {
                         save_tk_parse_logs(data, "tk_parse_logs_test", connection, transaction);
@@ -302,7 +302,7 @@ namespace molilian.core
                     if (data == null) break;
 
 
-                    if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
                          data.ip.Contains("127.0.0"))
                     {
                         save_jd_parse_logs(data, "jd_parse_logs_test", connection, transaction);
@@ -334,7 +334,8 @@ namespace molilian.core
                     if (data == null) break;
 
 
-                    if (data.ip.Contains("127.0.0"))
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                         data.ip.Contains("127.0.0"))
                     {
                         save_pdd_parse_logs(data, "pdd_parse_logs_test", connection, transaction);
                     }
@@ -386,22 +387,47 @@ namespace molilian.core
                 {
                     var data = redis.LPop<ToolParseDataDTO>(queue_parse_tool_key);
                     if (data == null) break;
-                    new DBContext.Table(connection, "tool_parse_logs")
-                        .Add("end_point", data.end_point)
-                        .Add("channel", (int)data.channel)
-                        .Add("rawContent", data.rawContent)
-                        .Add("success", data.success)
-                        .Add("message", data.message)
-                        .Add("reason", data.reason)
-                        .Add("content", data.content)
-                        .Add("taoToken", data.taoToken)
-                        .Add("shortLinkurl", data.shortLinkurl)
-                        .Add("deeplink_url", data.deeplink_url)
-                        .Add("elapsedTime", data.elapsedTime)
-                        .Add("ip", data.ip)
-                        .Add("oaid", data.oaid)
-                        .Add("create_time", data.create_time)
-                        .Create(DBContext.InsertType.NORMAL, transaction);
+
+
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                         data.ip.Contains("127.0.0"))
+                    {
+                        new DBContext.Table(connection, "tool_parse_logs_test")
+                            .Add("end_point", data.end_point)
+                            .Add("channel", (int)data.channel)
+                            .Add("rawContent", data.rawContent)
+                            .Add("success", data.success)
+                            .Add("message", data.message)
+                            .Add("reason", data.reason)
+                            .Add("content", data.content)
+                            .Add("taoToken", data.taoToken)
+                            .Add("shortLinkurl", data.shortLinkurl)
+                            .Add("deeplink_url", data.deeplink_url)
+                            .Add("elapsedTime", data.elapsedTime)
+                            .Add("ip", data.ip)
+                            .Add("oaid", data.oaid)
+                            .Add("create_time", data.create_time)
+                            .Create(DBContext.InsertType.NORMAL, transaction);
+                    }
+                    else
+                    {
+                        new DBContext.Table(connection, "tool_parse_logs")
+                            .Add("end_point", data.end_point)
+                            .Add("channel", (int)data.channel)
+                            .Add("rawContent", data.rawContent)
+                            .Add("success", data.success)
+                            .Add("message", data.message)
+                            .Add("reason", data.reason)
+                            .Add("content", data.content)
+                            .Add("taoToken", data.taoToken)
+                            .Add("shortLinkurl", data.shortLinkurl)
+                            .Add("deeplink_url", data.deeplink_url)
+                            .Add("elapsedTime", data.elapsedTime)
+                            .Add("ip", data.ip)
+                            .Add("oaid", data.oaid)
+                            .Add("create_time", data.create_time)
+                            .Create(DBContext.InsertType.NORMAL, transaction);
+                    }
                     total++;
                 }
 
@@ -411,8 +437,8 @@ namespace molilian.core
                     var data = redis.LPop<UnionCouponDTO>(queue_coupon_key);
                     if (data == null) break;
 
-                    if ("3JDaxNfPy83okP3kLScwCkGiuMcyC4PcyntF424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
-                      data.ip.Contains("127.0.0"))
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                         data.ip.Contains("127.0.0"))
                     {
                         var test_data = data.Convert2Json().Convert2Object<TestUnionCouponDTO>();
                         connection.Insert(test_data);
@@ -435,7 +461,8 @@ namespace molilian.core
                     var data = redis.LPop<UnionCpsDTO>(queue_cps_key);
                     if (data == null) break;
 
-                    if (data.ip.Contains("127.0.0"))
+                    if ("3B191CFA4C6B48F9BA459E915B57743BEC7D424979CC9C51BCAD0C245B1C7BA2".Equals(data.oaid) ||
+                         data.ip.Contains("127.0.0"))
                     {
                         var test_data = data.Convert2Json().Convert2Object<TestUnionCpsDTO>();
                         connection.Insert(test_data);

+ 2 - 2
molilian.core/Core/taoke/UnionCouponCore.cs

@@ -35,8 +35,8 @@ namespace molilian.core
             return channel switch
             {
                 "jd" => await JdCouponAsync(content, dplink, ip, oaid),
-                "eleme" => await UnionCpsPlus.EleAsync(ip, oaid),
-                "meituan" => await UnionCpsPlus.MeituanAsync(ip, oaid),
+                "eleme" => await UnionCpsCore.EleAsync(ip, oaid),
+                "meituan" => await UnionCpsCore.MeituanAsync(ip, oaid),
                 _ => await TaobaoCouponAsync(content, dplink, ip, oaid),
             };
         }

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

@@ -34,5 +34,6 @@ namespace molilian.core
         public int pddIgnorePercentage { get; set; } = 0;
         public string pddIgnorePercentageCity { get; set; } = string.Empty;
         public int pdd_limit_per_ip_24h { get; set; } = 0;
+
     }
 }

+ 27 - 0
molilian.core/DTO/cps/ElePoolDTO.cs

@@ -0,0 +1,27 @@
+namespace molilian.core
+{
+    public class ElePoolDTO
+    {
+        public int id { get; set; }
+        public string name { get; set; } = string.Empty;
+        public string company { get; set; } = string.Empty;
+        public string description { get; set; } = string.Empty;
+        public DateTime create_time { get; set; } = DateTime.Now;
+        public DateTime last_time { get; set; } = DateTime.Now;
+        public DateTime login_time { get; set; } = DateTime.Now;
+        public bool status { get; set; }
+        public string deeplink { get; set; } = string.Empty;
+
+        public string nodeName { get; set; } = string.Empty;
+        public string end_point { get; set; } = string.Empty;
+        public decimal current_amt { get; set; } = 0;
+        public int current_daily_calls { get; set; } = 0;
+        public int current_hourly_calls { get; set; } = 0;
+        public decimal daily_income_limit { get; set; } = 0;
+        public int daily_calls_limit { get; set; } = 0;
+        public int hourly_calls_limit { get; set; } = 0;
+        public decimal draw_balance { get; set; } = 0;
+        public int time_range { get; set; } = 0;
+
+    }
+}

+ 27 - 0
molilian.core/DTO/cps/MeituanPoolDTO.cs

@@ -0,0 +1,27 @@
+namespace molilian.core
+{
+    public class MeituanPoolDTO
+    {
+        public int id { get; set; }
+        public string name { get; set; } = string.Empty;
+        public string company { get; set; } = string.Empty;
+        public string description { get; set; } = string.Empty;
+        public DateTime create_time { get; set; } = DateTime.Now;
+        public DateTime last_time { get; set; } = DateTime.Now;
+        public DateTime login_time { get; set; } = DateTime.Now;
+        public bool status { get; set; }
+        public string deeplink { get; set; } = string.Empty;
+
+        public string nodeName { get; set; } = string.Empty;
+        public string end_point { get; set; } = string.Empty;
+        public decimal current_amt { get; set; } = 0;
+        public int current_daily_calls { get; set; } = 0;
+        public int current_hourly_calls { get; set; } = 0;
+        public decimal daily_income_limit { get; set; } = 0;
+        public int daily_calls_limit { get; set; } = 0;
+        public int hourly_calls_limit { get; set; } = 0;
+        public decimal draw_balance { get; set; } = 0;
+        public int time_range { get; set; } = 0;
+
+    }
+}

+ 3 - 1
molilian.core/Plus/Tool/ToolParsePlus.cs

@@ -133,7 +133,9 @@ namespace molilian.core
                 return;
             }
 
-            result.deeplink_url = $"bdnetdisk://n/action.SHARE_LINK?surl={surl}&pwd={pwd}";
+            string deeplink_url = $"bdnetdisk://n/action.SHARE_LINK?surl={surl}";
+            if (!string.IsNullOrEmpty(pwd)) deeplink_url += $"&pwd={pwd}";
+            result.deeplink_url = deeplink_url;
             result.channel = TkChannelEnum.bdpan;
             result.content = content;
             result.success = true;

+ 0 - 0
molilian.core/Plus/pdd/goods.cs → molilian.core/Plus/pdd/Crawler.cs


+ 3 - 3
molilian.core/Plus/pdd/PddUnionPlus.cs

@@ -98,9 +98,9 @@ namespace molilian.core
 
             switch (_account.work_mode)
             {
-                //case PddUnionWorkMode.SiteApi:
-                //    result = await GetPromotionBySiteAsync(result, url, cancellationToken);
-                //    break;
+                case PddUnionWorkMode.SiteApi:
+                    result = await UnionGeneratelink(result, url, cancellationToken);
+                    break;
                 //case PddUnionWorkMode.AffApi:
                 //    result = await GetPromotionByAffAsync(result, url, cancellationToken);
                 //    break;

+ 140 - 0
molilian.core/Plus/pdd/open.cs

@@ -0,0 +1,140 @@
+using dodohold.core;
+using Sayaka.Common;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+
+namespace molilian.core
+{
+
+
+
+    public partial class PddUnionPlus
+    {
+        static string _baseUrl = "https://gw-api.pinduoduo.com/api/router";
+
+
+        public class ErrorResponse
+        {
+            public string error_msg { get; set; }
+            public string sub_msg { get; set; }
+            public string sub_code { get; set; }
+            public int error_code { get; set; }
+            public string request_id { get; set; }
+        }
+
+
+        public class GoodsZsUnitGenerateResponse
+        {
+            public string multi_group_mobile_short_url { get; set; }
+            public string multi_group_url { get; set; }
+            public string mobile_url { get; set; }
+            public string multi_group_short_url { get; set; }
+            public string mobile_short_url { get; set; }
+            public string multi_group_mobile_url { get; set; }
+            public string request_id { get; set; }
+            public string url { get; set; }
+            public string short_url { get; set; }
+        }
+        public class UnionGeneratelinkDTO
+        {
+            public GoodsZsUnitGenerateResponse goods_zs_unit_generate_response { get; set; }
+            public ErrorResponse error_response { get; set; }
+        }
+
+
+        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;
+        }
+
+
+        /// <summary>
+        /// 多多进宝转链接口
+        /// </summary>
+        /// <param name="result"></param>
+        /// <param name="sourceUrl"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        public async Task<PddDataDTO> UnionGeneratelink(PddDataDTO result, string sourceUrl, CancellationToken cancellationToken = default)
+        {
+            var ts = DateTime.Now.Convert2UnixTimestamp(true);
+            var args = new Dictionary<string, string>
+            {
+                { "type", "pdd.ddk.goods.zs.unit.url.gen" },
+                { "data_type", "JSON" },
+                { "client_id", _account.app_key },
+                { "pid", _account.pid },
+                { "source_url", sourceUrl },
+                { "timestamp", ts.ToString() }
+            };
+            args = GenerateSignature(_account, args);
+
+            var query = HttpUtility.ParseQueryString(string.Empty);
+            foreach (var kvp in args) query[kvp.Key] = kvp.Value;
+            string urlWithQuery = $"{_baseUrl}?{query}";
+
+
+            WebClientUtility client = new();
+            client.Proxy = _proxy;
+#if DEBUG
+            client.Proxy = null;
+#endif
+            client.SetContentType("application/json");
+            var response = await client.RequestAsync(urlWithQuery, "GET", cancellationToken);
+
+            string body = response.Body();
+            var root = body.Convert2Object<UnionGeneratelinkDTO>();
+            string message = string.Empty;
+            _ = new LoggerLibrary("PddUnion", "debug ").Info(urlWithQuery, body).SaveAsync();
+
+            if (root.error_response != null || root.goods_zs_unit_generate_response == null)
+            {
+                message = $"{root.error_response.sub_code}:{root.error_response.sub_msg}";
+                result.success = false;
+                result.message = "转链失败";
+                result.reason = message;
+                _ = new LoggerLibrary("PddUnion", "UnionGeneratelink").Info(urlWithQuery, body).SaveAsync();
+                return result;
+            }
+
+            if (string.IsNullOrEmpty(root.goods_zs_unit_generate_response.url))
+            {
+                result.success = false;
+                result.message = "转链失败";
+                result.reason = "无法转链";
+                _ = new LoggerLibrary("PddUnion", "UnionGeneratelink").Info(urlWithQuery, body).SaveAsync();
+                return result;
+            }
+
+            result.itemId = root.goods_zs_unit_generate_response.url.GetContentPart("goods_id=", "&");
+
+            result.success = true;
+            result.message = "OK";
+            result.link_type = LinkTypeEnum.goods;
+            result.shortLinkurl = root.goods_zs_unit_generate_response.short_url;
+            result.content = result.shortLinkurl;
+            result.deeplink_url = GetDeeplink(result.shortLinkurl);
+            return result;
+        }
+    }
+}

+ 4 - 0
molilian.core/molilian.core.csproj

@@ -24,4 +24,8 @@
     <ProjectReference Include="..\taobao-sdk-netcore-auto_1719572210878-20240628-source\topsdk-netcore.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <Folder Include="Plus\CPS\" />
+  </ItemGroup>
+
 </Project>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است