init: radio init commit

This commit is contained in:
Blizzard
2026-02-28 15:56:26 +08:00
parent fc585fa4df
commit d79beb4663
63 changed files with 2540 additions and 6399 deletions
+2
View File
@@ -1,6 +1,7 @@
package v1
import (
"sundynix-go/api/v1/radio"
"sundynix-go/api/v1/system"
)
@@ -9,4 +10,5 @@ var ApiGroupApp = new(ApiGroup)
// ApiGroup 路由组
type ApiGroup struct {
SystemApiGroup system.ApiGroup
RadioApiGroup radio.ApiGroup
}
+159
View File
@@ -0,0 +1,159 @@
package radio
import (
"sundynix-go/global"
common "sundynix-go/model/commom/request"
"sundynix-go/model/commom/response"
"sundynix-go/model/radio/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type CategoryApi struct{}
// GetCategoryPage 获取分类列表
// @Tags 分类管理
// @Summary 获取分类列表
// @Accept application/json
// @Produce application/json
// @Param data body request.GetCategoryList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/category/page [post]
func (a *CategoryApi) GetCategoryPage(c *gin.Context) {
var req request.GetCategoryList
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := categoryService.GetCategoryList(req)
if err != nil {
global.Logger.Error("获取分类列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
PageSize: req.PageSize,
}, c)
}
// GetCategoryList 获取分类列表
// @Tags 分类管理
// @Summary 获取分类列表
// @Produce application/json
// @Success 200 {object} response.Response
// @Router /radio/category/list [get]
func (a *CategoryApi) GetCategoryList(c *gin.Context) {
list, err := categoryService.GetAllCategory()
if err != nil {
global.Logger.Error("获取分类列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.ListResult{
List: list,
}, c)
}
// GetCategoryDetail 获取分类详情
// @Tags 分类管理
// @Summary 获取分类详情
// @Produce application/json
// @Param id query string true "分类ID"
// @Success 200 {object} response.Response
// @Router /radio/category/detail [get]
func (a *CategoryApi) GetCategoryDetail(c *gin.Context) {
id := c.Query("id")
if id == "" {
response.FailWithMsg("参数错误: id不能为空", c)
return
}
category, err := categoryService.GetCategoryById(id)
if err != nil {
global.Logger.Error("获取分类详情失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(category, c)
}
// SaveCategory 保存分类
// @Tags 分类管理
// @Summary 保存分类
// @Accept application/json
// @Produce application/json
// @Param data body request.SaveCategory true "分类信息"
// @Success 200 {object} response.Response
// @Router /radio/category/save [post]
func (a *CategoryApi) SaveCategory(c *gin.Context) {
var req request.SaveCategory
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := categoryService.SaveCategory(req); err != nil {
global.Logger.Error("保存分类失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("保存成功", c)
}
// UpdateCategory 更新分类
// @Tags 分类管理
// @Summary 更新分类
// @Accept application/json
// @Produce application/json
// @Param data body request.UpdateCategory true "Success 200 {分类信息"
// @object} response.Response
// @Router /radio/category/update [post]
func (a *CategoryApi) UpdateCategory(c *gin.Context) {
var req request.UpdateCategory
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := categoryService.UpdateCategory(req); err != nil {
global.Logger.Error("更新分类失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("更新成功", c)
}
// DeleteCategory 删除分类
// @Tags 分类管理
// @Summary 删除分类
// @Produce application/json
// @Param data body common.GetById true "分类ID"
// @Success 200 {object} response.Response
// @Router /radio/category/delete [post]
func (a *CategoryApi) DeleteCategory(c *gin.Context) {
var req common.IdReq
err := c.ShouldBindJSON(&req)
if err != nil || req.Id == "" {
response.FailWithMsg("参数错误: id不能为空", c)
return
}
if err := categoryService.DeleteCategory(req.Id); err != nil {
global.Logger.Error("删除分类失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("删除成功", c)
}
+146
View File
@@ -0,0 +1,146 @@
package radio
import (
"sundynix-go/global"
common "sundynix-go/model/commom/request"
"sundynix-go/model/commom/response"
"sundynix-go/model/radio/request"
"sundynix-go/utils/auth"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type ChannelApi struct{}
// GetChannelList 获取频道列表
// @Tags 频道管理
// @Summary 获取频道列表
// @Accept application/json
// @Produce application/json
// @Param data body request.GetChannelList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/channel/list [post]
func (a *ChannelApi) GetChannelList(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.GetChannelList
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := channelService.GetChannelList(userId, req)
if err != nil {
global.Logger.Error("获取频道列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
PageSize: req.PageSize,
}, c)
}
// GetChannelDetail 获取频道详情
// @Tags 频道管理
// @Summary 获取频道详情
// @Accept application/json
// @Produce application/json
// @Param id query string true "频道ID"
// @Success 200 {object} response.Response
// @Router /radio/channel/detail [get]
func (a *ChannelApi) GetChannelDetail(c *gin.Context) {
userId := auth.GetUserId(c)
id := c.Query("id")
if id == "" {
response.FailWithMsg("参数错误: id不能为空", c)
return
}
channel, err := channelService.GetChannelById(userId, id)
if err != nil {
global.Logger.Error("获取频道详情失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(channel, c)
}
// SaveChannel 保存频道
// @Tags 频道管理
// @Summary 保存频道
// @Accept application/json
// @Produce application/json
// @Param data body request.SaveChannel true "频道信息"
// @Success 200 {object} response.Response
// @Router /radio/channel/save [post]
func (a *ChannelApi) SaveChannel(c *gin.Context) {
var req request.SaveChannel
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := channelService.SaveChannel(req); err != nil {
global.Logger.Error("保存频道失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("保存成功", c)
}
// UpdateChannel 更新频道
// @Tags 频道管理
// @Summary 更新频道
// @Accept application/json
// @Produce application/json
// @Param data body request.UpdateChannel true "频道信息"
// @Success 200 {object} response.Response
// @Router /radio/channel/update [post]
func (a *ChannelApi) UpdateChannel(c *gin.Context) {
var req request.UpdateChannel
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := channelService.UpdateChannel(req); err != nil {
global.Logger.Error("更新频道失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("更新成功", c)
}
// DeleteChannel 删除频道
// @Tags 频道管理
// @Summary 删除频道
// @Produce json
// @Param data body common.GetById true "频道ID"
// @Success 200 {object} response.Response
// @Router /radio/channel/delete [post]
func (a *ChannelApi) DeleteChannel(c *gin.Context) {
var req common.IdReq
err := c.ShouldBindJSON(&req)
if err != nil || req.Id == "" {
response.FailWithMsg("参数错误: id不能为空", c)
return
}
if err := channelService.DeleteChannel(req.Id); err != nil {
global.Logger.Error("删除频道失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("删除成功", c)
}
+21
View File
@@ -0,0 +1,21 @@
package radio
import "sundynix-go/service"
type ApiGroup struct {
CategoryApi
ChannelApi
ProgramApi
SubscriptionApi
InteractionApi
}
var ApiGroupApp = new(ApiGroup)
var (
categoryService = service.GroupApp.RadioServiceGroup.CategoryService
channelService = service.GroupApp.RadioServiceGroup.ChannelService
programService = service.GroupApp.RadioServiceGroup.ProgramService
subscriptionService = service.GroupApp.RadioServiceGroup.SubscriptionService
interactionService = service.GroupApp.RadioServiceGroup.InteractionService
)
+253
View File
@@ -0,0 +1,253 @@
package radio
import (
"sundynix-go/global"
"sundynix-go/model/commom/response"
"sundynix-go/model/radio/request"
"sundynix-go/utils/auth"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type InteractionApi struct{}
// AddHistory 添加收听历史
// @Tags 用户互动
// @Summary 添加收听历史
// @Produce json
// @Param data body request.AddHistory true "收听信息"
// @Success 200 {object} response.Response
// @Router /radio/history/add [post]
func (a *InteractionApi) AddHistory(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.AddHistory
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := interactionService.AddHistory(userId, req); err != nil {
global.Logger.Error("添加收听历史失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("添加成功", c)
}
// GetHistoryList 获取收听历史列表
// @Tags 用户互动
// @Summary 获取收听历史列表
// @Produce json
// @Param data body request.GetHistoryList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/history/list [post]
func (a *InteractionApi) GetHistoryList(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.GetHistoryList
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := interactionService.GetHistoryList(userId, req)
if err != nil {
global.Logger.Error("获取收听历史失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
}, c)
}
// ToggleLike 切换点赞状态
// @Tags 用户互动
// @Summary 切换点赞状态
// @Produce json
// @Param data body request.ToggleLike true "节目ID"
// @Success 200 {object} response.Response
// @Router /radio/like/toggle [post]
func (a *InteractionApi) ToggleLike(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.ToggleLike
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
isLiked, err := interactionService.ToggleLike(userId, req.ProgramId)
if err != nil {
global.Logger.Error("操作失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(isLiked, c)
}
// GetFavoriteList 获取收藏列表
// @Tags 用户互动
// @Summary 获取收藏列表
// @Produce json
// @Param data body request.GetFavoriteList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/favorite/list [post]
func (a *InteractionApi) GetFavoriteList(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.GetFavoriteList
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := interactionService.GetFavoriteList(userId, req)
if err != nil {
global.Logger.Error("获取收藏列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
}, c)
}
// AddFavorite 添加收藏
// @Tags 用户互动
// @Summary 添加收藏
// @Produce json
// @Param data body request.AddFavorite true "节目ID"
// @Success 200 {object} response.Response
// @Router /radio/favorite/add [post]
func (a *InteractionApi) AddFavorite(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.AddFavorite
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := interactionService.AddFavorite(userId, req.ProgramId); err != nil {
global.Logger.Error("添加收藏失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("收藏成功", c)
}
// RemoveFavorite 取消收藏
// @Tags 用户互动
// @Summary 取消收藏
// @Produce json
// @Param data body request.RemoveFavorite true "节目ID"
// @Success 200 {object} response.Response
// @Router /radio/favorite/remove [post]
func (a *InteractionApi) RemoveFavorite(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.RemoveFavorite
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := interactionService.RemoveFavorite(userId, req.ProgramId); err != nil {
global.Logger.Error("取消收藏失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("取消收藏成功", c)
}
// GetCommentList 获取评论列表
// @Tags 用户互动
// @Summary 获取评论列表
// @Produce json
// @Param data body request.GetCommentList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/comment/list [post]
func (a *InteractionApi) GetCommentList(c *gin.Context) {
var req request.GetCommentList
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := interactionService.GetCommentList(req.ProgramId, req)
if err != nil {
global.Logger.Error("获取评论列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
}, c)
}
// AddComment 添加评论
// @Tags 用户互动
// @Summary 添加评论
// @Produce json
// @Param data body request.AddComment true "评论信息"
// @Success 200 {object} response.Response
// @Router /radio/comment/add [post]
func (a *InteractionApi) AddComment(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.AddComment
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := interactionService.AddComment(userId, req); err != nil {
global.Logger.Error("添加评论失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("评论成功", c)
}
// DeleteComment 删除评论
// @Tags 用户互动
// @Summary 删除评论
// @Produce json
// @Param data body request.DeleteComment true "评论ID"
// @Success 200 {object} response.Response
// @Router /radio/comment/delete [post]
func (a *InteractionApi) DeleteComment(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.DeleteComment
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := interactionService.DeleteComment(userId, req.CommentId); err != nil {
global.Logger.Error("删除评论失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("删除成功", c)
}
+140
View File
@@ -0,0 +1,140 @@
package radio
import (
"sundynix-go/global"
common "sundynix-go/model/commom/request"
"sundynix-go/model/commom/response"
"sundynix-go/model/radio/request"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type ProgramApi struct{}
// GetProgramList 获取节目列表
// @Tags 节目管理
// @Summary 获取节目列表
// @Produce application/json
// @Param data body request.GetProgramList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/program/list [post]
func (a *ProgramApi) GetProgramList(c *gin.Context) {
var req request.GetProgramList
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := programService.GetProgramList(req)
if err != nil {
global.Logger.Error("获取节目列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
PageSize: req.PageSize,
}, c)
}
// GetProgramDetail 获取节目详情
// @Tags 节目管理
// @Summary 获取节目详情
// @Produce application/json
// @Param id query string true "节目ID"
// @Success 200 {object} response.Response
// @Router /radio/program/detail [get]
func (a *ProgramApi) GetProgramDetail(c *gin.Context) {
id := c.Query("id")
if id == "" {
response.FailWithMsg("参数错误: id不能为空", c)
return
}
program, err := programService.GetProgramById(id)
if err != nil {
global.Logger.Error("获取节目详情失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(program, c)
}
// SaveProgram 保存节目
// @Tags 节目管理
// @Summary 保存节目
// @Accept application/json
// @Produce application/json
// @Param data body request.SaveProgram true "节目信息"
// @Success 200 {object} response.Response
// @Router /radio/program/save [post]
func (a *ProgramApi) SaveProgram(c *gin.Context) {
var req request.SaveProgram
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := programService.SaveProgram(req); err != nil {
global.Logger.Error("保存节目失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("保存成功", c)
}
// UpdateProgram 更新节目
// @Tags 节目管理
// @Summary 更新节目
// @Accept application/json
// @Produce application/json
// @Param data body request.UpdateProgram true "节目信息"
// @Success 200 {object} response.Response
// @Router /radio/program/update [post]
func (a *ProgramApi) UpdateProgram(c *gin.Context) {
var req request.UpdateProgram
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := programService.UpdateProgram(req); err != nil {
global.Logger.Error("更新节目失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("更新成功", c)
}
// DeleteProgram 删除节目
// @Tags 节目管理
// @Summary 删除节目
// @Produce json
// @Param data body common.GetById true "节目ID"
// @Success 200 {object} response.Response
// @Router /radio/program/delete [post]
func (a *ProgramApi) DeleteProgram(c *gin.Context) {
var req common.IdsReq
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: id不能为空", c)
return
}
if err := programService.DeleteProgram(req.Ids); err != nil {
global.Logger.Error("删除节目失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("删除成功", c)
}
+134
View File
@@ -0,0 +1,134 @@
package radio
import (
"sundynix-go/global"
common "sundynix-go/model/commom/request"
"sundynix-go/model/commom/response"
"sundynix-go/model/radio/request"
"sundynix-go/utils/auth"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
type SubscriptionApi struct{}
// GetSubscriptionList 获取订阅列表
// @Tags 订阅管理
// @Summary 获取我的订阅列表
// @Accept application/json
// @Produce application/json
// @Param data body request.GetSubscriptionList true "分页查询"
// @Success 200 {object} response.Response
// @Router /radio/subscription/list [post]
func (a *SubscriptionApi) GetSubscriptionList(c *gin.Context) {
userId := auth.GetUserId(c)
var req common.PageInfo
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
list, total, err := subscriptionService.GetUserSubscription(userId, req)
if err != nil {
global.Logger.Error("获取订阅列表失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(response.PageResult{
List: list,
Total: total,
Page: req.Current,
}, c)
}
// CanSubscribe 检查是否可以订阅
// @Tags 订阅管理
// @Summary 检查是否可以订阅
// @Produce application/json
// @Param data body request.SubscribeChannel true "频道ID"
// @Success 200 {object} response.Response
// @Router /radio/subscription/can-subscribe [post]
func (a *SubscriptionApi) CanSubscribe(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.SubscribeChannel
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
can, _, err := subscriptionService.CanSubscribe(userId, req.ChannelId)
if err != nil {
global.Logger.Error("检查订阅权限失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithData(can, c)
}
// Subscribe 订阅频道
// @Tags 订阅管理
// @Summary 订阅频道
// @Produce application/json
// @Param data body request.SubscribeChannel true "频道ID"
// @Success 200 {object} response.Response
// @Router /radio/subscription/subscribe [post]
func (a *SubscriptionApi) Subscribe(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.SubscribeChannel
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
can, reason, err := subscriptionService.CanSubscribe(userId, req.ChannelId)
if err != nil {
global.Logger.Error("订阅失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
if !can {
response.FailWithMsg(reason, c)
return
}
// 订阅类型 1:免费
if err := subscriptionService.Subscribe(userId, req.ChannelId, 1); err != nil {
global.Logger.Error("订阅失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("订阅成功", c)
}
// Unsubscribe 退订频道
// @Tags 订阅管理
// @Summary 退订频道
// @Produce application/json
// @Param data body request.UnsubscribeChannel true "频道ID"
// @Success 200 {object} response.Response
// @Router /radio/subscription/unsubscribe [post]
func (a *SubscriptionApi) Unsubscribe(c *gin.Context) {
userId := auth.GetUserId(c)
var req request.UnsubscribeChannel
err := c.ShouldBindJSON(&req)
if err != nil {
response.FailWithMsg("参数错误: "+err.Error(), c)
return
}
if err := subscriptionService.Unsubscribe(userId, req.ChannelId); err != nil {
global.Logger.Error("退订失败!", zap.Error(err))
response.FailWithMsg(err.Error(), c)
return
}
response.OkWithMsg("退订成功", c)
}
+5 -5
View File
@@ -17,7 +17,7 @@ type ClientApi struct {
// SaveClient
// @Tags 客户端管理
// @Summary 创建client
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body system.Client true "client"
@@ -42,7 +42,7 @@ func (s *ClientApi) SaveClient(c *gin.Context) {
// UpdateClient
// @Tags 客户端管理
// @Summary 更新client
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body system.Client true "client"
@@ -67,7 +67,7 @@ func (s *ClientApi) UpdateClient(c *gin.Context) {
// GetClientList
// @Tags 客户端管理
// @Summary 获取client列表
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.GetClientList true "client"
@@ -97,7 +97,7 @@ func (s *ClientApi) GetClientList(c *gin.Context) {
// Delete
// @Tags 客户端管理
// @Summary 删除client
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "ids"
@@ -123,7 +123,7 @@ func (s *ClientApi) Delete(c *gin.Context) {
// @Tags 客户端管理
// @Summary 获取client详情
// @Description id获取详情
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce application/json
// @Param id query string true "id"
// @Success 200 {object} response.Response{data=system.Client,msg=string} "获取client详情"
+7 -7
View File
@@ -17,7 +17,7 @@ type MenuApi struct {
// SaveMenu
// @Tags 菜单管理
// @Summary 新增菜单
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body system.Menu false "menu"
@@ -42,7 +42,7 @@ func (m *MenuApi) SaveMenu(c *gin.Context) {
// UpdateMenu
// @Tags 菜单管理
// @Summary 更新菜单
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body system.Menu false "menu"
@@ -68,7 +68,7 @@ func (m *MenuApi) UpdateMenu(c *gin.Context) {
// @Tags 菜单管理
// @Summary 删除menu
// @Description 删除menu
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce application/json
// @Param id query string true "id"
// @Success 200 {object} response.Response{msg=string} "详情"
@@ -88,7 +88,7 @@ func (m *MenuApi) DeleteMenu(c *gin.Context) {
// @Tags 菜单管理
// @Summary 获取menu详情
// @Description id获取详情
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce application/json
// @Param id query string true "id"
// @Success 200 {object} response.Response{data=system.Menu,msg=string} "详情"
@@ -107,7 +107,7 @@ func (m *MenuApi) Detail(c *gin.Context) {
// GetAllMenuTree
// @Tags 菜单管理
// @Summary 获取所有菜单树
// @Security ApiKeyAuth
// @Security BasicAuth
// @Accept json
// @Produce json
// @Param data body systemReq.GetMenuTree true "菜单信息"
@@ -132,7 +132,7 @@ func (m *MenuApi) GetAllMenuTree(c *gin.Context) {
// GetUserMenuTree
// @Tags 菜单管理
// @Summary 用户菜单数据
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce json
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户菜单数据"
// @Router /menu/getUserMenuTree [get]
@@ -150,7 +150,7 @@ func (m *MenuApi) GetUserMenuTree(c *gin.Context) {
// Route
// @Tags 菜单管理
// @Summary 用户路由
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce json
// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户route"
// @Router /menu/route [get]
+4 -4
View File
@@ -17,7 +17,7 @@ type RoleApi struct {
// SaveRole
// @tags 角色管理
// @Summary 创建角色
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept json
// @Produce json
// @Param data body system.Role true "角色信息"
@@ -42,7 +42,7 @@ func (a *RoleApi) SaveRole(context *gin.Context) {
// UpdateRole
// @tags 角色管理
// @Summary 修改角色
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body system.Role true "角色ID"
@@ -121,7 +121,7 @@ func (a *RoleApi) Delete(context *gin.Context) {
// Detail
// @Tags 角色管理
// @Summary 角色详情
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce application/json
// @Param id query string true "id"
// @Success 200 {object} response.Response{data=system.Role} "角色详情"
@@ -140,7 +140,7 @@ func (a *RoleApi) Detail(context *gin.Context) {
// GrantMenu
// @tags 角色管理
// @Summary 授权菜单给角色
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body systemreq.GrantMenu true "授权菜单给角色"
+8 -8
View File
@@ -18,7 +18,7 @@ type UserApi struct {
// CurrentUser
// @tags 用户管理
// @Summary 当前登录用户
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce json
// @Success 200 {object} response.Response "{"code": 200, "data": {}, "msg": "添加成功"}"
// @Router /user/info [get]
@@ -36,7 +36,7 @@ func (u *UserApi) CurrentUser(c *gin.Context) {
// SaveUser
// @tags 用户管理
// @Summary 新增用户
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept json
// @Produce json
// @Param data body system.User true "用户信息"
@@ -60,7 +60,7 @@ func (u *UserApi) SaveUser(c *gin.Context) {
// UpdateUser
// @tags 用户管理
// @Summary 更新用户
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body system.User true "用户ID,用户信息"
@@ -84,7 +84,7 @@ func (u *UserApi) UpdateUser(c *gin.Context) {
// GetUserList
// @tags 用户管理
// @Summary 获取用户列表
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.GetUserList true "页码, 每页大小, 搜索条件"
@@ -114,7 +114,7 @@ func (u *UserApi) GetUserList(c *gin.Context) {
// Delete
// @Tags 用户管理
// @Summary 删除用户
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除用户"
@@ -139,7 +139,7 @@ func (u *UserApi) Delete(c *gin.Context) {
// Detail
// @Tags 用户管理
// @Summary 获取用户详情
// @Security ApiKeyAuth
// @Security BasicAuth
// @Produce application/json
// @Param id query string true "id"
// @Success 200 {object} response.Response{data=system.User} "获取用户详情成功"
@@ -158,7 +158,7 @@ func (u *UserApi) Detail(c *gin.Context) {
// ChangePassword
// @Tags 用户管理
// @Summary 修改密码
// @Security ApiKeyAuth
// @Security BasicAuth
// @Description 修改密码
// @accept json
// @Produce application/json
@@ -184,7 +184,7 @@ func (u *UserApi) ChangePassword(c *gin.Context) {
// GrantRole
// @Tags 用户管理
// @Summary 给用户分配角色
// @Security ApiKeyAuth
// @Security BasicAuth
// @accept application/json
// @Produce application/json
// @Param data body systemReq.GrantRole true "用户ID, 角色ID"