certification.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. // @Success 200 {object} response.Response{data=[]account.Useresignrecord,msg=string} "出参"
  17. // @Router /Account/QueryUserESignRecord [get]
  18. // @Tags 账户服务
  19. func QueryUserESignRecord(c *gin.Context) {
  20. g := utils.GinUtils{C: c}
  21. // 获取请求账号信息
  22. claims := g.GetClaims()
  23. if g.Err != nil {
  24. return
  25. }
  26. if rsp, err := signService.QueryUserESignRecord(claims.UserID); err == nil {
  27. response.OkWithDetailed(rsp, "查询成功", g.C)
  28. } else {
  29. global.M2A_LOG.Error(err.Error(), zap.Error(err))
  30. response.FailWithMessage(err.Error(), c)
  31. }
  32. }
  33. // AddUser 实名认证添加用户
  34. // @Summary 实名认证添加用户
  35. // @Security ApiKeyAuth
  36. // @accept application/json
  37. // @Produce application/json
  38. // @Param data body request.AddUserReq true "入参"
  39. // @Success 200 {object} response.Response{msg=string} "出参"
  40. // @Router /Account/AddUser [post]
  41. // @Tags 账户服务
  42. func AddUser(c *gin.Context) {
  43. g := utils.GinUtils{C: c}
  44. r := request.AddUserReq{}
  45. g.BindJsonReq(&r)
  46. if g.Err != nil {
  47. return
  48. }
  49. // 获取请求账号信息
  50. claims := g.GetClaims()
  51. if g.Err != nil {
  52. return
  53. }
  54. if err := signService.AddUser(r, claims.UserID); err == nil {
  55. response.Ok(g.C)
  56. } else {
  57. global.M2A_LOG.Error(err.Error(), zap.Error(err))
  58. response.FailWithMessage(err.Error(), c)
  59. }
  60. }
  61. // AddUser 上传待签署文件和添加签署方
  62. // @Summary 上传待签署文件和添加签署方
  63. // @Security ApiKeyAuth
  64. // @accept application/json
  65. // @Produce application/json
  66. // @Param data body request.CreateContractAndAddSignerReq true "入参"
  67. // @Success 200 {object} response.Response{data=string,msg=string} "出参"
  68. // @Router /Account/CreateContractAndAddSigner [post]
  69. // @Tags 账户服务
  70. func CreateContractAndAddSigner(c *gin.Context) {
  71. g := utils.GinUtils{C: c}
  72. r := request.CreateContractAndAddSignerReq{}
  73. g.BindJsonReq(&r)
  74. if g.Err != nil {
  75. return
  76. }
  77. // 获取请求账号信息
  78. claims := g.GetClaims()
  79. if g.Err != nil {
  80. return
  81. }
  82. if rsp, err := signService.CreateContractAndAddSigner(r, claims.UserID); err == nil {
  83. response.OkWithDetailed(rsp, "操作成功", g.C)
  84. } else {
  85. global.M2A_LOG.Error(err.Error(), zap.Error(err))
  86. response.FailWithMessage(err.Error(), c)
  87. }
  88. }