Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAppoint1 = errors.New("only the owner can appoint the administrator")
View Source
var ErrAppoint2 = errors.New("only the administrator can appoint others")
View Source
var ErrHasOwner = errors.New("there can only be one owner")
View Source
var ErrNoOwner = errors.New("owner permissions cannot be revoked")
View Source
var ErrNoSubmitter = errors.New("the post has no submitter")
View Source
var ErrSubmitted = errors.New("您已提交过")
View Source
var TestPost = &Post{ Platform: "weibo", Uid: "7198559139", Name: "七海Nana7mi", Avatar: Attachment{Url: "https://wx4.sinaimg.cn/orj480/007Raq4zly8hd1vqpx3coj30u00u00uv.jpg"}, Follower: "104.8万", Following: "192", Description: "蓝色饭团", Mid: "4952487292307646", Time: "1696248446", Text: `<span class="url-icon"><img alt=[good] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_good-0c51afc69c.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[good] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_good-0c51afc69c.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[good] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_good-0c51afc69c.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[good] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_good-0c51afc69c.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[赞] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_zan-44ddc70637.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[赞] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_zan-44ddc70637.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[赞] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_zan-44ddc70637.png" style="width:1em; height:1em;" /></span><span class="url-icon"><img alt=[赞] src="https://h5.sinaimg.cn/m/emoticon/icon/others/h_zan-44ddc70637.png" style="width:1em; height:1em;" /></span>`, Source: "🦈iPhone 14 Pro Max", Submitter: &User{Uid: "188888131", Permission: Owner}, Repost: &Post{ Platform: "weibo", Uid: "2203177060", Name: "阿梓从小就很可爱", Avatar: Attachment{Url: "https://wx4.sinaimg.cn/orj480/8351d064ly8hiph621dryj20u00u00vw.jpg"}, Follower: "61.9万", Following: "306", Description: "本人只喜欢读书", Mid: "4952449691946355", Time: "1696239481", Text: "[看书] ", Source: "iPhone 13 Pro Max", Attachments: []Attachment{{Url: "https://wx2.sinaimg.cn/large/8351d064ly1hih23pb486j21tk19k7wk.jpg"}}, Submitter: &User{Uid: "188888131"}, Repost: &Post{}, }, }
测试博文
Functions ¶
func ConvertURL ¶
Types ¶
type Attachment ¶
func (*Attachment) AfterCreate ¶
func (a *Attachment) AfterCreate(tx *gorm.DB) error
func (*Attachment) Download ¶
func (a *Attachment) Download() (err error)
func (*Attachment) Get ¶
func (a *Attachment) Get() *request.Result
func (*Attachment) MustDownload ¶
func (a *Attachment) MustDownload(sleep float64)
type Job ¶
type Job struct {
gorms.Model[uint64]
// 软删除
Deleted gorm.DeletedAt `json:"-"`
// 所有者
UserUid string `json:"-"`
// 监听样式
Pattern string `form:"pattern" json:"pattern" yaml:"pattern"`
// 任务参数
request.Job
}
任务
type OrderedPost ¶
func (OrderedPost) TableName ¶
func (OrderedPost) TableName() string
type Permission ¶
type Permission uint64
权限
const ( Owner Permission = 1 << iota Administrator Trustor )
func (Permission) Check ¶
func (p Permission) Check(n Permission) error
func (Permission) Has ¶
func (p Permission) Has(permissions ...Permission) bool
func (Permission) Is ¶
func (p Permission) Is(permissions ...Permission) bool
func (Permission) IsAdmin ¶
func (p Permission) IsAdmin() bool
func (Permission) IsTrusted ¶
func (p Permission) IsTrusted() bool
type Post ¶
type Post struct {
gorms.Model[uint64] `form:"-" json:"-"`
// 平台
Platform string `form:"platform" json:"platform"`
// 平台序号
Uid string `form:"uid" json:"uid" cmps:"1"`
// 昵称
Name string `form:"name" json:"name"`
// 粉丝数
Follower string `form:"follower" json:"follower"`
// 关注数
Following string `form:"following" json:"following"`
// 简介
Description string `form:"description" json:"description"`
// 头像
AvatarUrl string `gorm:"column:avatar"`
Avatar Attachment `form:"avatar" json:"avatar"`
// 装扮
PendantUrl string `gorm:"column:pendant"`
Pendant Attachment `form:"pendant" json:"pendant"`
// 头图
BannerUrl string `gorm:"column:banner"`
Banner Attachment `form:"banner" json:"banner"`
// 博文序号
Mid string `form:"mid" json:"mid"`
// 发送时间
Time string `form:"time" json:"time"`
// 文本
Text string `form:"text" json:"text"`
// 来源
Source string `form:"source" json:"source"`
// 附件
Attachments []Attachment `gorm:"many2many:post_attachments" form:"attachments" json:"attachments"`
// 标签
Tags []Tag
// 提交者
Submitter *User `form:"-" json:"submitter"`
// 回复
RepostID *uint64 `form:"-" json:"-" gorm:"column:repost"`
Repost *Post `form:"repost" json:"repost"`
// 评论
CommentID *uint64 `form:"-" json:"-" gorm:"column:comment"`
Comments []Post `form:"comments" json:"comments" gorm:"foreignKey:CommentID"`
// contains filtered or unexported fields
}
博文
type User ¶
type User struct {
Permission `json:"permission"`
// b站序号
Uid string `json:"uid" gorm:"primaryKey"`
// 鉴权码
Auth string `json:"auth,omitempty"`
// 经验
Exp int64 `json:"exp"`
// 账户下任务
Jobs []Job `json:"jobs,omitempty" gorm:"foreignKey:UserUid"`
// 关注的账号
Follow pq.StringArray `gorm:"type:text[]" json:"follow,omitempty"`
}
提交者
func (*User) RemoveJobs ¶
Click to show internal directories.
Click to hide internal directories.