huangjiajun vor 7 Monaten
Ursprung
Commit
7380260ac0
3 geänderte Dateien mit 48 neuen und 27 gelöschten Zeilen
  1. +29
    -5
      chain_transfer/svc/svc_turnchain.go
  2. +17
    -14
      chain_transfer/turn_chain.go
  3. +2
    -8
      taobao/convert_url.go

+ 29
- 5
chain_transfer/svc/svc_turnchain.go Datei anzeigen

@@ -485,6 +485,21 @@ func TikTokUrl(eg *xorm.Engine, dbName string, gid, activityId string) string {
}
return url
}
func CheckTaobaoWordGetTkl(eg *xorm.Engine, dbName string, s string, args map[string]string) (string, string) {
taobaoSdk, _ := taobao.NewTaobaoSDK(eg, dbName, args["platfrom"], zhios_third_party_utils.StrToInt(args["acc_taobao_share_id"]), args["union_id"])
if taobaoSdk == nil {
return "", ""
}
urls, _ := taobaoSdk.WnConvertUrlSC(s, "2", taobaoSdk.SelfPromoIdWeb, args["acc_taobao_share_id"])
if urls == nil {
return "", ""
}
// 查无数据
if urls.TaoBaoWord == "" {
return "", ""
}
return urls.TaoBaoWord, urls.ItemId
}

// 淘口令
func CheckTaobaoWordGetId(eg *xorm.Engine, dbName string, s string, args map[string]string) string {
@@ -511,7 +526,7 @@ func CommGetGoods(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]strin
oldCountUrl := countUrl
var urls = &md.ConvertedUrls{}
var err error
if tklWord != "" && zhios_third_party_utils.InArr(pvd, []string{md.PVD_TIKTOKLIFE, md.PVD_TIKTOK, md.PVD_KUAISHOU}) {
if tklWord != "" && zhios_third_party_utils.InArr(pvd, []string{md.PVD_TIKTOKLIFE, md.PVD_TIKTOK, md.PVD_KUAISHOU, md.PVD_TM, md.PVD_TB}) {
urls.TaoBaoWord = tklWord
} else if tklWord != "" && zhios_third_party_utils.InArr(newPvd, []string{md.PVD_TIKTOKLIFE, md.PVD_TIKTOK}) {
urls.TaoBaoWord = tklWord
@@ -575,13 +590,13 @@ func CommGetGoods(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]strin
tcPrase.Count = strings.ReplaceAll(tcPrase.Count, "]]", "]")
}
fmt.Println(isNull)
if (pvd == md.PVD_TIKTOKLIFE || pvd == md.PVD_TIKTOK || newPvd == md.PVD_TIKTOK) && tklWord != "" {
if (pvd == md.PVD_TIKTOKLIFE || pvd == md.PVD_TIKTOK || newPvd == md.PVD_TIKTOK || pvd == md.PVD_TB || pvd == md.PVD_TM) && tklWord != "" {
tcPrase.Count = strings.ReplaceAll(reqCount, countUrl, tklWord)
}
if pvd == md.PVD_KUAISHOU && tklWord != "" {
tcPrase.Count = strings.ReplaceAll(reqCount, countUrl, tklWord)
}
if pvd == md.PVD_TB || pvd == md.PVD_TM {
if (pvd == md.PVD_TB || pvd == md.PVD_TM) && tklWord == "" {
word, _ := ReplaceTbAll(eg, urls.ShortenURL, tmp)
tcPrase.Tkl = word
if countUrl != "" && strings.Contains(countUrl, "http") {
@@ -766,6 +781,17 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str
goodsParam["acc_jd_share_id"] = userProfile.AccJdCloudId
goodsParam["acc_pdd_self_id"] = userProfile.AccPddSelfId
}
//判断如果是有纯字母 字母+数字的内容 并且没有链接的 都调淘宝接口
split := regexp.MustCompile("[a-zA-Z0-9]{9,14}").FindAllString(reqCount, -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)

if len(split1) > 0 || strings.Contains(reqCount, "tb.cn") {
tkl, ItemId := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam)
if tkl != "" {
return md.PVD_TB, ItemId, tkl, ""
}
}
//判断是不是有淘宝链接
if strings.Count(reqCount, "€") >= 1 || strings.Contains(reqCount, "tb.cn") {

@@ -775,8 +801,6 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str
}

}
//判断如果是有纯字母 字母+数字的内容 并且没有链接的 都调淘宝接口
split := regexp.MustCompile("[a-zA-Z0-9]{9,14}").FindAllString(reqCount, -1)
//split_letter := regexp.MustCompile("[a-zA-Z]{8,15}").FindAllString(reqCount, -1)
if split != nil && ((zhios_third_party_utils.IsChineseChar(reqCount) && strings.Contains(reqCount, "http")) || strings.Contains(reqCount, "http") == false) {
var is_tkl = 0


+ 17
- 14
chain_transfer/turn_chain.go Datei anzeigen

@@ -2,7 +2,6 @@ package chain_transfer

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/chain_transfer/svc"
taoke "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/dataoke"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md"
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
@@ -70,9 +69,18 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string)
}
split := strings.Split(reqCount, "\n")
reqCount = strings.ReplaceAll(reqCount, "\nhttp", "http")
if isTikTok == "1" {
fmt.Println("============2", time.Since(now))
reqCount = strings.ReplaceAll(reqCount, "\nhttp", "http")
isTao := 0
if strings.Contains(reqCount, "tb.cn") {
ex := strings.Split(reqCount, "tb.cn")
if len(ex) <= 2 {
isTao = 1
}
}
if isTikTok == "1" || isTao == 1 {
pvd, goodsId, tklWord, _ := svc.FindTaobaoWord(eg, officialEg, args, reqCount, user)
if goodsId != "" || tklWord != "" {
if goodsId != "" || tklWord != "" || pvd == "taobao" {
tcPrase, _ = svc.CommGetGoods(eg, officialEg, args, tcPrase, 1, reqCount, pvd, goodsId, reqCount, tklWord, "0")
}
} else if len(split) > 0 {
@@ -106,12 +114,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string)
}
}
if PlatType == "" {
parse, _ := taoke.DaTaoKeContentParse(args["content"])
//fmt.Println("============1", time.Since(now))
args["platType"] = parse.PlatType
if parse.DataType == "activity" {

}
}
for k, v := range split {
if v == "" {
@@ -275,13 +278,13 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string)
}
url := ""
if zhios_third_party_utils.InArr(pvd, []string{md.PVD_TB, md.PVD_TM}) {
url = v
v = ""
}
if pvd == md.PVD_KUAISHOU {
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, word, "1")
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, word, "0")
} else {
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, url, "0")
if pvd == md.PVD_KUAISHOU {
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, word, "1")
} else {
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, url, "0")
}
}
}
fmt.Println("============"+zhios_third_party_utils.IntToStr(k+3), time.Since(now))


+ 2
- 8
taobao/convert_url.go Datei anzeigen

@@ -87,19 +87,13 @@ func (t *TB) WnConvertUrlSC(itemId, types, pid, externalId string) (*md.Converte
if types == "1" || types == "4" { // 商品ID列表
args["item_id_list"] = itemId
args["biz_scene_id"] = "1"
if php2go.IsNumeric(itemId) {
args["biz_scene_id"] = "2"
}
if externalId != "" && types == "1" {
if externalId != "0" && externalId != "" {
args["relation_id"] = externalId
}
if externalId != "" && types == "4" {
args["external_id"] = externalId
}
}
if types == "2" { //物料列表,可以为url或淘口令
args["material_list"] = itemId
if externalId != "" {
if externalId != "0" && externalId != "" {
args["relation_id"] = externalId
}
}


Laden…
Abbrechen
Speichern