|
@@ -7,28 +7,30 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
type ReportChapterType struct {
|
|
type ReportChapterType struct {
|
|
- ReportChapterTypeId int `orm:"column(report_chapter_type_id);pk" description:"报告章节类型id"`
|
|
|
|
- ReportChapterTypeKey string `description:"章节key"`
|
|
|
|
- ReportChapterTypeThumb string `description:"H5展示的图片"`
|
|
|
|
- BannerUrl string `description:"banner显示图片"`
|
|
|
|
- ReportChapterTypeName string `description:"报告章节类型名称"`
|
|
|
|
- Sort int `description:"排序字段"`
|
|
|
|
- Enabled int `description:"启禁用状态"`
|
|
|
|
- CreatedTime time.Time `description:"创建时间"`
|
|
|
|
- LastUpdatedTime time.Time `description:"更新时间"`
|
|
|
|
- ResearchType string `description:"研报类型"`
|
|
|
|
- SelectedImage string `description:"选中时的图片"`
|
|
|
|
- UnselectedImage string `description:"没选中时的图片"`
|
|
|
|
- PcSelectedImage string `description:"PC-选中的图片"`
|
|
|
|
- PcUnselectedImage string `description:"PC-未选中的图片"`
|
|
|
|
- EditImgUrl string `description:"管理后台编辑时选用的图"`
|
|
|
|
- TickerTitle string `description:"指标列的标题"`
|
|
|
|
- IsShow int `description:"是否显示(研报小程序端根据此字段判断)"`
|
|
|
|
- PauseStartTime string `description:"暂停开始日期"`
|
|
|
|
- PauseEndTime string `description:"暂停结束日期"`
|
|
|
|
- IsSet int `description:"是否设置:0为设置,1已设置"`
|
|
|
|
- YbIconUrl string `description:"研报小程序icon"`
|
|
|
|
- YbBottomIcon string `description:"研报小程序详情底部icon"`
|
|
|
|
|
|
+ ReportChapterTypeId int `orm:"column(report_chapter_type_id);pk" description:"报告章节类型id"`
|
|
|
|
+ ReportChapterTypeKey string `description:"章节key"`
|
|
|
|
+ ReportChapterTypeThumb string `description:"H5展示的图片"`
|
|
|
|
+ BannerUrl string `description:"banner显示图片"`
|
|
|
|
+ ReportChapterTypeName string `description:"报告章节类型名称"`
|
|
|
|
+ Sort int `description:"排序字段"`
|
|
|
|
+ Enabled int `description:"启禁用状态"`
|
|
|
|
+ CreatedTime time.Time `description:"创建时间"`
|
|
|
|
+ LastUpdatedTime time.Time `description:"更新时间"`
|
|
|
|
+ ResearchType string `description:"研报类型"`
|
|
|
|
+ SelectedImage string `description:"选中时的图片"`
|
|
|
|
+ UnselectedImage string `description:"没选中时的图片"`
|
|
|
|
+ PcSelectedImage string `description:"PC-选中的图片"`
|
|
|
|
+ PcUnselectedImage string `description:"PC-未选中的图片"`
|
|
|
|
+ EditImgUrl string `description:"管理后台编辑时选用的图"`
|
|
|
|
+ TickerTitle string `description:"指标列的标题"`
|
|
|
|
+ IsShow int `description:"是否显示(研报小程序端根据此字段判断)"`
|
|
|
|
+ PauseStartTime string `description:"暂停开始日期"`
|
|
|
|
+ PauseEndTime string `description:"暂停结束日期"`
|
|
|
|
+ IsSet int `description:"是否设置:0为设置,1已设置"`
|
|
|
|
+ YbIconUrl string `description:"研报小程序icon"`
|
|
|
|
+ YbBottomIcon string `description:"研报小程序详情底部icon"`
|
|
|
|
+ ReportClassifyId int `description:"所属分类id"`
|
|
|
|
+ InheritReportChapterTypeId int `description:"继承的报告章节类型id"`
|
|
}
|
|
}
|
|
|
|
|
|
func (item *ReportChapterType) Create() (err error) {
|
|
func (item *ReportChapterType) Create() (err error) {
|
|
@@ -183,7 +185,7 @@ func ResetDayWeekReportUpdateRule(researchType string) (err error) {
|
|
}
|
|
}
|
|
|
|
|
|
// SetDayWeekReportUpdateRule 设置章节类型的暂停时间
|
|
// SetDayWeekReportUpdateRule 设置章节类型的暂停时间
|
|
-func SetDayWeekReportUpdateRule(researchType string, list []DayWeekReportUpdateRule) (err error) {
|
|
|
|
|
|
+func SetDayWeekReportUpdateRule(classifyId int, list []DayWeekReportUpdateRule) (err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
to, err := o.Begin()
|
|
to, err := o.Begin()
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -198,8 +200,8 @@ func SetDayWeekReportUpdateRule(researchType string, list []DayWeekReportUpdateR
|
|
}()
|
|
}()
|
|
|
|
|
|
// 先将所有品种的状态变更为启用
|
|
// 先将所有品种的状态变更为启用
|
|
- sql := ` UPDATE report_chapter_type SET pause_start_time = null, pause_end_time = null, is_set = 0 WHERE research_type = ?`
|
|
|
|
- _, err = to.Raw(sql, researchType).Exec()
|
|
|
|
|
|
+ sql := ` UPDATE report_chapter_type SET pause_start_time = null, pause_end_time = null, is_set = 0 WHERE report_classify_id = ?`
|
|
|
|
+ _, err = to.Raw(sql, classifyId).Exec()
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -208,8 +210,8 @@ func SetDayWeekReportUpdateRule(researchType string, list []DayWeekReportUpdateR
|
|
if v.PauseStartTime == `` || v.PauseEndTime == `` {
|
|
if v.PauseStartTime == `` || v.PauseEndTime == `` {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
- tmpSql := ` UPDATE report_chapter_type SET pause_start_time = ?, pause_end_time = ?, is_set = 1 WHERE research_type = ? AND report_chapter_type_id = ? `
|
|
|
|
- _, err = to.Raw(tmpSql, v.PauseStartTime, v.PauseEndTime, researchType, v.ReportChapterTypeId).Exec()
|
|
|
|
|
|
+ tmpSql := ` UPDATE report_chapter_type SET pause_start_time = ?, pause_end_time = ?, is_set = 1 WHERE report_classify_id = ? AND report_chapter_type_id = ? `
|
|
|
|
+ _, err = to.Raw(tmpSql, v.PauseStartTime, v.PauseEndTime, classifyId, v.ReportChapterTypeId).Exec()
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -292,6 +294,25 @@ func GetDisableUpdateReportChapterTypeListByResearchType() (list []*ReportChapte
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// GetDisableUpdateReportChapterTypeListByResearchTypeByClassifyIdList
|
|
|
|
+// @Description: 根据分类id列表获取停止更新的章节类型列表
|
|
|
|
+// @author: Roc
|
|
|
|
+// @datetime 2024-06-18 14:13:50
|
|
|
|
+// @param classifyIdList []int
|
|
|
|
+// @return list []*ReportChapterType
|
|
|
|
+// @return err error
|
|
|
|
+func GetDisableUpdateReportChapterTypeListByResearchTypeByClassifyIdList(classifyIdList []int) (list []*ReportChapterType, err error) {
|
|
|
|
+ num := len(classifyIdList)
|
|
|
|
+ if num <= 0 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ sql := ` SELECT * FROM report_chapter_type WHERE enabled = 0 AND report_classify_id in (` + utils.GetOrmInReplace(num) + `) `
|
|
|
|
+ _, err = o.Raw(sql, classifyIdList).QueryRows(&list)
|
|
|
|
+
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
// UpdateReportChapterTypeResp 停止更新的报告分类列表
|
|
// UpdateReportChapterTypeResp 停止更新的报告分类列表
|
|
type UpdateReportChapterTypeResp struct {
|
|
type UpdateReportChapterTypeResp struct {
|
|
Day []*ReportChapterType `description:"所有晨报品种"`
|
|
Day []*ReportChapterType `description:"所有晨报品种"`
|