Exemple #1
0
        public ActionResult KeyWordSearch()
        {
            //搜索词
            string keyword = WebHelper.GetQueryString("keyword");

            WorkContext.SearchWord = WebHelper.HtmlEncode(keyword);
            if (keyword.Length == 0)
            {
                return(PromptView(WorkContext.UrlReferrer, "请输入搜索词"));
            }
            if (!SecureHelper.IsSafeSqlString(keyword))
            {
                return(PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在"));
            }

            //异步保存搜索历史
            Asyn.UpdateSearchHistory(WorkContext.Uid, keyword);

            //获取当前搜索词匹配缓存结果
            ProductSearchKeyInfo keyInfo = BMACache.Get(keyword) as ProductSearchKeyInfo;

            if (keyInfo != null && string.IsNullOrEmpty(keyInfo.Name)) //无匹配
            {
                return(PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在"));
            }

            if (keyInfo == null) //未匹配过
            {
                keyInfo = Searches.GetProductSearchKey(keyword);
                if (keyInfo == null || string.IsNullOrEmpty(keyInfo.Name))
                {
                    keyInfo = new ProductSearchKeyInfo()
                    {
                        Name    = "",
                        keyType = -1,
                        ToId    = -1
                    };
                }
                BMACache.Insert(keyword, keyInfo);
            }

            //再次判断搜索词匹配结果
            if (keyInfo != null && string.IsNullOrEmpty(keyInfo.Name)) //无匹配
            {
                return(PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在"));
            }

            return(Redirect(Url.Action("categorysearch", new RouteValueDictionary {
                { "keyword", keyword }, { "searchKeyType", keyInfo.keyType }, { "searchKeyId", keyInfo.ToId }
            })));
        }
Exemple #2
0
        /// <summary>
        /// 删除用户等级
        /// </summary>
        /// <param name="userRid">用户等级id</param>
        /// <returns>-2代表系统等级不能删除,-1代表此等级下还有用户未删除,0代表此用户等级不存在,1代表删除成功</returns>
        public static int DeleteUserRankById(int userRid)
        {
            UserRankInfo userRankInfo = GetUserRankById(userRid);

            if (userRankInfo != null)
            {
                if (userRankInfo.System == 1)
                {
                    return(-2);
                }

                if (AdminUsers.GetUserCountByUserRid(userRid) > 0)
                {
                    return(-1);
                }

                NStore.Data.UserRanks.DeleteUserRankById(userRid);
                BMACache.Remove(CacheKeys.MALL_USERRANK_LIST);
                return(1);
            }
            return(0);
        }
Exemple #3
0
 /// <summary>
 /// 更新用户等级
 /// </summary>
 public static void UpdateUserRank(UserRankInfo userRankInfo)
 {
     NStore.Data.UserRanks.UpdateUserRank(userRankInfo);
     BMACache.Remove(CacheKeys.MALL_USERRANK_LIST);
 }
 /// <summary>
 /// 创建用户等级
 /// </summary>
 public static void CreateUserRank(UserRankInfo userRankInfo)
 {
     BrnMall.Data.UserRanks.CreateUserRank(userRankInfo);
     BMACache.Remove(CacheKeys.MALL_USERRANK_LIST);
 }