|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package wph
-
- import (
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md/wph"
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "encoding/json"
- "fmt"
- "github.com/tidwall/gjson"
- )
-
- func GetOrder(serviceParam map[string]string, param string) []map[string]string {
- post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "orderListWithOauth", serviceParam, param)
- var data []wph.GetOrder
- msg := gjson.Get(post, "result.orderInfoList").String()
- json.Unmarshal([]byte(msg), &data)
- var list = make([]map[string]string, 0)
- stateArr := map[string]string{
- "已下单": "待定", "已付款": "订单付款", "已签收": "订单成功", "待结算": "订单成功", "已结算": "已完结", "已失效": "不合格",
- }
- for _, v := range data {
- gid := ""
- if len(v.DetailList) > 0 {
- gid = v.DetailList[0].GoodsId
- }
- tmp := map[string]string{
- "oid": v.OrderSn,
- "gid": gid,
- "commission": "0",
- "payment": "0",
- "status": stateArr[v.OrderSubStatusName],
- "channelTag": v.ChannelTag,
- "create_time": zhios_third_party_utils.Int64ToStr(v.OrderTime / 1000),
- "newCustomer": zhios_third_party_utils.IntToStr(v.NewCustomer),
- "js_time": "",
- }
- if v.Status == 2 {
- tmp["status"] = "已完结"
- }
- if v.SettledTime > 0 {
- tmp["js_time"] = zhios_third_party_utils.Int64ToStr(v.SettledTime / 1000)
- }
- var commission float64 = 0
- var payment float64 = 0
- for _, v1 := range v.DetailList {
- commission += zhios_third_party_utils.StrToFloat64(v1.Commission)
- payment += zhios_third_party_utils.StrToFloat64(v1.CommissionTotalCost)
- }
- tmp["payment"] = zhios_third_party_utils.Float64ToStr(payment)
- tmp["commission"] = zhios_third_party_utils.Float64ToStr(commission)
- list = append(list, tmp)
- }
- fmt.Println(zhios_third_party_utils.SerializeStr(list))
- return list
- }
- func GetRefundOrder(serviceParam map[string]string, param string) []map[string]string {
- post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "refundOrderListWithOauth", serviceParam, param)
- var data []wph.GetRefundOrder
- msg := gjson.Get(post, "result.refundOrderInfoList").String()
- json.Unmarshal([]byte(msg), &data)
- var list = make([]map[string]string, 0)
- for _, v := range data {
-
- tmp := map[string]string{
- "oid": v.OrderSn,
- "status": "",
- }
- if v.AfterSaleStatus == 2 {
- tmp["status"] = "不合格"
- }
- list = append(list, tmp)
- }
- return list
- }
|