diff --git a/COMCMS.API/COMCMS.API.csproj b/COMCMS.API/COMCMS.API.csproj index d73cd76..f98abdd 100644 --- a/COMCMS.API/COMCMS.API.csproj +++ b/COMCMS.API/COMCMS.API.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0 + netcoreapp3.1 diff --git a/COMCMS.Common/COMCMS.Common.csproj b/COMCMS.Common/COMCMS.Common.csproj index f7aeaf3..0e03d97 100644 --- a/COMCMS.Common/COMCMS.Common.csproj +++ b/COMCMS.Common/COMCMS.Common.csproj @@ -1,22 +1,20 @@  - netcoreapp3.0 + netcoreapp3.1 - - + + - + - - C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.authentication.cookies\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Cookies.dll - + diff --git a/COMCMS.Core/COMCMS.Core.csproj b/COMCMS.Core/COMCMS.Core.csproj index 3f8232b..ff22f42 100644 --- a/COMCMS.Core/COMCMS.Core.csproj +++ b/COMCMS.Core/COMCMS.Core.csproj @@ -1,12 +1,12 @@  - netcoreapp3.0 + netcoreapp3.1 - - + + @@ -14,9 +14,6 @@ - - C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.authentication.cookies\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Cookies.dll - diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs index 325aac9..272ef8c 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/ArticleController.cs @@ -483,8 +483,6 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers } } } - - //处理三个勾选属性的 string isnew = Request.Form["IsNew"]; model.IsNew = isnew == "1" ? 1 : 0; @@ -493,6 +491,8 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers string IsHide = Request.Form["IsHide"]; model.IsHide = IsHide == "1" ? 1 : 0; + //处理三个勾选属性的 + model.Hits = entity.Hits; model.UpdateTime = DateTime.Now; @@ -503,8 +503,43 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers content = ThumbnailHelper.SaveRemoteImgForContent(content); model.Content = content; } + + + entity.AddTime = model.AddTime; + entity.AdsId = model.AdsId; + entity.BannerImg = model.BannerImg; + entity.Content = model.Content; + entity.Description = model.Description; + entity.FilePath = model.FilePath; + entity.Hits = model.Hits; + entity.Icon = model.Icon; + entity.IsBest = model.IsBest; + entity.IsComment = model.IsComment; + entity.IsDel = model.IsDel; + entity.IsHide = model.IsHide; + entity.IsLock = model.IsLock; + entity.IsMember = model.IsMember; + entity.IsNew = model.IsNew; + entity.IsRecommend = model.IsRecommend; + entity.IsTop = model.IsTop; + entity.ItemImg = morIMG; + entity.Keyword = model.Keyword; + entity.KId = model.KId; + entity.LinkURL = model.LinkURL; + entity.Location = model.Location; + entity.Origin = model.Origin; + entity.OriginURL = model.OriginURL; + entity.Pic = model.Pic; + entity.Sequence = model.Sequence; + entity.SubTitle = model.SubTitle; + entity.Tags = model.Tags; + entity.TemplateFile = model.TemplateFile; + entity.Title = model.Title; + entity.TitleColor = model.TitleColor; + entity.UpdateTime = DateTime.Now; + //model.AuthorId = Core.Admin.GetMyInfo().Id; - model.Save(); + entity.Update(); //Tag.ModifyTags(model.Tags, RTType.RatuoModule.Article, model.Id, model.Title); Core.Admin.WriteLogActions("编辑文章(id:" + model.Id + ");"); tip.Status = JsonTip.SUCCESS; diff --git a/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs b/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs index dc40bcb..3c0dc97 100644 --- a/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs +++ b/COMCMS.Web/Areas/AdminCP/Controllers/PermissionController.cs @@ -10,6 +10,11 @@ using XCode; using Newtonsoft.Json; using COMCMS.Web.Common; using Microsoft.AspNetCore.Http; +using System.IO; +using NewLife.Log; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.FileProviders; +using System.Text; namespace COMCMS.Web.Areas.AdminCP.Controllers { @@ -17,6 +22,12 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers [DisplayName("后台权限")] public class PermissionController : AdminBaseController { + private IWebHostEnvironment _env; + public PermissionController(IWebHostEnvironment env) + { + _env = env; + } + #region 事件管理 /// /// 目标事件 @@ -329,5 +340,77 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers return Json(tip); } #endregion + + #region 系统运行日志 + [HttpGet] + [MyAuthorize("viewlist", "runlogs")] + [DisplayName("系统运行日志")] + public IActionResult RunLogs() + { + string logPath = $"{_env.ContentRootPath}{Path.DirectorySeparatorChar}Log{Path.DirectorySeparatorChar}"; + List lognames = new List(); + try + { + if (Directory.Exists(logPath)) + { + DirectoryInfo directory = new DirectoryInfo(logPath); + List listFiles = new List(); + DirectoryInfo[] directorys = directory.GetDirectories(); + FileInfo[] files; + files = directory.GetFiles(); + foreach (FileInfo file in files) + { + lognames.Add(file.Name); + } + } + } + catch (Exception ex) + { + XTrace.WriteException(ex); + } + lognames.Reverse();//倒序排列一下 + ViewBag.logPath = logPath; + return View(lognames); + } + #endregion + + #region 获取日志详情 + [HttpPost] + [MyAuthorize("viewlist", "runlogs")] + public async Task GetRunLogDetail(string logname) + { + if (string.IsNullOrEmpty(logname)) + { + return Content("错误日志名称!"); + } + string logPath = $"{_env.ContentRootPath}{Path.DirectorySeparatorChar}Log{Path.DirectorySeparatorChar}"; + string logFullPath = logPath + logname; + + + if (!System.IO.File.Exists(logFullPath)) + { + return Content("系统找不到本日志文件!"); + } + XTrace.WriteLine("查看日志:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + + IFileProvider fileProvider = new PhysicalFileProvider(logPath); + StringBuilder detail = new StringBuilder(); + using (Stream stream = fileProvider.GetFileInfo(logname).CreateReadStream()) + { + byte[] buffer = new byte[stream.Length]; + await stream.ReadAsync(buffer, 0, buffer.Length); + detail.Append(Encoding.Default.GetString(buffer)); + } + + + //using (StreamReader fs = new StreamReader(logFullPath)) + //{ + // detail.Append(fs.ReadToEndAsync()); + //} + + //string detail = await System.IO.File.ReadAllTextAsync(logFullPath); + return Content(detail.ToString()); + } + #endregion } } \ No newline at end of file diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml index ec176f6..65ee885 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/AddArticle.cshtml @@ -25,7 +25,7 @@
- +
diff --git a/COMCMS.Web/Areas/AdminCP/Views/Article/ArticleList.cshtml b/COMCMS.Web/Areas/AdminCP/Views/Article/ArticleList.cshtml index d192c3e..6d0c26b 100644 --- a/COMCMS.Web/Areas/AdminCP/Views/Article/ArticleList.cshtml +++ b/COMCMS.Web/Areas/AdminCP/Views/Article/ArticleList.cshtml @@ -221,7 +221,7 @@ return false; } list.map(function (item, index) { - if (item.Id) { + if (item.id) { ids.push(item.id); } }) @@ -265,7 +265,7 @@ return false; } list.map(function (item, index) { - if (item.Id) { + if (item.id) { ids.push(item.id); } }) diff --git a/COMCMS.Web/COMCMS.Web.csproj b/COMCMS.Web/COMCMS.Web.csproj index 4dfe261..6362dea 100644 --- a/COMCMS.Web/COMCMS.Web.csproj +++ b/COMCMS.Web/COMCMS.Web.csproj @@ -1,22 +1,22 @@  - netcoreapp3.0 + netcoreapp3.1 - - - - + + + + - - - - - - - + + + + + + + diff --git a/COMCMS.Web/Startup.cs b/COMCMS.Web/Startup.cs index 8d8417b..954c5eb 100644 --- a/COMCMS.Web/Startup.cs +++ b/COMCMS.Web/Startup.cs @@ -77,7 +77,10 @@ namespace COMCMS.Web //记录错误 options.Filters.Add(); }) - .AddNewtonsoftJson(options =>options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver()); + .AddNewtonsoftJson(options => { + options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; + }); //防止汉字被自动编码 services.Configure(options => @@ -92,16 +95,16 @@ namespace COMCMS.Web services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(); // 设置表单内容限制 - //services.Configure(options => - //{ - // //formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte - // //formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728 - // options.ValueCountLimit = int.MaxValue; - // options.ValueLengthLimit = int.MaxValue; - // options.KeyLengthLimit = int.MaxValue; - // options.MultipartBodyLengthLimit = int.MaxValue; - // options.MultipartBoundaryLengthLimit = int.MaxValue; - //}); + services.Configure(options => + { + //formOptions.ValueLengthLimit = int.MaxValue; // 表单内容大小限制,默认4194304,单位byte + //formOptions.MultipartBodyLengthLimit = int.MaxValue; // 如果是multipart,默认134217728 + options.ValueCountLimit = int.MaxValue; + options.ValueLengthLimit = int.MaxValue; + options.KeyLengthLimit = int.MaxValue; + options.MultipartBodyLengthLimit = int.MaxValue; + options.MultipartBoundaryLengthLimit = int.MaxValue; + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/COMCMS.Web/Views/Shared/_Layout.cshtml b/COMCMS.Web/Views/Shared/_Layout.cshtml index 937c373..56e4a8c 100644 --- a/COMCMS.Web/Views/Shared/_Layout.cshtml +++ b/COMCMS.Web/Views/Shared/_Layout.cshtml @@ -211,7 +211,7 @@
- @ViewBag.cfg.Copyright 技术支持:COMCMS 粤ICP备8888888号-1 + @ViewBag.cfg.Copyright 技术支持:COMCMS 粤ICP备8888888号-1 Powered by .NET Core 3.1.0 on Windows Server
diff --git a/Lib.Core/Lib.Core.csproj b/Lib.Core/Lib.Core.csproj index 65bbb4d..073306d 100644 --- a/Lib.Core/Lib.Core.csproj +++ b/Lib.Core/Lib.Core.csproj @@ -1,11 +1,11 @@ - netstandard2.0 + netcoreapp3.1 - + diff --git a/NewLife.UserGroup.WebUploader/NewLife.UserGroup.WebUploader.csproj b/NewLife.UserGroup.WebUploader/NewLife.UserGroup.WebUploader.csproj index 9f07ad1..63461cb 100644 --- a/NewLife.UserGroup.WebUploader/NewLife.UserGroup.WebUploader.csproj +++ b/NewLife.UserGroup.WebUploader/NewLife.UserGroup.WebUploader.csproj @@ -1,11 +1,11 @@ - + - netstandard2.0 + netstandard2.1 - + diff --git a/README.md b/README.md index c25a38e..eb470cf 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台 ### 技术简要 -- .net core 3.0 (请注意升级本地SDK 或者runtime) +- .net core 3.1 (请注意升级本地SDK 或者runtime) - 数据库:Mysql 5.7 /Mysql 8.0 - ORM:数据库操作使用XCode,目前支持mysql、sqlserver。详细见:https://github.com/NewLifeX/X -- 据库驱动使用:MySQL官方驱动,8.0.19 +- 据库驱动使用:MySQL官方驱动,8.0.18 - 后台模板是H+ - 编辑器采用CKeditor 支持截图粘贴进去,上传图片采用webuploader @@ -19,7 +19,7 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台 - COMCMS.Core 数据库操作核心业务逻辑和实体 采用XCode -- COMCMS.Web .net core 2.1 的MVC网站。 +- COMCMS.Web .net core 3.1 的MVC网站。 - XCoder 代码生成器,跟上述的没任何关系,只是为了生成数据库操作业务逻辑和实体而已。 @@ -35,7 +35,7 @@ COMCMS NETCORE版本,一个简单的CMS后台管理系统,暂时不带前台 ``` 演示地址(windows server 2019 + IIS):前台:[前台演示地址](http://123.207.59.192) 后台:[后台演示地址](http://123.207.59.192/AdminCP) -演示地址2(Centos + Nginx):后台[http://47.106.32.133/AdminCP] + 账号密码都是admin diff --git a/XCoder/Entity/Build.tt b/XCoder/Entity/Build.tt index 0ab4363..8009898 100644 --- a/XCoder/Entity/Build.tt +++ b/XCoder/Entity/Build.tt @@ -8,8 +8,8 @@ <# // 设置当前工作目录 PathHelper.BaseDirectory = Host.ResolvePath("."); - // 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名、中文文件名 - //EntityBuilder.Build(String xmlFile = null, String output = null, String nameSpace = null, String connName = null, Boolean? chineseFileName = true); + // 导入模型文件并生成实体类,模型文件、输出目录、命名空间、连接名、中文文件名、表名字段名大小写 + //EntityBuilder.Build(String xmlFile = null, String output = null, String nameSpace = null, String connName = null, Boolean? chineseFileName = true,Boolean? nameIgnoreCase = null); EntityBuilder.Build(); //var tables = DAL.ImportFrom("Company.Project.xml"); diff --git a/XCoder/XCoder(代码生成器).csproj b/XCoder/XCoder(代码生成器).csproj index a88ca6f..813cf7b 100644 --- a/XCoder/XCoder(代码生成器).csproj +++ b/XCoder/XCoder(代码生成器).csproj @@ -30,12 +30,14 @@ 4 - - ..\packages\NewLife.Core.8.3.2019.923\lib\net46\NewLife.Core.dll + + + ..\packages\NewLife.Core.8.4.2019.1203\lib\net46\NewLife.Core.dll + @@ -46,8 +48,8 @@ - - ..\packages\NewLife.XCode.9.14.2019.923\lib\net46\XCode.dll + + ..\packages\NewLife.XCode.9.14.2019.1203\lib\net45\XCode.dll diff --git a/XCoder/packages.config b/XCoder/packages.config index fc3a7a1..695f75e 100644 --- a/XCoder/packages.config +++ b/XCoder/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file