12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package models
- import (
- "github.com/rdlucklib/rdluck_tools/orm"
- "time"
- )
- type CygxArticleCollect struct {
- Id int `orm:"column(id);pk"`
- ArticleId int
- UserId int
- CreateTime time.Time
- }
- //添加收藏信息
- func AddCygxArticleCollect(item *CygxArticleCollect) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type ArticleCollectReq struct {
- ArticleId int `description:"报告id"`
- }
- type ArticleCollectResp struct {
- Status int `description:"1:收藏,2:取消收藏"`
- CollectCount int `description:"收藏总数"`
- }
- func RemoveArticleCollect(userId, articleId int) (err error) {
- o := orm.NewOrm()
- sql := `DELETE FROM cygx_article_collect WHERE user_id=? AND article_id=? `
- _, err = o.Raw(sql, userId, articleId).Exec()
- return
- }
- func GetArticleCollectUsersCount(articleId int) (count int, err error) {
- sql := `SELECT COUNT(user_id) AS count FROM cygx_article_collect WHERE article_id=? `
- err = orm.NewOrm().Raw(sql, articleId).QueryRow(&count)
- return
- }
- func GetArticleCollectCount(userId, articleId int) (count int, err error) {
- sql := `SELECT COUNT(1) AS count FROM cygx_article_collect WHERE user_id=? AND article_id=? `
- err = orm.NewOrm().Raw(sql, userId, articleId).QueryRow(&count)
- return
- }
- type ArticleCollectList struct {
- Id int `orm:"column(id);pk"`
- ArticleId int
- UserId int
- CreateTime time.Time
- Title string `description:"标题"`
- TitleEn string `description:"英文标题 "`
- UpdateFrequency string `description:"更新周期"`
- CreateDate string `description:"创建时间"`
- PublishDate string `description:"发布时间"`
- Body string `description:"内容"`
- Abstract string `description:"摘要"`
- CategoryName string `description:"一级分类"`
- SubCategoryName string `description:"二级分类"`
- }
|