diff --git a/chain_transfer/svc/svc_turnchain.go b/chain_transfer/svc/svc_turnchain.go index 5b20ec2..3825ca2 100644 --- a/chain_transfer/svc/svc_turnchain.go +++ b/chain_transfer/svc/svc_turnchain.go @@ -579,11 +579,15 @@ func CommGetGoods(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, tmp map[s oldCountUrl := countUrl var urls = &md.ConvertedUrls{} var err error + if len(tklWord) <= 3 { + tklWord = "" + } 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 } else { + if goods != nil { if goods.ClickUrl != "" { urls.ShortenURL = goods.ClickUrl @@ -1403,11 +1407,14 @@ func PDDByGoodsId(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]strin postData["appkey"] = db.SysCfgGetWithDb(eg, tmp["master_id"], md.KEY_CFG_ZM_AK) postData["secret_key"] = db.SysCfgGetWithDb(eg, tmp["master_id"], md.KEY_CFG_ZM_SK) union, _ := db.SysUnionByPVDByUse(eg, tmp["master_id"], "pdd") + if union != nil && union.AuthType == 2 { newpid := "own_" + tmp["master_id"] + "_" + tmp["uid"] - slist1 := zhimeng.OwnPddSearchGoods(newpid, union, postData, isList) + slist1 := zhimeng.OwnPddSearchGoodsDetail(newpid, union, postData, false) err := zhimeng.OwnPddToStruct(slist1, mdData) if err != nil { + + //e.OutErr(c, e.ERR_INVALID_ARGS, err) return nil, "" } } else { @@ -1442,6 +1449,7 @@ func PDDByGoodsId(eg *xorm.Engine, officialEg *xorm.Engine, tmp map[string]strin r.GoodID = mdData.GoodsSign return r, md.PVD_PDD } + return nil, "" } diff --git a/chain_transfer/turn_chain.go b/chain_transfer/turn_chain.go index d59e5bc..f95d3c0 100644 --- a/chain_transfer/turn_chain.go +++ b/chain_transfer/turn_chain.go @@ -77,9 +77,6 @@ func TurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[str isTikTok = "1" } split := strings.Split(reqCount, "\n") - reqCount = strings.ReplaceAll(reqCount, "\nhttp", "http") - 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") @@ -348,7 +345,9 @@ func TurnChain(eg *xorm.Engine, officialEg, zhimengEg *xorm.Engine, args map[str } } fmt.Println("============"+zhios_third_party_utils.IntToStr(k+3), time.Since(now)) - + tcPrase.Count = strings.ReplaceAll(tcPrase.Count, "\n\nhttp", "\thttp") + tcPrase.Count = strings.ReplaceAll(tcPrase.Count, "\nhttp", "http") + tcPrase.Count = strings.ReplaceAll(tcPrase.Count, "\thttp", "http") } fmt.Println("============30", time.Since(now)) diff --git a/zhimeng/own_pdd_goods.go b/zhimeng/own_pdd_goods.go index 1539a7f..83b6739 100644 --- a/zhimeng/own_pdd_goods.go +++ b/zhimeng/own_pdd_goods.go @@ -27,11 +27,11 @@ func OwnPddSearchGoods(pid string, auth *model.SysUnionSet, postData map[string] param["access_token"] = gjson.Get(auth.KeyData, "accessToken").String() param["page"] = postData["p"] param["page_size"] = postData["size"] - if postData["p"] == "" || postData["keyword"] == nil { + if postData["p"] == "" || postData["p"] == nil { param["page"] = "1" } if postData["size"] == "" || postData["size"] == nil { - param["page_size"] = "1" + param["page_size"] = "10" } param["sort_type"] = "0" param["pid"] = gjson.Get(auth.KeyData, "pid").String() @@ -137,3 +137,126 @@ func OwnPddSearchGoods(pid string, auth *model.SysUnionSet, postData map[string] return zhios_third_party_utils.SerializeStr(res1) } + +func OwnPddSearchGoodsDetail(pid string, auth *model.SysUnionSet, postData map[string]interface{}, isList bool) string { + newPostData := make(map[string]interface{}) + for k, v := range postData { + if v != "" && v != "" && v != nil { + newPostData[k] = v + } + } + postData = newPostData + param := make(map[string]interface{}) + param["access_token"] = gjson.Get(auth.KeyData, "accessToken").String() + param["page"] = postData["p"] + if zhios_third_party_utils.AnyToInt64(postData["p"]) == 0 { + param["page"] = "1" + } + param["page_size"] = postData["size"] + if zhios_third_party_utils.AnyToInt64(postData["size"]) == 0 { + param["page_size"] = "10" + } + param["sort_type"] = "0" + param["pid"] = gjson.Get(auth.KeyData, "pid").String() + if postData["keyword"] != "" && postData["keyword"] != nil { + param["keyword"] = postData["keyword"] + } + if postData["gid"] != "" && postData["gid"] != nil { + param["keyword"] = postData["gid"] + param["page_size"] = "10" + } + + if postData["cat_id"] != "" && postData["cat_id"] != nil { + param["cat_id"] = postData["cat_id"] + } + if postData["activity_tags"] != "" && postData["activity_tags"] != nil { + param["activity_tags"] = zhios_third_party_utils.SerializeStr([]interface{}{postData["activity_tags"]}) + } + if postData["cid"] != "" && postData["cid"] != nil { + param["cat_id"] = postData["cid"] + } + rangeList := make([]map[string]string, 0) + if zhios_third_party_utils.AnyToFloat64(postData["start_price"]) > 0 || zhios_third_party_utils.AnyToFloat64(postData["end_price"]) > 0 { + if zhios_third_party_utils.AnyToFloat64(postData["start_price"]) == 0 { + postData["start_price"] = "0" + } + if zhios_third_party_utils.AnyToFloat64(postData["end_price"]) == 0 { + postData["end_price"] = "50000" + } + tmp := map[string]string{ + "range_id": "1", + "range_from": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(postData["start_price"]) * 100), + "range_to": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(postData["end_price"]) * 100), + } + rangeList = append(rangeList, tmp) + } + if zhios_third_party_utils.AnyToFloat64(postData["start_commission_rate"]) > 0 || zhios_third_party_utils.AnyToFloat64(postData["end_commission_rate"]) > 0 { + if zhios_third_party_utils.AnyToFloat64(postData["start_commission_rate"]) == 0 { + postData["start_commission_rate"] = "0" + } + if zhios_third_party_utils.AnyToFloat64(postData["end_commission_rate"]) == 0 { + postData["end_commission_rate"] = "100" + } + tmp := map[string]string{ + "range_id": "2", + "range_from": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(postData["start_commission_rate"]) * 10), + "range_to": zhios_third_party_utils.Float64ToStr(zhios_third_party_utils.AnyToFloat64(postData["end_commission_rate"]) * 10), + } + rangeList = append(rangeList, tmp) + } + if zhios_third_party_utils.AnyToFloat64(postData["start_sales"]) > 0 || zhios_third_party_utils.AnyToFloat64(postData["end_commission_rate"]) > 0 { + if zhios_third_party_utils.AnyToFloat64(postData["start_sales"]) == 0 { + postData["start_sales"] = "" + } + if zhios_third_party_utils.AnyToFloat64(postData["end_sales"]) == 0 { + postData["end_sales"] = "" + } + tmp := map[string]string{ + "range_id": "5", + "range_from": zhios_third_party_utils.AnyToString(postData["start_sales"]), + "range_to": zhios_third_party_utils.AnyToString(postData["end_sales"]), + } + rangeList = append(rangeList, tmp) + } + if len(rangeList) > 0 { + param["range_list"] = zhios_third_party_utils.SerializeStr(rangeList) + } + sort_arr := map[string]int{ + "default": 0, //默认排序 + "commission asc": 1, //佣金比率升序 + "commission desc": 2, //佣金比率降序 + "commission1 desc": 14, //佣金降序 + "goods_price asc": 3, //价格升序 + "goods_price desc": 4, //价格降序 + "goods_sales asc": 5, //销量升序 + "goods_sales desc": 6, //销量降序 + "coupon asc": 7, //优惠券升序 + "coupon desc": 8, //优惠券降序 + "coupon after asc": 9, //券后价升序 + "coupon after desc": 10, //券后价降序 + "update asc": 11, //多多进宝 更新时间 升序 + "update desc": 12, //多多进宝 更新时间 降序 + } + if sort_arr[zhios_third_party_utils.AnyToString(postData["sort"])] != 0 { + param["sort_type"] = zhios_third_party_utils.IntToStr(sort_arr[zhios_third_party_utils.AnyToString(postData["sort"])]) + } + if postData["sort_num"] != "" && postData["sort_num"] != nil { + param["sort_type"] = postData["sort_num"] + } + //是否有优惠券 + param["with_coupon"] = "false" + if postData["conpon"] != "" && postData["conpon"] != nil { + param["with_coupon"] = "true" + } + param["custom_parameters"] = "{\"uid\":\"" + pid + "\"}" + + res1 := pdd_union.GetSearchGoodsDetail(pddcomm(), param) + if len(res1) == 0 { + return "" + } + if isList == false { + return zhios_third_party_utils.SerializeStr(res1[0]) + } + return zhios_third_party_utils.SerializeStr(res1) + +}