|
@@ -13,23 +13,10 @@ class orderstatsControl extends SystemControl
|
|
|
$type = $_GET['type'] ?? 'system';
|
|
|
$page = "{$type}.order.stats";
|
|
|
$model_refill_order = Model('refill_order');
|
|
|
+ $condition = $this->orderstats_cond($_GET);
|
|
|
$condition['type'] = $type;
|
|
|
- if (!empty($_GET['cid'])) {
|
|
|
- $condition['cid'] = ['in', $_GET['cid']];
|
|
|
- }
|
|
|
- if (!empty($_GET['order_time_type'])) {
|
|
|
- $condition['order_time_type'] = $_GET['order_time_type'];
|
|
|
- }
|
|
|
- $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['time_stamp'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
|
|
|
- } elseif ($start_unixtime > 0) {
|
|
|
- $condition['time_stamp'] = ['egt', $start_unixtime];
|
|
|
- } elseif ($end_unixtime > 0) {
|
|
|
- $condition['time_stamp'] = ['lt', $end_unixtime];
|
|
|
- }
|
|
|
-
|
|
|
+ $time_cond = \refill\rquery::custom_time_cond($_GET, 'time_stamp');
|
|
|
+ $condition = array_merge($condition, $time_cond);
|
|
|
$stats_list = $model_refill_order->getOrderStatsList($condition, 50, '*', 'time_stamp desc, cname asc');
|
|
|
if($type == 'merchant') {
|
|
|
foreach ($stats_list as $key => $stats) {
|
|
@@ -53,23 +40,10 @@ class orderstatsControl extends SystemControl
|
|
|
public function ExportDataOp()
|
|
|
{
|
|
|
$type = $_GET['type'] ?? 'system';
|
|
|
- $model_refill_order = Model('refill_order');
|
|
|
+ $condition = $this->orderstats_cond($_GET);
|
|
|
$condition['type'] = $type;
|
|
|
- if (!empty($_GET['cid'])) {
|
|
|
- $condition['cid'] = ['in', $_GET['cid']];
|
|
|
- }
|
|
|
- if (!empty($_GET['order_time_type'])) {
|
|
|
- $condition['order_time_type'] = $_GET['order_time_type'];
|
|
|
- }
|
|
|
- $start_unixtime = intval($_GET['query_start_time']);
|
|
|
- $end_unixtime = intval($_GET['query_end_time']);
|
|
|
- if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
|
|
|
- $condition['time_stamp'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
|
|
|
- } elseif ($start_unixtime > 0) {
|
|
|
- $condition['time_stamp'] = ['egt', $start_unixtime];
|
|
|
- } elseif ($end_unixtime > 0) {
|
|
|
- $condition['time_stamp'] = ['lt', $end_unixtime];
|
|
|
- }
|
|
|
+ $time_cond = \refill\rquery::custom_time_cond($_GET, 'time_stamp');
|
|
|
+ $condition = array_merge($condition, $time_cond);
|
|
|
$stats_list = $this->all_orderstats_data($condition);
|
|
|
|
|
|
$total_stats = $this->stats($condition);
|
|
@@ -120,4 +94,16 @@ class orderstatsControl extends SystemControl
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
+
|
|
|
+ private function orderstats_cond($input): array
|
|
|
+ {
|
|
|
+ $cond = [];
|
|
|
+ if (!empty($input['cid'])) {
|
|
|
+ $cond['cid'] = ['in', $input['cid']];
|
|
|
+ }
|
|
|
+ if (!empty($input['order_time_type'])) {
|
|
|
+ $cond['order_time_type'] = $input['order_time_type'];
|
|
|
+ }
|
|
|
+ return $cond;
|
|
|
+ }
|
|
|
}
|