feat: swagger format
This commit is contained in:
@@ -15,7 +15,7 @@ type LevelConfigApi struct{}
|
||||
// @Tags 等级配置
|
||||
// @Summary 添加等级配置
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateLevelConf true "添加等级配置"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
@@ -40,7 +40,7 @@ func (a *LevelConfigApi) AddLevelConfig(c *gin.Context) {
|
||||
// @Tags 等级配置
|
||||
// @Summary 修改等级配置
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.UpdateLevelConf true "修改等级配置"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
|
||||
@@ -17,7 +17,7 @@ type MyPlantApi struct{}
|
||||
// @Tags 我的植物
|
||||
// @Summary 添加植物
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateMyPlant true "创建植物"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
@@ -43,7 +43,7 @@ func (a *MyPlantApi) AddPlant(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 植物列表
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取植物列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
@@ -92,7 +92,7 @@ func (a *MyPlantApi) PlantDetail(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 修改ById植物
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.UpdateMyPlant true "修改ById植物"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改ById成功"}"
|
||||
@@ -117,7 +117,7 @@ func (a *MyPlantApi) UpdatePlant(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 今日任务
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /plant/todayTask [get]
|
||||
@@ -138,7 +138,7 @@ func (a *MyPlantApi) TodayTask(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 完成任务
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CompleteTask true "完成任务"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"完成任务"}"
|
||||
@@ -163,7 +163,7 @@ func (a *MyPlantApi) CompleteTask(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 删除植物
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "删除植物"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
@@ -187,7 +187,7 @@ func (a *MyPlantApi) DeletePlants(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 删除任务
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "删除植物"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
@@ -211,7 +211,7 @@ func (a *MyPlantApi) DeletePlans(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 添加养护事项
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateCarePlan true "添加养护事项"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
@@ -255,7 +255,7 @@ func (a *MyPlantApi) DeletePlan(c *gin.Context) {
|
||||
// @Tags 我的植物
|
||||
// @Summary 添加成长记录
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateGrowthRecord true "添加成长记录"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ func (o *OcrApi) ClassifyPlant(c *gin.Context) {
|
||||
// @tags 识别相关
|
||||
// @Summary 我的植物识别记录
|
||||
// @Security ApiKeyAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页"
|
||||
// @Success 200 {object} response.Response{msg=string} "识别记录"
|
||||
|
||||
@@ -16,7 +16,7 @@ type PostApi struct{}
|
||||
// @Tags 帖子
|
||||
// @Summary 发布帖子
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreatePost true "发布帖子"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"发布成功"}"
|
||||
@@ -43,7 +43,7 @@ func (a *PostApi) PublishPost(c *gin.Context) {
|
||||
// @Tags 帖子
|
||||
// @Summary 帖子列表
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.PostPage true "分页获取帖子列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
@@ -74,7 +74,7 @@ func (a *PostApi) PostPage(c *gin.Context) {
|
||||
// @Tags 帖子
|
||||
// @Summary 我的发布
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.PostPage true "分页获取帖子列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
@@ -127,7 +127,7 @@ func (a *PostApi) LikePost(c *gin.Context) {
|
||||
// @Tags 帖子
|
||||
// @Summary 评论帖子
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateComment true "评论帖子"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"评论成功"}"
|
||||
|
||||
@@ -16,7 +16,7 @@ type TopicApi struct{}
|
||||
// @Tags 帖子话题
|
||||
// @Summary 发布话题
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateTopic true "发布话题"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"发布成功"}"
|
||||
@@ -40,7 +40,7 @@ func (a *TopicApi) AddTopic(c *gin.Context) {
|
||||
// @Tags 帖子话题
|
||||
// @Summary 修改话题
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.UpdateTopic true "修改话题"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"发布成功"}"
|
||||
@@ -64,14 +64,15 @@ func (a *TopicApi) UpdateTopic(c *gin.Context) {
|
||||
// @Tags 帖子话题
|
||||
// @Summary 话题分页
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取话题列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /topic/page [post]
|
||||
func (a *TopicApi) TopicPage(c *gin.Context) {
|
||||
var req request.PageInfo
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ type UserProfileApi struct{}
|
||||
// @Tags 个人中心
|
||||
// @Summary 修改用户信息
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.UpdateProfile true "修改用户信息"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
|
||||
@@ -22,11 +22,12 @@ type WikiApi struct{}
|
||||
// @Router /wiki/add [post]
|
||||
func (a *WikiApi) CreateWiki(c *gin.Context) {
|
||||
var req plantReq.CreateWiki
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
err := c.ShouldBind(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
err := wikiService.CreateWiki(req)
|
||||
err = wikiService.CreateWiki(req)
|
||||
if err != nil {
|
||||
global.Logger.Error("添加百科失败", zap.Error(err))
|
||||
response.FailWithMsg("添加百科失败", c)
|
||||
@@ -46,11 +47,12 @@ func (a *WikiApi) CreateWiki(c *gin.Context) {
|
||||
// @Router /wiki/update [post]
|
||||
func (a *WikiApi) UpdateWiki(c *gin.Context) {
|
||||
var req plantReq.UpdateWiki
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
err := c.ShouldBind(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
err := wikiService.UpdateWiki(req)
|
||||
err = wikiService.UpdateWiki(req)
|
||||
if err != nil {
|
||||
global.Logger.Error("修改百科失败", zap.Error(err))
|
||||
response.FailWithMsg("修改百科失败", c)
|
||||
@@ -71,7 +73,8 @@ func (a *WikiApi) UpdateWiki(c *gin.Context) {
|
||||
// @Router /wiki/page [post]
|
||||
func (a *WikiApi) WikiPage(c *gin.Context) {
|
||||
var req plantReq.WikiPage
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
err := c.ShouldBind(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -16,18 +16,19 @@ type WikiClassApi struct{}
|
||||
// @Tags 百科分类
|
||||
// @Summary 添加分类
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.CreateWikiClass true "添加分类"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"发布成功"}"
|
||||
// @Router /wiki-class/add [post]
|
||||
func (a *WikiClassApi) AddClass(c *gin.Context) {
|
||||
var req plantReq.CreateWikiClass
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
err := wikiClassService.AddClass(req)
|
||||
err = wikiClassService.AddClass(req)
|
||||
if err != nil {
|
||||
global.Logger.Error("添加百科分类失败", zap.Error(err))
|
||||
response.FailWithMsg("添加百科分类失败", c)
|
||||
@@ -40,18 +41,19 @@ func (a *WikiClassApi) AddClass(c *gin.Context) {
|
||||
// @Tags 百科分类
|
||||
// @Summary 修改分类(可直接传入ossId修改图片)
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body plantReq.UpdateWikiClass true "修改分类"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"发布成功"}"
|
||||
// @Router /wiki-class/update [post]
|
||||
func (a *WikiClassApi) UpdateClass(c *gin.Context) {
|
||||
var req plantReq.UpdateWikiClass
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
err := wikiClassService.UpdateClass(req)
|
||||
err = wikiClassService.UpdateClass(req)
|
||||
if err != nil {
|
||||
global.Logger.Error("修改百科分类失败", zap.Error(err))
|
||||
response.FailWithMsg("修改百科失败", c)
|
||||
@@ -64,14 +66,15 @@ func (a *WikiClassApi) UpdateClass(c *gin.Context) {
|
||||
// @Tags 百科分类
|
||||
// @Summary 分类分页
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "分页获取分类列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /wiki-class/page [post]
|
||||
func (a *WikiClassApi) ClassPage(c *gin.Context) {
|
||||
var req request.PageInfo
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
err := c.ShouldBindQuery(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
@@ -93,7 +96,7 @@ func (a *WikiClassApi) ClassPage(c *gin.Context) {
|
||||
// @Tags 百科分类
|
||||
// @Summary 删除分类
|
||||
// @Security BearerAuth
|
||||
// @accept json
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "删除分类"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
|
||||
Reference in New Issue
Block a user