Documentation
¶
Index ¶
- Constants
- Variables
- type Api
- type AsyncSms
- type Check
- type Comment
- type CommentSearch
- type History
- type Interactive
- type Job
- type LotteryDraw
- type Menu
- type Pagination
- type Participant
- type Plate
- type Post
- type PostSearch
- type Profile
- type RankingParameter
- type ReadEvent
- type RecentActivity
- type Relation
- type RelationStats
- type Role
- type SecondKillEvent
- type User
- type UserSearch
- type UserWithProfile
Constants ¶
View Source
const ( UnderReview uint8 = iota Approved UnApproved )
View Source
const ( LotteryStatusPending string = "pending" // 待开始 LotteryStatusActive string = "active" // 进行中 LotteryStatusCompleted string = "completed" // 已完成 )
View Source
const ( SecondKillStatusPending string = "pending" // 待开始 SecondKillStatusActive string = "active" // 进行中 SecondKillStatusCompleted string = "completed" // 已完成 )
View Source
const ( Draft uint8 = iota // 0: 草稿状态 Published // 1: 发布状态 Withdrawn // 2: 撤回状态 Deleted // 3: 删除状态 )
Variables ¶
View Source
var ( ErrInvalidUsernameFormat = errors.New("invalid username format") ErrInvalidPasswordFormat = errors.New("invalid password format") ErrPasswordMismatch = errors.New("password mismatch") )
View Source
var ErrNotFound = errors.New("record not found")
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
ID int `json:"id"` // 主键ID
Name string `json:"name"` // API名称
Path string `json:"path"` // API路径
Method int `json:"method"` // HTTP请求方法(1:GET,2:POST,3:PUT,4:DELETE)
Description string `json:"description"` // API描述
Version string `json:"version"` // API版本
Category int `json:"category"` // API分类(1:系统,2:业务)
IsPublic int `json:"is_public"` // 是否公开(0:否,1:是)
CreateTime int64 `json:"create_time"` // 创建时间
UpdateTime int64 `json:"update_time"` // 更新时间
IsDeleted int `json:"is_deleted"` // 是否删除(0:否,1:是)
}
Api API接口
type CommentSearch ¶
type Interactive ¶
type Interactive struct {
BizID uint `json:"biz_id"`
ReadCount int64 `json:"read_count"`
LikeCount int64 `json:"like_count"`
CollectCount int64 `json:"collect_count"`
Liked bool `json:"liked"`
Collected bool `json:"collected"`
}
func (*Interactive) IncrementCollectCount ¶
func (i *Interactive) IncrementCollectCount()
func (*Interactive) IncrementLikeCount ¶
func (i *Interactive) IncrementLikeCount()
func (*Interactive) IncrementReadCount ¶
func (i *Interactive) IncrementReadCount()
type Job ¶
type LotteryDraw ¶
type LotteryDraw struct {
ID int // 抽奖活动的唯一标识符
Name string // 抽奖活动名称
Description string // 抽奖活动描述
StartTime int64 // UNIX 时间戳,表示活动开始时间
EndTime int64 // UNIX 时间戳,表示活动结束时间
Status string // 抽奖活动状态
Participants []Participant // 参与者列表
}
LotteryDraw 表示一个抽奖活动
type Menu ¶
type Menu struct {
ID int `json:"id"` // 菜单ID
Name string `json:"name"` // 菜单显示名称
ParentID int `json:"parent_id"` // 上级菜单ID,0表示顶级菜单
Path string `json:"path"` // 前端路由访问路径
Component string `json:"component"` // 前端组件文件路径
Icon string `json:"icon"` // 菜单显示图标
SortOrder int `json:"sort_order"` // 菜单显示顺序,数值越小越靠前
RouteName string `json:"route_name"` // 前端路由名称,需唯一
Hidden int `json:"hidden"` // 菜单是否隐藏(0:显示 1:隐藏)
CreateTime int64 `json:"create_time"` // 记录创建时间戳
UpdateTime int64 `json:"update_time"` // 记录最后更新时间戳
IsDeleted int `json:"is_deleted"` // 逻辑删除标记(0:未删除 1:已删除)
Children []*Menu `json:"children"` // 子菜单列表
}
Menu 菜单
type Pagination ¶
type Participant ¶
type Participant struct {
ID string // 参与记录的唯一标识符
LotteryID *int // 关联的活动ID(可以是抽奖或秒杀活动)
SecondKillID *int
ActivityType string
UserID int64 // 参与者的用户ID
ParticipatedAt int64 // UNIX 时间戳,表示参与时间
}
Participant 表示参与者的记录,适用于抽奖和秒杀活动
type Post ¶
type Post struct {
ID uint `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt sql.NullTime `json:"deleted_at"`
ReadCount int64 `json:"read_count"`
LikeCount int64 `json:"like_count"`
CollectCount int64 `json:"collect_count"`
Uid int64 `json:"uid"`
Status uint8 `json:"status"`
PlateID int64 `json:"plate_id"`
Slug string `json:"slug"`
CategoryID int64 `json:"category_id"`
Tags string `json:"tags"`
CommentCount int64 `json:"comment_count"`
IsSubmit bool `json:"is_submit"`
Total int64 `json:"total"`
}
type PostSearch ¶
type Profile ¶
type Profile struct {
ID int64 `json:"id"` // 资料ID,主键
UserID int64 `json:"userId"` // 用户ID,外键,关联到用户
RealName string `json:"realName"` // 真实姓名
Avatar string `json:"avatar"` // 头像URL
Email string `json:"email"` // 邮箱
About string `json:"about"` // 个人简介
Birthday string `json:"birthday"` // 生日
Phone *string `json:"phone"` // 手机号码,指针类型,允许为空
}
type RankingParameter ¶
type RecentActivity ¶
type RelationStats ¶
type Role ¶
type Role struct {
ID int `json:"id"` // 主键ID
Name string `json:"name"` // 角色名称
Description string `json:"description"` // 角色描述
RoleType int `json:"role_type"` // 角色类型(1:系统角色,2:自定义角色)
IsDefault int `json:"is_default"` // 是否为默认角色(0:否,1:是)
CreateTime int64 `json:"create_time"` // 创建时间
UpdateTime int64 `json:"update_time"` // 更新时间
IsDeleted int `json:"is_deleted"` // 是否删除(0:否,1:是)
Menus []*Menu `json:"menus"` // 菜单列表
Apis []*Api `json:"apis"` // API列表
}
Role 角色
type SecondKillEvent ¶
type SecondKillEvent struct {
ID int // 秒杀活动的唯一标识符
Name string // 秒杀活动名称
Description string // 秒杀活动描述
StartTime int64 // UNIX 时间戳,表示活动开始时间
EndTime int64 // UNIX 时间戳,表示活动结束时间
Status string // 秒杀活动状态
Participants []Participant // 参与者列表
}
SecondKillEvent 表示一个秒杀活动
type User ¶
type User struct {
ID int64 `json:"id"` // 用户ID,主键
Username string `json:"username"` // 用户名,唯一
Password string `json:"password"` // 密码
CreateTime int64 `json:"createTime"` // 创建时间,Unix时间戳
UpdatedTime int64 `json:"updatedTime"` // 更新时间,Unix时间戳
Deleted bool `json:"deleted"` // 删除标志,表示该用户是否被删除
Profile Profile `json:"profile"` // 用户的详细资料
Roles []int `json:"roles"`
}
func (*User) VerifyPassword ¶
VerifyPassword 验证密码是否匹配
type UserSearch ¶
type UserWithProfile ¶
type UserWithProfile struct {
ID int64 `json:"id"`
Username string `json:"username"`
PasswordHash string `json:"passwordHash"`
Deleted bool `json:"deleted"`
Phone *string `json:"phone"`
Email string `json:"email"`
ProfileID int64 `json:"profileId"`
UserID int64 `json:"userId"`
RealName string `json:"realName"`
Avatar string `json:"avatar"`
About string `json:"about"`
Birthday string `json:"birthday"`
Roles []string `json:"roles"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.