AcsMonitorController.cs 1.73 KB
using Infrastructure;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using WebApp;
using WebRepository;

namespace WebMvc
{
    /// <summary>
	/// AcsMonitor
	/// </summary>
    [Area("monitor")]
    public class AcsMonitorController : BaseController
    {
        private readonly string _appKey = "hhweb";
        private IUnitWork _unitWork;
        private IAuth _myauthUtil;

        public AcsMonitorController(IUnitWork unitWork, IAuth authUtil) : base(authUtil)
        {
            _unitWork = unitWork;
            _myauthUtil = authUtil;
        }

        #region 视图功能
        /// <summary>
        /// 默认Action
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 全屏Action
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Full()
        {
            SysInfo sysInfo = _unitWork.FindSingle<SysInfo>(u => u.AppKey.Equals(_appKey));
            ViewBag.CopyRight = sysInfo.Copyright;
            ViewBag.SystemNameCn = sysInfo.Title;
            ViewBag.SystemNameUs = sysInfo.TitleUs;
            ViewBag.IndexLogo = sysInfo.IndexLogo;

            AuthStrategyContext authStrategyContext = _myauthUtil.GetCurrentUser();
            if (authStrategyContext != null)
            {
                ViewBag.Account = authStrategyContext.User.Account;
                ViewBag.Name = authStrategyContext.User.Name;
            }

            return View();
        }
        #endregion
    }
}