orde.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "time"
  6. )
  7. type CygxOrder struct {
  8. OrderId int `orm:"column(order_id);pk";comment:"订单id"`
  9. OrderCode string `comment:"订单编号"`
  10. OutTradeCode string `comment:"外部交易号"`
  11. PaymentType int `comment:"支付类型。支付类型。取值范围:1微信小程序,2微信扫码支付,3微信H5支付。"`
  12. GoodsName string `comment:"商品名称"`
  13. GoodsId int `comment:"商品ID"`
  14. BuyerInvoice string `comment:"买家发票信息"`
  15. GoodsMoney float64 `comment:"商品总价"`
  16. OrderMoney float64 `comment:"订单总价"`
  17. Point int `comment:"订单消耗积分"`
  18. PointMoney float64 `comment:"订单消耗积分抵多少钱"`
  19. PayMoney float64 `comment:"订单实付金额"`
  20. RefundMoney float64 `comment:"订单退款金额"`
  21. RefundTime time.Time `description:"退款时间"`
  22. RefundRemark string `description:"退款原因说明"`
  23. OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"`
  24. PayTime time.Time `comment:"订单付款时间"`
  25. SourceId int `comment:"来源ID"`
  26. Source string `comment:"来源\n报告 :article\n活动 :activity"`
  27. SourceTitle string `comment:"来源名称,活动或者报告标题"`
  28. UserId int `comment:"用户ID"`
  29. Mobile string `comment:"手机号"`
  30. Email string `comment:"邮箱"`
  31. CompanyId int `comment:"公司ID"`
  32. CompanyName string `comment:"公司名称"`
  33. RealName string `comment:"用户实际名称"`
  34. SellerName string `comment:"所属销售"`
  35. CreateTime time.Time `comment:"创建时间"`
  36. ModifyTime time.Time `comment:"修改时间"`
  37. RegisterPlatform int `comment:"来源 1小程序,2:网页"`
  38. }
  39. type CygxOrderResp struct {
  40. OrderId int `orm:"column(order_id);pk";comment:"订单id"`
  41. OrderCode string `comment:"订单编号"`
  42. OutTradeCode string `comment:"外部交易号"`
  43. PaymentType int `comment:"支付类型。取值范围:1微信支付,2支付宝支付。"`
  44. GoodsName string `comment:"商品名称"`
  45. GoodsId int `comment:"商品ID"`
  46. BuyerInvoice string `comment:"买家发票信息"`
  47. GoodsMoney float64 `comment:"商品总价"`
  48. OrderMoney float64 `comment:"订单总价"`
  49. Point int `comment:"订单消耗积分"`
  50. PointMoney float64 `comment:"订单消耗积分抵多少钱"`
  51. PayMoney float64 `comment:"订单实付金额"`
  52. RefundMoney float64 `comment:"订单退款金额"`
  53. RefundTime time.Time `comment:"退款时间"`
  54. RefundRemark string `comment:"退款原因说明"`
  55. OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"`
  56. PayTime time.Time `comment:"订单付款时间"`
  57. SourceId int `comment:"来源ID"`
  58. Source string `comment:"来源\n报告 :article\n活动 :activity"`
  59. SourceTitle string `comment:"来源名称,活动或者报告标题"`
  60. UserId int `comment:"用户ID"`
  61. Mobile string `comment:"手机号"`
  62. Email string `comment:"邮箱"`
  63. CompanyId int `comment:"公司ID"`
  64. CompanyName string `comment:"公司名称"`
  65. RealName string `comment:"用户实际名称"`
  66. SellerName string `comment:"所属销售"`
  67. StartDate time.Time `comment:"开始日期"`
  68. EndDate time.Time `comment:"结束日期"`
  69. CreateTime time.Time `comment:"创建时间"`
  70. ModifyTime time.Time `comment:"修改时间"`
  71. RegisterPlatform int `comment:"来源 1小程序,2:网页"`
  72. ShareId int `comment:"分享人ID"`
  73. ShareName string `comment:"分享人姓名"`
  74. }
  75. func GetCygxOrderList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxOrderResp, err error) {
  76. o := orm.NewOrmUsingDB("hz_cygx")
  77. sql := `SELECT *
  78. FROM
  79. cygx_order
  80. WHERE 1 = 1 ` + condition
  81. sql += ` LIMIT ?,? `
  82. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  83. return
  84. }
  85. // 获取数量
  86. func GetCygxOrderCount(condition string, pars []interface{}) (count int, err error) {
  87. o := orm.NewOrmUsingDB("hz_cygx")
  88. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_order WHERE 1= 1 ` + condition
  89. err = o.Raw(sqlCount, pars).QueryRow(&count)
  90. return
  91. }
  92. // 根据订单编号获取订单详情
  93. func GetCygxOrderDetailByOrderCode(orderCode string) (item *CygxOrderResp, err error) {
  94. o := orm.NewOrmUsingDB("hz_cygx")
  95. sql := `SELECT * FROM cygx_order WHERE order_code = ? `
  96. err = o.Raw(sql, orderCode).QueryRow(&item)
  97. return
  98. }
  99. type OrderListResp struct {
  100. OrderCode string `comment:"订单编号"`
  101. UserId int `comment:"用户ID"`
  102. Mobile string `comment:"手机号"`
  103. Email string `comment:"邮箱"`
  104. CompanyId int `comment:"公司ID"`
  105. CompanyName string `comment:"公司名称"`
  106. RealName string `comment:"用户实际名称"`
  107. SellerName string `comment:"所属销售"`
  108. OrderMoney float64 `comment:"订单总价"`
  109. CreateTime string `comment:"创建时间"`
  110. SourceId int `comment:"来源ID"`
  111. Source string `comment:"来源\n报告 :article\n活动 :activity"`
  112. SourceTitle string `comment:"来源名称,活动或者报告标题"`
  113. OrderStatus int `comment:"订单状态码"`
  114. OrderStatusText string `comment:"订单状态描述"`
  115. PaymentTypeText string `comment:"支付类型。取值范围:1微信小程序,2微信扫码支付,3微信H5支付。"`
  116. StartDate string `comment:"开始日期"`
  117. EndDate string `comment:"结束日期"`
  118. InviteName string `description:"邀请人"`
  119. PayTime string `comment:"订单付款时间"`
  120. RefundTime string `comment:"订单退款时间"`
  121. RefundRemark string `description:"退款原因说明"`
  122. PaymentProject string `comment:"付款项目"`
  123. HttpUrl string `description:"跳转地址"`
  124. }
  125. type UserOrderListResp struct {
  126. Paging *paging.PagingItem `description:"分页数据"`
  127. List []*OrderListResp
  128. }