feat: 徽章处理
This commit is contained in:
@@ -2,6 +2,7 @@ package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
common "sundynix-go/model/commom/request"
|
||||
"sundynix-go/model/commom/response"
|
||||
plantReq "sundynix-go/model/plant/request"
|
||||
"sundynix-go/utils/auth"
|
||||
@@ -113,6 +114,31 @@ func (a *WikiApi) WikiDetail(c *gin.Context) {
|
||||
response.OkWithData(topic, c)
|
||||
}
|
||||
|
||||
// DeleteWiki 删除百科
|
||||
// @Tags 百科
|
||||
// @Summary 删除百科
|
||||
// @Security BearerAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body common.IdsReq true "删除百科"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /wiki/delete [post]
|
||||
func (a *WikiApi) DeleteWiki(c *gin.Context) {
|
||||
var req common.IdsReq
|
||||
err := c.ShouldBindJSON(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
err = wikiService.DeleteWiki(req)
|
||||
if err != nil {
|
||||
global.Logger.Error("删除失败", zap.Error(err))
|
||||
response.FailWithMsg("删除失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("删除成功", c)
|
||||
}
|
||||
|
||||
// StarWiki 收藏百科
|
||||
// @Tags 百科
|
||||
// @Summary 收藏百科
|
||||
@@ -134,3 +160,28 @@ func (a *WikiApi) StarWiki(c *gin.Context) {
|
||||
}
|
||||
response.OkWithMsg("操作成功", c)
|
||||
}
|
||||
|
||||
// UploadImg 上传图片
|
||||
// @Tags 百科
|
||||
// @Summary 上传图片
|
||||
// @Security BearerAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body common.UploadOss true "上传图片"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Router /wiki/uploadImg [post]
|
||||
func (a *WikiApi) UploadImg(c *gin.Context) {
|
||||
var req common.UploadOss
|
||||
err := c.ShouldBind(&req)
|
||||
if err != nil {
|
||||
response.FailWithMsg("请求参数错误", c)
|
||||
return
|
||||
}
|
||||
err = wikiService.UploadImg(req)
|
||||
if err != nil {
|
||||
global.Logger.Error("上传失败", zap.Error(err))
|
||||
response.FailWithMsg("上传失败", c)
|
||||
return
|
||||
}
|
||||
response.OkWithMsg("上传成功", c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user