test.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.APIPost[asignService.APICompanyBankCard4Req, asignService.APIBankCard4Rsp](
  30. asignService.APIReq[asignService.APICompanyBankCard4Req]{Data: req}, asignService.APIURL_Company_BankCard4); err == nil {
  31. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  32. } else {
  33. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  34. }
  35. }
  36. // CaptcaResend 重新发送认证验证码(测试)
  37. // @Summary 重新发送认证验证码(测试)
  38. // @Description 在实名认证的过程中,因用户手机原因未收到短信验证码或原验证码超过15分钟有效期而过期时,可以调用此接口重新发送短信验证码。若1分钟内多次调用此接口,则仅会发送一次短信验证码,15分钟内重新发送短信验证码不会变化。
  39. // @Produce json
  40. // @Security ApiKeyAuth
  41. // @accept application/json
  42. // @Param data body asignService.APICaptchaResendReq true "入参"
  43. // @Success 200 {object} app.Response
  44. // @Failure 500 {object} app.Response
  45. // @Router /Asign/TestCaptcaResend [post]
  46. // @Tags 爱签
  47. func TestCaptcaResend(c *gin.Context) {
  48. appG := app.Gin{C: c}
  49. // 获取请求参数
  50. var req asignService.APICaptchaResendReq
  51. if err := appG.C.ShouldBindJSON(&req); err != nil {
  52. logger.GetLogger().Errorf(err.Error())
  53. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  54. return
  55. }
  56. if rsp, err := asignService.APIPost[asignService.APICaptchaResendReq, interface{}](
  57. asignService.APIReq[asignService.APICaptchaResendReq]{Data: req}, asignService.APIURL_Captcha_Resend); err == nil {
  58. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  59. } else {
  60. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  61. }
  62. }
  63. // CaptchaVerify 认证验证码校验(测试)
  64. // @Summary 认证验证码校验(测试)
  65. // @Description 验证码认证成功后会调用爱签添加用户接口,同时调用交易系统JAVA实名认证接口
  66. // @Produce json
  67. // @Security ApiKeyAuth
  68. // @accept application/json
  69. // @Param data body asignService.APICaptchaVerifyReq true "入参"
  70. // @Success 200 {object} asignService.APICaptchaVerifyRsp
  71. // @Failure 500 {object} app.Response
  72. // @Router /Asign/TestCaptchaVerify [post]
  73. // @Tags 爱签
  74. func TestCaptchaVerify(c *gin.Context) {
  75. appG := app.Gin{C: c}
  76. // 获取请求参数
  77. var req asignService.APICaptchaVerifyReq
  78. if err := appG.C.ShouldBindJSON(&req); err != nil {
  79. logger.GetLogger().Errorf(err.Error())
  80. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  81. return
  82. }
  83. if rsp, err := asignService.APIPost[asignService.APICaptchaVerifyReq, asignService.APICaptchaVerifyRsp](
  84. asignService.APIReq[asignService.APICaptchaVerifyReq]{Data: req}, asignService.APIURL_Captcha_Verify); err == nil {
  85. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  86. } else {
  87. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  88. }
  89. }
  90. // CaptchaVerify 添加企业用户(V2)(测试)
  91. // @Summary 添加企业用户(V2)(测试)
  92. // @Produce json
  93. // @Security ApiKeyAuth
  94. // @accept application/json
  95. // @Param data body asignService.APIAddEnterpriseUserReq true "入参"
  96. // @Success 200 {object} asignService.APIAddUserRsp
  97. // @Failure 500 {object} app.Response
  98. // @Router /Asign/TestAddEnterpriseUser [post]
  99. // @Tags 爱签
  100. func TestAddEnterpriseUser(c *gin.Context) {
  101. appG := app.Gin{C: c}
  102. // 获取请求参数
  103. var req asignService.APIAddEnterpriseUserReq
  104. if err := appG.C.ShouldBindJSON(&req); err != nil {
  105. logger.GetLogger().Errorf(err.Error())
  106. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  107. return
  108. }
  109. if rsp, err := asignService.APIPost[asignService.APIAddEnterpriseUserReq, asignService.APIAddUserRsp](
  110. asignService.APIReq[asignService.APIAddEnterpriseUserReq]{Data: req}, asignService.APIURL_V2_User_AddEnterpriseUser); err == nil {
  111. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  112. } else {
  113. appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
  114. }
  115. }