|
|
@@ -1,6 +1,7 @@
|
|
|
package asign
|
|
|
|
|
|
import (
|
|
|
+ "errors"
|
|
|
"mtp2_if/global/app"
|
|
|
"mtp2_if/global/e"
|
|
|
"mtp2_if/logger"
|
|
|
@@ -70,13 +71,13 @@ func TestCaptcaResend(c *gin.Context) {
|
|
|
// CaptchaVerify 认证验证码校验(测试)
|
|
|
// @Summary 认证验证码校验(测试)
|
|
|
// @Description 验证码认证成功后会调用爱签添加用户接口,同时调用交易系统JAVA实名认证接口
|
|
|
-// @Produce json
|
|
|
-// @accept application/json
|
|
|
+// @Produce json
|
|
|
+// @accept application/json
|
|
|
// @Param data body asignService.APICaptchaVerifyReq true "入参"
|
|
|
// @Success 200 {object} asignService.APICaptchaVerifyRsp
|
|
|
-// @Failure 500 {object} app.Response
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
// @Router /Asign/TestCaptchaVerify [post]
|
|
|
-// @Tags 爱签
|
|
|
+// @Tags 爱签
|
|
|
func TestCaptchaVerify(c *gin.Context) {
|
|
|
appG := app.Gin{C: c}
|
|
|
|
|
|
@@ -123,3 +124,57 @@ func TestAddEnterpriseUser(c *gin.Context) {
|
|
|
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
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断证件号码是否已经在爱签平台存在
|
|
|
+ // var getUserReq APIGetUserReq
|
|
|
+ // getUserReq.Account = strconv.Itoa(req.UserId)
|
|
|
+ getUserReq := asignService.APIReq[asignService.APIGetUserReq]{
|
|
|
+ Data: asignService.APIGetUserReq{Account: req.Account},
|
|
|
+ }
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ if apiRsp.Code == asignService.CODE_SUCCESS {
|
|
|
+ err = errors.New("电子签平台用户编号已存在")
|
|
|
+ logger.GetLogger().Error("电子签平台用户编号已存在, apiRsp:", apiRsp)
|
|
|
+ appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getUserReq.Data.Account = ""
|
|
|
+ getUserReq.Data.IdCard = req.IdCard
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ if apiRsp.Code == asignService.CODE_SUCCESS && len(apiRsp.Data) > 0 {
|
|
|
+ err = errors.New("电子签平台证件号码已存在")
|
|
|
+ logger.GetLogger().Error("电子签平台证件号码已存在, apiRsp:", apiRsp)
|
|
|
+ appG.ResponseByMsg(http.StatusBadRequest, e.ERROR, err.Error(), nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, "")
|
|
|
+}
|