Browse Source

fix:完善查看研报和图表的逻辑

zqbao 10 months ago
parent
commit
d568f32ecb
2 changed files with 15 additions and 0 deletions
  1. 8 0
      controllers/chart.go
  2. 7 0
      controllers/report.go

+ 8 - 0
controllers/chart.go

@@ -90,6 +90,14 @@ func (this *ChartController) Detail() {
 		chart, err = models.GetChartByUniqueCode(uniqueCode)
 	}
 	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			item := new(models.ChartInfoView)
+			br.Ret = 200
+			br.Data = item
+			br.Msg = "图表不存在"
+			br.Success = true
+			return
+		}
 		br.Msg = "获取图表详情失败"
 		br.ErrMsg = "获取图表详情失败,系统错误,Err:" + err.Error()
 		return

+ 7 - 0
controllers/report.go

@@ -183,6 +183,13 @@ func (this *ReportController) Detail() {
 
 	report, err := models.GetReportById(reportId)
 	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Ret = 200
+			br.Data = new(response.ReportDetailResp)
+			br.Success = true
+			br.Msg = "该报告已删除或不存在"
+			return
+		}
 		br.Msg = "该报告已删除"
 		br.ErrMsg = "获取报告详情失败,Err:" + err.Error()
 		return