bank.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. "github.com/gin-gonic/gin"
  9. )
  10. // QueryBankCusBankExtendConfigs
  11. // @Summary 查询托管银行扩展配置信息
  12. // @Produce json
  13. // @Security ApiKeyAuth
  14. // @Param cusbankid query string true "托管银行编号"
  15. // @Param extendbiztype query int false "扩展业务类型 - 1:签约 2:入金 3:出金 4:签约信息修改"
  16. // @Success 200 {array} models.Bankcusbankextendconfig
  17. // @Failure 500 {object} app.Response
  18. // @Router /Bank/QueryBankCusBankExtendConfigs [get]
  19. // @Tags 银行
  20. func QueryBankCusBankExtendConfigs(c *gin.Context) {
  21. a := app.GinUtils{Gin: app.Gin{C: c}}
  22. m := models.Bankcusbankextendconfig{}
  23. a.DoBindReq(&m)
  24. a.DoGetDataEx(&m)
  25. }
  26. // QueryBankBranChnumInfo
  27. // @Summary 查询银行支行联行号信息表
  28. // @Produce json
  29. // @Security ApiKeyAuth
  30. // @Param branchname query string true "支行名称(模糊查询)"
  31. // @Param page query int false "页码"
  32. // @Param pagesize query int false "每页条数"
  33. // @Success 200 {array} models.Bankbranchnuminfo
  34. // @Failure 500 {object} app.Response
  35. // @Router /Bank/QueryBankBranChnumInfo [get]
  36. // @Tags 银行
  37. func QueryBankBranChnumInfo(c *gin.Context) {
  38. a := app.GinUtils{Gin: app.Gin{C: c}}
  39. m := models.Bankbranchnuminfo{}
  40. a.DoBindReq(&m)
  41. a.DoGetDataByPage(&m)
  42. }
  43. type GetAmtInByPaidUrlReq struct {
  44. AccountId int `form:"accountid" binding:"required"` // 资金账户
  45. Exchticket string `form:"exchticket" binding:"required"` // 银行服务流水号
  46. ChannelMode string `form:"channelmode"` // 渠道类型:ChillPay,PayerMax,AsiaPay
  47. }
  48. // GetAmtInByPaidUrl 获取银行待支付地址
  49. // @Summary 获取银行待支付地址
  50. // @Produce json
  51. // @Security ApiKeyAuth
  52. // @Param accountid query int true "资金账户"
  53. // @Param exchticket query string true "银行服务流水号"
  54. // @Param channelmode query string false "渠道类型:ChillPay,PayerMax,AsiaPay"
  55. // @Success 200 {object} models.GetAmtInByPaidUrlRsp
  56. // @Failure 500 {object} app.Response
  57. // @Router /Bank/GetAmtInByPaidUrl [get]
  58. // @Tags 银行
  59. func GetAmtInByPaidUrl(c *gin.Context) {
  60. appG := app.Gin{C: c}
  61. // 获取请求参数
  62. var req GetAmtInByPaidUrlReq
  63. if err := appG.C.ShouldBindQuery(&req); err != nil {
  64. logger.GetLogger().Errorf("GetAmtInByPaidUrl failed: %s", err.Error())
  65. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  66. return
  67. }
  68. rec, err := models.GetAmtInByPaid(req.AccountId, req.Exchticket, req.ChannelMode)
  69. if err != nil {
  70. // 查询失败
  71. logger.GetLogger().Error("GetAmtInByPaidUrl failed: 获取记录失败")
  72. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  73. return
  74. }
  75. if rec == nil {
  76. // 查询失败
  77. logger.GetLogger().Error("GetAmtInByPaidUrl failed: 获取记录失败")
  78. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  79. return
  80. }
  81. // 查询成功返回
  82. appG.Response(http.StatusOK, e.SUCCESS, rec)
  83. }
  84. // GetCusBankInfos 获取托管银行信息列表
  85. // @Summary 获取托管银行信息列表
  86. // @Produce json
  87. // @Security ApiKeyAuth
  88. // @Success 200 {array} models.Bankcusbankinfo
  89. // @Failure 500 {object} app.Response
  90. // @Router /Bank/GetCusBankInfos [get]
  91. // @Tags 银行
  92. func GetCusBankInfos(c *gin.Context) {
  93. appG := app.Gin{C: c}
  94. rec, err := models.GetCusBankInfos()
  95. if err != nil {
  96. // 查询失败
  97. logger.GetLogger().Errorf("GetCusBankInfos failed: %s", err.Error())
  98. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  99. return
  100. }
  101. // 查询成功返回
  102. appG.Response(http.StatusOK, e.SUCCESS, rec)
  103. }