12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- class order_searchControl extends SystemControl
- {
- public function __construct()
- {
- parent::__construct();
- }
- public function indexOp()
- {
- $model_refill_order = Model('refill_order');
- $order_list = [];
- $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00");
- if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40']))
- {
- $condition['vr_order.order_state'] = $_GET['order_state'];
- }
- if (!empty($_GET['mchid'])) {
- $condition['refill_order.mchid'] = $_GET['mchid'];
- }
- if (!empty($_GET['store_id'])) {
- $condition['vr_order.store_id'] = $_GET['store_id'];
- }
- //批量查询,二者都有,以卡号为主
- if(!empty($_GET['card_nos'])) {
- $card_nos = trim($_GET['card_nos'], ',');
- $condition['refill_order.card_no'] = ['in', $card_nos];
- } elseif (!empty($_GET['mch_orders'])) {
- $mch_orders = rtrim($_GET['mch_orders'], ',');
- $condition['refill_order.mch_order'] = ['in', $mch_orders];
- }
- if(!empty($_GET['order_sns'])) {
- $order_sns = trim($_GET['order_sns'], ',');
- $condition['refill_order.order_sn'] = ['in', $order_sns];
- }
- if(!empty($condition)) {
- $condition['refill_order.inner_status'] = 0;
- $start_unixtime = intval(strtotime($_GET['query_start_time']));
- $end_unixtime = intval(strtotime($_GET['query_end_time']));
- if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
- $condition['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
- } elseif ($start_unixtime > 0) {
- $condition['refill_order.order_time'] = ['egt', $start_unixtime];
- } elseif ($end_unixtime > 0) {
- $condition['refill_order.order_time'] = ['lt', $end_unixtime];
- } else {
- $start = strtotime(date('Y-m-d', time()));
- $condition['refill_order.order_time'] = ['egt', $start];
- }
- $order_list = $model_refill_order->getMerchantOrderList($condition, 200, 'refill_order.*,vr_order.order_state', 'refill_order.channel_name DESC ');
- $merchant_list = Model('')->table('merchant')->limit(1000)->select();
- foreach ($merchant_list as $value) {
- $merchants[$value['mchid']] = $value;
- }
- foreach ($order_list as $order_id => $order_info) {
- $order_list[$order_id]['card_type_text'] = $this->scard_type($order_info['card_type']);
- $order_list[$order_id]['mch_name'] = $merchants[$order_info['mchid']]['company_name'];
- if ($order_info['notify_time'] > 0) {
- $diff_time = $order_info['notify_time'] - $order_info['order_time'];
- } else {
- $diff_time = time() - $order_info['order_time'];
- }
- $order_list[$order_id]['diff_time_text'] = $this->elapse_time($diff_time);
- $order_list[$order_id]['diff_time'] = $diff_time;
- $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'],$order_info['card_type']);
- }
- }
- $merchant_list = $this->merchants();
- $provider_list = $this->providers();
- Tpl::output('provider_list', $provider_list);
- Tpl::output('merchant_list', $merchant_list);
- Tpl::output('order_list', $order_list);
- Tpl::output('show_page', $model_refill_order->showpage());
- Tpl::showpage('refill.order.search');
- }
- }
|