代码拉取完成,页面将自动刷新
同步操作将从 pixel/gin-vue-admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package hierarchy
import (
"gitee.com/g-qs/gin-vue-admin/server/global"
"gitee.com/g-qs/gin-vue-admin/server/model/common/response"
"gitee.com/g-qs/gin-vue-admin/server/service"
"gitee.com/g-qs/gin-vue-admin/server/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type FdArticleApi struct {
}
var fdArticleService = service.ServiceGroupApp.HierarchyServiceGroup.FdArticleService
// GetArticle 获取文章
// @Tags FdArticleAudio
// @Summary 创建FdArticleAudio
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body hierarchy.FdArticleAudio true "创建FdArticleAudio"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /fdArticle/getArticle [get]
func (fdArticleApi *FdArticleApi) GetArticle(c *gin.Context) {
level := c.Query("level")
id := c.Query("id")
userID := utils.GetUserID(c)
if articleList, err := fdArticleService.GetArticle(level, id, userID); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithData(articleList, c)
}
}
// GetHotArticle 搜索文章&获取热门搜索文章列表
// @Tags FdArticleAudio
// @Summary 搜索文章&获取热门搜索文章列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body hierarchy.FdArticleAudio true "创建FdArticleAudio"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /fdArticle/getHotArticle [get]
func (fdArticleApi *FdArticleApi) GetHotArticle(c *gin.Context) {
title := c.Query("title")
userID := utils.GetUserID(c)
if articleList, err := fdArticleService.GetHotArticle(userID, title); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithData(articleList, c)
}
}
// GetMyCollect 获取我的收藏文章
// @Tags FdArticleAudio
// @Summary 搜索文章&获取热门搜索文章列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body hierarchy.FdArticleAudio true "创建FdArticleAudio"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /fdArticle/getMyCollect [get]
func (fdArticleApi *FdArticleApi) GetMyCollect(c *gin.Context) {
userID := utils.GetUserID(c)
if articleList, err := fdArticleService.GetMyCollect(userID); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
} else {
response.OkWithData(articleList, c)
}
}
// ForwardArticle 转发文章
// @Tags FdArticleAudio
// @Summary 转发文章
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body hierarchy.FdArticleAudio true "创建FdArticleAudio"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /fdArticle/forwardArticle [put]
func (fdArticleApi *FdArticleApi) ForwardArticle(c *gin.Context) {
types := c.Query("types")
id := c.Query("id")
if err := fdArticleService.ForwardArticle(types, id); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("转发失败", c)
} else {
response.Result(200, "", "转发成功", c)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。