package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type Report struct { Id int `description:"报告Id"` AddType int `description:"新增方式:1:新增报告,2:继承报告"` ClassifyIdFirst int `description:"一级分类id"` ClassifyNameFirst string `description:"一级分类名称"` ClassifyIdSecond int `description:"二级分类id"` ClassifyNameSecond string `description:"二级分类名称"` Title string `description:"标题"` Abstract string `description:"摘要"` Author string `description:"作者"` Frequency string `description:"频度"` CreateTime string `description:"创建时间"` ModifyTime string `description:"修改时间"` State int `description:"1:未发布,2:已发布"` PublishTime string `description:"发布时间"` PrePublishTime string `description:"预发布时间"` Stage int `description:"期数"` MsgIsSend int `description:"消息是否已发送,0:否,1:是"` Content string `description:"内容"` VideoUrl string `description:"音频文件URL"` VideoName string `description:"音频文件名称"` VideoPlaySeconds string `description:"音频播放时长"` VideoSize string `description:"音频文件大小,单位M"` ContentSub string `description:"内容前两个章节"` IsShowNewLabel int `description:"是否显示新标签"` IsCurrentDate int `description:"是否当前日期"` ClassifyName string `description:"分类名称"` HasChapter int `description:"是否有章节"` // eta1.8.3(研报改版)相关内容 ContentStruct string `description:"内容组件"` LastModifyAdminId int `description:"最后更新人ID"` LastModifyAdminName string `description:"最后更新人姓名"` ContentModifyTime time.Time `description:"内容更新时间"` Pv int `description:"pv"` Uv int `description:"uv"` HeadImg string `description:"报告头图地址"` EndImg string `description:"报告尾图地址"` HeadStyle string `description:"版头样式"` EndStyle string `description:"版尾样式"` CanvasColor string `description:"画布颜色"` NeedSplice int `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"` HeadResourceId int `description:"版头资源ID"` EndResourceId int `description:"版尾资源ID"` ClassifyIdThird int `description:"三级分类id"` ClassifyNameThird string `description:"三级分类名称"` CollaborateType int8 `description:"协作方式,1:个人,2:多人协作。默认:1"` ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"` IsPublicPublish int8 `description:"是否公开发布,1:是,2:否"` ReportCreateTime time.Time `description:"报告时间创建时间"` } func GetReportByCode(reportCode string) (item *Report, err error) { o := orm.NewOrm() sql := `SELECT * FROM report WHERE report_code=?` err = o.Raw(sql, reportCode).QueryRow(&item) return } type ReportShareDetailResp struct { Report *ReportItem `description:"报告"` Disclaimer string `description:"免责声明"` H5ShareName string `description:"研报分享抬头"` H5ReportShareImg string `description:"研报分享图片"` WatermarkChart string `description:"图表是否需要水印"` WatermarkReport string `description:"报告是否需要水印"` Hz int ReportLogo string `description:"报告logo"` } type ReportItem struct { *Report ChapterList []*ReportChapter } // UpdateReportPv // @Description: 研报pv自增 // @author: Roc // @datetime 2024-07-19 15:46:58 // @param reportId int // @return err error func UpdateReportPv(reportId int) (err error) { o := orm.NewOrm() sql := `UPDATE report SET pv = pv + 1 WHERE id = ?` _, err = o.Raw(sql, reportId).Exec() return }