Documentation ¶
Index ¶
- Variables
- func AutoCache(key string, obj interface{}, time int64, callback func())
- func DeleteCache(key string)
- func StructDecode(data []byte, to interface{}) error
- func StructEncode(data interface{}) ([]byte, error)
- type Article
- func (this *Article) AddReply()
- func (this *Article) AddTag(name string)
- func (this *Article) AddViews()
- func (this *Article) Count(category int) int
- func (this *Article) Delete()
- func (this *Article) Find(category int, from int, number int) []*Article
- func (this *Article) FindByTag(tag string, from int, number int) []*Article
- func (this *Article) FindOne(id string) (bool, interface{})
- func (this *Article) FindTagCount(tag string) int
- func (this *Article) FindUserArticles(id bson.ObjectId, from int, number int) []*Article
- func (this *Article) FindUserArticlesCount(id bson.ObjectId) int
- func (this *Article) FindUserCold(id bson.ObjectId) []*Article
- func (this *Article) FindUserHot(id bson.ObjectId) []*Article
- func (this *Article) GetId()
- func (this *Article) Insert() (bool, interface{})
- func (this *Article) RemoveTag(name string)
- func (this *Article) Same() []*Article
- func (this *Article) SetTop()
- func (this *Article) UpdateCategory(category int) bool
- func (this *Article) UpdateContent()
- func (this *Article) UpdateLastReply(id string, image string)
- func (this *Article) UpdateTop()
- type Base
- type Member
- func (this *Member) AddArticleNumber()
- func (this *Member) AddReplyNumber()
- func (this *Member) FindArticles(articles []*Article) []*Member
- func (this *Member) FindOne(value string) (bool, interface{})
- func (this *Member) FindReplys(replys []*Reply) []*Member
- func (this *Member) FindToken(token string) (bool, interface{})
- func (this *Member) Insert() (bool, interface{})
- func (this *Member) Remove() bool
- func (this *Member) Save()
- type Party
- func (this *Party) ChangeMember(id string, memberId bson.ObjectId)
- func (this *Party) FindBinds(memberId bson.ObjectId) []*Party
- func (this *Party) FindMember(id string, _type string) bool
- func (this *Party) IdExist(id string) bool
- func (this *Party) Insert(id string, _type string, memberid string, accesstoken string, name string, ...)
- func (this *Party) RefreshAuthor(id string, _type string, token string, expresin string)
- type Reply
- type Tag
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Db *mgo.Database //数据库 Redis redis.Client //redis )
Functions ¶
Types ¶
type Article ¶
type Article struct { Id bson.ObjectId `bson:"_id" json:"_id" form:"_id"` // 主键 Uid bson.ObjectId `bson:"u" json:"u" form:"u"` // 所有者id Lid string `bson:"l" json:"l" form:"l"` // 最后回复者id Category int `bson:"c" json:"c" form:"c"` // 所属分类id 0:问答 1:分享 Title string `bson:"t" json:"t" form:"t"` // 标题 Content string `bson:"co" json:"co" form:"co"` // 正文内容 Views uint32 `bson:"v" json:"v" form:"v"` // 浏览量 Reply uint32 `bson:"r" json:"r" form:"r"` // 回复量 Tag []string `bson:"ta" json:"ta" form:"ta"` // 标签 Top int `bson:"tp" json:"tp" form:"tp"` // 置顶优先级 Time time.Time `bson:"tm" json:"tm" form:"tm"` // 发布日期 TimeLast time.Time `bson:"tl" json:"tl" form:"tl"` // 最后挖坟日期 }
func (*Article) FindUserArticles ¶
查询某用文章
func (*Article) FindUserArticlesCount ¶
查询某用文章数量
func (*Article) FindUserCold ¶
查询某用户冷门文章前10个
func (*Article) FindUserHot ¶
查询某用户热评文章前10个
func (*Article) UpdateLastReply ¶
更新某文章最后评论人信息
type Member ¶
type Member struct { Id bson.ObjectId `bson:"_id" json:"_id"` // 主键 NickName string `bson:"n" json:"n" form:"n"` // 昵称 Login string `bson:"l" json:"l" form:"l"` // github登陆名 Image string `bson:"i" json:"i" form:"i"` // 用户头像 Token string `bson:"to" json:"to" form:"to"` // github对应token ArticleNumber int `bson:"a" json:"a" form:"a"` // 文章发表量 ReplyNumber int `bson:"r" json:"r" form:"r"` // 评论数量 UploadSize int64 `bson:"u" json:"u" form:"u"` // 上传量 Time time.Time `bson:"t" json:"t" form:"t"` // 注册时间 Admin bool `bson:"ad" json:"ad" form:"ad"` // 是否为管理员 }
func (*Member) FindArticles ¶
查询文章用户信息
type Party ¶
type Party struct { Id string `bson:"_id" json:"_id" form:"_id"` //第三方平台id Type string `bson:"t" json:"t" form:"t"` //第三方平台类型 MemberId bson.ObjectId `bson:"mi" json:"mi" form:"mi"` //用户id AccessToken string `bson:"at" json:"at" form:"at"` //用户token Name string `bson:"n" json:"n" form:"n"` //用户昵称 Image string `bson:"i" json:"i" form:"i"` //用户头像地址 ExpiresTime time.Time `bson:"e" json:"e" form:"e"` //授权过期时间 }
func (*Party) ChangeMember ¶
修改第三方平台对应用户id
func (*Party) FindMember ¶
根据平台id和类型查询用户id
type Reply ¶
type Reply struct { Id bson.ObjectId `bson:"_id" json:"_id" form:"_id"` // 主键 Article bson.ObjectId `bson:"a" json:"a" form:"a"` // 所属文章id Uid bson.ObjectId `bson:"u" json:"u" form:"u"` // 所有者id Content string `bson:"co" json:"co" form:"co"` // 内容 Time time.Time `bson:"tm" json:"tm" form:"tm"` // 发布日期 }
func (*Reply) DeletArticleReply ¶
删除某个帖子下全部回复和评论
Click to show internal directories.
Click to hide internal directories.