Browse Source

文档管理中心

gmy 6 months ago
parent
commit
a7c737f0e1

+ 2 - 2
controllers/base_auth.go

@@ -222,11 +222,11 @@ func (c *BaseAuthController) Prepare() {
 			for _, s := range apis {
 				apiMap[s] = true
 			}
-			/*if !apiMap[uri] {
+			if !apiMap[uri] {
 				c.JSON(models.BaseResponse{Ret: 403, Msg: "无权访问!", ErrMsg: "无权访问!"}, false, false)
 				c.StopRun()
 				return
-			}*/
+			}
 		} else {
 			c.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
 			c.StopRun()

+ 4 - 0
controllers/document_manage/document_manage_controller.go

@@ -252,6 +252,10 @@ func (this *DocumentManageController) DocumentRuiSiDetail() {
 
 	reportDetail, err := document_manage_service.DocumentRuiSiDetail(reportId)
 	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "报告已被删除"
+			return
+		}
 		return
 	}
 

+ 5 - 2
models/document_manage_model/outside_report.go

@@ -82,14 +82,17 @@ func SaveOutsideReport(outsideReport OutsideReport) (id int64, err error) {
 // GetOutsideReportById 根据ID获取报告
 func GetOutsideReportById(id int) (outsideReport *OutsideReport, err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	err = o.QueryTable("outside_report").Filter("outside_report_id", id).One(&outsideReport)
+
+	outsideReport = &OutsideReport{}
+
+	err = o.QueryTable("outside_report").Filter("outside_report_id", id).One(outsideReport)
 	return
 }
 
 // UpdateOutsideReport 更新报告
 func UpdateOutsideReport(outsideReport *OutsideReport) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	_, err = o.Update(&outsideReport)
+	_, err = o.Update(outsideReport)
 	return
 }
 

+ 3 - 0
services/document_manage_service/document_manage_service.go

@@ -228,6 +228,9 @@ func DocumentRuiSiDetail(reportId int) (*models.ReportDetail, error) {
 
 	reportDetail, err := models.GetReportById(reportId)
 	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			return nil, fmt.Errorf("报告已被删除")
+		}
 		return nil, err
 	}