Pārlūkot izejas kodu

后端: 登录用户获取文件资料通知的接口

baichengfei 4 gadi atpakaļ
vecāks
revīzija
3a054aaa30

+ 12 - 4
src/dashoo.cn/backend/api/controllers/document/document.go

@@ -2,7 +2,6 @@ package document
 
 import (
 	"encoding/json"
-	"log"
 	"time"
 
 	"dashoo.cn/backend/api/business/documentmanage"
@@ -102,6 +101,16 @@ func (this *DocumentController) GetFolderList() {
 		where = where + " and Type = 1 "
 	}
 
+	rangeType := ""
+	if this.User.IsCompanyUser == 0 && this.User.UnitId > 0 {
+		// 管理单位用户全部能看
+		rangeType = "1,2,3"
+	} else {
+		// 企业用户通用和外部
+		rangeType = "1,3"
+	}
+	where = where + " and RangeType in (" + rangeType + ")"
+
 	svc := documentmanage.GetDocumentmanageService(utils.DBE)
 	var list []documentmanage.DocumentInfo
 	total, list := svc.GetDocumentInfoByWhere(page.CurrentPage, page.Size, "Id desc", DocumentInfoName, where)
@@ -115,7 +124,7 @@ func (this *DocumentController) GetFolderList() {
 	this.ServeJSON()
 }
 
-// @Title 获取文件夹
+// @Title 未登录获取文件夹
 // @Description get Name,CreateOn
 // @Success 200 {object} models.Userblood
 // @router /getdocumentnameandtime [get]
@@ -132,7 +141,7 @@ func (this *DocumentController) GetDocumentNameAndTime() {
 	this.ServeJSON()
 }
 
-// @Title 获取文件夹
+// @Title 登录用户获取文件夹
 // @Description get user by token
 // @Success 200 {object} models.Userblood
 // @router /get-res-by-user [get]
@@ -141,7 +150,6 @@ func (this *DocumentController) GetDocumentNameAndTimeInSys() {
 	rangeType := this.GetString("RangeType")
 
 	// 1通用  2内部 3外部
-	log.Print(this.User)
 	if this.User.IsCompanyUser == 0 && this.User.UnitId > 0 {
 		// 管理单位用户全部能看
 		rangeType = "1,2,3"