浏览代码

关闭所所有 endpoint "response null" 日志

dodo hold 3 天之前
父节点
当前提交
05acdc709d

文件差异内容过多而无法显示
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 34 - 3
molilian.core/Core/taoke/UnionParseCore/UnionParseCore.cs

@@ -1357,6 +1357,7 @@ namespace molilian.core
         public static async Task<APIResult> PddParseAsync(UnionParseRequest request, CancellationToken cancellationToken = default)
         {
             var result = PddUnionPlus.GetFormattedObject(request);
+            PddDataDTO? hiddenAccountFailure = null;
 
             var overrideContent = await OverrideRuleCore.ProcessAsync(request);
             if (overrideContent != null)
@@ -1503,6 +1504,7 @@ namespace molilian.core
                 PddPoolCore.UpdateAccountUsage(account.id);
 
                 var plus = new PddUnionPlus(account);
+                hiddenAccountFailure = account.is_hide ? CreatePddFailureResult(result) : null;
                 result = await plus.PddParseAsync(content, request.CommerceType, result, cancellationToken);
             }
             catch (Exception ex)
@@ -1533,12 +1535,13 @@ namespace molilian.core
                 }
             }
             _ = TkLogCore.ParseLogAsync(result);
-            return PddParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);
+            return PddParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK, hiddenAccountFailure);
 
         }
         public static async Task<APIResult> GoodsPddParseAsync(UnionParseRequest request, CancellationToken cancellationToken = default)
         {
             var result = PddUnionPlus.GetFormattedObject(request);
+            PddDataDTO? hiddenAccountFailure = null;
 
             string content = request.Content;
             content = content.UrlDecode();
@@ -1698,6 +1701,7 @@ namespace molilian.core
                 PddPoolCore.UpdateAccountUsage(account.id);
 
                 var plus = new PddUnionPlus(account);
+                hiddenAccountFailure = account.is_hide ? CreatePddFailureResult(result) : null;
                 result = await plus.PddParseAsync(content, request.CommerceType, result, cancellationToken);
                 if (!result.success)
                 {
@@ -1732,11 +1736,38 @@ namespace molilian.core
                 }
             }
             _ = TkLogCore.ParseLogAsync(result);
-            return PddParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);
+            return PddParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK, hiddenAccountFailure);
 
         }
-        private static APIResult PddParseOutput(PddDataDTO result, APIResultCodeEnum code = APIResultCodeEnum.OK)
+        private static PddDataDTO CreatePddFailureResult(PddDataDTO result)
         {
+            // 转链前保存失败返回所需的字段,避免成功后的商品信息、短链进入隐藏号响应。
+            return new PddDataDTO
+            {
+                success = false,
+                message = "转链失败",
+                reason = "无法转链",
+                commercial = false,
+                channel = result.channel,
+                link_type = result.link_type,
+                accountId = result.accountId,
+                itemId = result.itemId,
+                itemName = result.itemName,
+                shortLinkurl = result.shortLinkurl,
+                parse_type = result.parse_type,
+                riskStrategy = result.riskStrategy,
+            };
+        }
+
+        private static APIResult PddParseOutput(PddDataDTO result, APIResultCodeEnum code = APIResultCodeEnum.OK, PddDataDTO? hiddenAccountFailure = null)
+        {
+            if (result.success && hiddenAccountFailure != null)
+            {
+                // 只替换对外响应,保留真实转链结果供日志和统计使用。
+                hiddenAccountFailure.deeplink_url = result.deeplink_url;
+                result = hiddenAccountFailure;
+            }
+
             string itemName = result.itemName;
             switch (result.riskStrategy)
             {

+ 3 - 1
molilian.core/Core/taoke/UnionParseCore/dp2dp.cs

@@ -708,6 +708,7 @@ namespace molilian.core
         public static async Task<APIResult> DeeplinkPddParseAsync(UnionParseRequest request, CancellationToken cancellationToken = default)
         {
             var result = PddUnionPlus.GetFormattedObject(request);
+            PddDataDTO? hiddenAccountFailure = null;
             var content = request.Content.UrlDecode();
             result.rawContent = content;
 
@@ -838,6 +839,7 @@ namespace molilian.core
 
                 var plus = new PddUnionPlus(account);
 
+                hiddenAccountFailure = account.is_hide ? CreatePddFailureResult(result) : null;
                 result = await plus.PddParseAsync(content, request.CommerceType, result, cancellationToken);
             }
             catch (Exception ex)
@@ -868,7 +870,7 @@ namespace molilian.core
                 }
             }
             _ = TkLogCore.ParseLogAsync(result);
-            return PddParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK);
+            return PddParseOutput(result, IfExceptional ? APIResultCodeEnum.NotAcceptable : APIResultCodeEnum.OK, hiddenAccountFailure);
         }
 
         private static ParseDeeplinkResust parseJdDeeplinkInput(string content)

+ 12 - 12
molilian.core/Plus/Alimama/parse_endpoint/aliyun.cs

@@ -14,9 +14,9 @@ namespace molilian.core
         {
             if (content.Contains("霸下通用 web 页面-验证码"))
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info("霸下通用 web 页面-验证码")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info("霸下通用 web 页面-验证码")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.link_type = LinkTypeEnum.unknown;
                 result.success = false;
@@ -29,9 +29,9 @@ namespace molilian.core
 
             if (string.IsNullOrEmpty(item_id))
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(content, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(content, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.link_type = LinkTypeEnum.unknown;
                 result.success = false;
@@ -45,9 +45,9 @@ namespace molilian.core
             var response = await plus.GetProductInfoByIds(item_id, _account.open_pid);
             if (response == null)
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(content, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(content, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.link_type = LinkTypeEnum.unknown;
                 result.success = false;
@@ -74,9 +74,9 @@ namespace molilian.core
 
             if (response.Body.Data.Auctions.Count == 0)
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(content, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(content, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.link_type = LinkTypeEnum.unknown;
                 result.success = false;

+ 6 - 6
molilian.core/Plus/Alimama/parse_endpoint/endpoint_tbk_dg.cs

@@ -19,9 +19,9 @@ namespace molilian.core
 #endif
             if (string.IsNullOrEmpty(item_id))
             {
-                _ = new LoggerLibrary("endpoint", "tbk_dg")
-                    .Info(content, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "tbk_dg")
+                //     .Info(content, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.link_type = LinkTypeEnum.unknown;
                 result.success = false;
@@ -37,9 +37,9 @@ namespace molilian.core
 
             if (response == null)
             {
-                _ = new LoggerLibrary("endpoint", "tbk_dg")
-                    .Info(content, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "tbk_dg")
+                //     .Info(content, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.link_type = LinkTypeEnum.unknown;
                 result.success = false;

+ 13 - 13
molilian.core/Plus/Alimama/tkActivity.cs

@@ -25,10 +25,10 @@ namespace molilian.core
             var response = await plus.TaobaoTbkDgGeneralLinkConvert(adzone, result.page_id, [result.item_id]);
             if (response == null)
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(result.item_id, result.page_id)
-                    .Info("response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(result.item_id, result.page_id)
+                //     .Info("response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.success = false;
                 result.message = "fail";
@@ -76,9 +76,9 @@ namespace molilian.core
         {
             if (string.IsNullOrEmpty(item_id))
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(item_id, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(item_id, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.success = false;
                 result.message = "放弃转链";
@@ -90,9 +90,9 @@ namespace molilian.core
             var response = await plus.GetProductInfoByIds(item_id, _account.open_pid2);
             if (response == null)
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(item_id, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(item_id, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.success = false;
                 result.message = "fail";
@@ -117,9 +117,9 @@ namespace molilian.core
 
             if (response.Body.Data.Auctions.Count == 0)
             {
-                _ = new LoggerLibrary("endpoint", "aliyun")
-                    .Info(item_id, "response null")
-                    .SaveAsync();
+                // _ = new LoggerLibrary("endpoint", "aliyun")
+                //     .Info(item_id, "response null")
+                //     .SaveAsync();
                 result.channel = TkChannelEnum.tb;
                 result.success = false;
                 result.message = "result empty";

部分文件因为文件数量过多而无法显示