|
|
@ -2046,11 +2046,26 @@ function getGameCpRadio($game_id,$amount,$type) {
|
|
|
|
if (!$type) {
|
|
|
|
if (!$type) {
|
|
|
|
$data = M('cp_game_ratio','tab_')->where(['game_id'=>$game_id])->find();
|
|
|
|
$data = M('cp_game_ratio','tab_')->where(['game_id'=>$game_id])->find();
|
|
|
|
} else {
|
|
|
|
} 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;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|