domain

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package domain rsshub领域逻辑

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RssClientView

type RssClientView struct {
	Source   *RssSource
	Contents []*RssContent
}

RssClientView 频道视图

func (*RssClientView) Sort

func (r *RssClientView) Sort()

Sort ... order by Date desc

type RssContent

type RssContent struct {
	// Id 自增id
	ID          int64     `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	HashID      string    `gorm:"column:hash_id;unique"        json:"hash_id"`
	RssSourceID int64     `gorm:"column:rss_source_id;not null"   json:"rss_source_id"`
	Title       string    `gorm:"column:title"       json:"title"`
	Description string    `gorm:"column:description" json:"description"`
	Link        string    `gorm:"column:link"        json:"link"`
	Date        time.Time `gorm:"column:date"        json:"date"`
	Author      string    `gorm:"column:author"      json:"author"`
	Thumbnail   string    `gorm:"column:thumbnail"   json:"thumbnail"`
	Content     string    `gorm:"column:content"     json:"content"`
	// Mtime update time
	Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"`
}

RssContent 订阅的RSS频道的推送信息

func (RssContent) TableName

func (RssContent) TableName() string

TableName ...

type RssDomain

type RssDomain struct {
	// contains filtered or unexported fields
}

RssDomain RssRepo定义

func NewRssDomain

func NewRssDomain(dbPath string) (*RssDomain, error)

NewRssDomain 新建RssDomain,调用方保证单例模式

func (*RssDomain) GetSubscribedChannelsByGroupID

func (repo *RssDomain) GetSubscribedChannelsByGroupID(ctx context.Context, gid int64) ([]*RssClientView, error)

GetSubscribedChannelsByGroupID 获取群对应的订阅的频道信息

func (*RssDomain) Subscribe

func (repo *RssDomain) Subscribe(ctx context.Context, gid int64, feedPath string) (
	rv *RssClientView, isChannelExisted, isSubExisted bool, err error)

Subscribe QQ群订阅Rss频道

func (*RssDomain) Sync

func (repo *RssDomain) Sync(ctx context.Context) (groupView map[int64][]*RssClientView, err error)

Sync 同步任务,按照群组订阅情况做好map切片

func (*RssDomain) Unsubscribe

func (repo *RssDomain) Unsubscribe(ctx context.Context, gid int64, feedPath string) (err error)

Unsubscribe 群组取消订阅

type RssHubClient

type RssHubClient struct {
	*http.Client
}

RssHubClient rss hub client (http)

func (*RssHubClient) FetchFeed

func (c *RssHubClient) FetchFeed(path string) (feed *gofeed.Feed, err error)

FetchFeed 获取rss feed信息

type RssSource

type RssSource struct {
	// Id 自增id
	ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	// RssHubFeedPath 频道路由 用于区分rss_hub 不同的频道 例如: `/bangumi/tv/calendar/today`
	RssHubFeedPath string `gorm:"column:rss_hub_feed_path;not null;unique;" json:"rss_hub_feed_path"`
	// Title 频道标题
	Title string `gorm:"column:title"        json:"title"`
	// ChannelDesc 频道描述
	ChannelDesc string `gorm:"column:channel_desc" json:"channel_desc"`
	// ImageURL 频道图片
	ImageURL string `gorm:"column:image_url"    json:"image_url"`
	// Link 频道链接
	Link string `gorm:"column:link"         json:"link"`
	// UpdatedParsed RSS页面更新时间
	UpdatedParsed time.Time `gorm:"column:updated_parsed" json:"updated_parsed"`
	// Mtime update time
	Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"`
}

RssSource RSS频道

func (RssSource) IfNeedUpdate

func (r RssSource) IfNeedUpdate(cmp *RssSource) bool

IfNeedUpdate ...

func (RssSource) TableName

func (RssSource) TableName() string

TableName ...

type RssSubscribe

type RssSubscribe struct {
	// Id 自增id
	ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	// 订阅群组
	GroupID int64 `gorm:"column:group_id;not null;uniqueIndex:uk_sid_gid"`
	// 订阅频道
	RssSourceID int64 `gorm:"column:rss_source_id;not null;uniqueIndex:uk_sid_gid"`
	// Mtime update time
	Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"`
}

RssSubscribe 订阅关系表:群组-RSS频道

func (RssSubscribe) TableName

func (RssSubscribe) TableName() string

TableName ...

Jump to

Keyboard shortcuts

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