Server/Services/BiliVideoService.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Microsoft.EntityFrameworkCore;
using OnlineOpinionAnalysis.Server.Data;

namespace OnlineOpinionAnalysis.Server.Services
{
    public class BiliVideoService : IBiliVideoService
    {
        private readonly DataContext _dataContext;

        public BiliVideoService(DataContext dataContext)
        {
            _dataContext = dataContext;
        }

        // 获取视频信息
        public async Task<List<BiliVideo>> GetVideo(int number = 100)
        {
           var videos = await _dataContext.BiliVideos
                .Take (number)
                .OrderByDescending (video=>video.UpdateTime)
                .ToListAsync();
            return videos;
        }

        public async Task<List<BiliVideo>> GetVideoByTid(int tid, int number = 100)
        {
            List<BiliVideo> videos=new();
            videos= await _dataContext.BiliVideos.Where(video=>video.Tid== tid).Take(number).ToListAsync();
            return videos;
            //switch (tid)
            //{
            //    case 36:
            //        videos=await _dataContext.BiliKnowledgeVideos.Take(number).ToListAsync();
            //        break;
            //    case 1:
            //        videos = await _dataContext.BiliDougaVideos.Take(number).ToListAsync();
            //        break;
            //    case 13:
            //        videos = await _dataContext.BiliAnimeVideos.Take(number).ToListAsync();
            //        break;
            //    case 167:
            //        videos = await _dataContext.BiliGuoChuangVideos.Take(number).ToListAsync();
            //        break;
            //    case 4:
            //        videos = await _dataContext.BiliGameVideos.Take(number).ToListAsync();
            //        break;
            //    case 188:
            //        videos = await _dataContext.BiliTechVideos.Take(number).ToListAsync();
            //        break;
            //    case 160:
            //        videos = await _dataContext.BiliLifeVideos.Take(number).ToListAsync();
            //        break;
            //    case 119:
            //        videos = await _dataContext.BiliKichiKuVideos.Take(number).ToListAsync();
            //        break;
            //    default:
            //        break;
            //}
            //return videos;
        }
后面还有 14 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。