/// <summary> /// 从缓存中获取登录的餐饮商家信息 /// </summary> /// <returns></returns> public ResponseMerchant MerchantInfo() { ResponseMerchant Data = Cache.GetCache <ResponseMerchant>(SystemInfoKey.PrivateKey); return(Data == null ? null : (Data.TableName.Equals(typeof(ResponseMerchant).Name) ? Data : null)); }
/// <summary> /// 餐饮商家登录 /// </summary> /// <param name="LoginValidate"></param> /// <returns></returns> public Object MerchantLogin(RequestValidate LoginValidate) { #region 餐饮企业登录 IQueryable <RepastInfo> queryable = Kily.Set <RepastInfo>() .Where(t => t.Account.Equals(LoginValidate.Account) || t.Phone.Equals(LoginValidate.Account)) .Where(t => t.PassWord.Equals(LoginValidate.PassWord)) .Where(t => t.IsDelete == false); ResponseMerchant Info = queryable.Select(t => new ResponseMerchant() { Id = t.Id, Account = t.Account, CommunityCode = t.CommunityCode, MerchantName = t.MerchantName, Phone = t.Phone, DiningType = t.DiningType, VersionType = t.VersionType, VersionTypeName = AttrExtension.GetSingleDescription <SystemVersionEnum, DescriptionAttribute>(t.VersionType), DiningTypeName = AttrExtension.GetSingleDescription <MerchantEnum, DescriptionAttribute>(t.DiningType), MerchantImage = t.MerchantImage, AuditType = t.AuditType, AuditTypeName = AttrExtension.GetSingleDescription <AuditEnum, DescriptionAttribute>(t.AuditType), DingRoleId = t.DingRoleId, TypePath = t.TypePath, Address = t.Address, Certification = t.Certification, Email = t.Email, ImplUser = t.ImplUser, TableName = typeof(ResponseMerchant).Name }).FirstOrDefault(); #endregion 餐饮企业登录 #region 非企业登录 IQueryable <RepastInfoUser> queryables = Kily.Set <RepastInfoUser>() .Where(t => t.Account.Equals(LoginValidate.Account) || t.Phone.Equals(LoginValidate.Account)) .Where(t => t.PassWord.Equals(LoginValidate.PassWord)) .Where(t => t.IsDelete == false); ResponseMerchantUser User = queryables.Select(t => new ResponseMerchantUser() { Id = t.InfoId, InfoId = t.Id, Account = t.Account, TrueName = t.TrueName, DiningType = t.DiningType, VersionType = t.VersionType, DingRoleId = t.DingRoleId, TypePath = t.TypePath, MerchantName = t.MerchantName, Phone = t.Phone, IdCard = t.Phone, VersionTypeName = AttrExtension.GetSingleDescription <SystemVersionEnum, DescriptionAttribute>(t.VersionType), DiningTypeName = AttrExtension.GetSingleDescription <MerchantEnum, DescriptionAttribute>(t.DiningType), TableName = typeof(ResponseMerchantUser).Name }).FirstOrDefault(); #endregion 非企业登录 if (Info != null) { return(Info); } else if (User != null) { return(User); } else { return(null); } }