qq_bot/handler/rss/model.go

56 lines
1.9 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 rss
import "time"
// RSS源订阅信息-如果没有对应的订阅信息关联,则应该被清除
type RssFeed struct {
ID int `json:"id" gorm:"primaryKey"`
FeedURL string `json:"feed_url" gorm:"feed_url"`
Creator string `json:"creator" gorm:"creator"`
LastUpdate time.Time `json:"last_update" gorm:"last_update"`
}
// 群订阅信息-通过此数据定时检测最新的rss数据是否有更新若有则向对应群发送消息
type RssSubscribe struct {
ID int `json:"id" gorm:"primaryKey"`
FeedID int `json:"feed_id" gorm:"feed_id"`
GroupID int `json:"group_id" gorm:"group_id"`
Creator int `json:"creator" gorm:"creator"`
CreateAt time.Time `json:"create_at" gorm:"create_at"`
LastItemHash string `json:"last_item_hash" gorm:"last_item_hash"`
}
// RSS条目信息
type RssItem struct {
Title string `json:"title"` // 标题
Link string `json:"link"` // 链接
Description string `json:"description"` // 描述
PubDate time.Time `json:"pub_date"` // 发布时间
GUID string `json:"guid"` // 全局唯一标识符
Author string `json:"author"` // 作者
Category string `json:"category"` // 分类
Hash string `json:"hash"` // 内容哈希值,用于检测更新
}
// RSS Feed结构体用于解析XML
type RSSFeed struct {
XMLName string `xml:"rss"`
Channel struct {
Title string `xml:"title"`
Link string `xml:"link"`
Description string `xml:"description"`
Items []RSSItem `xml:"item"`
} `xml:"channel"`
}
// RSS Item结构体用于解析XML中的item
type RSSItem struct {
Title string `xml:"title"`
Link string `xml:"link"`
Description string `xml:"description"`
PubDate string `xml:"pubDate"`
GUID string `xml:"guid"`
Author string `xml:"author"`
Category string `xml:"category"`
}