@@ -20,7 +20,7 @@ provider 渠道 | |||
gid 商品id | |||
uid 用户id | |||
*/ | |||
func ChainTransfer(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) map[string]string { | |||
func ChainTransfer(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[string]string) map[string]string { | |||
var res = make(map[string]string) | |||
res["url"] = "" | |||
res["word"] = "" | |||
@@ -65,7 +65,7 @@ func ChainTransfer(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]str | |||
args["gid"] = zhios_third_party_utils.AnyToString(tbItemInfo.ItemID) | |||
} | |||
} | |||
curls, err := svc.ConvertUrl(eg, officialEg, args) | |||
curls, err := svc.ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err != nil || curls == nil { | |||
return res | |||
} | |||
@@ -144,7 +144,7 @@ func ChainTransfer(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]str | |||
} | |||
if zhios_third_party_utils.InArr(args["provider"], []string{md.PVD_TB, md.PVD_TM}) == false { | |||
curls, err := svc.ConvertUrl(eg, officialEg, args) | |||
curls, err := svc.ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err != nil || curls == nil { | |||
return res | |||
} | |||
@@ -3,6 +3,7 @@ package svc | |||
import ( | |||
"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/db/offical" | |||
db2 "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db/zhimeng" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/kuaishou" | |||
"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" | |||
@@ -12,43 +13,80 @@ import ( | |||
"xorm.io/xorm" | |||
) | |||
func KuaiShouKlGoods(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, tikTokArgs map[string]interface{}) *zhimeng.TikTokDetailData { | |||
func KuaiShouUrl(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string, tikTokArgs map[string]interface{}) *md.ConvertedUrls { | |||
param, kuaishouData := GetKuaishouKey(eg, officialEg, zhimengEg, dbName) | |||
if kuaishouData["authType"] != "2" { | |||
str := zhios_third_party_utils.AnyToString(tikTokArgs["external_info"]) | |||
tikTokArgs["external_info"] = "official_" + str | |||
} | |||
arg := map[string]interface{}{ | |||
"cpsLink": tikTokArgs["content"], | |||
"linkType": tikTokArgs["linkType"], | |||
"linkCarrierId": tikTokArgs["gid"], | |||
"comments": tikTokArgs["external_info"], | |||
"cpsPid": kuaishouData["pid"], | |||
} | |||
param, kuaishouData := GetKuaishouKey(eg, officialEg, dbName) | |||
if kuaishouData["authType"] != "2" { | |||
goods, _ := zhimeng.KuaiShouKlGoods(tikTokArgs) | |||
return goods | |||
if zhios_third_party_utils.AnyToInt64(tikTokArgs["genPoster"]) > 0 { | |||
arg["genPoster"] = true | |||
} | |||
param["param"] = zhios_third_party_utils.SerializeStr(arg) | |||
data, err := kuaishou.GetKuishouCpsUrl(kuaishouData["sign_secret"], param) | |||
goods := gjson.Get(data, "data").String() | |||
if goods == "" || err != nil { | |||
return nil | |||
} | |||
res := md.ConvertedUrls{ | |||
URL: gjson.Get(goods, "kwaiUrl").String(), | |||
ShortenURL: gjson.Get(goods, "kwaiUrl").String(), | |||
NoOpenAppURL: gjson.Get(goods, "linkUrl").String(), | |||
AppURL: gjson.Get(goods, "kwaiUrl").String(), | |||
ClickUrl: gjson.Get(goods, "kwaiUrl").String(), | |||
QrcodeUrl: gjson.Get(goods, "posterContent.minaCode").String(), | |||
Content: gjson.Get(goods, "commandContent").String(), | |||
WeChatMiniURL: gjson.Get(goods, "minaJumpContent.pageUrl").String(), | |||
WeChatMiniAPPID: gjson.Get(goods, "minaJumpContent.appId").String(), | |||
} | |||
return &res | |||
} | |||
func KuaiShouKlGoods(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string, tikTokArgs map[string]interface{}) *zhimeng.TikTokDetailData { | |||
arg := map[string]interface{}{ | |||
"cpsLink": tikTokArgs["content"], | |||
} | |||
param, kuaishouData := GetKuaishouKey(eg, officialEg, zhimengEg, dbName) | |||
//if kuaishouData["authType"] != "2" { | |||
// goods, _ := zhimeng.KuaiShouKlGoods(tikTokArgs) | |||
// return goods | |||
//} | |||
param["param"] = zhios_third_party_utils.SerializeStr(arg) | |||
data, err := kuaishou.GetKuishouCpsKlGoods(kuaishouData["sign_secret"], param) | |||
goods := gjson.Get(data, "data.itemId").String() | |||
if goods == "" || err != nil { | |||
return nil | |||
} | |||
detail := KuaiShouDetail(eg, officialEg, dbName, map[string]interface{}{"gid": []string{goods}}) | |||
detail := KuaiShouDetail(eg, officialEg, zhimengEg, dbName, map[string]interface{}{"gid": []string{goods}}) | |||
return detail | |||
} | |||
func GetKuaishouKey(eg *xorm.Engine, officialEg *xorm.Engine, dbName string) (map[string]string, map[string]string) { | |||
kuaishouData := CommKuaishou(eg, officialEg, dbName) | |||
func GetKuaishouKey(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string) (map[string]string, map[string]string) { | |||
kuaishouData := CommKuaishou(eg, officialEg, zhimengEg, dbName) | |||
param := map[string]string{ | |||
"appkey": kuaishouData["appkey"], | |||
"access_token": kuaishouData["token"], | |||
} | |||
return param, kuaishouData | |||
} | |||
func KuaiShouDetail(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, tikTokArgs map[string]interface{}) *zhimeng.TikTokDetailData { | |||
func KuaiShouDetail(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string, tikTokArgs map[string]interface{}) *zhimeng.TikTokDetailData { | |||
arg := map[string]interface{}{ | |||
"itemId": []interface{}{tikTokArgs["gid"]}, | |||
} | |||
param, kuaishouData := GetKuaishouKey(eg, officialEg, dbName) | |||
if kuaishouData["authType"] != "2" { | |||
goods, _ := zhimeng.KuaiShouDetail(tikTokArgs) | |||
return goods | |||
} | |||
param, kuaishouData := GetKuaishouKey(eg, officialEg, zhimengEg, dbName) | |||
//if kuaishouData["authType"] != "2" { | |||
// goods, _ := zhimeng.KuaiShouDetail(tikTokArgs) | |||
// return goods | |||
//} | |||
param["param"] = zhios_third_party_utils.SerializeStr(arg) | |||
data, err := kuaishou.GetKuishouCpsGoodsDetail(kuaishouData["sign_secret"], param) | |||
goods := gjson.Get(data, "data").String() | |||
@@ -97,7 +135,7 @@ func CommGoodsDetail(goods md.KuaishouGoods) zhimeng.TikTokDetailData { | |||
return res | |||
} | |||
func CommKuaishou(eg *xorm.Engine, officialEg *xorm.Engine, dbName string) map[string]string { | |||
func CommKuaishou(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string) map[string]string { | |||
kuaishouAppkey := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_appkey") | |||
kuaishouAppSecret := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_app_secret") | |||
kuaishouSignSecret := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_sign_secret") | |||
@@ -127,6 +165,12 @@ func CommKuaishou(eg *xorm.Engine, officialEg *xorm.Engine, dbName string) map[s | |||
authType = zhios_third_party_utils.IntToStr(cfg.AuthType) | |||
kuaishouToken = gjson.Get(cfg.KeyData, "teamAccessToken").String() | |||
pid = gjson.Get(cfg.KeyData, "pid").String() | |||
} else { | |||
res := OfficialCommKuaishou(officialEg, zhimengEg) | |||
res["own_appkey"] = kuaishouAppkey | |||
res["own_app_secret"] = kuaishouAppSecret | |||
res["own_sign_secret"] = kuaishouSignSecret | |||
return res | |||
} | |||
res := map[string]string{ | |||
"authType": authType, | |||
@@ -138,6 +182,23 @@ func CommKuaishou(eg *xorm.Engine, officialEg *xorm.Engine, dbName string) map[s | |||
} | |||
return res | |||
} | |||
func OfficialCommKuaishou(officialEg, zhimengEg *xorm.Engine) map[string]string { | |||
kuaishouAppkey := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_kfx_appkey") | |||
kuaishouAppSecret := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_kfx_app_secret") | |||
kuaishouSignSecret := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_kfx_sign_secret") | |||
authType := "0" | |||
kuaishouToken := db2.MasterListCfgGetOneData(zhimengEg, "0", "kuaishou_official_access_token") | |||
kuaishouPid := offical.MasterListCfgGetOneData(officialEg, "0", "kuaishou_official_pid") | |||
res := map[string]string{ | |||
"pid": kuaishouPid, | |||
"authType": authType, | |||
"appkey": kuaishouAppkey, | |||
"token": kuaishouToken, | |||
"app_secret": kuaishouAppSecret, | |||
"sign_secret": kuaishouSignSecret, | |||
} | |||
return res | |||
} | |||
func AppUserListPuidWithDb(officialEg *xorm.Engine, dbName string) string { | |||
appList := offical.GetUserAppList(officialEg, dbName) | |||
@@ -28,7 +28,7 @@ import ( | |||
) | |||
//转链主入口 | |||
func TurnChainFeatures(eg *xorm.Engine, officialEg *xorm.Engine, tikTokBase map[string]string, user *model.User) (*md.ConvertedUrls, error) { | |||
func TurnChainFeatures(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tikTokBase map[string]string, user *model.User) (*md.ConvertedUrls, error) { | |||
pvd := tikTokBase["pvd"] | |||
dbName := tikTokBase["master_id"] | |||
goodsId := tikTokBase["gid"] | |||
@@ -66,9 +66,9 @@ func TurnChainFeatures(eg *xorm.Engine, officialEg *xorm.Engine, tikTokBase map[ | |||
} | |||
goodsId += "csjp" | |||
tikTokBase["gid"] = goodsId | |||
urls, err = TikTokTurnChain(eg, officialEg, dbName, tikTokBase) | |||
urls, err = TikTokTurnChain(eg, officialEg, zhimengEg, dbName, tikTokBase) | |||
case md.PVD_TB, md.PVD_TM: | |||
urls, err = TBOrTmTurnChain(eg, officialEg, dbName, tikTokBase) | |||
urls, err = TBOrTmTurnChain(eg, officialEg, zhimengEg, dbName, tikTokBase) | |||
case md.PVD_JD: | |||
urls, err = JDTurnChain(eg, dbName, tikTokBase) | |||
@@ -79,8 +79,8 @@ func TurnChainFeatures(eg *xorm.Engine, officialEg *xorm.Engine, tikTokBase map[ | |||
} | |||
return urls, err | |||
} | |||
func TBOrTmTurnChain(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, args map[string]string) (*md.ConvertedUrls, error) { | |||
urls, err := ConvertUrl(eg, officialEg, args) | |||
func TBOrTmTurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string, args map[string]string) (*md.ConvertedUrls, error) { | |||
urls, err := ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -210,7 +210,7 @@ func PDDTurnChain(eg *xorm.Engine, dbName string, args map[string]string) (*md.C | |||
return urls, nil | |||
} | |||
func TikTokTurnChain(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, args map[string]string) (*md.ConvertedUrls, error) { | |||
func TikTokTurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string, args map[string]string) (*md.ConvertedUrls, error) { | |||
couponShareURL := "" | |||
itemUrl := args["itemUrl"] | |||
if strings.Contains(args["gid"], "csjp") { | |||
@@ -242,13 +242,13 @@ func TikTokTurnChain(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, ar | |||
couponShareURL = "https://haohuo.jinritemai.com/views/product/item2?id=" + args["gid"] | |||
} | |||
args["coupon_url"] = couponShareURL | |||
urls, err := ConvertUrl(eg, officialEg, args) | |||
urls, err := ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err != nil { | |||
return nil, err | |||
} | |||
return urls, nil | |||
} | |||
func ConvertUrl(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) (*md.ConvertedUrls, error) { | |||
func ConvertUrl(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[string]string) (*md.ConvertedUrls, error) { | |||
var ( | |||
err error | |||
) | |||
@@ -378,7 +378,8 @@ func ConvertUrl(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string | |||
tikTokArgs["linkType"] = "101" | |||
tikTokArgs["genPoster"] = "0" | |||
tikTokArgs["external_info"] = pid + "_" + args["master_id"] | |||
urls, err = zhimeng.KuaiShouUrl(tikTokArgs) | |||
urls = KuaiShouUrl(eg, officialEg, zhimengEg, args["master_id"], tikTokArgs) | |||
} | |||
case md.PVD_VIP: | |||
thirdZmAppKeyData, err := db.SysCfgGetOne(eg, "third_zm_app_key") | |||
@@ -561,7 +562,7 @@ func CheckTaobaoWordGetId(eg *xorm.Engine, dbName string, s string, args map[str | |||
} | |||
return urls.ItemId | |||
} | |||
func CommGetGoods(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]string, tcPrase md.TCPrase, isFirst int, reqCount, pvd, goodsId, countUrl, tklWord, isTkl string) (md.TCPrase, string) { | |||
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() | |||
fmt.Println("======================这里", time.Since(now)) | |||
@@ -592,7 +593,7 @@ func CommGetGoods(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]strin | |||
tikTokBase[k1] = v1 | |||
} | |||
tikTokBase["itemUrl"] = countUrl | |||
urls, err = TurnChainFeatures(eg, officialEg, tikTokBase, user) | |||
urls, err = TurnChainFeatures(eg, officialEg, zhimengEg, tikTokBase, user) | |||
if err != nil || urls == nil { | |||
return tcPrase, reqCount | |||
} | |||
@@ -713,7 +714,7 @@ func WordDeal(eg *xorm.Engine, dbName string, word *md.TaobaoWord) string { | |||
} | |||
//淘口令判断 | |||
func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]string, reqCount string, user *model.User) (pvd, goodsId, tklWord, url string) { | |||
func FindTaobaoWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map[string]string, reqCount string, user *model.User) (pvd, goodsId, tklWord, url string) { | |||
dbName := tmp["master_id"] | |||
if strings.Contains(reqCount, "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 | |||
@@ -730,7 +731,7 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str | |||
tikTokBase[k1] = v1 | |||
} | |||
tikTokBase["itemUrl"] = reqCount | |||
urls, err := TurnChainFeatures(eg, officialEg, tikTokBase, user) | |||
urls, err := TurnChainFeatures(eg, officialEg, zhimengEg, tikTokBase, user) | |||
if err != nil || urls == nil { | |||
return "", "", "", "" | |||
} | |||
@@ -742,13 +743,13 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str | |||
} | |||
} | |||
if strings.Contains(reqCount, "【快手】") { | |||
info, _ := CheckKuaishouWord(eg, officialEg, dbName, reqCount, user, 1) | |||
info, _ := CheckKuaishouWord(eg, officialEg, zhimengEg, dbName, reqCount, user, 1) | |||
if info != nil { | |||
return md.PVD_KUAISHOU, info.ItemId, info.Word, "" | |||
} | |||
} | |||
if strings.Contains(reqCount, "dou音") || strings.Contains(reqCount, "buydouke") || (strings.Contains(reqCount, "抖音") || strings.Contains(reqCount, "douyin")) && strings.Contains(reqCount, "【") { | |||
info := CheckTikTokWord(eg, officialEg, dbName, reqCount, user, 0) | |||
info := CheckTikTokWord(eg, officialEg, zhimengEg, dbName, reqCount, user, 0) | |||
activityId := "" | |||
pvd1 := md.PVD_TIKTOK | |||
if info != nil { | |||
@@ -793,7 +794,7 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str | |||
args["master_id"] = dbName | |||
args["provider"] = pvd1 | |||
args["uid"] = zhios_third_party_utils.IntToStr(user.Uid) | |||
curls, err = ConvertUrl(eg, officialEg, args) | |||
curls, err = ConvertUrl(eg, officialEg, zhimengEg, args) | |||
} | |||
if err != nil { | |||
return "", "", "", "" | |||
@@ -869,12 +870,12 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str | |||
} | |||
if strings.Contains(reqCount, "http") == false { | |||
if tmp["platType"] != "taobao" { | |||
info := CheckTikTokWord(eg, officialEg, dbName, reqCount, user, 1) | |||
info := CheckTikTokWord(eg, officialEg, zhimengEg, dbName, reqCount, user, 1) | |||
if info != nil { | |||
return md.PVD_TIKTOK, info.ItemId, info.Word, info.Url | |||
} | |||
info, _ = CheckKuaishouWord(eg, officialEg, dbName, reqCount, user, 1) | |||
info, _ = CheckKuaishouWord(eg, officialEg, zhimengEg, dbName, reqCount, user, 1) | |||
if info != nil { | |||
return md.PVD_KUAISHOU, info.ItemId, info.Word, "" | |||
} | |||
@@ -904,7 +905,7 @@ func FindTaobaoWord(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]str | |||
} | |||
return | |||
} | |||
func CheckTaobao(eg *xorm.Engine, officialEg *xorm.Engine, dbName, s string, args map[string]string) *md.ItemParseInfo { | |||
func CheckTaobao(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName, s string, args map[string]string) *md.ItemParseInfo { | |||
bizSceneId := "" | |||
taobaoSdk, _ := taobao.NewTaobaoSDK(eg, args["master_id"], args["platform"], zhios_third_party_utils.StrToInt(args["acc_taobao_share_id"]), args["union_id"]) | |||
if taobaoSdk == nil { | |||
@@ -928,7 +929,7 @@ func CheckTaobao(eg *xorm.Engine, officialEg *xorm.Engine, dbName, s string, arg | |||
couponUrl := itemInfo.URL | |||
//调用好单库 | |||
//hdkItemInfo, itemInfo, providers := GetHdkDtkGoods(c, itemInfo, md.PVD_DTK) | |||
convertUrl, err := ConvertUrl(eg, officialEg, args) | |||
convertUrl, err := ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err == nil && convertUrl != nil { | |||
couponUrl = convertUrl.ShortenURL | |||
} | |||
@@ -1013,7 +1014,7 @@ func getFirstTikTokGoodsKl(eg *xorm.Engine, officialEg *xorm.Engine, dbName stri | |||
return itemData, err | |||
} | |||
func CheckTikTokWord(eg *xorm.Engine, officialEg *xorm.Engine, dbName, s string, user *model.User, isChange int) *md.ItemParseInfo { | |||
func CheckTikTokWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName, s string, user *model.User, isChange int) *md.ItemParseInfo { | |||
var postData = map[string]interface{}{} | |||
postData["appkey"] = db.SysCfgGetWithDb(eg, dbName, md.KEY_CFG_ZM_AK) | |||
postData["secret_key"] = db.SysCfgGetWithDb(eg, dbName, md.KEY_CFG_ZM_SK) | |||
@@ -1075,7 +1076,7 @@ func CheckTikTokWord(eg *xorm.Engine, officialEg *xorm.Engine, dbName, s string, | |||
args["provider"] = "csjp" | |||
} | |||
args["uid"] = zhios_third_party_utils.IntToStr(user.Uid) | |||
convertUrl, err := ConvertUrl(eg, officialEg, args) | |||
convertUrl, err := ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err == nil && convertUrl != nil { | |||
couponUrl = convertUrl.AppURL | |||
word = convertUrl.Content | |||
@@ -1115,12 +1116,12 @@ func TikTokToken(eg *xorm.Engine) string { | |||
} | |||
return tokeStr | |||
} | |||
func CheckKuaishouWord(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, s string, user *model.User, isChange int) (*md.ItemParseInfo, bool) { | |||
func CheckKuaishouWord(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, dbName string, s string, user *model.User, isChange int) (*md.ItemParseInfo, bool) { | |||
var postData = map[string]interface{}{} | |||
postData["appkey"] = db.SysCfgGetWithDb(eg, dbName, md.KEY_CFG_ZM_AK) | |||
postData["secret_key"] = db.SysCfgGetWithDb(eg, dbName, md.KEY_CFG_ZM_SK) | |||
postData["content"] = s | |||
itemData := KuaiShouKlGoods(eg, officialEg, dbName, postData) | |||
itemData := KuaiShouKlGoods(eg, officialEg, zhimengEg, dbName, postData) | |||
if itemData == nil || itemData.GoodsID == "" { | |||
return nil, false | |||
@@ -1151,7 +1152,7 @@ func CheckKuaishouWord(eg *xorm.Engine, officialEg *xorm.Engine, dbName string, | |||
args["master_id"] = dbName | |||
args["provider"] = provider | |||
args["uid"] = zhios_third_party_utils.IntToStr(user.Uid) | |||
convertUrl, err := ConvertUrl(eg, officialEg, args) | |||
convertUrl, err := ConvertUrl(eg, officialEg, zhimengEg, args) | |||
if err == nil && convertUrl != nil { | |||
couponUrl = convertUrl.AppURL | |||
word = convertUrl.Content | |||
@@ -13,7 +13,7 @@ import ( | |||
"xorm.io/xorm" | |||
) | |||
func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) md.TCPrase { | |||
func TurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[string]string) md.TCPrase { | |||
dbName := args["master_id"] | |||
var tcPrase md.TCPrase | |||
tcPrase.TurnGoods = make([]md.TurnGoods, 0) | |||
@@ -79,9 +79,9 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
} | |||
if isTikTok == "1" || isTao == 1 { | |||
pvd, goodsId, tklWord, _ := svc.FindTaobaoWord(eg, officialEg, args, reqCount, user) | |||
pvd, goodsId, tklWord, _ := svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, reqCount, user) | |||
if goodsId != "" || tklWord != "" || pvd == "taobao" { | |||
tcPrase, _ = svc.CommGetGoods(eg, officialEg, args, tcPrase, 1, reqCount, pvd, goodsId, reqCount, tklWord, "0") | |||
tcPrase, _ = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, 1, reqCount, pvd, goodsId, reqCount, tklWord, "0") | |||
} | |||
} else if len(split) > 0 { | |||
for _, v := range split { | |||
@@ -127,8 +127,8 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
if strings.Contains(v, "m.tb") || strings.Contains(reqCount, "taobao.com") || strings.Contains(reqCount, "tmall.com") { | |||
// 淘口令 | |||
//fmt.Println(s) | |||
pvd, goodsId, tklWord, _ = svc.FindTaobaoWord(eg, officialEg, args, v, user) | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, tklWord, "0") | |||
pvd, goodsId, tklWord, _ = svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, v, user) | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, tklWord, "0") | |||
} | |||
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 | |||
@@ -141,7 +141,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
for k1, v1 := range tikTokBase { | |||
args[k1] = v1 | |||
} | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_TIKTOK, split1[0], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_TIKTOK, split1[0], v, tklWord, "0") | |||
if zhios_third_party_utils.StrToInt(tikTokBase["tik_activity_id"]) > 0 && strings.Contains(tcPrase.GID, "cid") == false { | |||
tcPrase.GID += "cid" + tikTokBase["tik_activity_id"] | |||
} | |||
@@ -161,12 +161,12 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
goodsidStrs := strings.Split(split[index], ".html") | |||
if len(goodsidStrs) > 0 { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, goodsidStrs[0], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, goodsidStrs[0], v, tklWord, "0") | |||
} | |||
} else { | |||
findAllUrl1 := xurls.Strict.FindAllString(v, -1) | |||
for _, v1 := range findAllUrl1 { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, "", v1, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, "", v1, tklWord, "0") | |||
} | |||
} | |||
} | |||
@@ -178,13 +178,13 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
for _, v2 := range sUrl { | |||
if strings.Contains(v2, "goods_id=") { | |||
goods := strings.Split(v2, "=") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, goods[1], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, goods[1], v, tklWord, "0") | |||
} | |||
} | |||
} | |||
} else { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, "", v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, "", v, tklWord, "0") | |||
} | |||
} | |||
if strings.Contains(v, "kaola.com") { | |||
@@ -198,7 +198,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
goodsidStrs := strings.Split(split[index], ".html") | |||
if len(goodsidStrs) > 0 { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_KL, goodsidStrs[0], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_KL, goodsidStrs[0], v, tklWord, "0") | |||
} | |||
return tcPrase | |||
} | |||
@@ -218,7 +218,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
i := bytes[index:len(bytes)] | |||
fmt.Println(string(i)) | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_SN, string(i), v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_SN, string(i), v, tklWord, "0") | |||
} | |||
if strings.Contains(v, "vip.") { | |||
gid := "" | |||
@@ -244,7 +244,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
gid = product[len(product)-1] | |||
} | |||
} | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_VIP, gid, v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_VIP, gid, v, tklWord, "0") | |||
} | |||
newV := strings.ToLower(v) | |||
for i := 0; i < 10; i++ { | |||
@@ -272,18 +272,18 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
if goodsId == "" && (zhios_third_party_utils.IsAllChinese(newV) == false && (PlatType == "taobao" || PlatType == "") || PlatType == "tkl") { | |||
pvd, goodsId, word, _ := svc.FindTaobaoWord(eg, officialEg, args, v, user) | |||
pvd, goodsId, word, _ := svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, v, user) | |||
if goodsId == "" && pvd == "" { | |||
continue | |||
} | |||
url := "" | |||
if zhios_third_party_utils.InArr(pvd, []string{md.PVD_TB, md.PVD_TM}) { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, word, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, word, "0") | |||
} else { | |||
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, zhimengEg, 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") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, url, "0") | |||
} | |||
} | |||
} | |||
@@ -300,12 +300,12 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
isFirst = 0 | |||
} | |||
for _, v1 := range v { | |||
pvd, goodsId, _, _ := svc.FindTaobaoWord(eg, officialEg, args, v1, user) | |||
pvd, goodsId, _, _ := svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, v1, user) | |||
url := "" | |||
if len(findAllUrl) > 0 { | |||
url = findAllUrl[k] | |||
} | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, url, v1, "1") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, url, v1, "1") | |||
} | |||
} | |||
} else if len(findAllUrl) > 0 && isTikTok == "0" { | |||
@@ -318,8 +318,8 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
strings.Contains(reqCount, "taobao.com") || strings.Contains(reqCount, "tmall.com") { | |||
// 淘口令 | |||
//fmt.Println(s) | |||
pvd, goodsId, tklWord, _ = svc.FindTaobaoWord(eg, officialEg, args, v, user) | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, tklWord, "0") | |||
pvd, goodsId, tklWord, _ = svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, v, user) | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, pvd, goodsId, v, tklWord, "0") | |||
} | |||
if strings.Contains(v, "haohuo.jinritemai.") { | |||
tikTokBase := svc.CommTik(eg, args["master_id"], v) | |||
@@ -328,7 +328,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
if len(split) == 2 { | |||
split1 := strings.Split(split[1], "&") | |||
if len(split1) > 0 { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_TIKTOK, split1[0], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_TIKTOK, split1[0], v, tklWord, "0") | |||
if zhios_third_party_utils.StrToInt(tikTokBase["tik_activity_id"]) > 0 && strings.Contains(tcPrase.GID, "cid") == false { | |||
tcPrase.GID += "cid" + tikTokBase["tik_activity_id"] | |||
} | |||
@@ -348,10 +348,10 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
goodsidStrs := strings.Split(split[index], ".html") | |||
if len(goodsidStrs) > 0 { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, goodsidStrs[0], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, goodsidStrs[0], v, tklWord, "0") | |||
} | |||
} else { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, "", v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_JD, "", v, tklWord, "0") | |||
} | |||
} | |||
if strings.Contains(v, "pinduoduo.com") || strings.Contains(v, "yangkeduo.com") { | |||
@@ -362,13 +362,13 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
for _, v2 := range sUrl { | |||
if strings.Contains(v2, "goods_id=") { | |||
goods := strings.Split(v2, "=") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, goods[1], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, goods[1], v, tklWord, "0") | |||
} | |||
} | |||
} | |||
} else { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, "", v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_PDD, "", v, tklWord, "0") | |||
} | |||
} | |||
if strings.Contains(v, "kaola.com") { | |||
@@ -382,7 +382,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
goodsidStrs := strings.Split(split[index], ".html") | |||
if len(goodsidStrs) > 0 { | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_KL, goodsidStrs[0], v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_KL, goodsidStrs[0], v, tklWord, "0") | |||
} | |||
return tcPrase | |||
} | |||
@@ -402,7 +402,7 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
i := bytes[index:len(bytes)] | |||
fmt.Println(string(i)) | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_SN, string(i), v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_SN, string(i), v, tklWord, "0") | |||
} | |||
if strings.Contains(v, "vip.") { | |||
@@ -430,14 +430,14 @@ func TurnChain(eg *xorm.Engine, officialEg *xorm.Engine, args map[string]string) | |||
} | |||
} | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, args, tcPrase, isFirst, reqCount, md.PVD_VIP, gid, v, tklWord, "0") | |||
tcPrase, reqCount = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, isFirst, reqCount, md.PVD_VIP, gid, v, tklWord, "0") | |||
} | |||
} | |||
} else { | |||
pvd, goodsId, tklWord, _ := svc.FindTaobaoWord(eg, officialEg, args, reqCount, user) | |||
pvd, goodsId, tklWord, _ := svc.FindTaobaoWord(eg, officialEg, zhimengEg, args, reqCount, user) | |||
if goodsId != "" { | |||
tcPrase, _ = svc.CommGetGoods(eg, officialEg, args, tcPrase, 1, reqCount, pvd, goodsId, "", tklWord, "0") | |||
tcPrase, _ = svc.CommGetGoods(eg, officialEg, zhimengEg, args, tcPrase, 1, reqCount, pvd, goodsId, "", tklWord, "0") | |||
} | |||
} | |||
@@ -10,7 +10,7 @@ func SysUnionByJdByUseByAuth(Db *xorm.Engine, masterId string) (*model.SysUnionS | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'jd' AND is_use = 1 ").Get(&m) | |||
has, err := Db.Where("provider = 'jd' AND is_use = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -26,7 +26,7 @@ func SysUnionByTaobaoByUseByAuth(Db *xorm.Engine, masterId string) (*model.SysUn | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'taobao' AND is_use = 1 AND auth_status = 1").Get(&m) | |||
has, err := Db.Where("provider = 'taobao' AND is_use = 1 AND auth_status = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -40,7 +40,7 @@ func SysUnionByMeituanByUseByAuth(Db *xorm.Engine, masterId string) (*model.SysU | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'meituan' AND is_use = 1 ").Get(&m) | |||
has, err := Db.Where("provider = 'meituan' AND is_use = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -54,7 +54,7 @@ func SysUnionByTikTokByUseByAuth(Db *xorm.Engine, masterId string) (*model.SysUn | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'tikTok' AND is_use = 1 ").Get(&m) | |||
has, err := Db.Where("provider = 'tikTok' AND is_use = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -68,7 +68,7 @@ func SysUnionByElmByUseByAuth(Db *xorm.Engine, masterId string) (*model.SysUnion | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'elm' AND is_use = 1 ").Get(&m) | |||
has, err := Db.Where("provider = 'elm' AND is_use = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -97,7 +97,7 @@ func SysUnionByTikTokByUseByAuthNoCache(Db *xorm.Engine, masterId string) (*mode | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'tikTok' AND is_use = 1 ").Get(&m) | |||
has, err := Db.Where("provider = 'tikTok' AND is_use = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -112,7 +112,7 @@ func SysUnionByPVDByUse(Db *xorm.Engine, masterId, pvd string) (*model.SysUnionS | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = ? AND is_use = 1", pvd).Get(&m) | |||
has, err := Db.Where("provider = ? AND is_use = 1 and is_delete=0", pvd).Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -142,7 +142,7 @@ func SysUnionByKuaishouByUseByAuth(Db *xorm.Engine, masterId string) (*model.Sys | |||
var ( | |||
m model.SysUnionSet | |||
) | |||
has, err := Db.Where("provider = 'kuaishou' AND is_use = 1 ").Get(&m) | |||
has, err := Db.Where("provider = 'kuaishou' AND is_use = 1 and is_delete=0").Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
@@ -0,0 +1,19 @@ | |||
package db | |||
import ( | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db/zhimeng/model" | |||
"xorm.io/xorm" | |||
) | |||
func MasterListCfgGetOneData(eg *xorm.Engine, uid, key string) string { | |||
var cfgList model.MasterListCfg | |||
has, err := eg.Where("`k`=? and uid=?", key, uid).Get(&cfgList) | |||
if err != nil { | |||
return "" | |||
} | |||
if has == false { | |||
cfgList = model.MasterListCfg{Uid: uid, K: key} | |||
eg.InsertOne(&cfgList) | |||
} | |||
return cfgList.V | |||
} |
@@ -0,0 +1,9 @@ | |||
package model | |||
type MasterListCfg struct { | |||
K string `json:"k" xorm:"not null VARCHAR(255)"` | |||
V string `json:"v" xorm:"TEXT"` | |||
Memo string `json:"memo" xorm:"VARCHAR(255)"` | |||
Uid string `json:"uid" xorm:"comment('0是官方') VARCHAR(255)"` | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
} |