|
- 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"
- "strings"
- )
-
- 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)
- for _, v := range data {
- gid := ""
- title := ""
- img := ""
- if len(v.DetailList) > 0 {
- gid = v.DetailList[0].GoodsId
- title = v.DetailList[0].GoodsName
- img = v.DetailList[0].GoodsThumb
- }
- if v.OrderSubStatusName == "已下单" {
- continue
- }
- if strings.Contains(v.ChannelTag, "own_") == false {
- continue
- }
- tmp := map[string]string{
- "title": title,
- "img": img,
- "oid": v.OrderSn,
- "gid": gid,
- "commission": "0",
- "payment": "0",
- "status": v.OrderSubStatusName,
- "channelTag": v.ChannelTag,
- "create_time": zhios_third_party_utils.Int64ToStr(v.OrderTime / 1000),
- "sign_time": zhios_third_party_utils.Int64ToStr(v.SignTime / 1000),
- "newCustomer": zhios_third_party_utils.IntToStr(v.NewCustomer),
- "js_time": "",
- }
- if v.SettledTime > 0 && v.Settled == 1 {
- tmp["js_time"] = zhios_third_party_utils.Int64ToStr(v.SettledTime / 1000)
- }
- var commission float64 = 0
- var payment float64 = 0
- for _, v1 := range v.DetailList {
- if v1.Status == 0 {
- continue
- }
- commission += zhios_third_party_utils.StrToFloat64(v1.EstimateCommissionAfterDeduction)
- 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
- }
|