feat: 个人中心发布
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/commom/response"
|
||||
"sundynix-go/model/plant/request"
|
||||
"sundynix-go/utils/auth"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type UserProfileApi struct{}
|
||||
@@ -49,3 +51,34 @@ func (a *UserProfileApi) ProfileDetail(c *gin.Context) {
|
||||
}
|
||||
response.OkWithData(res, c)
|
||||
}
|
||||
|
||||
// MyStars 我的收藏
|
||||
// @Tags 个人中心
|
||||
// @Summary 我的收藏
|
||||
// @Security BearerAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.StarsPageReq true "分页获取收藏列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /profile/star [post]
|
||||
func (a *UserProfileApi) MyStars(c *gin.Context) {
|
||||
var req request.StarsPageReq
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
userId := auth.GetUserId(c)
|
||||
list, total, err := userProfileService.MyStars(req, userId)
|
||||
if err != nil {
|
||||
global.Logger.Error("获取收藏失败", zap.Error(err))
|
||||
response.FailWithMsg("获取收藏失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: req.Current,
|
||||
PageSize: req.PageSize,
|
||||
}, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user