| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- package account
- import (
- "mtp20access/global"
- "mtp20access/model/account/request"
- "mtp20access/model/common/response"
- signService "mtp20access/service/sign"
- "mtp20access/utils"
- "net/http"
- "github.com/gin-gonic/gin"
- "go.uber.org/zap"
- )
- // AddUser 查询用户电子签记录表
- // @Summary 查询用户电子签记录表
- // @Security ApiKeyAuth
- // @accept application/json
- // @Produce application/json
- // @Success 200 {object} response.Response{data=[]account.Useresignrecord,msg=string} "出参"
- // @Router /Account/QueryUserESignRecord [get]
- // @Tags 账户服务
- func QueryUserESignRecord(c *gin.Context) {
- g := utils.GinUtils{C: c}
- // 获取请求账号信息
- claims := g.GetClaims()
- if g.Err != nil {
- return
- }
- if rsp, err := signService.QueryUserESignRecord(claims.UserID); err == nil {
- response.OkWithDetailed(rsp, "查询成功", g.C)
- } else {
- global.M2A_LOG.Error(err.Error(), zap.Error(err))
- response.FailWithMessage(err.Error(), c)
- }
- }
- // AddUser 实名认证添加用户
- // @Summary 实名认证添加用户
- // @Security ApiKeyAuth
- // @accept application/json
- // @Produce application/json
- // @Param data body request.AddUserReq true "入参"
- // @Success 200 {object} response.Response{msg=string} "出参"
- // @Router /Account/AddUser [post]
- // @Tags 账户服务
- func AddUser(c *gin.Context) {
- g := utils.GinUtils{C: c}
- r := request.AddUserReq{}
- g.BindJsonReq(&r)
- if g.Err != nil {
- return
- }
- // 获取请求账号信息
- claims := g.GetClaims()
- if g.Err != nil {
- return
- }
- if err := signService.AddUser(r, claims.UserID); err == nil {
- response.Ok(g.C)
- } else {
- global.M2A_LOG.Error(err.Error(), zap.Error(err))
- response.FailWithMessage(err.Error(), c)
- }
- }
- // CreateContractAndAddSigner 上传待签署文件和添加签署方
- // @Summary 上传待签署文件和添加签署方
- // @Security ApiKeyAuth
- // @accept application/json
- // @Produce application/json
- // @Param data body request.CreateContractAndAddSignerReq true "入参"
- // @Success 200 {object} response.Response{data=string,msg=string} "出参"
- // @Router /Account/CreateContractAndAddSigner [post]
- // @Tags 账户服务
- func CreateContractAndAddSigner(c *gin.Context) {
- g := utils.GinUtils{C: c}
- r := request.CreateContractAndAddSignerReq{}
- g.BindJsonReq(&r)
- if g.Err != nil {
- return
- }
- // 获取请求账号信息
- claims := g.GetClaims()
- if g.Err != nil {
- return
- }
- if rsp, err := signService.CreateContractAndAddSigner(r, claims.UserID); err == nil {
- response.OkWithDetailed(rsp, "操作成功", g.C)
- } else {
- global.M2A_LOG.Error(err.Error(), zap.Error(err))
- response.FailWithMessage(err.Error(), c)
- }
- }
- // SignCompleted 提交实名认证
- // @Summary 提交实名认证
- // @Security ApiKeyAuth
- // @accept application/json
- // @Produce application/json
- // @Success 200 {object} response.Response{msg=string} "出参"
- // @Router /Account/SignCompleted [post]
- // @Tags 账户服务
- func SignCompleted(c *gin.Context) {
- g := utils.GinUtils{C: c}
- // 获取请求账号信息
- claims := g.GetClaims()
- if g.Err != nil {
- return
- }
- if err := signService.SignCompleted(claims.UserID); err == nil {
- response.OkWithMessage("操作成功", g.C)
- } else {
- global.M2A_LOG.Error(err.Error(), zap.Error(err))
- response.FailWithMessage(err.Error(), c)
- }
- }
- // POST
- func HandleASignCompleted(c *gin.Context) {
- g := utils.GinUtils{C: c}
- r := request.HandleASignCompletedReq{}
- g.BindJsonReq(&r)
- if g.Err != nil {
- return
- }
- if err := signService.HandleASignCompleted(r); err == nil {
- g.C.String(http.StatusOK, "%s", "ok")
- } else {
- global.M2A_LOG.Error(err.Error(), zap.Error(err))
- response.FailWithMessage(err.Error(), c)
- }
- }
|