auth.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package tencetcloud
  2. import (
  3. "mtp2_if/config"
  4. "mtp2_if/global/app"
  5. "mtp2_if/global/e"
  6. "mtp2_if/logger"
  7. asignService "mtp2_if/services/asign"
  8. tencentCloudService "mtp2_if/services/tencent-cloud"
  9. "net/http"
  10. "strconv"
  11. "github.com/gin-gonic/gin"
  12. )
  13. // BankCard4 银行卡四要素认证
  14. // @Summary 银行卡四要素认证
  15. // @Produce json
  16. // @Security ApiKeyAuth
  17. // @accept application/json
  18. // @Param data body asignService.BankCard4Req true "入参"
  19. // @Success 200 {object} asignService.BankCard4Rsp
  20. // @Failure 500 {object} tencentCloudService.BankCard4Rsp
  21. // @Router /TencentCloud/BankCard4 [post]
  22. // @Tags 腾讯云
  23. func BankCard4(c *gin.Context) {
  24. appG := app.Gin{C: c}
  25. // 获取请求参数
  26. var req asignService.BankCard4Req
  27. if err := appG.C.ShouldBindJSON(&req); err != nil {
  28. logger.GetLogger().Errorf(err.Error())
  29. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  30. return
  31. }
  32. if !config.SerCfg.GetDebugMode() {
  33. requserid, _ := appG.C.Get("requserid")
  34. if requserid != strconv.Itoa(req.UserId) {
  35. appG.Response(http.StatusOK, e.SUCCESS, tencentCloudService.BankCard4Rsp{Code: "2", Description: "请求参数非法"})
  36. return
  37. }
  38. }
  39. rsp := tencentCloudService.BankCard4EVerification(req)
  40. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  41. }