示例#1
0
        public void UpdateProfileDynamic(string userId, string schemeId, string gameCode, string issuseNumber, decimal totalMoney, string dynamicType)
        {
            try
            {
                DB.Begin();

                var man = new Sports_Manager();
                var ub  = new UserBalanceManager();

                var together = man.QuerySports_Together(schemeId);
                var user2    = string.Empty;
                switch (dynamicType)
                {
                case "参与合买":
                    user2 = together.CreateUserId;
                    break;
                }

                var user1Name = ub.QueryUserRegister(userId);
                var user2Name = new C_User_Register();
                if (!string.IsNullOrEmpty(user2))
                {
                    user2Name = ub.QueryUserRegister(user2);
                }

                var entity = new E_Blog_Dynamic()
                {
                    UserId           = userId,
                    UserDisplayName  = user1Name.DisplayName,
                    UserId2          = user2,
                    User2DisplayName = string.IsNullOrEmpty(user2) ? "" : user2Name.DisplayName,
                    GameCode         = gameCode,
                    GameType         = together == null ? "" : together.GameType,
                    IssuseNumber     = issuseNumber,
                    DynamicType      = dynamicType,
                    Guarantees       = together == null ? 0 : together.Guarantees,
                    Price            = together == null ? 0M : together.Price,
                    Progress         = together == null ? 0M : together.Progress,
                    TotalMonery      = together == null ? 0M : together.TotalMoney,
                    SchemeId         = schemeId,
                    Subscription     = together == null ? 0 : together.Subscription,
                    CreateTime       = DateTime.Now,
                };
                var manager = new BlogManager();
                manager.AddBlog_Dynamic(entity);
                DB.Commit();
            }
            catch (Exception ex)
            {
                DB.Rollback();
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        /// 指定代理注册的用户  路径
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public UserRegister QueryUserRegisterByUserId(string userid)
        {
            var referUrl = new UserBalanceManager();
            var user     = referUrl.QueryUserRegister(userid);

            if (user == null)
            {
                new UserRegister();
            }
            return(user);
        }
示例#3
0
        /// <summary>
        /// 指定代理注册的用户  路径
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public UserRegister QueryByUserIdReferrerUrl(string userid)
        {
            var referUrl    = new UserBalanceManager();
            var ReferrerUrl = referUrl.QueryUserRegister(userid);

            if (ReferrerUrl == null)
            {
                throw new Exception("用户不存在");
            }
            return(ReferrerUrl);
        }
示例#4
0
        /// <summary>
        /// 被关注
        /// </summary>
        public void UpdateProfileAttention_Passive(string activeUserId, string passiveUserId, int count)
        {
            string guanZhu = string.Empty;

            if (count == 1)
            {
                guanZhu = "被关注";
            }
            if (count == -1)
            {
                guanZhu = "取消被关注";
            }

            //添加一条动态
            var ub        = new UserBalanceManager();
            var user1Name = ub.QueryUserRegister(passiveUserId);
            var user2Name = ub.QueryUserRegister(activeUserId);
            var entity    = new E_Blog_Dynamic()
            {
                UserId           = passiveUserId,
                UserDisplayName  = user1Name.DisplayName,
                UserId2          = activeUserId,
                User2DisplayName = user2Name.DisplayName,
                GameCode         = "",
                GameType         = "",
                IssuseNumber     = "",
                DynamicType      = guanZhu,
                Guarantees       = 0,
                Price            = 0M,
                Progress         = 0M,
                TotalMonery      = 0M,
                SchemeId         = "",
                Subscription     = 0,
                CreateTime       = DateTime.Now,
            };
            var manager = new BlogManager();

            manager.AddBlog_Dynamic(entity);
        }
示例#5
0
        /// <summary>
        /// 修改专家信息
        /// </summary>
        public void UpdateExperter(string userId, string image, string summary, string adeptGameCode)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager      = new ExperterManager();
                var useerManager = new UserBalanceManager();
                var userEntity   = useerManager.QueryUserRegister(userId);
                if (userEntity == null)
                {
                    throw new LogicException(string.Format("用户Id:{0}没有找到该用户", userId));
                }

                var experterId = manager.QueryExperterById(userId);
                if (experterId == null)
                {
                    throw new LogicException("没有该专家!");
                }

                var noneDealWith = manager.QueryExperterUpdateHitstroy(userId);
                if (noneDealWith != null)
                {
                    throw new LogicException("您上次提交的信息正在审核中,请耐心等待!");
                }

                var entity = new ExperterUpdateHitstroy()
                {
                    UserId            = userId,
                    ExperterHeadImage = image,
                    AdeptGameCode     = adeptGameCode,
                    ExperterSummary   = summary,
                    CreateTime        = DateTime.Now,
                    DealWithType      = DealWithType.NoneDealWith,
                    DisposeOpinion    = "",
                };
                manager.AddExperterUpdateHitstroy(entity);

                biz.CommitTran();
            }
        }
示例#6
0
        /// <summary>
        /// 添加名家
        /// </summary>
        public void AddExperter(ExperterInfo experter)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager      = new ExperterManager();
                var useerManager = new UserBalanceManager();
                var userEntity   = useerManager.QueryUserRegister(experter.UserId);
                if (userEntity == null)
                {
                    throw new LogicException(string.Format("用户Id:{0}没有找到该用户", experter.UserId));
                }
                var entityUser = manager.QueryExperterById(experter.UserId);
                if (entityUser != null)
                {
                    throw new LogicException(string.Format("该用户:{0}已经是名家", experter.UserId));
                }
                var entity = new Experter()
                {
                    UserId             = experter.UserId,
                    ExperterHeadImage  = experter.ExperterHeadImage,
                    AdeptGameCode      = "JCZQ",
                    ExperterSummary    = experter.ExperterSummary,
                    RecentlyOrderCount = 0,
                    IsEnable           = true,
                    ExperterType       = experter.ExperterType,
                    CreateTime         = DateTime.Now,
                    WeekShooting       = 0M,
                    MonthRate          = 0M,
                    TotalRate          = 0M,
                    WeekRate           = 0M,
                    DealWithType       = DealWithType.HasDealWith,
                    DisposeOpinion     = "",
                    MonthShooting      = 0M,
                    TotalShooting      = 0M,
                };
                manager.AddExperter(entity);
                biz.CommitTran();
            }
        }
示例#7
0
        public LoginInfo ResponseAuthenticationEmail(string userId, int delaySeconds, string delayDescription, out string mobile)
        {
            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var manager = new BettingPointManager())
                {
                    var entity = manager.GetUserEmail(userId);
                    if (entity == null)
                    {
                        throw new ArgumentException("尚未请求邮箱认证");
                    }
                    if (entity.IsSettedEmail)
                    {
                        throw new ArgumentException(string.Format("已于【{0:yyyy-MM-dd HH:mm:ss}】进行过邮箱认证。", entity.UpdateTime));
                    }
                    var span = DateTime.Now - entity.UpdateTime.AddSeconds(delaySeconds);
                    if (span.TotalSeconds > 0)
                    {
                        throw new ArgumentException(string.Format("提交认证邮箱必须在请求认证后【{0}】内完成。", delayDescription));
                    }
                    entity.IsSettedEmail = true;
                    manager.UpdateUserEmail(entity);
                    mobile = entity.Email;

                    //查询vip等级
                    var balanceManager = new UserBalanceManager();
                    var userReg        = balanceManager.QueryUserRegister(userId);
                    var gv             = new TaskListManager();
                    var old            = gv.QueryTaskListByCategory(userId, TaskCategory.EmailBinding);
                    if (old == null)
                    {
                        //增加成长值
                        var orderId = Guid.NewGuid().ToString("N");
                        BusinessHelper.Payin_UserGrowth("邮箱绑定", orderId, userId, 50, "完成邮箱绑定可获得50点成长值");
                        gv.AddUserTaskRecord(new UserTaskRecord
                        {
                            CreateTime   = DateTime.Now,
                            CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                            OrderId      = orderId,
                            TaskCategory = TaskCategory.EmailBinding,
                            TaskName     = "邮箱绑定",
                            UserId       = userId,
                        });
                        gv.AddTaskList(new TaskList
                        {
                            UserId       = userId,
                            OrderId      = orderId,
                            Content      = "完成邮箱绑定可获得50点成长值",
                            ValueGrowth  = 50,
                            IsGive       = true,
                            VipLevel     = 0,
                            CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                            TaskCategory = TaskCategory.EmailBinding,
                            TaskName     = "邮箱绑定",
                            CreateTime   = DateTime.Now,
                        });
                    }
                }
                biz.CommitTran();
            }
            var authBiz   = new GameBizAuthBusiness();
            var userToken = authBiz.GetUserToken(userId);

            var userManager = new UserBalanceManager();
            var user        = userManager.GetUserRegister(userId);

            return(new LoginInfo
            {
                DisplayName = user.DisplayName,
                LoginFrom = user.ComeFrom,
                UserId = userId,
                Message = "登录成功",
                Referrer = user.Referrer,
                RegType = user.RegType,
                IsSuccess = true,
                UserToken = userToken,
            });
        }
示例#8
0
        public UserQueryInfo QueryUserByKey(string userId, string agentId)
        {
            var userManager = new UserBalanceManager();
            var reg         = userManager.QueryUserRegister(userId);

            if (reg == null)
            {
                throw new Exception("用户不存在");
            }
            if (!string.IsNullOrEmpty(agentId) && reg.AgentId != agentId)
            {
                throw new Exception(string.Format("用户{0}不属于您发展的用户", userId));
            }

            var balance = userManager.QueryUserBalance(userId);

            if (balance == null)
            {
                throw new Exception("用户账户不存在");
            }

            var realNameManager = new UserRealNameManager();
            var real            = realNameManager.GetUserRealName(userId);

            //var apliy = new AlipayLoginInfo();
            //var apliyCount = apliy.ApliyCount;
            var mobileManagr = new UserMobileManager();
            var mobile       = mobileManagr.GetUserMobile(userId);

            var fundManger         = new FundManager();
            var agentFreezeBalance = fundManger.QueryAgentFreezeBalanceByUserId(userId);
            var caibbFreezeBalance = 0M;

            if (balance.FreezeBalance > 0)
            {
                caibbFreezeBalance = balance.FreezeBalance - agentFreezeBalance;//网站冻结资金=总冻结资金-代理冻结资金;
            }
            var userAlipayManager = new UserAlipayManager();
            var userAlipy         = userAlipayManager.GetUserAlipay(userId);


            var userQQManager = new UserQQManager();
            var userQQ        = userQQManager.GetUserQQ(userId);

            var ocAgentManager = new OCAgentManager();
            var ocAgent        = ocAgentManager.QueryOCAgent(userId);

            return(new UserQueryInfo
            {
                DisplayName = reg.DisplayName,
                UserId = reg.UserId,
                RealName = real == null ? string.Empty : real.RealName,
                IdCardNumber = real == null ? string.Empty : real.IdCardNumber,
                Mobile = mobile == null ? string.Empty : mobile.Mobile,
                FillMoneyBalance = balance.FillMoneyBalance,
                BonusBalance = balance.BonusBalance,
                CommissionBalance = balance.CommissionBalance,
                ExpertsBalance = balance.ExpertsBalance,
                RedBagBalance = balance.RedBagBalance,
                FreezeBalance = caibbFreezeBalance,
                IsEnable = reg.IsEnable,
                AgentId = reg.AgentId,
                IsAgent = reg.IsAgent,
                CardType = "",
                ComeFrom = reg.ComeFrom,
                Email = "",
                IsFillMoney = reg.IsFillMoney,
                IsSettedEmail = true,
                IsSettedMobile = mobile == null ? false : mobile.IsSettedMobile,
                IsSettedRealName = real == null ? false : real.IsSettedRealName,
                RegisterIp = reg.RegisterIp,
                RegTime = reg.CreateTime,
                VipLevel = reg.VipLevel,
                CurrentDouDou = balance.CurrentDouDou,
                ApliyCount = userAlipy == null ? string.Empty : userAlipy.AlipayAccount,
                QQNumber = userQQ == null ? string.Empty : userQQ.QQ,
                CPSMode = ocAgent == null ? 0 : ocAgent.CPSMode,
                UserGrowth = balance.UserGrowth,
                CPSBalance = balance.CPSBalance
            });
        }
示例#9
0
        private void PayOrderBonus(UserBalanceManager userManager, OCAgentManager ocAgentManager, string schemeId, SchemeType schemeType, string orderUserId,
                                   string gameCode, string gameType, string currentUserId, decimal bonusMoney, decimal doPercent)
        {
            var user = userManager.QueryUserRegister(currentUserId);

            if (user == null)
            {
                return;
            }

            var rebate = doPercent;
            var bonus  = ocAgentManager.QueryOCAgentDefaultRebate(currentUserId, gameCode, gameType, CPSMode.PayBonus);

            if (bonus != null && bonus.Rebate > 0M)
            {
                rebate = bonus.Rebate - doPercent;
                if (rebate < 0)
                {
                    return;
                }
                var giveBonus = bonusMoney * rebate / 100;
                if (giveBonus != 0)
                {
                    var remark = string.Format("订单{0}分红{1}元。", schemeId, giveBonus);
                    ocAgentManager.AddOCAgentPayDetail(new OCAgentPayDetail
                    {
                        CreateTime      = DateTime.Now,
                        GameCode        = gameCode,
                        GameType        = gameType,
                        OrderTotalMoney = bonusMoney,
                        OrderUser       = orderUserId,
                        PayInUserId     = currentUserId,
                        PayMoney        = giveBonus,
                        Rebate          = rebate,
                        Remark          = remark,
                        SchemeId        = schemeId,
                        SchemeType      = schemeType,
                        CPSMode         = CPSMode.PayBonus,
                    });
                    if (giveBonus > 0)
                    {
                        //添加佣金
                        BusinessHelper.Payin_To_Balance(AccountType.CPS, BusinessHelper.FundCategory_SchemeBonus, currentUserId,
                                                        schemeId, giveBonus, remark);
                    }
                    else
                    {
                        //添加佣金
                        BusinessHelper.Payout_To_End_CPS(AccountType.CPS, BusinessHelper.FundCategory_SchemeBonus, currentUserId,
                                                         schemeId, decimal.Negate(giveBonus), remark);
                    }
                }
            }

            if (string.IsNullOrEmpty(user.AgentId))
            {
                return;
            }

            //递归
            PayOrderBonus(userManager, ocAgentManager, schemeId, schemeType, orderUserId, gameCode, gameType, user.AgentId, bonusMoney, rebate);
        }
示例#10
0
        public void AddAuthenticationRealName(string authFrom, string userId, string realName, string cardType, string idCardNumber, string createBy, bool checkRepet)
        {
            using (var manager = new UserRealNameManager())
            {
                if (checkRepet)
                {
                    var other = manager.QueryUserRealName(idCardNumber);
                    if (other != null)
                    {
                        throw new ArgumentException(string.Format("此证件号【{0}】已被其他用户认证。", idCardNumber));
                    }
                    //var other2 = manager.QueryUserRealNameByName(realName);
                    //if (other2 != null)
                    //    throw new ArgumentException("对不起,由于系统检测到您的姓名已被绑定,请联系在线客服为您人工绑定,给您带来的不便敬请谅解,此绑定不影响您的正常购彩和提现。");
                }

                var entity = manager.GetUserRealName(userId);
                if (entity != null)
                {
                    entity.RealName         = realName;
                    entity.IdCardNumber     = idCardNumber;
                    entity.IsSettedRealName = true;
                    manager.UpdateUserRealName(entity);
                    //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime));
                }
                else
                {
                    if (entity == null)
                    {
                        entity = new UserRealName
                        {
                            UserId           = userId,
                            User             = manager.LoadUser(userId),
                            AuthFrom         = authFrom,
                            RealName         = realName,
                            CardType         = cardType,
                            IdCardNumber     = idCardNumber,
                            IsSettedRealName = true,
                            CreateBy         = createBy,
                            UpdateBy         = createBy,
                        };
                        manager.AddUserRealName(entity);
                    }
                    else
                    {
                        throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime));
                    }
                }

                //修改vip等级
                var balanceManager = new UserBalanceManager();
                var user           = balanceManager.QueryUserRegister(userId);
                user.VipLevel = 1;
                balanceManager.UpdateUserRegister(user);

                var gv  = new TaskListManager();
                var old = gv.QueryTaskListByCategory(userId, TaskCategory.RealName);
                if (old == null)
                {
                    var orderId = Guid.NewGuid().ToString("N");
                    //增加成长值
                    BusinessHelper.Payin_UserGrowth("实名认证", orderId, userId, 200, "完成实名认证获得200点成长值");
                    gv.AddUserTaskRecord(new UserTaskRecord
                    {
                        OrderId      = orderId,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        CreateTime   = DateTime.Now,
                        TaskName     = "实名认证",
                        TaskCategory = TaskCategory.RealName,
                        UserId       = userId,
                    });
                    //赠送成长值记录
                    gv.AddTaskList(new TaskList
                    {
                        UserId       = userId,
                        OrderId      = Guid.NewGuid().ToString("N"),
                        Content      = "完成实名认证获得200点成长值",
                        ValueGrowth  = 200,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        TaskCategory = TaskCategory.RealName,
                        VipLevel     = 0,
                        IsGive       = true,
                        TaskName     = "实名认证",
                        CreateTime   = DateTime.Now,
                    });
                }
            }
        }
示例#11
0
        //首页活动  绑定实名
        public void AddAuthenticationRealName_Index(string authFrom, string userId, string realName, string cardType, string idCardNumber, string createBy)
        {
            #region
            //using (var manager = new UserRealNameManager())
            //{
            //    var other = manager.GetOtherUserCard(cardType, idCardNumber, userId);
            //    if (other != null && other.IsSettedRealName)//判断证件号的唯一性
            //    {
            //        throw new ArgumentException(string.Format("此证件号【{0}】已被其他用户认证。", idCardNumber));
            //    }
            //    var entity = manager.GetUserRealName(userId);
            //    if (entity != null && !entity.IsSettedRealName && !string.IsNullOrEmpty(entity.IdCardNumber))//判断真实姓名的唯一性
            //    {
            //        entity.RealName = realName;
            //        entity.IdCardNumber = idCardNumber;
            //        entity.IsSettedRealName = true;
            //        manager.UpdateUserRealName(entity);
            //        //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime));
            //    }
            //    else
            //    {
            //        if (entity == null)
            //        {
            //            entity = new UserRealName
            //            {
            //                UserId = userId,
            //                User = manager.LoadUser(userId),
            //                AuthFrom = authFrom,
            //                RealName = realName,
            //                CardType = cardType,
            //                IdCardNumber = idCardNumber,
            //                IsSettedRealName = true,
            //                CreateBy = createBy,
            //                UpdateBy = createBy,
            //            };
            //            manager.AddUserRealName(entity);
            //        }
            //        else
            //            throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime));
            //    }

            //    //修改vip等级
            //    var balanceManager = new UserBalanceManager();
            //    var user = balanceManager.QueryUserRegister(userId);
            //    user.VipLevel = 1;
            //    balanceManager.UpdateUserRegister(user);

            //    var gv = new TaskListManager();
            //    var old = gv.QueryTaskListByCategory(userId, TaskCategory.RealName);
            //    if (old == null)
            //    {
            //        var orderId = Guid.NewGuid().ToString("N");
            //        //增加成长值
            //        BusinessHelper.Payin_UserGrowth("实名认证", orderId, userId, 200, "完成实名认证获得200点成长值");
            //        gv.AddUserTaskRecord(new UserTaskRecord
            //        {
            //            OrderId = orderId,
            //            CurrentTime = DateTime.Now.ToString("yyyyMMdd"),
            //            CreateTime = DateTime.Now,
            //            TaskName = "实名认证",
            //            TaskCategory = TaskCategory.RealName,
            //            UserId = userId,
            //        });
            //        //赠送成长值记录
            //        gv.AddTaskList(new TaskList
            //        {
            //            UserId = userId,
            //            OrderId = Guid.NewGuid().ToString("N"),
            //            Content = "完成实名认证获得200点成长值",
            //            ValueGrowth = 200,
            //            CurrentTime = DateTime.Now.ToString("yyyyMMdd"),
            //            TaskCategory = TaskCategory.RealName,
            //            VipLevel = 0,
            //            IsGive = true,
            //            TaskName = "实名认证",
            //            CreateTime = DateTime.Now,
            //        });
            //    }
            //}
            #endregion

            //注意:一个身份证号码可以被绑定多次
            using (var manager = new UserRealNameManager())
            {
                //var entity = manager.GetRealNameInfoByName(realName, idCardNumber);
                //if (entity != null && entity.IsSettedRealName)//判断证件号的唯一性
                //{
                //    throw new ArgumentException(string.Format("此证件号【{0}】已被其他用户认证。", idCardNumber));
                //}
                var entity = manager.GetUserRealName(userId);
                //if (entity != null && !entity.IsSettedRealName && !string.IsNullOrEmpty(entity.IdCardNumber))//判断真实姓名的唯一性
                if (entity != null)
                {
                    entity.RealName         = realName;
                    entity.IdCardNumber     = idCardNumber;
                    entity.IsSettedRealName = true;
                    manager.UpdateUserRealName(entity);
                    //throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime));
                }
                else
                {
                    if (entity == null)
                    {
                        entity = new UserRealName
                        {
                            UserId           = userId,
                            User             = manager.LoadUser(userId),
                            AuthFrom         = authFrom,
                            RealName         = realName,
                            CardType         = cardType,
                            IdCardNumber     = idCardNumber,
                            IsSettedRealName = true,
                            CreateBy         = createBy,
                            UpdateBy         = createBy,
                        };
                        manager.AddUserRealName(entity);
                    }
                    else
                    {
                        throw new ArgumentException(string.Format("此用户已于【{0:yyyy-MM-dd HH:mm:ss}】进行过实名认证", entity.CreateTime));
                    }
                }

                //修改vip等级
                var balanceManager = new UserBalanceManager();
                var user           = balanceManager.QueryUserRegister(userId);
                user.VipLevel = 1;
                balanceManager.UpdateUserRegister(user);

                var gv  = new TaskListManager();
                var old = gv.QueryTaskListByCategory(userId, TaskCategory.RealName);
                if (old == null)
                {
                    var orderId = Guid.NewGuid().ToString("N");
                    //增加成长值
                    BusinessHelper.Payin_UserGrowth("实名认证", orderId, userId, 200, "完成实名认证获得200点成长值");
                    gv.AddUserTaskRecord(new UserTaskRecord
                    {
                        OrderId      = orderId,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        CreateTime   = DateTime.Now,
                        TaskName     = "实名认证",
                        TaskCategory = TaskCategory.RealName,
                        UserId       = userId,
                    });
                    //赠送成长值记录
                    gv.AddTaskList(new TaskList
                    {
                        UserId       = userId,
                        OrderId      = Guid.NewGuid().ToString("N"),
                        Content      = "完成实名认证获得200点成长值",
                        ValueGrowth  = 200,
                        CurrentTime  = DateTime.Now.ToString("yyyyMMdd"),
                        TaskCategory = TaskCategory.RealName,
                        VipLevel     = 0,
                        IsGive       = true,
                        TaskName     = "实名认证",
                        CreateTime   = DateTime.Now,
                    });
                }
            }
        }
示例#12
0
        /// <summary>
        /// 返点接口
        /// </summary>
        public void ManualAgentPayIn(string schemeId)
        {
            var order = new SchemeManager().QueryOrderDetail(schemeId);

            if (order == null)
            {
                throw new LogicException(string.Format("找不到订单 :{0} ", schemeId));
            }
            if (order.TicketStatus != TicketStatus.Ticketed)
            {
                throw new LogicException("订单未出票完成,不能返点");
            }
            if (order.IsVirtualOrder)
            {
                throw new LogicException("虚拟订单不能返点");
            }

            string          currentUserId   = string.Empty;
            decimal         currentBetMoney = 0M;
            string          currentGameCode = string.Empty;
            bool            currentIsAgent  = false;
            OCAgentBusiness busi            = new OCAgentBusiness();

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();

                //查询订单信息
                var sportsManager = new Sports_Manager();

                //真实订单,处理返点数据
                var gameCode = order.GameCode.ToUpper();
                var gameType = order.GameType.ToUpper();
                var userId   = order.UserId;

                var msg = string.Empty;
                //合买判断
                if (order.SchemeType == SchemeType.TogetherBetting)
                {
                    var main = sportsManager.QuerySports_Together(schemeId);
                    if (main == null)
                    {
                        msg = string.Format("找不到合买订单:{0}", schemeId);
                        //throw new Exception(string.Format("找不到合买订单:{0}", schemeId));
                    }
                    //if (main.ProgressStatus != TogetherSchemeProgress.Finish)
                    //    throw new Exception(string.Format("合买订单:{0} 状态不正确", schemeId));
                    var sysJoinEntity = sportsManager.QuerySports_TogetherJoin(schemeId, TogetherJoinType.SystemGuarantees);
                    if (sysJoinEntity != null && sysJoinEntity.RealBuyCount > 0)
                    {
                        msg = "网站参与保底,不返点";
                        //throw new Exception("网站参与保底,不返点");
                    }

                    if (main.SoldCount + main.Guarantees < main.TotalCount)
                    {
                        throw new Exception("订单未满员,不执行返点");
                    }
                    //realMoney -= main.SystemGuarantees * main.Price;
                }

                var realMoney           = 0M;;
                var totalPayRebateMoney = 0M;
                var agentManager        = new OCAgentManager();
                if (string.IsNullOrEmpty(msg))
                {
                    //没有异常,执行返点
                    var noGameTypeArray = new string[] { "CQSSC", "JX11X5", "SSQ", "DLT", "FC3D", "PL3" };
                    if (noGameTypeArray.Contains(gameCode))
                    {
                        gameType = string.Empty;
                    }

                    //真实投注金额,订单成功金额
                    realMoney = order.TotalMoney;
                    //查询用户自身返点
                    var balanceManager = new UserBalanceManager();
                    var user           = balanceManager.QueryUserRegister(userId);
                    currentIsAgent = user.IsAgent;

                    //去掉红包参与金额
                    var redBagJoinMoney = order.RedBagMoney;// new FundManager().QuerySchemeRedBagTotalJoinMoney(schemeId);
                    realMoney -= redBagJoinMoney;
                    //递归调用
                    int rebateType  = 0;
                    var arrGameCode = new string[] { "JCZQ", "JCLQ", "BJDC" };
                    if (!string.IsNullOrEmpty(order.PlayType) && arrGameCode.Contains(order.GameCode))
                    {
                        if (order.PlayType == "1_1")
                        {
                            rebateType = 1;
                        }
                    }
                    totalPayRebateMoney = busi.PayOrderRebate(agentManager, user, schemeId, userId, order.SchemeType, gameCode, gameType, order.TotalMoney, realMoney, 0, rebateType);
                }

                biz.CommitTran();
            }
            //计算代理销量
            busi.CalculationAgentSales(currentUserId, currentGameCode, currentBetMoney, currentIsAgent, 0);
        }
示例#13
0
        /// <summary>
        /// 申请提现
        /// 实际添加提现记录,扣除用户资金
        /// </summary>
        public void RequestWithdraw_Step2(Withdraw_RequestInfo info, string userId, string password)
        {
            var userManager = new UserBalanceManager();
            var user        = userManager.QueryUserRegister(userId);

            if (!user.IsEnable)
            {
                throw new LogicException("用户已禁用");
            }


            DB.Begin();


            var            resonseMoney   = 0M;
            var            orderId        = BusinessHelper.GetWithdrawId();
            BusinessHelper businessHelper = new BusinessHelper();
            var            category       = businessHelper.Payout_To_Frozen_Withdraw(BusinessHelper.FundCategory_RequestWithdraw, userId, orderId, info.RequestMoney
                                                                                     , string.Format("申请提现:{0:N2}元", info.RequestMoney), "Withdraw", password, out resonseMoney);

            var fundManager = new FundManager();
            var addWithdraw = new C_Withdraw
            {
                OrderId        = orderId,
                BankCardNumber = info.BankCardNumber,
                BankCode       = info.BankCode,
                BankName       = info.BankName,
                BankSubName    = info.BankSubName,
                CityName       = info.CityName,
                RequestTime    = DateTime.Now,
                ProvinceName   = info.ProvinceName,
                UserId         = userId,
                RequestMoney   = info.RequestMoney,
                WithdrawAgent  = (int)info.WithdrawAgent,
                Status         = (int)WithdrawStatus.Requesting,

                WithdrawCategory = (int)category,
                ResponseMoney    = resonseMoney,
            };

            fundManager.AddWithdraw(addWithdraw);

            //查询到账金额
            var wi = GetWithdrawById(orderId);

            //判断DP是否可用
            var cacheDataBusiness = new CacheDataBusiness();
            var iscoreConfigInfo  = cacheDataBusiness.QueryCoreConfigByKey("DP.Isvailable");
            //获取当前系统时间(4-5点DP关闭)
            var      datetime    = System.DateTime.Now;
            var      nowHourAndM = datetime.ToString("t");
            var      datestar    = cacheDataBusiness.QueryCoreConfigByKey("DP.StartTime");
            var      dateend     = cacheDataBusiness.QueryCoreConfigByKey("DP.EndTime");
            DateTime dstar       = Convert.ToDateTime(datestar.ConfigValue);
            DateTime dend        = Convert.ToDateTime(dateend.ConfigValue);

            if (iscoreConfigInfo.ConfigValue == "1")
            {
                if (datetime <= dstar || datetime >= dend)
                {
                    //发送消息到DP
                    //判断是否发送到DP
                    String htmls = info.BankName;
                    //获取Dp提现最大限额
                    var coreConfigInfo = cacheDataBusiness.QueryCoreConfigByKey("DP.WithdrawHigthMoney");
                    //获取Dp给的公司编码
                    var coreConfigInfoC = cacheDataBusiness.QueryCoreConfigByKey("DP.Companyid");
                    //获取DP给的key
                    var ck = cacheDataBusiness.QueryCoreConfigByKey("DP.Key");
                    //获取DP访问路径
                    var     cw = cacheDataBusiness.QueryCoreConfigByKey("DP.WebUrl");
                    decimal withdrawHigthMoney = decimal.Parse(coreConfigInfo.ConfigValue);
                    //var writer = Common.Log.LogWriterGetter.GetLogWriter();
                    //writer.Write("关于DP日志", "关于DP日志", Common.Log.LogType.Information, "关于DP日志", "withdrawHigthMoney===============" + withdrawHigthMoney);

                    String str = String.Format("BankCardNumber=" + info.BankCardNumber + ",BankCode=" + info.BankCode + ",BankName=" + info.BankName + ",BankSubName=" + info.BankSubName + ",CityName=" + info.CityName + ",ProvinceName=" + info.ProvinceName + ",RequestMoney=" + info.RequestMoney + ",userRealName=" + info.userRealName + ",WithdrawAgent=" + info.WithdrawAgent + "");
                    //writer.Write("输出参数写测试用例", "输出参数写测试用例", Common.Log.LogType.Information, "输出参数写测试用例", "输出参数写测试用例===============" + str);
                    WithdrawApplyInfo wai = new WithdrawApplyInfo();
                    wai.company_order_num  = orderId;
                    wai.company_user       = userId;
                    wai.card_name          = info.userRealName;
                    wai.card_num           = info.BankCardNumber;
                    wai.issue_bank_name    = info.BankName;
                    wai.issue_bank_address = info.BankSubName;
                    wai.memo = "";
                    String amount = wi.ResponseMoney.ToString();
                    wai.amount = Math.Round(decimal.Parse(amount), 2);

                    wai.company_id = Int32.Parse(coreConfigInfoC.ConfigValue);
                    String  dpresult    = null;
                    decimal dpHighmoney = decimal.Parse(coreConfigInfo.ConfigValue);
                    if (info.RequestMoney < withdrawHigthMoney)
                    {
                        if (htmls.Contains("工商银行"))
                        {
                            int bankid = (int)BankCode.ICBC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("招商银行"))
                        {
                            int bankid = (int)BankCode.CMB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("建设银行"))
                        {
                            int bankid = (int)BankCode.CCB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("农业银行"))
                        {
                            int bankid = (int)BankCode.ABC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("中国银行"))
                        {
                            int bankid = (int)BankCode.BOC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("交通银行"))
                        {
                            int bankid = (int)BankCode.BCM;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("中国民生银行") || htmls.Contains("民生银行"))
                        {
                            int bankid = (int)BankCode.CMBC;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("中信银行"))
                        {
                            int bankid = (int)BankCode.ECC;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("浦东发展银行") || htmls.Contains("浦发") || htmls.Contains("浦东"))
                        {
                            int bankid = (int)BankCode.SPDB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("邮政储蓄") || htmls.Contains("中国邮政"))
                        {
                            int bankid = (int)BankCode.PSBC;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("光大银行"))
                        {
                            int bankid = (int)BankCode.CEB;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("平安银行"))
                        {
                            int bankid = (int)BankCode.PINGAN;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("广东发展银行") || htmls.Contains("广发银行"))
                        {
                            int bankid = (int)BankCode.CGB;
                            wai.bank_id = bankid.ToString();
                        }
                        else if (htmls.Contains("华夏银行"))
                        {
                            int bankid = (int)BankCode.HXB;
                            wai.bank_id = bankid.ToString();
                        }

                        else if (htmls.Contains("兴业银行"))
                        {
                            int bankid = (int)BankCode.CIB;
                            wai.bank_id = bankid.ToString();
                        }
                        else
                        {
                            var pListe = new List <string>();
                            pListe.Add(string.Format("{0}={1}", "[OrderId]", orderId));
                            pListe.Add(string.Format("{0}={1}", "[UserName]", user.DisplayName));
                            pListe.Add(string.Format("{0}={1}", "[RequestMoney]", info.RequestMoney));
                            pListe.Add(string.Format("{0}={1}", "[ResponseMoney]", resonseMoney));
                            //发送短信
                            new SiteMessageControllBusiness().DoSendSiteMessage(userId, "", "ON_User_Request_Withdraw", pListe.ToArray());
                            DB.Commit();
                            //刷新余额
                            BusinessHelper.RefreshRedisUserBalance(userId);
                            return;
                        }
                        dpresult = Withdrawal(wai, ck.ConfigValue, cw.ConfigValue);
                        if (dpresult == null || dpresult == "")
                        {
                            DB.Rollback();
                            throw new Exception("服务繁忙,请稍后重试,如多次尝试失败,请在客服服务时间内联系在线客服咨询");
                        }
                    }
                }
            }

            #region 发送站内消息:手机短信或站内信
            var pList = new List <string>();
            pList.Add(string.Format("{0}={1}", "[OrderId]", orderId));
            pList.Add(string.Format("{0}={1}", "[UserName]", ""));
            pList.Add(string.Format("{0}={1}", "[RequestMoney]", info.RequestMoney));
            pList.Add(string.Format("{0}={1}", "[ResponseMoney]", resonseMoney));
            //发送短信
            new SiteMessageControllBusiness().DoSendSiteMessage(userId, "", "ON_User_Request_Withdraw", pList.ToArray());

            #endregion

            DB.Commit();


            //刷新余额
            BusinessHelper.RefreshRedisUserBalance(userId);
        }