diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 5166439c8..cb40bab46 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -955,6 +955,13 @@ class BeforehandOrderLogic extends BaseLogic public static function statisticsCount($params) { $where = []; + $where2 = []; + if($params['store_id']>0){ + $where2[] = ['store_id', '=', $params['store_id']]; + } + if($params['start_time']!=''&& $params['end_time']!=''){ + $where2[] = ['create_time', 'between', [strtotime($params['start_time']), strtotime($params['end_time'])]]; + } if ($params['warehouse_type'] > 0) { switch ($params['warehouse_type']) { case 1: @@ -975,30 +982,31 @@ class BeforehandOrderLogic extends BaseLogic } } $orderCounts = BeforehandOrder::where('order_type', 'in', [1, 2, 3, 4, 5, 7, 8]) + ->where($where2) ->group('order_type') - ->where(['order_type', Db::raw('count(*) as count')]) - ->column('count', 'order_type'); - d($orderCounts); - $order_type_1 = BeforehandOrder::where([['order_type', '=', 1]])->count(); - $order_type_2 = BeforehandOrder::where([['order_type', '=', 2]])->count(); - $order_type_3 = BeforehandOrder::where([['order_type', '=', 3]])->count(); - $order_type_4 = BeforehandOrder::where([['order_type', '=', 4]])->count(); - $order_type_5 = BeforehandOrder::where([['order_type', '=', 5]])->count(); - $order_type_7 = BeforehandOrder::where([['order_type', '=', 7]])->count(); - $order_type_8 = BeforehandOrder::where([['order_type', '=', 8]])->count(); - - - - $outbound_0 = BeforehandOrder::where([['is_outbound', '=', 0], ['order_type', '<>', 5]])->count(); - $outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->count(); - $warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->count(); - $warehousing_1 = BeforehandOrder::where([['is_warehousing', '=', 1]])->count(); - - return [ - 'outbound_0' => $outbound_0, - 'outbound_1' => $outbound_1, - 'warehousing_0' => $warehousing_0, - 'warehousing_1' => $warehousing_1, + ->field([Db::raw('count(*) as count'),'order_type'])->select(); + $outbound_0 = BeforehandOrder::where([['is_outbound', '=', 0], ['order_type', '<>', 5]])->where($where2)->count(); + $outbound_1 = BeforehandOrder::where([['is_outbound', '=', 1]])->where($where2)->count(); + $warehousing_0 = BeforehandOrder::where([['is_warehousing', '=', 0]])->where($where2)->count(); + $warehousing_1 = BeforehandOrder::where([['is_warehousing', '=', 1]])->where($where2)->count(); + $data=[ + 'order_type_1' =>0, + 'order_type_2'=>0, + 'order_type_3'=>0, + 'order_type_4'=>0, + 'order_type_5'=>0, + 'order_type_7'=>0, + 'order_type_8'=>0 ]; + foreach ($orderCounts as $k => $v) { + $data['order_type'.'_'.$v['order_type']] =$v['count'] ; + } + $data['outbound_0'] = $outbound_0; + $data['outbound_1'] = $outbound_1; + $data['warehousing_0'] = $warehousing_0; + $data['warehousing_1'] = $warehousing_1; + + + return $data; } } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 5e335f720..dd60215b9 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -652,7 +652,8 @@ class PayNotifyLogic extends BaseLogic if ($order['uid'] != 1) { Redis::send('order_wetcha_push_send', ['order' => $order]); } - if($order['store_id']==21){ + $xprinter=DictData::where('type_value','xprinter')->where('name','xprinter_'.$order['store_id'])->where('status',1)->find(); + if($xprinter){ Redis::send('order_xprinter_push_send', ['order' => $order]); } } catch (\Exception $e) {