|
|
@ -139,14 +139,14 @@ class QueryController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($settlementType == 3) {
|
|
|
|
if ($settlementType != 3) {
|
|
|
|
$totalField = 'sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount';
|
|
|
|
$totalField = 'sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount';
|
|
|
|
$zTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//累计
|
|
|
|
$zTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//累计
|
|
|
|
|
|
|
|
$zTotal = bcdiv($zTotal, 100 ,2);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$totalField = 'sum(tab_spend.pay_amount) as sum_amount';
|
|
|
|
$totalField = 'sum(tab_spend.pay_amount) as sum_amount';
|
|
|
|
$zTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['sum_amount']);//累计
|
|
|
|
$zTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['sum_amount']);//累计
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$zTotal = bcdiv($zTotal, 100 ,2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(I('export', 0) == 1) {
|
|
|
|
if(I('export', 0) == 1) {
|
|
|
|
$data = [];
|
|
|
|
$data = [];
|
|
|
@ -1354,6 +1354,7 @@ class QueryController extends ThinkController
|
|
|
|
'settlement_time' => "{$list['begin_time']} - {$list['end_time']}",
|
|
|
|
'settlement_time' => "{$list['begin_time']} - {$list['end_time']}",
|
|
|
|
'game_name' => $gameName ?? '未知',
|
|
|
|
'game_name' => $gameName ?? '未知',
|
|
|
|
'sum_amount' => $list['sum_amount'],
|
|
|
|
'sum_amount' => $list['sum_amount'],
|
|
|
|
|
|
|
|
'default_ratio' => $list['default_ratio'] ? $list['default_ratio'] . '%' : '未知',
|
|
|
|
'ratio' => $list['selle_ratio'] . '%',
|
|
|
|
'ratio' => $list['selle_ratio'] . '%',
|
|
|
|
'settlement_amount' => bcdiv(bcmul($list['sum_amount'], $list['selle_ratio'], 2), 100, 2),
|
|
|
|
'settlement_amount' => bcdiv(bcmul($list['sum_amount'], $list['selle_ratio'], 2), 100, 2),
|
|
|
|
];
|
|
|
|
];
|
|
|
@ -1361,6 +1362,7 @@ class QueryController extends ThinkController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign('settlementType', $withdraw['settlement_type']);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1562,26 +1564,30 @@ class QueryController extends ThinkController
|
|
|
|
$this->ajaxReturn(['settlement_type' => $settlementType]);
|
|
|
|
$this->ajaxReturn(['settlement_type' => $settlementType]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getRecoupAmount()
|
|
|
|
public function getAmountBySettlementType()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$withdrawModel = new WithdrawModel();
|
|
|
|
$withdrawModel = new WithdrawModel();
|
|
|
|
$promoteId = intval(I('promote_id', 0));
|
|
|
|
$promoteId = intval(I('promote_id', 0));
|
|
|
|
$settlementType = intval(I('settlement_type', 0));
|
|
|
|
$settlementType = intval(I('settlement_type', 0));
|
|
|
|
$time = I('time', '');
|
|
|
|
$time = I('time', '');
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($promoteId) || $settlementType != 3) {
|
|
|
|
if (empty($promoteId) || !in_array($settlementType, [2, 3])) {
|
|
|
|
$this->ajaxReturn(['balance' => 0]);
|
|
|
|
$this->ajaxReturn(['balance' => 0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$promote = M('promote', 'tab_')->find($promoteId);
|
|
|
|
$promote = M('promote', 'tab_')->find($promoteId);
|
|
|
|
if (empty($promote) || $promote['level'] != 1 || $promote['ver_status'] != 1 || $promote['settlement_type'] != 1 || empty($time)) {
|
|
|
|
if (empty($promote) || $promote['level'] != 1 || $promote['ver_status'] != 1 || empty($time)) {
|
|
|
|
$this->ajaxReturn(['balance' => 0]);
|
|
|
|
$this->ajaxReturn(['balance' => 0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$data['begin_time'] = strtotime($time);
|
|
|
|
$data['begin_time'] = strtotime($time);
|
|
|
|
$data['end_time'] = strtotime('+1 month', $data['begin_time']) - 1;
|
|
|
|
$data['end_time'] = strtotime('+1 month', $data['begin_time']) - 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($settlementType == 2) {
|
|
|
|
|
|
|
|
$balance = $withdrawModel->getMonthAmount($promote, $data);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$balance = $withdrawModel->getRecoupAmount($promote, $data);
|
|
|
|
$balance = $withdrawModel->getRecoupAmount($promote, $data);
|
|
|
|
|
|
|
|
}
|
|
|
|
$this->ajaxReturn(['balance' => $balance]);
|
|
|
|
$this->ajaxReturn(['balance' => $balance]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|