Browse Source

研究研报告媒体风险等级筛选

kobe6258 6 months ago
parent
commit
b17187dbb9
2 changed files with 9 additions and 1 deletions
  1. 8 0
      domian/media/media_service.go
  2. 1 1
      models/media/media.go

+ 8 - 0
domian/media/media_service.go

@@ -132,6 +132,14 @@ func GetAnalystMediaPermissionMappingByPermissionIds(mediaType string, permissio
 		return 0, 0, ids
 	}
 	ids, err = mediaDao.GetAnalystMediaRangeReportIds(ids, analystId)
+	if err != nil {
+		logger.Error("根据研究员过滤媒体列表id失败:%v", err)
+		return 0, 0, ids
+	}
+	if len(ids) == 0 {
+		logger.Info("根据研究员过滤媒体列表id为空")
+		return 0, 0, ids
+	}
 	sort.Slice(ids, func(i, j int) bool {
 		return ids[i] > ids[j]
 	})

+ 1 - 1
models/media/media.go

@@ -111,7 +111,7 @@ func GetAnalystMediaRangeReportIds(srcIds []int, analystId int) (mediaIds []int,
 		return
 	}
 	db := models.Main()
-	err = db.Select(CommonColumns).Where(" id in ? and author_id = ? and id in ? and deleted =?", mediaIds, analystId, false).Find(&mediaIds).Error
+	err = db.Model(&Media{}).Select(CommonColumns).Where(" id in ? and author_id = ?  and deleted =?", mediaIds, analystId, false).Find(&mediaIds).Error
 	return
 }
 func GetMediaPageByAnalystId(latestId int64, limit int, offset int, mediaType string, analystId int, mediaIds []int) (mediaList []Media, err error) {