Exemplo n.º 1
0
        /// <summary>
        /// 自动添加返水
        /// </summary>
        /// <param name="time1">投注起始时间</param>
        /// <param name="time2">投注结束时间</param>
        /// <param name="fsbl">返水比率</param>
        /// <param name="mark">备注</param>
        /// <returns></returns>
        public static string AutoFanshui(string time1, string time2, decimal fsbl, string mark, string gametype)
        {
            decimal         down        = 10; //返水下限
            string          username    = "";
            decimal         amount      = 0;  //返水金额
            decimal         validamount = 0;
            string          type        = gametype;
            MySqlDataReader reader      = null;

            //查找时间段内有投注的会员
            try
            {
                if (gametype == "4")
                {
                    //ea返水
                    reader = BankService.GetFanshuis1(time1, time2);
                }
                else
                {
                    //pt
                    reader = BankService.GetFanshuisPT(time1, time2);
                }
                while (reader.Read())
                {
                    //遍历每个会员,把返水金额大于10元的插入返水审核表
                    username    = reader.GetString("login");
                    validamount = reader.GetDecimal("betamount");
                    amount      = validamount * fsbl / 100;
                    amount      = Math.Round(amount, 2);
                    if (amount >= down)
                    {
                        //派发返水
                        //判断用户是否存在
                        if (UserService.IsExistUsername(username))
                        {
                            //用户存在则派发
                            BankService.AddFanShui(username, type, amount, "1", mark, fsbl.ToString(), time1, time2, validamount);
                        }
                    }
                }
                return("1");
            }
            catch
            {
                return("0");
            }
        }