|
@@ -626,96 +626,57 @@ func (this *ReportController) GetReportChapterList() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // TODO 获取更新规则
|
|
|
- researchType := chapterList[0].ReportType
|
|
|
- chapterTypeList, tmpErr := models.GetAllReportChapterTypeListByResearchType(researchType)
|
|
|
- if tmpErr != nil {
|
|
|
- br.Msg = "获取更新规则失败"
|
|
|
- br.ErrMsg = "获取更新规则失败, Err: " + tmpErr.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- // 调整章节更新
|
|
|
- nowTime := time.Now().Local()
|
|
|
+ // 章节类型的字段
|
|
|
for _, item := range chapterList {
|
|
|
- stop := false
|
|
|
- for _, rule := range chapterTypeList {
|
|
|
- if rule.ReportChapterTypeId == item.TypeId {
|
|
|
- //fmt.Println("rule.Enabled :", rule.Enabled, ";name=", rule.ReportChapterTypeName, "item.IsEdit:", item.IsEdit, "rule.IsSet:", rule.IsSet)
|
|
|
- // 如果被永久暂停更新了
|
|
|
- if rule.Enabled == 0 && item.IsEdit == 0 { //该章节已被永久禁用,同时未被操作过
|
|
|
- stop = true
|
|
|
- } else if rule.PauseStartTime != "" && rule.PauseEndTime != "" && rule.PauseStartTime != utils.EmptyDateStr && rule.PauseEndTime != utils.EmptyDateStr {
|
|
|
- startTime, timeErr := time.ParseInLocation(utils.FormatDate, rule.PauseStartTime, time.Local)
|
|
|
- if timeErr != nil {
|
|
|
- br.Msg = "获取更新规则失败"
|
|
|
- br.ErrMsg = "更新规则时间转换失败4001, Err: " + timeErr.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- endTime, timeErr := time.ParseInLocation(utils.FormatDate, rule.PauseEndTime, time.Local)
|
|
|
- if timeErr != nil {
|
|
|
- br.Msg = "获取更新规则失败"
|
|
|
- br.ErrMsg = "更新规则时间转换失败4002, Err: " + timeErr.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- // 暂停更新
|
|
|
- if nowTime.After(startTime) && nowTime.Before(endTime.AddDate(0, 0, 1)) {
|
|
|
- stop = true
|
|
|
- }
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
+ // 授权的用户列表
|
|
|
+ tmpChapterIdGrandList, ok := chapterIdGrandListMap[item.ReportChapterId]
|
|
|
+ if !ok {
|
|
|
+ tmpChapterIdGrandList = make([]int, 0)
|
|
|
+ }
|
|
|
+ // 关联的品种列表
|
|
|
+ tmpChapterIdPermissionList, ok := chapterIdPermissionListMap[item.ReportChapterId]
|
|
|
+ if !ok {
|
|
|
+ tmpChapterIdPermissionList = make([]int, 0)
|
|
|
}
|
|
|
- if !stop {
|
|
|
- // 授权的用户列表
|
|
|
- tmpChapterIdGrandList, ok := chapterIdGrandListMap[item.ReportChapterId]
|
|
|
- if !ok {
|
|
|
- tmpChapterIdGrandList = make([]int, 0)
|
|
|
- }
|
|
|
- // 关联的品种列表
|
|
|
- tmpChapterIdPermissionList, ok := chapterIdPermissionListMap[item.ReportChapterId]
|
|
|
- if !ok {
|
|
|
- tmpChapterIdPermissionList = make([]int, 0)
|
|
|
- }
|
|
|
|
|
|
- tmpChapterItem := models.ReportChapterResp{
|
|
|
- ReportChapterId: item.ReportChapterId,
|
|
|
- ReportId: item.ReportId,
|
|
|
- ReportType: item.ReportType,
|
|
|
- TypeId: item.TypeId,
|
|
|
- TypeName: item.TypeName,
|
|
|
- TypeEditImg: typeIdImg[item.TypeId],
|
|
|
- Title: item.Title,
|
|
|
- IsEdit: item.IsEdit,
|
|
|
- Trend: item.Trend,
|
|
|
- Sort: item.Sort,
|
|
|
- PublishState: item.PublishState,
|
|
|
- VideoUrl: item.VideoUrl,
|
|
|
- VideoName: item.VideoName,
|
|
|
- VideoPlaySeconds: item.VideoPlaySeconds,
|
|
|
- VideoSize: item.VideoSize,
|
|
|
- VideoKind: item.VideoKind,
|
|
|
- ModifyTime: item.ModifyTime.Format(utils.FormatDate),
|
|
|
- GrandAdminIdList: tmpChapterIdGrandList,
|
|
|
- PermissionIdList: tmpChapterIdPermissionList,
|
|
|
- }
|
|
|
- markStatus, err := services.UpdateReportEditMark(item.ReportId, item.ReportChapterId, this.SysUser.AdminId, 2, this.SysUser.RealName, this.Lang)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "查询标记状态失败"
|
|
|
- br.ErrMsg = "查询标记状态失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+ tmpChapterItem := models.ReportChapterResp{
|
|
|
+ ReportChapterId: item.ReportChapterId,
|
|
|
+ ReportId: item.ReportId,
|
|
|
+ ReportType: item.ReportType,
|
|
|
+ TypeId: item.TypeId,
|
|
|
+ TypeName: item.TypeName,
|
|
|
+ TypeEditImg: typeIdImg[item.TypeId],
|
|
|
+ Title: item.Title,
|
|
|
+ IsEdit: item.IsEdit,
|
|
|
+ Trend: item.Trend,
|
|
|
+ Sort: item.Sort,
|
|
|
+ PublishState: item.PublishState,
|
|
|
+ VideoUrl: item.VideoUrl,
|
|
|
+ VideoName: item.VideoName,
|
|
|
+ VideoPlaySeconds: item.VideoPlaySeconds,
|
|
|
+ VideoSize: item.VideoSize,
|
|
|
+ VideoKind: item.VideoKind,
|
|
|
+ ModifyTime: item.ModifyTime.Format(utils.FormatDate),
|
|
|
+ GrandAdminIdList: tmpChapterIdGrandList,
|
|
|
+ PermissionIdList: tmpChapterIdPermissionList,
|
|
|
+ }
|
|
|
+ markStatus, err := services.UpdateReportEditMark(item.ReportId, item.ReportChapterId, this.SysUser.AdminId, 2, this.SysUser.RealName, this.Lang)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询标记状态失败"
|
|
|
+ br.ErrMsg = "查询标记状态失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- if markStatus.Status == 0 {
|
|
|
- tmpChapterItem.CanEdit = true
|
|
|
- } else {
|
|
|
- tmpChapterItem.Editor = markStatus.Editor
|
|
|
- }
|
|
|
+ if markStatus.Status == 0 {
|
|
|
+ tmpChapterItem.CanEdit = true
|
|
|
+ } else {
|
|
|
+ tmpChapterItem.Editor = markStatus.Editor
|
|
|
+ }
|
|
|
|
|
|
- // 报告章节的操作权限
|
|
|
- tmpChapterItem.IsAuth = services.CheckChapterAuthByAdminIdList(sysUser.AdminId, reportInfo.AdminId, tmpChapterIdGrandList)
|
|
|
+ // 报告章节的操作权限
|
|
|
+ tmpChapterItem.IsAuth = services.CheckChapterAuthByAdminIdList(sysUser.AdminId, reportInfo.AdminId, tmpChapterIdGrandList)
|
|
|
|
|
|
- resp = append(resp, tmpChapterItem)
|
|
|
- }
|
|
|
+ resp = append(resp, tmpChapterItem)
|
|
|
}
|
|
|
}
|
|
|
|