Ver código fonte

淘宝

master
huangjiajun 4 meses atrás
pai
commit
a13176f971
2 arquivos alterados com 40 adições e 5 exclusões
  1. +32
    -3
      chain_transfer/svc/svc_turnchain.go
  2. +8
    -2
      taobao/convert_url.go

+ 32
- 3
chain_transfer/svc/svc_turnchain.go Ver arquivo

@@ -595,6 +595,14 @@ func CheckTaobaoWordGetTkl(eg *xorm.Engine, dbName string, s string, args map[st
Code: urls.ShortTkl,
}
urls.TaoBaoWord = WordDeal(eg, args["master_id"], taokou)
if urls.TaoBaoWord == "" {
// 生成淘口令
taokou, err := taobaoSdk.WordCreate(urls.ShortenURL, "12345")
if err != nil {
taokou = new(md.TaobaoWord)
}
urls.TaoBaoWord = WordDeal(eg, args["master_id"], taokou)
}
}
if urls != nil {
return urls.TaoBaoWord, urls.ItemId, urls.IsDown
@@ -902,17 +910,26 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map
goodsParam["acc_vip_self_id"] = userProfile.AccVipShareId

}
repV := reqCount
replaceAll := []string{"(", ")", "\\", "/"}
for _, v2 := range replaceAll {
repV = strings.ReplaceAll(repV, v2, "")
}
//判断如果是有纯字母 字母+数字的内容 并且没有链接的 都调淘宝接口
split := regexp.MustCompile("[a-zA-Z0-9]{9,14}").FindAllString(reqCount, -1)
split := regexp.MustCompile("[a-zA-Z0-9]{9,14}").FindAllString(repV, -1)
//split_letter := regexp.MustCompile("[a-zA-Z]{8,15}").FindAllString(reqCount, -1)
split1 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{6,15}").FindAllString(reqCount, -1)
split1 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{6,15}").FindAllString(repV, -1)
split3 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{4,6}").FindAllString(repV, -1)

if len(split1) > 0 || strings.Contains(reqCount, "tb.cn") {
if len(split1) > 0 || len(split3) > 0 || strings.Contains(reqCount, "tb.cn") {
tkl, ItemId, isDown := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam)
pvds := md.PVD_TB
if isDown == "1" {
pvds = ""
}
if isDown == "10" && tkl != "" {
pvds = "tb_activity"
}
return pvds, ItemId, tkl, ""
}
//判断是不是有淘宝链接
@@ -923,6 +940,9 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map
if isDown == "1" {
pvds = ""
}
if isDown == "10" && tkl != "" {
pvds = "tb_activity"
}
return pvds, ItemId, tkl, ""
}
//split_letter := regexp.MustCompile("[a-zA-Z]{8,15}").FindAllString(reqCount, -1)
@@ -941,6 +961,9 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map
if isDown == "1" {
pvds = ""
}
if isDown == "10" && tkl != "" {
pvds = "tb_activity"
}
return pvds, ItemId, tkl, ""
}
}
@@ -969,6 +992,9 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map
if isDown == "1" {
pvds = ""
}
if isDown == "10" && tkl != "" {
pvds = "tb_activity"
}
return pvds, ItemId, tkl, ""
}
if strings.Contains(reqCount, "s.click.Taobao") {
@@ -977,6 +1003,9 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map
if isDown == "1" {
pvds = ""
}
if isDown == "10" && tkl != "" {
pvds = "tb_activity"
}
return pvds, ItemId, tkl, ""
}
return


+ 8
- 2
taobao/convert_url.go Ver arquivo

@@ -234,7 +234,7 @@ func (t *TB) WnConvertUrlSC(itemId, types, pid, externalId string) (*md.Converte
isitem = 1
maxCommissionRate = v.PromotionInfoDto.CommissionRate
}
isActivity := 0
for _, v := range tmp.TbkScGeneralLinkConvertResponse.Data.MaterialUrlList.MaterialUrlList {
if v.LinkInfoDto.CouponLongUrl == "" && v.LinkInfoDto.CpsLongUrl == "" {
continue
@@ -255,6 +255,9 @@ func (t *TB) WnConvertUrlSC(itemId, types, pid, externalId string) (*md.Converte
itemId = v.LinkInfoDto.MaterialId
isitem = 1
}
if v.LinkInfoDto.MaterialType == 3 {
isActivity = 1
}
itemUrl = url
maxCommissionRate = v.PromotionInfoDto.CommissionRate
}
@@ -268,10 +271,13 @@ func (t *TB) WnConvertUrlSC(itemId, types, pid, externalId string) (*md.Converte
itemUrl = url
}
isDown := "0"
if isActivity == 1 {
isDown = "10"
}
if tkl == "" {
isDown = "2"
}
if strings.Contains(string(resp), "该商品已下架") {
if strings.Contains(string(resp), "该商品已下架") || strings.Contains(string(resp), "URL解析失败") || strings.Contains(string(resp), "当前APPKEY无淘口令解析权限") {
isDown = "1"
}
return &md.ConvertedUrls{


Carregando…
Cancelar
Salvar