|
@@ -139,6 +139,47 @@ func GetUserAuthStatus(c *gin.Context) {
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, isAuth)
|
|
appG.Response(http.StatusOK, e.SUCCESS, isAuth)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// GetUserAccountReq 获取用户账号信息请求参数
|
|
|
|
|
+type GetUserAccountReq struct {
|
|
|
|
|
+ UserID int `form:"userID" binding:"required"` // 用户ID
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// GetUserAccount 获取用户账号信息
|
|
|
|
|
+// @Summary 获取用户账号信息
|
|
|
|
|
+// @Produce json
|
|
|
|
|
+// @Security ApiKeyAuth
|
|
|
|
|
+// @Param userID query int true "用户ID"
|
|
|
|
|
+// @Success 200 {object} models.Useraccount
|
|
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
|
|
+// @Router /User/GetUserAccount [get]
|
|
|
|
|
+// @Tags 用户信息
|
|
|
|
|
+func GetUserAccount(c *gin.Context) {
|
|
|
|
|
+ appG := app.Gin{C: c}
|
|
|
|
|
+
|
|
|
|
|
+ // 获取请求参数
|
|
|
|
|
+ var req GetUserAccountReq
|
|
|
|
|
+ if err := appG.C.ShouldBindQuery(&req); err != nil {
|
|
|
|
|
+ logger.GetLogger().Errorf("GetUserAccount failed: %s", err.Error())
|
|
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var (
|
|
|
|
|
+ userAccount *models.Useraccount
|
|
|
|
|
+ err error
|
|
|
|
|
+ )
|
|
|
|
|
+ if userAccount, err = models.GetUserAccount(req.UserID); err != nil {
|
|
|
|
|
+ // 查询失败
|
|
|
|
|
+ logger.GetLogger().Errorf("GetUserAccount failed: %s", err.Error())
|
|
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询成功
|
|
|
|
|
+ logger.GetLogger().Debugln("GetUserAccount successed: %v", userAccount)
|
|
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, userAccount)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// QueryUserFavoriteGoodsesReq 获取用户商品收藏信息请求参数
|
|
// QueryUserFavoriteGoodsesReq 获取用户商品收藏信息请求参数
|
|
|
type QueryUserFavoriteGoodsesReq struct {
|
|
type QueryUserFavoriteGoodsesReq struct {
|
|
|
UserID int `form:"userID" binding:"required"`
|
|
UserID int `form:"userID" binding:"required"`
|