Pārlūkot izejas kodu

增加 useCouponLinkFirst 控制二合一链接配置

dodo hold 1 gadu atpakaļ
vecāks
revīzija
16e47b272e

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
molilian.api/Properties/PublishProfiles/latest.pubxml.user


+ 3 - 0
molilian.core/Core/log/taobao.cs

@@ -249,6 +249,9 @@ namespace molilian.core
                 .Add("ip", data.ip)
                 .Add("oaid", data.oaid)
                 .Add("riskStrategy", data.riskStrategy)
+                .Add("item_url", data.item_url)
+                .Add("item_deeplink_url", data.item_deeplink_url)
+
                 .Add("create_time", data.create_time)
                 .Create(DBContext.InsertType.NORMAL, transaction);
         }

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

@@ -222,8 +222,8 @@ namespace molilian.core
 
             string accountName = item.accountName;
 
-            string shortLinkUrl = summary.shortLinkurl;
-            string deeplinkUrl = summary.deeplink_url;
+            string shortLinkUrl = !string.IsNullOrEmpty(summary.item_url) ? summary.item_url : summary.shortLinkurl;
+            string deeplinkUrl = !string.IsNullOrEmpty(summary.item_deeplink_url) ? summary.item_deeplink_url : summary.deeplink_url;
             switch (account.fake_click_link_type)
             {
                 case FakeClickLinkType.Deeplink:

+ 2 - 0
molilian.core/DTO/alimama/TkDataDTO.cs

@@ -120,6 +120,8 @@ namespace molilian.core
         public string end_point { get; set; } = string.Empty;
         public TkSubCodeEnum subCode { get; set; } = TkSubCodeEnum.Other;
         public string riskStrategy { get; set; } = string.Empty;
+        public string item_url { get; set; } = string.Empty;
+        public string item_deeplink_url { get; set; } = string.Empty;
 
     }
 

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

@@ -65,6 +65,7 @@
         /// brw-浏览器,qapp-快应用
         /// </summary>
         public string riskStrategy { get; set; } = string.Empty;
+        public bool useCouponLinkFirst { get; set; } = true;
 
     }
 }

+ 16 - 1
molilian.core/Plus/Alimama/parse_endpoint/aliyun.cs

@@ -1,5 +1,6 @@
 using dodohold.core;
 using Microsoft.AspNetCore.Mvc;
+using StackExchange.Redis;
 using System.Diagnostics;
 using System.Text.Json;
 using TencentCloud.Tcm.V20210413.Models;
@@ -71,6 +72,8 @@ namespace molilian.core
                 result.subCode = TkSubCodeEnum.NoConvert;
                 return result;
             }
+
+
             var data = response.Body.Data.Auctions[0].Result;
             result.itemId = data.InputItemId;
             result.couponAmount = (decimal)data.CouponAmount;
@@ -80,7 +83,19 @@ namespace molilian.core
             string url = data.Url;
             if (url.StartsWith("//")) url = $"https:{url}";
             result.shortLinkurl = url;
-            result.deeplink_url = AlimamaPlus.GetDeeplink(url);
+            result.deeplink_url = GetDeeplink(result.shortLinkurl);
+
+            result.item_url = url;
+            result.item_deeplink_url = result.deeplink_url;
+
+            string couponShareUrl = data.CouponShareUrl;
+            if (_account.useCouponLinkFirst && !string.IsNullOrEmpty(couponShareUrl))
+            {
+                if (couponShareUrl.StartsWith("//")) couponShareUrl = $"https:{couponShareUrl}";
+                result.shortLinkurl = couponShareUrl;
+                result.deeplink_url = GetDeeplink(couponShareUrl);
+            }
+
             result.mktId = data.ItemId;
             result.itemName = data.Title;
             if (decimal.TryParse(data.PriceAfterCoupon, out decimal promotionPrice))

+ 6 - 0
molilian.core/Plus/Alimama/parse_endpoint/moose_share.cs

@@ -199,6 +199,7 @@ namespace molilian.core
 
                 string qrCodeUrl = item.Read("qrCodeUrl", string.Empty);
 
+                string itemTaoToken = taoToken;
 
                 if (response.ResponseMessage != null)
                 {
@@ -266,6 +267,11 @@ namespace molilian.core
                 shortLinkurl = GetLink(taoToken);
                 string deeplink_url = GetDeeplink(shortLinkurl);
 
+                //补充原商品链接 2025-06-01
+                result.item_url = GetLink(itemTaoToken);
+                result.item_deeplink_url = GetDeeplink(result.item_url);
+
+
                 result.channel = TkChannelEnum.tb;
 
                 if (success)

+ 7 - 0
molilian.core/Plus/Alimama/parse_endpoint/promo_goods.cs

@@ -179,6 +179,7 @@ namespace molilian.core
                 string pic = item.Read("data.pic", string.Empty);
                 if (pic.StartsWith("//")) pic = "https:" + pic;
 
+                string itemTaoToken = taoToken;
                 string qrCodeUrl = item.Read("qrCodeUrl", string.Empty);
 
 
@@ -248,6 +249,12 @@ namespace molilian.core
                 shortLinkurl = GetLink(taoToken);
                 string deeplink_url = GetDeeplink(shortLinkurl);
 
+
+                //补充原商品链接 2025-06-01
+                result.item_url = GetLink(itemTaoToken);
+                result.item_deeplink_url = GetDeeplink(result.item_url);
+
+
                 result.channel = TkChannelEnum.tb;
 
                 if (success)

+ 8 - 2
molilian.core/Plus/Alimama/parse_endpoint/tool_links.cs

@@ -118,7 +118,7 @@ namespace molilian.core
                     }
                     throw new Exception(body);
                 }
-                
+
 
                 if (body.Contains("https://bixi.alicdn.com") && body.Contains("\"action\": \"deny\""))
                 {
@@ -158,7 +158,7 @@ namespace molilian.core
                 if (pic.StartsWith("//")) pic = "https:" + pic;
 
                 string qrCodeUrl = root.PathRead("data.qrCodeUrl", string.Empty);
-
+                string itemTaoToken = taoToken;
 
                 if (response.ResponseMessage != null)
                 {
@@ -225,6 +225,12 @@ namespace molilian.core
                 shortLinkurl = GetLink(taoToken);
                 string deeplink_url = GetDeeplink(shortLinkurl);
 
+
+                //补充原商品链接 2025-06-01
+                result.item_url = GetLink(itemTaoToken);
+                result.item_deeplink_url = GetDeeplink(result.item_url);
+
+
                 result.channel = TkChannelEnum.tb;
 
                 if (success)

+ 7 - 4
molilian.core/Plus/OtherApiPlus.cs

@@ -255,14 +255,17 @@ namespace molilian.core
                 // veapi 缺少商品pic 和 promotionPrice
 
                 result.taoToken = data.Read<string>("cps_full_tpwd", string.Empty);
-                //string coupon_full_tpwd = data.Read<string>("coupon_full_tpwd", string.Empty);
-                //if (!string.IsNullOrEmpty(coupon_full_tpwd)) result.taoToken = coupon_full_tpwd;
 
-                result.shortLinkurl = AlimamaPlus.GetLink(result.taoToken);
-                result.itemName = result.taoToken.GetContentPart(result.shortLinkurl, "").Trim();
+                result.item_url = AlimamaPlus.GetLink(result.taoToken);
+                result.item_deeplink_url = AlimamaPlus.GetDeeplink(result.shortLinkurl);
 
+                string coupon_full_tpwd = data.Read<string>("coupon_full_tpwd", string.Empty);
+                if (!string.IsNullOrEmpty(coupon_full_tpwd)) result.taoToken = coupon_full_tpwd;
 
+                result.shortLinkurl = AlimamaPlus.GetLink(result.taoToken);
                 result.deeplink_url = AlimamaPlus.GetDeeplink(result.shortLinkurl);
+                result.itemName = result.taoToken.GetContentPart(result.shortLinkurl, "").Trim();
+
                 return result;
             }
             else

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels