stats_805_3

This commit is contained in:
dengbw
2022-08-05 16:35:59 +08:00
parent 504cb7385a
commit 26e84ea01e
+10 -10
View File
@@ -30,8 +30,8 @@ class order extends HD_Controller
foreach ($bizs as $k => $v) {
$list = [];
foreach ($days as $k2 => $v2) {
$time = $this->getTime($k2);
$num = $this->mdOrders->count(['biz_id' => $k, 'status>=' => 0, 'bill_time>=' => $time['s_time'], 'bill_time<=' => $time['e_time']]);
$order_time = $this->getTime($k2);
$num = $this->mdOrders->count(['biz_id' => $k, 'status>=' => 0, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']]);
$list[$k2] = $num;
$days[$k2]['num'] = $v2['num'] + $num;
}
@@ -44,8 +44,8 @@ class order extends HD_Controller
foreach ($brands as $k2 => $v2) {
$stats_per = $stats = [];
foreach ($days as $k3 => $v3) {
$time = $this->getTime($k3);
$num = $this->mdOrders->count(['biz_id' => $k, 'brand_id' => $k2, 'status>=' => 0, 'bill_time>=' => $time['s_time'], 'bill_time<=' => $time['e_time']]);
$order_time = $this->getTime($k3);
$num = $this->mdOrders->count(['biz_id' => $k, 'brand_id' => $k2, 'status>=' => 0, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']]);
$stats_per[] = $this->getPercentage(['num' => $num, 'sum' => $v['list'][$k3]]);
$stats[] = $num;
}
@@ -63,11 +63,11 @@ class order extends HD_Controller
$stats_per_cus = $stats_cus = $stats_per_ord = $stats_ord = [];
foreach ($days as $k3 => $v3) {
$c_time = $this->getTime($k3, 1);
$bill_time = $this->getTime($k3);
$order_time = $this->getTime($k3);
$num_cus = $this->mdCustomers->count(['biz_id' => $k, 'of_id' => $k2, 'status>=' => 0, 'c_time>=' => $c_time['s_time'], 'c_time<=' => $c_time['e_time']]);
$num_ord = $this->mdOrders->count([
"customer_id in(select id from lc_receiver_customers where biz_id={$k} and of_id={$k2} and status>=0)" => null,
'biz_id' => $k, 'status>=' => 0, 'bill_time>=' => $bill_time['s_time'], 'bill_time<=' => $bill_time['e_time']]);
'biz_id' => $k, 'status>=' => 0, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']]);
$cus_sum[$k3] += $num_cus;
$ord_sum[$k3] += $num_ord;
$stats_cus[] = $num_cus;
@@ -79,8 +79,8 @@ class order extends HD_Controller
$ord_1[$k3] = $num_ord;
}
}
$list[] = ['name' => "{$v2['name']}转化率", 'type' => 1, 'stats_per' => $stats_per_cus, 'stats' => $stats_cus];
$list[] = ['name' => "{$v2['name']}订单占比", 'type' => 2, 'stats_per' => $stats_per_ord, 'stats' => $stats_ord];
$list[] = ['name' => "{$v2['name']}(转化率)", 'type' => 1, 'stats_per' => $stats_per_cus, 'stats' => $stats_cus];
$list[] = ['name' => "{$v2['name']}(订单占比)", 'type' => 2, 'stats_per' => $stats_per_ord, 'stats' => $stats_ord];
}
foreach ($days as $k3 => $v3) {
$ord = $ord_1[$k3] ? $ord_sum[$k3] - $ord_1[$k3] : $ord_sum[$k3];
@@ -112,10 +112,10 @@ class order extends HD_Controller
$into_sum[$k3] += $num_into;
$stats_per_into[$k3] = $num_into;
//成交数
$bill_time = $this->getTime($k3);
$order_time = $this->getTime($k3);
$num_ord = $this->mdOrders->count([
"customer_id in(select id from lc_receiver_customers where biz_id={$k} and of_id={$k2} and status>=0)" => null,
'biz_id' => $k, 'status>=' => 0, 'bill_time>=' => $bill_time['s_time'], 'bill_time<=' => $bill_time['e_time']]);
'biz_id' => $k, 'status>=' => 0, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']]);
$stats_ord[] = $num_ord;
$ord_sum[$k3] += $num_ord;
$stats_per_ord[$k3] = $num_ord;