public override void OnActionExecuting(HttpActionContext actionContext) { string userkey = ""; userkey = WebHelper.GetQueryString("userkey"); if (string.IsNullOrWhiteSpace(userkey)) { userkey = WebHelper.GetFormString("userkey"); } long shopuid = UserCookieEncryptHelper.Decrypt(userkey, CookieKeysCollection.USERROLE_SELLERADMIN); var shopm = ManagerApplication.GetSellerManager(shopuid); if (shopm == null) { throw new HimallApiException(ApiErrorCode.Parameter_Error, "商家信息错误"); } var shop = ShopApplication.GetShop(shopm.ShopId); if (shop == null) { throw new HimallApiException(ApiErrorCode.Parameter_Error, "商家信息错误"); } if (shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze) { throw new HimallApiException(ApiErrorCode.User_Freeze, "商家已冻结"); } base.OnActionExecuting(actionContext); }
/// <summary> /// 写入登录cookie /// </summary> /// <param name="member"></param> private void WriteLogin(Entities.MemberInfo member) { if (member != null) { base.SetUserLoginCookie(member.Id, DateTime.MaxValue); Core.Helper.WebHelper.SetCookie(CookieKeysCollection.HIMALL_ACTIVELOGOUT, "0", DateTime.MaxValue); var sell = ManagerApplication.GetSellerManager(member.UserName); if (sell != null) { base.SetSellerAdminLoginCookie(sell.Id, DateTime.MaxValue); } else { //多个账号切换时,商家之前登录的cookie可能没有清除掉,当当前账号不存在时再清除下 Core.Helper.WebHelper.DeleteCookie(CookieKeysCollection.SELLER_MANAGER); } } }
protected override Manager GetUser() { return(ManagerApplication.GetSellerManager(this.CurrentUserId)); }