diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php index 55a3a8b4f..256aa2211 100644 --- a/Application/Base/Repository/PromoteRepository.class.php +++ b/Application/Base/Repository/PromoteRepository.class.php @@ -372,21 +372,31 @@ class PromoteRepository { $params['time_column'] = 'pay_time'; $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(); + // echo M()->getLastSql();die(); $records = []; foreach ($items as $item) { + $promoteId = $item['promote_id']; + if (isset($params['basicPromotes'][$promoteId])) { + $promoteId = $params['basicPromotes'][$promoteId]; + } 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) { - $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 { - if (isset($records[$item['promote_id']])) { - $records[$item['promote_id']]['cash'] = isset($records[$item['promote_id']]['cash']) ? - $records[$item['promote_id']]['cash'] + $item['amount'] : - $item['amount']; + if (isset($records[$promoteId]) && isset($records[$promoteId]['cash'])) { + $records[$promoteId]['cash'] = $item['amount']; } else { - $records[$item['promote_id']]['cash'] = $item['amount']; + $records[$promoteId]['cash'] = $item['amount']; } - } } foreach ($ids as $id) {