|
@@ -231,6 +231,7 @@ class merchant_orderControl extends mbMerchantControl
|
|
|
|
|
|
$cond['mchid'] = $this->mchid();
|
|
|
$cond['inner_status'] = 0;
|
|
|
+ $fSingle = false;
|
|
|
if (!empty($_GET['card_type'])) {
|
|
|
if(in_array($_GET['card_type'] , ['1' , '2' , '4' , '5' , '6'])) {
|
|
|
$cond['refill_order.card_type'] = $_GET['card_type'];
|
|
@@ -243,49 +244,81 @@ class merchant_orderControl extends mbMerchantControl
|
|
|
}
|
|
|
}
|
|
|
if (!empty($_GET['card_no'])) {
|
|
|
+ $fSingle = true;
|
|
|
$cond['refill_order.card_no'] = $_GET['card_no'];
|
|
|
}
|
|
|
if (!empty($_GET['refill_amount'])) {
|
|
|
$cond['refill_order.refill_amount'] = $_GET['refill_amount'];
|
|
|
}
|
|
|
if (!empty($_GET['mch_order'])) {
|
|
|
+ $fSingle = true;
|
|
|
$cond['refill_order.mch_order'] = $_GET['mch_order'];
|
|
|
}
|
|
|
if (!empty($_GET['order_sn'])) {
|
|
|
+ $fSingle = true;
|
|
|
$cond['refill_order.order_sn'] = $_GET['order_sn'];
|
|
|
}
|
|
|
if (!empty($_GET['quality'])) {
|
|
|
$cond['refill_order.quality'] = $_GET['quality'];
|
|
|
}
|
|
|
+ $start = time() - 3600;
|
|
|
+ $cond['refill_order.order_time'] = ['egt', $start];
|
|
|
|
|
|
- $start_unixtime = intval($_GET['start_time']);
|
|
|
- $end_unixtime = intval($_GET['end_time']);
|
|
|
+ if ($fSingle) {
|
|
|
+ $start_unixtime = intval($_GET['start_time']);
|
|
|
+ $end_unixtime = intval($_GET['end_time']);
|
|
|
|
|
|
- if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
|
|
|
- $cond['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
|
|
|
- } elseif ($start_unixtime > 0) {
|
|
|
- $cond['refill_order.order_time'] = ['egt', $start_unixtime];
|
|
|
- } elseif ($end_unixtime > 0) {
|
|
|
- $cond['refill_order.order_time'] = ['lt', $end_unixtime];
|
|
|
- } else {
|
|
|
- $start = strtotime(date('Y-m-d', time()));
|
|
|
- $cond['refill_order.order_time'] = ['egt', $start];
|
|
|
- }
|
|
|
- if (in_array($_GET['order_state'], array('0', '30', '40'))) {
|
|
|
- $cond['vr_order.order_state'] = $_GET['order_state'];
|
|
|
- if($_GET['order_state'] == 30 && $_GET['time'] == 1){
|
|
|
- $cond['refill_order.order_time'] = ['lt', (time() - 3600)];
|
|
|
+ if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
|
|
|
+ $cond['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
|
|
|
+ } elseif ($start_unixtime > 0) {
|
|
|
+ $cond['refill_order.order_time'] = ['egt', $start_unixtime];
|
|
|
+ } elseif ($end_unixtime > 0) {
|
|
|
+ $cond['refill_order.order_time'] = ['lt', $end_unixtime];
|
|
|
+ } else {
|
|
|
+ $start = strtotime(date('Y-m-d', time()));
|
|
|
+ $cond['refill_order.order_time'] = ['egt', $start];
|
|
|
+ }
|
|
|
+ if (in_array($_GET['order_state'], array('0', '30', '40'))) {
|
|
|
+ $cond['vr_order.order_state'] = $_GET['order_state'];
|
|
|
+ if($_GET['order_state'] == 30 && $_GET['time'] == 1){
|
|
|
+ $cond['refill_order.order_time'] = ['lt', (time() - 3600)];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $fields = 'refill_order.*,vr_order.order_state';
|
|
|
- $order_list = $model_vr_order->getMerchantOrderList($cond, '10000', $fields, 'refill_order.order_id desc');
|
|
|
+ $order_list = $this->getAllOrders($cond);
|
|
|
$order_list = $this->merchant_order_format($order_list);
|
|
|
|
|
|
$result = $this->export_order_exec($order_list);
|
|
|
return self::outsuccess($result);
|
|
|
}
|
|
|
|
|
|
+ private function getAllOrders($condition): array
|
|
|
+ {
|
|
|
+ $len = 1000;
|
|
|
+
|
|
|
+ $i = 0;
|
|
|
+ $orders = [];
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ $start = $i * $len;
|
|
|
+ $items = Model('')->table('refill_order,vr_order')
|
|
|
+ ->field('refill_order.*,vr_order.order_state')
|
|
|
+ ->join('inner')
|
|
|
+ ->on('refill_order.order_id=vr_order.order_id')
|
|
|
+ ->where($condition)
|
|
|
+ ->order('refill_order.order_time desc')
|
|
|
+ ->limit("{$start},{$len}")
|
|
|
+ ->select();
|
|
|
+ $orders = array_merge($orders,$items);
|
|
|
+ if (empty($items) || count($items) < $len) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ return $orders;
|
|
|
+ }
|
|
|
+
|
|
|
private function export_order_exec($order_list)
|
|
|
{
|
|
|
$card_type = ['1'=>'中石油' , '2' =>'中石化' , '4' => '移动' , '5' => '联通' , '6' => '电信'];
|