| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- package asign
- import (
- "mtp2_if/global/app"
- "mtp2_if/global/e"
- "mtp2_if/logger"
- asignService "mtp2_if/services/asign"
- "net/http"
- "github.com/gin-gonic/gin"
- )
- // BankCard4 银行卡四要素认证(测试)
- // @Summary 银行卡四要素认证(测试)
- // @Produce json
- // @accept application/json
- // @Param data body asignService.APICompanyBankCard4Req true "入参"
- // @Success 200 {object} asignService.APIBankCard4Rsp
- // @Failure 500 {object} app.Response
- // @Router /Asign/TestBankCard4 [post]
- // @Tags 爱签
- func TestBankCard4(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.APICompanyBankCard4Req
- 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.APIPost[asignService.APICompanyBankCard4Req, asignService.APIBankCard4Rsp](
- asignService.APIReq[asignService.APICompanyBankCard4Req]{Data: req}, asignService.APIURL_Company_BankCard4); 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
- // @accept application/json
- // @Param data body asignService.APICaptchaResendReq true "入参"
- // @Success 200 {object} app.Response
- // @Failure 500 {object} app.Response
- // @Router /Asign/TestCaptcaResend [post]
- // @Tags 爱签
- func TestCaptcaResend(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.APICaptchaResendReq
- 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.APIPost[asignService.APICaptchaResendReq, interface{}](
- asignService.APIReq[asignService.APICaptchaResendReq]{Data: req}, asignService.APIURL_Captcha_Resend); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, rsp)
- } else {
- appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
- }
- }
- // CaptchaVerify 认证验证码校验(测试)
- // @Summary 认证验证码校验(测试)
- // @Description 验证码认证成功后会调用爱签添加用户接口,同时调用交易系统JAVA实名认证接口
- // @Produce json
- // @accept application/json
- // @Param data body asignService.APICaptchaVerifyReq true "入参"
- // @Success 200 {object} asignService.APICaptchaVerifyRsp
- // @Failure 500 {object} app.Response
- // @Router /Asign/TestCaptchaVerify [post]
- // @Tags 爱签
- func TestCaptchaVerify(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.APICaptchaVerifyReq
- 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.APIPost[asignService.APICaptchaVerifyReq, asignService.APICaptchaVerifyRsp](
- asignService.APIReq[asignService.APICaptchaVerifyReq]{Data: req}, asignService.APIURL_Captcha_Verify); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, rsp)
- } else {
- appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
- }
- }
- // CaptchaVerify 添加企业用户(V2)(测试)
- // @Summary 添加企业用户(V2)(测试)
- // @Produce json
- // @accept application/json
- // @Param data body asignService.APIAddEnterpriseUserReq true "入参"
- // @Success 200 {object} asignService.APIAddUserRsp
- // @Failure 500 {object} app.Response
- // @Router /Asign/TestAddEnterpriseUser [post]
- // @Tags 爱签
- func TestAddEnterpriseUser(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.APIAddEnterpriseUserReq
- 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.APIPost[asignService.APIAddEnterpriseUserReq, asignService.APIAddUserRsp](
- asignService.APIReq[asignService.APIAddEnterpriseUserReq]{Data: req}, asignService.APIURL_V2_User_AddEnterpriseUser); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, rsp)
- } else {
- appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
- }
- }
- // TestGetUser 获取用户信息(测试)
- // @Summary 获取用户信息(测试)
- // @Produce json
- // @accept application/json
- // @Param data body asignService.APIGetUserReq true "入参"
- // @Success 200 {object} asignService.APIGetUserReq
- // @Failure 500 {object} app.Response
- // @Router /Asign/TestGetUser [post]
- // @Tags 爱签
- func TestGetUser(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.APIGetUserReq
- if err := appG.C.ShouldBindJSON(&req); err != nil {
- logger.GetLogger().Errorf(err.Error())
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- getUserReq := asignService.APIReq[asignService.APIGetUserReq]{
- Data: req,
- }
- apiRsp, err := asignService.APIPost[asignService.APIGetUserReq, asignService.APIGetUserRsp](getUserReq, asignService.APIURL_GetUser)
- if err != nil {
- appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
- return
- }
- appG.Response(http.StatusOK, e.SUCCESS, apiRsp)
- }
- // GetUserSeals 查询印章(测试)
- // @Summary 查询印章(测试)
- // @Produce json
- // @accept application/json
- // @Param data body asignService.APIGetUserSealsReq true "入参"
- // @Success 200 {object} asignService.APIGetUserSealsRsp
- // @Failure 500 {object} app.Response
- // @Router /Asign/GetUserSeals [post]
- // @Tags 爱签
- func GetUserSeals(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req asignService.APIGetUserSealsReq
- if err := appG.C.ShouldBindJSON(&req); err != nil {
- logger.GetLogger().Errorf(err.Error())
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- r := asignService.APIReq[asignService.APIGetUserSealsReq]{
- Data: req,
- }
- apiRsp, err := asignService.APIPost[asignService.APIGetUserSealsReq, asignService.APIGetUserSealsRsp](r, asignService.APIURL_GetUserSeals)
- if err != nil {
- appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
- return
- }
- appG.Response(http.StatusOK, e.SUCCESS, apiRsp)
- }
|