|
@@ -23,7 +23,6 @@ class ordersendlistControl extends SystemControl
|
|
|
$period = 20;
|
|
|
$start_day = strtotime("-5 days",$cur_time);
|
|
|
|
|
|
- $stat_cond = [];
|
|
|
$data_cond = [];
|
|
|
|
|
|
if ($timeout_type > 0) {
|
|
@@ -70,46 +69,6 @@ class ordersendlistControl extends SystemControl
|
|
|
}
|
|
|
|
|
|
return [$data_cond,$card_type];
|
|
|
-
|
|
|
-
|
|
|
-// if ($_GET['time'] == 1) {
|
|
|
-// $condition['refill_order.order_time'] = ['between', [$cur_time - 3600, $cur_time - 1800]];
|
|
|
-// $condition['vr_order.add_time'] = ['between', [(time() - 3600), (time() - 1800)]];
|
|
|
-// }
|
|
|
-// if ($_GET['time'] == 2) {
|
|
|
-// $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// if ($_GET['time'] == 3) {
|
|
|
-// $condition = $mchid_filter(180, $condition);
|
|
|
-// $time_cond[] = ['lt', (time() - 180)];
|
|
|
-// $_GET['card_type'] = 'phone';
|
|
|
-// }
|
|
|
-// if ($_GET['time'] == 4) {
|
|
|
-// $condition = $mchid_filter(300, $condition);
|
|
|
-// $time_cond[] = ['lt', (time() - 300)];
|
|
|
-// $_GET['card_type'] = 'phone';
|
|
|
-// }
|
|
|
-// if ($_GET['time'] == 5) {
|
|
|
-// $condition = $mchid_filter(600, $condition);
|
|
|
-// $time_cond[] = ['lt', (time() - 600)];
|
|
|
-// $_GET['card_type'] = 'phone';
|
|
|
-// }
|
|
|
-// if ($_GET['time'] == 6) {
|
|
|
-// $condition = $mchid_filter(900, $condition);
|
|
|
-// $time_cond[] = ['lt', (time() - 900)];
|
|
|
-// $_GET['card_type'] = 'phone';
|
|
|
-// }
|
|
|
-// if ($_GET['time'] == 7) {
|
|
|
-// $condition = $mchid_filter(7200, $condition);
|
|
|
-// $time_cond[] = ['lt', (time() - 7200)];
|
|
|
-// $_GET['card_type'] = 'phone';
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// return [];
|
|
|
}
|
|
|
|
|
|
public function indexOp()
|
|
@@ -159,7 +118,7 @@ class ordersendlistControl extends SystemControl
|
|
|
->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
|
|
|
->where($cond)->find();
|
|
|
|
|
|
- $count = $this->refill_stats($cond, $time_cond);
|
|
|
+ $count = $this->refill_stats($cond, $timeout_type);
|
|
|
$merchant_list = $this->merchants();
|
|
|
|
|
|
if(!empty($order_list)) {
|
|
@@ -175,21 +134,44 @@ class ordersendlistControl extends SystemControl
|
|
|
Tpl::showpage('refill.order.send.index');
|
|
|
}
|
|
|
|
|
|
- private function refill_stats($condition, $times): array
|
|
|
+ private function refill_stats($cond, $timeout_type): array
|
|
|
{
|
|
|
- $stat_order = function ($condition) {
|
|
|
+ $result = [];
|
|
|
+ $cur_time = time();
|
|
|
+ $start_day = strtotime("-5 days",$cur_time);
|
|
|
+ $stat_default_cond = [
|
|
|
+ ['between', [$cur_time - 3600, $cur_time - 1800]],
|
|
|
+ [$start_day, $cur_time - 3600]
|
|
|
+ ];
|
|
|
+ $stat_order = function ($cond) {
|
|
|
$stat = Model('')->table('refill_order,vr_order')->join('inner')
|
|
|
->on('refill_order.order_id=vr_order.order_id')
|
|
|
->field('count(*) as order_count ')
|
|
|
- ->where($condition)->find();
|
|
|
+ ->where($cond)->find();
|
|
|
|
|
|
return $stat['order_count'];
|
|
|
};
|
|
|
- $result = [];
|
|
|
- $condition['order_state'] = ORDER_STATE_SEND;
|
|
|
- foreach ($times as $time) {
|
|
|
- $condition['refill_order.order_time'] = $time;
|
|
|
- $result[] = $stat_order($condition);
|
|
|
+
|
|
|
+ $timeouts = [3 => 180, 4 => 300, 5 => 600, 6 => 900, 7 => 7200];
|
|
|
+ $time_out = $timeouts[$timeout_type];
|
|
|
+ if(!empty($time_out)) {
|
|
|
+ $stat_default_cond[] = ['_multi' => true,
|
|
|
+ ['egt', $start_day],
|
|
|
+ ['lt', $cur_time - $time_out]];
|
|
|
+ }
|
|
|
+
|
|
|
+ unset($cond['vr_order.add_time&vr_order.add_time']);
|
|
|
+ unset($cond['refill_order.order_time&refill_order.order_time&refill_order.order_time']);
|
|
|
+ unset($cond['refill_order.order_time&refill_order.order_time']);
|
|
|
+ foreach ($stat_default_cond as $stat_cond) {
|
|
|
+ if(!empty($time_out)){
|
|
|
+ $cond['vr_order.add_time&vr_order.add_time'] = $stat_cond;
|
|
|
+ $cond['refill_order.order_time&refill_order.order_time'] = $stat_cond;
|
|
|
+ }else{
|
|
|
+ $cond['refill_order.order_time'] = $stat_cond;
|
|
|
+ $cond['vr_order.add_time'] = $stat_cond;
|
|
|
+ }
|
|
|
+ $result[] = $stat_order($cond);
|
|
|
}
|
|
|
return $result;
|
|
|
}
|