test.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. package asign
  2. import (
  3. "mtp2_if/global/app"
  4. "mtp2_if/global/e"
  5. "mtp2_if/logger"
  6. asignService "mtp2_if/services/asign"
  7. "net/http"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // BankCard4 银行卡四要素认证(测试)
  11. // @Summary 银行卡四要素认证(测试)
  12. // @Produce json
  13. // @Security ApiKeyAuth
  14. // @accept application/json
  15. // @Param data body asignService.APICompanyBankCard4Req true "入参"
  16. // @Success 200 {object} asignService.APIBankCard4Rsp
  17. // @Failure 500 {object} app.Response
  18. // @Router /Asign/TestBankCard4 [post]
  19. // @Tags 爱签
  20. func TestBankCard4(c *gin.Context) {
  21. appG := app.Gin{C: c}
  22. // 获取请求参数
  23. var req asignService.APICompanyBankCard4Req
  24. if err := appG.C.ShouldBindJSON(&req); err != nil {
  25. logger.GetLogger().Errorf(err.Error())
  26. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  27. return
  28. }
  29. if rsp, err := asignService.APICompanyBankCard4(req); err == nil {
  30. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  31. } else {
  32. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  33. }
  34. }
  35. // CaptcaResend 重新发送认证验证码(测试)
  36. // @Summary 重新发送认证验证码(测试)
  37. // @Description 在实名认证的过程中,因用户手机原因未收到短信验证码或原验证码超过15分钟有效期而过期时,可以调用此接口重新发送短信验证码。若1分钟内多次调用此接口,则仅会发送一次短信验证码,15分钟内重新发送短信验证码不会变化。
  38. // @Produce json
  39. // @Security ApiKeyAuth
  40. // @accept application/json
  41. // @Param data body asignService.APICaptchaResendReq true "入参"
  42. // @Success 200 {object} app.Response
  43. // @Failure 500 {object} app.Response
  44. // @Router /Asign/TestCaptcaResend [post]
  45. // @Tags 爱签
  46. func TestCaptcaResend(c *gin.Context) {
  47. appG := app.Gin{C: c}
  48. // 获取请求参数
  49. var req asignService.APICaptchaResendReq
  50. if err := appG.C.ShouldBindJSON(&req); err != nil {
  51. logger.GetLogger().Errorf(err.Error())
  52. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  53. return
  54. }
  55. if rsp, err := asignService.APICaptchaResend(req); err == nil {
  56. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  57. } else {
  58. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  59. }
  60. }
  61. // CaptchaVerify 认证验证码校验(测试)
  62. // @Summary 认证验证码校验(测试)
  63. // @Description 验证码认证成功后会调用爱签添加用户接口,同时调用交易系统JAVA实名认证接口
  64. // @Produce json
  65. // @Security ApiKeyAuth
  66. // @accept application/json
  67. // @Param data body asignService.APICaptchaVerifyReq true "入参"
  68. // @Success 200 {object} asignService.APICaptchaVerifyRsp
  69. // @Failure 500 {object} app.Response
  70. // @Router /Asign/TestCaptchaVerify [post]
  71. // @Tags 爱签
  72. func TestCaptchaVerify(c *gin.Context) {
  73. appG := app.Gin{C: c}
  74. // 获取请求参数
  75. var req asignService.APICaptchaVerifyReq
  76. if err := appG.C.ShouldBindJSON(&req); err != nil {
  77. logger.GetLogger().Errorf(err.Error())
  78. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  79. return
  80. }
  81. if rsp, err := asignService.APICaptchaVerify(req); err == nil {
  82. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  83. } else {
  84. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  85. }
  86. }
  87. // CaptchaVerify 添加企业用户(V2)(测试)
  88. // @Summary 添加企业用户(V2)(测试)
  89. // @Produce json
  90. // @Security ApiKeyAuth
  91. // @accept application/json
  92. // @Param data body asignService.APIAddEnterpriseUserReq true "入参"
  93. // @Success 200 {object} asignService.APIAddUserRsp
  94. // @Failure 500 {object} app.Response
  95. // @Router /Asign/TestAddEnterpriseUser [post]
  96. // @Tags 爱签
  97. func TestAddEnterpriseUser(c *gin.Context) {
  98. appG := app.Gin{C: c}
  99. // 获取请求参数
  100. var req asignService.APIAddEnterpriseUserReq
  101. if err := appG.C.ShouldBindJSON(&req); err != nil {
  102. logger.GetLogger().Errorf(err.Error())
  103. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  104. return
  105. }
  106. if rsp, err := asignService.APIAddEnterpriseUser(req); err == nil {
  107. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  108. } else {
  109. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  110. }
  111. }