合计区分类型

master
sunke 5 years ago
parent 462fe4b4eb
commit b3ac26ba80

@ -2503,9 +2503,12 @@ class DownloadController extends BaseController {
->order('id desc')
->select();
$total = [];
$total = $model->field('sum(pay_amount) as pay_amount,pay_way,sum(if(selle_ratio >= 0,selle_ratio * pay_amount,0)) as income')
->where($map)
->find();
$total = $model->field('sum(pay_amount) as pay_amount,sum(if(pay_way > -1,pay_amount,0)) as direct_pay_amount,sum(if(pay_way = -1,pay_amount,0)) as inner_pay_amount,sum(if(selle_ratio >= 0,selle_ratio * pay_amount,0)) as income')
->where($map)
->find();
$total['direct_pay_amount'] = empty($total['direct_pay_amount']) ? '0.00' : $total['direct_pay_amount'];
$total['inner_pay_amount'] = empty($total['inner_pay_amount']) ? '0.00' : $total['inner_pay_amount'];
$total['income'] = empty($total['income']) ? 0 : $total['income'];
$total['income'] = bcdiv($total['income'], 100, 2);
//提现状态
$withdrawIds = [];
@ -2558,13 +2561,8 @@ class DownloadController extends BaseController {
$allData['user_account'] = '--';
$allData['promote_account'] = '--';
$allData['pay_amount'] = $total['pay_amount'];
if($total['pay_way'] == -1) {
$allData['pay_amount_zhi'] = '0.00';
$allData['pay_amount_nei'] = $total['pay_amount'];
}else {
$allData['pay_amount_zhi'] = $total['pay_amount'];
$allData['pay_amount_nei'] = '0.00';
}
$allData['pay_amount_zhi'] = $total['direct_pay_amount'];
$allData['pay_amount_nei'] = $total['inner_pay_amount'];
$allData['selle_ratio'] = '--';
$allData['selle_ratio'] = '--';
$allData['income'] = $total['income'];

Loading…
Cancel
Save