|
@@ -93,3 +93,49 @@ func QueryUserInfo(c *gin.Context) {
|
|
|
logger.GetLogger().Infof("QueryUserInfo successed: %v", data)
|
|
logger.GetLogger().Infof("QueryUserInfo successed: %v", data)
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, 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)
|
|
|
|
|
+}
|