WebHost/Controllers/BaseController.cs

(开头部分) 5KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Domain;
using ViewModel;
using Common;
using IService;
using Autofac;
using System.IO;

namespace WebUI.Controllers
{
    public class BaseController : Controller
    {
        IRoleMenuFunctionService roleMenuFunctionService = AutofacManage.IocContainer.Resolve<IRoleMenuFunctionService>();
        IUserRoleService baseRoleMenuFunctionService = AutofacManage.IocContainer.Resolve<IUserRoleService>();
        protected string hostUrl = "";
        /// <summary>
        /// Action执行前判断
        /// </summary>
        /// <param name="filterContext"></param>
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // url
            //this.hostUrl = "http://" + this.Request.Url.Host;
            //this.hostUrl += this.Request.Url.Port.ToString() == "80" ? "" : ":" + this.Request.Url.Port;
            //this.hostUrl += this.Request.ApplicationPath;

            if (!this.ChekcLoginStatus())// 判断是否登录
            {
                //平板、ipad跳到对应的登录页
                if (filterContext.ActionDescriptor.IsDefined(typeof(PadFilterAttribute), false))
                {
                    filterContext.Result = RedirectToRoute("Default", new { Controller = "Users", Action = "Login_Pad" });
                }
                else
                    filterContext.Result = RedirectToRoute("Default", new { Controller = "Users", Action = "Login" });
            }

            base.OnActionExecuting(filterContext);
        }

        /// <summary>
        /// 判断是否登录
        /// </summary>
        protected bool ChekcLoginStatus()
        {
            bool result = false;
            if (Session[SC.CommonKey.DIANCAN_LOGIN_USER] != null)
                result = true;
            return result;
        }

        public ComShopUserMdl Sys_Shop_User
        {
            get
            {
                if (Session[SC.CommonKey.DIANCAN_LOGIN_USER] != null)
后面还有 99 行代码,购买后查看完整代码

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

AI 解读

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

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