order_search.php 3.1 KB

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