From e646d4fee61c96876a19c8aeef9b7bd7c30066ca Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 2 Apr 2024 14:44:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- taobao/convert_url.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/taobao/convert_url.go b/taobao/convert_url.go index e8688aa..23abf5d 100644 --- a/taobao/convert_url.go +++ b/taobao/convert_url.go @@ -5,6 +5,7 @@ import ( "encoding/json" "github.com/syyongx/php2go" "strconv" + "strings" ) type UrlInfo struct { @@ -235,6 +236,9 @@ func (t *TB) WnConvertUrlSC(itemId, types, pid, externalId string) (*md.Converte } for _, v := range tmp.TbkScGeneralLinkConvertResponse.Data.MaterialUrlList.MaterialUrlList { + if v.LinkInfoDto.CouponLongUrl == "" && v.LinkInfoDto.CpsLongUrl == "" { + continue + } url = v.LinkInfoDto.CouponLongUrl tkl = v.LinkInfoDto.CouponFullTpwd shortTkl = v.LinkInfoDto.CouponShortTpwd @@ -263,6 +267,18 @@ func (t *TB) WnConvertUrlSC(itemId, types, pid, externalId string) (*md.Converte shortTkl = v.LinkInfoDto.CpsShortTpwd itemUrl = url } + isDown := "0" + if tkl == "" { + isDown = "2" + } + if strings.Contains(string(resp), "该商品已下架") { + isDown = "1" + } + if isDown == "1" { + tkl = "" + shortTkl = "" + itemId = "" + } return &md.ConvertedUrls{ Tkl: tkl, ShortTkl: shortTkl,