Exemple #1
0
        public void CallBack()
        {
            Recharge thrid = null;

            if (!CreateRecharge(out thrid))
            {
                throw new ZzbException("验证失败");
            }

            if (thrid.State != RechargeStateEnum.Ok)
            {
                thrid.State    = RechargeStateEnum.Ok;
                thrid.IsEnable = true;
                //  thrid.Player.AddMoney(thrid.Money, CoinLogTypeEnum.Recharge, thrid.RechargeId, out var log, $"第三方充值自动到账,订单号为[{thrid.OrderNo}]");
                //  Context.CoinLogs.Add(log);
                //AcvitityServer.ActivityHandle(thrid);
                //    RechargeService.ReceiveGift(thrid, Context);
                var rate = BaseConfig.CreateInstance(SystemConfigEnum.ConsumerWithdrawRate).DecimalValue;
                if (rate > 0)
                {
                    rate = rate / 100;
                    //   thrid.Player.UpdateLastBetMoney(thrid.Money * rate);
                }
                Context.SaveChanges();
                LogHelper.Debug($"自动到账成功[{thrid.RechargeId}]");
            }
        }
Exemple #2
0
        public ServiceResult GetConfigValues(string configKeys)
        {
            if (string.IsNullOrEmpty(configKeys))
            {
                return(new ServiceResult()
                {
                    Message = "你想干嘛?.", ReturnCode = ServiceResultCode.Error
                });
            }
            string[] setKeys = configKeys.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            Dictionary <string, string> dic = new Dictionary <string, string>();

            foreach (string keyStr in setKeys)
            {
                if (!Enum.TryParse(keyStr, out SystemConfigEnum type))
                {
                    return(new ServiceResult(ServiceResultCode.Error, "传达的参数错误"));
                }
                var val = BaseConfig.CreateInstance(type).Value;
                dic.Add(keyStr, val);
            }
            return(Json(() => new ServiceResult <Dictionary <string, string> >()
            {
                Data = dic, ReturnCode = ServiceResultCode.Success
            }, "失败."));
        }
Exemple #3
0
        public ServiceResult Save()
        {
            var player = (from p in Context.Players where p.Name == Name select p).First();

            Rebate /= 100;

            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(Password))
            {
                sb.Append(",修改登录密码");
                player.Password = SecurityHelper.Encrypt(Password);
            }
            if (!string.IsNullOrEmpty(CoidPassword))
            {
                sb.Append(",修改资金密码");
                player.CoinPassword = SecurityHelper.Encrypt(CoidPassword);
            }



            UserOperateLogService.Log($"修改玩家[{player.Name}]资料{sb}{MvcHelper.LogDifferent(new LogDifferentViewModel((player.Rebate * 100).ToDecimalString(), (Rebate * 100).ToDecimalString(), "返点"), new LogDifferentViewModel(player.DailyWageRate == null ? null : (player.DailyWageRate.Value * 100).ToDecimalString(), DailyWageRate?.ToDecimalString(), "标准日工资"), new LogDifferentViewModel(player.DividendRate == null ? null : (player.DividendRate.Value * 100).ToDecimalString(), DividendRate?.ToDecimalString(), "分红比例"), new LogDifferentViewModel(player.IsFreeze.ToString(), IsFreeze.ToString(), "是否冻结"), new LogDifferentViewModel(player.CanWithdraw.ToString(), CanWithdraw.ToString(), "是否可以提现"))}", Context);

            if (player.ParentPlayer != null)
            {
                if (player.ParentPlayer.Rebate < Rebate)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"返点不能超过上级[{player.ParentPlayer.Rebate.ToPercenString()}]"));
                }

                if (DailyWageRate != null)
                {
                    if (player.ParentPlayer.DailyWageRate == null)
                    {
                        return(new ServiceResult(ServiceResultCode.Error, $"上级没有设置标准日工资"));
                    }
                    if (player.ParentPlayer.DailyWageRate * 100 < DailyWageRate)
                    {
                        return(new ServiceResult(ServiceResultCode.Error, $"标准日工资不能超过上级[{player.ParentPlayer.DailyWageRate?.ToPercenString()}]"));
                    }
                }

                if (DividendRate != null)
                {
                    if (player.ParentPlayer.DividendRate == null)
                    {
                        return(new ServiceResult(ServiceResultCode.Error, $"上级没有设置比例分红"));
                    }

                    if (player.ParentPlayer.DividendRate * 100 < DividendRate)
                    {
                        return(new ServiceResult(ServiceResultCode.Error, $"比例分红不能超过上级[{player.ParentPlayer.DividendRate?.ToPercenString()}]"));
                    }
                }
            }
            else
            {
                if (BaseConfig.CreateInstance(SystemConfigEnum.MaxRebate).DecimalValue < Rebate)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"返点不能超过最高返点[{(BaseConfig.CreateInstance(SystemConfigEnum.MaxRebate).DecimalValue * 100).ToDecimalString() + "%"}]"));
                }
            }

            if (player.Players.Any())
            {
                var min = (from p in player.Players orderby p.Rebate descending select p.Rebate).First();
                if (min > Rebate)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"返点不能低于下级[{min.ToPercenString()}]"));
                }
            }

            if (player.Players.Any(t => t.DailyWageRate != null))
            {
                if (DailyWageRate == null)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"标准日工资不能为空,因为已有下级设置了标准日工资"));
                }
                var min = (from p in player.Players where p.DailyWageRate != null orderby p.DailyWageRate descending select p.DailyWageRate).First();
                if (min > DailyWageRate)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"标准日工资不能低于下级[{min?.ToPercenString()}]"));
                }
            }

            if (player.Players.Any(t => t.DividendRate != null))
            {
                if (DividendRate == null)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"比例分红不能为空,因为已有下级设置了标准日工资"));
                }
                var min = (from p in player.Players where p.DividendRate != null orderby p.DividendRate descending select p.DividendRate).First();
                if (min > DividendRate)
                {
                    return(new ServiceResult(ServiceResultCode.Error, $"比例分红不能低于下级[{min?.ToPercenString()}]"));
                }
            }

            player.Rebate = Rebate;
            if (DailyWageRate != null)
            {
                player.DailyWageRate = DailyWageRate.Value / 100;
            }
            else
            {
                player.DailyWageRate = null;
            }

            if (DividendRate != null)
            {
                player.DividendRate = DividendRate.Value / 100;
            }
            else
            {
                player.DividendRate = null;
            }

            player.IsFreeze    = IsFreeze;
            player.CanWithdraw = CanWithdraw;

            player.Update();
            Context.SaveChanges();
            return(new ServiceResult(ServiceResultCode.Success));
        }