第一版完成
This commit is contained in:
0
internal/model/.gitkeep
Normal file
0
internal/model/.gitkeep
Normal file
77
internal/model/admin.go
Normal file
77
internal/model/admin.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Admin 管理员实体
|
||||
type Admin struct {
|
||||
Id uint64 `json:"id" orm:"id,primary"`
|
||||
Username string `json:"username" orm:"username"`
|
||||
Password string `json:"-" orm:"password"`
|
||||
RealName string `json:"real_name" orm:"real_name"`
|
||||
Email string `json:"email" orm:"email"`
|
||||
Phone string `json:"phone" orm:"phone"`
|
||||
Avatar string `json:"avatar" orm:"avatar"`
|
||||
RoleId uint64 `json:"role_id" orm:"role_id"`
|
||||
Status uint8 `json:"status" orm:"status"`
|
||||
LastLoginAt *time.Time `json:"last_login_at" orm:"last_login_at"`
|
||||
LastLoginIp string `json:"last_login_ip" orm:"last_login_ip"`
|
||||
CreatedAt *time.Time `json:"created_at" orm:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at" orm:"updated_at"`
|
||||
DeletedAt uint64 `json:"deleted_at" orm:"deleted_at"`
|
||||
}
|
||||
|
||||
// LoginRequest 登录请求
|
||||
type LoginRequest struct {
|
||||
Username string `json:"username" v:"required|length:3,30#用户名不能为空|用户名长度为3到30位"`
|
||||
Password string `json:"password" v:"required|length:6,30#密码不能为空|密码长度为6到30位"`
|
||||
}
|
||||
|
||||
// LoginResponse 登录响应
|
||||
type LoginResponse struct {
|
||||
Token string `json:"token"`
|
||||
Admin *Admin `json:"admin"`
|
||||
}
|
||||
|
||||
// AdminListRequest 管理员列表请求
|
||||
type AdminListRequest struct {
|
||||
Page int `json:"page" v:"min:1#页码不能小于1"`
|
||||
PageSize int `json:"page_size" v:"min:1|max:100#每页数量不能小于1且不能大于100"`
|
||||
Username string `json:"username"`
|
||||
RealName string `json:"real_name"`
|
||||
Status *int `json:"status"`
|
||||
}
|
||||
|
||||
// CreateAdminRequest 创建管理员请求
|
||||
type CreateAdminRequest struct {
|
||||
Username string `json:"username" v:"required|length:3,30#用户名不能为空|用户名长度为3到30位"`
|
||||
Password string `json:"password" v:"required|length:6,30#密码不能为空|密码长度为6到30位"`
|
||||
RealName string `json:"real_name" v:"required|length:2,20#真实姓名不能为空|真实姓名长度为2到20位"`
|
||||
Email string `json:"email" v:"email#邮箱格式不正确"`
|
||||
Phone string `json:"phone" v:"phone#手机号格式不正确"`
|
||||
RoleId uint64 `json:"role_id" v:"required|min:1#角色ID不能为空"`
|
||||
Status uint8 `json:"status" v:"in:0,1#状态值只能为0或1"`
|
||||
}
|
||||
|
||||
// UpdateAdminRequest 更新管理员请求
|
||||
type UpdateAdminRequest struct {
|
||||
RealName string `json:"real_name" v:"required|length:2,20#真实姓名不能为空|真实姓名长度为2到20位"`
|
||||
Email string `json:"email" v:"email#邮箱格式不正确"`
|
||||
Phone string `json:"phone" v:"phone#手机号格式不正确"`
|
||||
RoleId uint64 `json:"role_id" v:"required|min:1#角色ID不能为空"`
|
||||
Status uint8 `json:"status" v:"in:0,1#状态值只能为0或1"`
|
||||
}
|
||||
|
||||
// AdminLoginRequest 管理员登录请求
|
||||
type AdminLoginRequest struct {
|
||||
Username string `json:"username" v:"required|length:3,30#用户名不能为空|用户名长度为3到30位"`
|
||||
Password string `json:"password" v:"required|length:6,30#密码不能为空|密码长度为6到30位"`
|
||||
}
|
||||
|
||||
// AdminLoginResponse 管理员登录响应
|
||||
type AdminLoginResponse struct {
|
||||
Token string `json:"token"`
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
Admin *Admin `json:"admin"`
|
||||
}
|
||||
67
internal/model/article.go
Normal file
67
internal/model/article.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Article 文章模型
|
||||
type Article struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Title string `json:"title" dc:"标题"`
|
||||
Slug string `json:"slug" dc:"URL别名"`
|
||||
Summary string `json:"summary" dc:"摘要"`
|
||||
Content string `json:"content" dc:"内容(Markdown)"`
|
||||
HtmlContent string `json:"html_content" dc:"HTML内容"`
|
||||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||||
CategoryId int `json:"category_id" dc:"分类ID"`
|
||||
Tags interface{} `json:"tags" dc:"标签"`
|
||||
AuthorId int `json:"author_id" dc:"作者ID"`
|
||||
ViewCount int `json:"view_count" dc:"浏览次数"`
|
||||
LikeCount int `json:"like_count" dc:"点赞次数"`
|
||||
CommentCount int `json:"comment_count" dc:"评论次数"`
|
||||
IsPublished int `json:"is_published" dc:"是否发布 0:草稿 1:已发布"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐 0:否 1:是"`
|
||||
IsTop int `json:"is_top" dc:"是否置顶 0:否 1:是"`
|
||||
SeoTitle string `json:"seo_title" dc:"SEO标题"`
|
||||
SeoDescription string `json:"seo_description" dc:"SEO描述"`
|
||||
SeoKeywords string `json:"seo_keywords" dc:"SEO关键词"`
|
||||
PublishedAt *gtime.Time `json:"published_at" dc:"发布时间"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// CreateArticleRequest 创建文章请求
|
||||
type CreateArticleRequest struct {
|
||||
Title string `json:"title" v:"required|length:1,255#标题不能为空|标题长度不能超过255字符" dc:"标题"`
|
||||
Slug string `json:"slug" v:"length:0,255#URL别名长度不能超过255字符" dc:"URL别名"`
|
||||
Summary string `json:"summary" dc:"摘要"`
|
||||
Content string `json:"content" v:"required#内容不能为空" dc:"内容(Markdown)"`
|
||||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||||
CategoryId int `json:"category_id" dc:"分类ID"`
|
||||
Tags []string `json:"tags" dc:"标签"`
|
||||
AuthorId int `json:"author_id" dc:"作者ID"`
|
||||
IsPublished int `json:"is_published" dc:"是否发布"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||||
IsTop int `json:"is_top" dc:"是否置顶"`
|
||||
SeoTitle string `json:"seo_title" dc:"SEO标题"`
|
||||
SeoDescription string `json:"seo_description" dc:"SEO描述"`
|
||||
SeoKeywords string `json:"seo_keywords" dc:"SEO关键词"`
|
||||
}
|
||||
|
||||
// UpdateArticleRequest 更新文章请求
|
||||
type UpdateArticleRequest struct {
|
||||
Title string `json:"title" v:"required|length:1,255#标题不能为空|标题长度不能超过255字符" dc:"标题"`
|
||||
Slug string `json:"slug" v:"required|length:1,255#URL别名不能为空|URL别名长度不能超过255字符" dc:"URL别名"`
|
||||
Summary string `json:"summary" v:"required#摘要不能为空" dc:"摘要"`
|
||||
Content string `json:"content" v:"required#内容不能为空" dc:"内容"`
|
||||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||||
CategoryId int `json:"category_id" dc:"分类ID"`
|
||||
Tags []string `json:"tags" dc:"标签"`
|
||||
IsPublished int `json:"is_published" v:"in:0,1#发布状态只能为0或1" dc:"是否发布"`
|
||||
IsFeatured int `json:"is_featured" v:"in:0,1#推荐状态只能为0或1" dc:"是否推荐"`
|
||||
IsTop int `json:"is_top" v:"in:0,1#置顶状态只能为0或1" dc:"是否置顶"`
|
||||
SeoTitle string `json:"seo_title" dc:"SEO标题"`
|
||||
SeoDescription string `json:"seo_description" dc:"SEO描述"`
|
||||
SeoKeywords string `json:"seo_keywords" dc:"SEO关键词"`
|
||||
}
|
||||
40
internal/model/attachment.go
Normal file
40
internal/model/attachment.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Attachment 附件模型
|
||||
type Attachment struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
OriginalName string `json:"original_name" dc:"原始文件名"`
|
||||
FileName string `json:"file_name" dc:"存储文件名"`
|
||||
FilePath string `json:"file_path" dc:"文件路径"`
|
||||
FileUrl string `json:"file_url" dc:"文件URL"`
|
||||
FileSize int64 `json:"file_size" dc:"文件大小(字节)"`
|
||||
FileType string `json:"file_type" dc:"文件类型"`
|
||||
MimeType string `json:"mime_type" dc:"MIME类型"`
|
||||
FileExt string `json:"file_ext" dc:"文件扩展名"`
|
||||
StorageType string `json:"storage_type" dc:"存储类型 local:本地 oss:阿里云OSS"`
|
||||
UploadIp string `json:"upload_ip" dc:"上传IP"`
|
||||
UploadedBy int `json:"uploaded_by" dc:"上传者ID"`
|
||||
UsageCount int `json:"usage_count" dc:"使用次数"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// UploadRequest 上传请求
|
||||
type UploadRequest struct {
|
||||
FileType string `json:"file_type" dc:"文件类型"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
}
|
||||
|
||||
// UploadResponse 上传响应
|
||||
type UploadResponse struct {
|
||||
Id int `json:"id" dc:"附件ID"`
|
||||
FileName string `json:"file_name" dc:"文件名"`
|
||||
FileUrl string `json:"file_url" dc:"文件URL"`
|
||||
FileSize int64 `json:"file_size" dc:"文件大小"`
|
||||
FileType string `json:"file_type" dc:"文件类型"`
|
||||
}
|
||||
82
internal/model/common.go
Normal file
82
internal/model/common.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package model
|
||||
|
||||
// 通用响应结构
|
||||
type Response struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
// 分页响应结构
|
||||
type PageResponse struct {
|
||||
List interface{} `json:"list"`
|
||||
Total int `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
TotalPages int `json:"total_pages"`
|
||||
}
|
||||
|
||||
// 通用列表请求
|
||||
type ListRequest struct {
|
||||
Page int `json:"page" form:"page"`
|
||||
PageSize int `json:"page_size" form:"page_size"`
|
||||
Keyword string `json:"keyword" form:"keyword"`
|
||||
Status int `json:"status" form:"status"`
|
||||
}
|
||||
|
||||
|
||||
// 文章列表请求
|
||||
type ArticleListRequest struct {
|
||||
ListRequest
|
||||
CategoryId int `json:"category_id" form:"category_id"`
|
||||
AuthorId int `json:"author_id" form:"author_id"`
|
||||
IsPublished int `json:"is_published" form:"is_published"`
|
||||
IsFeatured int `json:"is_featured" form:"is_featured"`
|
||||
IsTop int `json:"is_top" form:"is_top"`
|
||||
StartDate string `json:"start_date" form:"start_date"`
|
||||
EndDate string `json:"end_date" form:"end_date"`
|
||||
}
|
||||
|
||||
// 附件列表请求
|
||||
type AttachmentListRequest struct {
|
||||
ListRequest
|
||||
FileType string `json:"file_type" form:"file_type"`
|
||||
UploadedBy int `json:"uploaded_by" form:"uploaded_by"`
|
||||
StartDate string `json:"start_date" form:"start_date"`
|
||||
EndDate string `json:"end_date" form:"end_date"`
|
||||
StorageType string `json:"storage_type" form:"storage_type"`
|
||||
}
|
||||
|
||||
// 新闻列表请求
|
||||
type NewsListRequest struct {
|
||||
ListRequest
|
||||
Category string `json:"category" form:"category"`
|
||||
Author string `json:"author" form:"author"`
|
||||
Source string `json:"source" form:"source"`
|
||||
IsPublished int `json:"is_published" form:"is_published"`
|
||||
IsFeatured int `json:"is_featured" form:"is_featured"`
|
||||
IsTop int `json:"is_top" form:"is_top"`
|
||||
StartDate string `json:"start_date" form:"start_date"`
|
||||
EndDate string `json:"end_date" form:"end_date"`
|
||||
}
|
||||
|
||||
// 合作伙伴列表请求
|
||||
type PartnerListRequest struct {
|
||||
ListRequest
|
||||
Category string `json:"category" form:"category"`
|
||||
IsFeatured int `json:"is_featured" form:"is_featured"`
|
||||
}
|
||||
|
||||
// 联系我们列表请求
|
||||
type ContactListRequest struct {
|
||||
ListRequest
|
||||
StartDate string `json:"start_date" form:"start_date"`
|
||||
EndDate string `json:"end_date" form:"end_date"`
|
||||
}
|
||||
|
||||
// 配置列表请求
|
||||
type ConfigListRequest struct {
|
||||
ListRequest
|
||||
GroupName string `json:"group_name" form:"group_name"`
|
||||
IsSystem int `json:"is_system" form:"is_system"`
|
||||
}
|
||||
48
internal/model/config.go
Normal file
48
internal/model/config.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Config 配置模型
|
||||
type Config struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
ConfigKey string `json:"config_key" dc:"配置键"`
|
||||
ConfigValue string `json:"config_value" dc:"配置值"`
|
||||
ConfigType string `json:"config_type" dc:"配置类型 string:字符串 int:整数 bool:布尔 json:JSON"`
|
||||
GroupName string `json:"group_name" dc:"分组名称"`
|
||||
Description string `json:"description" dc:"配置描述"`
|
||||
SortOrder int `json:"sort_order" dc:"排序"`
|
||||
IsSystem int `json:"is_system" dc:"是否系统配置 0:否 1:是"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
}
|
||||
|
||||
// SiteConfig 站点配置别名
|
||||
type SiteConfig = Config
|
||||
|
||||
// CreateConfigRequest 创建配置请求
|
||||
type CreateConfigRequest struct {
|
||||
ConfigKey string `json:"config_key" v:"required|length:1,100#配置键不能为空|配置键长度不能超过100字符" dc:"配置键"`
|
||||
ConfigValue string `json:"config_value" dc:"配置值"`
|
||||
ConfigType string `json:"config_type" dc:"配置类型"`
|
||||
GroupName string `json:"group_name" dc:"分组名称"`
|
||||
Description string `json:"description" dc:"配置描述"`
|
||||
SortOrder int `json:"sort_order" dc:"排序"`
|
||||
IsSystem int `json:"is_system" dc:"是否系统配置"`
|
||||
}
|
||||
|
||||
// UpdateConfigRequest 更新配置请求
|
||||
type UpdateConfigRequest struct {
|
||||
ConfigValue string `json:"config_value" dc:"配置值"`
|
||||
ConfigType string `json:"config_type" dc:"配置类型"`
|
||||
GroupName string `json:"group_name" dc:"分组名称"`
|
||||
Description string `json:"description" dc:"配置描述"`
|
||||
SortOrder int `json:"sort_order" dc:"排序"`
|
||||
IsSystem int `json:"is_system" dc:"是否系统配置"`
|
||||
}
|
||||
|
||||
// BatchUpdateConfigRequest 批量更新配置请求
|
||||
type BatchUpdateConfigRequest struct {
|
||||
Configs map[string]string `json:"configs" v:"required#配置不能为空" dc:"配置键值对"`
|
||||
}
|
||||
45
internal/model/contact.go
Normal file
45
internal/model/contact.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Contact 联系我们模型
|
||||
type Contact struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Name string `json:"name" dc:"姓名"`
|
||||
Email string `json:"email" dc:"邮箱"`
|
||||
Phone string `json:"phone" dc:"电话"`
|
||||
Company string `json:"company" dc:"公司"`
|
||||
Subject string `json:"subject" dc:"主题"`
|
||||
Message string `json:"message" dc:"留言内容"`
|
||||
Ip string `json:"ip" dc:"IP地址"`
|
||||
UserAgent string `json:"user_agent" dc:"用户代理"`
|
||||
Status int `json:"status" dc:"状态 0:未处理 1:已处理 2:已回复"`
|
||||
Reply string `json:"reply" dc:"回复内容"`
|
||||
RepliedAt *gtime.Time `json:"replied_at" dc:"回复时间"`
|
||||
RepliedBy int `json:"replied_by" dc:"回复人ID"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
}
|
||||
|
||||
// CreateContactRequest 创建联系信息请求
|
||||
type CreateContactRequest struct {
|
||||
Name string `json:"name" v:"required|length:1,50#姓名不能为空|姓名长度不能超过50字符" dc:"姓名"`
|
||||
Email string `json:"email" v:"required|email#邮箱不能为空|邮箱格式不正确" dc:"邮箱"`
|
||||
Phone string `json:"phone" dc:"电话"`
|
||||
Company string `json:"company" dc:"公司"`
|
||||
Subject string `json:"subject" v:"required|length:1,200#主题不能为空|主题长度不能超过200字符" dc:"主题"`
|
||||
Message string `json:"message" v:"required|length:1,2000#留言内容不能为空|留言内容长度不能超过2000字符" dc:"留言内容"`
|
||||
}
|
||||
|
||||
// ReplyContactRequest 回复联系信息请求
|
||||
type ReplyContactRequest struct {
|
||||
Reply string `json:"reply" v:"required|length:1,2000#回复内容不能为空|回复内容长度不能超过2000字符" dc:"回复内容"`
|
||||
}
|
||||
|
||||
// ContactTrend 联系信息趋势数据
|
||||
type ContactTrend struct {
|
||||
Date string `json:"date" dc:"日期"`
|
||||
Count int `json:"count" dc:"数量"`
|
||||
}
|
||||
0
internal/model/do/.gitkeep
Normal file
0
internal/model/do/.gitkeep
Normal file
0
internal/model/entity/.gitkeep
Normal file
0
internal/model/entity/.gitkeep
Normal file
23
internal/model/entity/admin.go
Normal file
23
internal/model/entity/admin.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Admin 管理员实体
|
||||
type Admin struct {
|
||||
Id uint64 `json:"id" orm:"id,primary"`
|
||||
Username string `json:"username" orm:"username"`
|
||||
Password string `json:"-" orm:"password"`
|
||||
RealName string `json:"real_name" orm:"real_name"`
|
||||
Email string `json:"email" orm:"email"`
|
||||
Phone string `json:"phone" orm:"phone"`
|
||||
Avatar string `json:"avatar" orm:"avatar"`
|
||||
RoleId uint64 `json:"role_id" orm:"role_id"`
|
||||
Status uint8 `json:"status" orm:"status"`
|
||||
LastLoginAt *time.Time `json:"last_login_at" orm:"last_login_at"`
|
||||
LastLoginIp string `json:"last_login_ip" orm:"last_login_ip"`
|
||||
CreatedAt *time.Time `json:"created_at" orm:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at" orm:"updated_at"`
|
||||
DeletedAt uint64 `json:"deleted_at" orm:"deleted_at"`
|
||||
}
|
||||
56
internal/model/news.go
Normal file
56
internal/model/news.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// News 新闻模型
|
||||
type News struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Title string `json:"title" dc:"标题"`
|
||||
Slug string `json:"slug" dc:"URL别名"`
|
||||
Summary string `json:"summary" dc:"摘要"`
|
||||
Content string `json:"content" dc:"内容"`
|
||||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
Source string `json:"source" dc:"来源"`
|
||||
Author string `json:"author" dc:"作者"`
|
||||
ViewCount int `json:"view_count" dc:"浏览次数"`
|
||||
IsPublished int `json:"is_published" dc:"是否发布 0:草稿 1:已发布"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐 0:否 1:是"`
|
||||
IsTop int `json:"is_top" dc:"是否置顶 0:否 1:是"`
|
||||
PublishedAt *gtime.Time `json:"published_at" dc:"发布时间"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// CreateNewsRequest 创建新闻请求
|
||||
type CreateNewsRequest struct {
|
||||
Title string `json:"title" v:"required|length:1,255#标题不能为空|标题长度不能超过255字符" dc:"标题"`
|
||||
Slug string `json:"slug" v:"length:0,255#URL别名长度不能超过255字符" dc:"URL别名"`
|
||||
Summary string `json:"summary" dc:"摘要"`
|
||||
Content string `json:"content" v:"required#内容不能为空" dc:"内容"`
|
||||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
Source string `json:"source" dc:"来源"`
|
||||
Author string `json:"author" dc:"作者"`
|
||||
IsPublished int `json:"is_published" dc:"是否发布"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||||
IsTop int `json:"is_top" dc:"是否置顶"`
|
||||
}
|
||||
|
||||
// UpdateNewsRequest 更新新闻请求
|
||||
type UpdateNewsRequest struct {
|
||||
Title string `json:"title" v:"required|length:1,255#标题不能为空|标题长度不能超过255字符" dc:"标题"`
|
||||
Slug string `json:"slug" v:"length:0,255#URL别名长度不能超过255字符" dc:"URL别名"`
|
||||
Summary string `json:"summary" dc:"摘要"`
|
||||
Content string `json:"content" v:"required#内容不能为空" dc:"内容"`
|
||||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
Source string `json:"source" dc:"来源"`
|
||||
Author string `json:"author" dc:"作者"`
|
||||
IsPublished int `json:"is_published" dc:"是否发布"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||||
IsTop int `json:"is_top" dc:"是否置顶"`
|
||||
}
|
||||
45
internal/model/partner.go
Normal file
45
internal/model/partner.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Partner 合作伙伴模型
|
||||
type Partner struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Name string `json:"name" dc:"合作伙伴名称"`
|
||||
Logo string `json:"logo" dc:"Logo图片"`
|
||||
Website string `json:"website" dc:"官网地址"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
SortOrder int `json:"sort_order" dc:"排序"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐 0:否 1:是"`
|
||||
Status int `json:"status" dc:"状态 0:禁用 1:启用"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// CreatePartnerRequest 创建合作伙伴请求
|
||||
type CreatePartnerRequest struct {
|
||||
Name string `json:"name" v:"required|length:1,100#合作伙伴名称不能为空|名称长度不能超过100字符" dc:"合作伙伴名称"`
|
||||
Logo string `json:"logo" dc:"Logo图片"`
|
||||
Website string `json:"website" dc:"官网地址"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
SortOrder int `json:"sort_order" dc:"排序"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
// UpdatePartnerRequest 更新合作伙伴请求
|
||||
type UpdatePartnerRequest struct {
|
||||
Name string `json:"name" v:"required|length:1,100#合作伙伴名称不能为空|名称长度不能超过100字符" dc:"合作伙伴名称"`
|
||||
Logo string `json:"logo" dc:"Logo图片"`
|
||||
Website string `json:"website" dc:"官网地址"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
Category string `json:"category" dc:"分类"`
|
||||
SortOrder int `json:"sort_order" dc:"排序"`
|
||||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
17
internal/model/permission.go
Normal file
17
internal/model/permission.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package model
|
||||
|
||||
// Permission 权限模型
|
||||
type Permission struct {
|
||||
Key string `json:"key" dc:"权限键"`
|
||||
Name string `json:"name" dc:"权限名称"`
|
||||
Description string `json:"description" dc:"权限描述"`
|
||||
Group string `json:"group" dc:"权限分组"`
|
||||
}
|
||||
|
||||
// PermissionGroup 权限分组模型
|
||||
type PermissionGroup struct {
|
||||
Key string `json:"key" dc:"分组键"`
|
||||
Name string `json:"name" dc:"分组名称"`
|
||||
Description string `json:"description" dc:"分组描述"`
|
||||
Permissions []Permission `json:"permissions" dc:"权限列表"`
|
||||
}
|
||||
41
internal/model/role.go
Normal file
41
internal/model/role.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Role 角色模型
|
||||
type Role struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Name string `json:"name" dc:"角色名称"`
|
||||
Description string `json:"description" dc:"角色描述"`
|
||||
Permissions interface{} `json:"permissions" dc:"权限列表"`
|
||||
Status int `json:"status" dc:"状态 0:禁用 1:启用"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// RoleListRequest 角色列表请求
|
||||
type RoleListRequest struct {
|
||||
Page int `json:"page" dc:"页码"`
|
||||
PageSize int `json:"page_size" dc:"每页数量"`
|
||||
Keyword string `json:"keyword" dc:"关键词"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
// CreateRoleRequest 创建角色请求
|
||||
type CreateRoleRequest struct {
|
||||
Name string `json:"name" v:"required|length:2,32#角色名称不能为空|角色名称长度为2-32位" dc:"角色名称"`
|
||||
Description string `json:"description" dc:"角色描述"`
|
||||
Permissions []string `json:"permissions" dc:"权限列表"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
// UpdateRoleRequest 更新角色请求
|
||||
type UpdateRoleRequest struct {
|
||||
Name string `json:"name" v:"required|length:2,32#角色名称不能为空|角色名称长度为2-32位" dc:"角色名称"`
|
||||
Description string `json:"description" dc:"角色描述"`
|
||||
Permissions []string `json:"permissions" dc:"权限列表"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
}
|
||||
83
internal/model/user.go
Normal file
83
internal/model/user.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// User 用户模型
|
||||
type User struct {
|
||||
Id int `json:"id" dc:"主键"`
|
||||
Account string `json:"account" dc:"账号"`
|
||||
NickName string `json:"nick_name" dc:"昵称"`
|
||||
Avatar string `json:"avatar" dc:"头像"`
|
||||
Email string `json:"email" dc:"邮箱"`
|
||||
Password string `json:"-" dc:"登录密码"`
|
||||
Balance float64 `json:"balance" dc:"余额"`
|
||||
QrCode string `json:"qr_code" dc:"微信二维码地址"`
|
||||
RoleId int `json:"role_id" dc:"角色"`
|
||||
IsSysNotifications int `json:"is_sys_notifications" dc:"是否接受邮件系统通知"`
|
||||
IsCollectionNotifications int `json:"is_collection_notifications" dc:"是否接受收藏的项目更新信息"`
|
||||
IsMarketingNotifications int `json:"is_marketing_notifications" dc:"是否接受营销信息"`
|
||||
Ip string `json:"ip" dc:"本次登录ip"`
|
||||
IpTable interface{} `json:"ip_table" dc:"常用登录IP地址列表"`
|
||||
Status int `json:"status" dc:"状态 0:正常 1:冻结 2:封号 3:注销"`
|
||||
LastResetPasswordAt int `json:"last_reset_password_at" dc:"最后一次修改密码的时间"`
|
||||
CreatedAt *gtime.Time `json:"created_at" dc:"注册时间"`
|
||||
UpdatedAt *gtime.Time `json:"updated_at" dc:"编辑时间"`
|
||||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||||
}
|
||||
|
||||
// UserListRequest 用户列表请求
|
||||
type UserListRequest struct {
|
||||
Page int `json:"page" dc:"页码"`
|
||||
PageSize int `json:"page_size" dc:"每页数量"`
|
||||
Keyword string `json:"keyword" dc:"关键词"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
RoleId int `json:"role_id" dc:"角色ID"`
|
||||
}
|
||||
|
||||
// CreateUserRequest 创建用户请求
|
||||
type CreateUserRequest struct {
|
||||
Account string `json:"account" v:"required|length:3,32#账号不能为空|账号长度为3-32位" dc:"账号"`
|
||||
NickName string `json:"nick_name" v:"required|length:2,64#昵称不能为空|昵称长度为2-64位" dc:"昵称"`
|
||||
Email string `json:"email" v:"required|email#邮箱不能为空|邮箱格式不正确" dc:"邮箱"`
|
||||
Password string `json:"password" v:"required|length:6,32#密码不能为空|密码长度为6-32位" dc:"密码"`
|
||||
Avatar string `json:"avatar" dc:"头像"`
|
||||
Balance float64 `json:"balance" dc:"余额"`
|
||||
RoleId int `json:"role_id" dc:"角色ID"`
|
||||
IsSysNotifications int `json:"is_sys_notifications" dc:"是否接受邮件系统通知"`
|
||||
IsCollectionNotifications int `json:"is_collection_notifications" dc:"是否接受收藏的项目更新信息"`
|
||||
IsMarketingNotifications int `json:"is_marketing_notifications" dc:"是否接受营销信息"`
|
||||
}
|
||||
|
||||
// UpdateUserRequest 更新用户请求
|
||||
type UpdateUserRequest struct {
|
||||
NickName string `json:"nick_name" v:"required|length:2,64#昵称不能为空|昵称长度为2-64位" dc:"昵称"`
|
||||
Email string `json:"email" v:"required|email#邮箱不能为空|邮箱格式不正确" dc:"邮箱"`
|
||||
Avatar string `json:"avatar" dc:"头像"`
|
||||
Balance float64 `json:"balance" dc:"余额"`
|
||||
RoleId int `json:"role_id" dc:"角色ID"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
IsSysNotifications int `json:"is_sys_notifications" dc:"是否接受邮件系统通知"`
|
||||
IsCollectionNotifications int `json:"is_collection_notifications" dc:"是否接受收藏的项目更新信息"`
|
||||
IsMarketingNotifications int `json:"is_marketing_notifications" dc:"是否接受营销信息"`
|
||||
}
|
||||
|
||||
// ChangePasswordRequest 修改密码请求
|
||||
type ChangePasswordRequest struct {
|
||||
OldPassword string `json:"old_password" v:"required#原密码不能为空" dc:"原密码"`
|
||||
NewPassword string `json:"new_password" v:"required|length:6,32#新密码不能为空|新密码长度为6-32位" dc:"新密码"`
|
||||
}
|
||||
|
||||
// UserLoginRequest 用户登录请求
|
||||
type UserLoginRequest struct {
|
||||
Account string `json:"account" v:"required#账号不能为空" dc:"账号"`
|
||||
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
|
||||
}
|
||||
|
||||
// UserLoginResponse 用户登录响应
|
||||
type UserLoginResponse struct {
|
||||
Token string `json:"token" dc:"访问令牌"`
|
||||
ExpiresIn int `json:"expires_in" dc:"过期时间(秒)"`
|
||||
User *User `json:"user" dc:"用户信息"`
|
||||
}
|
||||
Reference in New Issue
Block a user