xiexiaoyuan 3 年之前
父节点
当前提交
99b837fc84
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      models/tables/rddp/report/query.go
  2. 2 2
      services/report/report.go

+ 1 - 1
models/tables/rddp/report/query.go

@@ -137,7 +137,7 @@ func GetByReportId(id int) (item *Report, err error) {
 
 // GetByReportIds 根据id获取报告
 func GetByReportIds(ids []int) (list []*Report, err error) {
-	err = global.MYSQL["rddp"].Where("id in (?) and state = 2", ids).Select("id, create_time").Scan(&list).Error
+	err = global.MYSQL["rddp"].Model(Report{}).Where("id in (?) and state = 2", ids).Select("id, create_time").Scan(&list).Error
 	if err == utils.ErrNoRow {
 		err = nil
 	}

+ 2 - 2
services/report/report.go

@@ -358,7 +358,7 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 		return
 	}
 
-	if reportInfo.Stage != 2 {
+	if reportInfo.State != 2 {
 		err = errors.New("报告未发布")
 		return
 	}
@@ -613,7 +613,7 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 			return
 		}
 		total = int64(total1)
-		if searchResp.Hits != nil {
+		if searchResp.Hits != nil && total > 0 {
 			var reportIds []int
 			for _, v := range searchResp.Hits.Hits {
 				temp := new(report.Report)