1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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(!empty($_GET['card_nos'])) {
- $condition['refill_order.inner_status'] = 0;
- $card_nos = $_GET['card_nos'];
- $card_nos = str_replace(["\r\n", "\r", "\n"], ",", $card_nos);
- $condition['refill_order.card_no'] = ['in', $card_nos];
- $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, 50, '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'];
- $order_list[$order_id]['diff_time_text'] = $this->elapse_time(time() - $order_info['order_time']);
- $order_list[$order_id]['diff_time'] = time() - $order_info['order_time'];
- $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'],$order_info['card_type']);
- }
- }
- Tpl::output('order_list', $order_list);
- Tpl::output('show_page', $model_refill_order->showpage());
- Tpl::showpage('refill.order.search');
- }
- }
|