//1 2 3 4 5 最多5位万 千 百 十 个 11选5 福彩是3位百 十 个 11选5 第一位(万) 第二位(千) 第三为(百) private static List <BetDetailDTO> SplitDingWeiDanSSC(BetDetailDTO dto, int postionIndex = 0, string res = "") { List <BetDetailDTO> result = new List <BetDetailDTO>(); string content = dto.BetContent; if (string.IsNullOrEmpty(content)) { result.Add(dto); return(result); } var array = content.Replace("&", res).Split('|'); foreach (var str in array) { postionIndex++; if (string.IsNullOrEmpty(str)) { continue; } var newItem = dto.Copy(); newItem.BetContent = str + "_" + postionIndex; newItem.PostionName = Utils.GetPostionName(postionIndex); result.Add(newItem); } return(result); }
public static List <BetDetailDTO> Split(BetDetailDTO dto) { List <BetDetailDTO> res = new List <BetDetailDTO>(); //是否需要拆分 var entity = Ytg.Scheduler.Comm.Bets.RadioContentFactory.PostionLottery(dto.PalyRadioCode); int betMaxCount = 0; if (null != entity) { betMaxCount = (int)(entity.MaxBetCount * Percentage); } if (betMaxCount == 0) { betMaxCount = 9999; } dto.MaxBetCount = betMaxCount; if (string.IsNullOrEmpty(entity.Postion)) { res.Add(dto); return(res); } switch (entity.Postion) { case "DingWeiDanSSC": res = SplitDingWeiDanSSC(dto, 0); //拆分定位胆 break; case "DingWeiDan11x5": res = SplitDingWeiDanSSC(dto, 0, ","); //拆分定位胆 break; case "DingWeiDan3d": if (string.IsNullOrEmpty(dto.BetContent)) { dto.BetContent = "&,&," + dto.BetContent; } res = SplitDingWeiDanSSC(dto, 2); //拆分定位胆 break; case "RenXuanFuShi": //任选复试 res = RenXuanFushi.Split(dto, entity.MinPos); break; case "RenX": res = RenXuanFushi.DanShiSplit(dto, entity.MinPos); break; case "PK10DingWeiDanSSC": //pk10定位胆 //dto.PostionName = "定位胆"; //res.Add(dto); res = SplitPk10DingWeiDan(dto, 0, "&"); break; } return(res); }
/// <summary> /// 拆分复试 /// </summary> /// <param name="dto"></param> /// <returns></returns> public static List <BetDetailDTO> Split(BetDetailDTO dto, int minPos) { List <BetDetailDTO> dtos = new List <BetDetailDTO>(); if (string.IsNullOrEmpty(dto.BetContent)) { return(dtos); } var contentArray = dto.BetContent.Split('|'); List <int> indexSource = new List <int>(); for (var i = 1; i <= contentArray.Length; i++) { var cont = contentArray[i - 1]; if (!string.IsNullOrEmpty(cont)) { indexSource.Add(i); } } Combinations <int> v = new Combinations <int>(indexSource, minPos); foreach (var item in v._combinations) { string writerPos = ""; string writerContent = ""; foreach (var x in item) { writerPos += x; writerContent += contentArray[x - 1] + "|"; } if (writerContent.EndsWith("|")) { writerContent = writerContent.Substring(0, writerContent.Length - 1); } var detail = dto.Copy(); detail.PostionName = Utils.GetPostionName(writerPos).Replace("位", ""); detail.BetContent = writerContent + "_" + writerPos; dtos.Add(detail); } return(dtos); }
/// <summary> /// 拆分其他 单式+位置 /// </summary> /// <param name="dto"></param> /// <param name="minPos"></param> /// <returns></returns> public static List <BetDetailDTO> DanShiSplit(BetDetailDTO dto, int minPos) { List <BetDetailDTO> res = new List <BetDetailDTO>(); //12&34&56_12345 if (string.IsNullOrEmpty(dto.BetContent)) { return(res); } var contentArray = dto.BetContent.Split('_'); if (contentArray.Length != 2) { return(res); } var postion = contentArray[1].Select(x => Convert.ToInt32(x.ToString())).Where(c => c >= 1 && c <= 5).ToList(); if (postion.Distinct().Count() != postion.Count) { return(res); } if (postion.Count() < minPos) { return(res); } Combinations <int> v = new Combinations <int>(postion, minPos); foreach (var item in v._combinations) { string newContent = contentArray[0]; string postr = ""; for (var i = 0; i < minPos; i++) { postr += item[i].ToString(); } var detail = dto.Copy(); detail.BetContent = newContent + "_" + postr; detail.PostionName = Utils.GetPostionName(postr).Replace("位", ""); res.Add(detail); } return(res); }
/// <summary> /// html 版投注处理 /// </summary> private void HtmlAddBetDetails() { /* * loginUserId=63&lotterycode=cqssc&lotteryid=1&play_source=&pmode=2<_project%5b%5d=%7b%27type%27%3a%27digital%27%2c%27methodid%27%3a0%2c%27codes%27%3a%274%7c4%7c4%7c4%7c4%27%2c%27nums%27%3a1%2c%27 * omodel%27%3a2%2c%27times%27%3a1%2c%27money%27%3a2%2c%27mode%27%3a1%2c%27desc%27%3a%27%5b%u4e94%u661f_%u76f4%u9009%u590d%u5f0f%5d+4%2c4%2c4%2c4%2c4%27%7d& * lt_issue_start=20150707010<_total_nums=1<_total_money=2<_trace_if=yes<_trace_stop=yes<_trace_times_margin=1<_trace_margin=50<_trace_times_same=1& * lt_trace_diff=1<_trace_times_diff=2<_trace_count_input=10<_trace_money=20<_trace_issues%5b%5d=20150707011<_trace_issues%5b%5d=20150707012<_trace_issues%5b%5d= * 20150707013<_trace_issues%5b%5d=20150707014<_trace_times_20150707011=1<_trace_times_20150707012=2<_trace_times_20150707013=3<_trace_times_20150707014=4&randomNum=4371 */ int pmode = -1; int.TryParse(Request.Params["pmode"], out pmode); string projects = Request.Params["lt_project[]"]; //投注内容 string issueCode = Request.Params["lt_issue_start"]; //投注期号 bool lt_trace_if = Request.Params["lt_trace_if"] == "yes"; //是否追号 string lt_trace_stop = Request.Params["lt_trace_stop"]; //是否中奖后自动停止 string lt_trace_issues = Request.Params["lt_trace_issues[]"]; //追号期数 string lotteryStr = Request.Params["lotteryid"]; //彩种。。 int lotteryid = -1; if (!int.TryParse(lotteryStr, out lotteryid)) { AppGlobal.RenderResult(ApiCode.ParamEmpty); return; } //追号倍数 lt_trace_times_期号 if (string.IsNullOrEmpty(projects) || string.IsNullOrEmpty(issueCode)) { AppGlobal.RenderResult(ApiCode.ParamEmpty); return; } projects = "[" + projects + "]"; var bettingInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <List <HtmlParamDto> >(projects);//投注内容 if (bettingInfo.Count < 1) { AppGlobal.RenderResult(ApiCode.ParamEmpty); return; } var user = this.mSysUserService.Get(this.LoginUserId);//获取用户返点 if (null == user) { AppGlobal.RenderResult(ApiCode.Fail); return; } BettingDTO betting = new BettingDTO(); betting.BetDetails = new List <BetDetailDTO>(); betting.IsAutoStop = lt_trace_stop == "yes"; //是否自动停止追号 try { foreach (var item in bettingInfo) { if (string.IsNullOrEmpty(item.codes)) { continue; } if (!string.IsNullOrEmpty(item.poschoose)) { item.codes += "_" + item.poschoose; } var details = new BetDetailDTO() { PalyRadioCode = item.methodid, Model = item.mode - 1, Multiple = item.times, PrizeType = item.omodel == 2 ? 0 : 1,//omodel为2则表示舍弃返点的最高奖金 奖金类型 1 为有返点 0为无返点 IssueCode = issueCode, BetContent = item.codes, }; List <BetDetailDTO> appendSource = PostionSplitHelper.Split(details); betting.BetDetails.AddRange(appendSource); } //组织追号数据 if (lt_trace_if && !string.IsNullOrEmpty(lt_trace_issues)) { //追号,组织追号数据 betting.CatchDtos = new List <CatchDto>(); foreach (var item in lt_trace_issues.Split(',')) { int outMultiple = 0; if (!int.TryParse(Request.Params["lt_trace_times_" + item], out outMultiple)) { continue; } betting.CatchDtos.Add(new CatchDto() { IssueCode = item, Multiple = outMultiple }); } } ApiCode errorCode = ApiCode.Success; bool isCompled = false; if (lt_trace_if)//追号 { isCompled = this.CatchBetting(user, betting, ref errorCode, lotteryid, true); } else { isCompled = DefaultDetails(user, betting.BetDetails, ref errorCode, lotteryid, true);//普通投注 } if (isCompled) { AppGlobal.RenderResult(ApiCode.Success); } else { AppGlobal.RenderResult(errorCode); } } catch (Exception ex) { Ytg.Scheduler.Comm.LogManager.Error("HtmlAddBetDetails", ex); AppGlobal.RenderResult(ApiCode.Exception); } }
public dynamic GetUserBet(string id) { BetManager mgr = new BetManager(); EventsManager mgrEvent = new EventsManager(); //var bets = mgr.GetUserBets(id); var bets = mgr.GetUserBets(RequestContextHelper.SessionToken); if (bets.Status.Equals(ResponseStatus.OK)) { List <UserBetDTO> betList = new List <UserBetDTO>(); string lastProcessedLinkedCode = null; foreach (var bet in bets.GetData().OrderBy(b => b.LinkedCode)) { if (string.IsNullOrWhiteSpace(bet.LinkedCode) || (bet.LinkedCode != lastProcessedLinkedCode)) { UserBetDTO viewBet = new UserBetDTO(); viewBet.ID = bet.ID; viewBet.Amount = bet.Amount; viewBet.Simple = string.IsNullOrWhiteSpace(bet.LinkedCode); viewBet.Composed = !viewBet.Simple; if (viewBet.Simple) { viewBet.OddType = bet.SportBet.Code; viewBet.OddCode = bet.BetType; viewBet.Price = bet.BetPrice; var match = mgrEvent.GetSportEvent(bet.MatchCode); MatchDTO thisEvent = new MatchDTO(); thisEvent.ID = match.ID; thisEvent.Code = match.Code; thisEvent.Name = match.Name; thisEvent.Local = match.Home; thisEvent.Visitante = match.Away; thisEvent.Date = match.Init.ToString("dd MMM"); thisEvent.Time = match.Init.ToString("hh:mm"); viewBet.Match = thisEvent; } else { viewBet.Price = 1; lastProcessedLinkedCode = bet.LinkedCode; viewBet.BetInfo = new List <BetInfoItemDTO>(); foreach (var linkedBet in bets.GetData().Where(b => b.LinkedCode == bet.LinkedCode)) { viewBet.Price = viewBet.Price * linkedBet.BetPrice; var match = mgrEvent.GetSportEvent(linkedBet.MatchCode); BetDetailDTO betDetail = new BetDetailDTO(); betDetail.OddType = linkedBet.SportBet.Code; betDetail.OddCode = linkedBet.BetType; MatchDTO matchDetail = new MatchDTO(); matchDetail.ID = match.ID; matchDetail.Code = match.Code; matchDetail.Name = match.Name; matchDetail.Local = match.Home; matchDetail.Visitante = match.Away; matchDetail.Date = match.Init.ToString("dd MMM"); matchDetail.Time = match.Init.ToString("hh:mm"); BetInfoItemDTO betInfoItem = new BetInfoItemDTO(); betInfoItem.BetDetail = betDetail; betInfoItem.Match = matchDetail; viewBet.BetInfo.Add(betInfoItem); } } betList.Add(viewBet); } } return(this.GetView(betList)); } return(this.GetView("OperationFails")); }