Ejemplo n.º 1
0
 public JsonResult Register(Application.Dtos.T_Staff_LoginDto input)
 {
     Models.JsonResultStatus jsonStatus = new Models.JsonResultStatus();
     jsonStatus.Code = 200;
     if (input.LoginNo <= 0)
     {
         jsonStatus.Code = 400;
         jsonStatus.Msg  = "未获取到工资号";
     }
     else
     {
         //await t_userAppService.BindWeChat(input);
         var entity = staffAppService.ValidateUser(input.LoginNo, input.Password);
         if (entity != null)
         {
             string     encrtpt = Common.DESEncryptEx.Encrypt(string.Format("{0}|{1}|{2}", entity.Id, entity.LoginNo, entity.StaffName));
             HttpCookie cookie  = new HttpCookie(
                 Common.AbpWebConst.AuthSaveKey,
                 encrtpt);
             Response.Cookies.Add(cookie);
             jsonStatus.Msg         = "登陆成功";
             jsonStatus.RedirectUrl = "";
         }
         else
         {
             jsonStatus.Code = 400;
             jsonStatus.Msg  = "登陆失败";
         }
     }
     return(Json(jsonStatus));
 }
Ejemplo n.º 2
0
        public JsonResult LoginValidate(Models.WeiXinInfo userInfo)
        {
            var user = this.userAppService.GetT_UserByOpenIdAsync(userInfo.OpenId);

            Models.JsonResultStatus rstJson = new Models.JsonResultStatus();
            rstJson.Code = 200;
            // var user = this.weUserAppService.GetWeUser("oCbECv1pwMNyAodYQtRJVvJf_Zsg");
            if (user == null)
            {
                rstJson.Msg = "未绑定工资号,即将跳转到绑定页面";
                // string regUrl = string.Format("/RegisterWeChat/Index?openId={0}&HeadImgUrl={1}&NickName={2}&retUrl=", userInfo.OpenId, userInfo.HeadImgUrl, userInfo.NickName, userInfo.RetUrl);
                // rstJson.RedirectUrl = regUrl;
                rstJson.RedirectUrl = userInfo.RetUrl;
                return(Json(rstJson));
            }
            else
            {
                string encrtpt = Common.DESEncryptEx.Encrypt(string.Format("{0}|{1}|{2}", user.Id, userInfo.AccessToken, userInfo.OpenId));
                Logger.Debug("当前用户Cookie" + encrtpt);
                //        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                //1,
                //user.NickName,
                //DateTime.Now,
                //DateTime.Now.Add(FormsAuthentication.Timeout), true, string.Format("{0}|{1}|{2}|{3}|{4}", user.Id, user.PhoneNo, user.NickName, accessToken, opentid)

                //);

                //DateTime.Now.Add(FormsAuthentication.Timeout), true, string.Format("{0}|{1}|{2}|{3}|{4}", user.Id, user.PhoneNo, user.NickName, accessToken, openId)
                //HttpCookie cookie = new HttpCookie(
                //    Common.CommonConst.AuthSaveKey,
                //    FormsAuthentication.Encrypt(ticket));
                HttpCookie cookie = new HttpCookie(
                    Common.AbpWebConst.AuthSaveKey,
                    encrtpt);
                Response.Cookies.Add(cookie);
                rstJson.Msg         = "用户验证成功,即将跳转";
                rstJson.RedirectUrl = userInfo.RetUrl;
                return(Json(rstJson));
            }
        }