Ejemplo n.º 1
0
        /// <summary>
        /// 微信登陆
        /// </summary>
        /// <param name="openId"></param>
        /// <returns></returns>
        public bool WeChatLogin(string openId)
        {
            var IsExist = !string.IsNullOrEmpty(_redisManage.StringGet(openId));

            if (IsExist)
            {
                return(true);
            }

            if (_vipRepository.QueryVipIsExist(openId))
            {
                var vip = _vipRepository.QueryVipByOpenId(openId);
                _redisManage.StringSet(openId, JsonConvert.SerializeObject(vip), TimeSpan.FromSeconds(600));
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取会员信息
        /// </summary>
        /// <param name="openId"></param>
        /// <returns></returns>
        public Vip GetVipInfo(string openId)
        {
            var IsExist = !string.IsNullOrEmpty(_redisManage.StringGet(openId));

            if (IsExist)
            {
                return(JsonConvert.DeserializeObject <Vip>(_redisManage.StringGet(openId)));
            }

            if (_vipRepository.QueryVipIsExist(openId))
            {
                var vip = _vipRepository.QueryVipByOpenId(openId);
                _redisManage.StringSet(openId, JsonConvert.SerializeObject(vip), TimeSpan.FromSeconds(600));
                return(vip);
            }

            return(null);
        }