最近互联网彩票被国家叫停进行整改了,整改后互联网公司获取利润肯定会降低,但是不得不说中国的互联网彩票销售需要进行整改了,虽然对行业是阵痛,但是能够更好的规范彩票市场,对整个市场都会起到积极的作用。前段时间在做互联网彩票时也遇到了一些问题,特别是足彩任选九的复试组合算法。
足彩标注投注玩法:从14场比赛中任意选择9场比赛,每场比赛选择1种比赛结果为1注,每场比赛最多可选3种结果,单注最高奖金500万元!标准投注时可选择1~8场比赛结果作为胆码,其它比赛场次结果作为拖码进行胆拖投注,单注最高奖金500万元!
足彩标准投注是只从14场比赛中选9场比赛,而我们提交给第三方接口的必须是标准投注方式,也就是每次提交投注都是只能选择九场进行提交,但是在大部分的互联网彩票投注站都允许超过9场比赛的一个投注方式,这里就是各个互联网投注终端自己做的一个循环提交的处理了,所以这个需要一个自己组合算法,下面是该算法的代码,用C#代码实现:
这是足彩类型
1 public class FootBallItem : PropertyChangedBase 2 { 3 #region Property 4 private string lotteryId; 5 /// <summary> 6 /// 彩种编号 7 /// </summary> 8 public string LotteryId 9 { 10 get { return lotteryId; } 11 set { lotteryId = value; } 12 } 13 14 private string endTime; 15 /// <summary> 16 /// 结束时间 17 /// </summary> 18 public string EndTime 19 { 20 get { return endTime; } 21 set { endTime = value; } 22 } 23 private string finalScore; 24 25 public string FinalScore 26 { 27 get { return finalScore; } 28 set { finalScore = value; } 29 } 30 31 private string guestName; 32 /// <summary> 33 /// 客场 34 /// </summary> 35 public string GuestName 36 { 37 get { return guestName; } 38 set { guestName = value; } 39 } 40 private string index; 41 /// <summary> 42 /// 序列 43 /// </summary> 44 public string Index 45 { 46 get { return index; } 47 set { index = value; } 48 } 49 50 private string leageName; 51 /// <summary> 52 /// 赛事 53 /// </summary> 54 public string LeageName 55 { 56 get { return leageName; } 57 set { leageName = value; } 58 } 59 60 private string masterName; 61 /// <summary> 62 /// 主场 63 /// </summary> 64 public string MasterName 65 { 66 get { return masterName; } 67 set { masterName = value; } 68 } 69 private string result; 70 71 public string Result 72 { 73 get { return result; } 74 set { result = value; } 75 } 76 private string resultDes; 77 78 public string ResultDes 79 { 80 get { return resultDes; } 81 set { resultDes = value; } 82 } 83 private string scoreAtHalf; 84 85 public string ScoreAtHalf 86 { 87 get { return scoreAtHalf; } 88 set { scoreAtHalf = value; } 89 } 90 private string secondHalfTheScore; 91 92 public string SecondHalfTheScore 93 { 94 get { return secondHalfTheScore; } 95 set { secondHalfTheScore = value; } 96 } 97 98 private string startTime; 99 /// <summary> 100 /// 开赛时间 101 /// </summary> 102 public string StartTime 103 { 104 get { return startTime; } 105 set { startTime = value; } 106 } 107 108 private bool _scoreThree; 109 /// <summary> 110 /// 全场赢或者客场进3个球及以上 111 /// </summary> 112 public bool ScoreThree 113 { 114 get { return _scoreThree; } 115 set 116 { 117 string strNum = LotteryId.Equals("302") ? "3+" : "3"; 118 if (value) 119 { 120 StrFootBallNumber += strNum; 121 nSelectedCount++; 122 } 123 else 124 { 125 nSelectedCount--; 126 if (StrFootBallNumber.Contains(strNum)) 127 { 128 StrFootBallNumber = StrFootBallNumber.Replace(strNum, null); 129 } 130 } 131 _scoreThree = value; 132 NotifyOfPropertyChange("ScoreThree"); 133 } 134 } 135 136 private bool _scoreTwo; 137 /// <summary> 138 /// 全场平或者客场进2个球 139 /// </summary> 140 public bool ScoreTwo 141 { 142 get { return _scoreTwo; } 143 set 144 { 145 string strNum = LotteryId.Equals("302") ? "2" : "1"; 146 if (value) 147 { 148 StrFootBallNumber += strNum; 149 nSelectedCount++; 150 } 151 else 152 { 153 nSelectedCount--; 154 if (StrFootBallNumber.Contains(strNum)) 155 { 156 StrFootBallNumber = StrFootBallNumber.Replace(strNum, null); 157 } 158 } 159 _scoreTwo = value; 160 NotifyOfPropertyChange("ScoreTwo"); 161 } 162 } 163 164 private bool _scoreOne; 165 /// <summary> 166 /// 全场负或者客场进1个球 167 /// </summary> 168 public bool ScoreOne 169 { 170 get { return _scoreOne; } 171 set 172 { 173 string strNum = LotteryId.Equals("302") ? "1" : "0"; 174 if (value) 175 { 176 StrFootBallNumber += strNum; 177 nSelectedCount++; 178 } 179 else 180 { 181 nSelectedCount--; 182 if (StrFootBallNumber.Contains(strNum)) 183 { 184 StrFootBallNumber = StrFootBallNumber.Replace(strNum, null); 185 } 186 } 187 _scoreOne = value; 188 NotifyOfPropertyChange("ScoreOne"); 189 } 190 } 191 192 private bool _scoreZero; 193 /// <summary> 194 /// 客场进0个球 195 /// </summary> 196 public bool ScoreZero 197 { 198 get { return _scoreZero; } 199 set 200 { 201 if (value) 202 { 203 StrFootBallNumber += "0"; 204 nSelectedCount++; 205 } 206 else 207 { 208 nSelectedCount--; 209 if (StrFootBallNumber.Contains("0")) 210 { 211 StrFootBallNumber = StrFootBallNumber.Replace("0", null); 212 } 213 } 214 _scoreZero = value; 215 NotifyOfPropertyChange("ScoreZero"); 216 } 217 } 218 219 private bool _scoreThreeHalf; 220 /// <summary> 221 /// 半场赢或者主场进3个球及以上 222 /// </summary> 223 public bool ScoreThreeHalf 224 { 225 get { return _scoreThreeHalf; } 226 set 227 { 228 string strNum = LotteryId.Equals("302") ? "3+" : "3"; 229 if (value) 230 { 231 strNumberHalf += strNum; 232 nSelectHalfCount++; 233 } 234 else 235 { 236 nSelectHalfCount--; 237 if (strNumberHalf.Contains(strNum)) 238 { 239 strNumberHalf = strNumberHalf.Replace(strNum, null); 240 } 241 } 242 _scoreThreeHalf = value; 243 NotifyOfPropertyChange("ScoreThreeHalf"); 244 } 245 } 246 247 private bool _scoreTwoHalf; 248 /// <summary> 249 /// 半场平或者主场2个球 250 /// </summary> 251 public bool ScoreTwoHalf 252 { 253 get { return _scoreTwoHalf; } 254 set 255 { 256 string strNum = LotteryId.Equals("302") ? "2" : "1"; 257 if (value) 258 { 259 nSelectHalfCount++; 260 strNumberHalf += strNum; 261 } 262 else 263 { 264 nSelectHalfCount--; 265 if (strNumberHalf.Contains(strNum)) 266 { 267 strNumberHalf = strNumberHalf.Replace(strNum, null); 268 } 269 } 270 _scoreTwoHalf = value; 271 NotifyOfPropertyChange("ScoreTwoHalf"); 272 } 273 } 274 275 private bool _scoreOneHalf; 276 /// <summary> 277 /// 半场负或者主场进1个球 278 /// </summary> 279 public bool ScoreOneHalf 280 { 281 get { return _scoreOneHalf; } 282 set 283 { 284 string strNum = LotteryId.Equals("302") ? "1" : "0"; 285 if (value) 286 { 287 nSelectHalfCount++; 288 strNumberHalf += strNum; 289 } 290 else 291 { 292 nSelectHalfCount--; 293 if (strNumberHalf.Contains(strNum)) 294 { 295 strNumberHalf = strNumberHalf.Replace(strNum, null); 296 } 297 } 298 _scoreOneHalf = value; 299 NotifyOfPropertyChange("ScoreOneHalf"); 300 } 301 } 302 303 private bool _scoreZeroHalf; 304 /// <summary> 305 /// 主场进0个球 306 /// </summary> 307 public bool ScoreZeroHalf 308 { 309 get { return _scoreZeroHalf; } 310 set 311 { 312 if (value) 313 { 314 nSelectHalfCount++; 315 strNumberHalf += "0"; 316 } 317 else 318 { 319 nSelectHalfCount--; 320 if (strNumberHalf.Contains("0")) 321 { 322 strNumberHalf = strNumberHalf.Replace("0", null); 323 } 324 } 325 _scoreZeroHalf = value; 326 NotifyOfPropertyChange("ScoreZeroHalf"); 327 } 328 } 329 330 private string strNumber = ""; 331 /// <summary> 332 /// 单场选择记录 333 /// </summary> 334 public string StrFootBallNumber 335 { 336 get { return strNumber; } 337 set { strNumber = value; } 338 } 339 340 private string strNumberHalf = ""; 341 /// <summary> 342 /// 半场选择记录 343 /// </summary> 344 public string StrFootBallNumberHalf 345 { 346 get { return strNumberHalf; } 347 set { strNumberHalf = value; } 348 } 349 350 private int nselectedcount; 351 /// <summary> 352 /// 全场已选择(胜、负、平)的数量 353 /// </summary> 354 public int nSelectedCount 355 { 356 get { return nselectedcount; } 357 set { nselectedcount = value; } 358 } 359 private int nselecthalfcount; 360 /// <summary> 361 /// 半场已选择(胜、负、平)的数量 362 /// </summary> 363 public int nSelectHalfCount 364 { 365 get { return nselecthalfcount; } 366 set { nselecthalfcount = value; } 367 } 368 #endregion 369 }