|
@@ -178,12 +178,13 @@ func (this *ReportController) Detail() {
|
|
|
return
|
|
|
}
|
|
|
// 有效期是否到期
|
|
|
- var IsVail bool
|
|
|
+ var vailStatus int
|
|
|
if user.Status == utils.UserStatusFormal {
|
|
|
if user.ValidEndTime.After(time.Now()) && user.ValidStartTime.Before(time.Now()) {
|
|
|
- IsVail = true
|
|
|
+ vailStatus = 2
|
|
|
} else {
|
|
|
- IsVail = false
|
|
|
+ // 不在有效期时间则设置为过期, 将用户状态禁用
|
|
|
+ vailStatus = 1
|
|
|
user.Status = utils.UserStatusNo
|
|
|
}
|
|
|
}
|
|
@@ -230,20 +231,20 @@ func (this *ReportController) Detail() {
|
|
|
|
|
|
resp := new(response.ReportDetailResp)
|
|
|
if !IsPublic {
|
|
|
- // 如果被禁用或是潜在用户,直接返回无阅读报告权限
|
|
|
- if user.Status == utils.UserStatusNo || user.Status == utils.UserStatusPotential {
|
|
|
+ // 如果是私有报告,用户权限过期直接返回有效期已过
|
|
|
+ if vailStatus == 1 {
|
|
|
resp.Report = report
|
|
|
- resp.Status = utils.ReportPermissionStatusNo
|
|
|
+ resp.Status = utils.ReportPermissionStatusExpired
|
|
|
report.Content = ""
|
|
|
br.Ret = 200
|
|
|
br.Data = resp
|
|
|
br.Msg = "用户权限不足"
|
|
|
return
|
|
|
}
|
|
|
- // 如果是私有报告,用户权限过期直接返回有效期已过
|
|
|
- if !IsVail {
|
|
|
+ // 如果被禁用或是潜在用户,直接返回无阅读报告权限
|
|
|
+ if user.Status == utils.UserStatusNo || user.Status == utils.UserStatusPotential {
|
|
|
resp.Report = report
|
|
|
- resp.Status = utils.ReportPermissionStatusExpired
|
|
|
+ resp.Status = utils.ReportPermissionStatusNo
|
|
|
report.Content = ""
|
|
|
br.Ret = 200
|
|
|
br.Data = resp
|