예제 #1
0
        /// <summary>
        /// 更新盟友等级
        /// </summary>
        /// <param name="userId"></param>
        public static void userUpdate(int userId)
        {
            int amount = OrderLogic.CountOrdersByAllyUserId(userId, 1);

            using (var dal = FactoryDispatcher.UserFactory())
            {
                List <MallUserLevelModel> levels = dal.GeUserLevelList(ConstConfig.storeId, 0);
                bool isFind = false;
                foreach (MallUserLevelModel level in levels)
                {
                    if (amount >= level.UL_MemberNum)
                    {
                        //更新用户等级
                        dal.updateUserLevel(userId, level.UL_ID);
                        isFind = true;
                        break;
                    }
                }
                if (!isFind)
                {
                    int leveid = dal.GetMinLevelID(ConstConfig.storeId, 0);
                    //更新用户等级
                    dal.updateUserLevel(userId, leveid);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 我的业务汇总
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="userIdentity">用户身份0盟友 1盟主</param>
        /// <returns>MyUserBusinessModel.</returns>
        public static MyUserBusinessModel MyBusinessAmount(int userId, int userIdentity)
        {
            MyUserBusinessModel model = new MyUserBusinessModel();

            //订单数量
            model.orderAmount = userIdentity == 1 ? OrderLogic.CountOrders(userId, 0) : OrderLogic.CountOrdersByAllyUserId(userId, 0);

            //客户数量
            model.customerAmount = CustomerLogic.GetCustomerCount(userId, userIdentity, 0);

            //兑换数量
            model.exchangeAmount = GetConvertCount(userId, 0);


            var data = getMyCashCouponList(userId);

            if (data != null)
            {
                //现金券数量
                //model.cashCouponAmount = CouponLogic.GetMyCashCouponCount(userId);
                model.cashCouponAmount = data.Count();
            }

            if (userIdentity == 1)
            {
                model.allyApplyAmount = AllyApplyCount(userId);
            }
            return(model);
        }