升级到.net core 3.1;整体组件升级到最新版本
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 事件管理
|
||||
/// <summary>
|
||||
/// 目标事件
|
||||
@@ -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<string> lognames = new List<string>();
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(logPath))
|
||||
{
|
||||
DirectoryInfo directory = new DirectoryInfo(logPath);
|
||||
List<string> listFiles = new List<string>();
|
||||
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<IActionResult> 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
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章标题:</label>
|
||||
<label class="col-sm-3 control-label text-danger">文章标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="200" type="text" class="form-control" required aria-required="true" placeholder="填写文章标题">
|
||||
</div>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.3.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
|
||||
<PackageReference Include="MimeKit" Version="2.3.2" />
|
||||
<PackageReference Include="MailKit" Version="2.4.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
|
||||
<PackageReference Include="MimeKit" Version="2.4.1" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.18" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.923" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.6.102" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.102" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.102" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.7.102" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.7.0" />
|
||||
<PackageReference Include="NewLife.XCode" Version="9.14.2019.1203" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Senparc.Weixin" Version="6.6.104" />
|
||||
<PackageReference Include="Senparc.Weixin.MP" Version="16.9.104" />
|
||||
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.5.104" />
|
||||
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.7.104" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
|
||||
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
+14
-11
@@ -77,7 +77,10 @@ namespace COMCMS.Web
|
||||
//记录错误
|
||||
options.Filters.Add<HttpGlobalExceptionFilter>();
|
||||
})
|
||||
.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<WebEncoderOptions>(options =>
|
||||
@@ -92,16 +95,16 @@ namespace COMCMS.Web
|
||||
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||
|
||||
// 设置表单内容限制
|
||||
//services.Configure<FormOptions>(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<FormOptions>(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.
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
</div>
|
||||
<div class="foot-bottom">
|
||||
<div class="cont">
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a></span>
|
||||
<span>@ViewBag.cfg.Copyright <a href="http://www.comcms.com/" target="_blank"> 技术支持:COMCMS</a> <a href="http://www.miitbeian.gov.cn/" target="_blank">粤ICP备8888888号-1</a> Powered by .NET Core 3.1.0 on Windows Server</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user