Documentation ¶
Index ¶
- Constants
- Variables
- func DownImg(rawurl string) (string, error)
- func Init()
- type Admin
- func (this *Admin) Delete(id uint32) error
- func (this *Admin) Get(id uint32) *models.Admin
- func (this *Admin) GetAll() []*models.Admin
- func (this *Admin) GetMenus(adminId uint32) []*models.Role
- func (this *Admin) IsAccountExists(account string, filterId ...uint32) bool
- func (this *Admin) Login(account, password string) (*models.Admin, error)
- func (this *Admin) Save(admin *models.Admin) error
- func (this *Admin) UpdateLoginInfo(admin *models.Admin) error
- func (this *Admin) UpdatePwd(admin *models.Admin) error
- func (this *Admin) ValidPurview(adminId uint32, module, action string) bool
- type AdminLog
- type Banner
- func (this *Banner) Delete(id uint32) error
- func (this *Banner) DeleteBatch(ids []string) error
- func (this *Banner) Get(id uint32) *models.Banner
- func (this *Banner) GetAll(args map[string]interface{}) []*models.Banner
- func (this *Banner) Save(banner *models.Banner) error
- func (this Banner) Zones() map[uint8]string
- type Cate
- type Chapter
- func (this *Chapter) DelByNovId(novId uint32) error
- func (this *Chapter) Delete(id uint64, novId uint32) error
- func (this *Chapter) DeleteBatch(novId uint32, ids []string) error
- func (this *Chapter) Get(id uint64, novId uint32) *models.Chapter
- func (this *Chapter) GetEmptyChaps(novId uint32) []*models.Chapter
- func (this *Chapter) GetFirst(novId uint32) *models.Chapter
- func (this *Chapter) GetLast(novId uint32) *models.Chapter
- func (this *Chapter) GetNext(novId, chapNo uint32) *models.Chapter
- func (this *Chapter) GetNovChaps(novId uint32, size, offset int, sort string, isCount bool) ([]*models.Chapter, int64)
- func (this *Chapter) GetPre(novId, chapNo uint32) *models.Chapter
- func (this *Chapter) InsertMulti(chapters []*models.Chapter, isInit bool) error
- func (this *Chapter) Save(chapter *models.Chapter) error
- func (this *Chapter) UpdateEmpty(chapter *models.Chapter) error
- func (this *Chapter) UpdateViews(chapter *models.Chapter) error
- type Config
- func (this *Config) Bool(key string, def ...bool) bool
- func (this *Config) GetAll() map[string]string
- func (this *Config) Init()
- func (this *Config) Int(key string, def ...int) int
- func (this *Config) Int64(key string, def ...int64) int64
- func (this *Config) Set(key string, value string) error
- func (this *Config) String(key string, def ...string) string
- type Crawler
- type Feedback
- func (this *Feedback) Delete(id uint32) error
- func (this *Feedback) DeleteBatch(ids []string) error
- func (this *Feedback) Get(id uint32) *models.Feedback
- func (this *Feedback) GetAll(size, offset int, args map[string]interface{}) ([]*models.Feedback, int64)
- func (this *Feedback) Save(feed *models.Feedback) error
- type Group
- func (this *Group) Delete(id uint32) error
- func (this *Group) Get(id uint32) *models.Group
- func (this *Group) GetAll() []*models.Group
- func (this *Group) GetMenus(groupId uint32) []*models.Role
- func (this *Group) Save(group *models.Group) error
- func (this *Group) ValidPurview(groupId uint32, module, action string) bool
- type Novel
- func (this *Novel) AddLink(novId uint32, link, source, chapterLink string) error
- func (this *Novel) DelChapters(id uint32) error
- func (this *Novel) DelLink(id uint32) error
- func (this *Novel) Delete(id uint32) error
- func (this *Novel) DeleteBatch(ids []string) error
- func (this *Novel) Get(id uint32) *models.Novel
- func (this *Novel) GetAll(args models.ArgsNovelList) ([]*models.Novel, int64)
- func (this *Novel) GetByLink(link, source string) *models.NovelLinks
- func (this *Novel) GetByName(name string) *models.Novel
- func (this *Novel) GetCateRanks(cateId, size, offset int) []*models.Novel
- func (this *Novel) GetCollects(size, offset int) []*models.Novel
- func (this *Novel) GetEnds(size, offset int) []*models.Novel
- func (this *Novel) GetHots(size, offset int) []*models.Novel
- func (this *Novel) GetLinks(novId uint32) []*models.NovelLinks
- func (this *Novel) GetList(size, offset int, qs map[string]interface{}) ([]*models.Novel, int64)
- func (this *Novel) GetNewUps(size, offset int) []*models.Novel
- func (this *Novel) GetNews(size, offset int) []*models.Novel
- func (this *Novel) GetOriginals(size, offset int) []*models.Novel
- func (this *Novel) GetRanks(size, offset int) []*models.Novel
- func (this *Novel) GetRecs(size, offset int) []*models.Novel
- func (this *Novel) GetSignNewBooks(size, offset int) []*models.Novel
- func (this *Novel) GetTodayRecs(size, offset int) []*models.Novel
- func (this *Novel) GetVipRecs(size, offset int) []*models.Novel
- func (this *Novel) GetVipRewards(size, offset int) []*models.Novel
- func (this *Novel) GetVipUps(size, offset int) []*models.Novel
- func (this *Novel) IsExists(name string) bool
- func (this *Novel) Save(novel *models.Novel) error
- func (this *Novel) UpChapterInfo(novId uint32, novTextNum, chapterNum int, chapterId uint64, ...) error
- func (this *Novel) UpChapterTextNum(novId uint32, novTextNum int, isAdded bool) error
- func (this *Novel) UpNovelInfo(nov *models.Novel) error
- func (this *Novel) UpRecBatch(field string, books []string) error
- func (this *Novel) UpStatus(novId uint32, status uint8) error
- func (this *Novel) UpViews(novId uint32)
- type Proxy
- type Role
- func (this *Role) GetMenus(roleIds []string) []*models.Role
- func (this *Role) GetRole(id uint32) *models.Role
- func (this *Role) GetRoles(isTree ...bool) []*models.Role
- func (this *Role) Save(role *models.Role) error
- func (this *Role) ValidPurview(groupId uint32, module, action string, roleIds []string) bool
- type Search
- func (this *Search) Delete(id uint64) error
- func (this *Search) DeleteBatch(ids []string) error
- func (this *Search) GetAll(args models.ArgsSearchList) ([]*models.Search, int64)
- func (this *Search) GetRes(size int) []*models.Search
- func (this *Search) InsertOrIncrement(kw string, log *models.SearchLog) error
- func (this *Search) UpRec(id uint64, isRec uint8) error
- type SearchLog
- type Snatch
- func (this *Snatch) FindNovel(source, kw string) (*snatchs.SnatchInfo, error)
- func (this *Snatch) FindNovels(kw string) []*snatchs.SnatchInfo
- func (this *Snatch) GetChapter(source, rawurl string) (*snatchs.SnatchInfo, error)
- func (this *Snatch) GetChapters(source, rawurl string) ([]*snatchs.SnatchInfo, error)
- func (this *Snatch) GetNovel(source, rawurl string) (*snatchs.SnatchInfo, error)
- func (this *Snatch) GetProvideByURL(url string) (*models.SnatchRule, error)
- func (this *Snatch) InitNovel(url string) error
- func (this *Snatch) IsBookURL(source, rawurl string) bool
- func (this *Snatch) IsCrawlerURL(source, rawurl string) bool
- func (this *Snatch) SnatchNovel(novId uint32) error
- type SnatchRank
- type SnatchRule
- func (this *SnatchRule) Delete(id uint32) error
- func (this *SnatchRule) DeleteBatch(ids []string) error
- func (this *SnatchRule) Get(id uint32) *models.SnatchRule
- func (this *SnatchRule) GetAll(args *models.ArgsListRule) []*models.SnatchRule
- func (this *SnatchRule) GetByCode(code string) *models.SnatchRule
- func (this *SnatchRule) GetSnatchs() map[string]*models.SnatchRule
- func (this *SnatchRule) Init()
- func (this *SnatchRule) Load()
- func (this *SnatchRule) Save(sr *models.SnatchRule) error
- func (this *SnatchRule) UpState(id uint32, state uint8) error
- type SnatchTask
- type SnatchTaskManager
Constants ¶
View Source
const ( // 广告区域 ZONEINDEXSLICE uint8 = iota + 1 // pc首页轮播 ZONEINDEXBANNER // pc首页banner图 ZONEMINDEX // h5首页轮播 ZONENOV // 小说详情页右侧轮播 )
View Source
const ( CRAWLER_WAIT uint8 = iota CRAWLER_RUNING MAX_BLOOM_SIZE = 10000000 BLOOM_RATE = 0.00001 )
View Source
const ( NO_PROXY int = iota HTTP_PROXY IP_AUTO_PROXY STATE_WAIT int = iota STATE_RUNING )
代理模式
Variables ¶
View Source
var ( ErrInvalidURL = errors.New("非法URL") ErrNotCurrSiteURL = errors.New("非当前站点URL") )
View Source
var ( RoleService *Role GroupService *Group AdminService *Admin AdminLogService *AdminLog NovelService *Novel CateService *Cate ChapterService *Chapter FeedbackService *Feedback SnatchService *Snatch BannerService *Banner CrawlerService *Crawler ProxyService *Proxy ConfigService *Config SearchService *Search SearchLogService *SearchLog SnatchRuleService *SnatchRule )
View Source
var ( ErrNotProvider = errors.New("没有获取到采集点") ErrURLSnatchMatch = errors.New("该小说URL匹配不到采集站点") )
View Source
var ( ErrNovExists = errors.New("小说已经存在") ErrNovsEmpty = errors.New("获取到的小说为空") )
View Source
var (
ERRVALIDZONE = errors.New("广告区域不存在")
)
Functions ¶
Types ¶
type Admin ¶
type Admin struct { }
定义AdminService
func (*Admin) IsAccountExists ¶
判断管理员是否存在
func (*Admin) UpdateLoginInfo ¶
修改用户登录信息
type AdminLog ¶
type AdminLog struct { }
定义AdminLogService
func NewAdminLog ¶
func NewAdminLog() *AdminLog
type Chapter ¶
type Chapter struct{}
func NewChapter ¶
func NewChapter() *Chapter
func (*Chapter) DeleteBatch ¶
批量删除小说章节
func (*Chapter) GetEmptyChaps ¶
获取小说空章节列表
func (*Chapter) GetNovChaps ¶
func (this *Chapter) GetNovChaps(novId uint32, size, offset int, sort string, isCount bool) ([]*models.Chapter, int64)
获取小说章节列表
func (*Chapter) InsertMulti ¶
批量插入多个章节内容
func (*Chapter) UpdateEmpty ¶
更新空章节信息
type Crawler ¶
type Crawler struct { // 采集URL列表 URLs *bloom.BloomFilter // contains filtered or unexported fields }
定义CrawlerService
func NewCrawler ¶
func NewCrawler() *Crawler
type Feedback ¶
type Feedback struct { }
定义FeedbackService
func NewFeedback ¶
func NewFeedback() *Feedback
type Novel ¶
type Novel struct { }
定义NovelService
func (*Novel) GetByLink ¶
func (this *Novel) GetByLink(link, source string) *models.NovelLinks
根据你URL 和 站点获取小说采集URL
func (*Novel) GetCateRanks ¶
获取同类推荐排行榜
func (*Novel) GetCollects ¶
获取收藏榜列表
func (*Novel) GetOriginals ¶
获取原创小说
func (*Novel) GetSignNewBooks ¶
获取新人签约榜列表
func (*Novel) GetTodayRecs ¶
获取今日推荐
func (*Novel) GetVipRewards ¶
获取VIP打赏
func (*Novel) UpChapterInfo ¶
func (this *Novel) UpChapterInfo(novId uint32, novTextNum, chapterNum int, chapterId uint64, chapterTitle string, status uint8) error
修改章节信息
func (*Novel) UpChapterTextNum ¶
修改小说文字数
type Search ¶
type Search struct { }
定义SearchService
func (*Search) InsertOrIncrement ¶
添加搜索记录
type SearchLog ¶
type SearchLog struct { }
定义SearchLogService
func NewSearchLog ¶
func NewSearchLog() *SearchLog
type Snatch ¶
type Snatch struct {
// contains filtered or unexported fields
}
func (*Snatch) FindNovel ¶
func (this *Snatch) FindNovel(source, kw string) (*snatchs.SnatchInfo, error)
查找小说
func (*Snatch) GetChapter ¶
func (this *Snatch) GetChapter(source, rawurl string) (*snatchs.SnatchInfo, error)
获取小说章节内容
func (*Snatch) GetChapters ¶
func (this *Snatch) GetChapters(source, rawurl string) ([]*snatchs.SnatchInfo, error)
获取小说章节列表
func (*Snatch) GetNovel ¶
func (this *Snatch) GetNovel(source, rawurl string) (*snatchs.SnatchInfo, error)
获取一本小说
func (*Snatch) GetProvideByURL ¶
func (this *Snatch) GetProvideByURL(url string) (*models.SnatchRule, error)
根据URL匹配采集站点
func (*Snatch) IsCrawlerURL ¶
是否小说是否爬虫页面
type SnatchRank ¶
type SnatchRank struct{}
func NewSnatchRank ¶
func NewSnatchRank() *SnatchRank
type SnatchRule ¶
type SnatchRule struct {
// contains filtered or unexported fields
}
定义SnatchRuleService
func NewSnatchRule ¶
func NewSnatchRule() *SnatchRule
func (*SnatchRule) GetAll ¶
func (this *SnatchRule) GetAll(args *models.ArgsListRule) []*models.SnatchRule
获取采集规则列表
func (*SnatchRule) GetByCode ¶
func (this *SnatchRule) GetByCode(code string) *models.SnatchRule
获取单个采集配置
func (*SnatchRule) GetSnatchs ¶
func (this *SnatchRule) GetSnatchs() map[string]*models.SnatchRule
获取可用采集器列表
func (*SnatchRule) Init ¶
func (this *SnatchRule) Init()
func (*SnatchRule) Load ¶
func (this *SnatchRule) Load()
type SnatchTask ¶
type SnatchTask struct {
// contains filtered or unexported fields
}
func NewSnatchTask ¶
func NewSnatchTask(novId uint32) *SnatchTask
func (*SnatchTask) Run ¶
func (this *SnatchTask) Run()
type SnatchTaskManager ¶
采集任务管理
func NewSnatchTaskManager ¶
func NewSnatchTaskManager() *SnatchTaskManager
func (*SnatchTaskManager) AddTask ¶
func (this *SnatchTaskManager) AddTask(novId uint32) error
添加采集章节更新队列
func (*SnatchTaskManager) DelTask ¶
func (this *SnatchTaskManager) DelTask(novId uint32) error
删除采集队列任务
func (*SnatchTaskManager) RunOneTask ¶
func (this *SnatchTaskManager) RunOneTask(novId uint32) error
运行指定小说的采集任务
Source Files ¶
Click to show internal directories.
Click to hide internal directories.