|
|
@@ -8,6 +8,45 @@ import ( |
|
|
|
"strings" |
|
|
|
) |
|
|
|
|
|
|
|
func DkGoodsOrder(args map[string]string) map[string]interface{} { |
|
|
|
|
|
|
|
params := map[string]interface{}{"time_type": args["time_type"], "size": args["size"], "cursor": args["cursor"], "start_time": args["start_time"], "end_time": args["end_time"], "distribution_type": "ProductDetail"} |
|
|
|
if args["distribution_type"] != "" { |
|
|
|
params["distribution_type"] = args["distribution_type"] |
|
|
|
} |
|
|
|
send, err := Send(args["appkey"], args["appSecret"], "buyin.doukeOrderAds", params, args["acctoken"]) |
|
|
|
fmt.Println(send) |
|
|
|
var data = map[string]interface{}{} |
|
|
|
if err != nil { |
|
|
|
return data |
|
|
|
} |
|
|
|
order := gjson.Get(send, "data.orders").String() |
|
|
|
data["cursor"] = gjson.Get(send, "data.cursor").String() |
|
|
|
var tmpList = make([]interface{}, 0) |
|
|
|
err = json.Unmarshal([]byte(order), &tmpList) |
|
|
|
if err != nil { |
|
|
|
return data |
|
|
|
} |
|
|
|
var orderTmp = make([]map[string]string, 0) |
|
|
|
statusArr := map[string]string{ |
|
|
|
"PAY_SUCC": "订单付款", |
|
|
|
"REFUND": "订单退款", |
|
|
|
"SETTLE": "订单结算", |
|
|
|
"CONFIRM": "订单成功", |
|
|
|
} |
|
|
|
for _, v := range tmpList { |
|
|
|
|
|
|
|
tmp := CommOrder(v, statusArr, "dk") |
|
|
|
if tmp["oid"] == "" { |
|
|
|
continue |
|
|
|
} |
|
|
|
orderTmp = append(orderTmp, tmp) |
|
|
|
} |
|
|
|
data["order"] = orderTmp |
|
|
|
return data |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func GoodsOrder(args map[string]string) map[string]interface{} { |
|
|
|
|
|
|
|
params := map[string]interface{}{"time_type": args["time_type"], "size": args["size"], "cursor": args["cursor"], "start_time": args["start_time"], "end_time": args["end_time"], "distribution_type": "ProductDetail"} |
|
|
@@ -35,7 +74,7 @@ func GoodsOrder(args map[string]string) map[string]interface{} { |
|
|
|
"CONFIRM": "订单成功", |
|
|
|
} |
|
|
|
for _, v := range tmpList { |
|
|
|
tmp := CommOrder(v, statusArr) |
|
|
|
tmp := CommOrder(v, statusArr, "") |
|
|
|
if tmp["oid"] == "" { |
|
|
|
continue |
|
|
|
} |
|
|
@@ -70,7 +109,7 @@ func LiveOrder(args map[string]string) map[string]interface{} { |
|
|
|
"CONFIRM": "订单成功", |
|
|
|
} |
|
|
|
for _, v := range tmpList { |
|
|
|
tmp := CommOrder(v, statusArr) |
|
|
|
tmp := CommOrder(v, statusArr, "") |
|
|
|
if tmp["oid"] == "" { |
|
|
|
continue |
|
|
|
} |
|
|
@@ -80,7 +119,7 @@ func LiveOrder(args map[string]string) map[string]interface{} { |
|
|
|
return data |
|
|
|
|
|
|
|
} |
|
|
|
func CommOrder(v interface{}, statusArr map[string]string) map[string]string { |
|
|
|
func CommOrder(v interface{}, statusArr map[string]string, types string) map[string]string { |
|
|
|
tmp := make(map[string]string) |
|
|
|
goods := v.(map[string]interface{}) |
|
|
|
pidInfo, ok := goods["pid_info"].(map[string]interface{}) |
|
|
@@ -120,13 +159,13 @@ func CommOrder(v interface{}, statusArr map[string]string) map[string]string { |
|
|
|
tmp["mid"] = split[2] |
|
|
|
} |
|
|
|
} |
|
|
|
if tmp["type"] == "Live" || tmp["type"] == "Activity" || tmp["type"] == "Mix" { |
|
|
|
if tmp["type"] == "Live" || tmp["type"] == "Activity" || tmp["type"] == "Mix" || types == "dk" { |
|
|
|
tmp["commission"] = zhios_third_party_utils.AnyToString(zhios_third_party_utils.AnyToFloat64(goods["ads_estimated_commission"]) / 100) |
|
|
|
if zhios_third_party_utils.AnyToFloat64(goods["ads_real_commission"]) > 0 { |
|
|
|
tmp["commission"] = zhios_third_party_utils.AnyToString(zhios_third_party_utils.AnyToFloat64(goods["ads_real_commission"]) / 100) |
|
|
|
} |
|
|
|
} |
|
|
|
if tmp["type"] == "ProductDetail" { |
|
|
|
if tmp["type"] == "ProductDetail" && types == "" { |
|
|
|
tmp["commission"] = zhios_third_party_utils.AnyToString(zhios_third_party_utils.AnyToFloat64(goods["estimated_commission"]) / 100) |
|
|
|
if zhios_third_party_utils.AnyToFloat64(goods["real_commission"]) > 0 { |
|
|
|
tmp["commission"] = zhios_third_party_utils.AnyToString(zhios_third_party_utils.AnyToFloat64(goods["real_commission"]) / 100) |
|
|
|