Files
SNCTF/type/commentypes.go
jiayuqi7813 7cb171bc90 default
2022-05-21 23:29:23 +08:00

59 lines
2.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package types
//user定义用户结构体。
type User struct {
ID int `json:"id"` //用户id唯一自增
Token string `json:"token"` //用户token唯一
Username string `json:"username"` //用户名,唯一
Password string `json:"password"` //用户密码md5值md5(原密码)
Email string `json:"email"` //邮箱,唯一
Affiliation string `json:"affiliation"` //组织、战队或机构等非必需默认为0
Country string `json:"country"` //国家非必需默认为0
Website string `json:"website"` //个人链接默认为0
Hidden int `json:"hidden"` //1隐藏0显示默认为0
Banned int `json:"banned"` //1禁止0正常默认为1邮箱激活后为0
TeamID int `json:"team_id"` //队伍id在团队模式下必须个人模式非必需默认为0
Created int `json:"created"` //用户注册时间10位数时间戳
Role int `json:"role"` //0普通用户默认为01普通管理员2所有者最高权限
}
// Notice 定义一个公告
type Notice struct {
ID int `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
CreatedAt int `json:"created_at"`
}
// Challenge 定义一个题目
type Challenge struct {
ID int `json:"id"`
Name string `json:"name"`
Score int `json:"score"`
Flag string `json:"flag"`
Description string `json:"description"`
Attachment []string `json:"attachment"`
Category string `json:"category"`
Tags string `json:"tags"`
Hints []string `json:"hints"`
Visible int `json:"visible"` // 0表示隐藏1表示可见
}
// Submission 表示一次flag提交记录
type Submission struct {
ID int `json:"id"`
UserID int `json:"uid" gorm:"column:uid"`
ChallengeID int `json:"cid" gorm:"column:cid"`
Flag string `json:"flag"`
IP string `json:"ip"`
Time int `json:"submitted_at" gorm:"column:submitted_at"`
}
// Solve 表示一次正确的flag提交记录
type Solve struct {
ID int `json:"id" `
UserID int `json:"uid" gorm:"column:uid"`
ChallengeID int `json:"cid" gorm:"column:cid"`
Time int `json:"solved_at" gorm:"column:submitted_at"`
}