懒得勤快 5 anni fa
parent
commit
371b2113a0

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

@@ -3,6 +3,7 @@ using Masuit.MyBlogs.Core.Extensions;
 using Masuit.MyBlogs.Core.Infrastructure.Services.Interface;
 using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
+using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.Tools;
 using Masuit.Tools.Html;
 using Microsoft.AspNetCore.Hosting;
@@ -51,6 +52,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         [Route("donate")]
         public ActionResult Donate()
         {
+            ViewBag.Ads = AdsService.GetsByWeightedPrice(2, AdvertiseType.InPage);
             return CurrentUser.IsAdmin ? View("Donate_Admin") : View();
         }
 

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

@@ -23,7 +23,6 @@ using Masuit.Tools.Systems;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Rendering;
 using Microsoft.EntityFrameworkCore.Internal;
 using System;
 using System.ComponentModel.DataAnnotations;
@@ -228,7 +227,7 @@ namespace Masuit.MyBlogs.Core.Controllers
             post.Label = string.IsNullOrEmpty(post.Label?.Trim()) ? null : post.Label.Replace(",", ",");
             post.Status = Status.Pending;
             post.Content = await ImagebedClient.ReplaceImgSrc(post.Content.HtmlSantinizerStandard().ClearImgAttributes());
-            ViewBag.CategoryId = new SelectList(CategoryService.GetQueryNoTracking(c => c.Status == Status.Available), "Id", "Name", post.CategoryId);
+            //ViewBag.CategoryId = new SelectList(CategoryService.GetQueryNoTracking(c => c.Status == Status.Available), "Id", "Name", post.CategoryId);
             Post p = post.Mapper<Post>();
             p.IP = ClientIP;
             p.Modifier = p.Author;

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

@@ -30,7 +30,7 @@
         <PackageReference Include="CacheManager.Serialization.Json" Version="2.0.0-beta-1629" />
         <PackageReference Include="CSRedisCore" Version="3.5.5" />
         <PackageReference Include="DocxToHtml_ldqk" Version="1.0.4" />
-        <PackageReference Include="Hangfire" Version="1.7.9" />
+        <PackageReference Include="Hangfire" Version="1.7.10" />
         <PackageReference Include="Hangfire.Autofac" Version="2.3.1" />
         <PackageReference Include="Hangfire.MemoryStorage" Version="1.7.0" />
         <PackageReference Include="htmldiff.net-core" Version="1.3.6" />

+ 27 - 0
src/Masuit.MyBlogs.Core/Views/Misc/Donate.cshtml

@@ -1,10 +1,12 @@
 @using Masuit.MyBlogs.Core.Common
+@using Masuit.MyBlogs.Core.Models.Entity
 @model List<Masuit.MyBlogs.Core.Models.Entity.Donate>
 
 @{
     ViewBag.Title = "网站打赏";
     Layout = "~/Views/Shared/_Layout.cshtml";
     Random r = new Random();
+    List<Advertisement> ads = ViewBag.Ads;
 }
 <style>
     .bg-title {
@@ -50,6 +52,14 @@
         </p>
     </div>
 </div>
+<div class="container">
+    <p class="text-red size20">
+        如果你现在正好需要一台显示器,可以到我的<a href="https://shop123472283.taobao.com/" target="_blank">淘宝店铺</a>进行选购以表支持本站发展。
+    </p>
+    <p class="text-red size20">
+        或点击本站任意形式的广告链接,如果是你需要的软件或服务,也可以购买表示对本站的支持!
+    </p>
+</div>
 <div class="container-fluid">
     <div class="row">
         <div class="col-md-4">
@@ -130,6 +140,23 @@
     </table>
     <tm-pagination conf="paginationConf"></tm-pagination>
 </div>
+@if (ads.Count == 2)
+{
+    <div class="container-fluid">
+        <div class="row">
+            <div class="col-md-6">
+                @{
+                    await Html.RenderPartialAsync("_ArticleListAdvertisement", ads[0]);
+                }
+            </div>
+            <div class="col-md-6">
+                @{
+                    await Html.RenderPartialAsync("_ArticleListAdvertisement", ads[1]);
+                }
+            </div>
+        </div>
+    </div>
+}
 <script>
     var app = angular.module('myApp', ["ngTable", "tm.pagination"]);
     app.config(["$httpProvider", function ($httpProvider) {

+ 27 - 0
src/Masuit.MyBlogs.Core/Views/Misc/Donate_Admin.cshtml

@@ -1,10 +1,12 @@
 @using Masuit.MyBlogs.Core.Common
+@using Masuit.MyBlogs.Core.Models.Entity
 @model List<Masuit.MyBlogs.Core.Models.Entity.Donate>
 
 @{
     ViewBag.Title = "网站打赏";
     Layout = "~/Views/Shared/_Layout.cshtml";
     Random r = new Random();
+    List<Advertisement> ads = ViewBag.Ads;
 }
 <style>
     .bg-title {
@@ -55,6 +57,14 @@
         </p>
     </div>
 </div>
+<div class="container">
+    <p class="text-red size20">
+        如果你现在正好需要一台显示器,可以到我的<a href="https://shop123472283.taobao.com/" target="_blank">淘宝店铺</a>进行选购以表支持本站发展。
+    </p>
+    <p class="text-red size20">
+        或点击本站任意形式的广告链接,如果是你需要的软件或服务,也可以购买表示对本站的支持!
+    </p>
+</div>
 <div class="container-fluid">
     <div class="flex-box">
         <div>
@@ -143,6 +153,23 @@
     </table>
     <tm-pagination conf="paginationConf"></tm-pagination>
 </div>
+@if (ads.Count == 2)
+{
+    <div class="container-fluid">
+        <div class="row">
+            <div class="col-md-6">
+                @{
+                    await Html.RenderPartialAsync("_ArticleListAdvertisement", ads[0]);
+                }
+            </div>
+            <div class="col-md-6">
+                @{
+                    await Html.RenderPartialAsync("_ArticleListAdvertisement", ads[1]);
+                }
+            </div>
+        </div>
+    </div>
+}
 <script>
     var app = angular.module('myApp', ["ngTable", "tm.pagination"]);
     app.config(["$httpProvider", function ($httpProvider) {