diff --git a/COMCMS.Core/Models/APIModels.cs b/COMCMS.Core/Models/APIModels.cs
index 267cbe2..b0a9aae 100644
--- a/COMCMS.Core/Models/APIModels.cs
+++ b/COMCMS.Core/Models/APIModels.cs
@@ -38,4 +38,29 @@ namespace COMCMS.Core.Models
public int qty { get; set; } = 1;
}
#endregion
+
+ #region 系统文件目录信息列表
+ ///
+ /// 系统文件目录信息
+ ///
+ public class DirInfo
+ {
+ ///
+ /// 目录名称
+ ///
+ public string name { get; set; }
+ ///
+ /// 目录
+ ///
+ public string path { get; set; }
+ ///
+ /// 目录详情
+ ///
+ public string fullPath { get; set; }
+ ///
+ /// 子目录
+ ///
+ public List subList { get; set; }
+ }
+ #endregion
}
diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/AttachController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/AttachController.cs
index 3e775e6..5afc9e3 100644
--- a/COMCMS.Web/Areas/AdminCP/Controllers/AttachController.cs
+++ b/COMCMS.Web/Areas/AdminCP/Controllers/AttachController.cs
@@ -37,7 +37,13 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
[MyAuthorize("viewlist", "attach")]
public IActionResult AttachList()
{
+ List all = getAllAttach("");
+ string allJson = JsonConvert.SerializeObject(all);
+ //string basePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";//基础目录
+
+ //string[] arrDirs = Directory.GetDirectories(basePath);
return View();
+ //return Content(JsonConvert.SerializeObject(allJson));
}
#endregion
@@ -46,7 +52,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
[MyAuthorize("viewlist", "attach","JSON")]
public IActionResult GetDirList(string subdir)
{
- string attachPath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";
+ //string attachPath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";
@@ -54,5 +60,42 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
return Json(tip);
}
#endregion
+
+ #region 获取附件目录和所有子目录树
+ ///
+ /// 所有所有附件目录树
+ ///
+ /// 子目录,需要完整,如:images/2020
+ ///
+ public List getAllAttach(string subdir)
+ {
+ List list = new List();
+ string basePath = $"{_env.WebRootPath}{Path.DirectorySeparatorChar}{attach.AttachPatch}{Path.DirectorySeparatorChar}";//基础目录
+ if (!string.IsNullOrEmpty(subdir))
+ {
+ basePath += subdir.Replace("/", Path.DirectorySeparatorChar.ToString());
+ }
+
+ string[] arrDirs = Directory.GetDirectories(basePath);
+
+ if (arrDirs !=null && arrDirs.Length > 0)
+ {
+ foreach (var item in arrDirs)
+ {
+ string nextSubDir = subdir + "/" + item.Substring(item.LastIndexOf(Path.DirectorySeparatorChar)+1);
+ var tpmList = getAllAttach(nextSubDir);
+ list.Add(new DirInfo()
+ {
+ name = item.Substring(item.LastIndexOf(Path.DirectorySeparatorChar)+1),
+ path = nextSubDir,
+ //fullPath = item,
+ subList = tpmList
+ });
+ }
+ }
+
+ return list;
+ }
+ #endregion
}
}
diff --git a/COMCMS.Web/Areas/AdminCP/Views/Attach/AttachList.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Attach/AttachList.cshtml
new file mode 100644
index 0000000..601e84a
--- /dev/null
+++ b/COMCMS.Web/Areas/AdminCP/Views/Attach/AttachList.cshtml
@@ -0,0 +1,75 @@
+@{
+ ViewBag.title = "附件管理";
+}
+
+
+
+
+
+
+
+
显示:
+
所有
+
文档
+
视频
+
图片
+
+
+
+
文件夹
+
+
标签
+
+
+
+
+
+
+
+
+
+