using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Models;
using Models.Models.LOGDB;
using Quartz;
using SERVER;
using SERVER.LIB;
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using TcpServer;
using WebUI.LIB;

namespace WebUI.Controllers
{
    /// <summary>
    /// 首页默认控制器
    /// </summary>
    public class HomeController : BaseController
    {
        
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 同步数据
        /// </summary>
        /// <returns></returns>
        public IActionResult Privacy()
        {
            var res = SYNC_DATA.SYNC_DATA_ALL();
            string Result = "不能频繁刷新~";
            if (res)
            {
                Result = "刷新成功,大概一分钟左右生效~";
            }
            return Json(new ReturnData<string>() { IsSuccess = res, Result = Result });
        }
        /// <summary>
        /// 错误页面
        /// </summary>
        /// <returns></returns>
        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
        /// <summary>
        /// 暂时未使用
        /// </summary>
        /// <returns></returns>
        [Produces("text/event-stream")]
        public IActionResult Demo()
        {
            return Content(String.Empty);
        }



    }
}
