order_search.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. class order_searchControl extends SystemControl
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct();
  7. }
  8. public function indexOp()
  9. {
  10. $model_refill_order = Model('refill_order');
  11. $order_list = [];
  12. $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00");
  13. //批量查询,二者都有,以卡号为主
  14. if(!empty($_GET['card_nos'])) {
  15. $card_nos = trim($_GET['card_nos'], ',');
  16. $condition['refill_order.card_no'] = ['in', $card_nos];
  17. } elseif (!empty($_GET['mch_orders'])) {
  18. $mch_orders = rtrim($_GET['mch_orders'], ',');
  19. $condition['refill_order.mch_order'] = ['in', $mch_orders];
  20. } else {
  21. $condition = [];
  22. }
  23. if(!empty($condition)) {
  24. $condition['refill_order.inner_status'] = 0;
  25. $start_unixtime = intval(strtotime($_GET['query_start_time']));
  26. $end_unixtime = intval(strtotime($_GET['query_end_time']));
  27. if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
  28. $condition['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
  29. } elseif ($start_unixtime > 0) {
  30. $condition['refill_order.order_time'] = ['egt', $start_unixtime];
  31. } elseif ($end_unixtime > 0) {
  32. $condition['refill_order.order_time'] = ['lt', $end_unixtime];
  33. } else {
  34. $start = strtotime(date('Y-m-d', time()));
  35. $condition['refill_order.order_time'] = ['egt', $start];
  36. }
  37. $order_list = $model_refill_order->getMerchantOrderList($condition, 200, 'refill_order.*,vr_order.order_state', 'refill_order.channel_name DESC ');
  38. $merchant_list = Model('')->table('merchant')->limit(1000)->select();
  39. foreach ($merchant_list as $value) {
  40. $merchants[$value['mchid']] = $value;
  41. }
  42. foreach ($order_list as $order_id => $order_info) {
  43. $order_list[$order_id]['card_type_text'] = $this->scard_type($order_info['card_type']);
  44. $order_list[$order_id]['mch_name'] = $merchants[$order_info['mchid']]['company_name'];
  45. if ($order_info['notify_time'] > 0) {
  46. $diff_time = $order_info['notify_time'] - $order_info['order_time'];
  47. } else {
  48. $diff_time = time() - $order_info['order_time'];
  49. }
  50. $order_list[$order_id]['diff_time_text'] = $this->elapse_time($diff_time);
  51. $order_list[$order_id]['diff_time'] = $diff_time;
  52. $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'],$order_info['card_type']);
  53. }
  54. }
  55. Tpl::output('order_list', $order_list);
  56. Tpl::output('show_page', $model_refill_order->showpage());
  57. Tpl::showpage('refill.order.search');
  58. }
  59. }