Răsfoiți Sursa

后台请求格式改为json

懒得勤快 3 ani în urmă
părinte
comite
cc33dbc628
34 a modificat fișierele cu 348 adăugiri și 453 ștergeri
  1. 2 1
      src/Masuit.MyBlogs.Core/Controllers/AdvertisementController.cs
  2. 4 3
      src/Masuit.MyBlogs.Core/Controllers/CategoryController.cs
  3. 4 3
      src/Masuit.MyBlogs.Core/Controllers/DashboardController.cs
  4. 3 2
      src/Masuit.MyBlogs.Core/Controllers/DonateController.cs
  5. 3 19
      src/Masuit.MyBlogs.Core/Controllers/LinksController.cs
  6. 3 2
      src/Masuit.MyBlogs.Core/Controllers/MenuController.cs
  7. 5 2
      src/Masuit.MyBlogs.Core/Controllers/MergeController.cs
  8. 3 2
      src/Masuit.MyBlogs.Core/Controllers/MiscController.cs
  9. 3 2
      src/Masuit.MyBlogs.Core/Controllers/NoticeController.cs
  10. 5 3
      src/Masuit.MyBlogs.Core/Controllers/PostController.cs
  11. 2 1
      src/Masuit.MyBlogs.Core/Controllers/SeminarController.cs
  12. 4 3
      src/Masuit.MyBlogs.Core/Controllers/ShareController.cs
  13. 14 13
      src/Masuit.MyBlogs.Core/Controllers/SystemController.cs
  14. 8 7
      src/Masuit.MyBlogs.Core/Controllers/UserController.cs
  15. 3 2
      src/Masuit.MyBlogs.Core/Controllers/ValuesController.cs
  16. 1 1
      src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.csproj
  17. 5 0
      src/Masuit.MyBlogs.Core/Models/DTO/PostCommand.cs
  18. 1 14
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/app/app.config.js
  19. 78 86
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/analysis.js
  20. 2 7
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/comment.js
  21. 2 7
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/donate.js
  22. 13 22
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/links.js
  23. 1 1
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/loginrecord.js
  24. 17 23
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/main.js
  25. 8 19
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/menu.js
  26. 89 90
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/merge.js
  27. 3 8
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/misc.js
  28. 8 26
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/msg.js
  29. 21 26
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/notice.js
  30. 2 6
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/partner.js
  31. 8 17
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/post.js
  32. 5 11
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/seminar.js
  33. 10 16
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/system.js
  34. 8 8
      src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/users.js

+ 2 - 1
src/Masuit.MyBlogs.Core/Controllers/AdvertisementController.cs

@@ -8,6 +8,7 @@ using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.ViewModel;
 using Masuit.Tools.AspNetCore.Mime;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.AspNetCore.ResumeFileResults.Extensions;
 using Masuit.Tools.Core.Net;
 using Masuit.Tools.Database;
@@ -86,7 +87,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost, MyAuthorize]
-        public async Task<IActionResult> Save(AdvertisementDto model)
+        public async Task<IActionResult> Save([FromBodyOrDefault] AdvertisementDto model)
         {
             var entity = AdsService[model.Id] ?? new Advertisement();
             model.CategoryIds = model.CategoryIds?.Replace("null", "");

+ 4 - 3
src/Masuit.MyBlogs.Core/Controllers/CategoryController.cs

@@ -5,6 +5,7 @@ using Masuit.MyBlogs.Core.Models.Command;
 using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Microsoft.AspNetCore.Mvc;
 
 namespace Masuit.MyBlogs.Core.Controllers
@@ -48,7 +49,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="model"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Add(Category model)
+        public async Task<ActionResult> Add([FromBodyOrDefault] Category model)
         {
             bool exist = CategoryService.Any(c => c.Name.Equals(model.Name));
             if (exist)
@@ -70,7 +71,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Edit(CategoryCommand dto)
+        public async Task<ActionResult> Edit([FromBodyOrDefault] CategoryCommand dto)
         {
             var cat = await CategoryService.GetByIdAsync(dto.Id) ?? throw new NotFoundException("分类不存在!");
             cat.Name = dto.Name;
@@ -92,4 +93,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null, b, b ? "分类删除成功" : "分类删除失败");
         }
     }
-}
+}

+ 4 - 3
src/Masuit.MyBlogs.Core/Controllers/DashboardController.cs

@@ -1,6 +1,7 @@
 using Masuit.MyBlogs.Core.Infrastructure.Services.Interface;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.Tools;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.Logging;
 using Microsoft.AspNetCore.Mvc;
 using Polly;
@@ -78,7 +79,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="filename"></param>
         /// <returns></returns>
-        public ActionResult Catlog(string filename)
+        public ActionResult Catlog([FromBodyOrDefault] string filename)
         {
             if (System.IO.File.Exists(Path.Combine(LogManager.LogDirectory, filename)))
             {
@@ -93,7 +94,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="filename"></param>
         /// <returns></returns>
-        public ActionResult DeleteFile(string filename)
+        public ActionResult DeleteFile([FromBodyOrDefault] string filename)
         {
             Policy.Handle<IOException>().WaitAndRetry(5, i => TimeSpan.FromSeconds(1)).Execute(() => System.IO.File.Delete(Path.Combine(LogManager.LogDirectory, filename)));
             return ResultData(null, message: "文件删除成功!");
@@ -109,4 +110,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return View();
         }
     }
-}
+}

+ 3 - 2
src/Masuit.MyBlogs.Core/Controllers/DonateController.cs

@@ -1,6 +1,7 @@
 using Masuit.MyBlogs.Core.Extensions;
 using Masuit.MyBlogs.Core.Infrastructure.Services.Interface;
 using Masuit.MyBlogs.Core.Models.Entity;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Microsoft.AspNetCore.Mvc;
 using System.ComponentModel.DataAnnotations;
 
@@ -44,7 +45,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="donate"></param>
         /// <returns></returns>
-        public async Task<ActionResult> Save(Donate donate)
+        public async Task<ActionResult> Save([FromBodyOrDefault] Donate donate)
         {
             var b = await DonateService.AddOrUpdateSavedAsync(d => d.Id, donate) > 0;
             return ResultData(null, b, b ? "保存成功!" : "保存失败!");
@@ -61,4 +62,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null, b, b ? "删除成功!" : "删除失败!");
         }
     }
-}
+}

+ 3 - 19
src/Masuit.MyBlogs.Core/Controllers/LinksController.cs

@@ -5,6 +5,7 @@ using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.Tools;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Microsoft.AspNetCore.Mvc;
 using System.Text;
 
@@ -98,7 +99,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="links"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Add(Links links)
+        public async Task<ActionResult> Add([FromBodyOrDefault] Links links)
         {
             bool b = await LinksService.AddOrUpdateSavedAsync(l => l.Id, links) > 0;
             return b ? ResultData(null, message: "添加成功!") : ResultData(null, false, "添加失败!");
@@ -110,7 +111,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="link"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public Task<ActionResult> Check(string link)
+        public Task<ActionResult> Check([FromBodyOrDefault] string link)
         {
             HttpClient.DefaultRequestHeaders.UserAgent.TryParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.47");
             HttpClient.DefaultRequestHeaders.Add("X-Forwarded-For", "1.1.1.1");
@@ -149,23 +150,6 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null, b, b ? "删除成功!" : "删除失败!");
         }
 
-        /// <summary>
-        /// 编辑友链
-        /// </summary>
-        /// <param name="model"></param>
-        /// <returns></returns>
-        [MyAuthorize]
-        public async Task<ActionResult> Edit(Links model)
-        {
-            var b = await LinksService.GetQuery(m => m.Id == model.Id).UpdateFromQueryAsync(m => new Links()
-            {
-                Name = model.Name,
-                Url = model.Url,
-                UrlBase = model.UrlBase
-            }) > 0;
-            return ResultData(null, b, b ? "保存成功" : "保存失败");
-        }
-
         /// <summary>
         /// 所有的友情链接
         /// </summary>

+ 3 - 2
src/Masuit.MyBlogs.Core/Controllers/MenuController.cs

@@ -4,6 +4,7 @@ using Masuit.MyBlogs.Core.Models.Command;
 using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.Systems;
 using Microsoft.AspNetCore.Mvc;
 
@@ -65,7 +66,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        public async Task<ActionResult> Save(MenuCommand model)
+        public async Task<ActionResult> Save([FromBodyOrDefault] MenuCommand model)
         {
             if (string.IsNullOrEmpty(model.Icon) || !model.Icon.Contains("/"))
             {
@@ -82,4 +83,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null, b, b ? "修改成功" : "修改失败");
         }
     }
-}
+}

+ 5 - 2
src/Masuit.MyBlogs.Core/Controllers/MergeController.cs

@@ -10,6 +10,7 @@ using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.ViewModel;
 using Masuit.Tools;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.Core.Net;
 using Masuit.Tools.Linq;
 using Masuit.Tools.Strings;
@@ -25,7 +26,9 @@ namespace Masuit.MyBlogs.Core.Controllers
     public class MergeController : AdminController
     {
         public IPostMergeRequestService PostMergeRequestService { get; set; }
+
         public IWebHostEnvironment HostEnvironment { get; set; }
+
         public MapperConfiguration MapperConfig { get; set; }
 
         /// <summary>
@@ -120,7 +123,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
-        public async Task<IActionResult> Merge([FromForm] PostMergeRequestCommandBase dto)
+        public async Task<IActionResult> Merge([FromBodyOrDefault] PostMergeRequestCommandBase dto)
         {
             var merge = await PostMergeRequestService.GetByIdAsync(dto.Id) ?? throw new NotFoundException("待合并文章未找到");
             Mapper.Map(dto, merge);
@@ -165,4 +168,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return b ? ResultData(null, true, "操作成功!") : ResultData(null, false, "操作失败!");
         }
     }
-}
+}

+ 3 - 2
src/Masuit.MyBlogs.Core/Controllers/MiscController.cs

@@ -6,6 +6,7 @@ using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.ViewModel;
 using Masuit.Tools;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.Core.Net;
 using Microsoft.AspNetCore.Mvc;
 using System.Text;
@@ -126,7 +127,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="model"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Write(Misc model, CancellationToken cancellationToken)
+        public async Task<ActionResult> Write([FromBodyOrDefault] Misc model, CancellationToken cancellationToken)
         {
             model.Content = await ImagebedClient.ReplaceImgSrc(await model.Content.Trim().ClearImgAttributes(), cancellationToken);
             var e = MiscService.AddEntitySaved(model);
@@ -151,7 +152,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="misc"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Edit(Misc misc, CancellationToken cancellationToken)
+        public async Task<ActionResult> Edit([FromBodyOrDefault] Misc misc, CancellationToken cancellationToken)
         {
             var entity = await MiscService.GetByIdAsync(misc.Id) ?? throw new NotFoundException("杂项页未找到");
             entity.ModifyDate = DateTime.Now;

+ 3 - 2
src/Masuit.MyBlogs.Core/Controllers/NoticeController.cs

@@ -6,6 +6,7 @@ using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.ViewModel;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.Core.Net;
 using Microsoft.AspNetCore.Mvc;
 using System.ComponentModel.DataAnnotations;
@@ -75,7 +76,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="notice"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Write(Notice notice, CancellationToken cancellationToken)
+        public async Task<ActionResult> Write([FromBodyOrDefault] Notice notice, CancellationToken cancellationToken)
         {
             notice.Content = await ImagebedClient.ReplaceImgSrc(await notice.Content.ClearImgAttributes(), cancellationToken);
             if (notice.StartTime.HasValue && notice.EndTime.HasValue && notice.StartTime >= notice.EndTime)
@@ -125,7 +126,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="notice"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public async Task<ActionResult> Edit(NoticeDto notice, CancellationToken cancellationToken)
+        public async Task<ActionResult> Edit([FromBodyOrDefault] NoticeDto notice, CancellationToken cancellationToken)
         {
             var entity = await NoticeService.GetByIdAsync(notice.Id) ?? throw new NotFoundException("公告已经被删除!");
             if (notice.StartTime.HasValue && notice.EndTime.HasValue && notice.StartTime >= notice.EndTime)

+ 5 - 3
src/Masuit.MyBlogs.Core/Controllers/PostController.cs

@@ -20,6 +20,7 @@ using Masuit.MyBlogs.Core.Models.ViewModel;
 using Masuit.MyBlogs.Core.Views.Post;
 using Masuit.Tools;
 using Masuit.Tools.AspNetCore.Mime;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.AspNetCore.ResumeFileResults.Extensions;
 using Masuit.Tools.Core.Net;
 using Masuit.Tools.Core.Validator;
@@ -676,7 +677,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="cancellationToken"></param>
         /// <returns></returns>
         [HttpPost, MyAuthorize]
-        public async Task<ActionResult> Edit(PostCommand post, bool reserve = true, CancellationToken cancellationToken = default)
+        public async Task<ActionResult> Edit([FromBodyOrDefault] PostCommand post, CancellationToken cancellationToken = default)
         {
             post.Content = await ImagebedClient.ReplaceImgSrc(await post.Content.Trim().ClearImgAttributes(), cancellationToken);
             if (!ValidatePost(post, out var resultData))
@@ -685,7 +686,7 @@ namespace Masuit.MyBlogs.Core.Controllers
             }
 
             Post p = await PostService.GetByIdAsync(post.Id);
-            if (reserve && p.Status == Status.Published)
+            if (post.Reserve && p.Status == Status.Published)
             {
                 var context = BrowsingContext.New(Configuration.Default);
                 var doc1 = await context.OpenAsync(req => req.Content(p.Content), cancellationToken);
@@ -735,9 +736,10 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="post"></param>
         /// <param name="timespan"></param>
         /// <param name="schedule"></param>
+        /// <param name="cancellationToken"></param>
         /// <returns></returns>
         [MyAuthorize, HttpPost]
-        public async Task<ActionResult> Write(PostCommand post, DateTime? timespan, bool schedule = false, CancellationToken cancellationToken = default)
+        public async Task<ActionResult> Write([FromBodyOrDefault] PostCommand post, [FromBodyOrDefault] DateTime? timespan, [FromBodyOrDefault] bool schedule = false, CancellationToken cancellationToken = default)
         {
             post.Content = await ImagebedClient.ReplaceImgSrc(await post.Content.Trim().ClearImgAttributes(), cancellationToken);
             if (!ValidatePost(post, out var resultData))

+ 2 - 1
src/Masuit.MyBlogs.Core/Controllers/SeminarController.cs

@@ -7,6 +7,7 @@ using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.ViewModel;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.Core.Net;
 using Masuit.Tools.Linq;
 using Masuit.Tools.Systems;
@@ -73,7 +74,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="seminar"></param>
         /// <returns></returns>
         [MyAuthorize]
-        public ActionResult Save(Seminar seminar)
+        public ActionResult Save([FromBodyOrDefault] Seminar seminar)
         {
             if (seminar.Id > 0 ? SeminarService.Any(s => s.Id != seminar.Id && s.Title == seminar.Title) : SeminarService.Any(s => s.Title == seminar.Title))
             {

+ 4 - 3
src/Masuit.MyBlogs.Core/Controllers/ShareController.cs

@@ -1,5 +1,6 @@
 using Masuit.MyBlogs.Core.Infrastructure.Services.Interface;
 using Masuit.MyBlogs.Core.Models.Entity;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Microsoft.AspNetCore.Mvc;
 
 namespace Masuit.MyBlogs.Core.Controllers
@@ -30,7 +31,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="share"></param>
         /// <returns></returns>
         [HttpPost]
-        public ActionResult Add(FastShare share)
+        public ActionResult Add([FromBodyOrDefault] FastShare share)
         {
             bool b = FastShareService.AddEntitySaved(share) != null;
             return ResultData(null, b, b ? "添加成功" : "添加失败");
@@ -54,7 +55,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public async Task<ActionResult> Update(FastShare model)
+        public async Task<ActionResult> Update([FromBodyOrDefault] FastShare model)
         {
             var b = await FastShareService.GetQuery(s => s.Id == model.Id).UpdateFromQueryAsync(s => new FastShare()
             {
@@ -65,4 +66,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null, b, b ? "更新成功" : "更新失败");
         }
     }
-}
+}

+ 14 - 13
src/Masuit.MyBlogs.Core/Controllers/SystemController.cs

@@ -6,6 +6,7 @@ using Masuit.MyBlogs.Core.Infrastructure.Services.Interface;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.Tools;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Masuit.Tools.DateTimeExt;
 using Masuit.Tools.Logging;
 using Masuit.Tools.Models;
@@ -100,14 +101,14 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="sets"></param>
         /// <returns></returns>
-        public async Task<ActionResult> Save(string sets)
+        public async Task<ActionResult> Save([FromBodyOrDefault] string sets)
         {
             var settings = JsonConvert.DeserializeObject<List<SystemSetting>>(sets).ToArray();
             var b = await SystemSettingService.AddOrUpdateSavedAsync(s => s.Name, settings) > 0;
             var dic = settings.ToDictionary(s => s.Name, s => s.Value); //同步设置
             foreach (var (key, value) in dic)
             {
-                CommonHelper.SystemSettings[key]= value;
+                CommonHelper.SystemSettings[key] = value;
             }
 
             return ResultData(null, b, b ? "设置保存成功!" : "设置保存失败!");
@@ -142,7 +143,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="port"></param>
         /// <param name="to"></param>
         /// <returns></returns>
-        public ActionResult MailTest(string smtp, string user, string pwd, int port, string to, bool ssl)
+        public ActionResult MailTest([FromBodyOrDefault] string smtp, [FromBodyOrDefault] string user, [FromBodyOrDefault] string pwd, [FromBodyOrDefault] int port, [FromBodyOrDefault] string to, [FromBodyOrDefault] bool ssl)
         {
             try
             {
@@ -172,7 +173,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="title"></param>
         /// <param name="content"></param>
         /// <returns></returns>
-        public ActionResult SendMail([Required(ErrorMessage = "收件人不能为空")] string tos, [Required(ErrorMessage = "邮件标题不能为空")] string title, [Required(ErrorMessage = "邮件内容不能为空")] string content)
+        public ActionResult SendMail([Required(ErrorMessage = "收件人不能为空"), FromBodyOrDefault] string tos, [Required(ErrorMessage = "邮件标题不能为空"), FromBodyOrDefault] string title, [Required(ErrorMessage = "邮件内容不能为空"), FromBodyOrDefault] string content)
         {
             BackgroundJob.Enqueue(() => CommonHelper.SendMail(title, content + "<p style=\"color: red\">本邮件由系统自动发出,请勿回复本邮件!</p>", tos, "127.0.0.1"));
             return Ok();
@@ -183,7 +184,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="path"></param>
         /// <returns></returns>
-        public ActionResult PathTest(string path)
+        public ActionResult PathTest([FromBodyOrDefault] string path)
         {
             if (!(path.EndsWith("/") || path.EndsWith("\\")))
             {
@@ -216,7 +217,7 @@ namespace Masuit.MyBlogs.Core.Controllers
             return RedisHelper.SUnion(RedisHelper.Keys("Email:*")).Select(JObject.Parse).OrderByDescending(o => o["time"]).ToList();
         }
 
-        public ActionResult BounceEmail([FromServices] IMailSender mailSender, string email)
+        public ActionResult BounceEmail([FromServices] IMailSender mailSender, [FromBodyOrDefault] string email)
         {
             var msg = mailSender.AddRecipient(email);
             return Ok(new
@@ -249,7 +250,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// 设置IP地址段黑名单
         /// </summary>
         /// <returns></returns>
-        public async Task<ActionResult> SetIPRangeBlackList(string content)
+        public async Task<ActionResult> SetIPRangeBlackList([FromBodyOrDefault] string content)
         {
             var file = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "DenyIPRange.txt")).ShareReadWrite();
             await file.WriteAllTextAsync(content, Encoding.UTF8, false);
@@ -284,7 +285,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="content"></param>
         /// <returns></returns>
-        public async Task<ActionResult> SetIpBlackList(string content)
+        public async Task<ActionResult> SetIpBlackList([FromBodyOrDefault] string content)
         {
             CommonHelper.DenyIP = content + "";
             await new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "denyip.txt")).ShareReadWrite().WriteAllTextAsync(CommonHelper.DenyIP, Encoding.UTF8);
@@ -296,7 +297,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="content"></param>
         /// <returns></returns>
-        public async Task<ActionResult> SetIpWhiteList(string content)
+        public async Task<ActionResult> SetIpWhiteList([FromBodyOrDefault] string content)
         {
             await new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "whitelist.txt")).ShareReadWrite().WriteAllTextAsync(content, Encoding.UTF8);
             CommonHelper.IPWhiteList.Add(content);
@@ -346,7 +347,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="ip"></param>
         /// <returns></returns>
-        public async Task<ActionResult> AddToWhiteList(string ip)
+        public async Task<ActionResult> AddToWhiteList([FromBodyOrDefault] string ip)
         {
             if (!ip.MatchInetAddress())
             {
@@ -368,7 +369,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="firewallRepoter"></param>
         /// <param name="ip"></param>
         /// <returns></returns>
-        public async Task<ActionResult> AddToBlackList([FromServices] IFirewallRepoter firewallRepoter, string ip)
+        public async Task<ActionResult> AddToBlackList([FromServices] IFirewallRepoter firewallRepoter, [FromBodyOrDefault] string ip)
         {
             if (!ip.MatchInetAddress())
             {
@@ -384,6 +385,6 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null);
         }
 
-        #endregion
+        #endregion 网站防火墙
     }
-}
+}

+ 8 - 7
src/Masuit.MyBlogs.Core/Controllers/UserController.cs

@@ -1,5 +1,6 @@
 using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Microsoft.AspNetCore.Mvc;
 using System.Linq.Expressions;
 using System.Net;
@@ -17,7 +18,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="id"></param>
         /// <param name="username"></param>
         /// <returns></returns>
-        public async Task<ActionResult> ChangeUsername(int id, string username)
+        public async Task<ActionResult> ChangeUsername([FromBodyOrDefault] int id, [FromBodyOrDefault] string username)
         {
             UserInfo userInfo = await UserInfoService.GetByIdAsync(id);
             if (!username.Equals(userInfo.Username) && UserInfoService.UsernameExist(username))
@@ -36,7 +37,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="id"></param>
         /// <param name="username"></param>
         /// <returns></returns>
-        public async Task<ActionResult> ChangeNickName(int id, string username)
+        public async Task<ActionResult> ChangeNickName([FromBodyOrDefault] int id, [FromBodyOrDefault] string username)
         {
             UserInfo userInfo = await UserInfoService.GetByIdAsync(id);
             userInfo.NickName = username;
@@ -52,7 +53,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="pwd"></param>
         /// <param name="pwd2"></param>
         /// <returns></returns>
-        public ActionResult ChangePassword(int id, string old, string pwd, string pwd2)
+        public ActionResult ChangePassword([FromBodyOrDefault] int id, [FromBodyOrDefault] string old, [FromBodyOrDefault] string pwd, [FromBodyOrDefault] string pwd2)
         {
             if (pwd.Equals(pwd2))
             {
@@ -69,7 +70,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="name">用户名</param>
         /// <param name="pwd"></param>
         /// <returns></returns>
-        public ActionResult ResetPassword(string name, string pwd)
+        public ActionResult ResetPassword([FromBodyOrDefault] string name, [FromBodyOrDefault] string pwd)
         {
             bool b = UserInfoService.ResetPassword(name, pwd);
             return ResultData(null, b, b ? $"密码重置成功,新密码为:{pwd}!" : "密码重置失败!");
@@ -81,7 +82,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="id"></param>
         /// <param name="path"></param>
         /// <returns></returns>
-        public async Task<ActionResult> ChangeAvatar(int id, string path)
+        public async Task<ActionResult> ChangeAvatar([FromBodyOrDefault] int id, [FromBodyOrDefault] string path)
         {
             UserInfo userInfo = await UserInfoService.GetByIdAsync(id);
             userInfo.Avatar = path;
@@ -96,7 +97,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType((int)HttpStatusCode.OK)]
-        public async Task<IActionResult> Save(UserInfoDto model)
+        public async Task<IActionResult> Save([FromBodyOrDefault] UserInfoDto model)
         {
             var userInfo = UserInfoService.GetByUsername(model.Username);
             if (userInfo is null)
@@ -119,7 +120,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType((int)HttpStatusCode.OK)]
-        public async Task<IActionResult> Delete(int id)
+        public async Task<IActionResult> Delete([FromBodyOrDefault] int id)
         {
             await UserInfoService.DeleteByIdAsync(id);
             return ResultData(null);

+ 3 - 2
src/Masuit.MyBlogs.Core/Controllers/ValuesController.cs

@@ -1,6 +1,7 @@
 using EFCoreSecondLevelCacheInterceptor;
 using Masuit.MyBlogs.Core.Infrastructure.Services.Interface;
 using Masuit.MyBlogs.Core.Models.Entity;
+using Masuit.Tools.AspNetCore.ModelBinder;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 
@@ -18,7 +19,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         }
 
         [HttpPost]
-        public async Task<ActionResult> Save(Variables model)
+        public async Task<ActionResult> Save([FromBodyOrDefault] Variables model)
         {
             var b = await VariablesService.AddOrUpdateSavedAsync(v => v.Key, model) > 0;
             return ResultData(null, b, b ? "保存成功" : "保存失败");
@@ -31,4 +32,4 @@ namespace Masuit.MyBlogs.Core.Controllers
             return ResultData(null, b, b ? "删除成功" : "保存失败");
         }
     }
-}
+}

+ 1 - 1
src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.csproj

@@ -68,7 +68,7 @@
         <PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.18" />
         <PackageReference Include="TimeZoneConverter" Version="5.0.0" />
         <PackageReference Include="WilderMinds.RssSyndication" Version="1.7.0" />
-        <PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.17" />
+        <PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.18" />
     </ItemGroup>
     <ItemGroup>
         <Content Update="appsettings.json">

+ 5 - 0
src/Masuit.MyBlogs.Core/Models/DTO/PostCommand.cs

@@ -120,5 +120,10 @@ namespace Masuit.MyBlogs.Core.Models.DTO
         /// 跳转到第三方链接
         /// </summary>
         public string Redirect { get; set; }
+
+        /// <summary>
+        /// 保留历史版本
+        /// </summary>
+        public bool Reserve { get; set; }
     }
 }

+ 1 - 14
src/Masuit.MyBlogs.Core/wwwroot/ng-views/app/app.config.js

@@ -1,24 +1,11 @@
 var myApp = angular.module('myApp', ["ui.router", "oc.lazyLoad", 'ngAnimate', 'ngResource', 'ui.bootstrap', 'angular-loading-bar', 'ng.ueditor', "ngTable", "tm.pagination", 'ui.tree', 'ui.bootstrap','ngFileUpload']);
-myApp.config(["$provide", "$compileProvider", "$controllerProvider", "$filterProvider", "$httpProvider",function($provide, $compileProvider, $controllerProvider, $filterProvider, $httpProvider) {
+myApp.config(["$provide", "$compileProvider", "$controllerProvider", "$filterProvider",function($provide, $compileProvider, $controllerProvider, $filterProvider) {
 		myApp.controller = $controllerProvider.register;
 		myApp.directive = $compileProvider.directive;
 		myApp.filter = $filterProvider.register;
 		myApp.factory = $provide.factory;
 		myApp.service = $provide.service;
 		myApp.constant = $provide.constant;
-		$httpProvider.defaults.transformRequest = function(obj) {
-			var str = [];
-			for (var p in obj) {
-				if (obj.hasOwnProperty(p)) {
-					str.push(window.encodeURIComponent(p) + "=" + window.encodeURIComponent(obj[p]));
-				}
-			}
-			return str.join("&");
-		};
-
-		$httpProvider.defaults.headers.post = {
-			'Content-Type': 'application/x-www-form-urlencoded; charser=UTF-8'
-		}
 }]);
 myApp.directive("trackedTable", function () {
 	return {

+ 78 - 86
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/analysis.js

@@ -1,95 +1,87 @@
-myApp.controller("searchAnalysis", ["$scope", "$http", "NgTableParams", "$timeout",
-	function($scope, $http, NgTableParams, $timeout) {
-		var self = this;
-		$scope.query = "";
-		$scope.currentPage = 1;
-		var _timeout;
-		$http.get("/search/HotKey").then(function(res) {
-			if(res.data.Success) {
-				$scope.agg = res.data.Data;
-			} else {
-				window.notie.alert({
-					type:3,
-					text:res.data.Message,
-					time:4
-				});
-			}
-		});
+myApp.controller("searchAnalysis", ["$scope", "$http", "NgTableParams", "$timeout", function($scope, $http, NgTableParams, $timeout) {
+	var self = this;
+	$scope.query = "";
+	$scope.currentPage = 1;
+	var _timeout;
+	$http.get("/search/HotKey").then(function(res) {
+		if(res.data.Success) {
+			$scope.agg = res.data.Data;
+		} else {
+			window.notie.alert({
+				type:3,
+				text:res.data.Message,
+				time:4
+			});
+		}
+	});
 
-		$scope.paginationConf = {
-			currentPage:1,
-			itemsPerPage:10,
-			pagesLength:25,
-			perPageOptions:[1, 5, 10, 15, 20, 30, 40, 50],
-			rememberPerPage:'perPageItems',
-			onChange:function() {
-				if(_timeout) {
-					$timeout.cancel(_timeout);
-				}
-				_timeout = $timeout(function() {
-					self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-					_timeout = null;
-				}, 100);
-			}
-		};
-		$scope.search = function() {
+	$scope.paginationConf = {
+		currentPage:1,
+		itemsPerPage:10,
+		pagesLength:25,
+		perPageOptions:[1, 5, 10, 15, 20, 30, 40, 50],
+		rememberPerPage:'perPageItems',
+		onChange:function() {
 			if(_timeout) {
 				$timeout.cancel(_timeout);
 			}
 			_timeout = $timeout(function() {
 				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
 				_timeout = null;
-			}, 1000);
+			}, 100);
 		}
-		this.GetPageData = function(page, size) {
-			$http.post("/search/SearchList", {
-				page,
-				size,
-				search:$scope.query
-			}).then(function(res) {
-				if(res.data.TotalCount > 0) {
-					$scope.paginationConf.currentPage = page;
-					$scope.paginationConf.totalItems = res.data.TotalCount;
-					//$("div[ng-table-pagination]").remove();
-					$("#interview").next("div[ng-table-pagination]").remove();
-					self.tableParams = new NgTableParams({
-						count:50000
-					}, {
-						filterDelay:0,
-						dataset:res.data.Data
-					});
-				} else {
-					window.notie.alert({
-						type:3,
-						text:res.data.Message,
-						time:4
-					});
-				}
-			});
-		};
-		self.del = function(row) {
-			swal({
-				title:"确认删除这条记录吗?",
-				text:row.Title,
-				showCancelButton:true,
-				confirmButtonColor:"#DD6B55",
-				confirmButtonText:"确定",
-				cancelButtonText:"取消",
-				showLoaderOnConfirm:true,
-				animation:true,
-				allowOutsideClick:false
-			}).then(function() {
-				$scope.request("/search/delete", {
-					id:row.Id
-				}, function(data) {
-					window.notie.alert({
-						type:1,
-						text:data.Message,
-						time:4
-					});
-				});
-				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-			}, function() {
-			}).catch(swal.noop);
+	};
+	$scope.search = function() {
+		if(_timeout) {
+			$timeout.cancel(_timeout);
 		}
-	}]);
+		_timeout = $timeout(function() {
+			self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+			_timeout = null;
+		}, 1000);
+	}
+	this.GetPageData = function(page, size) {
+		$http.post(`/search/SearchList?page=${page}&size=${size}&search=${$scope.query}`).then(function(res) {
+			if(res.data.TotalCount > 0) {
+				$scope.paginationConf.currentPage = page;
+				$scope.paginationConf.totalItems = res.data.TotalCount;
+				$("#interview").next("div[ng-table-pagination]").remove();
+				self.tableParams = new NgTableParams({
+					count:50000
+				}, {
+					filterDelay:0,
+					dataset:res.data.Data
+				});
+			} else {
+				window.notie.alert({
+					type:3,
+					text:res.data.Message,
+					time:4
+				});
+			}
+		});
+	};
+	self.del = function(row) {
+		swal({
+			title:"确认删除这条记录吗?",
+			text:row.Title,
+			showCancelButton:true,
+			confirmButtonColor:"#DD6B55",
+			confirmButtonText:"确定",
+			cancelButtonText:"取消",
+			showLoaderOnConfirm:true,
+			animation:true,
+			allowOutsideClick:false
+		}).then(function() {
+			$scope.request("/search/delete/" + row.Id, null, function(data) {
+				window.notie.alert({
+					type:1,
+					text:data.Message,
+					time:4
+				});
+			});
+			self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+		}, function() {
+		}).catch(swal.noop);
+	}
+}]);

+ 2 - 7
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/comment.js

@@ -12,10 +12,7 @@
 		}
 	};
 	this.GetPageData = function (page, size) {
-		$http.post("/comment/GetPendingComments", {
-			page,
-			size
-		}).then(function (res) {
+		$http.post(`/comment/GetPendingComments?page=${page}&size=${size}`).then(function (res) {
 			$scope.paginationConf.currentPage = page;
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
@@ -39,9 +36,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function () {
-			$scope.request("/comment/delete", {
-				id: row.Id
-			}, function (data) {
+			$scope.request("/comment/delete/" + row.Id,null, function (data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,

+ 2 - 7
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/donate.js

@@ -11,10 +11,7 @@
 		}
 	};
 	this.GetPageData = function(page, size) {
-		$http.post("/donate/getpagedata", {
-			page,
-			size
-		}).then(function(res) {
+		$http.post(`/donate/getpagedata?page=${page}&size=${size}`).then(function(res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
 			self.tableParams = new NgTableParams({
@@ -37,9 +34,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function() {
-			$scope.request("/donate/delete", {
-				id: row.Id
-			}, function(data) {
+			$scope.request("/donate/delete/" + row.Id, null, function(data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,

+ 13 - 22
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/links.js

@@ -2,7 +2,7 @@
 	var self = this;
 	var source = [];
 	this.load = function() {
-		$http.post("/links/get", null).then(function(res) {
+		$http.get("/links/get").then(function(res) {
 			self.tableParams = new NgTableParams({}, {
 				filterDelay: 0,
 				dataset: res.data.Data
@@ -24,9 +24,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function() {
-			$scope.request("/links/delete", {
-				id: row.Id
-			}, function(data) {
+			$scope.request("/links/delete/" + row.Id, null, function(data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -61,7 +59,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function () {
-			$scope.request("/links/edit", row, function (data) {
+			$scope.request("/links/add", { Id: row.Id, Name: row.Name, Url: row.Url, UrlBase:row.UrlBase}, function (data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -116,34 +114,27 @@
 			}
 		}).catch(swal.noop);
 	}
+
 	self.check= function(link) {
 		$scope.request("/links/check", {
 			link:link.Url
 		}, function (data) {
 			layer.tips(data.Message, '#link-'+link.Id, {
-                tips: [1, '#3595CC'],
-                time: 5000
-            });
+				tips: [1, '#3595CC'],
+				time: 5000
+			});
 		});
 	}
-	$scope.toggleWhite= function(row) {
-		$scope.request("/links/ToggleWhitelist", {
-			id:row.Id
-		}, function (data) {
-        });
+
+	$scope.toggleWhite = function (row) {
+		$scope.request("/links/ToggleWhitelist/" + row.Id);
 	}
+
 	$scope.toggleState= function(row) {
-		$scope.request("/links/Toggle", {
-			id:row.Id
-		}, function (data) {
-			
-		});
+		$scope.request("/links/Toggle/" + row.Id);
 	}
 
 	$scope.toggleRecommend = function(row) {
-		$scope.request("/links/ToggleRecommend", {
-			id:row.Id
-		}, function (data) {
-        });
+		$scope.request("/links/ToggleRecommend/" + row.Id);
 	}
 }]);

+ 1 - 1
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/loginrecord.js

@@ -1,6 +1,6 @@
 myApp.controller("loginrecord", ["$scope", "$http", "NgTableParams", function($scope, $http, NgTableParams) {
 	var self = this;
-	$http.post("/login/getrecent/"+$scope.user.Id).then(function(res) {
+	$http.get("/login/getrecent/"+$scope.user.Id).then(function(res) {
 		self.tableParams = new NgTableParams({
 			count: 15
 		}, {

+ 17 - 23
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/main.js

@@ -60,9 +60,7 @@
 	}
 	this.clearNotification = function($event) {
 		$event.preventDefault();
-		$http.post("/msg/MarkRead", {
-			id:_.max($scope.InternalMsgs, m => m.Id).Id
-		}).then(function(res) {
+		$http.post("/msg/MarkRead/" + _.max($scope.InternalMsgs, m => m.Id).Id).then(function(res) {
 			var data = res.data;
 			if(data.Success) {
 				var x = angular.element($event.target).closest('.listview');
@@ -140,16 +138,14 @@
 		}
 	}
 
-	$http.post("/passport/getuserinfo", null).then(function(res) {
+	$http.get("/passport/getuserinfo").then(function(res) {
 		if(res.data.Success) {
 			$scope.user = res.data.Data;
 		}
 	});
 
 	$scope.request = function(url, data, success, error) {
-		$http.post(url, data, {
-			'Content-Type':'application/x-www-form-urlencoded'
-		}).then(function(res) {
+		$http.post(url, data).then(function(res) {
 			if(res.data.Success && res.data.IsLogin) {
 				success(res.data);
 			} else {
@@ -236,25 +232,23 @@
 
 	function getUnreadMsgs() {
 		fetch("/msg/GetUnreadMsgs",{
-				headers:{
-					'Accept': 'application/json',
-					'Content-Type': 'application/json'
-				}
-			}).then(function(response) {
-				return response.json();
-			}).then(function(res) {
-				$scope.InternalMsgs = res.Data;
-				$scope.$apply();
-			}).catch(function(e) {
-				console.log("Oops, error");
-			});
+			headers:{
+				'Accept': 'application/json',
+				'Content-Type': 'application/json'
+			}
+		}).then(function(response) {
+			return response.json();
+		}).then(function(res) {
+			$scope.InternalMsgs = res.Data;
+			$scope.$apply();
+		}).catch(function(e) {
+			console.log("Oops, error");
+		});
 	}
 	getmsgs();
 	setInterval(getmsgs,5000);
 	$scope.read = function(id) {
-		$http.post("/msg/read", {
-			id
-		}).then(getUnreadMsgs);
+		$http.post("/msg/read/"+id).then(getUnreadMsgs);
 	}
 
 	$scope.changeUsername = function() {
@@ -415,7 +409,7 @@
 			cancelButtonText:"取消",
 			preConfirm:function() {
 				return new Promise(function(resolve, reject) {
-					$http.post("/passport/logout", null).then(function(res) {
+					$http.post("/passport/logout").then(function(res) {
 						if(res.data.Success) {
 							resolve();
 						} else {

+ 8 - 19
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/menu.js

@@ -1,8 +1,8 @@
 myApp.controller("menu", ["$scope", "$http", "$timeout", function($scope, $http, $timeout) {
 	$scope.menu = {};
 	$scope.init = function() {
-		$scope.request("/menu/getmenus", null, function(data) {
-			$scope.data = data.Data;//transData(data.Data, "Id", "ParentId", "nodes");
+		$scope.get("/menu/getmenus", function(data) {
+			$scope.data = data.Data;
 			$scope.collapse = true;
 			$timeout(function() {
 				$scope.expandAll();
@@ -231,9 +231,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function() {
-			$scope.request("/menu/delete", {
-				id: id
-			}, function(data) {
+			$scope.request("/menu/delete/"+id, null, function(data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -246,21 +244,12 @@
 	}
 	
 	$scope.getMenuType = function() {
-		$scope.request("/menu/getmenutype", null, function(data) {
+		$scope.get("/menu/getmenutype", function(data) {
 			$scope.MenuType = data.Data;
 		});
 	}
 	$scope.edit= function(menu) {
 		$scope.menu = menu;
-		//Custombox.open({
-		//	target: '#menu',
-		//	zIndex: 100,
-		//	height: 900,
-		//	close: function () {
-		//		$scope.menu = {};
-		//	},
-		//	overlayOpacity: 0.5
-		//});
 		layer.open({
 			type: 1,
 			zIndex: 20,
@@ -304,18 +293,18 @@
 		}
 	}
 	$scope.uploadImage = function() {
-        $("#uploadform").ajaxSubmit({
+		$("#uploadform").ajaxSubmit({
 			url: "/Upload",
 			type: "post",
 			success: function(data) {
 				document.getElementById("uploadform").reset();
 				$scope.$apply(function () {
-			      $scope.allowUpload=false;
+				  $scope.allowUpload=false;
 					$scope.menu.Icon = data.Data;
-			    });
+				});
 			}
 		});
-    };
+	};
 	$scope.upload = function() {
 		$scope.allowUpload=true;
 	}

+ 89 - 90
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/merge.js

@@ -1,5 +1,5 @@
 myApp.controller("mergelist", ["$scope", "$http", "NgTableParams", "$timeout", function ($scope, $http, NgTableParams, $timeout) {
-    var self = this;
+	var self = this;
 	$scope.kw = "";
 	$scope.orderby = 1;
 	$scope.paginationConf = {
@@ -26,7 +26,7 @@
 		});
 	};
 	self.pass = function(row) {
-        swal({
+		swal({
 			title: "确认直接合并这篇文章吗?",
 			text: row.Title,
 			showCancelButton: true,
@@ -38,22 +38,22 @@
 			allowOutsideClick: false
 		}).then(function() {
 			$scope.request("/merge/"+row.Id, null, function(data) {
-			    window.notie.alert({
-				    type: 1,
-				    text: data.Message,
-				    time: 4
-			    });
-			    self.stats = [];
-			    self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-		    });
+				window.notie.alert({
+					type: 1,
+					text: data.Message,
+					time: 4
+				});
+				self.stats = [];
+				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+			});
 		}, function() {
 		}).catch(swal.noop);
-    }
+	}
 
 	self.reject = function(row) {
 		swal({
 			title: "拒绝合并理由:",
-            input: 'textarea',
+			input: 'textarea',
 			showCancelButton: true,
 			confirmButtonColor: "#DD6B55",
 			confirmButtonText: "确定",
@@ -61,28 +61,28 @@
 			showLoaderOnConfirm: true,
 			animation: true,
 			allowOutsideClick: false,
-            inputValidator: function(value) {
-            return new Promise(function(resolve, reject) {
-              if (value) {
-                resolve();
-              } else {
-                reject('请填写拒绝理由!');
-              }
-            });
-          }
+			inputValidator: function(value) {
+			return new Promise(function(resolve, reject) {
+			  if (value) {
+				resolve();
+			  } else {
+				reject('请填写拒绝理由!');
+			  }
+			});
+		  }
 		}).then(function(reason) {
-            $scope.request("/merge/reject/"+row.Id, {reason:reason}, function(data) {
-			    window.notie.alert({
-				    type: 1,
-				    text: data.Message,
-				    time: 4
-			    });
-			    self.stats = [];
-			    self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-		    });
+			$scope.request("/merge/reject/"+row.Id, {reason:reason}, function(data) {
+				window.notie.alert({
+					type: 1,
+					text: data.Message,
+					time: 4
+				});
+				self.stats = [];
+				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+			});
 		}, function() {
 		}).catch(swal.noop);
-    }
+	}
 
 	self.block = function(row) {
 		swal({
@@ -96,18 +96,18 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function() {
-            $scope.request("/merge/block/"+row.Id, null, function(data) {
-			    window.notie.alert({
-				    type: 1,
-				    text: data.Message,
-				    time: 4
-			    });
-			    self.stats = [];
-			    self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-		    });
+			$scope.request("/merge/block/"+row.Id, null, function(data) {
+				window.notie.alert({
+					type: 1,
+					text: data.Message,
+					time: 4
+				});
+				self.stats = [];
+				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+			});
 		}, function() {
 		}).catch(swal.noop);
-    }
+	}
 
 	var _timeout;
 	$scope.search = function (kw) {
@@ -126,12 +126,12 @@ myApp.controller("mergecompare", ["$scope","$location", function ($scope, $locat
 	$scope.id = $location.search()['id'];
 	$scope.get("/merge/compare/"+$scope.id, function(res) {
 		var data = res.Data;
-        $scope.old=data.old;
-        $scope.newer=data.newer;
+		$scope.old=data.old;
+		$scope.newer=data.newer;
 	});
-    
+	
 	$scope.pass = function() {
-        swal({
+		swal({
 			title: "确认直接合并这篇文章吗?",
 			showCancelButton: true,
 			confirmButtonColor: "#DD6B55",
@@ -142,21 +142,21 @@ myApp.controller("mergecompare", ["$scope","$location", function ($scope, $locat
 			allowOutsideClick: false
 		}).then(function() {
 			$scope.request("/merge/"+$scope.id, null, function(data) {
-			    window.notie.alert({
-				    type: 1,
-				    text: data.Message,
-				    time: 4
-			    });
-                window.location.href = "#/merge/list";
-		    });
+				window.notie.alert({
+					type: 1,
+					text: data.Message,
+					time: 4
+				});
+				window.location.href = "#/merge/list";
+			});
 		}, function() {
 		}).catch(swal.noop);
-    }
+	}
 
 	$scope.reject = function() {
-        swal({
+		swal({
 			title: "拒绝合并理由:",
-            input: 'textarea',
+			input: 'textarea',
 			showCancelButton: true,
 			confirmButtonColor: "#DD6B55",
 			confirmButtonText: "确定",
@@ -164,30 +164,30 @@ myApp.controller("mergecompare", ["$scope","$location", function ($scope, $locat
 			showLoaderOnConfirm: true,
 			animation: true,
 			allowOutsideClick: false,
-            inputValidator: function(value) {
-            return new Promise(function(resolve, reject) {
-              if (value) {
-                resolve();
-              } else {
-                reject('请填写拒绝理由!');
-              }
-            });
-          }
+			inputValidator: function(value) {
+			return new Promise(function(resolve, reject) {
+			  if (value) {
+				resolve();
+			  } else {
+				reject('请填写拒绝理由!');
+			  }
+			});
+		  }
 		}).then(function(reason) {
-            $scope.request("/merge/reject/" + $scope.id, {reason:reason}, function(data) {
-			    window.notie.alert({
-				    type: 1,
-				    text: data.Message,
-				    time: 4
-			    });
-                window.location.href = "#/merge/list";
-		    });
+			$scope.request("/merge/reject/" + $scope.id, {reason:reason}, function(data) {
+				window.notie.alert({
+					type: 1,
+					text: data.Message,
+					time: 4
+				});
+				window.location.href = "#/merge/list";
+			});
 		}, function() {
 		}).catch(swal.noop);
-    }
+	}
 
 	$scope.block = function() {
-        swal({
+		swal({
 			title: "确认标记为恶意修改吗?",
 			showCancelButton: true,
 			confirmButtonColor: "#DD6B55",
@@ -198,17 +198,17 @@ myApp.controller("mergecompare", ["$scope","$location", function ($scope, $locat
 			allowOutsideClick: false
 		}).then(function() {
 			$scope.request("/merge/block/"+$scope.id, null, function(data) {
-			    window.notie.alert({
-				    type: 1,
-				    text: data.Message,
-				    time: 4
-			    });
-			    self.stats = [];
-			    self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-		    });
+				window.notie.alert({
+					type: 1,
+					text: data.Message,
+					time: 4
+				});
+				self.stats = [];
+				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+			});
 		}, function() {
 		}).catch(swal.noop);
-    }
+	}
 
 }]);
 myApp.controller("mergeedit", ["$scope", "$location", function ($scope, $location) {
@@ -216,16 +216,15 @@ myApp.controller("mergeedit", ["$scope", "$location", function ($scope, $locatio
 	$scope.id = $location.search()['id'];
 	$scope.get("/merge/"+$scope.id, function(res) {
 		$scope.post= res.Data;
-	    
 	});
-    $scope.merge= function() {
-        $scope.request("/merge",$scope.post, function(res) {
-		    window.notie.alert({
+	$scope.merge= function() {
+		$scope.request("/merge",$scope.post, function(res) {
+			window.notie.alert({
 				type: 1,
 				text: res.Message,
 				time: 4
 			});
-            window.location.href = "#/merge/list";
-	    });
-    }
+			window.location.href = "#/merge/list";
+		});
+	}
 }]);

+ 3 - 8
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/misc.js

@@ -2,7 +2,7 @@
 	$scope.misc = {};
 	$scope.misc.Id = $location.search()['id'];
 	if ($scope.misc.Id) {
-		$scope.request("/misc/get", { id: $scope.misc.Id }, function (res) {
+		$scope.get("/misc/get/" + $scope.misc.Id, function (res) {
 			$scope.misc = res.Data;
 		});
 	}
@@ -52,10 +52,7 @@ myApp.controller("miscList", ["$scope", "$http", "NgTableParams", function ($sco
 		}
 	};
 	this.GetPageData = function (page, size) {
-		$http.post("/misc/getpagedata", {
-			page,
-			size
-		}).then(function (res) {
+		$http.get(`/misc/getpagedata?page=${page}&size=${size}`).then(function (res) {
 			$scope.paginationConf.currentPage = page;
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
@@ -79,9 +76,7 @@ myApp.controller("miscList", ["$scope", "$http", "NgTableParams", function ($sco
 			animation: true,
 			allowOutsideClick: false
 		}).then(function () {
-			$scope.request("/misc/delete", {
-				id: row.Id
-			}, function (data) {
+			$scope.request("/misc/delete/" + row.Id, null, function (data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,

+ 8 - 26
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/msg.js

@@ -1,5 +1,5 @@
-myApp.controller("msg", ["$scope", "$http", "NgTableParams", "$timeout", function ($scope, $http, NgTableParams, $timeout) {
-    var self = this;
+myApp.controller("msg", ["$scope", "$http", "NgTableParams", function ($scope, $http, NgTableParams) {
+	var self = this;
 	$scope.currentPage = 1;
 	$scope.paginationConf = {
 		currentPage: $scope.currentPage ||1,
@@ -12,10 +12,7 @@
 		}
 	};
 	this.GetPageData = function(page, size) {
-		$http.post("/msg/GetPendingMsgs", {
-			page,
-			size
-		}).then(function(res) {
+		$http.get(`/msg/GetPendingMsgs?page=${page}&size=${size}`).then(function(res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
 			self.tableParams = new NgTableParams({
@@ -38,9 +35,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function() {
-			$scope.request("/msg/delete", {
-				id: row.Id
-			}, function(data) {
+			$scope.request("/msg/delete/" + row.Id, null, function(data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -85,19 +80,14 @@ myApp.controller("msgs", ["$scope", "$http", function ($scope, $http) {
 		}
 	};
 	this.GetPageData = function (page, size) {
-		$http.post("/msg/GetInternalMsgs", {
-			page,
-			size
-		}).then(function (res) {
+		$http.get(`/msg/GetInternalMsgs?page=${page}&size=${size}`).then(function (res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$scope.Messages = res.data.Data;
 		});
 	};
 	$scope.MarkRead= function() {
 		var id = _.max($scope.Messages, m => m.Id).Id;
-		$http.post("/msg/MarkRead", {
-			id
-		}).then(function(res) {
+		$http.post("/msg/MarkRead/"+id).then(function(res) {
 			var data = res.data;
 			if (data.Success) {
 				self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
@@ -106,17 +96,9 @@ myApp.controller("msgs", ["$scope", "$http", function ($scope, $http) {
 	}
 	$scope.toggleRead= function(id,checked) {
 		if (checked) {
-			$http.post("/msg/read", {
-				id
-			}).then(function(res) {
-				
-			});
+			$http.post("/msg/read/"+id);
 		} else {
-			$http.post("/msg/unread", {
-				id
-			}).then(function(res) {
-				
-			});
+			$http.post("/msg/unread/"+id);
 		}
 	}
 	$scope.clearMsgs = function() {

+ 21 - 26
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/notice.js

@@ -1,34 +1,34 @@
 myApp.controller("noticeAdd", ["$scope", "$http", "$location", function ($scope, $http, $location) {
-    $scope.notice = {};
+	$scope.notice = {};
 	$scope.notice.Id = $location.search()['id']||0;
 	if ($scope.notice.Id) {
-		$scope.request("/notice/get", { id: $scope.notice.Id }, function (res) {
+		$scope.get("/notice/get/" + $scope.notice.Id, function (res) {
 			$scope.notice = res.Data;
-            if ($scope.notice.StartTime+$scope.notice.EndTime) {
-                $scope.notice.Range=new Date($scope.notice.StartTime).Format("yyyy-MM-dd")+" 至 "+new Date($scope.notice.EndTime).Format("yyyy-MM-dd");
-            } else {
-                delete $scope.notice.StartTime;
-			    delete $scope.notice.EndTime;
-            }
+			if ($scope.notice.StartTime+$scope.notice.EndTime) {
+				$scope.notice.Range=new Date($scope.notice.StartTime).Format("yyyy-MM-dd")+" 至 "+new Date($scope.notice.EndTime).Format("yyyy-MM-dd");
+			} else {
+				delete $scope.notice.StartTime;
+				delete $scope.notice.EndTime;
+			}
 		});
 	}
 
-    jeDate("#timespan",{
-        multiPane:false,
-        range:" 至 ",
-        minDate:new Date().Format("yyyy-MM-dd"),
-        maxDate:'2099-06-16',
-        format: 'YYYY-MM-DD',
+	jeDate("#timespan",{
+		multiPane:false,
+		range:" 至 ",
+		minDate:new Date().Format("yyyy-MM-dd"),
+		maxDate:'2099-06-16',
+		format: 'YYYY-MM-DD',
 		donefun: function (obj) {
 			$scope.notice.StartTime = obj.date[0].YYYY+"-"+obj.date[0].MM+"-"+obj.date[0].DD;
 			$scope.notice.EndTime = obj.date[1].YYYY+"-"+obj.date[1].MM+"-"+obj.date[1].DD;
 		},
 		clearfun: function(elem, val) {
-            delete $scope.notice.StartTime;
+			delete $scope.notice.StartTime;
 			delete $scope.notice.EndTime;
 			delete $scope.notice.Range;
-        }
-    });
+		}
+	});
 	
 	//异步提交表单开始
 	$scope.submit = function (notice) {
@@ -71,10 +71,7 @@ myApp.controller("noticeList", ["$scope", "$http", "NgTableParams", function ($s
 		}
 	};
 	this.GetPageData = function (page, size) {
-		$http.post("/notice/getpagedata", {
-			page,
-			size
-		}).then(function (res) {
+		$http.post(`/notice/getpagedata?page=${page}&size=${size}`).then(function (res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
 			self.tableParams = new NgTableParams({
@@ -97,9 +94,7 @@ myApp.controller("noticeList", ["$scope", "$http", "NgTableParams", function ($s
 			animation: true,
 			allowOutsideClick: false
 		}).then(function () {
-			$scope.request("/notice/delete", {
-				id: row.Id
-			}, function (data) {
+			$scope.request("/notice/delete/"+row.Id,null, function (data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -119,7 +114,7 @@ myApp.controller("noticeList", ["$scope", "$http", "NgTableParams", function ($s
 		}).catch(swal.noop);
 	}
 	
-    $scope.changeState= function(row) {
+	$scope.changeState= function(row) {
 		$scope.request("/notice/ChangeState/"+row.Id, null, function(data) {
 			window.notie.alert({
 				type: 1,
@@ -128,6 +123,6 @@ myApp.controller("noticeList", ["$scope", "$http", "NgTableParams", function ($s
 			});
 			row.NoticeStatus=3-row.NoticeStatus;
 		});
-    }
+	}
 
 }]);

+ 2 - 6
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/partner.js

@@ -15,11 +15,7 @@
 		}
 	};
 	this.GetPageData = function (page, size) {
-		$http.post("/partner/getpagedata", {
-			page,
-			size,
-			kw: $scope.kw
-		}).then(function(res) {
+		$http.get(`/partner/getpagedata?page=${page}&size=${size}&kw=${$scope.kw}`).then(function(res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
 			self.tableParams = new NgTableParams({
@@ -45,7 +41,7 @@
 	});
 
 	$scope.getCategory = function () {
-		$http.post("/category/getcategories", null).then(function (res) {
+		$http.get("/category/getcategories").then(function (res) {
 			var data = res.data;
 			if (data.Success) {
 				$scope.cat = data.Data;

+ 8 - 17
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/post.js

@@ -49,7 +49,7 @@
 
 	stat();
 	setInterval(stat,5000);
-	$http.post("/category/getcategories", null).then(function (res) {
+	$http.get("/category/getcategories").then(function (res) {
 		var data = res.data;
 		if (data.Success) {
 			$scope.cat = data.Data;
@@ -83,8 +83,8 @@
 	});
 
 	this.GetPageData = function (page, size) {
-		var params={ page, size, kw: $scope.kw, orderby:$scope.orderby, cid:$scope.CategoryId };
-		$http.post("/post/getpagedata", params).then(function(res) {
+		var params = { page, size, kw: $scope.kw, orderby: $scope.orderby, cid: $scope.CategoryId };
+		$http.get(`/post/getpagedata?page=${page}&size=${size}&kw=${$scope.kw}&orderby=${$scope.orderby}&cid=${$scope.CategoryId}`).then(function(res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
 			self.tableParams = new NgTableParams({ count: 50000 }, {
@@ -99,7 +99,6 @@
 				});
 			});
 			self.stats = Enumerable.From(self.stats).Distinct().ToArray();
-			
 			localStorage.setItem("postlist-params",JSON.stringify(params));
 		});
 	}
@@ -141,9 +140,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function() {
-			$scope.request("/post/truncate", {
-				id: row.Id
-			}, function(data) {
+			$scope.request("/post/truncate/" + row.Id, null, function(data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -174,9 +171,7 @@
 		});
 	}
 	self.restore = function(row) {
-		$scope.request("/post/restore", {
-			id: row.Id
-		}, function(data) {
+		$scope.request("/post/restore/"+row.Id,null, function(data) {
 			window.notie.alert({
 				type: 1,
 				text: data.Message,
@@ -187,9 +182,7 @@
 		});
 	}
 	self.fixtop = function(id) {
-		$scope.request("/post/Fixtop", {
-			id: id
-		}, function(data) {
+		$scope.request("/post/Fixtop/"+id,null, function(data) {
 			window.notie.alert({
 				type: 1,
 				text: data.Message,
@@ -504,11 +497,9 @@ myApp.controller("postedit", ["$scope", "$http", "$location", "$timeout", functi
 	$scope.id = $location.search()['id'];
 	
 	$scope.reserve = true;
-	$scope.request("/post/get", {
-		id: $scope.id
-	}, function (data) {
+	$scope.get("/post/get/" + $scope.id, function (data) {
 		$scope.post = data.Data;
-		$scope.request("/post/gettag", null, function (res) {
+		$scope.get("/post/gettag", function (res) {
 			$scope.Tags = res.Data;
 			$('.ui.dropdown.tags').dropdown({
 				allowAdditions: true,

+ 5 - 11
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/seminar.js

@@ -1,6 +1,6 @@
 myApp.controller("seminar", ["$scope", "$http", "NgTableParams", function ($scope, $http, NgTableParams) {
-    var self = this;
-    $scope.paginationConf = {
+	var self = this;
+	$scope.paginationConf = {
 		currentPage: $scope.currentPage ? $scope.currentPage : 1,
 		itemsPerPage: 10,
 		pagesLength: 25,
@@ -11,10 +11,7 @@
 		}
 	};
 	this.GetPageData = function (page, size) {
-		$http.post("/seminar/getpagedata", {
-			page,
-			size
-		}).then(function (res) {
+		$http.get(`/seminar/getpagedata?page=${page}&size=${size}`).then(function (res) {
 			$scope.paginationConf.currentPage = page;
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
@@ -24,7 +21,7 @@
 				filterDelay: 0,
 				dataset: res.data.Data
 			});
-        });
+		});
 	};
 	self.del = function (row) {
 		swal({
@@ -38,9 +35,7 @@
 			animation: true,
 			allowOutsideClick: false
 		}).then(function () {
-			$scope.request("/seminar/delete", {
-				id: row.Id
-			}, function (data) {
+			$scope.request("/seminar/delete/" + row.Id, null, function (data) {
 				window.notie.alert({
 					type: 1,
 					text: data.Message,
@@ -102,5 +97,4 @@
 			}
 		}).catch(swal.noop);
 	}
-	
 }]);

+ 10 - 16
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/system.js

@@ -7,7 +7,7 @@ myApp.controller("dashboard", ["$scope", function ($scope) {
 myApp.controller("system", ["$scope", "$http", function($scope, $http) {
 	UEDITOR_CONFIG.autoHeightEnabled=false;
 	UEDITOR_CONFIG.initialFrameHeight=320;
-	$scope.request("/system/getsettings", null, function(data) {
+	$scope.get("/system/getsettings", function(data) {
 		var settings = {};
 		Enumerable.From(data.Data).Select(e => {
 			return {
@@ -69,8 +69,6 @@ myApp.controller("system", ["$scope", "$http", function($scope, $http) {
 					}
 					$http.post("/system/save", {
 						sets: JSON.stringify(result)
-					}, {
-						'Content-Type': 'application/x-www-form-urlencoded'
 					}).then(function(res) {
 						resolve(res.data);
 					}, function() {
@@ -201,7 +199,7 @@ myApp.controller("system", ["$scope", "$http", function($scope, $http) {
 }]);
 myApp.controller("log", ["$scope", function ($scope) {
 	$scope.getfiles= function() {
-		$scope.request("/dashboard/GetLogfiles", null, function(data) {
+		$scope.get("/dashboard/GetLogfiles", function(data) {
 			$scope.files = data.Data;
 		});
 	}
@@ -293,7 +291,7 @@ myApp.controller("email", ["$scope", "$http", function ($scope) {
 myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", function ($scope, $http,NgTableParams,$timeout) {
 	var self = this;
 	self.data = {};
-	$scope.request("/system/getsettings", null, function(data) {
+	$scope.get("/system/getsettings", function(data) {
 		var settings = {};
 		Enumerable.From(data.Data).Select(e => {
 			return {
@@ -306,7 +304,7 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 		$scope.Settings = settings;
 	});
 	this.load = function() {
-		$scope.request("/system/InterceptLog", null, function(res) {
+		$scope.get("/system/InterceptLog", function(res) {
 			self.tableParams = new NgTableParams({}, {
 				filterDelay: 0,
 				dataset: res.Data.list
@@ -329,7 +327,7 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 			cancelButtonText: '取消',
 			preConfirm: function() {
 				return new Promise(function (resolve) {
-					$scope.request("/system/ClearInterceptLog", null, function (res) {
+					$scope.request("/system/ClearInterceptLog",null, function (res) {
 						resolve(res.Message);
 					});
 				});
@@ -362,7 +360,7 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 	}
 
 	$scope.getIPBlackList= function() {
-		$scope.request("/system/IpBlackList",null, function (data) {
+		$scope.get("/system/IpBlackList",function (data) {
 			swal({
 				title:"编辑全局IP黑名单",
 				text:"多个IP之间用英文逗号分隔",
@@ -389,7 +387,7 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 	}
 
 	$scope.getIPWhiteList= function() {
-		$scope.request("/system/IpWhiteList",null, function (data) {
+		$scope.get("/system/IpWhiteList", function (data) {
 			swal({
 				title:"编辑全局IP白名单",
 				text:"多个IP之间用英文逗号分隔",
@@ -416,7 +414,7 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 	}
 
 	$scope.getIPRangeBlackList= function() {
-		$scope.request("/system/GetIPRangeBlackList",null, function (data) {
+		$scope.get("/system/GetIPRangeBlackList", function (data) {
 			swal({
 				title:"编辑IP地址段黑名单",
 				text:"每行一条地址段,起始地址和结束地址用空格分隔开,其余信息也用空格分隔开",
@@ -465,8 +463,6 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 					}
 					$http.post("/system/save", {
 						sets: JSON.stringify(result)
-					}, {
-						'Content-Type': 'application/x-www-form-urlencoded'
 					}).then(function(res) {
 						resolve(res.data);
 					}, function() {
@@ -513,7 +509,7 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 myApp.controller("sendbox", ["$scope", "$http", function ($scope, $http) {
 	UEDITOR_CONFIG.autoHeightEnabled=false;
 	$scope.load= function() {
-		$http.post("/system/sendbox").then(function (res) {
+		$http.get("/system/sendbox").then(function (res) {
 			$scope.Mails = res.data;
 		});
 	};
@@ -532,9 +528,7 @@ myApp.controller("sendbox", ["$scope", "$http", function ($scope, $http) {
 	}
 
 	$scope.send= function(mail) {
-		$http.post("/system/sendmail",mail, {
-			'Content-Type':'application/x-www-form-urlencoded'
-		}).then(function (res) {
+		$http.post("/system/sendmail",mail).then(function (res) {
 			if (res.data) {
 				layer.alert(res.data.Message);
 			} else {

+ 8 - 8
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/users.js

@@ -1,8 +1,8 @@
 myApp.controller("users", ["$scope", "$http", "$timeout","NgTableParams", function ($scope, $http, $timeout,NgTableParams) {
-    var self = this;
+	var self = this;
 	$scope.isAdd = true;
 	$scope.allowUpload=false;
-    $scope.userinfo = {};
+	$scope.userinfo = {};
 	$scope.kw = "";
 	$scope.paginationConf = {
 		currentPage:  1,
@@ -16,12 +16,12 @@
 	};
 
 	this.GetPageData = function (page, size) {
-        $http.get("/user/getusers?page="+page+"&size="+size+"&search="+$scope.kw).then(function(res) {
+		$http.get("/user/getusers?page="+page+"&size="+size+"&search="+$scope.kw).then(function(res) {
 			$scope.paginationConf.totalItems = res.data.TotalCount;
 			$("div[ng-table-pagination]").remove();
 			self.tableParams = new NgTableParams({count: 50000}, { filterDelay: 0, dataset: res.data.Data });
 			self.data = res.data.Data;
-        });
+		});
 	}
 
 	$scope.remove = function(userinfo) {
@@ -36,9 +36,9 @@
 			cancelButtonText: '取消'
 		}).then(function(isConfirm) {
 			if (isConfirm) {
-                $scope.request("/user/delete?id="+userinfo.Id, null, function(data) {
+				$scope.request("/user/delete?id="+userinfo.Id, null, function(data) {
 					swal(data.Message, null, 'success');
-			        self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
+					self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
 				});
 			}
 		}).catch(swal.noop);
@@ -93,7 +93,7 @@
 				time: 4
 			});
 			self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
-        });
+		});
 	}
 
 	var _timeout;
@@ -140,7 +140,7 @@
 			if (result) {
 				if (result.Success) {
 					swal(result.Message, "", "success");
-                } else {
+				} else {
 					swal(result.Message, "", "error");
 				}
 			}