Explorar o código

修改上传人姓名

xyxie hai 2 meses
pai
achega
3685638267
Modificáronse 2 ficheiros con 1 adicións e 74 borrados
  1. 1 1
      controllers/material/material.go
  2. 0 73
      services/material/material.go

+ 1 - 1
controllers/material/material.go

@@ -1290,7 +1290,7 @@ func (this *MaterialController) BatchAdd() {
 			return
 		}
 	}
-	err = materialService.BatchAddMaterial(req.MaterialList, classifyId, sysUser.AdminId, sysUser.AdminName)
+	err = materialService.BatchAddMaterial(req.MaterialList, classifyId, sysUser.AdminId, sysUser.RealName)
 	if err != nil {
 		br.Msg = "文件上传失败"
 		br.ErrMsg = "文件上传失败,Err:" + err.Error()

+ 0 - 73
services/material/material.go

@@ -53,24 +53,6 @@ func MaterialClassifyItemsMakeTree(sysUser *system.Admin, allNode []*material.Ma
 	}
 }
 
-// GetMaterialClassifyListForMe 获取我创建的素材
-func GetMaterialClassifyListForMe(adminInfo system.Admin, resp *material.MaterialClassifyListResp, classifyId int) (errMsg string, err error) {
-
-	classifyAll, err := material.GetMaterialClassifyByParentId(classifyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		errMsg = "获取失败"
-		return
-	}
-	nodeAll := make([]*material.MaterialClassifyItems, 0)
-	for k := range classifyAll {
-		rootNode := classifyAll[k]
-		MaterialClassifyItemsMakeTree(&adminInfo, classifyAll, rootNode)
-		nodeAll = append(nodeAll, rootNode)
-	}
-	resp.AllNodes = nodeAll
-	return
-}
-
 func BatchAddMaterial(materialList []material.BatchAddMaterialItem, classifyId, opUserId int, opUserName string) (err error) {
 	addList := make([]*material.Material, 0)
 	sort, err := material.GetMaterialMaxSort()
@@ -342,61 +324,6 @@ func uploadToMaterial(oldRsourceUrl string) (resourceUrl string, err error, errM
 	return
 }
 
-func MaterialItemsMakeTree(allNode []*material.MaterialClassifyItems, sandListMap map[int][]*material.MaterialClassifyItems, classifyId int) (nodeAll []*material.MaterialClassifyItems) {
-	for k := range allNode {
-		if len(allNode[k].Children) > 0 {
-			MaterialItemsMakeTree(allNode[k].Children, sandListMap, classifyId)
-			allNode = append(allNode, sandListMap[allNode[k].ParentId]...)
-			nodeAll = allNode
-		} else if k == len(allNode)-1 {
-			allNode = append(allNode, sandListMap[allNode[k].ParentId]...)
-			nodeAll = allNode
-		}
-	}
-	if len(allNode) == 0 {
-		nodeAll = append(nodeAll, sandListMap[classifyId]...)
-	}
-	return
-}
-
-func MaterialClassifyHaveChild(allNode []*material.MaterialClassifyItems, node *material.MaterialClassifyItems) (childs []*material.MaterialClassifyItems, yes bool) {
-	for _, v := range allNode {
-		if v.ParentId == node.ClassifyId {
-			childs = append(childs, v)
-		}
-	}
-	if len(childs) > 0 {
-		yes = true
-	}
-	return
-}
-
-func MaterialClassifyItemsMakeTreeV2(sysUser *system.Admin, allNode []*material.MaterialClassifyItems, node *material.MaterialClassifyItems) {
-
-	childs, _ := materialClassifyHaveChildV2(allNode, node) //判断节点是否有子节点并返回
-	if len(childs) > 0 {
-		node.Children = append(node.Children, childs[0:]...) //添加子节点
-		for _, v := range childs {                           //查询子节点的子节点,并添加到子节点
-			_, has := materialClassifyHaveChildV2(allNode, v)
-			if has {
-				MaterialClassifyItemsMakeTreeV2(sysUser, allNode, v) //递归添加节点
-			}
-		}
-	}
-}
-
-func materialClassifyHaveChildV2(allNode []*material.MaterialClassifyItems, node *material.MaterialClassifyItems) (childs []*material.MaterialClassifyItems, yes bool) {
-	for _, v := range allNode {
-		if v.ParentId == node.ClassifyId && node.ClassifyId == 0 {
-			childs = append(childs, v)
-		}
-	}
-	if len(childs) > 0 {
-		yes = true
-	}
-	return
-}
-
 func MoveMaterialClassify(classifyInfo *material.MaterialClassify, req *material.MoveMaterialClassifyReq) (err error, errMsg string) {
 	nodeMove := models.SingleMoveNodeReq{}
 	nodeMove.NodeId = req.ClassifyId