rdluck 4 years ago
parent
commit
4acf849b76
1 changed files with 12 additions and 9 deletions
  1. 12 9
      controllers/report.go

+ 12 - 9
controllers/report.go

@@ -59,6 +59,7 @@ func (this *ReportController) Detail() {
 		br.ErrMsg = "获取报告详情失败,Err:" + err.Error()
 		return
 	}
+
 	if report == nil {
 		status = 1
 		msg = "报告不存在"
@@ -156,15 +157,17 @@ func (this *ReportController) Detail() {
 	//判断大小权限
 	{
 		if status == 2 {
-			permissionCount, err := models.GetCompanyProductPermissionCount(company.CompanyId, productId)
-			if err != nil {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
-				return
-			}
-			if permissionCount >= maxPermissionCount {
-				status = 0
-				msg = ""
+			if company!=nil {
+				permissionCount, err := models.GetCompanyProductPermissionCount(company.CompanyId, productId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
+					return
+				}
+				if permissionCount >= maxPermissionCount {
+					status = 0
+					msg = ""
+				}
 			}
 		}
 	}