优化注册中心页面展示
大石头 authored at 2021-12-18 17:04:50
1.03 KiB
Stardust
using System;
using System.Collections.Generic;
using NewLife.Cube;
using NewLife.Web;
using Stardust.Data;
using XCode.Membership;

namespace Stardust.Web.Areas.Registry.Controllers
{
    [RegistryArea]
    [Menu(0, false)]
    public class AppLogController : ReadOnlyEntityController<AppLog>
    {
        protected override AppLog Find(Object key) => AppLog.FindById(key.ToLong());

        protected override IEnumerable<AppLog> Search(Pager p)
        {
            PageSetting.EnableAdd = false;
            PageSetting.EnableNavbar = false;

            var appId = p["appId"].ToInt(-1);
            var clientId = p["clientId"];
            var threadId = p["threadId"].ToInt(-1);

            var start = p["dtStart"].ToDateTime();
            var end = p["dtEnd"].ToDateTime();

            if (start.Year < 2000)
            {
                start = DateTime.Today;
                p["dtStart"] = start.ToString("yyyy-MM-dd");
            }

            return AppLog.Search(appId, clientId, threadId, start, end, p["Q"], p);
        }
    }
}