第三方api接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.4 KiB

  1. package wph
  2. import (
  3. "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md/wph"
  4. zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
  5. "encoding/json"
  6. "fmt"
  7. "github.com/tidwall/gjson"
  8. )
  9. func GetOrder(serviceParam map[string]string, param string) []map[string]string {
  10. post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "orderListWithOauth", serviceParam, param)
  11. var data []wph.GetOrder
  12. msg := gjson.Get(post, "result.orderInfoList").String()
  13. json.Unmarshal([]byte(msg), &data)
  14. var list = make([]map[string]string, 0)
  15. stateArr := map[string]string{
  16. "已下单": "待定", "已付款": "订单付款", "已签收": "订单成功", "待结算": "订单成功", "已结算": "已完结", "已失效": "不合格",
  17. }
  18. for _, v := range data {
  19. gid := ""
  20. if len(v.DetailList) > 0 {
  21. gid = v.DetailList[0].GoodsId
  22. }
  23. tmp := map[string]string{
  24. "oid": v.OrderSn,
  25. "gid": gid,
  26. "commission": "0",
  27. "payment": "0",
  28. "status": stateArr[v.OrderSubStatusName],
  29. "channelTag": v.ChannelTag,
  30. "create_time": zhios_third_party_utils.Int64ToStr(v.OrderTime / 1000),
  31. "newCustomer": zhios_third_party_utils.IntToStr(v.NewCustomer),
  32. "js_time": "",
  33. }
  34. if v.Status == 2 {
  35. tmp["status"] = "已完结"
  36. }
  37. if v.SettledTime > 0 {
  38. tmp["js_time"] = zhios_third_party_utils.Int64ToStr(v.SettledTime / 1000)
  39. }
  40. var commission float64 = 0
  41. var payment float64 = 0
  42. for _, v1 := range v.DetailList {
  43. commission += zhios_third_party_utils.StrToFloat64(v1.Commission)
  44. payment += zhios_third_party_utils.StrToFloat64(v1.CommissionTotalCost)
  45. }
  46. tmp["payment"] = zhios_third_party_utils.Float64ToStr(payment)
  47. tmp["commission"] = zhios_third_party_utils.Float64ToStr(commission)
  48. list = append(list, tmp)
  49. }
  50. fmt.Println(zhios_third_party_utils.SerializeStr(list))
  51. return list
  52. }
  53. func GetRefundOrder(serviceParam map[string]string, param string) []map[string]string {
  54. post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "refundOrderListWithOauth", serviceParam, param)
  55. var data []wph.GetRefundOrder
  56. msg := gjson.Get(post, "result.refundOrderInfoList").String()
  57. json.Unmarshal([]byte(msg), &data)
  58. var list = make([]map[string]string, 0)
  59. for _, v := range data {
  60. tmp := map[string]string{
  61. "oid": v.OrderSn,
  62. "status": "",
  63. }
  64. if v.AfterSaleStatus == 2 {
  65. tmp["status"] = "不合格"
  66. }
  67. list = append(list, tmp)
  68. }
  69. return list
  70. }