public object GetUser(string UserKey)
        {
            CheckUserLogin();
            dynamic data   = SuccessResult();
            long    userId = CurrentUser.Id;

            var member = MemberApplication.GetMember(userId);

            data.UserId    = member.Id;
            data.UserName  = member.UserName;
            data.Photo     = string.IsNullOrEmpty(member.Photo) ? "" : HimallIO.GetRomoteImagePath(member.Photo);
            data.CellPhone = member.CellPhone;

            data.QQ       = member.QQ;
            data.BirthDay = member.BirthDay;
            data.Nick     = member.Nick;
            data.RealName = member.RealName;
            data.Sex      = (int)member.Sex;


            var orderStatic = StatisticApplication.GetMemberOrderStatistic(userId, true);

            //用户所有订单
            data.AllOrders = orderStatic.OrderCount;
            //待付款订单
            data.WaitingForPay = orderStatic.WaitingForPay;
            //待发货订单
            data.WaitingForDelivery = orderStatic.WaitingForDelivery;//获取待发货订单数
            //未评论订单
            data.WaitingForComments = orderStatic.WaitingForComments;
            //待收货订单/待消费
            data.WaitingForRecieve = orderStatic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(userId);
            //待处理的售后
            data.RefundOrders    = orderStatic.RefundCount;
            data.FavoriteShop    = ShopApplication.GetUserConcernShopsCount(userId);
            data.FavoriteProduct = FavoriteApplication.GetFavoriteCountByUser(userId);
            data.Coupon          = MemberApplication.GetAvailableCouponCount(userId);
            data.Integral        = MemberIntegralApplication.GetAvailableIntegral(userId);
            data.Balance         = MemberCapitalApplication.GetBalanceByUserId(userId);


            //用户参与的团数量
            var seastatus = new List <FightGroupOrderJoinStatus>
            {
                FightGroupOrderJoinStatus.Ongoing,
                FightGroupOrderJoinStatus.JoinSuccess,
                FightGroupOrderJoinStatus.BuildFailed,
                FightGroupOrderJoinStatus.BuildSuccess
            };

            //TODO:FG 查询待优化
            data.GroupTotal = ServiceProvider.Instance <IFightGroupService> .Create.GetJoinGroups(userId, seastatus, 1, 1).Total;

            data.MyGroup = ServiceProvider.Instance <IFightGroupService> .Create.CountJoiningOrder(userId);

            data.IsOpenRechargePresent = SiteSettingApplication.SiteSettings.IsOpenRechargePresent;

            MemberApplication.AddIntegel(member);//给用户加积分//执行登录后初始化相关操作
            return(data);
        }
        /// <summary>
        /// 个人中心主页
        /// </summary>
        /// <returns></returns>
        public new JsonResult <Result <dynamic> > GetUser()
        {
            CheckUserLogin();
            dynamic         d                  = new System.Dynamic.ExpandoObject();
            long            id                 = CurrentUser.Id;
            var             member             = MemberApplication.GetMember(id);
            DistributorInfo currentDistributor = DistributionApplication.GetDistributor(member.Id);

            d.UserName  = member.UserName;                                                                     //用户名
            d.RealName  = member.RealName;                                                                     //真实姓名
            d.Nick      = member.Nick;                                                                         //昵称
            d.UserId    = member.Id.ToString();
            d.CellPhone = member.CellPhone;                                                                    //绑定的手机号码
            d.Photo     = String.IsNullOrEmpty(member.Photo) ? "" : HimallIO.GetRomoteImagePath(member.Photo); //头像

            var statistic = StatisticApplication.GetMemberOrderStatistic(id, true);

            d.AllOrders          = statistic.OrderCount;
            d.WaitingForPay      = statistic.WaitingForPay;
            d.WaitingForRecieve  = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(id);
            d.WaitingForDelivery = statistic.WaitingForDelivery;
            d.WaitingForComments = statistic.WaitingForComments;
            d.RefundOrders       = statistic.RefundCount;

            d.FavoriteShop    = ShopApplication.GetUserConcernShopsCount(member.Id);   //收藏的店铺数
            d.FavoriteProduct = FavoriteApplication.GetFavoriteCountByUser(member.Id); //收藏的商品数

            d.Counpon = MemberApplication.GetAvailableCouponCount(id);

            d.Integral = MemberIntegralApplication.GetAvailableIntegral(member.Id); //我的积分
            d.Balance  = MemberCapitalApplication.GetBalanceByUserId(member.Id);    //我的资产
            d.IsOpenRechargePresent = SiteSettingApplication.SiteSettings.IsOpenRechargePresent;
            var phone = SiteSettingApplication.SiteSettings.SitePhone;

            d.ServicePhone  = string.IsNullOrEmpty(phone) ? "" : phone;
            d.IsDistributor = (currentDistributor != null && currentDistributor.DistributionStatus == (int)DistributorStatus.Audited);
            return(JsonResult <dynamic>(d));
        }
        public ActionResult Center()
        {
            var userId = CurrentUser.Id;
            MemberCenterModel model = new MemberCenterModel();

            var statistic = StatisticApplication.GetMemberOrderStatistic(userId, true);

            var member = _iMemberService.GetMember(userId);

            model.Member               = member;
            model.AllOrders            = statistic.OrderCount;
            model.WaitingForRecieve    = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(UserId);
            model.WaitingForPay        = statistic.WaitingForPay;
            model.WaitingForDelivery   = statistic.WaitingForDelivery;
            model.WaitingForComments   = statistic.WaitingForComments;
            model.RefundOrders         = statistic.RefundCount;
            model.FavoriteProductCount = FavoriteApplication.GetFavoriteCountByUser(userId);

            //拼团
            model.CanFightGroup         = FightGroupApplication.IsOpenMarketService();
            model.BulidFightGroupNumber = FightGroupApplication.CountJoiningOrder(userId);

            model.Capital      = MemberCapitalApplication.GetBalanceByUserId(userId);
            model.CouponsCount = MemberApplication.GetAvailableCouponCount(userId);
            var integral = MemberIntegralApplication.GetMemberIntegral(userId);

            model.GradeName = MemberGradeApplication.GetMemberGradeByUserIntegral(integral.HistoryIntegrals).GradeName;
            model.MemberAvailableIntegrals = MemberIntegralApplication.GetAvailableIntegral(userId);

            model.CollectionShop = ShopApplication.GetUserConcernShopsCount(userId);

            model.CanSignIn             = _iMemberSignInService.CanSignInByToday(userId);
            model.SignInIsEnable        = _iMemberSignInService.GetConfig().IsEnable;
            model.userMemberInfo        = CurrentUser;
            model.IsOpenRechargePresent = SiteSettings.IsOpenRechargePresent;

            model.DistributionOpenMyShopShow = SiteSettings.DistributorRenameOpenMyShop;
            model.DistributionMyShopShow     = SiteSettings.DistributorRenameMyShop;

            if (PlatformType == PlatformType.WeiXin)
            {
                //分销
                model.IsShowDistributionOpenMyShop = SiteSettings.DistributionIsEnable;
                var duser = DistributionApplication.GetDistributor(CurrentUser.Id);
                if (duser != null && duser.DistributionStatus != (int)DistributorStatus.UnApply)
                {
                    model.IsShowDistributionOpenMyShop = false;
                    //拒绝的分销员显示“我要开店”
                    if (duser.DistributionStatus == (int)DistributorStatus.Refused || duser.DistributionStatus == (int)DistributorStatus.UnAudit)
                    {
                        model.IsShowDistributionOpenMyShop = true && SiteSettings.DistributionIsEnable;
                    }

                    model.IsShowDistributionMyShop = true && SiteSettings.DistributionIsEnable;
                    if (duser.DistributionStatus == (int)DistributorStatus.NotAvailable || duser.DistributionStatus == (int)DistributorStatus.Refused || duser.DistributionStatus == (int)DistributorStatus.UnAudit)
                    {
                        model.IsShowDistributionMyShop = false;
                    }
                }
            }
            _iMemberService.AddIntegel(member); //给用户加积分//执行登录后初始化相关操作
            return(View(model));
        }