|
|
@@ -758,3 +758,40 @@ func UpdateUserInfoWechatAndEmail(c *gin.Context) {
|
|
|
logger.GetLogger().Debugln("UpdateUserInfoWechatAndEmail successed:", "ok")
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, "ok")
|
|
|
}
|
|
|
+
|
|
|
+// GetUserScoreReq 用户积分信息查询请求参数
|
|
|
+type GetUserScoreReq struct {
|
|
|
+ UserID int `form:"userID" binding:"required"` // 用户ID
|
|
|
+}
|
|
|
+
|
|
|
+// QueryUserScore 用户积分信息查询
|
|
|
+// @Summary 用户积分信息查询
|
|
|
+// @Produce json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param userid query int true "用户ID"
|
|
|
+// @Success 200 {object} models.UserScore
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /User/QueryUserScore [get]
|
|
|
+// @Tags 用户信息
|
|
|
+func QueryUserScore(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req GetUserScoreReq
|
|
|
+ if err := appG.C.ShouldBindJSON(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("QueryUserScore failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ userScores, err := models.GetUserScore(req.UserID)
|
|
|
+ if err != nil {
|
|
|
+ // 查询失败
|
|
|
+ logger.GetLogger().Errorf("QueryUserScore failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询成功
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, userScores)
|
|
|
+}
|