model

package
v0.0.0-...-2ae2b33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2023 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArticleStatusNew = iota
	ArticleStatusOnline
	ArticleStatusOffline
)
View Source
const (
	AutoCrawlOn = 0
	AutoCrawOff = 1
)
View Source
const (
	IsFreeFalse = iota
	IsFreeTrue
)
View Source
const (
	TypeTopic     = iota // 主题
	TypeArticle          // 博文
	TypeResource         // 资源
	TypeWiki             // WIKI
	TypeProject          // 开源项目
	TypeBook             // 图书
	TypeInterview        // 面试题
)

不要修改常量的顺序

View Source
const (
	TypeComment = 100
	// 置顶
	TypeTop = 101
)
View Source
const (
	TopicURI    = "topics"
	ArticleURI  = "articles"
	ResourceURI = "resources"
	WikiURI     = "wiki"
	ProjectURI  = "p"
	BookURI     = "book"
)
View Source
const (
	DLArchived = iota
	DLStable
	DLFeatured
	DLUnstable
)
View Source
const (
	GCTTRoleTranslator = iota
	GCTTRoleLeader
	GCTTRoleSelecter // 选题
	GCTTRoleChecker  // 校对
	GCTTRoleCore     // 核心成员
)
View Source
const (
	IssueOpened = iota
	IssueClosed
)
View Source
const (
	LabelUnClaim = "待认领"
	LabelClaimed = "已认领"
)
View Source
const (
	GiftStateOnline  = 1
	GiftStateExpired = 3

	GiftTypRedeem   = 0
	GiftTypDiscount = 1
)
View Source
const (
	FlagCancel = iota
	FlagLike   // 喜欢
	FlagUnlike // 不喜欢(暂时不支持)
)
View Source
const (
	FdelNotDel = "未删"
	FdelHasDel = "已删"

	TdelNotDel = "未删"
	TdelHasDel = "已删"

	HasRead = "已读"
	NotRead = "未读"
)
View Source
const (
	// 和comment中objtype保持一致(除了@)
	MsgtypeTopicReply      = iota // 回复我的主题
	MsgtypeArticleComment         // 评论我的博文
	MsgtypeResourceComment        // 评论我的资源
	MsgtypeWikiComment            // 评论我的Wiki页
	MsgtypeProjectComment         // 评论我的项目

	MsgtypeAtMe        = 10 // 评论 @提到我
	MsgtypePublishAtMe = 11 // 发布时提到我

	MsgtypeSubjectContribute = 12 //专栏投稿
)
View Source
const (
	MissionTypeLogin   = 1
	MissionTypeInitial = 2
	MissionTypeShare   = 3
	MissionTypeAdd     = 4

	// 回复
	MissionTypeReply = 51
	// 创建
	MissionTypeTopic    = 52
	MissionTypeArticle  = 53
	MissionTypeResource = 54
	MissionTypeWiki     = 55
	MissionTypeProject  = 56
	MissionTypeBook     = 57

	MissionTypeAppend = 60
	// 置顶
	MissionTypeTop = 61

	MissionTypeModify = 65
	// 被回复
	MissionTypeReplied = 70
	// 额外赠予
	MissionTypeAward = 80
	// 活跃奖励
	MissionTypeActive = 81

	// 物品兑换
	MissionTypeGift = 100

	// 管理员操作后处罚
	MissionTypePunish = 120
	// 水
	MissionTypeSpam = 127
)
View Source
const (
	RtypeGo   = iota // Go技术晨读
	RtypeComp        // 综合技术晨读
)
View Source
const (
	ProjectStatusNew     = 0
	ProjectStatusOnline  = 1
	ProjectStatusOffline = 2
)
View Source
const (
	LinkForm    = "只是链接"
	ContentForm = "包括内容"
)
View Source
const (
	// Master 站长
	Master = iota + 1
	AssistantMaster
	Administrator
	TopicAdmin
	ResourceAdmin
	ArticleAdmin
	ReadingAdmin
)
View Source
const (
	ContributeStateNew = iota
	ContributeStateOnline
	ContributeStateOffline
)
View Source
const (
	FlagNoAudit = iota
	FlagNormal
	FlagAuditDelete
	FlagUserDelete
)
View Source
const (
	PermissionPublic = iota // 公开
	PermissionLogin         // 登录可见
	PermissionFollow        // 关注可见(暂未实现)
	PermissionPay           // 知识星球或其他方式付费可见
	PermissionOnlyMe        // 自己可见
)
View Source
const (
	UserStatusNoAudit = iota
	UserStatusAudit   // 已激活
	UserStatusRefuse
	UserStatusFreeze // 冻结
	UserStatusOutage // 停用
)
View Source
const (
	// 用户拥有的权限设置
	DauAuthTopic = 1 << iota
	DauAuthArticle
	DauAuthResource
	DauAuthWiki
	DauAuthProject
	DauAuthBook
	DauAuthComment // 评论
	DauAuthTop     // 置顶
)
View Source
const (
	BindTypeGithub = iota
	BindTypeGitea
)
View Source
const (
	KeyNewUserWait     = "new_user_wait"    // 新用户注册多久才能发布帖子,单位秒,0表示没限制
	KeyCanEditTime     = "can_edit_time"    // 发布后多久内能够编辑,单位秒
	KeyPublishTimes    = "publish_times"    // 一天发布次数大于该值,需要验证码
	KeyPublishInterval = "publish_interval" // 发布时间间隔在该值内,需要验证码,单位秒
)
View Source
const (
	TabRecommend = "recommend"
	TabAll       = "all"
)
View Source
const (
	AutoReplyTypWord      = iota // 关键词回复
	AutoReplyTypNotFound         // 收到消息(未命中关键词且未搜索到)
	AutoReplyTypSubscribe        // 被关注回复
)
View Source
const (
	WeMsgTypeText       = "text"
	WeMsgTypeImage      = "image"
	WeMsgTypeVoice      = "voice"
	WeMsgTypeVideo      = "video"
	WeMsgTypeShortVideo = "shortvideo"
	WeMsgTypeLocation   = "location"
	WeMsgTypeLink       = "link"
	WeMsgTypeEvent      = "event"

	WeEventSubscribe   = "subscribe"
	WeEventUnsubscribe = "unsubscribe"
)
View Source
const AdminMinRoleId = 7 // 晨读管理员

角色分界点:roleid 大于该值,则没有管理权限

View Source
const (
	// 最多附言条数
	AppendMaxNum = 3
)
View Source
const FeedOffline = 1
View Source
const (
	InitialMissionId = 1
)

Variables

View Source
var ArticleStatusSlice = []string{"未上线", "已上线", "已下线"}
View Source
var BalanceTypeMap = map[int]string{
	MissionTypeLogin:    "每日登录奖励",
	MissionTypeInitial:  "初始资本",
	MissionTypeShare:    "分享获得",
	MissionTypeAdd:      "充值获得",
	MissionTypeReply:    "创建回复",
	MissionTypeTopic:    "创建主题",
	MissionTypeArticle:  "发表文章",
	MissionTypeResource: "分享资源",
	MissionTypeWiki:     "创建WIKI",
	MissionTypeProject:  "发布项目",
	MissionTypeBook:     "分享图书",
	MissionTypeAppend:   "增加附言",
	MissionTypeTop:      "置顶",
	MissionTypeModify:   "修改",
	MissionTypeReplied:  "回复收益",
	MissionTypeAward:    "额外赠予",
	MissionTypeActive:   "活跃奖励",
	MissionTypeGift:     "兑换物品",
	MissionTypePunish:   "处罚",
	MissionTypeSpam:     "Spam",
}
View Source
var GiftTypeMap = map[int]string{
	GiftTypRedeem:   "兑换码",
	GiftTypDiscount: "折扣",
}
View Source
var LangSlice = []string{"中文", "英文"}
View Source
var PathUrlMap = map[int]string{
	TypeTopic:     "/topics/",
	TypeArticle:   "/articles/",
	TypeResource:  "/resources/",
	TypeWiki:      "/wiki/",
	TypeProject:   "/p/",
	TypeBook:      "/book/",
	TypeInterview: "/interview/",
}
View Source
var TypeNameMap = map[int]string{
	TypeTopic:     "主题",
	TypeArticle:   "博文",
	TypeResource:  "资源",
	TypeWiki:      "Wiki",
	TypeProject:   "项目",
	TypeBook:      "图书",
	TypeInterview: "面试题",
}
View Source
var WebsiteSetting = &websiteSetting{}

Functions

func AutoTag

func AutoTag(title, content string, num int) string

AutoTag 自动生成 tag

func DisplayName

func DisplayName(g *GiteaUser) string

func FilterTxt

func FilterTxt(txt string) string

文本过滤(预处理)

func PublishFeed

func PublishFeed(object interface{}, objectExt interface{}, me *Me)

PublishFeed 发布动态

Types

type AddCommand

type AddCommand struct {
	Doc          *Document `json:"doc"`
	Boost        float64   `json:"boost,omitempty"`
	Overwrite    bool      `json:"overwrite"`
	CommitWithin int       `json:"commitWithin,omitempty"`
}

func NewAddCommand

func NewAddCommand(doc *Document, boost float64, overwrite bool, commitWithin int) *AddCommand

func NewDefaultArgsAddCommand

func NewDefaultArgsAddCommand(doc *Document) *AddCommand
type Advertisement struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Name      string    `json:"name"`
	AdType    int       `json:"ad_type"`
	Code      string    `json:"code"`
	Source    string    `json:"source"`
	IsOnline  bool      `json:"is_online"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`
}

type Article

type Article struct {
	Id            int       `json:"id" xorm:"pk autoincr"`
	Domain        string    `json:"domain"`
	Name          string    `json:"name"`
	Title         string    `json:"title"`
	Cover         string    `json:"cover"`
	Author        string    `json:"author"`
	AuthorTxt     string    `json:"author_txt"`
	Lang          int       `json:"lang"`
	PubDate       string    `json:"pub_date"`
	Url           string    `json:"url"`
	Content       string    `json:"content"`
	Txt           string    `json:"txt"`
	Tags          string    `json:"tags"`
	Css           string    `json:"css"`
	Viewnum       int       `json:"viewnum"`
	Cmtnum        int       `json:"cmtnum"`
	Likenum       int       `json:"likenum"`
	Lastreplyuid  int       `json:"lastreplyuid"`
	Lastreplytime OftenTime `json:"lastreplytime"`
	Top           uint8     `json:"top"`
	Markdown      bool      `json:"markdown"`
	GCTT          bool      `json:"gctt" xorm:"gctt"`
	CloseReply    bool      `json:"close_reply"`
	Status        int       `json:"status"`
	OpUser        string    `json:"op_user"`
	Ctime         OftenTime `json:"ctime" xorm:"created"`
	Mtime         OftenTime `json:"mtime" xorm:"<-"`

	IsSelf bool  `json:"is_self" xorm:"-"`
	User   *User `json:"-" xorm:"-"`
	// 排行榜阅读量
	RankView      int   `json:"rank_view" xorm:"-"`
	LastReplyUser *User `json:"last_reply_user" xorm:"-"`
}

抓取的文章信息

func (*Article) AfterInsert

func (this *Article) AfterInsert()

func (*Article) AfterSet

func (this *Article) AfterSet(name string, cell xorm.Cell)

func (*Article) BeforeInsert

func (this *Article) BeforeInsert()

func (*Article) TableName

func (*Article) TableName() string

type ArticleGCTT

type ArticleGCTT struct {
	ArticleID  int `xorm:"article_id pk"`
	Author     string
	AuthorURL  string `xorm:"author_url"`
	Translator string
	Checker    string
	URL        string `xorm:"url"`

	Avatar   string   `xorm:"-"`
	Checkers []string `xorm:"-"`
}

func (*ArticleGCTT) AfterSet

func (this *ArticleGCTT) AfterSet(name string, cell xorm.Cell)

func (*ArticleGCTT) TableName

func (*ArticleGCTT) TableName() string

type Authority

type Authority struct {
	Aid    int       `json:"aid" xorm:"pk autoincr"`
	Name   string    `json:"name"`
	Menu1  int       `json:"menu1"`
	Menu2  int       `json:"menu2"`
	Route  string    `json:"route"`
	OpUser string    `json:"op_user"`
	Ctime  OftenTime `json:"ctime" xorm:"created"`
	Mtime  OftenTime `json:"mtime" xorm:"<-"`
}

权限信息

type AutoCrawlRule

type AutoCrawlRule struct {
	Id             int    `json:"id" xorm:"pk autoincr"`
	Website        string `json:"website"`
	AllUrl         string `json:"all_url"`
	IncrUrl        string `json:"incr_url"`
	Keywords       string `json:"keywords"`
	ListSelector   string `json:"list_selector"`
	ResultSelector string `json:"result_selector"`
	PageField      string `json:"page_field"`
	MaxPage        int    `json:"max_page"`
	Ext            string `json:"ext"`
	OpUser         string `json:"op_user"`
	Mtime          string `json:"mtime" xorm:"<-"`

	ExtMap map[string]string `json:"-" xorm:"-"`
}

网站自动抓取规则

func (*AutoCrawlRule) AfterSet

func (this *AutoCrawlRule) AfterSet(name string, cell xorm.Cell)

type BindUser

type BindUser struct {
	Id           int       `json:"id" xorm:"pk autoincr"`
	Uid          int       `json:"uid"`
	Type         int       `json:"type"`
	Email        string    `json:"email"`
	Tuid         int       `json:"tuid"`
	Username     string    `json:"username"`
	Name         string    `json:"name"`
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	Expire       int       `json:"expire"`
	Avatar       string    `json:"avatar"`
	CreatedAt    time.Time `json:"created_at" xorm:"<-"`
}

type Book

type Book struct {
	Id            int       `json:"id" xorm:"pk autoincr"`
	Name          string    `json:"name"`
	Ename         string    `json:"ename"`
	Cover         string    `json:"cover"`
	Author        string    `json:"author"`
	Translator    string    `json:"translator"`
	Lang          int       `json:"lang"`
	PubDate       string    `json:"pub_date"`
	Desc          string    `json:"desc"`
	Tags          string    `json:"tags"`
	Catalogue     string    `json:"catalogue"`
	IsFree        bool      `json:"is_free"`
	OnlineUrl     string    `json:"online_url"`
	DownloadUrl   string    `json:"download_url"`
	BuyUrl        string    `json:"buy_url"`
	Price         float32   `json:"price"`
	Lastreplyuid  int       `json:"lastreplyuid"`
	Lastreplytime OftenTime `json:"lastreplytime"`
	Viewnum       int       `json:"viewnum"`
	Cmtnum        int       `json:"cmtnum"`
	Likenum       int       `json:"likenum"`
	Uid           int       `json:"uid"`
	CreatedAt     OftenTime `json:"created_at" xorm:"created"`
	UpdatedAt     OftenTime `json:"updated_at" xorm:"<-"`

	// 排行榜阅读量
	RankView int `json:"rank_view" xorm:"-"`
}

func (*Book) AfterInsert

func (this *Book) AfterInsert()

type CData

type CData struct {
	Val string `xml:",cdata"`
}

type Comment

type Comment struct {
	Cid     int       `json:"cid" xorm:"pk autoincr"`
	Objid   int       `json:"objid"`
	Objtype int       `json:"objtype"`
	Content string    `json:"content"`
	Uid     int       `json:"uid"`
	Floor   int       `json:"floor"`
	Flag    int       `json:"flag"`
	Ctime   OftenTime `json:"ctime" xorm:"created"`

	Objinfo    map[string]interface{} `json:"objinfo" xorm:"-"`
	ReplyFloor int                    `json:"reply_floor" xorm:"-"` // 回复某一楼层
}

评论信息(通用)

func (*Comment) TableName

func (*Comment) TableName() string

type CrawlRule

type CrawlRule struct {
	Id      int    `json:"id" xorm:"pk autoincr"`
	Domain  string `json:"domain"`
	Subpath string `json:"subpath"`
	Lang    int    `json:"lang"`
	Name    string `json:"name"`
	Title   string `json:"title"`
	Author  string `json:"author"`
	InUrl   bool   `json:"in_url"`
	PubDate string `json:"pub_date"`
	Content string `json:"content"`
	Ext     string `json:"ext"`
	OpUser  string `json:"op_user"`
	Ctime   string `json:"ctime" xorm:"<-"`
}

抓取网站文章的规则

func (*CrawlRule) ParseExt

func (this *CrawlRule) ParseExt() map[string]string

type DefaultAvatar

type DefaultAvatar struct {
	Id        int `json:"-" xorm:"pk autoincr"`
	Filename  string
	CreatedAt time.Time `json:"-" xorm:"<-"`
}

type DelCommand

type DelCommand struct {
	Id string `json:"id"`
}

func NewDelCommand

func NewDelCommand(doc *Document) *DelCommand

type DocMenu

type DocMenu struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type Document

type Document struct {
	Id      string `json:"id"`
	Objid   int    `json:"objid"`
	Objtype int    `json:"objtype"`
	Title   string `json:"title"`
	Author  string `json:"author"`
	Uid     int    `json:"uid"`
	PubTime string `json:"pub_time"`
	Content string `json:"content"`
	Tags    string `json:"tags"`
	Viewnum int    `json:"viewnum"`
	Cmtnum  int    `json:"cmtnum"`
	Likenum int    `json:"likenum"`

	Lastreplyuid  int       `json:"lastreplyuid"`
	Lastreplytime OftenTime `json:"lastreplytime"`

	CreatedAt OftenTime `json:"created_at"`
	UpdatedAt OftenTime `json:"updated_at"`

	// 排序用的时间
	SortTime OftenTime `json:"sort_time"`

	Top uint8 `json:"top"`

	Nid int `json:"nid"`

	HlTitle   string `json:",omitempty"` // 高亮的标题
	HlContent string `json:",omitempty"` // 高亮的内容
}

文档对象(供solr使用)

func NewDocument

func NewDocument(object interface{}, objectExt interface{}) *Document

type Download

type Download struct {
	Id          int `xorm:"pk autoincr"`
	Version     string
	Filename    string
	Kind        string
	OS          string `xorm:"os"`
	Arch        string
	Size        int
	Checksum    string
	Category    int
	IsRecommend bool
	Seq         int
	CreatedAt   time.Time `xorm:"created"`
}

Download go 下载

type Dynamic

type Dynamic struct {
	Id      int       `json:"id" xorm:"pk autoincr"`
	Content string    `json:"content"`
	Dmtype  int       `json:"dmtype"`
	Url     string    `json:"url"`
	Seq     int       `json:"seq"`
	Ctime   time.Time `json:"ctime" xorm:"created"`
}

动态(go动态;本站动态等)

type Favorite

type Favorite struct {
	Uid     int    `json:"uid"`
	Objtype int    `json:"objtype"`
	Objid   int    `json:"objid"`
	Ctime   string `json:"ctime" xorm:"<-"`
}

用户收藏(用户可以收藏文章、话题、资源等)

func (*Favorite) TableName

func (*Favorite) TableName() string

type Feed

type Feed struct {
	Id            int `xorm:"pk autoincr"`
	Title         string
	Objid         int
	Objtype       int
	Uid           int
	Author        string
	Nid           int
	Lastreplyuid  int
	Lastreplytime OftenTime
	Tags          string
	Cmtnum        int
	Likenum       int
	Top           uint8
	Seq           int
	State         int
	CreatedAt     OftenTime `xorm:"created"`
	UpdatedAt     OftenTime `json:"updated_at" xorm:"<-"`

	User          *User                  `xorm:"-"`
	Lastreplyuser *User                  `xorm:"-"`
	Node          map[string]interface{} `xorm:"-"`
	Uri           string                 `xorm:"-"`
}

type FooterNav

type FooterNav struct {
	Name      string `json:"name"`
	Url       string `json:"url"`
	OuterSite bool   `json:"outer_site"`
}
type FriendLink struct {
	Id        int       `json:"-" xorm:"pk autoincr"`
	Name      string    `json:"name"`
	Url       string    `json:"url"`
	Seq       int       `json:"-"`
	CreatedAt time.Time `json:"-" xorm:"created"`
}
type FriendLogo struct {
	Image  string `json:"image"`
	Url    string `json:"url"`
	Name   string `json:"name"`
	Width  string `json:"width"`
	Height string `json:"height"`
}

type GCTTGit

type GCTTGit struct {
	Id            int `xorm:"pk autoincr"`
	Username      string
	Md5           string
	Title         string
	PR            int `xorm:"pr"`
	TranslatingAt int64
	TranslatedAt  int64
	Words         int
	ArticleId     int
	CreatedAt     time.Time `xorm:"<-"`
}

func (*GCTTGit) TableName

func (*GCTTGit) TableName() string

type GCTTIssue

type GCTTIssue struct {
	Id            int `xorm:"pk autoincr"`
	Translator    string
	Email         string
	Title         string
	TranslatingAt int64
	TranslatedAt  int64
	Label         string
	State         uint8
	CreatedAt     time.Time `xorm:"<-"`
}

func (*GCTTIssue) TableName

func (*GCTTIssue) TableName() string

type GCTTTimeLine

type GCTTTimeLine struct {
	Id        int `xorm:"pk autoincr"`
	Content   string
	CreatedAt time.Time
}

func (*GCTTTimeLine) TableName

func (*GCTTTimeLine) TableName() string

type GCTTUser

type GCTTUser struct {
	Id        int `xorm:"pk autoincr"`
	Username  string
	Avatar    string
	Uid       int
	JoinedAt  int64
	LastAt    int64
	Num       int
	Words     int
	AvgTime   int
	Role      int
	CreatedAt time.Time `xorm:"<-"`

	RoleName string `xorm:"-"`
	Fa       string `xorm:"-"`
}

func (*GCTTUser) AfterSet

func (this *GCTTUser) AfterSet(name string, cell xorm.Cell)

func (*GCTTUser) TableName

func (*GCTTUser) TableName() string

type Gift

type Gift struct {
	Id          int `json:"id" xorm:"pk autoincr"`
	Name        string
	Description string
	Price       int
	TotalNum    int
	RemainNum   int
	ExpireTime  time.Time `xorm:"int"`
	Supplier    string
	BuyLimit    int
	Typ         int
	State       int
	CreatedAt   OftenTime `xorm:"<-"`

	TypShow string `xorm:"-"`
}

func (*Gift) AfterSet

func (this *Gift) AfterSet(name string, cell xorm.Cell)

type GiftRedeem

type GiftRedeem struct {
	Id        int `json:"id" xorm:"pk autoincr"`
	GiftId    int
	Code      string
	Exchange  int
	Uid       int
	UpdatedAt OftenTime `xorm:"<-"`
}

type GiteaUser

type GiteaUser = gitea.User

type GithubUser

type GithubUser struct {
	Id        int    `json:"id"`
	Login     string `json:"login"`
	AvatarUrl string `json:"avatar_url"`
	Email     string `json:"email"`
	Name      string `json:"name"`
	Company   string `json:"company"`
	Blog      string `json:"blog"`
	Location  string `json:"location"`
}

type Highlighting

type Highlighting struct {
	Title   []string `json:"title"`
	Content []string `json:"content"`
}

type Image

type Image struct {
	Pid    int `xorm:"pk autoincr"`
	Md5    string
	Path   string
	Size   int
	Width  int
	Height int
}

图片

type IndexNav

type IndexNav struct {
	Tab        string           `json:"tab"`
	Name       string           `json:"name"`
	DataSource string           `json:"data_source"`
	Children   []*IndexNavChild `json:"children"`
}

type IndexNavChild

type IndexNavChild struct {
	Uri  string `json:"uri"`
	Name string `json:"name"`
}

type InterviewQuestion

type InterviewQuestion struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Sn        int64     `json:"sn"`
	ShowSn    string    `json:"show_sn" xorm:"-"`
	Question  string    `json:"question"`
	Answer    string    `json:"answer"`
	Level     int       `json:"level"`
	Viewnum   int       `json:"viewnum"`
	Cmtnum    int       `json:"cmtnum"`
	Likenum   int       `json:"likenum"`
	Source    string    `json:"source"`
	CreatedAt time.Time `json:"created_at" xorm:"created"`
}

Go 面试题

func (*InterviewQuestion) AfterInsert

func (iq *InterviewQuestion) AfterInsert()

func (*InterviewQuestion) AfterSet

func (iq *InterviewQuestion) AfterSet(name string, cell xorm.Cell)

type LearningMaterial

type LearningMaterial struct {
	Id        int       `json:"-" xorm:"pk autoincr"`
	Title     string    `json:"title"`
	Url       string    `json:"url"`
	Type      int       `json:"type"`
	Seq       int       `json:"-"`
	FirstUrl  string    `json:"first_url"`
	CreatedAt time.Time `json:"-" xorm:"created"`
}

type Like

type Like struct {
	Uid     int       `json:"uid"`
	Objid   int       `json:"objid"`
	Objtype int       `json:"objtype"`
	Flag    int       `json:"flag"`
	Ctime   time.Time `json:"ctime" xorm:"<-"`
}

赞(喜欢)

func (*Like) TableName

func (*Like) TableName() string

type Me

type Me struct {
	Uid       int       `json:"uid"`
	Username  string    `json:"username"`
	Name      string    `json:"name"`
	Monlog    string    `json:"monlog"`
	Email     string    `json:"email"`
	Avatar    string    `json:"avatar"`
	Status    int       `json:"status"`
	MsgNum    int       `json:"msgnum"`
	IsAdmin   bool      `json:"isadmin"`
	IsRoot    bool      `json:"is_root"`
	DauAuth   int       `json:"dau_auth"`
	IsVip     bool      `json:"is_vip"`
	CreatedAt time.Time `json:"created_at"`

	Balance int `json:"balance"`
	Gold    int `json:"gold"`
	Silver  int `json:"silver"`
	Copper  int `json:"copper"`

	RoleIds []int `json:"-"`
}

Me 代表当前用户

type Message

type Message struct {
	Id      int       `json:"id" xorm:"pk autoincr"`
	Content string    `json:"content"`
	Hasread string    `json:"hasread"`
	From    int       `json:"from"`
	Fdel    string    `json:"fdel"`
	To      int       `json:"to"`
	Tdel    string    `json:"tdel"`
	Ctime   OftenTime `json:"ctime" xorm:"created"`
}

短消息

type Mission

type Mission struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Name      string    `json:"name"`
	Type      int       `json:"type"`
	Fixed     int       `json:"fixed"`
	Min       int       `json:"min"`
	Max       int       `json:"max"`
	Incr      int       `json:"incr"`
	State     int       `json:"state"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`
}

type MorningReading

type MorningReading struct {
	Id       int       `json:"id" xorm:"pk autoincr"`
	Content  string    `json:"content"`
	Rtype    int       `json:"rtype"`
	Inner    int       `json:"inner"`
	Url      string    `json:"url"`
	Moreurls string    `json:"moreurls"`
	Username string    `json:"username"`
	Clicknum int       `json:"clicknum,omitempty"`
	Ctime    OftenTime `json:"ctime" xorm:"<-"`

	// 晨读日期,从 ctime 中提取
	Rdate string `json:"rdate,omitempty" xorm:"-"`

	Urls []string `json:"urls" xorm:"-"`
}

技术晨读

func (*MorningReading) AfterSet

func (this *MorningReading) AfterSet(name string, cell xorm.Cell)

type NodeInfo

type NodeInfo struct {
	RecommendNode `xorm:"extends"`
	TopicNode     `xorm:"extends"`
}

func (*NodeInfo) TableName

func (*NodeInfo) TableName() string

type OftenTime

type OftenTime time.Time

func NewOftenTime

func NewOftenTime() OftenTime

func (OftenTime) MarshalBinary

func (self OftenTime) MarshalBinary() ([]byte, error)

func (OftenTime) MarshalJSON

func (self OftenTime) MarshalJSON() ([]byte, error)

func (OftenTime) MarshalText

func (self OftenTime) MarshalText() ([]byte, error)

func (OftenTime) String

func (self OftenTime) String() string

func (*OftenTime) UnmarshalBinary

func (this *OftenTime) UnmarshalBinary(data []byte) error

func (*OftenTime) UnmarshalJSON

func (this *OftenTime) UnmarshalJSON(data []byte) (err error)

func (*OftenTime) UnmarshalText

func (this *OftenTime) UnmarshalText(data []byte) (err error)

type OpenProject

type OpenProject struct {
	Id            int       `json:"id" xorm:"pk autoincr"`
	Name          string    `json:"name"`
	Category      string    `json:"category"`
	Uri           string    `json:"uri"`
	Home          string    `json:"home"`
	Doc           string    `json:"doc"`
	Download      string    `json:"download"`
	Src           string    `json:"src"`
	Desc          string    `json:"desc"`
	Repo          string    `json:"repo"`
	Author        string    `json:"author"`
	Licence       string    `json:"licence"`
	Lang          string    `json:"lang"`
	Os            string    `json:"os"`
	Tags          string    `json:"tags"`
	Username      string    `json:"username,omitempty"`
	Viewnum       int       `json:"viewnum,omitempty"`
	Cmtnum        int       `json:"cmtnum,omitempty"`
	Likenum       int       `json:"likenum,omitempty"`
	Lastreplyuid  int       `json:"lastreplyuid"`
	Lastreplytime OftenTime `json:"lastreplytime"`
	Status        int       `json:"status"`
	Ctime         OftenTime `json:"ctime,omitempty" xorm:"created"`
	Mtime         OftenTime `json:"mtime,omitempty" xorm:"<-"`

	User *User `json:"user" xorm:"-"`
	// 排行榜阅读量
	RankView      int   `json:"rank_view" xorm:"-"`
	LastReplyUser *User `json:"last_reply_user" xorm:"-"`
}

开源项目信息

func (*OpenProject) AfterInsert

func (this *OpenProject) AfterInsert()

func (*OpenProject) AfterLoad

func (this *OpenProject) AfterLoad()

func (*OpenProject) AfterSet

func (this *OpenProject) AfterSet(name string, cell xorm.Cell)

func (*OpenProject) BeforeInsert

func (this *OpenProject) BeforeInsert()

type PageAd

type PageAd struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Path      string    `json:"path"`
	AdId      int       `json:"ad_id"`
	Position  string    `json:"position"`
	IsOnline  bool      `json:"is_online"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`
}

type RecommendNode

type RecommendNode struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Name      string    `json:"name"`
	Parent    int       `json:"parent"`
	Nid       int       `json:"nid"`
	Seq       int       `json:"seq"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`
}

推荐节点

type Resource

type Resource struct {
	Id            int       `json:"id" xorm:"pk autoincr"`
	Title         string    `json:"title"`
	Form          string    `json:"form"`
	Content       string    `json:"content"`
	Url           string    `json:"url"`
	Uid           int       `json:"uid"`
	Catid         int       `json:"catid"`
	CatName       string    `json:"-" xorm:"-"`
	Lastreplyuid  int       `json:"lastreplyuid"`
	Lastreplytime OftenTime `json:"lastreplytime"`
	Tags          string    `json:"tags"`
	Ctime         OftenTime `json:"ctime" xorm:"created"`
	Mtime         OftenTime `json:"mtime" xorm:"<-"`

	// 排行榜阅读量
	RankView int `json:"rank_view" xorm:"-"`
}

资源信息

func (*Resource) BeforeInsert

func (this *Resource) BeforeInsert()

type ResourceCat

type ResourceCat struct {
	Catid int    `json:"catid" xorm:"pk autoincr"`
	Name  string `json:"name"`
	Intro string `json:"intro"`
	Ctime string `json:"ctime" xorm:"<-"`
}

资源分类信息

func (*ResourceCat) TableName

func (*ResourceCat) TableName() string

type ResourceEx

type ResourceEx struct {
	Id      int       `json:"-" xorm:"pk"`
	Viewnum int       `json:"viewnum"`
	Cmtnum  int       `json:"cmtnum"`
	Likenum int       `json:"likenum"`
	Mtime   time.Time `json:"mtime" xorm:"<-"`
}

资源扩展(计数)信息

type ResourceInfo

type ResourceInfo struct {
	Resource   `xorm:"extends"`
	ResourceEx `xorm:"extends"`
}

func (*ResourceInfo) TableName

func (*ResourceInfo) TableName() string

type ResponseBody

type ResponseBody struct {
	NumFound int         `json:"numFound"`
	Start    int         `json:"start"`
	Docs     []*Document `json:"docs"`
}

type Role

type Role struct {
	Roleid int    `json:"roleid" xorm:"pk autoincr"`
	Name   string `json:"name"`
	OpUser string `json:"op_user"`
	Ctime  string `json:"ctime,omitempty" xorm:"created"`
	Mtime  string `json:"mtime,omitempty" xorm:"<-"`
}

角色信息

type RoleAuthority

type RoleAuthority struct {
	Roleid int    `json:"roleid" xorm:"pk autoincr"`
	Aid    int    `json:"aid"`
	OpUser string `json:"op_user"`
	Ctime  string `json:"ctime" xorm:"<-"`
}

角色权限信息

type SearchResponse

type SearchResponse struct {
	RespHeader map[string]interface{}   `json:"responseHeader"`
	RespBody   *ResponseBody            `json:"response"`
	Highlight  map[string]*Highlighting `json:"highlighting"`
}

type SearchStat

type SearchStat struct {
	Id      int       `json:"id" xorm:"pk autoincr"`
	Keyword string    `json:"keyword"`
	Times   int       `json:"times"`
	Ctime   time.Time `json:"ctime" xorm:"<-"`
}

搜索词统计

type Subject

type Subject struct {
	Id          int       `xorm:"pk autoincr" json:"id"`
	Name        string    `json:"name"`
	Cover       string    `json:"cover"`
	Description string    `json:"description"`
	Uid         int       `json:"uid"`
	Contribute  bool      `json:"contribute"`
	Audit       bool      `json:"audit"`
	ArticleNum  int       `json:"article_num"`
	CreatedAt   OftenTime `json:"created_at" xorm:"created"`
	UpdatedAt   OftenTime `json:"updated_at" xorm:"<-"`

	User *User `json:"user" xorm:"-"`
}

Subject 专栏

type SubjectAdmin

type SubjectAdmin struct {
	Id        int       `xorm:"pk autoincr" json:"id"`
	Sid       int       `json:"sid"`
	Uid       int       `json:"uid"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`
}

SubjectAdmin 专栏管理员

type SubjectArticle

type SubjectArticle struct {
	Id        int       `xorm:"pk autoincr" json:"id"`
	Sid       int       `json:"sid"`
	ArticleId int       `json:"article_id"`
	State     int       `json:"state"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`
}

SubjectArticle 专栏文章

type SubjectArticles

type SubjectArticles struct {
	Article   `xorm:"extends"`
	Sid       int
	CreatedAt time.Time
}

SubjectArticles xorm join 需要

func (*SubjectArticles) TableName

func (*SubjectArticles) TableName() string

type SubjectFollower

type SubjectFollower struct {
	Id        int       `xorm:"pk autoincr" json:"id"`
	Sid       int       `json:"sid"`
	Uid       int       `json:"uid"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`

	User    *User  `xorm:"-"`
	TimeAgo string `xorm:"-"`
}

SubjectFollower 专栏关注者

type SystemMessage

type SystemMessage struct {
	Id      int       `json:"id" xorm:"pk autoincr"`
	Msgtype int       `json:"msgtype"`
	Hasread string    `json:"hasread"`
	To      int       `json:"to"`
	Ctime   OftenTime `json:"ctime" xorm:"created"`

	// 扩展信息,json格式
	Ext string
}

系统消息

func (*SystemMessage) GetExt

func (this *SystemMessage) GetExt() map[string]interface{}

func (*SystemMessage) SetExt

func (this *SystemMessage) SetExt(ext map[string]interface{})

type Topic

type Topic struct {
	Tid           int       `xorm:"pk autoincr" json:"tid"`
	Title         string    `json:"title"`
	Content       string    `json:"content"`
	Nid           int       `json:"nid"`
	Uid           int       `json:"uid"`
	Flag          uint8     `json:"flag"`
	Lastreplyuid  int       `json:"lastreplyuid"`
	Lastreplytime OftenTime `json:"lastreplytime"`
	EditorUid     int       `json:"editor_uid"`
	Top           uint8     `json:"top"`
	TopTime       int64     `json:"top_time"`
	Tags          string    `json:"tags"`
	Permission    int       `json:"permission"`
	CloseReply    bool      `json:"close_reply"`
	Ctime         OftenTime `json:"ctime" xorm:"created"`
	Mtime         OftenTime `json:"mtime" xorm:"<-"`

	// 为了方便,加上Node(节点名称,数据表没有)
	Node string `xorm:"-"`
	// 排行榜阅读量
	RankView int `json:"rank_view" xorm:"-"`
}

社区主题信息

func (*Topic) BeforeInsert

func (this *Topic) BeforeInsert()

func (*Topic) TableName

func (*Topic) TableName() string

type TopicAppend

type TopicAppend struct {
	Id        int `xorm:"pk autoincr"`
	Tid       int
	Content   string
	CreatedAt OftenTime `xorm:"<-"`
}

type TopicEx

type TopicEx struct {
	Tid   int       `json:"-"`
	View  int       `json:"view"`
	Reply int       `json:"reply"`
	Like  int       `json:"like"`
	Mtime time.Time `json:"mtime" xorm:"<-"`
}

社区主题扩展(计数)信息

func (*TopicEx) TableName

func (*TopicEx) TableName() string

type TopicInfo

type TopicInfo struct {
	Topic   `xorm:"extends"`
	TopicEx `xorm:"extends"`
}

func (*TopicInfo) TableName

func (*TopicInfo) TableName() string

type TopicNode

type TopicNode struct {
	Nid       int       `json:"nid" xorm:"pk autoincr"`
	Parent    int       `json:"parent"`
	Name      string    `json:"name"`
	Ename     string    `json:"ename"`
	Seq       int       `json:"seq"`
	Intro     string    `json:"intro"`
	ShowIndex bool      `json:"show_index"`
	Ctime     time.Time `json:"ctime" xorm:"<-"`

	Level int `json:"-" xorm:"-"`
}

社区主题节点信息

func (*TopicNode) TableName

func (*TopicNode) TableName() string

type TopicUpEx

type TopicUpEx struct {
	Tid   int       `json:"-" xorm:"pk"`
	View  int       `json:"view"`
	Reply int       `json:"reply"`
	Like  int       `json:"like"`
	Mtime time.Time `json:"mtime" xorm:"<-"`
}

社区主题扩展(计数)信息,用于 incr 更新

func (*TopicUpEx) TableName

func (*TopicUpEx) TableName() string

type User

type User struct {
	Uid         int       `json:"uid" xorm:"pk autoincr"`
	Username    string    `json:"username" validate:"min=4,max=20,regexp=^[a-zA-Z0-9_]*$"`
	Email       string    `json:"email"`
	Open        int       `json:"open"`
	Name        string    `json:"name"`
	Avatar      string    `json:"avatar"`
	City        string    `json:"city"`
	Company     string    `json:"company"`
	Github      string    `json:"github"`
	Gitea       string    `json:"gitea"`
	Weibo       string    `json:"weibo"`
	Website     string    `json:"website"`
	Monlog      string    `json:"monlog"`
	Introduce   string    `json:"introduce"`
	Unsubscribe int       `json:"unsubscribe"`
	Balance     int       `json:"balance"`
	IsThird     int       `json:"is_third"`
	DauAuth     int       `json:"dau_auth"`
	IsVip       bool      `json:"is_vip"`
	VipExpire   int       `json:"vip_expire"`
	Status      int       `json:"status"`
	IsRoot      bool      `json:"is_root"`
	Ctime       OftenTime `json:"ctime" xorm:"created"`
	Mtime       time.Time `json:"mtime" xorm:"<-"`

	// 非用户表中的信息,为了方便放在这里
	Roleids   []int    `xorm:"-"`
	Rolenames []string `xorm:"-"`

	// 活跃度
	Weight int `json:"weight" xorm:"-"`
	Gold   int `json:"gold" xorm:"-"`
	Silver int `json:"silver" xorm:"-"`
	Copper int `json:"copper" xorm:"-"`

	IsOnline bool `json:"is_online" xorm:"-"`
}

用户基本信息

func (*User) AfterSet

func (this *User) AfterSet(name string, cell xorm.Cell)

func (*User) String

func (this *User) String() string

func (*User) TableName

func (this *User) TableName() string

type UserActive

type UserActive struct {
	Uid      int       `json:"uid" xorm:"pk"`
	Username string    `json:"username"`
	Email    string    `json:"email"`
	Avatar   string    `json:"avatar"`
	Weight   int       `json:"weight"`
	Mtime    time.Time `json:"mtime" xorm:"<-"`
}

活跃用户信息 活跃度规则:

1、注册成功后 +2
2、登录一次 +1
3、修改资料 +1
4、发帖子 + 10
5、评论 +5
6、创建Wiki页 +10

type UserBalanceDetail

type UserBalanceDetail struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Uid       int       `json:"uid"`
	Type      int       `json:"type"`
	Num       int       `json:"num"`
	Balance   int       `json:"balance"`
	Desc      string    `json:"desc"`
	CreatedAt time.Time `json:"created_at" xorm:"<-"`

	TypeShow string `json:"type_show" xorm:"-"`
}

func (*UserBalanceDetail) AfterSet

func (this *UserBalanceDetail) AfterSet(name string, cell xorm.Cell)

type UserExchangeRecord

type UserExchangeRecord struct {
	Id         int `json:"id" xorm:"pk autoincr"`
	GiftId     int
	Uid        int
	Remark     string
	ExpireTime time.Time `xorm:"int"`
	CreatedAt  OftenTime `xorm:"<-"`
}

type UserLogin

type UserLogin struct {
	Uid       int       `json:"uid" xorm:"pk"`
	Username  string    `json:"username"`
	Passcode  string    `json:"passcode"` // 加密随机串
	Passwd    string    `json:"passwd"`
	Email     string    `json:"email"`
	LoginIp   string    `json:"login_ip"`
	LoginTime time.Time `json:"login_time" xorm:"<-"`
}

用户登录信息

func (*UserLogin) GenMd5Passwd

func (this *UserLogin) GenMd5Passwd() error

生成加密密码

func (*UserLogin) TableName

func (this *UserLogin) TableName() string

type UserLoginMission

type UserLoginMission struct {
	Uid       int       `json:"uid" xorm:"pk"`
	Date      int       `json:"date"`
	Award     int       `json:"award"`
	Days      int       `json:"days"`
	TotalDays int       `json:"total_days"`
	UpdatedAt time.Time `json:"updated_at" xorm:"<-"`
}

type UserRecharge

type UserRecharge struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Uid       int       `json:"uid"`
	Amount    int       `json:"amount"`
	Channel   string    `json:"channel"`
	Remark    string    `json:"remark"`
	CreatedAt time.Time `json:"created_at"`
}

type UserRole

type UserRole struct {
	Uid    int `json:"uid"`
	Roleid int `json:"roleid"`
	// contains filtered or unexported fields
}

用户角色信息

type UserSetting

type UserSetting struct {
	Id        int `xorm:"pk autoincr"`
	Key       string
	Value     int
	CreatedAt time.Time `xorm:"created"`
}

type ViewRecord

type ViewRecord struct {
	Id        int       `json:"id" xorm:"pk autoincr"`
	Objid     int       `json:"objid"`
	Objtype   int       `json:"objtype"`
	Uid       int       `json:"uid"`
	CreatedAt OftenTime `json:"created_at" xorm:"<-"`
}

type ViewSource

type ViewSource struct {
	Id        int `xorm:"pk autoincr"`
	Objid     int
	Objtype   int
	Google    int
	Baidu     int
	Bing      int
	Sogou     int
	So        int
	Other     int
	UpdatedAt OftenTime `xorm:"<-"`
}

type WechatAutoReply

type WechatAutoReply struct {
	Id        int `xorm:"pk autoincr"`
	Typ       uint8
	Word      string
	MsgType   string
	Content   string
	CreatedAt time.Time `xorm:"created"`
	UpdatedAt time.Time `xorm:"<-"`
}

WechatAutoReply 微信自动回复

type WechatImage

type WechatImage struct {
	MediaId *CData
}

type WechatMsg

type WechatMsg struct {
	ToUserName   string
	FromUserName string
	CreateTime   int64
	MsgType      string
	Content      string
	MsgId        int64

	// 图片消息
	PicUrl  string
	MediaId string

	// 音频消息
	Format string

	// 视频或短视频
	ThumbMediaId string

	// 地理位置消息
	Location_X float64
	Location_Y float64
	Scale      int
	Label      string

	// 链接消息
	Title       string
	Description string
	Url         string

	// 事件
	Event string
}

type WechatReply

type WechatReply struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   *CData
	FromUserName *CData
	CreateTime   int64
	MsgType      *CData
	Content      *CData       `xml:",omitempty"`
	Image        *WechatImage `xml:",omitempty"`
}

type WechatUser

type WechatUser struct {
	Id         int `xorm:"pk autoincr"`
	Openid     string
	Nickname   string
	Avatar     string
	SessionKey string
	OpenInfo   string
	Uid        int
	CreatedAt  time.Time `xorm:"created"`
	UpdatedAt  time.Time `xorm:"<-"`
}

微信绑定用户信息

type Wiki

type Wiki struct {
	Id      int       `json:"id" xorm:"pk autoincr"`
	Title   string    `json:"title"`
	Content string    `json:"content"`
	Uri     string    `json:"uri"`
	Uid     int       `json:"uid"`
	Cuid    string    `json:"cuid"`
	Viewnum int       `json:"viewnum"`
	Tags    string    `json:"tags"`
	Ctime   OftenTime `json:"ctime" xorm:"created"`
	Mtime   time.Time `json:"mtime" xorm:"<-"`

	Users map[int]*User `xorm:"-"`
}

func (*Wiki) BeforeInsert

func (this *Wiki) BeforeInsert()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL