示例#1
0
        public JsonResult Login(Qz.GPS.DirectService.Parameter.User.Login user)
        {
            UserService service = new UserService();

            var response = service.Login(new Qz.Core.Entity.Request <Qz.GPS.DirectService.Parameter.User.Login>()
            {
                Obj = user
            }, new LoginLog()
            {
                HostName = Request.UserHostName,
                HostIP   = Request.UserHostAddress,
                LoginMsg = Request.UserAgent + " " + Request.UrlReferrer
            });

            if (response.Status == 0)
            {
                // 保存 Session 状态
                SessionUser.Value(response.Data);

                var moduleResponse = new ModuleService().GetModuleByUser(new Qz.Core.Entity.Request <DirectService.Parameter.Module.ByUser>()
                {
                    Obj = new DirectService.Parameter.Module.ByUser()
                    {
                        ApplicationId = QConst.GPS_APPLICATION_ID,
                        ParentId      = 0,
                        UserId        = response.Data.Id
                    }
                });

                SessionModule.ListValue(moduleResponse.Data);
                SessionModule.JsonValue(Qz.Common.QJsonConvert.Serialize(moduleResponse.Data));
            }

            return(Json(
                       new Qz.Core.Entity.Response()
            {
                Message = response.Message,
                Times = response.Times,
                Status = response.Status
            }
                       ));
        }
 public static SessionModule getInstance()
 {
     return (instance==null?(instance=new SessionModule()):instance);
 }