Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSubmitted = errors.New("您已提交过")
View Source
var (
Posts db.DB
)
View Source
var TestPost = &Post{ Platform: "weibo", 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", Blogger: Blogger{ Platform: "weibo", Uid: "7198559139", Name: "七海Nana7mi", Create: "1699116457", Follower: "104.8万", Following: "192", Description: "蓝色饭团", Face: Attachment{ Url: "https://wx4.sinaimg.cn/orj480/007Raq4zly8hd1vqpx3coj30u00u00uv.jpg", }, }, Repost: &Post{ Platform: "weibo", Mid: "4952449691946355", Time: "1696239481", Text: "[看书] ", Source: "iPhone 13 Pro Max", Blogger: Blogger{ Platform: "weibo", Uid: "2203177060", Name: "阿梓从小就很可爱", Create: "1699116457", Follower: "61.9万", Following: "306", Description: "本人只喜欢读书", Face: Attachment{ Url: "https://wx4.sinaimg.cn/orj480/8351d064ly8hiph621dryj20u00u00vw.jpg", }, }, Comments: make([]Post, 0), Attachments: Attachments{ {Url: "https://wx2.sinaimg.cn/large/8351d064ly1hih23pb486j21tk19k7wk.jpg"}, }, Submitter: &user.User{Uid: "188888131", Permission: 1}, }, Comments: make([]Post, 0), Attachments: make(Attachments, 0), Submitter: &user.User{Uid: "188888131", Permission: 1}, }
测试博文
Functions ¶
func CheckFiles ¶ added in v0.6.0
func CheckFiles() error
Types ¶
type Attachment ¶
type Attachment struct { db.Model // 原网址 Url string `json:"url" form:"url" gorm:"unique;not null" cmps:"1"` // 本站链接 Link string `json:"link"` // 本地路径 Local string `json:"-"` // 同浏览器 MIME type 附件的媒体类型 MIME string `json:"MIME"` }
附件
func (*Attachment) Detect ¶ added in v0.11.4
func (a *Attachment) Detect(content []byte)
func (*Attachment) Init ¶ added in v0.13.0
func (a *Attachment) Init()
func (*Attachment) Save ¶ added in v0.7.0
func (a *Attachment) Save(_ any)
func (*Attachment) Store ¶
func (a *Attachment) Store(content []byte)
func (Attachment) String ¶
func (a Attachment) String() string
type Attachments ¶
type Attachments []Attachment
附件合集
func (Attachments) String ¶
func (as Attachments) String() string
func (Attachments) Urls ¶
func (as Attachments) Urls() string
type Blogger ¶
type Blogger struct { db.Model Platform string `form:"platform" json:"platform"` Uid string `form:"uid" json:"uid" cmps:"1"` Name string `form:"name" json:"name"` Create string `form:"create" json:"create"` Follower string `form:"follower" json:"follower"` Following string `form:"following" json:"following"` Description string `form:"description" json:"description"` FaceID int64 `gorm:"column:face" json:"-"` Face Attachment `form:"face" json:"face" default:"Save"` PendantID int64 `gorm:"column:pendant" json:"-"` Pendant Attachment `form:"pendant" json:"pendant" default:"Save"` }
博主信息部分
func (*Blogger) SetPlatform ¶ added in v0.10.0
type Post ¶
type Post struct { db.Model // 平台 Platform string `form:"platform" json:"platform"` // 博文序号 Mid string `form:"mid" json:"mid"` // 发送时间 Time string `form:"time" json:"time"` // 文本 Text string `form:"text" json:"text"` // 来源 Source string `form:"source" json:"source"` // 博主 BloggerID string `form:"-" json:"-" gorm:"column:blogger"` Blogger Blogger `form:"blogger" json:"blogger" default:"SetPlatform;initial.Default"` // 回复 RepostID *uint64 `form:"-" json:"-" gorm:"column:repost"` Repost *Post `form:"repost" json:"repost" binding:"omitempty" default:"SetRepost;initial.Default"` // 评论 CommentID *uint64 `form:"-" json:"-" gorm:"column:comment"` Comments []Post `form:"comments" json:"comments" gorm:"foreignKey:CommentID" default:"range.SetSubmitter;range.initial.Default"` // 附件 Attachments Attachments `form:"attachments" json:"attachments" gorm:"many2many:post_attachments;" default:"range.Save"` // 提交者 Submitter *user.User `form:"-" json:"submitter"` // 编辑距离 Distance int `gorm:"-" form:"-" json:"-" cmps:"1"` // contains filtered or unexported fields }
博文或评论
func (*Post) SetSubmitter ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.