123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type DetailCygxResearchSummaryRep struct {
- ArticleId int `description:"报告Id"`
- Title string `description:"标题"`
- Department string `description:"作者"`
- PublishDate string `description:"发布时间"`
- VideoUrl string `description:"链接"`
- VideoPlaySeconds string `description:"时长"`
- VideoName string `description:"音频名称"`
- Abstract string `description:"摘要"`
- VisibleRange int `description:"设置可见范围1全部,0内部"`
- }
- type ResearchSummaryLetailResp struct {
- Detail *DetailCygxResearchSummaryRep
- HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
- List []*ResearchSummaryChartPermission
- IsShow bool `description:"是否展示"`
- }
- type ResearchSummaryChartPermission struct {
- ListName string `description:"列表名称"`
- IcoLink string `orm:"column(image_url)"description:"图标链接"`
- Type string `description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
- List []*CygxResearchSummaryLogSecond
- }
- type CygxResearchSummaryLogSecond struct {
- PermissionName string `description:"行业名称"`
- ChartPermissionId int `description:"行业ID"`
- IcoLink string `orm:"column(image_url)"description:"图标链接"`
- List []*CygxResearchSummaryLogThird
- }
- type CygxResearchSummaryLogThird struct {
- Body string `description:"内容"`
- ReportLink string `orm:"column(link_article_id)"description:"报告链接"`
- VideoUrl string `description:"链接"`
- IsHaveVideo bool `description:"是否含有音频文件"`
- }
- type IndustriaResearchSummary struct {
- IndustrialManagementId int `description:"产业Id"`
- IndustryName string `description:"产业名称"`
- }
- type ResearchSummaryId struct {
- ArticleId int `description:"报告I"`
- }
- // 通过纪要ID获取详情
- func GetCygxResearchSummaryInfoById(articleId int) (item *DetailCygxResearchSummaryRep, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_research_summary WHERE article_id=? AND publish_status = 1 `
- err = o.Raw(sql, articleId).QueryRow(&item)
- return
- }
- type CygxResearchSummaryLog struct {
- ArticleSunId int `description:"子级报告id"`
- ArticleId int `description:"父级报告Id"`
- ChartPermissionId int `description:"行业ID"`
- PermissionName string `description:"行业ID"`
- CreateTime time.Time `description:"创建时间"`
- Body string `description:"内容"`
- IndustrialSubjectId string `description:"标的ID"`
- IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
- SubjectName string `description:"标的名称"`
- Type string `description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
- }
- // 列表
- func GetResearchSummarylogListFirst(articleId int) (items []*ResearchSummaryChartPermission, err error) {
- o := orm.NewOrm()
- sql := `SELECT l.*
- FROM cygx_research_summary_log AS l
- WHERE l.article_id = ?
- GROUP BY l.type
- ORDER BY l.sort ASC`
- _, err = o.Raw(sql, articleId).QueryRows(&items)
- return
- }
- // 列表
- func GetResearchSummarylogSonListSecond(articleId int, artType string) (items []*CygxResearchSummaryLogSecond, err error) {
- o := orm.NewOrm()
- sql := `SELECT l.*
- FROM
- cygx_research_summary_log AS l
- WHERE l.article_id = ? AND l.type =?
- GROUP BY l.chart_permission_id
- ORDER BY l.chart_permission_sort ASC`
- _, err = o.Raw(sql, articleId, artType).QueryRows(&items)
- return
- }
- // 列表
- func GetResearchSummarylogSonListThird(articleId, chartPermissionId int, artType string) (items []*CygxResearchSummaryLogThird, err error) {
- o := orm.NewOrm()
- sql := `SELECT l.link_article_id,l.body ,a.video_url
- FROM cygx_research_summary_log AS l
- LEFT JOIN cygx_article as a ON a.article_id = l.link_article_id
- WHERE l.article_id = ? AND l.type =? AND l.chart_permission_id = ?
- ORDER BY l.chart_permission_sort ASC `
- _, err = o.Raw(sql, articleId, artType, chartPermissionId).QueryRows(&items)
- return
- }
- func UpdateResearchSummaryVoiceCounts(articleId int) (err error) {
- sql := `UPDATE cygx_research_summary SET voice_counts = voice_counts+1 WHERE article_id = ? `
- o := orm.NewOrm()
- _, err = o.Raw(sql, articleId).Exec()
- return
- }
- func UpdateMinutesSummaryVoiceCounts(articleId int) (err error) {
- sql := `UPDATE cygx_minutes_summary SET voice_counts = voice_counts+1 WHERE article_id = ? `
- o := orm.NewOrm()
- _, err = o.Raw(sql, articleId).Exec()
- return
- }
- func UpdateReportSelectionVoiceCounts(articleId int) (err error) {
- sql := `UPDATE cygx_report_selection SET voice_counts = voice_counts+1 WHERE article_id = ? `
- o := orm.NewOrm()
- _, err = o.Raw(sql, articleId).Exec()
- return
- }
|