Beispiel #1
0
        public JsonResult AddLotteryOrders(string list, int usedisFee = 0)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            List <LotteryOrder>  models     = serializer.Deserialize <List <LotteryOrder> >(list);
            string msg    = "";
            var    result = LotteryOrderBusiness.CreateUserOrderList(models, CurrentUser, OperateIP, usedisFee, 3, ref msg);

            JsonDictionary.Add("result", result);
            JsonDictionary.Add("ErrMsg", msg);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public JsonResult MessageInfo(string message, string cpcode, string issuenum)
        {
            string mes    = "";
            var    result = -1;

            message = message.Replace("毒", "万千百十个");
            var strs = message.Trim().Split(' ');

            if (strs.Length == 2)
            {
                message = "万个 " + message.Trim();
                strs    = message.Trim().Split(' ');
            }
            if (strs.Length == 3)
            {
                List <Plays>  plays   = CommonBusiness.LottertPlays.Where(x => x.CPCode == cpcode && !string.IsNullOrEmpty(x.OutName)).ToList();
                Lottery       lottery = CommonBusiness.LottertList.Where(x => x.CPCode == cpcode.ToUpper()).FirstOrDefault();
                List <string> list1   = new List <string>();
                List <string> list2   = new List <string>();
                List <string> list3   = new List <string>();
                var           chars   = strs[1].Trim().ToCharArray();
                if (strs[1].Trim().IndexOf("龙") > -1 || strs[1].Trim().IndexOf("虎") > -1 || strs[1].Trim().IndexOf("和") > -1)
                {
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if ("龙虎和".IndexOf(s) > -1)
                        {
                            list2.Add(s);
                        }
                    }
                    chars = strs[0].Trim().ToCharArray();
                    string mv = "";
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if (cpcode.ToLower() == "bjsc")
                        {
                        }
                        else
                        {
                            if ("万千百十个".IndexOf(s) > -1)
                            {
                                mv = mv + s;
                                if (mv.Length == 2)
                                {
                                    list1.Add(mv);
                                    mv = "";
                                }
                            }
                        }
                    }
                }
                else
                {
                    chars = strs[0].Trim().ToCharArray();
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if (cpcode.ToLower() == "bjsc")
                        {
                        }
                        else
                        {
                            if ("万千百十个".IndexOf(s) > -1)
                            {
                                list1.Add(s);
                            }
                        }
                    }
                    chars = strs[1].Trim().ToCharArray();
                    foreach (char c in chars)
                    {
                        string s = c.ToString();
                        if ("龙虎和大小单双1234567890".IndexOf(s) > -1)
                        {
                            list2.Add(s);
                        }
                    }
                }


                list3.Add(System.Text.RegularExpressions.Regex.Replace(strs[2], @"[^0-9]+", ""));
                if (list1.Count > 0 && list2.Count > 0 && list3.Count > 0)
                {
                    List <LotteryOrder>         orders = new List <LotteryOrder>();
                    Dictionary <string, string> tplays = new Dictionary <string, string>();
                    foreach (string s in list1)
                    {
                        foreach (string t in list2)
                        {
                            string key = s + t;
                            string pid = plays.Where(x => x.OutName.IndexOf(key) > -1).FirstOrDefault().PIDS;
                            if (!tplays.ContainsKey(s + t) && !string.IsNullOrWhiteSpace(pid))
                            {
                                LotteryOrder order = new LotteryOrder();
                                order.CPCode    = cpcode.ToUpper();
                                order.CPName    = lottery.CPName;
                                order.Status    = 0;
                                order.TypeName  = key;
                                order.Type      = pid;
                                order.Num       = 1;
                                order.PMuch     = 1;
                                order.RPoint    = 0;
                                order.MType     = 0;
                                order.ModelName = "0/0%";
                                order.PayFee    = Convert.ToDecimal(Convert.ToInt32(list3[list3.Count - 1]));
                                order.Content   = t;
                                order.UserID    = CurrentUser.UserID;
                                order.IssueNum  = issuenum;
                                orders.Add(order);
                                tplays.Add(s + t, pid);
                            }
                        }
                    }
                    if (list2.Count > 1 && orders.Count > 1)
                    {
                        decimal payfee = Convert.ToDecimal(Convert.ToInt32(Convert.ToInt32(list3[list3.Count - 1]) / orders.Count));
                        if (payfee > 10)
                        {
                            orders.ForEach(x => x.PayFee = payfee);
                            result = LotteryOrderBusiness.CreateUserOrderList(orders, CurrentUser, OperateIP, 0, 4, ref mes);
                        }
                        else
                        {
                            mes = "单注金额必须大于10元";
                        }
                    }
                    else if (orders.Count > 0)
                    {
                        if (Convert.ToDecimal(Convert.ToInt32(list3[list3.Count - 1])) > 10)
                        {
                            result = LotteryOrderBusiness.CreateUserOrderList(orders, CurrentUser, OperateIP, 0, 4, ref mes);
                        }
                        else
                        {
                            mes = "单注金额必须大于10元";
                        }
                    }
                    else
                    {
                        mes = "输入格式不正确";
                    }
                }
                else
                {
                    mes = "输入格式不正确";
                }
            }
            JsonDictionary.Add("result", result > 0?"投注成功":mes);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }