|
|
@ -372,21 +372,31 @@ class PromoteRepository {
|
|
|
|
$params['time_column'] = 'pay_time';
|
|
|
|
$params['time_column'] = 'pay_time';
|
|
|
|
$map = $this->getPublicAchievementMap($ids, $params);
|
|
|
|
$map = $this->getPublicAchievementMap($ids, $params);
|
|
|
|
$items = M('spend', 'tab_')->field(['sum(pay_amount) amount', 'promote_id', 'pay_way'])->where($map)->group('promote_id, pay_way')->select();
|
|
|
|
$items = M('spend', 'tab_')->field(['sum(pay_amount) amount', 'promote_id', 'pay_way'])->where($map)->group('promote_id, pay_way')->select();
|
|
|
|
|
|
|
|
// echo M()->getLastSql();die();
|
|
|
|
$records = [];
|
|
|
|
$records = [];
|
|
|
|
foreach ($items as $item) {
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
|
|
|
$promoteId = $item['promote_id'];
|
|
|
|
|
|
|
|
if (isset($params['basicPromotes'][$promoteId])) {
|
|
|
|
|
|
|
|
$promoteId = $params['basicPromotes'][$promoteId];
|
|
|
|
|
|
|
|
}
|
|
|
|
if ($item['pay_way'] == -1) {
|
|
|
|
if ($item['pay_way'] == -1) {
|
|
|
|
$records[$item['promote_id']]['ban_coin'] = $item['amount'];
|
|
|
|
if (isset($records[$promoteId]) && isset($records[$promoteId]['ban_coin'])) {
|
|
|
|
|
|
|
|
$records[$promoteId]['ban_coin'] += $item['amount'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$records[$promoteId]['ban_coin'] = $item['amount'];
|
|
|
|
|
|
|
|
}
|
|
|
|
} elseif ($item['pay_way'] == 0) {
|
|
|
|
} elseif ($item['pay_way'] == 0) {
|
|
|
|
$records[$item['promote_id']]['coin'] = $item['amount'];
|
|
|
|
if (isset($records[$promoteId]) && isset($records[$promoteId]['coin'])) {
|
|
|
|
|
|
|
|
$records[$promoteId]['coin'] += $item['amount'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$records[$promoteId]['coin'] = $item['amount'];
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (isset($records[$item['promote_id']])) {
|
|
|
|
if (isset($records[$promoteId]) && isset($records[$promoteId]['cash'])) {
|
|
|
|
$records[$item['promote_id']]['cash'] = isset($records[$item['promote_id']]['cash']) ?
|
|
|
|
$records[$promoteId]['cash'] = $item['amount'];
|
|
|
|
$records[$item['promote_id']]['cash'] + $item['amount'] :
|
|
|
|
|
|
|
|
$item['amount'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$records[$item['promote_id']]['cash'] = $item['amount'];
|
|
|
|
$records[$promoteId]['cash'] = $item['amount'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
foreach ($ids as $id) {
|
|
|
|