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

85 lines
2.6 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.SettledTime > 0 && v.Settled == 1 {
  46. tmp["js_time"] = zhios_third_party_utils.Int64ToStr(v.SettledTime / 1000)
  47. }
  48. var commission float64 = 0
  49. var payment float64 = 0
  50. for _, v1 := range v.DetailList {
  51. if v1.Status == 0 {
  52. continue
  53. }
  54. commission += zhios_third_party_utils.StrToFloat64(v1.EstimateCommissionAfterDeduction)
  55. payment += zhios_third_party_utils.StrToFloat64(v1.CommissionTotalCost)
  56. }
  57. tmp["payment"] = zhios_third_party_utils.Float64ToStr(payment)
  58. tmp["commission"] = zhios_third_party_utils.Float64ToStr(commission)
  59. list = append(list, tmp)
  60. }
  61. fmt.Println(zhios_third_party_utils.SerializeStr(list))
  62. return list
  63. }
  64. func GetRefundOrder(serviceParam map[string]string, param string) []map[string]string {
  65. post, _ := SendPost("com.vip.adp.api.open.service.UnionOrderService", "refundOrderListWithOauth", serviceParam, param)
  66. var data []wph.GetRefundOrder
  67. msg := gjson.Get(post, "result.refundOrderInfoList").String()
  68. json.Unmarshal([]byte(msg), &data)
  69. var list = make([]map[string]string, 0)
  70. for _, v := range data {
  71. tmp := map[string]string{
  72. "oid": v.OrderSn,
  73. "status": "",
  74. }
  75. if v.AfterSaleStatus == 2 {
  76. tmp["status"] = "不合格"
  77. }
  78. list = append(list, tmp)
  79. }
  80. return list
  81. }