Browse Source

转链

master
huangjiajun 8 months ago
parent
commit
e646d4fee6
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      taobao/convert_url.go

+ 16
- 0
taobao/convert_url.go View File

@@ -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,


Loading…
Cancel
Save