|
@@ -99,7 +99,7 @@ func GetChapterListByReport(classifyNameFirst string, reportId int, companyId in
|
|
|
}
|
|
|
}
|
|
|
//获取所有当前研报的章节
|
|
|
- chapterList, tErr := report_chapter.GetListByReportId(reportId)
|
|
|
+ chapterList, tErr := report_chapter.GetListByReportId(reportId, classifyNameFirst)
|
|
|
if tErr != nil && tErr != utils.ErrNoRow{
|
|
|
errMsg = err.Error()
|
|
|
err = errors.New("章节查询出错")
|
|
@@ -183,6 +183,10 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
|
|
|
err = errors.New("报告不存在")
|
|
|
return
|
|
|
}
|
|
|
+ if reportInfo.ClassifyNameFirst == "周报" && reportChapter.IsEdit != 1 {
|
|
|
+ err = errors.New("章节未编辑")
|
|
|
+ return
|
|
|
+ }
|
|
|
//判断权限
|
|
|
permissionIds, tErr := company.GetValidPermissionIdListByCompany2ProductId(user.CompanyID, 1)
|
|
|
if tErr != nil && tErr != utils.ErrNoRow {
|
|
@@ -192,7 +196,7 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
|
|
|
}
|
|
|
|
|
|
//TODO 修改权限校验接口,如果用户没有权限也要允许用户查看部分内容
|
|
|
- authOk, permissionCheckInfo, tErr = company.CheckPermissionByPermissionIdList2Ficc(user.CompanyID, int(user.UserID), permissionIds)
|
|
|
+ authOk, permissionCheckInfo, tErr = company.GetCheckPermission(user.CompanyID, int(user.UserID), permissionIds)
|
|
|
if tErr != nil && tErr != utils.ErrNoRow{
|
|
|
errMsg = tErr.Error()
|
|
|
err = errors.New("权限查询出错")
|
|
@@ -230,9 +234,9 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
|
|
|
reportChapterItem.VideoUrl = reportChapter.VideoUrl
|
|
|
//底部菜单切换
|
|
|
if reportInfo.ClassifyNameFirst == "周报" {
|
|
|
- chapterMenu, err = GetMenuChapter(reportInfo.Id, newTypeIds)
|
|
|
+ chapterMenu, err = GetMenuChapter(reportInfo.Id, newTypeIds, reportInfo.ClassifyNameFirst)
|
|
|
}else{
|
|
|
- chapterMenu, err = GetMenuChapter(reportInfo.Id, typeIds)
|
|
|
+ chapterMenu, err = GetMenuChapter(reportInfo.Id, typeIds, reportInfo.ClassifyNameFirst)
|
|
|
}
|
|
|
}else{
|
|
|
reportChapterItem.ContentSub = reportChapter.ContentSub
|
|
@@ -245,7 +249,7 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetMenuChapter(reportId int, typeIds []int) (reportTypeList []*response.ReportChapterMenu, err error) {
|
|
|
+func GetMenuChapter(reportId int, typeIds []int, classifyNameFirst string) (reportTypeList []*response.ReportChapterMenu, err error) {
|
|
|
//查询有效的章节
|
|
|
typeList, tErr := report_chapter_type.GetEffectTypes()
|
|
|
if tErr != nil {
|
|
@@ -262,7 +266,7 @@ func GetMenuChapter(reportId int, typeIds []int) (reportTypeList []*response.Rep
|
|
|
}
|
|
|
|
|
|
//获取所有当前研报的章节
|
|
|
- chapterList, tErr := report_chapter.GetListByReportIdTypeIds(reportId, typeIds)
|
|
|
+ chapterList, tErr := report_chapter.GetListByReportIdTypeIds(reportId, typeIds, classifyNameFirst)
|
|
|
if tErr != nil && tErr != utils.ErrNoRow{
|
|
|
return
|
|
|
}
|
|
@@ -279,4 +283,28 @@ func GetMenuChapter(reportId int, typeIds []int) (reportTypeList []*response.Rep
|
|
|
}
|
|
|
}
|
|
|
return
|
|
|
+}
|
|
|
+
|
|
|
+// CheckWeekReportPermission 验证周报的权限
|
|
|
+func CheckWeekReportPermission(userInfo user.UserInfo, reportId int) (authOk bool, permissionCheckInfo company.PermissionCheckInfo, err error) {
|
|
|
+ permissionIds, err := chart_permission_chapter_mapping.GetPermissionIdsByReportId(reportId, "week")
|
|
|
+ if err != nil && err != utils.ErrNoRow {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ authOk, permissionCheckInfo, err = company.GetCheckPermission(userInfo.CompanyID, int(userInfo.UserID), permissionIds)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// CheckDayReportPermission 验证晨报的权限
|
|
|
+func CheckDayReportPermission(userInfo user.UserInfo) (authOk bool, permissionCheckInfo company.PermissionCheckInfo, err error) {
|
|
|
+ permissions, err := company.GetValidPermissionByCompany2ProductId(userInfo.CompanyID, 1)
|
|
|
+ if err != nil && err != utils.ErrNoRow {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var permissionIds []int
|
|
|
+ for _, item := range permissions {
|
|
|
+ permissionIds = append(permissionIds, item.ChartPermissionID)
|
|
|
+ }
|
|
|
+ authOk, permissionCheckInfo, err = company.GetCheckPermission(userInfo.CompanyID, int(userInfo.UserID), permissionIds)
|
|
|
+ return
|
|
|
}
|