/// <summary> /// 获取内置用户的token /// </summary> public static string GetInnerUserToken() { XCLCMS.Data.BLL.UserInfo bll = new Data.BLL.UserInfo(); var model = bll.GetModel(XCLCMS.Data.CommonHelper.SystemDataConst.XInnerUserName); if (null == model) { throw new System.Exception("内置用户不存在!"); } return(CreateUserToken(model.UserName, model.Pwd)); }
/// <summary> /// 根据该model的字符串形式还原该model /// </summary> /// <param name="userToken">加密后的userToken信息</param> /// <returns>解密后的用户信息</returns> public static XCLCMS.Data.Model.UserInfo GetUserInfoByUserToken(string userToken) { if (string.IsNullOrEmpty(userToken)) { return(null); } //解密为:admin^21232F297A57A5A743894A0E4A801FC3 userToken = XCLCMS.Lib.Encrypt.EncryptHelper.DecryptStringDES(userToken); string[] strSplit = userToken.Split('^'); if (strSplit.Length != 2) { return(null); } XCLCMS.Data.BLL.UserInfo bll = new Data.BLL.UserInfo(); UserLoginInfoModel model = new UserLoginInfoModel(); model.UserName = strSplit[0]; model.Pwd = strSplit[1]; return(bll.GetModel(model.UserName, model.Pwd)); }