From 9e1c25a2a32a93495e4838c39a8b349534452278 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 19 Nov 2019 19:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/PromoteRepository.class.php | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) 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) {