package asign import ( "mtp2_if/global/app" "mtp2_if/global/e" "mtp2_if/logger" "mtp2_if/models" "net/http" asignService "mtp2_if/services/asign" "github.com/gin-gonic/gin" ) // CaptchaVerify 创建印章 // @Summary 创建印章 // @Produce json // @Security ApiKeyAuth // @accept application/json // @Param data body asignService.CreateSealReq true "入参" // @Success 200 {object} app.Response // @Failure 500 {object} app.Response // @Router /Asign/CreateSeal [post] // @Tags 爱签 func CreateSeal(c *gin.Context) { appG := app.Gin{C: c} // 获取请求参数 var req asignService.CreateSealReq if err := appG.C.ShouldBindJSON(&req); err != nil { logger.GetLogger().Errorf(err.Error()) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if err := asignService.CreateSeal(req); err == nil { appG.Response(http.StatusOK, e.SUCCESS, "ok") } else { appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil) } } // BankCard4 银行卡四要素认证 // @Summary 银行卡四要素认证 // @Produce json // @Security ApiKeyAuth // @accept application/json // @Param data body asignService.BankCard4Req true "入参" // @Success 200 {object} asignService.BankCard4Rsp // @Failure 500 {object} app.Response // @Router /Asign/BankCard4 [post] // @Tags 爱签 func BankCard4(c *gin.Context) { appG := app.Gin{C: c} // 获取请求参数 var req asignService.BankCard4Req if err := appG.C.ShouldBindJSON(&req); err != nil { logger.GetLogger().Errorf(err.Error()) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if rsp, err := asignService.BankCard4(req); err == nil { appG.Response(http.StatusOK, e.SUCCESS, rsp) } else { appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil) } } // CaptcaResend 重新发送认证验证码 // @Summary 重新发送认证验证码 // @Description 在实名认证的过程中,因用户手机原因未收到短信验证码或原验证码超过15分钟有效期而过期时,可以调用此接口重新发送短信验证码。若1分钟内多次调用此接口,则仅会发送一次短信验证码,15分钟内重新发送短信验证码不会变化。 // @Produce json // @Security ApiKeyAuth // @accept application/json // @Param data body asignService.CaptchaResendReq true "入参" // @Success 200 {object} app.Response // @Failure 500 {object} app.Response // @Router /Asign/CaptcaResend [post] // @Tags 爱签 func CaptcaResend(c *gin.Context) { appG := app.Gin{C: c} // 获取请求参数 var req asignService.CaptchaResendReq if err := appG.C.ShouldBindJSON(&req); err != nil { logger.GetLogger().Errorf(err.Error()) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if err := asignService.CaptcaResend(req); err == nil { appG.Response(http.StatusOK, e.SUCCESS, "ok") } else { appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil) } } // CaptchaVerify 认证验证码校验 // @Summary 认证验证码校验 // @Description 验证码认证成功后会调用爱签添加用户接口,同时调用交易系统JAVA实名认证接口 // @Produce json // @Security ApiKeyAuth // @accept application/json // @Param data body asignService.CaptchaVerifyReq true "入参" // @Success 200 {object} app.Response // @Failure 500 {object} app.Response // @Router /Asign/CaptchaVerify [post] // @Tags 爱签 func CaptchaVerify(c *gin.Context) { appG := app.Gin{C: c} // 获取请求参数 var req asignService.CaptchaVerifyReq if err := appG.C.ShouldBindJSON(&req); err != nil { logger.GetLogger().Errorf(err.Error()) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if err := asignService.CaptchaVerify(req); err == nil { appG.Response(http.StatusOK, e.SUCCESS, "ok") } else { appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil) } } // CaptchaVerify 同步合同状态 // @Summary 同步合同状态 // @Description 此接口会调用爱签合同状态查询接口,并同步到交易系统用户电子签记录表记录中 // @Produce json // @accept application/json // @Param data body asignService.SyncContractStatusReq true "入参" // @Success 200 {object} asignService.SyncContractStatusRsp // @Failure 500 {object} app.Response // @Router /Asign/SyncContractStatus [post] // @Tags 爱签 func SyncContractStatus(c *gin.Context) { appG := app.Gin{C: c} // 获取请求参数 var req asignService.SyncContractStatusReq if err := appG.C.ShouldBindJSON(&req); err != nil { logger.GetLogger().Errorf(err.Error()) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if rsp, err := asignService.SyncContractStatus(req); err == nil { appG.Response(http.StatusOK, e.SUCCESS, rsp) } else { appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil) } } // QueryUsereSignRecords 查询用户电子签记录表 // @Summary 查询用户电子签记录表 // @Produce json // @Security ApiKeyAuth // @accept application/json // @Param userId query int true "用户ID" // @Param memberUserId query int true "所属会员ID" // @Param recordId query int false "记录ID" // @Param templateConfigId query int false "模板配置ID" // @Param templatetype query int false "模板类型 - 1:实名认证 2:开户协议 3:日结算单 4:交易协议" // @Success 200 {array} models.Useresignrecord // @Failure 500 {object} app.Response // @Router /Asign/QueryUsereSignRecords [get] // @Tags 爱签 func QueryUsereSignRecords(c *gin.Context) { appG := app.Gin{C: c} // 获取请求参数 var req asignService.QueryUsereSignRecordsReq if err := appG.C.ShouldBindQuery(&req); err != nil { logger.GetLogger().Errorf("QueryUsereSignRecords failed: %s", err.Error()) appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil) return } if rsp, err := models.QueryUsereSignRecords(req.UserId, req.MemberUserId, req.RecordId, req.TemplateConfigId, req.Templatetype); err == nil { appG.Response(http.StatusOK, e.SUCCESS, rsp) } else { appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil) } }