service

package
v0.0.0-...-69154b6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminService

type AdminService struct {
	ORM          *orm.ORM      `ioc:"auto"`
	CacheService *CacheService `ioc:"auto"`
	RoleService  *RoleService  `ioc:"auto"`
	// contains filtered or unexported fields
}

func (*AdminService) All

func (s *AdminService) All(selfID uint) []*model.Admin

func (*AdminService) AssertPwd

func (s *AdminService) AssertPwd(pwd string, enPwd string) bool

func (*AdminService) CheckToken

func (s *AdminService) CheckToken(token string) (*model.Admin, error)

func (*AdminService) Delete

func (s *AdminService) Delete(id int) error

func (*AdminService) GenToken

func (s *AdminService) GenToken(admin *model.Admin)

func (*AdminService) Get

func (s *AdminService) Get(id int) *model.Admin

func (*AdminService) GetByUsername

func (s *AdminService) GetByUsername(username string) *model.Admin

func (*AdminService) Save

func (s *AdminService) Save(admin *model.Admin) error

func (*AdminService) TrieGet

func (s *AdminService) TrieGet(id uint) *model.Admin

type ArticlePageQuery

type ArticlePageQuery struct {
	Type       int
	CategoryID int
	Keyword    string
	TagID      int
	UserID     int
}

type ArticleService

type ArticleService struct {
	CategoryService *CategoryService `ioc:"auto"`
	AdminService    *AdminService    `ioc:"auto"`
	TagService      *TagService      `ioc:"auto"`
	ORM             *orm.ORM         `ioc:"auto"`
	PageSize        int              `val:"${website.page_size}"`
	TableSize       int              `val:"${website.article_table_size}"`
	TablePrefix     string           `val:"${db.table_prefix}"`
	// contains filtered or unexported fields
}

func (*ArticleService) Delete

func (s *ArticleService) Delete(ids []int) error

func (*ArticleService) DraftCount

func (s *ArticleService) DraftCount() int

func (*ArticleService) Edit

func (s *ArticleService) Edit(article *model.ArticlePublish) error

func (*ArticleService) GetById

func (s *ArticleService) GetById(id int) *model.Article

func (*ArticleService) GetContent

func (s *ArticleService) GetContent(tableName string, id int) *model.ArticleContent

func (*ArticleService) NoCategoryCount

func (s *ArticleService) NoCategoryCount() int

func (*ArticleService) Page

func (s *ArticleService) Page(page int, query *ArticlePageQuery) *orm.Page

func (*ArticleService) Publish

func (s *ArticleService) Publish(article *model.ArticlePublish, adminID uint) error

func (*ArticleService) TotalCount

func (s *ArticleService) TotalCount() int

type CacheService

type CacheService struct {
	CacheType string `val:"${cache.type}"`
	Address   string `val:"${cache.url}"`
	Password  string `val:"${cache.password}"`
	DB        int    `val:"${cache.db}"`
	CacheSize int    `val:"${cache.cache_size}"` // cache memory size :MB
	// contains filtered or unexported fields
}

func (*CacheService) Delete

func (s *CacheService) Delete(key string) error

func (*CacheService) Get

func (s *CacheService) Get(key string, i interface{}) error

func (*CacheService) GetInt

func (s *CacheService) GetInt(key string) (int, error)

func (*CacheService) GetStr

func (s *CacheService) GetStr(key string) (string, error)

func (*CacheService) Inc

func (s *CacheService) Inc(key string, val int) error

func (*CacheService) Set

func (s *CacheService) Set(key string, val interface{}, exp time.Duration) error

func (*CacheService) SetExp

func (s *CacheService) SetExp(key string, exp time.Duration) error

type CategoryQuery

type CategoryQuery struct {
	Keyword string `json:"keyword"`
}

type CategoryService

type CategoryService struct {
	ArticleService *ArticleService `ioc:"auto"`
	PageSize       int             `val:"${website.page_size}"`
	ORM            *orm.ORM        `ioc:"auto"`
	// contains filtered or unexported fields
}

func (*CategoryService) Get

func (s *CategoryService) Get(id int) (*model.Category, error)

func (*CategoryService) Page

func (s *CategoryService) Page(page int, query *CategoryQuery) *orm.Page

func (*CategoryService) Save

func (s *CategoryService) Save(category *model.Category) error

func (*CategoryService) Sort

func (s *CategoryService) Sort(sort *CategorySort) error

func (*CategoryService) Tree

func (s *CategoryService) Tree() []*CategoryTree

func (*CategoryService) TrieGet

func (s *CategoryService) TrieGet(id uint) *model.Category

type CategorySort

type CategorySort struct {
	ParentID uint `json:"parent_id"`
	Sort     []struct {
		ID    uint `json:"id"`
		Index int  `json:"index"`
	} `json:"sort"`
}

type CategoryTree

type CategoryTree struct {
	ID       uint            `json:"id"`
	Name     string          `json:"name"`
	Children []*CategoryTree `json:"children"`
	Category *model.Category `json:"category"`
}

type DictService

type DictService struct {
	PageSize int      `val:"${website.page_size}"`
	ORM      *orm.ORM `ioc:"auto"`
}

func (*DictService) All

func (s *DictService) All() []*model.Dict

func (*DictService) GetByKey

func (s *DictService) GetByKey(key string) *model.Dict

func (*DictService) Init

func (s *DictService) Init()

func (*DictService) Save

func (s *DictService) Save(dict *model.Dict)

func (*DictService) Update

func (s *DictService) Update(dict *model.Dict)

type LocalUpload

type LocalUpload struct {
	StaticDir string   `val:"${server.static}"`
	UploadDir string   `val:"${upload.local_dir}"`
	MaxSize   int      `val:"${upload.max_size}"`
	ORM       *orm.ORM `ioc:"auto"`
}

func (*LocalUpload) Upload

func (s *LocalUpload) Upload(file *multipart.FileHeader) (*model.Upload, error)

func (*LocalUpload) UploadBase64

func (s *LocalUpload) UploadBase64(base64Data string) (*model.Upload, error)

type RoleService

type RoleService struct {
	ORM          *orm.ORM      `ioc:"auto"`
	AdminService *AdminService `ioc:"auto"`
	PageSize     int           `val:"${website.page_size}"`
	// contains filtered or unexported fields
}

func (*RoleService) All

func (s *RoleService) All() []*model.Role

func (*RoleService) AllPermission

func (s *RoleService) AllPermission() []*model.Permission

func (*RoleService) Get

func (s *RoleService) Get(id int) (*model.Role, error)

func (*RoleService) Init

func (s *RoleService) Init()

func (*RoleService) Page

func (s *RoleService) Page(page int) *orm.Page

func (*RoleService) Save

func (s *RoleService) Save(role model.Role, permissions []*model.Permission) error

type SkinInfo

type SkinInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Cover       string `json:"cover"`
	Template    []struct {
		File        string `json:"file"`
		Description string `json:"description"`
	}
	CoverImgs map[string]string `json:"cover_imgs"`
}

type SkinService

type SkinService struct {
	ORM       *orm.ORM `ioc:"auto"`
	SkinDir   string   `val:"${server.skin_template_dir}"`
	StaticDir string   `val:"${server.static}"`
}

func (*SkinService) AllSkin

func (s *SkinService) AllSkin() ([]*SkinInfo, error)

type TagQuery

type TagQuery struct {
	Keyword string `json:"keyword"`
}

type TagService

type TagService struct {
	PageSize int      `val:"${website.page_size}"`
	ORM      *orm.ORM `ioc:"auto"`
	// contains filtered or unexported fields
}

func (*TagService) Get

func (s *TagService) Get(id int) (*model.Tag, error)

func (*TagService) GetByArticleID

func (s *TagService) GetByArticleID(id int) []*model.Tag

func (*TagService) GetByName

func (s *TagService) GetByName(name string) *model.Tag

func (*TagService) GetHotTag

func (s *TagService) GetHotTag(count int) []*model.Tag

func (*TagService) Page

func (s *TagService) Page(page int, query *TagQuery) *orm.Page

func (*TagService) PrefixFind

func (s *TagService) PrefixFind(prefix string) []string

func (*TagService) PutPrefix

func (s *TagService) PutPrefix(tag *model.Tag)

func (*TagService) Save

func (s *TagService) Save(tag *model.Tag) error

type UpyunUpload

type UpyunUpload struct {
}

func (*UpyunUpload) Upload

func (s *UpyunUpload) Upload(file *multipart.FileHeader) (*model.Upload, error)

func (*UpyunUpload) UploadBase64

func (s *UpyunUpload) UploadBase64(base64 string) (*model.Upload, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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