General.Services/DiyPage/DiyPageService.cs

(开头部分) 6KB

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

using General.Core.Config;
using General.Core.Data;
using General.Entities.Data;
using General.Entities.Models;
using General.Services.Template;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace General.Services.DiyPage
{
    public class DiyPageService: IDiyPageService
    {
        private readonly IRepository<tc_diypage> tc_DiypageRepository;
        private readonly ITemplateService templateService;
        private readonly IMemoryCache memoryCache;

        public DiyPageService(IRepository<tc_diypage> tc_diypageRepository, 
            ITemplateService templateService,
            IMemoryCache memoryCache)
        {
            tc_DiypageRepository = tc_diypageRepository;
            this.templateService = templateService;
            this.memoryCache = memoryCache;
        }



        /// <summary>
        /// 获取列表信息    
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        public async Task<AdminResult> GetList(int page, int limit, string name)
        {
            AdminResult result = new AdminResult();
            var query = tc_DiypageRepository.Table.Where(x => !string.IsNullOrWhiteSpace(name) ? x.title.Contains(name) : true).OrderByDescending(x => x.id);
            result.count = await query.CountAsync();
            result.data = await query.Skip((page - 1) * limit).Take(limit).ToListAsync();
            result.code = 0;
            return result;
        }

        /// <summary>
        /// 获取所有正常状态页面列表(路由)  
        /// </summary>
        /// <returns></returns>
        public async Task<List<tc_diypage>> GetNormalStausList()
        {
            var result = await tc_DiypageRepository.Table.Where(x => x.status == 1).Select(x=>new tc_diypage()
            {
                 id=x.id, title=x.title, route=x.route
            }).ToListAsync();
后面还有 113 行代码,解锁后查看完整代码

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

AI 解读

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

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