cp分成比例方法修正

master
zyx 5 years ago
parent 4be5b1ba2c
commit f58f05d00d

@ -2046,11 +2046,26 @@ function getGameCpRadio($game_id,$amount,$type) {
if (!$type) {
$data = M('cp_game_ratio','tab_')->where(['game_id'=>$game_id])->find();
} else {
$data = M('cp_game_ratio','tab_')->where(['game_id'=>$game_id,'begin_total_amount'=>['elt',$amount]])->order('begin_total_amount desc')->find();
//取两条
$ladderData = M('cp_game_ratio','tab_')->where(['game_id'=>$game_id,'begin_total_amount'=>['elt',$amount]])->limit(0,2)->order('begin_total_amount desc')->select();
// dump($ladderData);die();
foreach($ladderData as $key => $value) {
if ($value['instanceof'] == 1 && $value['begin_total_amount'] <= $amount
|| $value['instanceof'] == 2 && $value['begin_total_amount'] != $amount ) {
$data['ratio'] = $value['ratio'];
break;
} else {
$data['ratio'] = $value['ratio'];
}
}
}
return $data['ratio'];
return $data['ratio']?$data['ratio']:0;
}

Loading…
Cancel
Save