|
@@ -0,0 +1,83 @@
|
|
|
+package english_report
|
|
|
+
|
|
|
+import (
|
|
|
+ "hongze/hongze_yb_en_api/global"
|
|
|
+ "hongze/hongze_yb_en_api/models/base"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type EnglishReport struct {
|
|
|
+ Id int `gorm:"primaryKey;column:id" json:"id"`
|
|
|
+ AddType int8 `gorm:"column:add_type" json:"add_type"` //新增方式:1:新增报告,2:继承报告
|
|
|
+ ClassifyIdFirst int `gorm:"column:classify_id_first" json:"classify_id_first"` //一级分类id
|
|
|
+ ClassifyNameFirst string `gorm:"column:classify_name_first" json:"classify_name_first"` //一级分类名称
|
|
|
+ ClassifyIdSecond int `gorm:"column:classify_id_second" json:"classify_id_second"` //二级分类id
|
|
|
+ ClassifyNameSecond string `gorm:"column:classify_name_second" json:"classify_name_second"` //二级分类名称
|
|
|
+ Title string `gorm:"column:title" json:"title"` //标题
|
|
|
+ Abstract string `gorm:"column:abstract" json:"abstract"` //摘要
|
|
|
+ Author string `gorm:"column:author" json:"author"` //作者
|
|
|
+ Frequency string `gorm:"column:frequency" json:"frequency"` //频度
|
|
|
+ State int8 `gorm:"column:state" json:"state"` //1:未发布,2:已发布
|
|
|
+ PublishTime time.Time `gorm:"column:publish_time" json:"publish_time"` //发布时间
|
|
|
+ Stage int `gorm:"column:stage" json:"stage"` //期数
|
|
|
+ MsgIsSend int8 `gorm:"column:msg_is_send" json:"msg_is_send"` //消息是否已发送,0:否,1:是
|
|
|
+ Content string `gorm:"column:content" json:"content"` //内容
|
|
|
+ Overview string `gorm:"column:overview" json:"overview"` //概述
|
|
|
+ VideoUrl string `gorm:"column:video_url" json:"video_url"` //音频文件URL
|
|
|
+ VideoName string `gorm:"column:video_name" json:"video_name"` //音频文件名称
|
|
|
+ VideoPlaySeconds string `gorm:"column:video_play_seconds" json:"video_play_seconds"` //音频播放时长
|
|
|
+ ContentSub string `gorm:"column:content_sub" json:"content_sub"` //内容前两个章节
|
|
|
+ ReportCode string `gorm:"column:report_code" json:"report_code"` //报告唯一编码
|
|
|
+ VideoSize string `gorm:"column:video_size" json:"video_size"` //音频文件大小,单位M
|
|
|
+ Pv int `gorm:"column:pv" json:"pv"`
|
|
|
+ ShareUrl string `gorm:"column:share_url" json:"share_url"` //分享url
|
|
|
+ PvEmail uint `gorm:"column:pv_email" json:"pv_email"` //分享邮箱的PV
|
|
|
+ EmailState uint8 `gorm:"column:email_state" json:"email_state"` //是否已群发邮件:0-否; 1-是
|
|
|
+ base.TimeBase
|
|
|
+}
|
|
|
+
|
|
|
+// TableName get sql table name.获取数据库表名
|
|
|
+func (r *EnglishReport) TableName() string {
|
|
|
+ return "english_report"
|
|
|
+}
|
|
|
+
|
|
|
+type ReportListReq struct {
|
|
|
+ ClassifyIdFirst string `json:"classify_id_first" form:"classify_id_first"`
|
|
|
+ ClassifyIdSecond string `json:"classify_id_second" form:"classify_id_second"`
|
|
|
+ base.PageReq
|
|
|
+}
|
|
|
+
|
|
|
+type ListItem struct {
|
|
|
+ Id int `json:"id"`
|
|
|
+ AddType int8 `json:"add_type"` //新增方式:1:新增报告,2:继承报告
|
|
|
+ ClassifyIdFirst int `json:"classify_id_first"` //一级分类id
|
|
|
+ ClassifyNameFirst string `json:"classify_name_first"` //一级分类名称
|
|
|
+ ClassifyIdSecond int `json:"classify_id_second"` //二级分类id
|
|
|
+ ClassifyNameSecond string `json:"classify_name_second"` //二级分类名称
|
|
|
+ Title string `json:"title"` //标题
|
|
|
+ Abstract string `json:"abstract"` //摘要
|
|
|
+ Author string `json:"author"` //作者
|
|
|
+ Frequency string `json:"frequency"` //频度
|
|
|
+ PublishTime string `json:"publish_time"` //发布时间
|
|
|
+ Stage int `json:"stage"` //期数
|
|
|
+ VideoUrl string `json:"video_url"` //音频文件URL
|
|
|
+ VideoName string `json:"video_name"` //音频文件名称
|
|
|
+ VideoPlaySeconds string `json:"video_play_seconds"` //音频播放时长
|
|
|
+ ReportCode string `json:"report_code"` //报告唯一编码
|
|
|
+ ShareUrl string `json:"share_url"` //分享url
|
|
|
+ CreateTime string `json:"create_time"` //创建时间
|
|
|
+ ModifyTime string `json:"modify_time"` //最后更新时间
|
|
|
+}
|
|
|
+
|
|
|
+func (r *EnglishReport) SelectPage(page base.IPage, condition string, pars []interface{}) (count int64, results []*EnglishReport, err error) {
|
|
|
+ results = make([]*EnglishReport, 0)
|
|
|
+ query := global.DEFAULT_MYSQL.Model(r).
|
|
|
+ Select("*").
|
|
|
+ Where(condition, pars...)
|
|
|
+ query.Count(&count)
|
|
|
+ if len(page.GetOrderItemsString()) > 0 {
|
|
|
+ query = query.Order(page.GetOrderItemsString())
|
|
|
+ }
|
|
|
+ err = query.Limit(int(page.GetPageSize())).Offset(int(page.Offset())).Find(&results).Error
|
|
|
+ return
|
|
|
+}
|