|
@@ -17,6 +17,7 @@ import ( |
|
|
"errors" |
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/jinzhu/copier" |
|
|
"github.com/jinzhu/copier" |
|
|
|
|
|
"github.com/syyongx/php2go" |
|
|
"github.com/tidwall/gjson" |
|
|
"github.com/tidwall/gjson" |
|
|
"math/rand" |
|
|
"math/rand" |
|
|
"regexp" |
|
|
"regexp" |
|
@@ -485,20 +486,47 @@ func TikTokUrl(eg *xorm.Engine, dbName string, gid, activityId string) string { |
|
|
} |
|
|
} |
|
|
return url |
|
|
return url |
|
|
} |
|
|
} |
|
|
func CheckTaobaoWordGetTkl(eg *xorm.Engine, dbName string, s string, args map[string]string) (string, string) { |
|
|
|
|
|
|
|
|
func CheckTaobaoWordGetTkl(eg *xorm.Engine, dbName string, s string, args map[string]string) (string, string, string) { |
|
|
taobaoSdk, _ := taobao.NewTaobaoSDK(eg, dbName, args["platfrom"], zhios_third_party_utils.StrToInt(args["acc_taobao_share_id"]), args["union_id"]) |
|
|
taobaoSdk, _ := taobao.NewTaobaoSDK(eg, dbName, args["platfrom"], zhios_third_party_utils.StrToInt(args["acc_taobao_share_id"]), args["union_id"]) |
|
|
if taobaoSdk == nil { |
|
|
if taobaoSdk == nil { |
|
|
return "", "" |
|
|
|
|
|
|
|
|
return "", "", "" |
|
|
} |
|
|
} |
|
|
urls, _ := taobaoSdk.WnConvertUrlSC(s, "2", taobaoSdk.SelfPromoIdWeb, args["acc_taobao_share_id"]) |
|
|
|
|
|
if urls == nil { |
|
|
|
|
|
return "", "" |
|
|
|
|
|
|
|
|
if strings.Contains(s, "taobao.com") || strings.Contains(s, "tmall.com") { |
|
|
|
|
|
bizSceneId := "" |
|
|
|
|
|
url := strings.ReplaceAll(s, "?", "&") + "&" |
|
|
|
|
|
split := strings.Split(url, "&id=") |
|
|
|
|
|
if len(split) == 2 { |
|
|
|
|
|
split1 := strings.Split(split[1], "&") |
|
|
|
|
|
if len(split1) > 0 { |
|
|
|
|
|
goodsId := split1[0] |
|
|
|
|
|
if php2go.IsNumeric(goodsId) { |
|
|
|
|
|
bizSceneId = "2" |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
s1 := s |
|
|
|
|
|
itemInfo, err := taobaoSdk.ItemDetailByLink(s1, bizSceneId) |
|
|
|
|
|
if itemInfo == nil || err != nil { |
|
|
|
|
|
return "", "", "" |
|
|
|
|
|
} |
|
|
|
|
|
return "", zhios_third_party_utils.AnyToString(itemInfo.ItemID), "" |
|
|
} |
|
|
} |
|
|
// 查无数据 |
|
|
|
|
|
if urls.TaoBaoWord == "" { |
|
|
|
|
|
return "", "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urls, _ := taobaoSdk.WnConvertUrlSC(s, "2", taobaoSdk.CloudPromoIdWeb, args["acc_taobao_share_id"]) |
|
|
|
|
|
if urls != nil { |
|
|
|
|
|
if urls.IsDown == "2" { |
|
|
|
|
|
return "", "", "" |
|
|
|
|
|
} |
|
|
|
|
|
taokou := &md.TaobaoWord{ |
|
|
|
|
|
Text: urls.Tkl, |
|
|
|
|
|
Code: urls.ShortTkl, |
|
|
|
|
|
} |
|
|
|
|
|
urls.TaoBaoWord = WordDeal(eg, args["master_id"], taokou) |
|
|
|
|
|
} |
|
|
|
|
|
if urls != nil { |
|
|
|
|
|
return urls.TaoBaoWord, urls.ItemId, urls.IsDown |
|
|
} |
|
|
} |
|
|
return urls.TaoBaoWord, urls.ItemId |
|
|
|
|
|
|
|
|
return "", "", "" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 淘口令 |
|
|
// 淘口令 |
|
@@ -787,19 +815,22 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str |
|
|
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(reqCount, -1) |
|
|
|
|
|
|
|
|
if len(split1) > 0 || strings.Contains(reqCount, "tb.cn") { |
|
|
if len(split1) > 0 || strings.Contains(reqCount, "tb.cn") { |
|
|
tkl, ItemId := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
if tkl != "" { |
|
|
|
|
|
return md.PVD_TB, ItemId, tkl, "" |
|
|
|
|
|
|
|
|
tkl, ItemId, isDown := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
pvds := md.PVD_TB |
|
|
|
|
|
if isDown == "1" { |
|
|
|
|
|
pvds = "" |
|
|
} |
|
|
} |
|
|
|
|
|
return pvds, ItemId, tkl, "" |
|
|
} |
|
|
} |
|
|
//判断是不是有淘宝链接 |
|
|
//判断是不是有淘宝链接 |
|
|
if strings.Count(reqCount, "€") >= 1 || strings.Contains(reqCount, "tb.cn") { |
|
|
if strings.Count(reqCount, "€") >= 1 || strings.Contains(reqCount, "tb.cn") { |
|
|
|
|
|
|
|
|
ItemId := CheckTaobaoWordGetId(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
if ItemId != "" { |
|
|
|
|
|
return md.PVD_TB, ItemId, "", "" |
|
|
|
|
|
|
|
|
tkl, ItemId, isDown := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
pvds := md.PVD_TB |
|
|
|
|
|
if isDown == "1" { |
|
|
|
|
|
pvds = "" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return pvds, ItemId, tkl, "" |
|
|
} |
|
|
} |
|
|
//split_letter := regexp.MustCompile("[a-zA-Z]{8,15}").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) { |
|
|
if split != nil && ((zhios_third_party_utils.IsChineseChar(reqCount) && strings.Contains(reqCount, "http")) || strings.Contains(reqCount, "http") == false) { |
|
@@ -812,10 +843,12 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if is_tkl == 1 { |
|
|
if is_tkl == 1 { |
|
|
taobaoWord := CheckTaobaoWordGetId(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
if taobaoWord != "" { |
|
|
|
|
|
return md.PVD_TB, taobaoWord, tklWord, "" |
|
|
|
|
|
|
|
|
tkl, ItemId, isDown := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
pvds := md.PVD_TB |
|
|
|
|
|
if isDown == "1" { |
|
|
|
|
|
pvds = "" |
|
|
} |
|
|
} |
|
|
|
|
|
return pvds, ItemId, tkl, "" |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if strings.Contains(reqCount, "http") == false { |
|
|
if strings.Contains(reqCount, "http") == false { |
|
@@ -838,16 +871,20 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if strings.Contains(strings.ToLower(reqCount), "taobao.com") || strings.Contains(strings.ToLower(reqCount), "tmall.com") { |
|
|
if strings.Contains(strings.ToLower(reqCount), "taobao.com") || strings.Contains(strings.ToLower(reqCount), "tmall.com") { |
|
|
taobaoWord := CheckTaobao(eg, officialEg, dbName, reqCount, goodsParam) |
|
|
|
|
|
if taobaoWord != nil { |
|
|
|
|
|
return md.PVD_TB, taobaoWord.ItemId, "", "" |
|
|
|
|
|
|
|
|
tkl, ItemId, isDown := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
pvds := md.PVD_TB |
|
|
|
|
|
if isDown == "1" { |
|
|
|
|
|
pvds = "" |
|
|
} |
|
|
} |
|
|
|
|
|
return pvds, ItemId, tkl, "" |
|
|
} |
|
|
} |
|
|
if strings.Contains(reqCount, "s.click.Taobao") { |
|
|
if strings.Contains(reqCount, "s.click.Taobao") { |
|
|
taobaoWord := CheckTaobao(eg, officialEg, dbName, reqCount, goodsParam) |
|
|
|
|
|
if taobaoWord != nil { |
|
|
|
|
|
return md.PVD_TB, taobaoWord.ItemId, "", "" |
|
|
|
|
|
|
|
|
tkl, ItemId, isDown := CheckTaobaoWordGetTkl(eg, dbName, reqCount, goodsParam) |
|
|
|
|
|
pvds := md.PVD_TB |
|
|
|
|
|
if isDown == "1" { |
|
|
|
|
|
pvds = "" |
|
|
} |
|
|
} |
|
|
|
|
|
return pvds, ItemId, tkl, "" |
|
|
} |
|
|
} |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|