bank.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package bank
  2. import (
  3. "errors"
  4. "mtp2_if/global/app"
  5. "mtp2_if/global/e"
  6. "mtp2_if/logger"
  7. "mtp2_if/models"
  8. "net/http"
  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. }
  48. // GetAmtInByPaidUrl 获取银行待支付地址
  49. // @Summary 获取银行待支付地址
  50. // @Produce json
  51. // @Security ApiKeyAuth
  52. // @Param accountid query int true "资金账户"
  53. // @Param exchticket query string true "银行服务流水号"
  54. // @Success 200 {object} string
  55. // @Failure 500 {object} app.Response
  56. // @Router /Bank/GetAmtInByPaidUrl [get]
  57. // @Tags 银行
  58. func GetAmtInByPaidUrl(c *gin.Context) {
  59. appG := app.Gin{C: c}
  60. // 获取请求参数
  61. var req GetAmtInByPaidUrlReq
  62. if err := appG.C.ShouldBindQuery(&req); err != nil {
  63. logger.GetLogger().Errorf("GetAmtInByPaidUrl failed: %s", err.Error())
  64. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  65. return
  66. }
  67. rec, err := models.GetAmtInByPaid(req.AccountId, req.Exchticket)
  68. if err != nil {
  69. // 查询失败
  70. logger.GetLogger().Errorf("GetAmtInByPaidUrl failed: %s", err.Error())
  71. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  72. return
  73. }
  74. if rec == nil {
  75. // 查询失败
  76. err = errors.New("获取记录失败")
  77. logger.GetLogger().Errorf("GetAmtInByPaidUrl failed: %s", err.Error())
  78. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  79. return
  80. }
  81. // 查询成功返回
  82. appG.Response(http.StatusOK, e.SUCCESS, rec.PAYMENTURL)
  83. }