瀏覽代碼

增加“获取用户实名认证状态请求参数”接口

Zhou Xiaoning 5 年之前
父節點
當前提交
8317253098
共有 5 個文件被更改,包括 156 次插入6 次删除
  1. 46 0
      controllers/user/user.go
  2. 41 2
      docs/docs.go
  3. 41 2
      docs/swagger.json
  4. 26 2
      docs/swagger.yaml
  5. 2 0
      routers/router.go

+ 46 - 0
controllers/user/user.go

@@ -93,3 +93,49 @@ func QueryUserInfo(c *gin.Context) {
 	logger.GetLogger().Infof("QueryUserInfo successed: %v", data)
 	appG.Response(http.StatusOK, e.SUCCESS, data)
 }
+
+// GetUserAuthStatusReq 获取用户实名认证状态请求参数
+type GetUserAuthStatusReq struct {
+	UserID int `form:"userID" binding:"required"` // 用户ID
+}
+
+// GetUserAuthStatus 获取用户实名认证状态
+// @Summary 获取用户实名认证状态
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userID query int true "用户ID"
+// @Success 200 {bool} app.Response
+// @Failure 500 {object} app.Response
+// @Router /User/GetUserAuthStatus [get]
+// @Tags 用户信息
+func GetUserAuthStatus(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req GetUserAuthStatusReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("GetUserAuthStatus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	isAuth := false
+	var userAccount models.Useraccount
+	engine := db.GetEngine()
+	has, err := engine.Where("USERID = ?", req.UserID).Get(&userAccount)
+	if err != nil {
+		// 获取行情报价牌分类菜单
+		logger.GetLogger().Errorf("GetUserAuthStatus failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_QUOTEMENU_FAIL, nil)
+		return
+	}
+	if has {
+		if userAccount.Hasauth == 1 {
+			isAuth = true
+		}
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("GetUserAuthStatus successed: %v", isAuth)
+	appG.Response(http.StatusOK, e.SUCCESS, isAuth)
+}

+ 41 - 2
docs/docs.go

@@ -1062,7 +1062,7 @@ var doc = `{
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                        "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易 3:交易转金点赞(不设置) 4:交易转金点拍(不设置) 5:花生米转交易 6:交易转花生米(不设置)",
                         "name": "convertType",
                         "in": "query"
                     },
@@ -1462,6 +1462,45 @@ var doc = `{
                 }
             }
         },
+        "/User/GetUserAuthStatus": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "用户信息"
+                ],
+                "summary": "获取用户实名认证状态",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "bool"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/User/QueryUserInfo": {
             "get": {
                 "security": [
@@ -3249,7 +3288,7 @@ var doc = `{
             ],
             "properties": {
                 "converttype": {
-                    "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                    "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易 3:交易转金点赞(不设置) 4:交易转金点拍(不设置) 5:花生米转交易 6:交易转花生米(不设置)",
                     "type": "integer"
                 },
                 "createtime": {

+ 41 - 2
docs/swagger.json

@@ -1046,7 +1046,7 @@
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                        "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易 3:交易转金点赞(不设置) 4:交易转金点拍(不设置) 5:花生米转交易 6:交易转花生米(不设置)",
                         "name": "convertType",
                         "in": "query"
                     },
@@ -1446,6 +1446,45 @@
                 }
             }
         },
+        "/User/GetUserAuthStatus": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "用户信息"
+                ],
+                "summary": "获取用户实名认证状态",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userID",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "bool"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/User/QueryUserInfo": {
             "get": {
                 "security": [
@@ -3233,7 +3272,7 @@
             ],
             "properties": {
                 "converttype": {
-                    "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                    "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易 3:交易转金点赞(不设置) 4:交易转金点拍(不设置) 5:花生米转交易 6:交易转花生米(不设置)",
                     "type": "integer"
                 },
                 "createtime": {

+ 26 - 2
docs/swagger.yaml

@@ -1247,7 +1247,7 @@ definitions:
   models.Szdz3convertconfig:
     properties:
       converttype:
-        description: 转换类型 - 1:金点赞转交易 2:金点拍转交易
+        description: 转换类型 - 1:金点赞转交易 2:金点拍转交易 3:交易转金点赞(不设置) 4:交易转金点拍(不设置) 5:花生米转交易 6:交易转花生米(不设置)
         type: integer
       createtime:
         description: 创建时间
@@ -3311,7 +3311,7 @@ paths:
   /SZDZ/QueryConvertConfig:
     get:
       parameters:
-      - description: 转换类型 - 1:金点赞转交易 2:金点拍转交易
+      - description: 转换类型 - 1:金点赞转交易 2:金点拍转交易 3:交易转金点赞(不设置) 4:交易转金点拍(不设置) 5:花生米转交易 6:交易转花生米(不设置)
         in: query
         name: convertType
         type: integer
@@ -3572,6 +3572,30 @@ paths:
       summary: 获取登录ID
       tags:
       - 用户信息
+  /User/GetUserAuthStatus:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userID
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            type: bool
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 获取用户实名认证状态
+      tags:
+      - 用户信息
   /User/QueryUserInfo:
     get:
       parameters:

+ 2 - 0
routers/router.go

@@ -52,6 +52,8 @@ func InitRouter() *gin.Engine {
 		userR.GET("/QueryUserReferNum", user.QueryUserReferNum)
 		// 获取用户信息请求参数
 		userR.Use(token.Auth()).GET("/QueryUserInfo", user.QueryUserInfo)
+		// 获取用户实名认证状态
+		userR.Use(token.Auth()).GET("/GetUserAuthStatus", user.GetUserAuthStatus)
 	}
 	// ************************ 资金账户 ************************
 	taAccountR := apiR.Group("TaAccount")