Documentation ¶
Index ¶
- Constants
- Variables
- func InitDB()
- func InitModel()
- type Admin
- type AdminLog
- func (m *AdminLog) Delete(forceDelete ...bool) error
- func (m *AdminLog) DeleteBatch(ids []string) error
- func (m *AdminLog) GetAll(args ArgsAdminLog) ([]*AdminLog, int64)
- func (m *AdminLog) Insert() error
- func (m *AdminLog) Read(fields ...string) error
- func (m *AdminLog) Update(fields ...string) error
- type ArgsAdminLog
- type ArgsBase
- type ArgsListRule
- type ArgsNovelLinksList
- type ArgsNovelList
- type ArgsSearchList
- type ArgsSearchLogList
- type Banner
- func (m *Banner) Delete(forceDelete ...bool) error
- func (m *Banner) DeleteBatch(ids []string) error
- func (m *Banner) GetAll(args map[string]interface{}) []*Banner
- func (m *Banner) Insert() error
- func (m *Banner) Read(fields ...string) error
- func (m Banner) StatusName() string
- func (m *Banner) Update(fields ...string) error
- type Cate
- func (m *Cate) Delete(forceDelete ...bool) error
- func (m *Cate) DeleteBatch(ids []string) error
- func (m *Cate) GetAll() []*Cate
- func (m *Cate) Insert() error
- func (m Cate) IsHomeName() string
- func (m Cate) IsMenuName() string
- func (m *Cate) Read(fields ...string) error
- func (m *Cate) Update(fields ...string) error
- type CateMap
- type Chapter
- func (m *Chapter) Count() int64
- func (m *Chapter) DelByNovId() error
- func (m *Chapter) Delete() error
- func (m *Chapter) DeleteBatch(ids []string) error
- func (m *Chapter) GetByChapNo(asc string) error
- func (m *Chapter) GetByTitle() error
- func (m *Chapter) GetChapsTextNum(ids []string) int64
- func (m *Chapter) GetEmptyChaps() []*Chapter
- func (m *Chapter) GetFirst() error
- func (m *Chapter) GetLast() error
- func (m *Chapter) GetNovChaps(size, offset int, sort string) []*Chapter
- func (m *Chapter) Insert() error
- func (m *Chapter) InsertMulti(chapters []*Chapter) error
- func (m *Chapter) Read() error
- func (m Chapter) StatusName() string
- func (m *Chapter) Update(fields ...string) error
- func (m *Chapter) UpdateEmpty(fields ...string) error
- func (m *Chapter) UpdateViews(fields ...string) error
- type Config
- type Feedback
- func (m *Feedback) Delete(forceDelete ...bool) error
- func (m *Feedback) DeleteBatch(ids []string) error
- func (m *Feedback) GetAll(size, offset int, args map[string]string) ([]*Feedback, int64)
- func (m *Feedback) Insert() error
- func (m *Feedback) Read(fields ...string) error
- func (m *Feedback) Update(fields ...string) error
- type Group
- type Novel
- func (m *Novel) Delete(forceDelete ...bool) error
- func (m *Novel) DeleteBatch(ids []string) error
- func (m *Novel) GetAll(args ArgsNovelList) ([]*Novel, int64)
- func (m *Novel) GetByName(name string) *Novel
- func (m *Novel) Insert() error
- func (m Novel) IsHotName() string
- func (m Novel) IsOriginalName() string
- func (m Novel) IsRecName() string
- func (m Novel) IsVipRecName() string
- func (m *Novel) Read(fields ...string) error
- func (m Novel) StatusList() map[uint8]string
- func (m Novel) StatusName() string
- func (m *Novel) UpRecBatch(field string, books []string) error
- func (m *Novel) Update(fields ...string) error
- type NovelLinks
- type Role
- func (m *Role) Delete(forceDelete ...bool) error
- func (m *Role) GetByPurview(module, action string) *Role
- func (m *Role) GetMenus(roleIds []string) []*Role
- func (m *Role) GetRoles() []*Role
- func (m *Role) Insert() error
- func (m Role) IsMenuName() string
- func (m *Role) Read(fields ...string) error
- func (m *Role) Update(fields ...string) error
- func (m Role) Url() string
- type Rule
- type Search
- type SearchLog
- func (m *SearchLog) Delete(forceDelete ...bool) error
- func (m *SearchLog) DeleteBatch(ids []string) error
- func (m *SearchLog) GetAll(args ArgsSearchLogList) ([]*SearchLog, int64)
- func (m *SearchLog) Insert() error
- func (m SearchLog) IsResultName() string
- func (m SearchLog) SourceName() string
- func (m *SearchLog) Update(fields ...string) error
- type SnatchRule
- func (m *SnatchRule) Decode() error
- func (m *SnatchRule) Delete(forceDelete ...bool) error
- func (m *SnatchRule) DeleteBatch(ids []string) error
- func (m *SnatchRule) Encode() error
- func (m *SnatchRule) GetAll(args *ArgsListRule) []*SnatchRule
- func (m *SnatchRule) GetByCode(code string) *SnatchRule
- func (m *SnatchRule) Insert() error
- func (m *SnatchRule) Read(fields ...string) error
- func (m SnatchRule) StateName() string
- func (m *SnatchRule) Update(fields ...string) error
- type SnatchTestData
Constants ¶
View Source
const ( // 小说状态 BOOKOPEN uint8 = iota + 1 BOOKFINISH BOOKEUNUCHS )
View Source
const (
TABLE_CHAPTER_SLICE_NUM uint32 = 100
)
View Source
const (
// 表前缀
TABLE_PREFIX = "nov_"
)
Variables ¶
View Source
var ( RoleModel *Role AdminModel *Admin GroupModel *Group AdminLogModel *AdminLog NovelModel *Novel NovelLinksModel *NovelLinks CateModel *Cate ChapterModel *Chapter FeedbackModel *Feedback BannerModel *Banner ConfigModel *Config SearchModel *Search SearchLogModel *SearchLog SnatchRuleModel *SnatchRule )
Functions ¶
Types ¶
type Admin ¶
type Admin struct { Id uint32 `orm:"auto"` Account string `orm:"size(30);unique"` Mail string `orm:"size(100)"` Name string `orm:"size(20)"` Mobile uint64 `orm:"size(11)"` Password string `orm:"size(100)"` GroupId uint32 `orm:"size(11);default(0)"` GroupName string `orm:"-"` Status uint8 `orm:"size(1);default(0)"` LoginVisit uint32 `orm:"size(1);default(0)"` LastLoginIp string `orm:"size(15)"` LastLoginedAt uint32 `orm:"size(11)"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11);default(0)"` }
管理员模型
type AdminLog ¶
type AdminLog struct { Id uint32 `orm:"auto"` Uid uint32 `orm:"size(11)"` Name string `orm:"size(50)"` Ip string `orm:"size(15);"` Type uint `orm:"size(5);"` Content string `orm:"size(255);"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11);default(0)"` }
后台日记操作
func NewAdminLog ¶
func NewAdminLog() *AdminLog
type ArgsListRule ¶
type ArgsListRule struct {
Ids []interface{}
}
type ArgsNovelLinksList ¶
type ArgsNovelList ¶
type ArgsSearchList ¶
type ArgsSearchLogList ¶
type Banner ¶
type Banner struct { Id uint32 `orm:"auto;size(11)"` Name string `orm:"size(100)"` Img string `orm:"size(100)"` Link string `orm:"size(100)"` Zone uint8 `orm:"size(3)"` Ext string `orm:"size(100)"` Desc string `orm:"size(100)"` Status uint8 `orm:"size(1);default(0)"` CreatedAt uint32 `orm:"size(11);default(0)"` UpdatedAt uint32 `orm:"size(11);default(0)"` DeletedAt uint32 `orm:"size(11);default(0)` }
banner图管理
type Cate ¶
type Cate struct { Id uint32 `orm:"auto;size(11)"` Name string `orm:"size(100)"` IsMenu uint8 `orm:"size(1);default(0)"` IsHome uint8 `orm:"size(1);default(0)"` CreatedAt uint32 `orm:"size(11);default(0)"` UpdatedAt uint32 `orm:"size(11);default(0)"` DeletedAt uint32 `orm:"size(11);default(0)` }
小说分类
type Chapter ¶
type Chapter struct { Id uint64 `orm:"auto"` NovId uint32 `orm:"size(11)"` ChapterNo uint32 `orm:"size(11)"` Title string `orm:"size(100)"` Desc string `orm:"type(text)"` Link string `orm:"size(100)"` Source string `orm:"size(10)"` Views uint32 `orm:"size(11);default(0);"` TextNum uint32 `orm:"size(11);default(0);"` Status uint8 `orm:"size(1);default(0);"` TryViews uint8 `orm:"size(2);default(0);"` CreatedAt uint32 `orm:"size(11);default(0);"` UpdatedAt uint32 `orm:"size(11);default(0);"` DeletedAt uint32 `orm:"size(11);default(0)"` }
小说章节内容
func NewChapter ¶
func NewChapter() *Chapter
func (*Chapter) GetNovChaps ¶
获取小说章节列表
type Config ¶
type Config struct { Id uint32 `orm:"auto;size(11)"` Key string `orm:"size(50)"` Value string `orm:"size(255)"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` }
配置模型
type Feedback ¶
type Feedback struct { Id uint32 `orm:"auto"` Uid uint32 `orm:"size(11)"` Name string `orm:"size(50)"` Ip string `orm:"size(15);"` Type uint `orm:"size(5);"` Status uint `orm:"size(1);"` Content string `orm:"size(255);"` Contact string `orm:"size(100);"` Reply string `orm:"size(255);"` ReplyAt uint32 `orm:"size(11);"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11);default(0)"` }
用户意见反馈
func NewFeedback ¶
func NewFeedback() *Feedback
type Group ¶
type Group struct { Id uint32 `orm:"auto"` Name string `orm:"size(30)"` Desc string `orm:"size(255)"` RoleIds string `orm:"size(2555);"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11);default(0)"` }
管理员群组
type Novel ¶
type Novel struct { Id uint32 `orm:"auto"` Name string `orm:"size(100)"` Desc string `orm:"size(2555)"` Cover string `orm:"size(100);"` CateId uint32 `orm:"size(11);default(0);"` CateName string `orm:"size(30);"` Author string `orm:"size(30);"` IsOriginal uint8 `orm:"size(1);default(0);"` IsHot uint8 `orm:"size(1);default(0);"` IsRec uint8 `orm:"size(1);default(0);"` IsTodayRec uint8 `orm:"size(1);default(0);"` IsVipRec uint8 `orm:"size(1);default(0);"` IsVipReward uint8 `orm:"size(1);default(0);"` IsVipUp uint8 `orm:"size(1);default(0);"` IsSignNewBook uint8 `orm:"size(1);default(0);"` IsCollect uint8 `orm:"size(1);default(0);"` Status uint8 `orm:"size(11);default(0);"` Views uint32 `orm:"size(11);default(0);"` CollectNum uint32 `orm:"size(11);default(0)"` RecNum uint32 `orm:"size(11);default(0)"` TextNum uint32 `orm:"size(11);default(0)"` ChapterNum uint32 `orm:"size(6);default(0)"` ChapterUpdatedAt uint32 `orm:"size(11);default(0);"` ChapterId uint64 `orm:"size(20);default(0);"` ChapterTitle string `orm:"size(100);"` CreatedAt uint32 `orm:"size(11);default(0);"` UpdatedAt uint32 `orm:"size(11);default(0);"` DeletedAt uint32 `orm:"size(11);default(0)"` }
小说内容
func (Novel) StatusList ¶
type NovelLinks ¶
type NovelLinks struct { Id uint32 `orm:"auto"` NovId uint32 `orm:"size(11)"` Link string `orm:"size(100)"` Source string `orm:"size(30);"` ChapterLink string `orm:"size(100);"` CreatedAt uint32 `orm:"size(11);default(0);"` UpdatedAt uint32 `orm:"size(11);default(0);"` DeletedAt uint32 `orm:"size(11);default(0)"` }
小说采集来源列表内容
func NewNovelLinks ¶
func NewNovelLinks() *NovelLinks
func (*NovelLinks) GetAll ¶
func (m *NovelLinks) GetAll(args ArgsNovelLinksList) ([]*NovelLinks, int64)
获取小说采集点列表
func (*NovelLinks) GetByLink ¶
func (m *NovelLinks) GetByLink(link, source string) *NovelLinks
判断小说是否存在
type Role ¶
type Role struct { Id uint32 `orm:"auto;size(11)"` Pid uint32 `orm:"default(0);"` Name string `orm:"size(30)"` Icon string `orm:"size(10)"` IsMenu uint8 `orm:"size(1)"` Desc string `orm:"size(255)"` Module string `orm:"size(50)"` Action string `orm:"size(50)"` Sort uint8 `orm:"size(3)"` IsDefault uint8 `orm:"size(1);default(0)"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11);default(0)"` Child []*Role `orm:"-"` }
权限模型
type Rule ¶
type Rule struct { // 是否小说简介页面 IsBookURL string `json:"is_book_url"` // 是否可爬虫页面 IsCrawlerURL string `json:"is_crawler_url"` // 小说简介页面采集规则 BookTitleSelector string `json:"book_title_selector"` // 小说标题 BookTitleAttr string `json:"book_title_attr"` // 小说标题css选择器获取属性 BookTitleFilter string `json:"book_title_filter"` BookAuthorSelector string `json:"book_author_selector"` BookAuthorAttr string `json:"book_author_attr"` BookAuthorFilter string `json:"book_author_filter"` BookCateSelector string `json:"book_cate_selector"` BookCateAttr string `json:"book_cate_attr"` BookCateFilter string `json:"book_cate_filter"` BookDescSelector string `json:"book_desc_selector"` BookDescAttr string `json:"book_desc_attr"` BookDescFilter string `json:"book_desc_filter"` BookCoverSelector string `json:"book_cover_selector"` BookCoverAttr string `json:"book_cover_attr"` BookNoCover string `json:"book_no_cover"` BookChapterURLSelector string `json:"book_chapter_url_selector"` BookChapterURLAttr string `json:"book_chapter_url_attr"` BookLastChapterTitleSelector string `json:"book_last_chapter_title_selector"` BookLastChapterTitleAttr string `json:"book_last_chapter_title_attr"` // 章节目录采集规则 ChapterCatalogSelector string `json:"chapter_catalog_selector"` ChapterNextPageSelector string `json:"chapter_next_page_selector"` // 章节目录下一页选择器 ChapterAbandonNum int `json:"chapter_abandon_num"` // 丢弃章节数(最新章节) // 详情页面采集规则 InfoTitleSelector string `json:"info_title_selector"` InfoTitleFilter string `json:"info_title_filter"` InfoDescSelector string `json:"info_desc_selector"` InfoDescFilter string `json:"info_desc_filter"` InfoPrePageSelector string `json:"info_pre_page_selector"` InfoNextPageSelector string `json:"info_next_page_selector"` // 搜索页面采集规则 FindURL string `json:"find_url"` FindCharset string `json:"find_charset"` FindBookURLSelector string `json:"find_book_url_selector"` }
采集规则
type Search ¶
type Search struct { Id uint64 `orm:"auto"` Kw string `orm:"size(100);unique"` Views uint64 `orm:"size(21)"` IsRec uint8 `orm:"size(1)"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` }
搜索记录管理模型
func (*Search) InsertOrIncrement ¶
更新搜索记录、不存在新增,存在更新搜索次数
type SearchLog ¶
type SearchLog struct { Id uint64 `orm:"auto"` Kw string `orm:"size(100)"` Uid uint32 `orm:"size(11)"` Ip string `orm:"size(15);"` Source uint `orm:"size(1);"` IsResult uint `orm:"size(1);"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11);default(0)"` }
搜索日记操作
func NewSearchLog ¶
func NewSearchLog() *SearchLog
type SnatchRule ¶
type SnatchRule struct { Id uint32 `orm:"auto;size(11)"` Name string `orm:"size(50)"` Code string `orm:"size(20)"` Url string `orm:"size(50)"` State uint8 `orm:"size(1)"` IsUpdate uint8 `orm:"size(1);default(0)"` Charset string `orm:"size(10)"` CateMap string `orm:"size(2555)"` Rule string `orm:"size(2555)"` TestData string `orm:"size(2555)"` CreatedAt uint32 `orm:"size(11)"` UpdatedAt uint32 `orm:"size(11)"` DeletedAt uint32 `orm:"size(11)"` Test *SnatchTestData `orm:"-"` Rules *Rule `orm:"-"` CateMaps []*CateMap `orm:"-"` }
采集规则配置模型
func NewSnatchRule ¶
func NewSnatchRule() *SnatchRule
func (*SnatchRule) Decode ¶
func (m *SnatchRule) Decode() error
func (*SnatchRule) Encode ¶
func (m *SnatchRule) Encode() error
type SnatchTestData ¶
type SnatchTestData struct { // 小说简介页面 BookURL string `json:"book_url"` // 小说简介URL BookTitle string `json:"book_title"` // 小说标题 BookAuthor string `json:"book_author"` // 小说作者 BookCate string `json:"book_cate"` // 小说分类名 BookDesc string `json:"book_desc"` // 小说简介 BookCover string `json:"book_cover"` // 小说封面LOGO BookChapterURL string `json:"book_chapter_url"` // 小说章节页面URL // 章节目录 ChapterURL string `json:"chapter_url"` // 章节目录URL ChapterCatalogURL string `json:"chapter_catalog_url"` // 章节目录中第一个章节的URL地址 ChapterCatalogTitle string `json:"chapter_catalog_title"` // 章节目录中第一个章节的标题 // 详情页面 InfoURL string `json:"info_url"` // 小说章节页面URL InfoTitle string `json:"info_title"` // 小说章节标题 InfoDesc string `json:"info_desc"` // 小说章节内容 InfoPrePageURL string `json:"info_pre_page_url"` // 上一章节URL InfoNextPageURL string `json:"info_next_page_url"` // 下一章节URL // 搜索页面获得URL FindBookKw string `json:"find_book_kw"` // 搜索关键词 FindBookURL string `json:"find_book_url"` // 搜索结果小说简介页面的URL }
采集测试对比数据
Click to show internal directories.
Click to hide internal directories.