初始化v1

This commit is contained in:
2025-08-03 00:11:15 +08:00
commit b88c8b8afa
171 changed files with 22353 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
package user
import (
"github.com/gogf/gf/v2/net/ghttp"
"nl-video-api/internal/service"
)
// AttachmentController 用户附件管理控制器
type AttachmentController struct{}
// NewAttachmentController 创建用户附件管理控制器实例
func NewAttachmentController() *AttachmentController {
return &AttachmentController{}
}
// Upload 上传附件
func (c *AttachmentController) Upload(r *ghttp.Request) {
service.NewAttachmentService().UserUpload(r)
}
// GetList 获取用户附件列表
func (c *AttachmentController) GetList(r *ghttp.Request) {
service.NewAttachmentService().UserGetList(r)
}
// GetDetail 获取附件详情
func (c *AttachmentController) GetDetail(r *ghttp.Request) {
service.NewAttachmentService().UserGetDetail(r)
}
// Update 更新附件
func (c *AttachmentController) Update(r *ghttp.Request) {
service.NewAttachmentService().UserUpdate(r)
}
// Delete 删除附件
func (c *AttachmentController) Delete(r *ghttp.Request) {
service.NewAttachmentService().UserDelete(r)
}
// Download 下载附件
func (c *AttachmentController) Download(r *ghttp.Request) {
service.NewAttachmentService().UserDownload(r)
}
// Copy 复制附件
func (c *AttachmentController) Copy(r *ghttp.Request) {
service.NewAttachmentService().UserCopy(r)
}
// Rename 重命名附件
func (c *AttachmentController) Rename(r *ghttp.Request) {
service.NewAttachmentService().UserRename(r)
}
// Search 搜索附件
func (c *AttachmentController) Search(r *ghttp.Request) {
service.NewAttachmentService().UserSearch(r)
}
// GetCategoryList 获取附件分类列表
func (c *AttachmentController) GetCategoryList(r *ghttp.Request) {
service.NewAttachmentService().UserGetCategoryList(r)
}

View File

@@ -0,0 +1,21 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
var Banner = cBanner{}
type cBanner struct{}
// GetList 获取轮播图列表
func (c *cBanner) GetList(r *ghttp.Request) {
service.Banner.UserGetList(r)
}
// GetDetail 获取轮播图详情
func (c *cBanner) GetDetail(r *ghttp.Request) {
service.Banner.UserGetDetail(r)
}

View File

@@ -0,0 +1,42 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// CommentController 评论控制器
type CommentController struct{}
var Comment = &CommentController{}
// Add 添加评论
func (c *CommentController) Add(r *ghttp.Request) {
service.Comment.Add(r)
}
// List 评论列表
func (c *CommentController) List(r *ghttp.Request) {
service.Comment.GetList(r)
}
// Delete 删除评论
func (c *CommentController) Delete(r *ghttp.Request) {
service.Comment.Delete(r)
}
// Like 点赞评论
func (c *CommentController) Like(r *ghttp.Request) {
service.Comment.Like(r)
}
// Unlike 取消点赞
func (c *CommentController) Unlike(r *ghttp.Request) {
service.Comment.Unlike(r)
}
// Report 举报评论
func (c *CommentController) Report(r *ghttp.Request) {
service.Comment.Report(r)
}

View File

@@ -0,0 +1,22 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// ConfigController 系统配置控制器
type ConfigController struct{}
var Config = &ConfigController{}
// GetList 获取配置列表
func (c *ConfigController) GetList(r *ghttp.Request) {
service.Config.GetList(r)
}
// GetByKey 根据键获取配置
func (c *ConfigController) GetByKey(r *ghttp.Request) {
service.Config.GetByKey(r)
}

View File

@@ -0,0 +1,17 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// LogController 日志控制器
type LogController struct{}
var Log = &LogController{}
// GetList 获取日志列表
func (c *LogController) GetList(r *ghttp.Request) {
service.Log.GetList(r)
}

View File

@@ -0,0 +1,37 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// PaymentOrderController 支付订单控制器
type PaymentOrderController struct{}
var PaymentOrder = &PaymentOrderController{}
// Create 创建支付订单
func (c *PaymentOrderController) Create(r *ghttp.Request) {
service.PaymentOrder.Create(r)
}
// GetList 获取支付订单列表
func (c *PaymentOrderController) GetList(r *ghttp.Request) {
service.PaymentOrder.GetList(r)
}
// GetDetail 获取支付订单详情
func (c *PaymentOrderController) GetDetail(r *ghttp.Request) {
service.PaymentOrder.GetDetail(r)
}
// Pay 支付订单
func (c *PaymentOrderController) Pay(r *ghttp.Request) {
service.PaymentOrder.Pay(r)
}
// Cancel 取消订单
func (c *PaymentOrderController) Cancel(r *ghttp.Request) {
service.PaymentOrder.Cancel(r)
}

View File

@@ -0,0 +1,49 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// UserCollectController 用户收藏控制器
type UserCollectController struct{}
var UserCollect = &UserCollectController{}
// Add 添加收藏
func (c *UserCollectController) Add(r *ghttp.Request) {
service.UserCollect.Add(r)
}
// Remove 取消收藏
func (c *UserCollectController) Remove(r *ghttp.Request) {
service.UserCollect.Remove(r)
}
// GetList 获取收藏列表
func (c *UserCollectController) GetList(r *ghttp.Request) {
service.NewUserCollectService().GetList(r)
}
// List 获取收藏列表(别名方法)
func (c *UserCollectController) List(r *ghttp.Request) {
c.GetList(r)
}
// Check 检查收藏状态
func (c *UserCollectController) Check(r *ghttp.Request) {
// TODO: 实现检查收藏状态逻辑
r.Response.WriteJson(map[string]interface{}{
"code": 0,
"message": "检查成功",
"data": map[string]interface{}{
"is_collected": false,
},
})
}
// CheckCollect 检查是否已收藏
func (c *UserCollectController) CheckCollect(r *ghttp.Request) {
service.UserCollect.CheckCollect(r)
}

View File

@@ -0,0 +1,80 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// UserWatchHistoryController 用户观看历史控制器
type UserWatchHistoryController struct{}
var UserWatchHistory = &UserWatchHistoryController{}
// Add 添加观看历史
func (c *UserWatchHistoryController) Add(r *ghttp.Request) {
service.NewUserWatchHistoryService().Add(r)
}
// GetList 获取观看历史列表
func (c *UserWatchHistoryController) GetList(r *ghttp.Request) {
service.NewUserWatchHistoryService().GetList(r)
}
// Delete 删除观看历史
func (c *UserWatchHistoryController) Delete(r *ghttp.Request) {
service.NewUserWatchHistoryService().Delete(r)
}
// Clear 清空观看历史
func (c *UserWatchHistoryController) Clear(r *ghttp.Request) {
// 获取用户ID需要实现GetUserIdFromContext函数
userId := service.GetUserIdFromContext(r.Context())
if userId == 0 {
r.Response.WriteJson(map[string]interface{}{
"code": 401,
"message": "请先登录",
})
return
}
err := service.NewUserWatchHistoryService().Clear(r.Context(), &service.UserWatchHistoryClearReq{
UserId: uint(userId),
})
if err != nil {
r.Response.WriteJson(map[string]interface{}{
"code": 1002,
"message": err.Error(),
})
return
}
r.Response.WriteJson(map[string]interface{}{
"code": 0,
"message": "清空成功",
})
}
// GetProgress 获取观看进度
func (c *UserWatchHistoryController) GetProgress(r *ghttp.Request) {
service.NewUserWatchHistoryService().GetProgress(r)
}
// List 获取观看历史列表(别名方法)
func (c *UserWatchHistoryController) List(r *ghttp.Request) {
c.GetList(r)
}
// Get 获取单个观看历史记录
func (c *UserWatchHistoryController) Get(r *ghttp.Request) {
// TODO: 实现获取单个观看历史记录逻辑
r.Response.WriteJson(map[string]interface{}{
"code": 0,
"message": "获取成功",
"data": map[string]interface{}{
"id": 1,
"movie_id": 1,
"progress": 50,
"watch_time": 3600,
},
})
}

View File

@@ -0,0 +1,27 @@
package user
import (
"nl-video-api/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
// VipLevelController VIP等级控制器
type VipLevelController struct{}
var VipLevel = &VipLevelController{}
// GetList 获取VIP等级列表
func (c *VipLevelController) GetList(r *ghttp.Request) {
service.VipLevel.GetList(r)
}
// GetAll 获取所有VIP等级
func (c *VipLevelController) GetAll(r *ghttp.Request) {
service.VipLevel.GetAll(r)
}
// GetDetail 获取VIP等级详情
func (c *VipLevelController) GetDetail(r *ghttp.Request) {
service.VipLevel.GetDetail(r)
}