Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function prepareStepOne($_b, $_f){
- $BET_TYPES = array('HANDICAP', 'TOTALS', 'TEAM_TOTALS', 'TEAM_GOALS', 'HALF_TOTALS', 'HALF_HANDICAP', 'WIN', "HALF_WIN");
- $BET_TYPES2 = array('HANDICAP'=>1, 'TOTALS'=>2, 'TEAM_TOTALS'=>2, 'TEAM_GOALS'=>2, 'HALF_TOTALS'=>2, 'HALF_HANDICAP'=>1, 'WIN'=>3, "HALF_WIN"=>3);
- 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){
- die(__("ERROR: prepareStepOne(): cant find bet_type '%s'", $_b['bet_type']));
- }
- $_out = array(
- 'bet_result' => (intval($_b['bet_result']) == 1 ? 1.0 : 0.0),
- 'bet_id' => $_b['id'],
- 'cf' => $_b['cf'],
- 'cf2' => __("%.6f", 1/floatval($_b['cf'])),
- 'cf3' => __("%.6f", 1/floatval($_b['cf']) - floatval($_b['margin2'])/2/100),
- 'fork_income' => $_b['fork_income'],
- 'overw_v3' => floatval($_b['fork_income'])+floatval($_b['margin2'])/2,
- 'bet_type' => $_bet_type,
- 'bet_type2' => $_bet_type2,
- 'bet_type3' => 0,
- 'time_wday' => intval(date('w', $_b['added_at_uts'])),
- 'time_hour' => intval(date('H', $_b['added_at_uts'])) + intval(date('i', $_b['added_at_uts']))/100,
- 'time_intraday' => __("%.6f", (intval(date('H', $_b['added_at_uts']))*60 + intval(date('i', $_b['added_at_uts'])))/(60*24)),
- 'margin1' => $_b['margin1'],
- 'margin2' => $_b['margin2'],
- 'limits_indicator' => $_b['limits_indicator'],
- 'in_event_count' => $_b['in_event_count'],
- 'added_at_diff' => intval($_b['added_at_uts'])-intval($_f['added_at_uts'])-15,
- 'master_is_initiator' => $_f['master_is_initiator'],
- 'slave_is_initiator' => $_f['slave_is_initiator'],
- 'master_forks_count' => $_f['master_is_initiator'],
- 'slave_forks_count' => $_f['slave_forks_count'],
- 'score_goals_total' => -1,
- 'score_goals_diff' => -1,
- 'score_match_min' => -1,
- 'score_match_period' => 1,
- #'added_at' => $_b['added_at']
- );
- if(preg_match("!^([0-9]+):([0-9]+)( |$)(\(([0-9]+):([0-9]+)\))?!", $_b['game_score'], $_sc)){
- #print_r($_sc); exit;
- $_out['score_goals_total'] = $_sc[1]+$_sc[2];
- $_out['score_goals_diff'] = abs($_sc[1]-$_sc[2]);
- if(isset($_sc[4]) and $_sc[4] != ''){
- #var_dump($_sc);
- $_out['score_match_period'] = 2;
- }
- }
- if(preg_match("! ([0-9]{1,2}):([0-5][0-9])$!", $_b['game_score'], $_sc)){
- #print_r($_sc); exit;
- $_out['score_match_min'] = $_sc[1]+1;
- }
- #$_out['game_score'] = $_b['game_score'];
- $_BET_TYPES2 = array(
- '__GOALS__YES' => 2,
- '__GOALS__NO' => 1,
- 'HANDICAP__P[12]\(\-' => 2,
- 'HANDICAP__P[12]\(0' => 3,
- 'HANDICAP__P[12]\([0-9]' => 1,
- '__UNDER' => 1,
- '__OVER' => 2
- );
- foreach($_BET_TYPES2 as $_rg => $_v){
- if(preg_match("!$_rg!", $_b['bet_name'])){
- $_out['bet_type3'] = $_v;
- break;
- }
- }
- #$_out['___'] = $_b['bet_name'];
- #print_r($_b); print_r($_f); print_r($_out); exit;
- $_result = array();
- $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");
- foreach($keys as $k){
- $_result[] = $_out[$k];
- }
- return $_result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement