|
|
|
@ -2018,10 +2018,23 @@ function getWithdrawNumber() {
|
|
|
|
|
//上有流水计算
|
|
|
|
|
function caculateUpstream($game_id,$pay_amount) {
|
|
|
|
|
|
|
|
|
|
$data = M('cp_game_ratio','tab_')
|
|
|
|
|
$ladderData = M('cp_game_ratio','tab_')
|
|
|
|
|
->where(['game_id'=>$game_id,'begin_total_amount'=>['elt',$pay_amount],'is_del'=>0])
|
|
|
|
|
->order('begin_total_amount Desc')
|
|
|
|
|
->find();
|
|
|
|
|
->limit(0,2)
|
|
|
|
|
->order('begin_total_amount desc')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
foreach($ladderData as $key => $value) {
|
|
|
|
|
|
|
|
|
|
if ($value['instanceof'] == 1 && $value['begin_total_amount'] <= $pay_amount
|
|
|
|
|
|| $value['instanceof'] == 2 && $value['begin_total_amount'] != $pay_amount ) {
|
|
|
|
|
$data['ratio'] = $value['ratio'];
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
$data['ratio'] = $value['ratio'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return number_format($pay_amount*($data['ratio']/100),2,'.','');
|
|
|
|
|
|
|
|
|
|