dodo hold 1 год назад
Родитель
Сommit
c62ba35a6a

+ 5 - 2
molilian.api/Controllers/public/ApiController.cs

@@ -11,6 +11,7 @@ using TencentCloud.Ecm.V20190719.Models;
 using COSXML.Network;
 using System.Linq;
 using static dodohold.core.ZTOExpress.CreateOrderArgs;
+using TencentCloud.Lighthouse.V20200324.Models;
 
 namespace molilian.api.Controllers
 {
@@ -35,6 +36,7 @@ namespace molilian.api.Controllers
             var url = form.Read("url", string.Empty);
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
+            var scene = form.Read("scene", string.Empty);
             var recommand = form.Read("recommand", true);
 
             //验证签名
@@ -65,7 +67,7 @@ namespace molilian.api.Controllers
                 var bytes = new WebClientUtility().Request(url).ResponseBody;
                 img = Convert.ToBase64String(bytes);
             }
-            return await core.PromotionQueryAsync(img, oaid, ip, recommand);
+            return await core.PromotionQueryAsync(img, oaid, ip, scene, recommand);
         }
 
 
@@ -76,6 +78,7 @@ namespace molilian.api.Controllers
             var url = form.Read("url", string.Empty);
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
+            var scene = form.Read("scene", string.Empty);
             var recommand = form.Read("recommand", true);
             var debug = form.Read("debug", false);
 
@@ -91,7 +94,7 @@ namespace molilian.api.Controllers
                 oaid = $"{rand.Next(100000, 999999)}-{rand.Next(100000, 999999)}-{rand.Next(100000, 999999)}";
             }
 
-            return await core.PromotionQueryAsync(img, oaid, ip, recommand, debug);
+            return await core.PromotionQueryAsync(img, oaid, ip, scene, recommand, debug);
         }
 
 

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
molilian.api/Properties/PublishProfiles/https___ccr.ccs.tencentyun.com_shaobin.pubxml.user


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

@@ -61,6 +61,7 @@ namespace molilian.core
                     .Add("img", data.img)
                     .Add("ip", data.ip)
                     .Add("oaid", data.oaid)
+                    .Add("scene", data.scene)
                     .Add("success", data.success)
                     .Add("message", data.message)
                     .Add("reason", data.reason)
@@ -89,7 +90,7 @@ namespace molilian.core
 
                 //using var connection = DBContext.GetOpenConnection();
                 //connection.Insert(response);
-                savePromotionCache(response.accountId, response.accountName, response.success, response.message, response.reason);
+                savePromotionCache(response.accountId, response.accountName, response.scene, response.success, response.message, response.reason);
             }
             catch (Exception ex) { }
         }
@@ -98,10 +99,12 @@ namespace molilian.core
 
 
 
-        private static void savePromotionCache(int accountId, string accountName, bool success, string message, string reason)
+        private static void savePromotionCache(int accountId, string accountName, string scene, bool success, string message, string reason)
         {
             savePromotionAccountCache("all", success, message, reason);
             savePromotionAccountCache($"{accountId}", success, message, reason);
+            savePromotionAccountCache($"all_scene_{scene}", success, message, reason);
+            savePromotionAccountCache($"{accountId}_{scene}", success, message, reason);
         }
 
         private static void savePromotionAccountCache(string accountName, bool success, string message, string reason)

+ 2 - 1
molilian.core/Core/taoke/TaokeOpenCore.cs

@@ -23,13 +23,14 @@ namespace molilian.core
         }
 
 
-        public async Task<APIResult> PromotionQueryAsync(string img, string oaid = "", string ip = "", bool recommand = true, bool debug = false)
+        public async Task<APIResult> PromotionQueryAsync(string img, string oaid = "", string ip = "", string scene = "", bool recommand = true, bool debug = false)
         {
             PromotionQueryDTO result = new()
             {
                 end_point = _end_point,
                 ip = ip,
                 oaid = oaid,
+                scene = scene,
                 img = img
             };
             if (string.IsNullOrEmpty(oaid))

+ 8 - 3
molilian.core/Core/tool/DeeplinkParseCore.cs

@@ -248,7 +248,7 @@ namespace molilian.core
                                 prompt_text = prompt_text.Replace($"{{decode:{i - 1}}}", encodedUrl);
                             }
 
-
+                            //两次url编码
                             if (deeplink.Contains("{url2:"))
                             {
                                 string encodedUrl = HttpUtility.UrlEncode(val);
@@ -263,6 +263,7 @@ namespace molilian.core
                             }
 
 
+                            //三次url解码
                             if (deeplink.Contains("{url3:"))
                             {
                                 string encodedUrl = HttpUtility.UrlEncode(val);
@@ -279,20 +280,24 @@ namespace molilian.core
                             //atob
                             if (deeplink.Contains("{atob:"))
                             {
-                                deeplink = deeplink.Replace($"{{atob:{i - 1}}}", val.FromBase64());
+                                string encodedUrl = HttpUtility.UrlDecode(val);
+                                deeplink = deeplink.Replace($"{{atob:{i - 1}}}", encodedUrl.FromBase64());
                             }
                             if (prompt_text.Contains("{atob:"))
                             {
-                                prompt_text = prompt_text.Replace($"{{atob:{i - 1}}}", val.FromBase64());
+                                string encodedUrl = HttpUtility.UrlDecode(val);
+                                prompt_text = prompt_text.Replace($"{{atob:{i - 1}}}", encodedUrl.FromBase64());
                             }
 
                             //btoa
                             if (deeplink.Contains("{btoa:"))
                             {
+                                string encodedUrl = HttpUtility.UrlEncode(val);
                                 deeplink = deeplink.Replace($"{{btoa:{i - 1}}}", val.ToBase64());
                             }
                             if (prompt_text.Contains("{btoa:"))
                             {
+                                string encodedUrl = HttpUtility.UrlEncode(val);
                                 prompt_text = prompt_text.Replace($"{{btoa:{i - 1}}}", val.ToBase64());
                             }
 

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

@@ -15,6 +15,7 @@ namespace molilian.core
         public string oaid { get; set; } = string.Empty;
         public bool success { get; set; } = false;
         public string message { get; set; } = string.Empty;
+        public string scene { get; set; } = string.Empty;
         public string reason { get; set; } = string.Empty;
         public string url { get; set; } = string.Empty;
         public string similarPromotion { get; set; } = string.Empty;

+ 37 - 13
molilian.core/Plus/Alimama/orders.cs

@@ -5,6 +5,7 @@ using System.Drawing.Printing;
 using System.Runtime.InteropServices;
 using System.Text.Json;
 using System.Text.RegularExpressions;
+using System.Xml.Linq;
 using static System.Runtime.InteropServices.JavaScript.JSType;
 
 namespace molilian.core
@@ -18,25 +19,25 @@ namespace molilian.core
             //DateTime endTime = DateTime.Now;
             //DateTime startTime = endTime.AddDays(-90);
             //if (_accountId == 3) endTime = DateTime.Parse("2024-04-07");
-//#if DEBUG
+            //#if DEBUG
 
-//            startTime = DateTime.Parse("2024-05-01");
-//            endTime = DateTime.Parse("2024-06-01");
+            //            startTime = DateTime.Parse("2024-05-01");
+            //            endTime = DateTime.Parse("2024-06-01");
 
 
-//            int total = 0;
+            //            int total = 0;
 
-//            List<DateTime> orderTimes = new List<DateTime>();
+            //            List<DateTime> orderTimes = new List<DateTime>();
 
-//            for (DateTime date = startTime; date <= endTime; date = date.AddDays(1))
-//            {
-//                orderTimes.Add(date);
-//            }
+            //            for (DateTime date = startTime; date <= endTime; date = date.AddDays(1))
+            //            {
+            //                orderTimes.Add(date);
+            //            }
 
 
-//#else
+            //#else
 
-//#endif       
+            //#endif       
 
             //当日往前查询
             (int total, DateTime max_modifiedTime, List<DateTime> orderTimes) = GetTkOrders(startTime, endTime, DateTime.MinValue, false, sleep);
@@ -572,8 +573,12 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
 
         string GetRawItemId(string mktId)
         {
+            string body = string.Empty, location = string.Empty;
             try
             {
+                string lock_key = $"lock:GetRawItemId:disabled";
+                int count = RedisHelper.Get<int>(lock_key);
+                if (count > 0) return null;
 
                 string cacheKey = $":cache:mkt2itemId:{mktId}";
 
@@ -609,7 +614,24 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
                     throw response.ResponseException;
                 }
 
-                var body = response.Body();
+                location = response.ResponseMessage?.Headers?.Location?.ToString();
+                if (!string.IsNullOrEmpty(location) && location.Contains("err.taobao.com/error1.html"))
+                {
+                    RedisHelper.Set(lock_key, 1, 60);
+
+                    string message = $"【GetRawItemId】{_accountId}:{_accountName}\t{_proxy?.Address}\n" +
+                        $"{mktId}\n{location}";
+
+                    NotifyCore.Notify(new NifyMessage
+                    {
+                        message = message,
+                        priority = NifyMessagePriority.high,
+                        tags = ["red_circle"]
+                    });
+                    return null;
+                }
+
+                body = response.Body();
                 var root = body.Convert2JsonElement();
                 itemId = root.PathRead<string>("model.item.itemId");
                 if (!string.IsNullOrEmpty(itemId))
@@ -620,7 +642,9 @@ SET  order_ord_num = order_ord_num_3 + order_ord_num_12 + order_ord_num_13 + ord
             }
             catch (Exception ex)
             {
-                string message = $"【GetRawItemId】[{mktId}\n{ex.Message}\n{ex.StackTrace}";
+                string message = $"【GetRawItemId】{_accountId}:{_accountName}\t{_proxy?.Address}\n" +
+                    $"{mktId}\n{location}\n{body}\n{ex.Message}";
+
                 NotifyCore.Notify(new NifyMessage
                 {
                     message = message,

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

@@ -100,8 +100,10 @@ namespace molilian.core
                     return (true, resultUrl);
                 }
             }
+            //https://pages-g.m.taobao.com/wow/z/app/detail-next/item/index?x-ssr=true&id=753169018016
 
             if (url.Contains("//item.taobao.com/item.htm?") ||
+                url.Contains("//pages-g.m.taobao.com/wow/z/app/detail-next/item/index?") ||
                 url.Contains("//main.m.taobao.com/detail/index.html?") ||
                 url.Contains("//h5.m.taobao.com/awp/core/detail.htm?") ||
                 url.Contains("//new.m.taobao.com/detail.htm?") ||

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

@@ -226,7 +226,7 @@ namespace molilian.core
                     result.success = false;
                     result.message = "放弃转链";
                     result.reason = "非商品链接";
-                    result.deeplink_url = GetDeeplink(content, LinkTypeEnum.goods);
+                    //result.deeplink_url = GetDeeplink(content, LinkTypeEnum.goods);
                 }
                 return result;
             }

Некоторые файлы не были показаны из-за большого количества измененных файлов