Browse Source

路由变更

懒得勤快 4 năm trước cách đây
mục cha
commit
78eabfa8c9

+ 1 - 1
src/Masuit.MyBlogs.Core/Controllers/HomeController.cs

@@ -77,7 +77,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="size"></param>
         /// <param name="orderBy"></param>
         /// <returns></returns>
-        [Route("p"), ResponseCache(Duration = 600, VaryByQueryKeys = new[] { "page", "size", "orderBy" }, VaryByHeader = "Cookie")]
+        [Route("posts"), ResponseCache(Duration = 600, VaryByQueryKeys = new[] { "page", "size", "orderBy" }, VaryByHeader = "Cookie")]
         public async Task<ActionResult> Post([Optional] OrderBy? orderBy, [Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")] int page = 1, [Range(1, 50, ErrorMessage = "页大小必须在0到50之间")] int size = 15)
         {
             var viewModel = await GetIndexPageViewModel();

+ 1 - 1
src/Masuit.MyBlogs.Core/Controllers/NoticeController.cs

@@ -57,7 +57,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// </summary>
         /// <param name="id"></param>
         /// <returns></returns>
-        [Route("n/{id:int}"), ResponseCache(Duration = 600, VaryByQueryKeys = new[] { "id" }, VaryByHeader = "Cookie")]
+        [Route("notice/{id:int}"), ResponseCache(Duration = 600, VaryByQueryKeys = new[] { "id" }, VaryByHeader = "Cookie")]
         public async Task<ActionResult> Details(int id)
         {
             var notice = await NoticeService.GetByIdAsync(id) ?? throw new NotFoundException("页面未找到");

+ 1 - 1
src/Masuit.MyBlogs.Core/Controllers/SearchController.cs

@@ -35,7 +35,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="page"></param>
         /// <param name="size"></param>
         /// <returns></returns>
-        [Route("s/{wd?}")]
+        [Route("search")]
         public async Task<ActionResult> Search([FromServices] IPostService postService, string wd = "", [Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")] int page = 1, [Range(1, 50, ErrorMessage = "页大小必须在0到50之间")] int size = 15)
         {
             wd = wd?.Trim().ToSimplified();

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

@@ -42,7 +42,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         /// <param name="size"></param>
         /// <param name="orderBy"></param>
         /// <returns></returns>
-        [Route("c/{id:int}"), ResponseCache(Duration = 600, VaryByQueryKeys = new[] { "page", "size", "orderBy" }, VaryByHeader = "Cookie")]
+        [Route("special/{id:int}"), ResponseCache(Duration = 600, VaryByQueryKeys = new[] { "page", "size", "orderBy" }, VaryByHeader = "Cookie")]
         public async Task<ActionResult> Index(int id, [Optional] OrderBy? orderBy, [Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")] int page = 1, [Range(1, 50, ErrorMessage = "页大小必须在0到50之间")] int size = 15)
         {
             var s = await SeminarService.GetByIdAsync(id) ?? throw new NotFoundException("文章未找到");

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

@@ -58,7 +58,7 @@
         <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="5.0.3" />
         <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="5.0.3" />
         <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="5.0.1" />
-        <PackageReference Include="Microsoft.Graph" Version="3.25.0" />
+        <PackageReference Include="Microsoft.Graph" Version="3.26.0" />
         <PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.6" />
         <PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.22" />
         <PackageReference Include="OpenXmlPowerTools-NetStandard" Version="4.4.21" />

+ 1 - 1
src/Masuit.MyBlogs.Core/Views/Home/Index.cshtml

@@ -10,7 +10,7 @@
     ViewBag.Title = "首页";
     Layout = "~/Views/Shared/_Layout.cshtml";
     List<FastShare> shares = ViewBag.FastShare;
-    Context.Request.Path = new PathString("/p");
+    Context.Request.Path = new PathString("/posts");
 }
 <link href="~/Assets/banner/bootstrap-touch-slider.min.css" rel="stylesheet" />
 @if (Model.Banner.Any())

+ 1 - 1
src/Masuit.MyBlogs.Core/Views/Search/Search.cshtml

@@ -26,7 +26,7 @@
                     <small>搜索用时(@Model.Elapsed 毫秒)</small>
                 }
                 <div class="search-form">
-                    <form action="/s" method="get">
+                    <form action="/search" method="get">
                         <div class="input-group">
                             <input type="text" placeholder="你要查找的关键词,支持部分指令:intitle,content,如:intitle:会声会影 content:懒得勤快,指令支持组合" id="search" name="wd" maxlength="32" value="@ViewBag.Keyword" class="form-control input-lg">
                             <div class="input-group-btn">

+ 1 - 1
src/Masuit.MyBlogs.Core/Views/Shared/_Layout.cshtml

@@ -258,7 +258,7 @@
             </ul>
         </nav>
         <div id="cd-search" class="cd-search">
-            <form action="/s" method="get">
+            <form method="get" asp-action="Search" asp-controller="Search">
                 <input type="search" name="wd" placeholder="请在此处输入您想要的搜索的关键词,支持部分指令:intitle,content,如:intitle:会声会影 content:懒得勤快,指令支持组合">
             </form>
         </div>

+ 1 - 1
src/Masuit.MyBlogs.Core/wwwroot/Scripts/global/scripts.js

@@ -157,7 +157,7 @@ $(function() {
                 btn1: function(layero) {
                     nid.push(data.Id);
                     window.localStorage.setItem("notice", JSON.stringify(nid));
-                    window.location.href = "/n/" + data.Id;
+                    window.location.href = "/notice/" + data.Id;
                     loading();
                 },
                 btn2: function(index) {

+ 4 - 4
src/Masuit.MyBlogs.Core/wwwroot/ng-views/views/analysis/search.html

@@ -15,7 +15,7 @@
     <table ng-table="list.tableParams" id="interview" class="table table-bordered table-hover table-condensed" ng-form="list.tableForm" disable-filter="list.isAdding" tracked-table="list.tableTracker">
         <tr ng-repeat="row in $data" ng-form="rowForm" tracked-table-row="row">
             <td title="'关键词'">
-                <a ng-href="/s/{{row.Keywords}}" target="_blank">{{row.Keywords}}</a>
+                <a ng-href="/search/{{row.Keywords}}" target="_blank">{{row.Keywords}}</a>
             </td>
             <td title="'搜索时间'">
                 {{row.SearchTime|date:'yyyy-MM-dd HH:mm:ss'}}
@@ -49,7 +49,7 @@
             <tbody>
             <tr ng-repeat="item in agg.month">
                 <td>{{$index+1}}</td>
-                <td><a ng-href="/s/{{item.Keywords}}" target="_blank">{{item.Keywords}}</a></td>
+                <td><a ng-href="/search/{{item.Keywords}}" target="_blank">{{item.Keywords}}</a></td>
                 <td>{{item.Count}}</td>
             </tr>
             </tbody>
@@ -68,7 +68,7 @@
             </thead>
             <tbody>
                 <tr ng-repeat="item in agg.week">
-                    <td><a ng-href="/s/{{item.Keywords}}" target="_blank">{{item.Keywords}}</a></td>
+                    <td><a ng-href="/search/{{item.Keywords}}" target="_blank">{{item.Keywords}}</a></td>
                     <td>{{item.Count}}</td>
                 </tr>
             </tbody>
@@ -87,7 +87,7 @@
             </thead>
             <tbody>
                 <tr ng-repeat="item in agg.today">
-                    <td><a ng-href="/s/{{item.Keywords}}" target="_blank">{{item.Keywords}}</a></td>
+                    <td><a ng-href="/search/{{item.Keywords}}" target="_blank">{{item.Keywords}}</a></td>
                     <td>{{item.Count}}</td>
                 </tr>
             </tbody>

+ 2 - 2
src/Masuit.MyBlogs.Core/wwwroot/ng-views/views/notice/list.html

@@ -7,10 +7,10 @@
     <table ng-table="list.tableParams" class="table table-bordered table-hover table-condensed editable-table listTable" ng-form="list.tableForm" disable-filter="list.isAdding" tracked-table="list.tableTracker">
         <tr ng-repeat="row in $data" ng-form="rowForm" tracked-table-row="row">
             <td title="'标题'" filter="{Title: 'text'}" sortable="'Title'">
-                <a ng-href="/n/{{row.Id}}" target="_blank">{{row.Title}}</a>
+                <a ng-href="/notice/{{row.Id}}" target="_blank">{{row.Title}}</a>
             </td>
             <td title="'内容'" filter="{Content: 'text'}" sortable="'Content'">
-                <a ng-href="/n/{{row.Id}}" target="_blank" ng-bind-html="row.Content|htmlString"></a>
+                <a ng-href="/notice/{{row.Id}}" target="_blank" ng-bind-html="row.Content|htmlString"></a>
                 </td>
             <td title="'发表时间'" filter="{PostDate: 'text'}" sortable="'PostDate'">
                 {{row.PostDate|date:'yyyy-MM-dd HH:mm:ss'}}

+ 1 - 1
src/Masuit.MyBlogs.Core/wwwroot/ng-views/views/seminar.html

@@ -8,7 +8,7 @@
     <table ng-table="list.tableParams" class="table table-bordered table-hover table-condensed" ng-form="list.tableForm" disable-filter="list.isAdding" tracked-table="list.tableTracker">
         <tr ng-repeat="row in $data" ng-form="rowForm" tracked-table-row="row">
             <td title="'标题'" filter="{Title: 'text'}" sortable="'Title'">
-                <a ng-href="/c/{{row.Id}}" target="_blank">{{row.Title}}</a>
+                <a ng-href="/special/{{row.Id}}" target="_blank">{{row.Title}}</a>
             </td>
             <td title="'子标题'" filter="{SubTitle: 'text'}" sortable="'SubTitle'">
                 {{row.SubTitle}}