|
@@ -26,26 +26,25 @@ func (ETAReport) TableName() string {
|
|
|
}
|
|
|
|
|
|
type ETAReport struct {
|
|
|
- ID int `gorm:"primary_key;auto_increment"`
|
|
|
- ClassifyID int `gorm:"_"`
|
|
|
- ClassifyIDFirst int `gorm:"column:classify_id_first;default:0"`
|
|
|
- ClassifyIDSecond int `gorm:"column:classify_id_second;default:0"`
|
|
|
- ClassifyIDThird int `gorm:"column:classify_id_third;default:0"`
|
|
|
- Title string `gorm:"column:title;size:125;"`
|
|
|
- Abstract string `gorm:"column:abstract;size:255;"`
|
|
|
- Author string `gorm:"column:author;size:50;"`
|
|
|
- PublishTime string `gorm:"column:publish_time"`
|
|
|
- PublishedTime time.Time
|
|
|
- Content string `gorm:"column:content"`
|
|
|
- CollaborateType int `gorm:"column:collaborate_type"`
|
|
|
- ReportLayout int `gorm:"column:report_layout"`
|
|
|
- VideoUrl string `gorm:"column:video_url"`
|
|
|
- VideoName string `gorm:"column:video_name"`
|
|
|
- VideoPlaySeconds string `gorm:"column:video_play_seconds"`
|
|
|
- HeadResourceId int `gorm:"column:head_resource_id"`
|
|
|
- EndResourceId int `gorm:"column:end_resource_id"`
|
|
|
- HasChapter bool `gorm:"column:has_chapter"`
|
|
|
- NeedSplice bool `gorm:"column:need_splice"`
|
|
|
+ ID int `gorm:"primary_key;auto_increment"`
|
|
|
+ ClassifyID int `gorm:"_"`
|
|
|
+ ClassifyIDFirst int `gorm:"column:classify_id_first;default:0"`
|
|
|
+ ClassifyIDSecond int `gorm:"column:classify_id_second;default:0"`
|
|
|
+ ClassifyIDThird int `gorm:"column:classify_id_third;default:0"`
|
|
|
+ Title string `gorm:"column:title;size:125;"`
|
|
|
+ Abstract string `gorm:"column:abstract;size:255;"`
|
|
|
+ Author string `gorm:"column:author;size:50;"`
|
|
|
+ PublishTime time.Time `gorm:"column:publish_time"`
|
|
|
+ Content string `gorm:"column:content"`
|
|
|
+ CollaborateType int `gorm:"column:collaborate_type"`
|
|
|
+ ReportLayout int `gorm:"column:report_layout"`
|
|
|
+ VideoUrl string `gorm:"column:video_url"`
|
|
|
+ VideoName string `gorm:"column:video_name"`
|
|
|
+ VideoPlaySeconds string `gorm:"column:video_play_seconds"`
|
|
|
+ HeadResourceId int `gorm:"column:head_resource_id"`
|
|
|
+ EndResourceId int `gorm:"column:end_resource_id"`
|
|
|
+ HasChapter bool `gorm:"column:has_chapter"`
|
|
|
+ NeedSplice bool `gorm:"column:need_splice"`
|
|
|
}
|
|
|
|
|
|
//type ReportClassify struct {
|
|
@@ -62,13 +61,6 @@ func GetETAReports(id int) (reports []ETAReport, err error) {
|
|
|
err = models.ETA().Table("report").Select(colunms+strings.Join(classifyIds, ",")).Where("state =? or state=?", published, passed).Where("id > ?", id).Order("id asc").Limit(limit).Find(&reports).Error
|
|
|
if reports != nil {
|
|
|
for i := 0; i < len(reports); i++ {
|
|
|
- var date time.Time
|
|
|
- date, err = time.Parse(time.DateTime, reports[i].PublishTime)
|
|
|
- if err != nil {
|
|
|
- logger.Error("时间转换错误:%v", err)
|
|
|
- } else {
|
|
|
- reports[i].PublishedTime = date
|
|
|
- }
|
|
|
setClassifyIdValue(&reports[i])
|
|
|
}
|
|
|
}
|
|
@@ -84,13 +76,13 @@ func GetUpdateETAReports() (reports []ETAReport, err error) {
|
|
|
}
|
|
|
if reports != nil {
|
|
|
for i := 0; i < len(reports); i++ {
|
|
|
- var date time.Time
|
|
|
- date, err = time.Parse(time.DateTime, reports[i].PublishTime)
|
|
|
- if err != nil {
|
|
|
- logger.Error("时间转换错误:%v", err)
|
|
|
- } else {
|
|
|
- reports[i].PublishedTime = date
|
|
|
- }
|
|
|
+ //var date time.Time
|
|
|
+ //date, err = time.Parse(time.DateTime, reports[i].PublishTime)
|
|
|
+ //if err != nil {
|
|
|
+ // logger.Error("时间转换错误:%v", err)
|
|
|
+ //} else {
|
|
|
+ // reports[i].PublishedTime = date
|
|
|
+ //}
|
|
|
setClassifyIdValue(&reports[i])
|
|
|
}
|
|
|
}
|
|
@@ -102,14 +94,14 @@ func GetETAReportById(id int) (report ETAReport, err error) {
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- var date time.Time
|
|
|
- date, err = time.Parse(time.DateTime, report.PublishTime)
|
|
|
- if err != nil {
|
|
|
- logger.Error("时间转换错误:%v", err)
|
|
|
- err = nil
|
|
|
- } else {
|
|
|
- report.PublishedTime = date
|
|
|
- }
|
|
|
+ //var date time.Time
|
|
|
+ //date, err = time.Parse(time.DateTime, report.PublishTime)
|
|
|
+ //if err != nil {
|
|
|
+ // logger.Error("时间转换错误:%v", err)
|
|
|
+ // err = nil
|
|
|
+ //} else {
|
|
|
+ // report.PublishedTime = date
|
|
|
+ //}
|
|
|
return
|
|
|
}
|
|
|
func DoSql(sql string, result interface{}, values ...interface{}) (err error) {
|