diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 6aebd9452..3eefa7b83 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -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; }