第三方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.

88 lines
2.7 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. "strings"
  9. )
  10. func GetOrder(serviceParam map[string]string, param string) []map[string]string {
  11. post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "orderListWithOauth", serviceParam, param)
  12. var data []wph.GetOrder
  13. msg := gjson.Get(post, "result.orderInfoList").String()
  14. json.Unmarshal([]byte(msg), &data)
  15. var list = make([]map[string]string, 0)
  16. for _, v := range data {
  17. gid := ""
  18. title := ""
  19. img := ""
  20. if len(v.DetailList) > 0 {
  21. gid = v.DetailList[0].GoodsId
  22. title = v.DetailList[0].GoodsName
  23. img = v.DetailList[0].GoodsThumb
  24. }
  25. if v.OrderSubStatusName == "已下单" {
  26. continue
  27. }
  28. if strings.Contains(v.ChannelTag, "own_") == false {
  29. continue
  30. }
  31. tmp := map[string]string{
  32. "title": title,
  33. "img": img,
  34. "oid": v.OrderSn,
  35. "gid": gid,
  36. "commission": "0",
  37. "payment": "0",
  38. "status": v.OrderSubStatusName,
  39. "channelTag": v.ChannelTag,
  40. "create_time": zhios_third_party_utils.Int64ToStr(v.OrderTime / 1000),
  41. "sign_time": zhios_third_party_utils.Int64ToStr(v.SignTime / 1000),
  42. "newCustomer": zhios_third_party_utils.IntToStr(v.NewCustomer),
  43. "js_time": "",
  44. }
  45. if v.Status == 2 {
  46. tmp["status"] = "已完结"
  47. }
  48. if v.SettledTime > 0 && v.Settled == 1 {
  49. tmp["js_time"] = zhios_third_party_utils.Int64ToStr(v.SettledTime / 1000)
  50. }
  51. var commission float64 = 0
  52. var payment float64 = 0
  53. for _, v1 := range v.DetailList {
  54. if v1.Status == 0 {
  55. continue
  56. }
  57. commission += zhios_third_party_utils.StrToFloat64(v1.Commission)
  58. payment += zhios_third_party_utils.StrToFloat64(v1.CommissionTotalCost)
  59. }
  60. tmp["payment"] = zhios_third_party_utils.Float64ToStr(payment)
  61. tmp["commission"] = zhios_third_party_utils.Float64ToStr(commission)
  62. list = append(list, tmp)
  63. }
  64. fmt.Println(zhios_third_party_utils.SerializeStr(list))
  65. return list
  66. }
  67. func GetRefundOrder(serviceParam map[string]string, param string) []map[string]string {
  68. post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "refundOrderListWithOauth", serviceParam, param)
  69. var data []wph.GetRefundOrder
  70. msg := gjson.Get(post, "result.refundOrderInfoList").String()
  71. json.Unmarshal([]byte(msg), &data)
  72. var list = make([]map[string]string, 0)
  73. for _, v := range data {
  74. tmp := map[string]string{
  75. "oid": v.OrderSn,
  76. "status": "",
  77. }
  78. if v.AfterSaleStatus == 2 {
  79. tmp["status"] = "不合格"
  80. }
  81. list = append(list, tmp)
  82. }
  83. return list
  84. }