示例#1
0
        public static QueryPageModel <MemberIntegral> GetMemberIntegrals(IntegralQuery query)
        {
            var data    = _iMemberIntegralService.GetMemberIntegralList(query);
            var members = GetService <IMemberService>().GetMembers(data.Models.Select(p => (long)p.MemberId).ToList());
            var grades  = MemberGradeApplication.GetMemberGrades();
            var result  = new List <MemberIntegral>();

            foreach (var item in data.Models)
            {
                var member = members.FirstOrDefault(p => p.Id == item.MemberId);
                result.Add(new MemberIntegral
                {
                    Id = item.Id,
                    AvailableIntegrals = item.AvailableIntegrals,
                    HistoryIntegrals   = item.HistoryIntegrals,
                    MemberGrade        = MemberGradeApplication.GetMemberGradeByIntegral(grades, item.HistoryIntegrals).GradeName,
                    UserName           = member.UserName,
                    MemberId           = member.Id,
                    CreateDate         = member.CreateDate,
                });
            }

            return(new QueryPageModel <MemberIntegral>
            {
                Models = result,
                Total = data.Total
            });
        }
示例#2
0
        /// <summary>
        /// 会员购买力列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static QueryPageModel <DTO.MemberPurchasingPower> GetPurchasingPowerMember(MemberPowerQuery query)
        {
            var result = _iMemberService.GetPurchasingPowerMember(query);
            QueryPageModel <DTO.MemberPurchasingPower> model = new QueryPageModel <MemberPurchasingPower>();

            model.Total  = result.Total;
            model.Models = AutoMapper.Mapper.Map <List <DTO.MemberPurchasingPower> >(result.Models);

            var userIds = model.Models.Select(p => p.Id).ToArray();

            var memberCategorys = _iMemberService.GetMemberBuyCategoryByUserIds(userIds);

            var grades = MemberGradeApplication.GetMemberGradeList();

            var integrals = MemberIntegralApplication.GetMemberIntegrals(userIds);

            foreach (var item in model.Models)
            {
                var intergral = integrals.Where(a => a.MemberId == item.Id).Select(a => a.HistoryIntegrals).FirstOrDefault();
                //填充等级数据
                item.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, intergral).GradeName;

                //填充分类数据
                var categoryNames = memberCategorys.Where(p => p.UserId == item.Id).Select(p => p.CategoryName).Take(3).ToArray();
                if (categoryNames.Length == 0)
                {
                    continue;
                }
                item.CategoryNames = string.Join(",", categoryNames);
            }

            return(model);
        }
示例#3
0
        /// <summary>
        /// 根据查询条件分页获取会员信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static QueryPageModel <DTO.Members> GetMemberList(MemberQuery query)
        {
            if (query.GradeId.HasValue)
            {
                var expenditureRange = MemberApplication.GetMemberGradeRange(query.GradeId.Value);
                query.MinIntegral = expenditureRange.MinIntegral;
                query.MaxIntegral = expenditureRange.MaxIntegral;
            }
            var list    = _iMemberService.GetMembers(query);
            var members = Mapper.Map <QueryPageModel <DTO.Members> >(list);
            var grades  = MemberGradeApplication.GetMemberGradeList();

            foreach (var m in members.Models)
            {
                var memberIntegral = MemberIntegralApplication.GetMemberIntegral(m.Id);
                //获取等级
                m.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, memberIntegral.HistoryIntegrals).GradeName;
                if (memberIntegral != null)
                {
                    m.AvailableIntegral = memberIntegral.AvailableIntegrals;
                    m.HistoryIntegral   = memberIntegral.HistoryIntegrals;
                }
            }
            return(members);
        }
示例#4
0
        public static QueryPageModel <ManagerInfo> GetMemberList(ManagerQuery query)
        {
            var list    = _iManagerService.GetManagersList(query);
            var members = Mapper.Map <QueryPageModel <ManagerInfo> >(list);
            var grades  = MemberGradeApplication.GetMemberGradeList();

            foreach (var m in members.Models)
            {
                var memberIntegral = MemberIntegralApplication.GetMemberIntegral(m.Id);
                m.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, memberIntegral.HistoryIntegrals).GradeName;
                if (memberIntegral != null)
                {
                    m.AvailableIntegral = memberIntegral.AvailableIntegrals;
                    m.HistoryIntegral   = memberIntegral.HistoryIntegrals;
                }
            }
            return(members);
        }
示例#5
0
        /// <summary>
        /// 获取商家信息列表
        /// </summary>
        public static QueryPageModel <ManagerInfo> GetMemberList(ManagerQuery query)
        {
            var list    = _iManagerService.GetManagersList(query);
            var members = Mapper.Map <QueryPageModel <ManagerInfo> >(list);
            var grades  = MemberGradeApplication.GetMemberGradeList();

            foreach (var m in members.Models)
            {
                //获取用户积分
                var member         = _iMemberService.GetMemberByName(m.UserName);
                var memberIntegral = MemberIntegralApplication.GetMemberIntegral(member.Id);
                m.GradeName = MemberGradeApplication.GetMemberGradeByIntegralandType(grades, memberIntegral.HistoryIntegrals, Convert.ToInt32(m.MemberGradeId), m.BondMoney).GradeName;
                if (memberIntegral != null)
                {
                    m.AvailableIntegral = memberIntegral.AvailableIntegrals;
                    m.HistoryIntegral   = memberIntegral.HistoryIntegrals;
                }
            }
            return(members);
        }
示例#6
0
        /// <summary>
        /// 获取会员信息
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public static Himall.DTO.Members GetMembers(long UserId)
        {
            //  var model = _iMemberService.GetMember(UserId);
            // Mapper.CreateMap<Himall.Model.UserMemberInfo, Himall.DTO.Members>();
            // return Mapper.Map<Himall.Model.UserMemberInfo, Himall.DTO.Members>(model);

            var model = _iMemberService.GetMember(UserId);
            var m     = Mapper.Map <Himall.Model.UserMemberInfo, Himall.DTO.Members>(model);

            if (model.InviteUserId.HasValue)
            {
                var inviteUser = _iMemberService.GetMember(model.InviteUserId.Value);
                if (inviteUser != null)
                {
                    m.InviteUserName = inviteUser.UserName;
                }
            }
            m.MemberLabels = MemberLabelApplication.GetMemberLabelList(UserId).Models;
            var userInte  = MemberIntegralApplication.GetMemberIntegral(UserId);
            var userGrade = MemberGradeApplication.GetMemberGradeByUserIntegral(userInte.HistoryIntegrals);

            m.GradeName = userGrade.GradeName;//方法内部包含获取等级的方法
            return(m);
        }
示例#7
0
        /// <summary>
        /// 根据会员积分获取会员等级,获取单个会员的会员等级(循环调用时禁用)
        /// </summary>
        /// <param name="integral"></param>
        /// <returns></returns>
        public static DTO.MemberGrade GetMemberGradeByUserIntegral(int integral)
        {
            List <Himall.DTO.MemberGrade> memberGrade = MemberGradeApplication.GetMemberGradeList();

            return(GetMemberGradeByIntegral(memberGrade, integral));
        }