From a25e5c02ffd131231d5283663ac0e22c4daa6308 Mon Sep 17 00:00:00 2001 From: denghy Date: Mon, 12 Aug 2019 14:27:34 +0800 Subject: [PATCH] counts --- app/Domains/Virtual/Services/OrderService.php | 2 +- tests/ExampleTest.php | 15 ++++++--------- tests/ProcChildTest.php | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 tests/ProcChildTest.php diff --git a/app/Domains/Virtual/Services/OrderService.php b/app/Domains/Virtual/Services/OrderService.php index 16e3600d..5fe45f9c 100644 --- a/app/Domains/Virtual/Services/OrderService.php +++ b/app/Domains/Virtual/Services/OrderService.php @@ -990,7 +990,7 @@ class OrderService extends Service foreach ($array as $card) { $data[$card['sim']] = [ 'sim' => $card['sim'], - 'counts' => $data[$card['sim']] ? $data[$card['sim']] + $card['counts'] : $card['counts'], + 'counts' => $data[$card['sim']] ? $data[$card['sim']]['counts'] + $card['counts'] : $card['counts'], 'type' => $node['type'], 'order_id' => $node['id'], 'company_id' => $node['company_id'], diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index e9355d89..55f68baa 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -1,14 +1,11 @@ select("call proc_child('No00000000768')"); +$conditions = [ + 'company_name' = '福建车媒通网络科技有限公司', + 'month' = '2016-01' +] -foreach ($res as $key => &$value) { - $value = (array) $value; -} - -$res = array_pluck($res, 'custom_no'); -dd(in_array('No00000003080', $res)); +$export = new CompanyReportExport($conditions); +$url = ExportService::store($export, $this->disk); diff --git a/tests/ProcChildTest.php b/tests/ProcChildTest.php new file mode 100644 index 00000000..e9355d89 --- /dev/null +++ b/tests/ProcChildTest.php @@ -0,0 +1,14 @@ +select("call proc_child('No00000000768')"); + +foreach ($res as $key => &$value) { + $value = (array) $value; +} + +$res = array_pluck($res, 'custom_no'); +dd(in_array('No00000003080', $res));