Advertisement
viamvadens

Untitled

Dec 5th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1.  
  2. function prepareStepOne($_b, $_f){
  3. $BET_TYPES = array('HANDICAP', 'TOTALS', 'TEAM_TOTALS', 'TEAM_GOALS', 'HALF_TOTALS', 'HALF_HANDICAP', 'WIN', "HALF_WIN");
  4. $BET_TYPES2 = array('HANDICAP'=>1, 'TOTALS'=>2, 'TEAM_TOTALS'=>2, 'TEAM_GOALS'=>2, 'HALF_TOTALS'=>2, 'HALF_HANDICAP'=>1, 'WIN'=>3, "HALF_WIN"=>3);
  5. if(($_bet_type = array_search($_b['bet_type'], $BET_TYPES)) === false or !isset($BET_TYPES2[$_b['bet_type']]) or ($_bet_type2 = $BET_TYPES2[$_b['bet_type']]) === false){
  6. die(__("ERROR: prepareStepOne(): cant find bet_type '%s'", $_b['bet_type']));
  7. }
  8.  
  9.  
  10.  
  11. $_out = array(
  12. 'bet_result' => (intval($_b['bet_result']) == 1 ? 1.0 : 0.0),
  13. 'bet_id' => $_b['id'],
  14. 'cf' => $_b['cf'],
  15. 'cf2' => __("%.6f", 1/floatval($_b['cf'])),
  16. 'cf3' => __("%.6f", 1/floatval($_b['cf']) - floatval($_b['margin2'])/2/100),
  17. 'fork_income' => $_b['fork_income'],
  18. 'overw_v3' => floatval($_b['fork_income'])+floatval($_b['margin2'])/2,
  19. 'bet_type' => $_bet_type,
  20. 'bet_type2' => $_bet_type2,
  21. 'bet_type3' => 0,
  22. 'time_wday' => intval(date('w', $_b['added_at_uts'])),
  23. 'time_hour' => intval(date('H', $_b['added_at_uts'])) + intval(date('i', $_b['added_at_uts']))/100,
  24. 'time_intraday' => __("%.6f", (intval(date('H', $_b['added_at_uts']))*60 + intval(date('i', $_b['added_at_uts'])))/(60*24)),
  25. 'margin1' => $_b['margin1'],
  26. 'margin2' => $_b['margin2'],
  27. 'limits_indicator' => $_b['limits_indicator'],
  28. 'in_event_count' => $_b['in_event_count'],
  29. 'added_at_diff' => intval($_b['added_at_uts'])-intval($_f['added_at_uts'])-15,
  30. 'master_is_initiator' => $_f['master_is_initiator'],
  31. 'slave_is_initiator' => $_f['slave_is_initiator'],
  32. 'master_forks_count' => $_f['master_is_initiator'],
  33. 'slave_forks_count' => $_f['slave_forks_count'],
  34. 'score_goals_total' => -1,
  35. 'score_goals_diff' => -1,
  36. 'score_match_min' => -1,
  37. 'score_match_period' => 1,
  38. #'added_at' => $_b['added_at']
  39. );
  40. if(preg_match("!^([0-9]+):([0-9]+)( |$)(\(([0-9]+):([0-9]+)\))?!", $_b['game_score'], $_sc)){
  41. #print_r($_sc); exit;
  42. $_out['score_goals_total'] = $_sc[1]+$_sc[2];
  43. $_out['score_goals_diff'] = abs($_sc[1]-$_sc[2]);
  44. if(isset($_sc[4]) and $_sc[4] != ''){
  45. #var_dump($_sc);
  46. $_out['score_match_period'] = 2;
  47. }
  48. }
  49. if(preg_match("! ([0-9]{1,2}):([0-5][0-9])$!", $_b['game_score'], $_sc)){
  50. #print_r($_sc); exit;
  51. $_out['score_match_min'] = $_sc[1]+1;
  52. }
  53. #$_out['game_score'] = $_b['game_score'];
  54.  
  55. $_BET_TYPES2 = array(
  56. '__GOALS__YES' => 2,
  57. '__GOALS__NO' => 1,
  58. 'HANDICAP__P[12]\(\-' => 2,
  59. 'HANDICAP__P[12]\(0' => 3,
  60. 'HANDICAP__P[12]\([0-9]' => 1,
  61. '__UNDER' => 1,
  62. '__OVER' => 2
  63. );
  64. foreach($_BET_TYPES2 as $_rg => $_v){
  65. if(preg_match("!$_rg!", $_b['bet_name'])){
  66. $_out['bet_type3'] = $_v;
  67. break;
  68. }
  69. }
  70. #$_out['___'] = $_b['bet_name'];
  71.  
  72. #print_r($_b); print_r($_f); print_r($_out); exit;
  73. $_result = array();
  74. $keys = explode(",", "bet_result,bet_id,cf,cf2,cf3,fork_income,overw_v3,bet_type,bet_type2,bet_type3,time_wday,time_hour,time_intraday,margin1,margin2,limits_indicator,in_event_count,added_at_diff,master_is_initiator,slave_is_initiator,master_forks_count,slave_forks_count,score_goals_total,score_goals_diff,score_match_min,score_match_period");
  75. foreach($keys as $k){
  76. $_result[] = $_out[$k];
  77. }
  78. return $_result;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement