order.go 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. package sbyj
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. "mtp2_if/models"
  7. "net/http"
  8. "strings"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // GetMyOrders 获取我的订单列表
  12. // @Summary 获取我的订单列表
  13. // @Produce json
  14. // @Security ApiKeyAuth
  15. // @Param userId query int true "用户ID"
  16. // @Param accountId query string false "资金账户"
  17. // @Param goodsId query int false "商品ID"
  18. // @Success 200 {array} models.RedisTradeHolderDetailEx
  19. // @Failure 500 {object} app.Response
  20. // @Router /sbyj/GetMyOrders [get]
  21. // @Tags 订单系统
  22. func GetMyOrders(c *gin.Context) {
  23. appG := app.Gin{C: c}
  24. // 获取请求参数
  25. var req GetMyOrdersReq
  26. if err := appG.C.ShouldBindQuery(&req); err != nil {
  27. logger.GetLogger().Errorf("GetMyOrders failed: %s", err.Error())
  28. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  29. return
  30. }
  31. // 获取数据
  32. d := models.RedisTradeHolderDetailEx{}
  33. rsp, err := d.GetDataEx(req.UserId, req.GoodsId, strings.TrimSpace(req.AccountId))
  34. if err != nil {
  35. // 查询失败
  36. logger.GetLogger().Errorf("GetMyOrders failed: %s", err.Error())
  37. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  38. return
  39. }
  40. // 查询成功返回
  41. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  42. }
  43. // QueryMyTradegoodsdeliveryoffline 查询我的交收
  44. // @Summary 查询我的交收
  45. // @Produce json
  46. // @Security ApiKeyAuth
  47. // @Param userid query int true "用户ID"
  48. // @Param status query string false "格式:1,2,3 交收单状态2(52模式使用) - 1:待审核 2:待确认 3:待付款 4:付款中 5:已完成付款 6:处理中 20:交收完成 21:审核拒绝 22:确认过期 23:付款过期 24:财务撤销 -- 枚举deliveryStatus"
  49. // @Param page query int false "页码"
  50. // @Param pagesize query int false "每页条数"
  51. // @Success 200 {array} models.MyTradegoodsdeliveryoffline
  52. // @Failure 500 {object} app.Response
  53. // @Router /sbyj/QueryMyTradegoodsdeliveryoffline [get]
  54. // @Tags 订单系统
  55. func QueryMyTradegoodsdeliveryoffline(c *gin.Context) {
  56. a := app.GinUtils{Gin: app.Gin{C: c}}
  57. m := models.MyTradegoodsdeliveryoffline{}
  58. a.DoBindReq(&m)
  59. a.DoGetDataByPage(&m)
  60. }
  61. // QueryMyDeliveryofflinedetail 查询我的交收-订单明细
  62. // @Summary 查询我的交收-订单明细
  63. // @Produce json
  64. // @Security ApiKeyAuth
  65. // @Param userid query int true "用户ID"
  66. // @Param deliveryorderid query string true "交收单号(905+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)"
  67. // @Param page query int false "页码"
  68. // @Param pagesize query int false "每页条数"
  69. // @Success 200 {array} models.MyDeliveryofflinedetail
  70. // @Failure 500 {object} app.Response
  71. // @Router /sbyj/QueryMyDeliveryofflinedetail [get]
  72. // @Tags 订单系统
  73. func QueryMyDeliveryofflinedetail(c *gin.Context) {
  74. a := app.GinUtils{Gin: app.Gin{C: c}}
  75. m := models.MyDeliveryofflinedetail{}
  76. a.DoBindReq(&m)
  77. a.DoGetDataByPage(&m)
  78. }
  79. // QueryMyDeliveryofflineoperatelog 查询我的交收-操作明细
  80. // @Summary 查询我的交收-操作明细
  81. // @Produce json
  82. // @Security ApiKeyAuth
  83. // @Param deliveryorderid query string true "交收单号(905+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)"
  84. // @Param operatetype query int false "操作类型 - 1:交收流程 2:付款流水"
  85. // @Param deliverypaymode query int false "付款方式 - 1:线上支付2:线下支付 - 枚举deliveryPayMode"
  86. // @Param confirmstatus query int false "确认状态 - 1:未确认 2:已确认 - 枚举confirmStatus"
  87. // @Param page query int false "页码"
  88. // @Param pagesize query int false "每页条数"
  89. // @Success 200 {array} models.MyDeliveryofflineoperatelog
  90. // @Failure 500 {object} app.Response
  91. // @Router /sbyj/QueryMyDeliveryofflineoperatelog [get]
  92. // @Tags 订单系统
  93. func QueryMyDeliveryofflineoperatelog(c *gin.Context) {
  94. a := app.GinUtils{Gin: app.Gin{C: c}}
  95. m := models.MyDeliveryofflineoperatelog{}
  96. a.DoBindReq(&m)
  97. a.DoGetDataByPage(&m)
  98. }
  99. // QueryTradeHolderDetailEx 查询我的订单
  100. // @Summary 查询我的订单
  101. // @Produce json
  102. // @Security ApiKeyAuth
  103. // @Param accountid query int true "资金账户"
  104. // @Param tradedate query string false "交易日(yyyyMMdd)"
  105. // @Param goodsid query int false "商品ID"
  106. // @Param holderqty query int false "持仓数量"
  107. // @Param marketids query string false "目标市场ID列表,格式 1,2,3"
  108. // @Param trademodes query string false "交易模式列表,格式 10,53,52"
  109. // @Param page query int false "页码"
  110. // @Param pagesize query int false "每页条数"
  111. // @Success 200 {array} models.Tradeholderdetailex
  112. // @Failure 500 {object} app.Response
  113. // @Router /sbyj/QueryTradeHolderDetailEx [get]
  114. // @Tags 订单系统
  115. func QueryTradeHolderDetailEx(c *gin.Context) {
  116. a := app.GinUtils{Gin: app.Gin{C: c}}
  117. m := models.Tradeholderdetailex{}
  118. a.DoBindReq(&m)
  119. a.DoGetDataByPage(&m)
  120. }
  121. // QueryTradeCloseDetails 查询我的终止订单
  122. // @Summary 查询我的终止订单
  123. // @Produce json
  124. // @Security ApiKeyAuth
  125. // @Param accountid query int true "资金账户"
  126. // @Param page query int false "页码"
  127. // @Param pagesize query int false "每页条数"
  128. // @Success 200 {array} models.TradeCloseDetail
  129. // @Failure 500 {object} app.Response
  130. // @Router /sbyj/QueryTradeCloseDetails [get]
  131. // @Tags 订单系统
  132. func QueryTradeCloseDetails(c *gin.Context) {
  133. a := app.GinUtils{Gin: app.Gin{C: c}}
  134. m := models.TradeCloseDetail{}
  135. a.DoBindReq(&m)
  136. a.DoGetDataByPage(&m)
  137. }
  138. // QueryMemberPayInfos 查询所属会员的支付信息
  139. // @Summary 查询所属会员的支付信息
  140. // @Produce json
  141. // @Security ApiKeyAuth
  142. // @Param userid query int true "用户id"
  143. // @Success 200 {array} models.MemberPayInfo
  144. // @Failure 500 {object} app.Response
  145. // @Router /sbyj/QueryMemberPayInfos [get]
  146. // @Tags 订单系统
  147. func QueryMemberPayInfos(c *gin.Context) {
  148. a := app.GinUtils{Gin: app.Gin{C: c}}
  149. m := models.MemberPayInfo{}
  150. a.DoBindReq(&m)
  151. a.DoGetDataEx(&m)
  152. }
  153. // QueryUserTradeSettings 查询用户交易个性化设置
  154. // @Summary 查询用户交易个性化设置
  155. // @Produce json
  156. // @Security ApiKeyAuth
  157. // @Param userid query int true "用户id"
  158. // @Success 200 {array} models.UserTradeSetting
  159. // @Failure 500 {object} app.Response
  160. // @Router /sbyj/QueryUserTradeSettings [get]
  161. // @Tags 订单系统
  162. func QueryUserTradeSettings(c *gin.Context) {
  163. a := app.GinUtils{Gin: app.Gin{C: c}}
  164. m := models.UserTradeSetting{}
  165. a.DoBindReq(&m)
  166. a.DoGetDataEx(&m)
  167. }