From f5016bae10a67ced0abe17af75ea87127f767c2c Mon Sep 17 00:00:00 2001 From: qianhy Date: Thu, 30 Mar 2023 13:32:04 +0800 Subject: [PATCH] customer_stat plan sql k adjust --- api/controllers/plan/Customer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/controllers/plan/Customer.php b/api/controllers/plan/Customer.php index ec8f2cd7..ac5d3408 100644 --- a/api/controllers/plan/Customer.php +++ b/api/controllers/plan/Customer.php @@ -55,9 +55,9 @@ class Customer extends HD_Controller union all select 3 as group_id, concat(ct.name) as k, count(*) as v from lc_receiver_customers c left join lc_biz b on c.biz_id = b.id left join lc_sys_city ct on b.city_id = ct.city_id where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') group by k union all - select c.biz_id * 10 as group_id, concat('',b.biz_name,'') k, count(*) as v from lc_receiver_customers c left join lc_biz b on c.biz_id = b.id where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') group by group_id, k + select c.biz_id * 10 as group_id, if(c.biz_id,concat('',b.biz_name,''),'未分配门店') k, count(*) as v from lc_receiver_customers c left join lc_biz b on c.biz_id = b.id where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') group by group_id, k union all - select (c.biz_id * 10 + 1) as group_id, concat(' - ',b.biz_name,'-', u.uname) as k, count(*) as v from lc_receiver_customers c left join lc_biz b on c.biz_id = b.id left join lc_app_licheb_users u on c.admin_id = u.id where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') group by group_id,k + select (c.biz_id * 10 + 1) as group_id, if(c.admin_id,concat(' - ',b.biz_name,'-', u.uname), ' - 未分配') as k, count(*) as v from lc_receiver_customers c left join lc_biz b on c.biz_id = b.id left join lc_app_licheb_users u on c.admin_id = u.id where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') group by group_id,k union all select 10007 as group_id, '战败' as k, count(*) as v from lc_receiver_customers c where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') and c.status = 3 group by k union all @@ -81,7 +81,7 @@ class Customer extends HD_Controller union all select 10041 as group_id, concat(' - 未见客户的见面意向','-', t.name) as k, count(*) as v from lc_receiver_customers_tagdata td join lc_receiver_customers_tag t on td.t_id = t.id where t.tag_type = 2 and t.pid in (120) and td.c_id in (select id from lc_receiver_customers c where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') and c.status = 0) group by k union all - select 10050 as group_id, '到店客户的购车意向' as k, count(*) as v from lc_receiver_customers_tagdata td join lc_receiver_customers_tag t on td.t_id = t.id where t.tag_type = 2 and t.pid in (121) and td.c_id in (select id from lc_receiver_customers c where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') and c.status = 1) group by k + select 10050 as group_id, '到店客户的购车意向' as k, count(*) as v from lc_receiver_customers_tagdata td join lc_receiver_customers_tag t on td.t_id = t.id where t.tag_type = 2 and t.pid in (121) and td.c_id in (select id from lc_receiver_customers c where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') and c.status = 1) group by k union all select 10051 as group_id, concat(' - 到店客户的购车意向','-', t.name) as k, count(*) as v from lc_receiver_customers_tagdata td join lc_receiver_customers_tag t on td.t_id = t.id where t.tag_type = 2 and t.pid in (121) and td.c_id in (select id from lc_receiver_customers c where c.of_id = @of_id and c.of2_id = @of2_id and c.c_time >= UNIX_TIMESTAMP('@s_date') and c.status = 1) group by k union all