diff --git a/csjplatform/order.go b/csjplatform/order.go index bec32a2..6dbb61b 100644 --- a/csjplatform/order.go +++ b/csjplatform/order.go @@ -1,12 +1,14 @@ package csjplatform import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tik_tok" zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" - "fmt" + "encoding/json" + "github.com/tidwall/gjson" "strings" ) -func OrderList(args map[string]string) (string, error) { +func OrderList(args map[string]string) map[string]interface{} { params := map[string]interface{}{ "size": zhios_third_party_utils.StrToInt(args["size"]), "cursor": args["cursor"], @@ -18,7 +20,32 @@ func OrderList(args map[string]string) (string, error) { params["order_ids"] = strings.Split(args["order_ids"], ",") } send, err := Send(args["app_id"], args["app_secret"], "order/search", params) - fmt.Println(send) - fmt.Println(err) - return send, err + 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 := tik_tok.CommOrder(v, statusArr, "dk") + if tmp["oid"] == "" { + continue + } + orderTmp = append(orderTmp, tmp) + } + data["order"] = orderTmp + return data }