|
@@ -27,11 +27,11 @@ func OwnPddSearchGoods(pid string, auth *model.SysUnionSet, postData map[string] |
|
|
param["access_token"] = gjson.Get(auth.KeyData, "accessToken").String() |
|
|
param["access_token"] = gjson.Get(auth.KeyData, "accessToken").String() |
|
|
param["page"] = postData["p"] |
|
|
param["page"] = postData["p"] |
|
|
param["page_size"] = postData["size"] |
|
|
param["page_size"] = postData["size"] |
|
|
if postData["p"] == "" || postData["keyword"] == nil { |
|
|
|
|
|
|
|
|
if postData["p"] == "" || postData["p"] == nil { |
|
|
param["page"] = "1" |
|
|
param["page"] = "1" |
|
|
} |
|
|
} |
|
|
if postData["size"] == "" || postData["size"] == nil { |
|
|
if postData["size"] == "" || postData["size"] == nil { |
|
|
param["page_size"] = "1" |
|
|
|
|
|
|
|
|
param["page_size"] = "10" |
|
|
} |
|
|
} |
|
|
param["sort_type"] = "0" |
|
|
param["sort_type"] = "0" |
|
|
param["pid"] = gjson.Get(auth.KeyData, "pid").String() |
|
|
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) |
|
|
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 != "<nil>" && 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) |
|
|
|
|
|
|
|
|
|
|
|
} |