| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- 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)
- }
- }
- // BankCard4 个人意愿核身认证(双录)
- // @Summary 个人意愿核身认证(双录)
- // @Produce json
- // @Security ApiKeyAuth
- // @accept application/json
- // @Param data body asignService.WillFaceReq true "入参"
- // @Success 200 {object} asignService.WillFaceRsp
- // @Failure 500 {object} app.Response
- // @Router /Asign/WillFace [post]
- // @Tags 爱签
- func WillFace(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.WillFaceReq
- 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.WillFace(req); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, rsp)
- } else {
- appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
- }
- }
|