repository

package
v0.0.0-...-abc415f Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheTags = map[int]TagItem{}

CacheTags 缓存标签

View Source
var Hid *hashids.HashID

Hid ...

Functions

func ArticleAfter

func ArticleAfter(article *orm.Article)

ArticleAfter 修改文章

func ArticleRank

func ArticleRank(article orm.Article) (rank float64)

ArticleRank 获取文章RANK 该rank具有维一性,可作游标 通过创建时间计算期分值,以赞同否定作为偏移值

func CreateTempQrcode

func CreateTempQrcode(id int32) (*qrcode.TempQrcode, error)

CreateTempQrcode 创建临时二维码

func Decode

func Decode(s string) (ids []int)

Decode 解密

func Encode

func Encode(ids []int) (s string)

Encode 加密

func Find

func Find(url string) (article wechat.Article, err error)

Find wechat.Article

func GetArticle

func GetArticle(limit, offset, tag int) (articles []orm.Article, err error)

GetArticle 获取文章列表

func GetBindQrcode

func GetBindQrcode(uid int) (url string, err error)

GetBindQrcode 站点获取签名任务

func GetMd5String

func GetMd5String(s string) string

GetMd5String 生成32位md5字串

func GetMediaByAppID

func GetMediaByAppID(appID string) (media orm.Media, err error)

GetMediaByAppID 通过 appID 获取公众号信息

func GetMediaByID

func GetMediaByID(id int) (media orm.Media, err error)

GetMediaByID 通过 appID 获取公众号信息

func GetMediaIDByAppID

func GetMediaIDByAppID()

func GetRandomSalt

func GetRandomSalt() string

return len=16 salt

func GetRandomString

func GetRandomString(l int) string

生成随机字符串

func GetTagByMediaID

func GetTagByMediaID(id int) (tag orm.Tag, err error)

GetTagByMediaID ..

func GetTagByType

func GetTagByType(name string) (tags []orm.Tag, err error)

GetTagByType ..通过属性获取标签

func GetTagsByIDS

func GetTagsByIDS(idstr string) (tags []orm.Tag, err error)

GetTagsByIDS ..通过id获取标签

func GetTagsByTitle

func GetTagsByTitle(name string) (tags []orm.Tag, err error)

GetTagsByTitle ..通过属性获取标签

func GetTimestamp

func GetTimestamp() int64

获取当前时间

func Hate

func Hate(id int) (a orm.Article, err error)

Hate ..

func Insert

func Insert(url string) (article wechat.Article, err error)

Insert wechat.Article

func Like

func Like(id int) (a orm.Article, err error)

Like ..

func Post

func Post(url string) (err error)

Post ... url

func PrintErrorImageHandler

func PrintErrorImageHandler(w http.ResponseWriter, r *http.Request)

PrintErrorImageHandler 显示错误图片

func PrintImageHandler

func PrintImageHandler(u string, w http.ResponseWriter, r *http.Request)

PrintImageHandler 显示正常图片

func Rank

func Rank(vote int, devote int, timestamp int64) float64

Rank 获取排名

func Remove

func Remove(url string) (article wechat.Article, err error)

Remove wechat.Article

func SaveImg

func SaveImg(imageURL, saveName string) (n int64, err error)

SaveImg 保存图片到本地

func SearchTags

func SearchTags(title string) (tags []orm.Tag, err error)

SearchTags ..通过标题模糊搜索

func SendArticle

func SendArticle(openID, title, description, picURL, url string) (err error)

SendArticle 发送文章

func SendEmail

func SendEmail(address, title, body string) (err error)

SendEmail 发送邮件

func SendText

func SendText(openID, text string) (err error)

SendText 发送文本

func SetWebGetSignTaskValueForWechatPush

func SetWebGetSignTaskValueForWechatPush(str, openID string) bool

SetWebGetSignTaskValueForWechatPush ..

func SpiderGet

func SpiderGet(url string) (article wechat.Article, err error)

SpiderGet wechat.Article

func Str2Int64

func Str2Int64(str string) []int64

Str2Int64 url请求中使用的字符串转int64数组

func Tag

func Tag(id int) (tag orm.Tag, err error)

Tag ..

func View

func View(id int) (a orm.Article, err error)

View ..

func WechatServe

func WechatServe(w http.ResponseWriter, r *http.Request)

WechatServe 微信接口服务

Types

type ArticleItem

type ArticleItem struct {
	ID            uint
	Title         string
	Author        string
	Cover         string
	PubAt         time.Time
	MediaTagID    int
	MediaTagTitle string
	Like          int
	Hate          int
	Rank          float64
	URL           string
}

ArticleItem 返回前台使用的文章信息

func GetArticleCursorByID

func GetArticleCursorByID(id, limit int, tags []int64) (rows []ArticleItem, err error)

GetArticleCursorByID 通过ID游标方式获取最新收录文章

func GetArticleCursorByRank

func GetArticleCursorByRank(rank float64, limit int, tags []int64) (rows []ArticleItem, err error)

GetArticleCursorByRank 通过Rank游标方式获取热门文章

func GetArticleData

func GetArticleData(article orm.Article) (data ArticleItem)

GetArticleData 获取文章数据,转义返回

func GetArticlesByTitle

func GetArticlesByTitle(text string, rank float64, limit int) (rows []ArticleItem, err error)

GetArticlesByTitle 通过Rank游标方式获取热门文章

func GetArticlesData

func GetArticlesData(articles []orm.Article) (rows []ArticleItem)

GetArticlesData 获取文章数据,转义返回

type JsSign

type JsSign struct {
	URL       string `json:"url" `
	Timestamp string `json:"timestamp"`
	Signature string `json:"signature"`
	NonceStr  string `json:"nonceStr"`
}

Post has and belongs to many languages, use `Post_languages` as join table

func GetSign

func GetSign(url string) (js JsSign, err error)

GetSign 获取排名

type TagItem

type TagItem struct {
	ID    uint
	Type  string
	Title string
}

TagItem 标签属性 (不存在相同的标签)

func GetTagMsg

func GetTagMsg(id int) (tag TagItem, err error)

GetTagMsg ..

Jump to

Keyboard shortcuts

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