This commit is contained in:
lin fan
2024-11-04 17:27:34 +08:00
parent e346e8e84a
commit 34099e1292
+27 -65
View File
@@ -216,11 +216,11 @@ class Score extends Wxapp
$s_stime = strtotime($s_time);
$s_etime = strtotime($e_time);
$indicator = [
['name' => '拓客能力', 'max' => 100],
['name' => '跟进能力', 'max' => 1],
['name' => '邀约能力', 'max' => 100],
['name' => '成交能力', 'max' => 100],
['name' => '交付能力', 'max' => 1]
['name' => '拓客能力', 'max' => 10],
['name' => '跟进能力', 'max' => 10],
['name' => '邀约能力', 'max' => 10],
['name' => '成交能力', 'max' => 10],
['name' => '交付能力', 'max' => 10]
];
$series_value = [];
foreach ($indicator as $key => $value) {
@@ -228,11 +228,13 @@ class Score extends Wxapp
case 0:
$where = [
'status>=' => 0,
"biz_id in (biz_id in (select id from lc_biz where province_id =$province_id))" => null,
'of_id' => 3,
'c_time >=' => $s_stime,
'c_time <=' => $s_etime,
];
$max = $this->customers_model->count($where);
$where_max = $where;
$where_max["biz_id in (select id from lc_biz where province_id =$province_id)"] = null;
$max = $this->customers_model->count($where_max);
$max && $indicator[$key]['max'] = $max;
$where['biz_id'] = $this->biz_id;
$value = $this->customers_model->count($where);
@@ -241,41 +243,16 @@ class Score extends Wxapp
$where = [
'status>=' => 0,
"biz_id in (select id from lc_biz where province_id =$province_id)" => null,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"id in (select DISTINCT customer_id from lc_receiver_customer_oplogs where c_time>={$s_stime} and c_time>={$s_etime})" => null
];
$province_gj = $this->customers_model->count($where);
$max = $this->customers_model->count($where);
$where = [
'status>=' => 0,
'province_id' => $province_id,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"id in (select DISTINCT customer_id from lc_receiver_customer_oplogs where c_time>={$s_stime} and c_time>={$s_etime})" => null,
"biz_id" => $this->biz_id
];
$biz_gj = $this->customers_model->count($where);
$where = [
'status>=' => 0,
"biz_id in (select id from lc_biz where province_id =$province_id)" => null,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"status in (0,1)" => null
];
$province_total = $this->customers_model->count($where);
$where = [
'status>=' => 0,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"status in (0,1)" => null,
'biz_id' => $this->biz_id
];
$biz_total = $this->customers_model->count($where);
$province_total && $max = $province_gj / $province_total;
$value = 0;
if ($biz_total) {
$value = $biz_gj / $biz_total;
}
$value = $this->customers_model->count($where);
$max && $indicator[$key]['max'] = $max;
break;
case 2:
$where = [
@@ -284,7 +261,9 @@ class Score extends Wxapp
'dt_time >=' => $s_time,
'dt_time <=' => $e_time,
];
$max = $this->customers_model->count($where);
$where_max = $where;
$where_max["biz_id in (select id from lc_biz where province_id =$province_id)"] = null;
$max = $this->customers_model->count($where_max);
$max && $indicator[$key]['max'] = $max;
$where["biz_id"] = $this->biz_id;
$value = $this->customers_model->count($where);
@@ -292,47 +271,30 @@ class Score extends Wxapp
case 3:
$where = [
'status>=' => 0,
"biz_id in (select id from lc_biz where province_id =$province_id)" => null,
'c_time >=' => $s_stime,
'c_time <=' => $s_etime,
];
$max = $this->customers_model->count($where);
$where_max = $where;
$where_max["biz_id in (select id from lc_biz where province_id =$province_id)"] = null;
$max = $this->orders_model->count($where_max);
$max && $indicator[$key]['max'] = $max;
$sub_sql = "select id from lc_receiver_customers where province_id={$province_id} and biz_id={$this->biz_id} and c_time>={$s_stime} and c_time>={$s_etime}";
$where = [
'status>=' => 0,
"biz_id" => $this->biz_id,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"customer_id in ($sub_sql)" => null
];
$where["biz_id"] = $this->biz_id;
$value = $this->orders_model->count($where);
break;
case 4:
$sub_sql = "select id from lc_receiver_customers where province_id={$province_id} and c_time>={$s_stime} and c_time>={$s_etime}";
$where = [
'status>=' => 0,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"customer_id in ($sub_sql)" => null
'over_time >=' => $s_time,
'over_time <=' => $e_time,
];
$province_order = $this->orders_model->count($where);
$where['status'] = 3;
$province_jf = $this->orders_model->count($where);
$sub_sql = "select id from lc_receiver_customers where biz_id={$this->biz_id} and province_id={$province_id} and c_time>={$s_stime} and c_time>={$s_etime}";
$where = [
'status>=' => 0,
'c_time >=' => strtotime($s_time),
'c_time <=' => strtotime($e_time),
"customer_id in ($sub_sql)" => null
];
$biz_order = $this->orders_model->count($where);
$where['status'] = 3;
$biz_jf = $this->orders_model->count($where);
$province_order && $max = $province_jf / $province_order;
$where_max = $where;
$where_max["biz_id in (select id from lc_biz where province_id =$province_id)"] = null;
$max = $this->orders_model->count($where_max);
$max && $indicator[$key]['max'] = $max;
$value = $biz_order ? $biz_jf / $biz_order : 0;
$where['biz_id'] = $this->biz_id;
$value = $this->orders_model->count($where);
default:
break;
}
$series_value[] = $value;
}