Documentation
¶
Index ¶
- Constants
- Variables
- type AppData
- type Article
- type ArticleResponse
- type ArticleSimpleResponse
- type ArticleTag
- type Comment
- type CommentResponse
- type ConfigData
- type Favorite
- type FavoriteResponse
- type FooterConfig
- type LikeInfo
- type Link
- type Model
- type Node
- type NodeResponse
- type NotificationResponse
- type Record
- type ScoreConfig
- type Setting
- type SiteNav
- type SiteTip
- type Tag
- type TagResponse
- type Topic
- type TopicLike
- type TopicResponse
- type TopicSimpleResponse
- type TopicTag
- type User
- type UserClaims
- type UserInfo
- type UserScore
- type UserScoreLog
- type UserSelfInfo
- type UserWatch
Constants ¶
View Source
const ( SettingSiteTitle = "siteTitle" // 站点标题 SettingSiteDescription = "siteDescription" // 站点描述 SettingSiteKeywords = "siteKeywords" // 站点关键字 SettingSiteTips = "siteTips" // 小贴士 SettingSiteNotification = "siteNotification" // 站点公告 SettingRecommendTags = "recommendTags" // 推荐标签 SettingScoreConfig = "scoreConfig" // 分数配置 SettingDefaultNodeId = "defaultNodeId" // 发帖默认节点 )
系统配置
View Source
const ( ImageStyleAvatar = "avatar" // 头像样式 ImageStyleDetail = "detail" // 图片详情样式 )
图片样式
View Source
const ( StatusOk = 0 // 正常 StatusDeleted = 1 // 删除 UserLevelGeneral = 0 // 普通用户 UserLevelAdmin = 10 // 管理员 ContentTypeHtml = "html" EntityTypeArticle = "article" EntityTypeTopic = "topic" EntityTypeComment = "comment" EntityTypeUser = "user" MsgTypeComment = 0 // 回复消息 MsgTypeTopicLike = 1 // 话题点赞 MsgTypeUserWatch = 2 // 用户关注 ScoreTypeIncr = 0 // 积分+ ScoreTypeDecr = 1 // 积分- TopicTypeNormal = 0 // 普通帖子 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Model
UserId int64 `gorm:"index:idx_article_user_id" json:"userId" form:"userId"` // 所属用户编号
Title string `gorm:"size:128;not null;" json:"title" form:"title"` // 标题
Summary string `gorm:"type:text" json:"summary" form:"summary"` // 摘要
Content string `gorm:"type:longtext;not null;" json:"content" form:"content"` // 内容
ContentType string `gorm:"type:varchar(32);not null" json:"contentType" form:"contentType"` // 内容类型:html、html
Status int `gorm:"int;not null;index:idx_article_status" json:"status" form:"status"` // 状态
SourceUrl string `gorm:"type:text" json:"sourceUrl" form:"sourceUrl"` // 原文链接
ViewCount int64 `gorm:"not null;index:idx_view_count;" json:"viewCount" form:"viewCount"` // 查看数量
CreateTime int64 `gorm:"index:idx_article_create_time" json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
文章
type ArticleResponse ¶
type ArticleResponse struct {
ArticleSimpleResponse
Content template.HTML `json:"content"`
Toc template.HTML `json:"toc"`
}
type ArticleSimpleResponse ¶
type ArticleSimpleResponse struct {
ArticleId int64 `json:"articleId"`
User *UserInfo `json:"user"`
Tags *[]TagResponse `json:"tags"`
Title string `json:"title"`
Summary string `json:"summary"`
SourceUrl string `json:"sourceUrl"`
ViewCount int64 `json:"viewCount"`
CreateTime int64 `json:"createTime"`
}
type ArticleTag ¶
type ArticleTag struct {
Model
ArticleId int64 `gorm:"not null;index:idx_article_id;" json:"articleId" form:"articleId"` // 文章编号
TagId int64 `gorm:"not null;index:idx_article_tag_tag_id;" json:"tagId" form:"tagId"` // 标签编号
Status int64 `gorm:"not null;index:idx_article_tag_status" json:"status" form:"status"` // 状态:正常、删除
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
文章标签
type Comment ¶
type Comment struct {
Model
UserId int64 `gorm:"index:idx_comment_user_id;not null" json:"userId" form:"userId"` // 用户编号
EntityType string `gorm:"index:idx_comment_entity_type;not null" json:"entityType" form:"entityType"` // 被评论实体类型
EntityId int64 `gorm:"index:idx_comment_entity_id;not null" json:"entityId" form:"entityId"` // 被评论实体编号
Content string `gorm:"type:text;not null" json:"content" form:"content"` // 内容
ContentType string `gorm:"type:varchar(32);not null" json:"contentType" form:"contentType"` // 内容类型:html、html
QuoteId int64 `gorm:"not null" json:"quoteId" form:"quoteId"` // 引用的评论编号
Status int `gorm:"int;index:idx_comment_status" json:"status" form:"status"` // 状态:0:待审核、1:审核通过、2:审核失败、3:已发布
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
评论
type CommentResponse ¶
type CommentResponse struct {
CommentId int64 `json:"commentId"`
User *UserInfo `json:"user"`
EntityType string `json:"entityType"`
EntityId int64 `json:"entityId"`
Content template.HTML `json:"content"`
QuoteId int64 `json:"quoteId"`
Quote *CommentResponse `json:"quote"`
QuoteContent template.HTML `json:"quoteContent"`
Status int `json:"status"`
CreateTime int64 `json:"createTime"`
}
回帖详情返回实体
type ConfigData ¶
type ConfigData struct {
SiteTitle string `json:"siteTitle"`
SiteDescription string `json:"siteDescription"`
SiteKeywords []string `json:"siteKeywords"`
SiteTips []SiteTip `json:"siteTips"`
SiteNotification string `json:"siteNotification"`
RecommendTags []string `json:"recommendTags"`
ScoreConfig ScoreConfig `json:"scoreConfig"`
DefaultNodeId int64 `json:"defaultNodeId"`
}
配置返回结构体
type Favorite ¶
type Favorite struct {
Model
UserId int64 `gorm:"index:idx_favorite_user_id;not null" json:"userId" form:"userId"` // 用户编号
EntityType string `gorm:"index:idx_favorite_entity_type;size:32;not null" json:"entityType" form:"entityType"` // 收藏实体类型
EntityId int64 `gorm:"index:idx_favorite_entity_id;not null" json:"entityId" form:"entityId"` // 收藏实体编号
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
收藏
type FavoriteResponse ¶
type Link ¶
type Link struct {
Model
Url string `gorm:"not null;type:text" json:"url" form:"url"` // 链接
Title string `gorm:"not null;size:128" json:"title" form:"title"` // 标题
Summary string `gorm:"size:1024" json:"summary" form:"summary"` // 站点描述
Logo string `gorm:"type:text" json:"logo" form:"logo"` // LOGO
Status int `gorm:"not null" json:"status" form:"status"` // 状态
CreateTime int64 `gorm:"not null" json:"createTime" form:"createTime"` // 创建时间
}
友链
type Node ¶
type Node struct {
Model
Name string `gorm:"size:32;unique" json:"name" form:"name"` // 名称
Description string `json:"description" form:"description"` // 描述
SortNo int `gorm:"index:idx_sort_no" json:"sortNo" form:"sortNo"` // 排序编号
Status int `gorm:"not null" json:"status" form:"status"` // 状态
TopicCount int64 `gorm:"not null" json:"topicCount" form:"topicCount"` // 主题数量
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
话题节点
type NodeResponse ¶
type NotificationResponse ¶
type NotificationResponse struct {
MessageId int64 `json:"messageId"`
From *UserInfo `json:"from"` // 消息发送人
UserId int64 `json:"userId"` // 消息接收人编号
Content string `json:"content"` // 消息内容
QuoteContent string `json:"quoteContent"`
Type int `json:"type"`
Icon string `json:"icon"`
DetailUrl string `json:"detailUrl"` // 消息详情url
ExtraData string `json:"extraData"`
Status int `json:"status"`
CreateTime int64 `json:"createTime"`
}
消息
type Record ¶
type Record struct {
// 不使用Model
ID int64 `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id" form:"id"`
RequestIDPrefix string `gorm:"index:idx_record_requests_id_prefix;not null"`
ServerName string `gorm:"not null"`
UserID int64
UserUID string // 修改为你需要的数据类型
UserToken string `gorm:"type:text"`
IP string `gorm:"not null"`
GeoCode string `gorm:"not null"`
Geo string `gorm:"not null"`
Scheme string `gorm:"not null"`
Method string `gorm:"not null"`
Host string `gorm:"not null"`
Path string `gorm:"not null"`
Query string `gorm:"type:json;not null"`
ContentType *string `gorm:"not null"`
RequestsBody string `gorm:"type:text;not null"`
ResponseBody *string `gorm:"type:text"`
ResponseBodyError *string `gorm:"size:2000"`
RequestsHeader string `gorm:"type:json;not null"`
ResponseHeader *string `gorm:"type:json"`
StatusCode int64
PanicError *string `gorm:"size:2000"`
Message *string `gorm:"type:json"`
UseTime int64
CreateTime time.Time `gorm:"index:idx_record_create_time;autoUpdateTime"`
StartTime *time.Time
EndTime *time.Time
}
type ScoreConfig ¶
type ScoreConfig struct {
PostTopicScore int `json:"postTopicScore"` // 发帖获得积分
PostCommentScore int `json:"postCommentScore"` // 跟帖获得积分
}
积分配置
type Setting ¶
type Setting struct {
Model
Key string `gorm:"not null;size:128;unique" json:"key" form:"key"` // 配置key
Value string `gorm:"type:text" json:"value" form:"value"` // 配置值
Name string `gorm:"not null;size:32" json:"name" form:"name"` // 配置名称
Description string `gorm:"size:128" json:"description" form:"description"` // 配置描述
CreateTime int64 `gorm:"not null" json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `gorm:"not null" json:"updateTime" form:"updateTime"` // 更新时间
}
系统配置
type Tag ¶
type Tag struct {
Model
Name string `gorm:"size:32;unique;not null" json:"name" form:"name"`
Description string `gorm:"size:1024" json:"description" form:"description"`
Status int `gorm:"index:idx_tag_status;not null" json:"status" form:"status"`
CreateTime int64 `json:"createTime" form:"createTime"`
UpdateTime int64 `json:"updateTime" form:"updateTime"`
}
标签
type TagResponse ¶
type Topic ¶
type Topic struct {
Model
Type int `gorm:"not null;index:idx_topic_type" json:"type" form:"type"` // 类型
NodeId int64 `gorm:"not null;index:idx_node_id;" json:"nodeId" form:"nodeId"` // 节点编号
UserId int64 `gorm:"not null;index:idx_topic_user_id;" json:"userId" form:"userId"` // 用户
Title string `gorm:"size:128" json:"title" form:"title"` // 标题
Content string `gorm:"type:longtext" json:"content" form:"content"` // 内容
ImageList string `gorm:"type:longtext" json:"imageList" form:"imageList"` // 图片
Recommend bool `gorm:"not null;index:idx_recommend" json:"recommend" form:"recommend"` // 是否推荐
ViewCount int64 `gorm:"not null" json:"viewCount" form:"viewCount"` // 查看数量
CommentCount int64 `gorm:"not null" json:"commentCount" form:"commentCount"` // 跟帖数量
LikeCount int64 `gorm:"not null" json:"likeCount" form:"likeCount"` // 点赞数量
Status int `gorm:"index:idx_topic_status;" json:"status" form:"status"`
LastCommentUserId int64 `gorm:"index:idx_topic_last_comment_user_id" json:"lastCommentUserId" form:"lastCommentUserId"` // 最后回复时间 // 状态:0:正常、1:删除
LastCommentTime int64 `gorm:"index:idx_topic_last_comment_time" json:"lastCommentTime" form:"lastCommentTime"` // 最后回复时间
CreateTime int64 `gorm:"index:idx_topic_create_time" json:"createTime" form:"createTime"` // 创建时间
ExtraData string `gorm:"type:text" json:"extraData" form:"extraData"` // 扩展数据
}
话题
type TopicLike ¶
type TopicLike struct {
Model
UserId int64 `gorm:"not null;index:idx_topic_like_user_id;" json:"userId" form:"userId"` // 用户
TopicId int64 `gorm:"not null;index:idx_topic_like_topic_id;" json:"topicId" form:"topicId"` // 主题编号
Count int64 `gorm:"not null;" json:"count" form:"count"` // 点赞数
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
话题点赞
type TopicResponse ¶
type TopicResponse struct {
TopicSimpleResponse
Content template.HTML `json:"content"`
Toc template.HTML `json:"toc"`
}
帖子详情返回实体
type TopicSimpleResponse ¶
type TopicSimpleResponse struct {
TopicId int64 `json:"topicId"`
Type int `json:"type"`
User *UserInfo `json:"user"`
Node *NodeResponse `json:"node"`
Tags *[]TagResponse `json:"tags"`
Title string `json:"title"`
ImageList *[]string `json:"imageList"`
LastCommentUser *UserInfo `json:"lastCommentUser"`
LastCommentTime int64 `json:"lastCommentTime"`
ViewCount int64 `json:"viewCount"`
CommentCount int64 `json:"commentCount"`
LikeCount int64 `json:"likeCount"`
CreateTime int64 `json:"createTime"`
}
帖子列表返回实体
type TopicTag ¶
type TopicTag struct {
Model
TopicId int64 `gorm:"not null;index:idx_topic_tag_topic_id;" json:"topicId" form:"topicId"` // 主题编号
TagId int64 `gorm:"not null;index:idx_topic_tag_tag_id;" json:"tagId" form:"tagId"` // 标签编号
Status int64 `gorm:"not null;index:idx_topic_tag_status" json:"status" form:"status"` // 状态:正常、删除
LastCommentTime int64 `gorm:"index:idx_topic_tag_last_comment_time" json:"lastCommentTime" form:"lastCommentTime"` // 最后回复时间
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
主题标签
type User ¶
type User struct {
Model
Uid string `gorm:"size:128;" json:"uid" form:"uid"`
Phone string `gorm:"size:50;" json:"phone" form:"phone"`
Username sql.NullString `gorm:"size:32;" json:"username" form:"username"` // 用户名
Email sql.NullString `gorm:"size:128;" json:"email" form:"email"` // 邮箱
Nickname sql.NullString `gorm:"size:16;" json:"nickname" form:"nickname"` // 昵称
Header sql.NullString `gorm:"size:128" json:"header" form:"header"` // 头像
Status int `gorm:"index:idx_user_status;not null" json:"status" form:"status"` // 状态
TopicCount int `gorm:"not null" json:"topicCount" form:"topicCount"` // 帖子数量
CommentCount int `gorm:"not null" json:"commentCount" form:"commentCount"` // 跟帖数量
Level int `gorm:"not null" json:"level" form:"level"` // 用户等级
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
type UserClaims ¶
type UserClaims struct {
*User
}
type UserInfo ¶
type UserInfo struct {
Id int64 `json:"id"`
Uid string `json:"uid"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Header string `json:"header"`
Level int `json:"level"`
LevelName string `json:"levelName"`
Score int `json:"score"` // 积分
TopicCount int `json:"topicCount"` // 话题数量
CommentCount int `json:"commentCount"` // 跟帖数量
Status int `json:"status"`
CreateTime int64 `json:"createTime"`
}
type UserScore ¶
type UserScore struct {
Model
UserId int64 `gorm:"unique;not null" json:"userId" form:"userId"` // 用户编号
Score int `gorm:"not null" json:"score" form:"score"` // 积分
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
UpdateTime int64 `json:"updateTime" form:"updateTime"` // 更新时间
}
用户积分
type UserScoreLog ¶
type UserScoreLog struct {
Model
UserId int64 `gorm:"not null;index:idx_user_score_log_user_id" json:"userId" form:"userId"` // 用户编号
SourceType string `gorm:"not null;index:idx_user_score_score" json:"sourceType" form:"sourceType"` // 积分来源类型
SourceId string `gorm:"not null;index:idx_user_score_score" json:"sourceId" form:"sourceId"` // 积分来源编号
Description string `json:"description" form:"description"` // 描述
Type int `json:"type" form:"type"` // 类型(增加、减少)
Score int `json:"score" form:"score"` // 积分
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
用户积分流水
type UserSelfInfo ¶
type UserSelfInfo struct {
Id int64 `json:"id"`
Uid string `json:"uid"`
Username string `json:"username"`
Phone string `json:"phone"`
Email string `json:"email"`
Nickname string `json:"nickname"`
Header string `json:"header"`
Level int `json:"level"`
LevelName string `json:"levelName"`
Score int `json:"score"` // 积分
TopicCount int `json:"topicCount"` // 话题数量
CommentCount int `json:"commentCount"` // 跟帖数量
Status int `json:"status"`
CreateTime int64 `json:"createTime"`
}
type UserWatch ¶
type UserWatch struct {
Model
UserID int64 `gorm:"not null;index:idx_user_watch_user_id;" json:"userId" form:"userId"` // 用户
WatcherID int64 `gorm:"not null;index:idx_user_watch_watcher_id;" json:"watcherId" form:"watcherId"` // 关注者编号
CreateTime int64 `json:"createTime" form:"createTime"` // 创建时间
}
用户关注
Click to show internal directories.
Click to hide internal directories.