certification.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package account
  2. import (
  3. "mtp20access/global"
  4. "mtp20access/model/account/request"
  5. "mtp20access/model/common/response"
  6. signService "mtp20access/service/sign"
  7. "mtp20access/utils"
  8. "github.com/gin-gonic/gin"
  9. "go.uber.org/zap"
  10. )
  11. // AddUser 实名认证添加用户
  12. // @Summary 实名认证添加用户
  13. // @Security ApiKeyAuth
  14. // @accept application/json
  15. // @Produce application/json
  16. // @Param data body request.AddUserReq true "入参"
  17. // @Success 200 {object} response.Response{msg=string} "出参"
  18. // @Router /Account/AddUser [post]
  19. // @Tags 账户服务
  20. func AddUser(c *gin.Context) {
  21. g := utils.GinUtils{C: c}
  22. r := request.AddUserReq{}
  23. g.BindJsonReq(&r)
  24. if g.Err != nil {
  25. return
  26. }
  27. // 获取请求账号信息
  28. claims := g.GetClaims()
  29. if g.Err != nil {
  30. return
  31. }
  32. if err := signService.AddUser(r, claims.UserID); err == nil {
  33. response.Ok(g.C)
  34. } else {
  35. global.M2A_LOG.Error(err.Error(), zap.Error(err))
  36. response.FailWithMessage(err.Error(), c)
  37. }
  38. }
  39. // AddUser 查询用户电子签记录表
  40. // @Summary 查询用户电子签记录表
  41. // @Security ApiKeyAuth
  42. // @accept application/json
  43. // @Produce application/json
  44. // @Success 200 {object} response.Response{data=[]account.Useresignrecord,msg=string} "出参"
  45. // @Router /Account/QueryUserESignRecord [get]
  46. // @Tags 账户服务
  47. func QueryUserESignRecord(c *gin.Context) {
  48. g := utils.GinUtils{C: c}
  49. // 获取请求账号信息
  50. claims := g.GetClaims()
  51. if g.Err != nil {
  52. return
  53. }
  54. if rsp, err := signService.QueryUserESignRecord(claims.UserID); err == nil {
  55. response.OkWithDetailed(rsp, "查询成功", g.C)
  56. } else {
  57. global.M2A_LOG.Error(err.Error(), zap.Error(err))
  58. response.FailWithMessage(err.Error(), c)
  59. }
  60. }