bank.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. }
  47. // GetAmtInByPaidUrl 获取银行待支付地址
  48. // @Summary 获取银行待支付地址
  49. // @Produce json
  50. // @Security ApiKeyAuth
  51. // @Param accountid query int true "资金账户"
  52. // @Param exchticket query string true "银行服务流水号"
  53. // @Success 200 {object} string
  54. // @Failure 500 {object} app.Response
  55. // @Router /Bank/GetAmtInByPaidUrl [get]
  56. // @Tags 银行
  57. func GetAmtInByPaidUrl(c *gin.Context) {
  58. appG := app.Gin{C: c}
  59. // 获取请求参数
  60. var req GetAmtInByPaidUrlReq
  61. if err := appG.C.ShouldBindQuery(&req); err != nil {
  62. logger.GetLogger().Errorf("GetAmtInByPaidUrl failed: %s", err.Error())
  63. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  64. return
  65. }
  66. rec := models.GetAmtInByPaid(req.AccountId, req.Exchticket)
  67. if rec == "" {
  68. // 查询失败
  69. logger.GetLogger().Error("GetAmtInByPaidUrl failed: 获取记录失败")
  70. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  71. return
  72. }
  73. // 查询成功返回
  74. appG.Response(http.StatusOK, e.SUCCESS, rec)
  75. }
  76. // GetCusBankInfos 获取托管银行信息列表
  77. // @Summary 获取托管银行信息列表
  78. // @Produce json
  79. // @Security ApiKeyAuth
  80. // @Success 200 {array} models.Bankcusbankinfo
  81. // @Failure 500 {object} app.Response
  82. // @Router /Bank/GetCusBankInfos [get]
  83. // @Tags 银行
  84. func GetCusBankInfos(c *gin.Context) {
  85. appG := app.Gin{C: c}
  86. rec, err := models.GetCusBankInfos()
  87. if err != nil {
  88. // 查询失败
  89. logger.GetLogger().Errorf("GetCusBankInfos failed: %s", err.Error())
  90. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  91. return
  92. }
  93. // 查询成功返回
  94. appG.Response(http.StatusOK, e.SUCCESS, rec)
  95. }