|
@@ -0,0 +1,326 @@
|
|
|
+package models
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type EnglishReport struct {
|
|
|
+ Id int `orm:"column(id)" description:"报告Id"`
|
|
|
+ AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
+ ClassifyNameSecond 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 time.Time `description:"发布时间"`
|
|
|
+ Stage int `description:"期数"`
|
|
|
+ Content string `description:"内容"`
|
|
|
+ VideoUrl string `description:"音频文件URL"`
|
|
|
+ VideoName string `description:"音频文件名称"`
|
|
|
+ VideoPlaySeconds string `description:"音频播放时长"`
|
|
|
+ VideoSize string `description:"音频文件大小,单位M"`
|
|
|
+ ContentSub string `description:"内容前两个章节"`
|
|
|
+ ReportCode string `description:"报告唯一编码"`
|
|
|
+ Pv int `description:"Pv"`
|
|
|
+ PvEmail int `description:"邮箱PV"`
|
|
|
+ EmailState int `description:"群发邮件状态: 0-未发送; 1-已发送"`
|
|
|
+ Overview string `description:"英文概述部分"`
|
|
|
+ KeyTakeaways string `description:"关键点"`
|
|
|
+ FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
|
|
|
+ AdminId int `description:"创建者账号"`
|
|
|
+ AdminRealName string `description:"创建者姓名"`
|
|
|
+}
|
|
|
+
|
|
|
+type AddEnglishReportReq struct {
|
|
|
+ AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
+ ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
+ Author string `description:"作者"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ State int `description:"状态:1:未发布,2:已发布"`
|
|
|
+ Content string `description:"内容"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ Overview string `description:"英文概述部分"`
|
|
|
+}
|
|
|
+
|
|
|
+type AddEnglishReportResp struct {
|
|
|
+ ReportId int64 `description:"报告id"`
|
|
|
+ ReportCode string `description:"报告code"`
|
|
|
+}
|
|
|
+
|
|
|
+type EditEnglishReportReq struct {
|
|
|
+ ReportId int64 `description:"报告id"`
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
+ ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
+ Author string `description:"作者"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ State int `description:"状态:1:未发布,2:已发布"`
|
|
|
+ Content string `description:"内容"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ Overview string `description:"英文概述部分"`
|
|
|
+}
|
|
|
+
|
|
|
+type EditEnglishReportFromPolicyReq struct {
|
|
|
+ ReportId int64 `description:"报告id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
+ Author string `description:"作者"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ //Overview string `description:"英文概述部分"`
|
|
|
+}
|
|
|
+type EditEnglishReportResp struct {
|
|
|
+ ReportId int64 `description:"报告id"`
|
|
|
+ ReportCode string `description:"报告code"`
|
|
|
+}
|
|
|
+
|
|
|
+type ElasticEnglishReportDetail struct {
|
|
|
+ Id string `description:"报告id或者线上路演Id"`
|
|
|
+ ReportId int `description:"报告id"`
|
|
|
+ VideoId int `description:"线上路演Id"`
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
+ ClassifyNameSecond string `description:"二级分类名称"`
|
|
|
+ StageStr string `description:"报告期数"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
+ Author string `description:"作者"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ PublishState int `description:"状态:1:未发布,2:已发布"`
|
|
|
+ BodyContent string `description:"内容"`
|
|
|
+ ContentSub string `description:"前两段内容"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ PublishTime string `description:"发布时间"`
|
|
|
+ ReportCode string `description:"报告唯一编码"`
|
|
|
+ Overview string `description:"英文概述部分"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type EnglishReportDetail struct {
|
|
|
+ Id int `orm:"column(id)" description:"报告Id"`
|
|
|
+ AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
+ ClassifyNameSecond 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:是"`
|
|
|
+ ReportCode string `description:"报告唯一编码"`
|
|
|
+ Content string `description:"内容"`
|
|
|
+ VideoUrl string `description:"音频文件URL"`
|
|
|
+ VideoName string `description:"音频文件名称"`
|
|
|
+ VideoPlaySeconds string `description:"音频播放时长"`
|
|
|
+ ContentSub string `description:"内容前两个章节"`
|
|
|
+ Pv int `description:"Pv"`
|
|
|
+ Overview string `description:"英文概述部分"`
|
|
|
+ FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
|
|
|
+ KeyTakeaways string `description:"关键点"`
|
|
|
+}
|
|
|
+
|
|
|
+type EnglishReportList struct {
|
|
|
+ Id int `description:"报告Id"`
|
|
|
+ AddType int `description:"新增方式:1:新增报告,2:继承报告"`
|
|
|
+ ClassifyIdFirst int `description:"一级分类id"`
|
|
|
+ ClassifyNameFirst string `description:"一级分类名称"`
|
|
|
+ ClassifyIdSecond int `description:"二级分类id"`
|
|
|
+ ClassifyNameSecond 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:"期数"`
|
|
|
+ Content string `description:"内容"`
|
|
|
+ VideoUrl string `description:"音频文件URL"`
|
|
|
+ VideoName string `description:"音频文件名称"`
|
|
|
+ VideoPlaySeconds string `description:"音频播放时长"`
|
|
|
+ ContentSub string `description:"内容前两个章节"`
|
|
|
+ ReportCode string `description:"报告唯一编码"`
|
|
|
+ Pv int `description:"Pv"`
|
|
|
+ ShareUrl string `description:"分享url"`
|
|
|
+ PvEmail int `description:"邮箱PV"`
|
|
|
+ EmailState int `description:"群发邮件状态: 0-未发送; 1-已发送"`
|
|
|
+ EmailAuth bool `description:"是否有权限群发邮件"`
|
|
|
+ EmailHasFail bool `description:"是否存在邮件发送失败的记录"`
|
|
|
+ CanEdit bool `description:"是否可编辑"`
|
|
|
+ Editor string `description:"编辑人"`
|
|
|
+ FromReportId int `description:"继承的报告ID(英文策略报告ID)"`
|
|
|
+ AdminId int `description:"创建者账号"`
|
|
|
+ AdminRealName string `description:"创建者姓名"`
|
|
|
+}
|
|
|
+
|
|
|
+type EnglishReportListResp struct {
|
|
|
+ List []*EnglishReportList
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+}
|
|
|
+
|
|
|
+//删除报告
|
|
|
+func DeleteEnglishReport(reportIds int) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := ` DELETE FROM english_report WHERE id =? `
|
|
|
+ _, err = o.Raw(sql, reportIds).Exec()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+type EnglishClassifyList struct {
|
|
|
+ Id int `orm:"column(id);pk"`
|
|
|
+ ClassifyName string `description:"分类名称"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ ParentId int `description:"父级分类id"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"修改时间"`
|
|
|
+ ClassifyLabel string `description:"分类标签"`
|
|
|
+ ShowType int `description:"展示类型:1-列表 2-专栏"`
|
|
|
+ IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
|
|
|
+ ClassifyType int `description:"分类类型:0英文报告,1英文线上路演"`
|
|
|
+ Child []*EnglishClassify
|
|
|
+}
|
|
|
+
|
|
|
+type EnglishClassifyListResp struct {
|
|
|
+ List []*EnglishClassifyList
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// Update 更新
|
|
|
+func (item *EnglishReport) Update(cols []string) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ _, err = o.Update(item, cols...)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ModifyEnglishReportAuthor 更改英文报告作者
|
|
|
+func ModifyEnglishReportAuthor(condition string, pars []interface{}, authorName string) (count int, err error) {
|
|
|
+ //产品权限
|
|
|
+ oRddp := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := `UPDATE english_report set author = ? WHERE 1=1 `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ err = oRddp.Raw(sql, authorName, pars).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+type EnglishClassify struct {
|
|
|
+ Id int `orm:"column(id);pk"`
|
|
|
+ ClassifyName string `description:"分类名称"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ ParentId int `description:"父级分类id"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"修改时间"`
|
|
|
+ ClassifyLabel string `description:"分类标签"`
|
|
|
+ ShowType int `description:"展示类型:1-列表 2-专栏"`
|
|
|
+ IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
|
|
|
+ ClassifyType int `description:"分类类型:0英文报告,1英文线上路演"`
|
|
|
+}
|
|
|
+
|
|
|
+func AddEnglishClassify(item *EnglishClassify) (lastId int64, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ lastId, err = o.Insert(item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func ModifyEnglishClassify(item *EnglishClassify) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := `UPDATE english_classify
|
|
|
+ SET
|
|
|
+ classify_name = ?,
|
|
|
+ sort = ?,
|
|
|
+ parent_id = ?,
|
|
|
+ modify_time = ?
|
|
|
+ WHERE id = ? `
|
|
|
+ _, err = o.Raw(sql, item.ClassifyName, item.Sort, item.ParentId, item.ModifyTime, item.Id).Exec()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateClassify 更新分类
|
|
|
+func (classifyInfo *EnglishClassify) UpdateEnglishClassify(cols []string) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ _, err = o.Update(classifyInfo, cols...)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateReport 更新英文报告
|
|
|
+func (reportInfo *EnglishReport) UpdateReport(cols []string) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ _, err = o.Update(reportInfo, cols...)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// MarkEditEnReport 标记编辑英文研报的请求数据
|
|
|
+type MarkEditEnReport struct {
|
|
|
+ ReportId int `description:"研报id"`
|
|
|
+ Status int `description:"标记状态,1:编辑中,2:编辑完成"`
|
|
|
+}
|
|
|
+
|
|
|
+type EnglishClassifyNameParentName struct {
|
|
|
+ Id int `description:"分类ID"`
|
|
|
+ ClassifyName string `description:"分类名称"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ ParentId int `description:"父级分类id"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"修改时间"`
|
|
|
+ ClassifyLabel string `description:"分类标签"`
|
|
|
+ ShowType int `description:"展示类型:1-列表 2-专栏"`
|
|
|
+ IsShow int `description:"是否在小程序显示:1-显示 0-隐藏"`
|
|
|
+ ParentClassifyName string `description:"父级分类名称"`
|
|
|
+}
|
|
|
+
|
|
|
+type RSClassifyList []*EnglishClassifyList
|
|
|
+
|
|
|
+func (m RSClassifyList) Len() int {
|
|
|
+ return len(m)
|
|
|
+}
|
|
|
+
|
|
|
+func (m RSClassifyList) Less(i, j int) bool {
|
|
|
+ return m[i].Sort < m[j].Sort
|
|
|
+}
|
|
|
+
|
|
|
+func (m RSClassifyList) Swap(i, j int) {
|
|
|
+ m[i], m[j] = m[j], m[i]
|
|
|
+}
|
|
|
+
|
|
|
+type RSChildClassifyList []*EnglishClassify
|
|
|
+
|
|
|
+func (m RSChildClassifyList) Len() int {
|
|
|
+ return len(m)
|
|
|
+}
|
|
|
+
|
|
|
+func (m RSChildClassifyList) Less(i, j int) bool {
|
|
|
+ return m[i].Sort < m[j].Sort
|
|
|
+}
|
|
|
+
|
|
|
+func (m RSChildClassifyList) Swap(i, j int) {
|
|
|
+ m[i], m[j] = m[j], m[i]
|
|
|
+}
|