feat: 完成API接口隔离设计和定义
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m5s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m0s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署后端服务 / 🧪 测试后端 (push) Failing after 3m15s
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m5s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m0s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署后端服务 / 🧪 测试后端 (push) Failing after 3m15s
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped
🚀 主要功能: - 创建前端公共展示API (/api/v1/public/*) - 创建前端用户认证API (/api/v1/auth/*) - 创建管理后台完整API (/admin/*) - 实现双重认证体系设计 📋 新增文件: - api/desc/frontend/public.api - 前端公共接口定义 - api/desc/frontend/auth.api - 前端认证接口定义 - api/desc/admin.api - 管理后台主入口 - api/desc/admin/auth.api - 管理员认证接口 - api/desc/admin/users.api - 用户管理接口 - api/desc/admin/photos.api - 照片管理接口 - api/desc/admin/categories.api - 分类管理接口 - api/desc/admin/dashboard.api - 仪表板统计接口 🔧 更新文件: - api/desc/common.api - 扩展类型定义支持前端和管理后台 - api/desc/photography.api - 更新为前端主入口 - etc/photographyapi-api.yaml - 修复中间件配置 📚 文档: - docs/API_SEPARATION_DESIGN.md - 接口隔离设计方案 - docs/API_REFACTORING_TASKS.md - 详细任务规划 - docs/COMPLETED_TASKS_ARCHIVE.md - 已完成任务归档 ✨ 特性亮点: - 前端和管理后台权限完全隔离 - 优化的数据结构去除敏感信息 - 完整的CRUD和统计功能 - 支持批量操作和高级筛选 - 详细的仪表板分析功能
This commit is contained in:
@ -50,4 +50,169 @@ type Category {
|
||||
Description string `json:"description"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
// 前端公共展示类型
|
||||
|
||||
// 前端公共照片信息 (去除敏感信息)
|
||||
type PublicPhoto {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
FilePath string `json:"file_path"`
|
||||
ThumbnailPath string `json:"thumbnail_path"`
|
||||
CategoryId int64 `json:"category_id"`
|
||||
CategoryName string `json:"category_name,optional"`
|
||||
Featured bool `json:"featured"`
|
||||
ViewCount int64 `json:"view_count,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
// 前端公共分类信息 (去除敏感信息)
|
||||
type PublicCategory {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CoverImage string `json:"cover_image,optional"`
|
||||
PhotoCount int64 `json:"photo_count,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
// 前端公共分类详情 (包含照片)
|
||||
type PublicCategoryWithPhotos {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CoverImage string `json:"cover_image,optional"`
|
||||
PhotoCount int64 `json:"photo_count"`
|
||||
Photos []PublicPhoto `json:"photos,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
// 前端用户信息 (精简版)
|
||||
type FrontendUser {
|
||||
Id int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
// 管理后台类型
|
||||
|
||||
// 管理员信息
|
||||
type Admin {
|
||||
Id int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar"`
|
||||
Role string `json:"role"` // super_admin, admin
|
||||
Status int `json:"status"` // 1:启用 0:禁用
|
||||
LastLogin int64 `json:"last_login,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
// 管理后台用户信息 (包含更多字段)
|
||||
type AdminUser {
|
||||
Id int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Avatar string `json:"avatar"`
|
||||
Status int `json:"status"` // 1:启用 0:禁用
|
||||
Role string `json:"role"` // user, vip, admin
|
||||
LastLogin int64 `json:"last_login,optional"`
|
||||
LoginCount int64 `json:"login_count,optional"`
|
||||
PhotoCount int64 `json:"photo_count,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
// 管理后台用户详情 (包含统计信息)
|
||||
type AdminUserDetail {
|
||||
AdminUser
|
||||
Stats AdminUserStats `json:"stats"`
|
||||
}
|
||||
|
||||
type AdminUserStats {
|
||||
TotalPhotos int64 `json:"total_photos"`
|
||||
TotalViews int64 `json:"total_views"`
|
||||
TotalLikes int64 `json:"total_likes"`
|
||||
TotalComments int64 `json:"total_comments"`
|
||||
StorageUsed int64 `json:"storage_used"`
|
||||
RecentActivity int64 `json:"recent_activity"`
|
||||
}
|
||||
|
||||
// 管理后台照片信息 (包含更多字段)
|
||||
type AdminPhoto {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
FilePath string `json:"file_path"`
|
||||
ThumbnailPath string `json:"thumbnail_path"`
|
||||
UserId int64 `json:"user_id"`
|
||||
UserName string `json:"user_name,optional"`
|
||||
CategoryId int64 `json:"category_id"`
|
||||
CategoryName string `json:"category_name,optional"`
|
||||
Tags string `json:"tags,optional"`
|
||||
Featured bool `json:"featured"`
|
||||
Status string `json:"status"` // published, draft, deleted
|
||||
FileSize int64 `json:"file_size,optional"`
|
||||
Format string `json:"format,optional"`
|
||||
Width int `json:"width,optional"`
|
||||
Height int `json:"height,optional"`
|
||||
ViewCount int64 `json:"view_count,optional"`
|
||||
LikeCount int64 `json:"like_count,optional"`
|
||||
CommentCount int64 `json:"comment_count,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
// 管理后台照片详情 (包含统计和 EXIF 信息)
|
||||
type AdminPhotoDetail {
|
||||
AdminPhoto
|
||||
ExifData string `json:"exif_data,optional"`
|
||||
Stats AdminPhotoStats `json:"stats"`
|
||||
}
|
||||
|
||||
type AdminPhotoStats {
|
||||
ViewHistory []AdminPhotoViewHistory `json:"view_history,optional"`
|
||||
DownloadCount int64 `json:"download_count,optional"`
|
||||
ShareCount int64 `json:"share_count,optional"`
|
||||
RecentViews int64 `json:"recent_views"` // 最近7天浏览量
|
||||
}
|
||||
|
||||
type AdminPhotoViewHistory {
|
||||
Date string `json:"date"`
|
||||
Views int64 `json:"views"`
|
||||
}
|
||||
|
||||
// 管理后台分类信息 (包含更多字段)
|
||||
type AdminCategory {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
SortOrder int `json:"sort_order"` // 排序权重
|
||||
Status string `json:"status"` // active, inactive
|
||||
CoverImage string `json:"cover_image,optional"`
|
||||
PhotoCount int64 `json:"photo_count,optional"`
|
||||
ViewCount int64 `json:"view_count,optional"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
}
|
||||
|
||||
// 管理后台分类详情 (包含统计信息)
|
||||
type AdminCategoryDetail {
|
||||
AdminCategory
|
||||
Stats AdminCategoryStats `json:"stats"`
|
||||
}
|
||||
|
||||
type AdminCategoryStats {
|
||||
TotalPhotos int64 `json:"total_photos"`
|
||||
PublishedPhotos int64 `json:"published_photos"`
|
||||
DraftPhotos int64 `json:"draft_photos"`
|
||||
FeaturedPhotos int64 `json:"featured_photos"`
|
||||
TotalViews int64 `json:"total_views"`
|
||||
RecentViews int64 `json:"recent_views"` // 最近7天浏览量
|
||||
GrowthRate float64 `json:"growth_rate"` // 增长率
|
||||
}
|
||||
Reference in New Issue
Block a user