package models import ( "eta_gn/eta_report/global" ) type Report struct { Id int `gorm:"primaryKey;autoIncrement;column:id"` AddType int `gorm:"column:add_type" description:"新增方式:1:新增报告,2:继承报告"` ClassifyIdFirst int `gorm:"column:classify_id_first" description:"一级分类id"` ClassifyNameFirst string `gorm:"column:classify_name_first" description:"一级分类名称"` ClassifyIdSecond int `gorm:"column:classify_id_second" description:"二级分类id"` ClassifyNameSecond string `gorm:"column:classify_name_second" description:"二级分类名称"` Title string `gorm:"column:title" description:"标题"` Abstract string `gorm:"column:abstract" description:"摘要"` Author string `gorm:"column:author" description:"作者"` Frequency string `gorm:"column:frequency" description:"频度"` CreateTime string `gorm:"column:create_time" description:"创建时间"` ModifyTime string `gorm:"column:modify_time" description:"修改时间"` State int `gorm:"column:state" description:"1:未发布,2:已发布"` PublishTime string `gorm:"column:publish_time" description:"发布时间"` PrePublishTime string `gorm:"column:pre_publish_time" description:"预发布时间"` Stage int `gorm:"column:stage" description:"期数"` MsgIsSend int `gorm:"column:msg_is_send" description:"消息是否已发送,0:否,1:是"` Content string `gorm:"column:content" description:"内容"` VideoUrl string `gorm:"column:video_url" description:"音频文件URL"` VideoName string `gorm:"column:video_name" description:"音频文件名称"` VideoPlaySeconds string `gorm:"column:video_play_seconds" description:"音频播放时长"` VideoSize string `gorm:"column:video_size" description:"音频文件大小,单位M"` ContentSub string `gorm:"column:content_sub" description:"内容前两个章节"` IsShowNewLabel int `gorm:"column:is_show_new_label" description:"是否显示新标签"` IsCurrentDate int `gorm:"column:is_current_date" description:"是否当前日期"` ClassifyName string `gorm:"column:classify_name" description:"分类名称"` HasChapter int `gorm:"column:has_chapter" description:"是否有章节"` ContentStruct string `gorm:"column:content_struct" description:"内容组件"` LastModifyAdminId int `gorm:"column:last_modify_admin_id" description:"最后更新人ID"` LastModifyAdminName string `gorm:"column:last_modify_admin_name" description:"最后更新人姓名"` ContentModifyTime string `gorm:"column:content_modify_time" description:"内容更新时间"` Pv int `gorm:"column:pv" description:"pv"` Uv int `gorm:"column:uv" description:"uv"` HeadImg string `gorm:"column:head_img" description:"报告头图地址"` EndImg string `gorm:"column:end_img" description:"报告尾图地址"` HeadStyle string `gorm:"column:head_style" description:"版头样式"` EndStyle string `gorm:"column:end_style" description:"版尾样式"` CanvasColor string `gorm:"column:canvas_color" description:"画布颜色"` NeedSplice int `gorm:"column:need_splice" description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"` HeadResourceId int `gorm:"column:head_resource_id" description:"版头资源ID"` EndResourceId int `gorm:"column:end_resource_id" description:"版尾资源ID"` ClassifyIdThird int `gorm:"column:classify_id_third" description:"三级分类id"` ClassifyNameThird string `gorm:"column:classify_name_third" description:"三级分类名称"` CollaborateType int8 `gorm:"column:collaborate_type" description:"协作方式,1:个人,2:多人协作。默认:1"` ReportLayout int8 `gorm:"column:report_layout" description:"报告布局,1:常规布局,2:智能布局。默认:1"` IsPublicPublish int8 `gorm:"column:is_public_publish" description:"是否公开发布,1:是,2:否"` ReportCreateTime string `gorm:"column:report_create_time" description:"报告时间创建时间"` } func GetReportByCode(reportCode string) (item *Report, err error) { sql := `SELECT * FROM report WHERE report_code=?` err = global.DEFAULT_DmSQL.Raw(sql, reportCode).Scan(&item).Error 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) { sql := `UPDATE report SET pv = pv + 1 WHERE id = ?` err = global.DEFAULT_DmSQL.Exec(sql, reportId).Error return }