123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- )
- type HomeArtAndChartListResp struct {
- Paging *paging.PagingItem
- List []*HomeArticle `description:"文章列表"`
- ChartList []*HomeChartListResp `description:"图表列表"`
- }
- type HomeArticle struct {
- ArticleId int `description:"文章id"`
- Title string `description:"标题"`
- TitleEn string `description:"英文标题 "`
- UpdateFrequency string `description:"更新周期"`
- CreateDate string `description:"创建时间"`
- PublishDate string `description:"发布时间"`
- Body string `description:"内容"`
- BodyHtml string `description:"内容带有HTML标签"`
- Abstract string `description:"摘要"`
- CategoryName string `description:"一级分类"`
- SubCategoryName string `description:"二级分类"`
- ExpertBackground string `description:"专家背景"`
- IsResearch bool `description:"是否属于研选"`
- Pv int `description:"PV"`
- ImgUrlPc string `description:"图片链接"`
- CategoryId string `description:"文章分类"`
- HttpUrl string `description:"文章链接跳转地址"`
- IsNeedJump bool `description:"是否需要跳转链接地址"`
- Source int `description:"来源 1:文章, 2:图表"`
- Annotation string `description:"核心观点"`
- HomeType int `description:"数据类型:0-纪要(默认); 1-微路演音频"`
- MicroAudio *MicroAudioUnionList `description:"微路演音频"`
- List []*IndustrialManagementIdInt
- }
- type HomeChartListResp struct {
- ChartId int `description:"图表ID"`
- Title string `description:"标题"`
- TitleEn string `description:"英文标题 "`
- CreateDate string `description:"创建时间"`
- PtagName string `description:"父类名称"`
- CtagName string `description:"子类名称"`
- PtagNameTwo string `description:"父类名称"`
- CtagNameTwo string `description:"子类名称"`
- CtagNamePc string `description:"Pc端所有的分类名称"`
- BodyHtml string `orm:"column(cover)";description:"图片链接"`
- HttpUrl string `orm:"column(iframe)";description:"文章链接跳转地址"`
- IsNeedJump bool `description:"是否需要跳转链接地址"`
- IsTop bool `description:"是否置顶"`
- NumTop int `description:"置顶数量"`
- Source int `description:"来源 1:文章, 2:图表"`
- LabelList []*LabelList `description:"图表标签列表"`
- }
- type LabelList struct {
- PtagName string `description:"父类名称"`
- CtagName string `description:"子类名称"`
- }
- func GetHomeCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count
- FROM cygx_article AS a
- WHERE a.publish_status=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- func GetHomeList(condition string, pars []interface{}, startSize, pageSize int) (items []*HomeArticle, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * ,(SELECT count(1) FROM cygx_article_history_record_newpv as h WHERE h.article_id = a.article_id ) as pv
- FROM cygx_article AS a
- WHERE a.publish_status=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY publish_date DESC,article_id DESC LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- func GetReportTacticsList(condition string, pars []interface{}, userId, startSize, pageSize int) (items []*HomeArticle, err error) {
- o := orm.NewOrm()
- sql := ` SELECT *
- FROM cygx_article AS a
- WHERE a.publish_status=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY publish_date DESC LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
|