Exemple #1
0
        /// <summary>
        /// 订单回写
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool OrderReturn(JuHeFuResponseModel model)
        {
            bool           isOk     = false;
            CustomerEntity userInfo = accountBll.GetUserById(ConvertHelper.ZParseInt32(model.userid, 0));

            #region 操作充值、回写订单

            //验证订单号、流水号
            OrderPaymentEntity entity = buyOrderManager.GetOrderPaymentByTradeCode(model.tradeid);
            if (entity == null)
            {
                LogHelper.WriteInfo(typeof(PayBll), string.Format("PayCallBackRetunResult支付回调操作失败信息:订单不存在-----{0}", JsonHelper.ToJson(model)));
                //该订单不存在,记录日志
                return(false);
            }
            if (entity.UserId.ToString().Trim() != model.userid.Trim() || entity.PayCode != model.channeltradeid)
            {
                LogHelper.WriteInfo(typeof(PayBll), string.Format("PayCallBackRetunResult支付回调操作失败信息:UserId、Tradeid跟订单信息不匹配----{0}", JsonHelper.ToJson(model)));
                //信息有误,记录日志
                return(false);
            }
            if (model.success == "1")
            {
                //调用充值
                if (entity.PayStatus == 1)
                {
                    if (userInfo.SourceType == 10)
                    {
Exemple #2
0
        /// <summary>
        /// 检查登陆状态
        /// </summary>
        /// <param name="userModel"></param>
        /// <returns></returns>
        private static bool CheckSessionBase(out LoginUserModel userModel)
        {
            userModel = null;
            if (System.Web.HttpContext.Current.Session != null &&
                System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser] != null)
            {
                int userId = System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser].As(0);

                try
                {
                    if (userId <= 0)
                    {
                        System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser] = null;
                        System.Web.HttpContext.Current.Session.Clear();
                        return(false);
                    }
                    var tempuser = RedisCacheHelper.AutoCache <LoginUserModel>("", GetLoginUserRedisKey(userId), () => accountBll.GetUserById(userId).AsLoginUserModel(), ConfigHelper.SessionExpireMinutes);
                    if (tempuser == null || tempuser.Status != 1)
                    {
                        //清错误缓存
                        RedisCacheHelper.Remove(GetLoginUserRedisKey(userId));
                        System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser] = null;
                        System.Web.HttpContext.Current.Session.Clear();
                        return(false);
                    }
                    userModel = tempuser;
                    return(true);
                }
                catch (Exception ex)
                {
                    LogHelper.Error(ex);
                    RedisCacheHelper.Remove(GetLoginUserRedisKey(userId));
                    System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser] = null;
                    return(false);
                }
            }

            return(false);
        }