public object GetUser(string userName, string password) { var siteSettings = SiteSettingApplication.SiteSettings; //普通登录 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) { //商家登录也放在这里,因为商家app和门店app为同一个并且没做登录区分,只能通过登录后才能知道是登录的商家还是门店管理员 var seller = ManagerApplication.Login(userName, password); dynamic result = SuccessResult(); if (seller != null) { if (!siteSettings.IsOpenShopApp) { return(ErrorResult("未授权商家APP")); } var shop = ShopApplication.GetShop(seller.ShopId); if (shop != null && shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.HasExpired) { return(ErrorResult("店铺已过期")); } if (null != shop && shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze) { return(ErrorResult("店铺已冻结")); } if (shop != null && shop.ShopStatus != Entities.ShopInfo.ShopAuditStatus.Open) { return(ErrorResult("无效的账号")); } if (seller.RoleId != 0) { var model = RoleApplication.GetRoleInfo(seller.RoleId); //TODO:FG 权限验证 实现逻辑待优化 var SellerPrivileges = RoleApplication.GetSellerPrivileges(seller.RoleId); if (!SellerPermission.CheckPermissions(SellerPrivileges, "App", "App")) { return(ErrorResult("您没有登录商家APP的权限")); } } result = SuccessResult(); result.UserKey = UserCookieEncryptHelper.Encrypt(seller.Id, CookieKeysCollection.USERROLE_SELLERADMIN); result.type = ManagerType.ShopManager; return(result); } var member = ShopBranchApplication.ShopBranchLogin(userName, password); if (member == null) { return(ErrorResult("用户名或密码错误")); } var shopbranch = ShopBranchApplication.GetShopBranchById(member.ShopBranchId); if (shopbranch != null) { if (shopbranch.Status == ShopBranchStatus.Freeze) { return(ErrorResult("门店已被冻结")); } if (!siteSettings.IsOpenStore) { return(ErrorResult("未授权门店模块")); } } var membershop = ShopApplication.GetShop(shopbranch.ShopId); if (membershop != null && membershop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.HasExpired) { return(ErrorResult("门店所属店铺已过期")); } if (null != membershop && membershop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze) { return(ErrorResult("门店所属店铺已冻结")); } if (member != null) { result = SuccessResult(); result.UserKey = UserCookieEncryptHelper.Encrypt(member.Id, CookieKeysCollection.USERROLE_USER); result.type = ManagerType.ShopBranchManager; return(result); } } return(ErrorResult("用户名或密码不能为空")); }