bank.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. package bank
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. "mtp2_if/models"
  7. "net/http"
  8. "strconv"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // QueryBankCusBankExtendConfigs
  12. // @Summary 查询托管银行扩展配置信息
  13. // @Produce json
  14. // @Security ApiKeyAuth
  15. // @Param cusbankid query string true "托管银行编号"
  16. // @Param extendbiztype query int false "扩展业务类型 - 1:签约 2:入金 3:出金 4:签约信息修改"
  17. // @Success 200 {array} models.Bankcusbankextendconfig
  18. // @Failure 500 {object} app.Response
  19. // @Router /Bank/QueryBankCusBankExtendConfigs [get]
  20. // @Tags 银行
  21. func QueryBankCusBankExtendConfigs(c *gin.Context) {
  22. a := app.GinUtils{Gin: app.Gin{C: c}}
  23. m := models.Bankcusbankextendconfig{}
  24. a.DoBindReq(&m)
  25. a.DoGetDataEx(&m)
  26. }
  27. // QueryBankBranChnumInfo
  28. // @Summary 查询银行支行联行号信息表
  29. // @Produce json
  30. // @Security ApiKeyAuth
  31. // @Param branchname query string true "支行名称(模糊查询)"
  32. // @Param page query int false "页码"
  33. // @Param pagesize query int false "每页条数"
  34. // @Success 200 {array} models.Bankbranchnuminfo
  35. // @Failure 500 {object} app.Response
  36. // @Router /Bank/QueryBankBranChnumInfo [get]
  37. // @Tags 银行
  38. func QueryBankBranChnumInfo(c *gin.Context) {
  39. a := app.GinUtils{Gin: app.Gin{C: c}}
  40. m := models.Bankbranchnuminfo{}
  41. a.DoBindReq(&m)
  42. a.DoGetDataByPage(&m)
  43. }
  44. type GetAmtInByPaidUrlReq struct {
  45. AccountId int `form:"accountid" binding:"required"` // 资金账户
  46. Exchticket string `form:"exchticket" binding:"required"` // 银行服务流水号
  47. ChannelMode string `form:"channelmode"` // 渠道类型:ChillPay,PayerMax,AsiaPay
  48. }
  49. // GetAmtInByPaidUrl 获取银行待支付地址
  50. // @Summary 获取银行待支付地址
  51. // @Produce json
  52. // @Security ApiKeyAuth
  53. // @Param accountid query int true "资金账户"
  54. // @Param exchticket query string true "银行服务流水号"
  55. // @Param channelmode query string false "渠道类型:chillpay payermax asiapay hybrid"
  56. // @Success 200 {object} models.GetAmtInByPaidUrlRsp
  57. // @Failure 500 {object} app.Response
  58. // @Router /Bank/GetAmtInByPaidUrl [get]
  59. // @Tags 银行
  60. func GetAmtInByPaidUrl(c *gin.Context) {
  61. appG := app.Gin{C: c}
  62. // 获取请求参数
  63. var req GetAmtInByPaidUrlReq
  64. if err := appG.C.ShouldBindQuery(&req); err != nil {
  65. logger.GetLogger().Errorf("GetAmtInByPaidUrl failed: %s", err.Error())
  66. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  67. return
  68. }
  69. rec, err := models.GetAmtInByPaid(req.AccountId, req.Exchticket, req.ChannelMode)
  70. if err != nil {
  71. // 查询失败
  72. logger.GetLogger().Error("GetAmtInByPaidUrl failed: 获取记录失败")
  73. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  74. return
  75. }
  76. if rec == nil {
  77. // 查询失败
  78. logger.GetLogger().Error("GetAmtInByPaidUrl failed: 获取记录失败")
  79. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  80. return
  81. }
  82. // 查询成功返回
  83. appG.Response(http.StatusOK, e.SUCCESS, rec)
  84. }
  85. // GetCusBankInfos 获取托管银行信息列表
  86. // @Summary 获取托管银行信息列表
  87. // @Produce json
  88. // @Security ApiKeyAuth
  89. // @Success 200 {array} models.Bankcusbankinfo
  90. // @Failure 500 {object} app.Response
  91. // @Router /Bank/GetCusBankInfos [get]
  92. // @Tags 银行
  93. func GetCusBankInfos(c *gin.Context) {
  94. appG := app.Gin{C: c}
  95. rec, err := models.GetCusBankInfos()
  96. if err != nil {
  97. // 查询失败
  98. logger.GetLogger().Errorf("GetCusBankInfos failed: %s", err.Error())
  99. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  100. return
  101. }
  102. // 查询成功返回
  103. appG.Response(http.StatusOK, e.SUCCESS, rec)
  104. }
  105. // GetHybridConfigs 获取支付中心混合支付渠道配置信息列表
  106. // @Summary 获取支付中心混合支付渠道配置信息列表
  107. // @Produce json
  108. // @Security ApiKeyAuth
  109. // @Success 200 {array} models.PaymentCenterHybridConfig
  110. // @Failure 500 {object} app.Response
  111. // @Router /Bank/GetHybridConfigs [get]
  112. // @Tags 银行
  113. func GetHybridConfigs(c *gin.Context) {
  114. appG := app.Gin{C: c}
  115. rec, err := models.GetPaymentCenterHybridConfig()
  116. if err != nil {
  117. // 查询失败
  118. logger.GetLogger().Errorf("GetHybridConfigs failed: %s", err.Error())
  119. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  120. return
  121. }
  122. // 查询成功返回
  123. appG.Response(http.StatusOK, e.SUCCESS, rec)
  124. }
  125. // QueryHybridReceiverOnboards
  126. // @Summary 查询混合支付出金接收者信息
  127. // @Produce json
  128. // @Security ApiKeyAuth
  129. // @Success 200 {array} models.Hybridreceiveronboard
  130. // @Failure 500 {object} app.Response
  131. // @Router /Bank/QueryHybridReceiverOnboards [get]
  132. // @Tags 银行
  133. func QueryHybridReceiverOnboards(c *gin.Context) {
  134. a := app.GinUtils{Gin: app.Gin{C: c}}
  135. requserid, _ := a.C.Get("requserid")
  136. i, _ := strconv.Atoi(requserid.(string))
  137. m := models.Hybridreceiveronboard{USERID: int64(i)}
  138. a.DoBindReq(&m)
  139. a.DoGetDataEx(&m)
  140. }