Skip to content

Commit

Permalink
Merge pull request #802 from LittleFish-233/master
Browse files Browse the repository at this point in the history
添加log打印,抽奖号码圆圈扩大,添加看板娘l2d权限接口
  • Loading branch information
LittleFish-233 authored Aug 10, 2024
2 parents b7daa96 + 0adf0ff commit 215aed5
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public async Task TransferMainImagesToPublic(int maxCount)
}

}
_userRepository.Clear();


var entries = await _entryRepository.GetAll().Where(s => string.IsNullOrWhiteSpace(s.MainPicture) == false && s.IsHidden == false && string.IsNullOrWhiteSpace(s.Name) == false && s.MainPicture.Contains("?") == false && s.MainPicture.Contains("default") == false)
Expand All @@ -126,6 +127,8 @@ public async Task TransferMainImagesToPublic(int maxCount)

}

_entryRepository.Clear();

entries = await _entryRepository.GetAll().Where(s => string.IsNullOrWhiteSpace(s.Thumbnail) == false && s.IsHidden == false && string.IsNullOrWhiteSpace(s.Name) == false && s.Thumbnail.Contains("?") == false && s.Thumbnail.Contains("default") == false)
.OrderBy(s => s.Id)
.Take(maxCount).ToListAsync();
Expand All @@ -149,6 +152,8 @@ public async Task TransferMainImagesToPublic(int maxCount)

}

_entryRepository.Clear();


var articles = await _articleRepository.GetAll().Where(s => string.IsNullOrWhiteSpace(s.MainPicture) == false && s.IsHidden == false && string.IsNullOrWhiteSpace(s.Name) == false && s.MainPicture.Contains("?") == false && s.MainPicture.Contains("default") == false)
.OrderBy(s => s.Id)
Expand All @@ -171,6 +176,8 @@ public async Task TransferMainImagesToPublic(int maxCount)
_logger.LogError(ex, "转存文章 - {Name}({Id}) 主图失败", item.Name, item.Id);
}
}
_articleRepository.Clear();


var videos = await _videoRepository.GetAll().Where(s => string.IsNullOrWhiteSpace(s.MainPicture) == false && s.IsHidden == false && string.IsNullOrWhiteSpace(s.Name) == false && s.MainPicture.Contains("?") == false && s.MainPicture.Contains("default") == false)
.OrderBy(s => s.Id)
Expand All @@ -194,6 +201,9 @@ public async Task TransferMainImagesToPublic(int maxCount)
}
}

_videoRepository.Clear();


var entryPictures = await _entryRepository.GetAll()
.Include(s => s.Pictures)
.Where(s => s.IsHidden == false && string.IsNullOrWhiteSpace(s.Name) == false)
Expand Down Expand Up @@ -230,6 +240,8 @@ public async Task TransferMainImagesToPublic(int maxCount)
}
}

_entryRepository.Clear();

var websitePictures = await _entryRepository.GetAll()
.Include(s => s.WebsiteAddInfor).ThenInclude(s => s.Images)
.Where(s => s.IsHidden == false && string.IsNullOrWhiteSpace(s.Name) == false)
Expand Down Expand Up @@ -266,6 +278,9 @@ public async Task TransferMainImagesToPublic(int maxCount)
_logger.LogError(ex, "转存 词条 - {name}({id}) 专题页图片失败", item.Name, item.Id);
}
}


_entryRepository.Clear();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using CnGalWebSite.APIServer.Application.Search;
using CnGalWebSite.APIServer.Application.SteamInfors;
using CnGalWebSite.APIServer.Application.Stores;
using CnGalWebSite.APIServer.Application.Users;
using CnGalWebSite.APIServer.DataReositories;
using CnGalWebSite.APIServer.ExamineX;
using CnGalWebSite.Core.Models;
Expand Down Expand Up @@ -52,11 +53,12 @@ public class HomeAPIController : ControllerBase
private readonly IStoreInfoService _storeInfoService;
private readonly IRepository<Carousel, int> _carouselRepository;
private readonly IQueryService _queryService;
private readonly IUserService _userService;
private readonly IRepository<FriendLink, int> _friendLinkRepository;

public HomeAPIController(ISearchHelper searchHelper, IAppHelper appHelper, IRepository<Article, long> articleRepository, IHostApplicationLifetime applicationLifetime, ILogger<HomeAPIController> logger, IRepository<StoreInfo, long> storeInfoRepository,
IRepository<Entry, int> entryRepository, IHomeService homeService, IExamineService examineService, IRepository<Examine, long> examineRepository, IStoreInfoService storeInfoService, IRepository<Tag, int> tagRepository, IRepository<Recommend, long> recommendRepository,
IRepository<Comment, long> commentRepository, IRepository<Carousel, int> carouselRepository, IQueryService queryService, IRepository<FriendLink, int> friendLinkRepository)
IRepository<Comment, long> commentRepository, IRepository<Carousel, int> carouselRepository, IQueryService queryService, IRepository<FriendLink, int> friendLinkRepository, IUserService userService)
{
_searchHelper = searchHelper;
_entryRepository = entryRepository;
Expand All @@ -75,6 +77,7 @@ public HomeAPIController(ISearchHelper searchHelper, IAppHelper appHelper, IRepo
_carouselRepository = carouselRepository;
_queryService = queryService;
_friendLinkRepository = friendLinkRepository;
_userService = userService;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using CnGalWebSite.DataModel.Helper;
using CnGalWebSite.DataModel.Model;
using CnGalWebSite.DataModel.ViewModel.Admin;
using CnGalWebSite.DataModel.ViewModel.Home;
using CnGalWebSite.DataModel.ViewModel.Others;
using CnGalWebSite.DataModel.ViewModel.PlayedGames;
using CnGalWebSite.DataModel.ViewModel.Search;
Expand Down Expand Up @@ -984,5 +985,46 @@ public async Task<ActionResult<EChartsHeatMapOptionModel>> GetUserHeatMap([FromQ
};
}



[AllowAnonymous]
[HttpGet]
public async Task<ActionResult<KanbanPermissionsModel>> GetKanbanPermissions()
{
//获取当前用户ID
var user = await _appHelper.GetAPICurrentUserAsync(HttpContext);

if(user == null)
{
return new KanbanPermissionsModel { Permissions = false };
}

if (_userService.CheckCurrentUserRole("Tester"))
{
return new KanbanPermissionsModel { Permissions = true };
}


var dateTime = DateTime.Now.ToCstTime();

if (dateTime < new DateTime(2024, 8, 17, 23, 30, 00))
{
return new KanbanPermissionsModel { Permissions = false };
}


var IsAnniversariesLiveBookings = await _userIntegralRepository.AnyAsync(s => s.ApplicationUserId == user.Id && s.SourceType == UserIntegralSourceType.AnniversariesLiveBookings && s.Type == UserIntegralType.GCoins && s.Time.AddDays(270) > dateTime);
var IsAnniversariesLottery = await _userIntegralRepository.AnyAsync(s => s.ApplicationUserId == user.Id && s.SourceType == UserIntegralSourceType.AnniversariesLotteries && s.Type == UserIntegralType.GCoins && s.Time.AddDays(270) > dateTime);
var IsAnniversariesShare = await _userIntegralRepository.AnyAsync(s => s.ApplicationUserId == user.Id && s.SourceType == UserIntegralSourceType.AnniversariesShare && s.Type == UserIntegralType.GCoins && s.Time.AddDays(270) > dateTime);

if (IsAnniversariesLiveBookings && IsAnniversariesLottery && IsAnniversariesShare)
{
return new KanbanPermissionsModel { Permissions = true };
}


return new KanbanPermissionsModel { Permissions = false };

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using CnGalWebSite.EventBus.Models;
using CnGalWebSite.EventBus.Services;
using CnGalWebSite.TimedTask.Models.DataModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
Expand All @@ -19,6 +20,7 @@ public class BackgroundTask : BackgroundService
{

private readonly IServiceProvider _serviceProvider;
private int _counter = 0;

public BackgroundTask(IServiceProvider serviceProvider)
{
Expand All @@ -34,6 +36,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
var _eventBusService = scope.ServiceProvider.GetRequiredService<IEventBusService>();
var _timedTaskService = scope.ServiceProvider.GetRequiredService<ITimedTaskService>();
var _backgroundTaskService = scope.ServiceProvider.GetRequiredService<IBackgroundTaskService>();
var _entryRepository = scope.ServiceProvider.GetRequiredService<IRepository<Entry, int>>();
ConcurrentQueue<RunTimedTaskModel> _queue = new ConcurrentQueue<RunTimedTaskModel>();

try
Expand All @@ -58,6 +61,13 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await _timedTaskService.RunTimedTask(model);
}

_counter++;
if (_counter%10==0)
{
var item =await _entryRepository.GetAll().AsNoTracking().FirstOrDefaultAsync(s => s.Id == 5223);
_logger.LogInformation($"{item?.DisplayName}");
}
}

}
Expand Down
4 changes: 2 additions & 2 deletions CnGalWebSite/CnGalWebSite.Components/wwwroot/css/bundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,8 @@ html {
.m-tab--active, .m-tab--active .m-btn.m-btn--flat, .m-tab--active .m-icon, .m-tab.m-tab {
color: inherit;
}
.m-slide-group__next--disabled, .m-slide-group__prev--disabled{
display:none!important;
.m-tabs .m-slide-group__next--disabled, .m-tabs .m-slide-group__prev--disabled {
display: none !important;
}
/*聚焦边框去除*/
:focus-visible {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ html {
.m-tab--active, .m-tab--active .m-btn.m-btn--flat, .m-tab--active .m-icon, .m-tab.m-tab {
color: inherit;
}
.m-slide-group__next--disabled, .m-slide-group__prev--disabled{
display:none!important;
.m-tabs .m-slide-group__next--disabled, .m-tabs .m-slide-group__prev--disabled {
display: none !important;
}
/*聚焦边框去除*/
:focus-visible {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CnGalWebSite.DataModel.ViewModel.Home
{
public class KanbanPermissionsModel
{
public bool Permissions { get; set; }
}
}
Loading

0 comments on commit 215aed5

Please sign in to comment.