|
@@ -103,28 +103,27 @@ class handler
|
|
|
foreach ($items as $item)
|
|
|
{
|
|
|
$order_state = $item['order_state'];
|
|
|
- if(!array_key_exists($order_state,$result)) {
|
|
|
- $val = [];
|
|
|
- $val['order_count'] = $item['order_count'];
|
|
|
- $val['refill_amounts'] = ncPriceFormat($item['refill_amounts']);
|
|
|
- $val['channel_amounts'] = ncPriceFormat($item['channel_amounts']);
|
|
|
- $val['mch_amounts'] = ncPriceFormat($item['mch_amounts']);
|
|
|
-
|
|
|
- $result[$order_state] = $val;
|
|
|
- }
|
|
|
- else {
|
|
|
- $result[$order_state]['order_count'] += $item['order_count'];
|
|
|
- $result[$order_state]['refill_amounts'] += ncPriceFormat($item['refill_amounts']);
|
|
|
- $result[$order_state]['channel_amounts'] += ncPriceFormat($item['channel_amounts']);
|
|
|
- $result[$order_state]['mch_amounts'] += ncPriceFormat($item['mch_amounts']);
|
|
|
- }
|
|
|
+
|
|
|
+ $result[$order_state]['order_count'] += $item['order_count'];
|
|
|
+ $result[$order_state]['refill_amounts'] += ncPriceFormat($item['refill_amounts']);
|
|
|
+ $result[$order_state]['channel_amounts'] += ncPriceFormat($item['channel_amounts']);
|
|
|
+ $result[$order_state]['mch_amounts'] += ncPriceFormat($item['mch_amounts']);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $initor = function (&$records)
|
|
|
+ {
|
|
|
+ $order_states = [ORDER_STATE_CANCEL, ORDER_STATE_SEND, ORDER_STATE_SUCCESS];
|
|
|
+ foreach ($order_states as $state) {
|
|
|
+ $val = ['order_count' => 0, 'refill_amounts' => 0, 'channel_amounts' => 0, 'mch_amounts' => 0];
|
|
|
+ $records[$state] = $val;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$all_summer = function ($records)
|
|
|
{
|
|
|
$result = ['order_count' => 0, 'refill_amounts' => 0, 'channel_amounts' => 0, 'mch_amounts' => 0];
|
|
|
- foreach ($records as $order_state => $item) {
|
|
|
+ foreach ($records as $item) {
|
|
|
$result['order_count'] += $item['order_count'];
|
|
|
$result['refill_amounts'] += ncPriceFormat($item['refill_amounts']);
|
|
|
$result['channel_amounts'] += ncPriceFormat($item['channel_amounts']);
|
|
@@ -138,6 +137,7 @@ class handler
|
|
|
try
|
|
|
{
|
|
|
$records = [];
|
|
|
+ $initor($records);
|
|
|
$stats = $order_reader($normal_cond, $time_scope);
|
|
|
foreach ($stats as $items) {
|
|
|
$summer($items,$records);
|
|
@@ -158,7 +158,7 @@ class handler
|
|
|
|
|
|
public function refill_order_stat_ex_title($condition)
|
|
|
{
|
|
|
- return md5("refill_order_stat-".serialize($condition));
|
|
|
+ return md5("refill_order_stat_ex-".serialize($condition));
|
|
|
}
|
|
|
|
|
|
public function refill_order_export($cond)
|