예제 #1
0
        /// <summary>
        /// 取得用户的订购信息,收费代码和到期时间,使用"|"分隔
        /// </summary>
        public String GetUserVas(EntityUser session, ref string message)
        {
            string userSubscribe      = string.Empty;
            string cacheKey_subscribe = "tkci_user_subscribe_" + session.fSubUserName;
            int    cacheTimeOut       = 30 * 60; //缓存30分钟

            WService.WebServiceForKeywordForecast wsProxy = new WService.WebServiceForKeywordForecast();
            try
            {
                userSubscribe = wsProxy.GetValueTimeOut(cacheKey_subscribe);
                if (!string.IsNullOrEmpty(userSubscribe))
                {
                    return(userSubscribe);
                }
            }
            catch (Exception se)
            {
                logger.Error("缓存获取用户收费代码失败", se);
            }

            VasSubscribeGetResponse response = CommonHandler.DoTaoBaoApi <VasSubscribeGetResponse>(bllTaoBaoApi.TaobaoSimbaSvaGet, session);

            if (response.IsError)
            {
                message = response.SubErrMsg;
                logger.ErrorFormat("API获取用户收费代码失败,{0}", response.Body);
            }
            else
            {
                if (response != null && response.ArticleUserSubscribes != null && response.ArticleUserSubscribes.Count > 0)
                {
                    string itemCode = string.Join(",", response.ArticleUserSubscribes.Select(o => o.ItemCode).ToArray());
                    string deadLine = string.Join(",", response.ArticleUserSubscribes.Select(o => o.Deadline).ToArray());
                    userSubscribe = itemCode + "|" + deadLine;
                    try
                    {
                        wsProxy.SetValueTimeOut(cacheKey_subscribe, userSubscribe, cacheTimeOut);
                    }
                    catch (Exception se)
                    {
                        logger.Error("缓存设置用户收费代码失败", se);
                    }
                }
            }


            return(userSubscribe);
        }
예제 #2
0
        /// <summary>
        /// 判断用户是否VIP
        /// </summary>
        public Boolean CheckUserVip(string userName)
        {
            Boolean result   = false;
            string  cacheKey = "tkci_user_vips";

            WService.WebServiceForKeywordForecast wsProxy = new WService.WebServiceForKeywordForecast();
            try
            {
                string vips = wsProxy.GetValueTimeOut(cacheKey);
                if (!string.IsNullOrEmpty(vips))
                {
                    string[] arrUserName = vips.Split(',');
                    if (arrUserName.Contains(userName))
                    {
                        result = true;
                    }
                }
            }
            catch (Exception se)
            {
                logger.Error("缓存获取VIP用户失败", se);
            }
            return(result);
        }
예제 #3
0
        /// <summary>
        /// 判断用户是否是测试初级版的
        /// </summary>
        public Boolean IsUserTestBasicVersion(string userName)
        {
            Boolean result   = false;
            string  cacheKey = "tkci_basic_version_user";

            WService.WebServiceForKeywordForecast wsProxy = new WService.WebServiceForKeywordForecast();
            try
            {
                string cacheValue = wsProxy.GetValueTimeOut(cacheKey);
                if (!string.IsNullOrEmpty(cacheValue))
                {
                    string[] arrUserName = cacheValue.Split(',');
                    if (arrUserName.Contains(userName))
                    {
                        result = true;
                    }
                }
            }
            catch (Exception se)
            {
                logger.Error("缓存获取初级版测试用户失败", se);
            }
            return(result);
        }