diff --git a/chain_transfer/svc/svc_turnchain.go b/chain_transfer/svc/svc_turnchain.go index 49f1b93..5b20ec2 100644 --- a/chain_transfer/svc/svc_turnchain.go +++ b/chain_transfer/svc/svc_turnchain.go @@ -565,6 +565,14 @@ func CheckTaobaoWordGetId(eg *xorm.Engine, dbName string, s string, args map[str func CommGetGoods(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map[string]string, tcPrase md.TCPrase, isFirst int, reqCount, pvd, goodsId, countUrl, tklWord, isTkl string) (md.TCPrase, string) { newPvd := pvd now := time.Now() + if pvd == "tb_activity" && tklWord != "" { + var urls = &md.ConvertedUrls{} + urls.TaoBaoWord = tklWord + tcPrase.Count = strings.ReplaceAll(reqCount, countUrl, tklWord) + tcPrase.SuccessCount = zhios_third_party_utils.IntToStr(zhios_third_party_utils.StrToInt(tcPrase.SuccessCount) + 1) + reqCount = tcPrase.Count + return tcPrase, reqCount + } fmt.Println("======================这里", time.Since(now)) goods, pvd, _, _, _, _, _, mddata := ProcessTurnChainByGoodsId(eg, officialEg, tmp, goodsId, pvd, countUrl) fmt.Println("======================这里1", time.Since(now)) @@ -1242,8 +1250,21 @@ func TBByGoodsId(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]string var itemInfo *taobao.Material if goodsId != "" { itemInfo, err = taobaoSdk.ItemDetailById(goodsId, "") - } else { - itemInfo, err = taobaoSdk.ItemDetailByLink(url, "") + } else if strings.Contains(url, "http") { + + bizSceneId := "" + urls := strings.ReplaceAll(url, "?", "&") + "&" + split := strings.Split(urls, "&id=") + if len(split) == 2 { + split1 := strings.Split(split[1], "&") + if len(split1) > 0 { + goodsIds := split1[0] + if php2go.IsNumeric(goodsIds) { + bizSceneId = "2" + } + } + } + itemInfo, err = taobaoSdk.ItemDetailByLink(url, bizSceneId) } if err != nil { return diff --git a/chain_transfer/turn_chain.go b/chain_transfer/turn_chain.go index 9d72a0e..d59e5bc 100644 --- a/chain_transfer/turn_chain.go +++ b/chain_transfer/turn_chain.go @@ -124,6 +124,22 @@ func TurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[str } if PlatType == "" { + } + replaceAll := []string{"(", ")", "\\", "/"} + reqCount2 := reqCount + + for _, v := range replaceAll { + reqCount2 = strings.ReplaceAll(reqCount2, v, "") + } + split1 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{6,15}").FindAllString(reqCount2, -1) + split3 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{4,6}").FindAllString(reqCount2, -1) + split2 := regexp.MustCompile("[a-zA-Z0-9]{6,15}").FindAllString(reqCount2, -1) + if strings.Contains(reqCount2, "http") { + split2 = make([]string, 0) + } + isTao2 := 0 + if len(split1) > 0 || len(split3) > 0 || len(split2) == 2 || strings.Count(reqCount2, "€") >= 1 || strings.Contains(reqCount2, "tb.cn") || ((strings.Contains(reqCount2, "taobao.com") || strings.Contains(reqCount2, "tmall.com")) && strings.Contains(reqCount2, "id=") == false) { + isTao2 = 1 } for k, v := range split { if v == "" { @@ -133,11 +149,46 @@ func TurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[str if k > 0 && tcPrase.GID != "" { isFirst = 0 } - if strings.Contains(v, "m.tb") || strings.Contains(reqCount, "taobao.com") || strings.Contains(reqCount, "tmall.com") { + repV := v + for _, v2 := range replaceAll { + repV = strings.ReplaceAll(repV, v2, "") + } + 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) + split2 := regexp.MustCompile("[a-zA-Z0-9]{6,15}").FindAllString(repV, -1) + if strings.Contains(repV, "http") { + split2 = make([]string, 0) + } + isTao1 := 0 + if len(split1) > 0 || len(split3) > 0 || len(split2) == 2 || strings.Count(repV, "€") >= 1 || strings.Contains(repV, "tb.cn") || ((strings.Contains(repV, "taobao.com") || strings.Contains(repV, "tmall.com")) && strings.Contains(repV, "id=") == false) { + isTao1 = 1 + } + if isTao2 == 1 && isTao1 == 0 { + continue + } + if strings.Contains(v, "m.tb") || strings.Contains(v, "taobao.com") || strings.Contains(v, "tmall.com") || isTao1 == 1 { // 淘口令 //fmt.Println(s) pvd, goodsId, tklWord, _ = svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, v, user) + if len(split3) > 0 || len(split1) > 0 { + split5 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{6,15}").FindAllString(v, -1) + split6 := regexp.MustCompile("[a-zA-Z0-9]{6,15} [a-zA-Z0-9]{4,6}").FindAllString(v, -1) + if len(split5) == 0 && len(split6) == 0 { + split4 := regexp.MustCompile("[a-zA-Z0-9]{8,15}").FindAllString(repV, -1) + v = split4[0] + } else { + if len(split3) > 0 { + v = split3[0] + } + if len(split1) > 0 { + v = split1[0] + } + } + } tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, tklWord, "0") + if pvd == "tb_activity" && tklWord != "" { + continue + } } if strings.Contains(v, "haohuo.jinritemai.") { //https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3556342393857024570&ins_activity_param=yNAkhfs&origin_type=pc_buyin_group&pick_source=v.6nZos