251 lines
8.2 KiB
PHP
251 lines
8.2 KiB
PHP
<?php
|
|
/**
|
|
* Created by Vim
|
|
* User: lcc
|
|
* Date: 2021/06/29
|
|
* Time: 13:47
|
|
*/
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Receiver_customers_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_receiver_customers';
|
|
private $status_arr = [-1 => '删除', 0 => '未见客户', 1 => '到店客户', 2 => '订单客户', 3 => '战败客户'];
|
|
private $level = ['H', 'A', 'B', 'C'];
|
|
private $cfrom_arr = ['自有资源', '平台分配'];
|
|
private $cfrom_clues_arr = ['自然进店', '外展', 'DM', '转介绍', '其它', '网站', '外展外拓', '垂直媒体', '自媒体'];
|
|
private $buy_time = [3 => '3天(H级)', 7 => '7天(A级)', 15 => '15天(B级)'];
|
|
private $follow_channel = ['见面', '电话', '微信'];
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
/**
|
|
* Notes:根据id获取数据
|
|
* @param $ids array() id 数组
|
|
* @param string $fileds
|
|
* @return array
|
|
*/
|
|
public function get_map_by_ids($ids, $fileds = '')
|
|
{
|
|
$rows = [];
|
|
$ids = array_filter($ids);
|
|
if ($ids) {
|
|
$cf_ids = implode(',', $ids);
|
|
$where = [
|
|
"id in ($cf_ids)" => null
|
|
];
|
|
$rows = $this->map('id', '', $where, '', '', '', $fileds);
|
|
}
|
|
return $rows;
|
|
}
|
|
|
|
public function get_status()
|
|
{
|
|
return $this->status_arr;
|
|
}
|
|
|
|
public function get_sdata($type = 'cfrom')
|
|
{
|
|
switch ($type) {
|
|
case 'cfrom':
|
|
$result = $this->cfrom_arr;
|
|
break;
|
|
case 'cfrom_clues':
|
|
$result = $this->cfrom_clues_arr;
|
|
break;
|
|
case 'btime':
|
|
$result = $this->buy_time;
|
|
break;
|
|
case 'level':
|
|
$result = $this->level;
|
|
break;
|
|
case 'follow_channel':
|
|
$result = $this->follow_channel;
|
|
break;
|
|
default:
|
|
$result = '';
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Notes:线下来源
|
|
* Created on: 2022/3/4 16:54
|
|
* Created by: dengbw
|
|
* @param int $id
|
|
* @return mixed
|
|
*/
|
|
public function offlineSources_search($id = 0)
|
|
{
|
|
$arr[1] = ['name' => '自然到店', 'list' => []];
|
|
$arr[2] = ['name' => '转介绍', 'list' => [' 26' => '老车主', ' 20' => '其他4S店', ' 21' => '其他二网', ' 22' => '汽车美容', ' 23' => '二手车', ' 24' => '修车厂', ' 25' => '驾校', ' 27' => '亲朋好友']];
|
|
$arr[3] = ['name' => '门店垂媒', 'list' => [' 32' => '懂车帝', ' 33' => '易车', ' 34' => '汽车之家']];
|
|
$arr[4] = ['name' => '外展外拓', 'list' => [' 40' => '精准地推', ' 41' => '车展', ' 42' => '静展', ' 43' => '走进企业']];
|
|
$arr[5] = ['name' => '自媒体', 'list' => [' 50' => '小红书号', ' 51' => '咸鱼号', ' 52' => '抖音号', ' 53' => '狸车素材', ' 54' => '知乎号', ' 55' => '视频号']];
|
|
$arr[6] = ['name' => '网络推广', 'list' => [' 60' => '抖音本地通表单', ' 61' => '抖音本地通私信', ' 62' => '视频号', ' 63' => '本地投放(狸车分配)']];
|
|
$arr[7] = ['name' => '厂商分配', 'list' => [' 70' => '传统渠道', ' 71' => '垂媒-懂车帝', ' 72' => '垂媒-汽车之家', ' 73' => '垂媒-易车', ' 74' => '抖音-效果通', ' 75' => '抖音-本地推', ' 76' => '抖音-本地通', ' 77' => '直播活动']];
|
|
|
|
if ($id) {
|
|
return $arr[$id];
|
|
} else {
|
|
return $arr;
|
|
}
|
|
}
|
|
public function offlineSources($id = 0)
|
|
{
|
|
$arr[1] = ['name' => '自然到店', 'list' => []];
|
|
$arr[2] = ['name' => '转介绍', 'list' => [26 => '老车主',20 => '其他4S店', 21 => '其他二网', 22 => '汽车美容', 23 => '二手车', 24 => '修车厂', 25 => '驾校', 27 => '亲朋好友']];
|
|
$arr[3] = ['name' => '门店垂媒', 'list' => [32 => '懂车帝', 33 => '易车', 34 => '汽车之家']];
|
|
$arr[4] = ['name' => '外展外拓', 'list' => [40 => '精准地推', 41 => '车展', 42 => '静展', 43 => '走进企业']];
|
|
$arr[5] = ['name' => '自媒体', 'list' => [50 => '小红书号', 51 => '咸鱼号', 52 => '抖音号', 53 => '狸车素材', 54 => '知乎号', 55 => '视频号']];
|
|
$arr[6] = ['name' => '网络推广', 'list' => [60 => '抖音本地通表单', 61 => '抖音本地通私信', 62 => '视频号', 63 => '狸车分配']];
|
|
$arr[7] = ['name' => '厂商分配', 'list' => [70 => '传统渠道', 71 => '垂媒-懂车帝', 72 => '垂媒-汽车之家', 73 => '垂媒-易车', 74 => '抖音-效果通', 75 => '抖音-本地推', 76 => '抖音-本地通', 77 => '直播活动']];
|
|
|
|
if ($id) {
|
|
return $arr[$id];
|
|
} else {
|
|
return $arr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Notes:企微好友状态
|
|
* Created on: 2022/5/10 10:00
|
|
* Created by: dengbw
|
|
* @param int $id
|
|
* @return array|mixed
|
|
*/
|
|
public function wxqyAry($id = '')
|
|
{
|
|
$arr = [0 => '未添加', 1 => '已添加', -1 => '删除'];
|
|
if (strlen($id)) {
|
|
return $arr[$id];
|
|
} else {
|
|
return $arr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Notes:个微好友状态
|
|
* @param string $id
|
|
* @return array|mixed
|
|
*/
|
|
public function wxgrAry($id = '')
|
|
{
|
|
$arr = [0 => '未加', 1 => '已添加'];
|
|
if (strlen($id)) {
|
|
return $arr[$id];
|
|
} else {
|
|
return $arr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Notes:好友类型
|
|
* Created on: 2022/5/26 10:00
|
|
* Created by: dengbw
|
|
* @param int $id
|
|
* @return array|mixed
|
|
*/
|
|
public function buddyTypeAry($id = 0)
|
|
{
|
|
$arr = [1 => '潜客', 2 => '车主', 3 => '亲朋'];
|
|
if ($id) {
|
|
return $arr[$id];
|
|
} else {
|
|
return $arr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Notes:改派类型
|
|
* Created on: 2023/2/7 17:00
|
|
* Created by: qianhy
|
|
* @param int $cs_biz_id
|
|
* @return array|mixed
|
|
*/
|
|
public function csbizidAry($cs_biz_id=null){
|
|
$arr = [-1 => '已改派', 0 => '本店线索', 1 => '接收线索'];
|
|
if (!$cs_biz_id && strlen($cs_biz_id) == 0){
|
|
return $arr;
|
|
}
|
|
if ($cs_biz_id == -1 || $cs_biz_id == 0) {
|
|
return $arr[$cs_biz_id];
|
|
}
|
|
elseif ($cs_biz_id > 0){
|
|
return $arr[1];
|
|
}
|
|
else {
|
|
return $arr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Notes:改派搜索条件
|
|
* Created on: 2023/2/7 17:00
|
|
* Created by: qianhy
|
|
* @param int $cs_biz_id
|
|
* @return string
|
|
*/
|
|
public function csbizidWhere($cs_biz_id=null){
|
|
if (!$cs_biz_id && strlen($cs_biz_id) == 0){
|
|
return '1 = 1';
|
|
}
|
|
if ($cs_biz_id == -1 || $cs_biz_id == 0) {
|
|
return 'cs_biz_id = '.$cs_biz_id;
|
|
}
|
|
elseif ($cs_biz_id == 1){
|
|
return 'cs_biz_id > 0';
|
|
}
|
|
else {
|
|
return '1 = 1';
|
|
}
|
|
}
|
|
|
|
public function cbrandAry($c_brand=null){
|
|
$arr = [0 => '综合', 1 => '东风纳米', 4 => '哪吒', 5 => '零跑'];
|
|
|
|
if (is_numeric($c_brand)) {
|
|
return $arr[$c_brand];
|
|
} else {
|
|
return $arr;
|
|
}
|
|
}
|
|
|
|
public function count_order($where)
|
|
{
|
|
return $this->select_order($where, '', '', '', '', 1);
|
|
}
|
|
|
|
public function select_order($where = array(), $order = '', $page = 0, $page_size = 20, $fileds = '', $count = 0)
|
|
{
|
|
!$fileds && $fileds = 'lc_receiver_customers.*';
|
|
$this->db->distinct()->select($fileds);
|
|
$this->db->from('lc_receiver_customers');
|
|
$this->db->join('lc_receiver_orders', 'lc_receiver_orders.rid = lc_receiver_customers.id', 'left');
|
|
|
|
if ($where) {
|
|
$this->db->where($where);
|
|
}
|
|
if ($count) {
|
|
return $this->db->count_all_results();
|
|
}
|
|
if ($order) {
|
|
$this->db->order_by($order);
|
|
}
|
|
if ($page) {
|
|
$offset = ($page - 1) * $page_size;
|
|
$limit = $page_size;
|
|
} else {
|
|
$offset = null;
|
|
$limit = null;
|
|
}
|
|
$this->db->limit($limit, $offset);
|
|
return $this->db->get()->result_array();
|
|
}
|
|
}
|