package models import ( "eta/eta_mini_api/utils" "time" ) type ReportView struct { Id int `description:"报告Id"` AddType int `description:"新增方式:1:新增报告,2:继承报告"` ClassifyIdFirst int `description:"一级分类id"` ClassifyNameFirst string `description:"一级分类名称"` ClassifyIdSecond int `description:"二级分类id"` ClassifyNameSecond string `description:"二级分类名称"` ClassifyIdThird int `description:"三级分类id"` ClassifyNameThird string `description:"三级分类名称"` PermissionNames []string `description:"二级分类名称"` Title string `description:"标题"` Abstract string `description:"摘要"` Author string `description:"作者"` Frequency string `description:"频度"` CreateTime string `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` State int `description:"1:未发布,2:已发布"` PublishTime string `description:"发布时间"` Stage int `description:"期数"` MsgIsSend int `description:"消息是否已发送,0:否,1:是"` Content string `description:"内容"` ChapterContent []*ReportChapter `description:"章节内容"` VideoUrl string `description:"音频文件URL"` VideoName string `description:"音频文件名称"` VideoPlaySeconds string `description:"音频播放时长"` VideoSize string `description:"音频文件大小,单位M"` HasPermission int `description:"是否拥有报告权限,1:拥有,0:没有"` TitleType string `description:"标题类型,FICC或者权益"` IsCurrentDate int `description:"是否当前日期:1是,0不是"` IsPublic bool `description:"是否是公共报告"` ReportType int `description:"报告类型,1:eta报告,2:pdf报告"` PdfUrl string `description:"pdf文件URL"` CollaborateType int `description:"合作类型, 1:个人,2:多人协作"` ReportLayout int `description:"报告布局, 1:常规布局,2:智能布局"` HasChapter int `description:"是否有章节: 0-否 1-是"` HeadResource *SmartReportResource `description:"版头资源库"` EndResource *SmartReportResource `description:"版尾资源库"` ClassifyDetail } type ReportDetail struct { Id int `description:"报告Id"` AddType int `description:"新增方式:1:新增报告,2:继承报告"` ClassifyIdFirst int `description:"一级分类id"` ClassifyNameFirst string `description:"一级分类名称"` ClassifyIdSecond int `description:"二级分类id"` ClassifyNameSecond string `description:"二级分类名称"` ClassifyIdThird int `description:"三级分类id"` ClassifyNameThird 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:"发布时间"` Stage int `description:"期数"` MsgIsSend int `description:"消息是否已发送,0:否,1:是"` Content string `description:"内容"` ChapterContent []*ReportChapter `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:"分类名称"` TitleType string `description:"标题类型,FICC或者权益"` IsPublic bool `description:"是否是公共报告"` CollaborateType int `description:"合作类型, 1:个人,2:多人协作"` ReportLayout int `description:"报告布局, 1:常规布局,2:智能布局"` HasChapter int `description:"是否有章节: 0-否 1-是"` HeadResource SmartReportResource `description:"版头资源库"` EndResource SmartReportResource `description:"版尾资源库"` } type ReportChapter struct { Title string `description:"章节标题"` Content string `description:"章节内容"` } type SmartReportResource struct { ResourceId int `description:"资源库id"` ImgUrl string `description:"图片url"` Type int `description:"资源类型:1-版头 2-版尾"` Style string `description:"版图样式"` } type ByPublishTimeReportView []*ReportView func (a ByPublishTimeReportView) Len() int { return len(a) } func (a ByPublishTimeReportView) Less(i, j int) bool { if a[i].PublishTime == "" { return true } if a[j].PublishTime == "" { return false } aiTime, err := time.Parse(utils.FormatDateTime, a[i].PublishTime) if err != nil { return true } ajTime, err := time.Parse(utils.FormatDateTime, a[j].PublishTime) if err != nil { return false } return aiTime.After(ajTime) } func (a ByPublishTimeReportView) Swap(i, j int) { a[i], a[j] = a[j], a[i] }