From fc492608366cb0a4b70354fd222abf71bb794aa3 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Thu, 5 Aug 2021 14:40:02 +0800 Subject: [PATCH] edit-licheb-customer --- admin/controllers/app/liche/Main.php | 3 +- admin/controllers/app/liche/Member.php | 2 - admin/controllers/auto/Brand.php | 140 +++++++++++++++++ admin/controllers/auto/Series.php | 141 ++++++++++++++++++ admin/views/app/liche/member/lists.php | 2 +- admin/views/auto/brand/edit.php | 30 ++++ admin/views/auto/brand/lists.php | 63 ++++++++ api/controllers/wxapp/liche/Car.php | 2 +- api/controllers/wxapp/licheb/Cusorder.php | 2 +- api/controllers/wxapp/licheb/Customerlogs.php | 16 ++ api/controllers/wxapp/licheb/Customers.php | 105 +++++++++++-- .../libraries/receiver/Customers_entity.php | 29 ++-- common/models/auto/Auto_brand_model.php | 5 + .../receiver/Receiver_customers_model.php | 20 +++ sql/auto.sql | 1 + sql/receiver/customer.sql | 4 +- www/admin/favicon.ico | Bin 0 -> 1887 bytes www/api/favicon.ico | Bin 0 -> 1887 bytes www/home/favicon.ico | Bin 0 -> 1887 bytes 19 files changed, 525 insertions(+), 40 deletions(-) create mode 100644 admin/controllers/auto/Brand.php create mode 100644 admin/controllers/auto/Series.php create mode 100755 admin/views/auto/brand/edit.php create mode 100755 admin/views/auto/brand/lists.php diff --git a/admin/controllers/app/liche/Main.php b/admin/controllers/app/liche/Main.php index fbf0d8b4..a225346e 100644 --- a/admin/controllers/app/liche/Main.php +++ b/admin/controllers/app/liche/Main.php @@ -67,9 +67,10 @@ class Main extends HD_Controller /*小程序设置 end*/ $list = []; + $value = $this->userM->count(['dealer'=>1,'up_uid'=>0]); $list[] = array( 'title' => '分销用户(人)', - 'value' => 0, + 'value' => $value, 'btns' => array( array('name' => '查看详情', 'url' => '/appdistribution/distribution?app_id='.$this->app_id), ), diff --git a/admin/controllers/app/liche/Member.php b/admin/controllers/app/liche/Member.php index 48febcdb..192794b6 100755 --- a/admin/controllers/app/liche/Member.php +++ b/admin/controllers/app/liche/Member.php @@ -112,11 +112,9 @@ class Member extends HD_Controller{ $id = $this->input->post('id'); $dealer = $this->input->post('dealer'); - $upd = [ 'dealer' => $dealer, ]; - $this->userM->update($upd, array('id' => $id)); return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); diff --git a/admin/controllers/auto/Brand.php b/admin/controllers/auto/Brand.php new file mode 100644 index 00000000..5d513fd4 --- /dev/null +++ b/admin/controllers/auto/Brand.php @@ -0,0 +1,140 @@ +load->model('auto/auto_brand_model'); + } + + public function index(){ + $this->lists(); + } + + public function lists(){ + $params = $this->input->get(); + $page = $this->input->get('page'); + !$page && $page = 1; + $size = 20; + $where["status > -1"] = null; + $params['title'] && $where["name like '%{$params['title']}%'"] = null; + $count = $this->auto_brand_model->count($where); + $rows = $this->auto_brand_model->select($where, 'id desc', $page, $size); + $status_arr = $this->auto_brand_model->get_status(); + $list = []; + if($rows){ + foreach($rows as $key=>$val){ + $list[] = [ + 'id' => $val['id'], + 'name' => $val['name'], + 'status' => $val['status'], + 'status_name' => $status_arr[$val['status']], + 'c_time' => date('Y-m-d H:i:s',$val['c_time']) + ]; + } + } + $this->data['lists'] = $list; + $this->data['params'] = $params; + $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); + $this->data['_title'] = '品牌列表'; + $this->show_view('auto/brand/lists', true); + } + + public function get(){ + $id = $this->input->get('id'); + + $info = []; + if ($id) { + $info = $this->auto_brand_model->get(array('id' => $id)); + if (!$info || empty($info)) { + return $this->show_json(SYS_CODE_FAIL, '数据不存在!'); + } + } + + $this->data['info'] = $info; + $this->data['_title'] = $id ? '编辑品牌' : '新增品牌'; + return $this->show_view('auto/brand/edit'); + } + + public function add(){ + if (!$this->if_ajax) { + return $this->show_json(SYS_CODE_FAIL, '提交出错!'); + } + $id = $this->input->post('id'); + $name = $this->input->post('name'); + $img = $this->input->post('img'); + if (!$name || empty($name)) { + return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空'); + } + $old = $this->auto_brand_model->get(['name'=>$name,'status>'=>-1]); + if ($old) { + return $this->show_json(SYS_CODE_FAIL, '品牌已经存在'); + } + $add_data = array( + 'name' => $name, + 'logo' => $img, + 'c_time' => time() + ); + $brand_id = $this->auto_brand_model->add($add_data); + if (!$brand_id) { + return $this->show_json(SYS_CODE_FAIL, '添加失败'); + } + return $this->show_json(SYS_CODE_SUCCESS, '添加成功'); + } + + public function edit(){ + if (!$this->if_ajax) { + return $this->show_json(SYS_CODE_FAIL, '提交出错!'); + } + $id = $this->input->post('id'); + $name = $this->input->post('name'); + $img = $this->input->post('img'); + $row = $this->auto_brand_model->get(['id' => $id]); + if (!$row) { + return $this->show_json(SYS_CODE_FAIL, '数据不存在!'); + } + if (!$name) { + return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空'); + } + //防止品牌名称重复 + $where = array('name' => $name, "status<>-1" => null); + $id && $where['id <>'] = $id; + $old = $this->auto_brand_model->get($where); + if ($old) { + return $this->show_json(SYS_CODE_FAIL, '品牌已经存在'); + } + $up_data = array( + 'name' => $name, + ); + $img && $up_data['logo'] = $img; + $this->auto_brand_model->update($up_data, array('id' => $id)); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); + } + + public function del(){ + $id = $this->input->post('id'); + if (!$id) { + $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + $stauts = $this->input->post('status'); + $where = array('id' => $id); + $this->auto_brand_model->update(array('status' => $stauts), $where); + return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); + } + + public function batch(){ + + } + + public function export(){ + + } + +} diff --git a/admin/controllers/auto/Series.php b/admin/controllers/auto/Series.php new file mode 100644 index 00000000..0711b664 --- /dev/null +++ b/admin/controllers/auto/Series.php @@ -0,0 +1,141 @@ +load->model('auto/auto_brand_model'); + $this->load->model('auto/auto_series_model'); + } + + public function index(){ + $this->lists(); + } + + public function lists(){ + $params = $this->input->get(); + $page = $this->input->get('page'); + !$page && $page = 1; + $size = 20; + $where["status > -1"] = null; + $params['title'] && $where["name like '%{$params['title']}%'"] = null; + $count = $this->auto_brand_model->count($where); + $rows = $this->auto_brand_model->select($where, 'id desc', $page, $size); + $status_arr = $this->auto_brand_model->get_status(); + $list = []; + if($rows){ + foreach($rows as $key=>$val){ + $list[] = [ + 'id' => $val['id'], + 'name' => $val['name'], + 'status' => $val['status'], + 'status_name' => $status_arr[$val['status']], + 'c_time' => date('Y-m-d H:i:s',$val['c_time']) + ]; + } + } + $this->data['lists'] = $list; + $this->data['params'] = $params; + $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); + $this->data['_title'] = '品牌列表'; + $this->show_view('auto/brand/lists', true); + } + + public function get(){ + $id = $this->input->get('id'); + + $info = []; + if ($id) { + $info = $this->auto_brand_model->get(array('id' => $id)); + if (!$info || empty($info)) { + return $this->show_json(SYS_CODE_FAIL, '数据不存在!'); + } + } + + $this->data['info'] = $info; + $this->data['_title'] = $id ? '编辑品牌' : '新增品牌'; + return $this->show_view('auto/brand/edit'); + } + + public function add(){ + if (!$this->if_ajax) { + return $this->show_json(SYS_CODE_FAIL, '提交出错!'); + } + $id = $this->input->post('id'); + $name = $this->input->post('name'); + $img = $this->input->post('img'); + if (!$name || empty($name)) { + return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空'); + } + $old = $this->auto_brand_model->get(['name'=>$name,'status>'=>-1]); + if ($old) { + return $this->show_json(SYS_CODE_FAIL, '品牌已经存在'); + } + $add_data = array( + 'name' => $name, + 'logo' => $img, + 'c_time' => time() + ); + $brand_id = $this->auto_brand_model->add($add_data); + if (!$brand_id) { + return $this->show_json(SYS_CODE_FAIL, '添加失败'); + } + return $this->show_json(SYS_CODE_SUCCESS, '添加成功'); + } + + public function edit(){ + if (!$this->if_ajax) { + return $this->show_json(SYS_CODE_FAIL, '提交出错!'); + } + $id = $this->input->post('id'); + $name = $this->input->post('name'); + $img = $this->input->post('img'); + $row = $this->auto_brand_model->get(['id' => $id]); + if (!$row) { + return $this->show_json(SYS_CODE_FAIL, '数据不存在!'); + } + if (!$name) { + return $this->show_json(SYS_CODE_FAIL, '品牌名称不能为空'); + } + //防止品牌名称重复 + $where = array('name' => $name, "status<>-1" => null); + $id && $where['id <>'] = $id; + $old = $this->auto_brand_model->get($where); + if ($old) { + return $this->show_json(SYS_CODE_FAIL, '品牌已经存在'); + } + $up_data = array( + 'name' => $name, + ); + $img && $up_data['logo'] = $img; + $this->auto_brand_model->update($up_data, array('id' => $id)); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); + } + + public function del(){ + $id = $this->input->post('id'); + if (!$id) { + $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + $stauts = $this->input->post('status'); + $where = array('id' => $id); + $this->auto_brand_model->update(array('status' => $stauts), $where); + return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); + } + + public function batch(){ + + } + + public function export(){ + + } + +} diff --git a/admin/views/app/liche/member/lists.php b/admin/views/app/liche/member/lists.php index e22a63f1..011a8a2d 100755 --- a/admin/views/app/liche/member/lists.php +++ b/admin/views/app/liche/member/lists.php @@ -37,7 +37,7 @@ - onchange="set_publish(this,)"/> + onchange="set_publish(this,)"/> diff --git a/admin/views/auto/brand/edit.php b/admin/views/auto/brand/edit.php new file mode 100755 index 00000000..f332ead2 --- /dev/null +++ b/admin/views/auto/brand/edit.php @@ -0,0 +1,30 @@ +
+ +
+ +
+ +
+
+
+ +
+
+ + + + + 尺寸100x100 +
+
+
+
+
+ +
+
+
diff --git a/admin/views/auto/brand/lists.php b/admin/views/auto/brand/lists.php new file mode 100755 index 00000000..40493b12 --- /dev/null +++ b/admin/views/auto/brand/lists.php @@ -0,0 +1,63 @@ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
ID品牌名称状态创建时间操作
+ | + + 禁用 + + 恢复 + +
+
+
+
+ +
+
+
+ + diff --git a/api/controllers/wxapp/liche/Car.php b/api/controllers/wxapp/liche/Car.php index f95e32cd..9f35664d 100644 --- a/api/controllers/wxapp/liche/Car.php +++ b/api/controllers/wxapp/liche/Car.php @@ -45,7 +45,7 @@ class Car extends Wxapp{ $version[] = [ 'id' => $val['id'], 'title' => $val['title'], - 'v' => number_format($jsondata['v']).'元起', + 'v' => number_format($jsondata['price']).'元起', ]; }else{ //颜色 $color[] = [ diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index b5046a7e..5cbcb4aa 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -260,7 +260,7 @@ class Cusorder extends Wxapp{ '车辆名称' => $brand['name'].$series['name'], '车辆级别' => $version, '颜色' => $color, - '车辆平台价格' => $row['price'], + '车辆合同售价' => $row['price'], '定金' => $row['deposit'] ]; //开票信息 diff --git a/api/controllers/wxapp/licheb/Customerlogs.php b/api/controllers/wxapp/licheb/Customerlogs.php index 4eb243ec..e1e6d974 100644 --- a/api/controllers/wxapp/licheb/Customerlogs.php +++ b/api/controllers/wxapp/licheb/Customerlogs.php @@ -89,4 +89,20 @@ class Customerlogs extends Wxapp{ } return $data; } + + protected function post(){ + $id = $this->input_param('cus_id'); + $log = $this->input_param('content'); + $img_arr = $this->input_param('imgs'); + if(!$log && !$img_arr){ + throw new Exception('参数错误', ERR_PARAMS_ERROR); + } + $this->load->library('receiver/customers_entity'); + $result = $this->customers_entity->add_log($id,$this->session['uid'],$this->session['uname'],$log,'','wxapp',$img_arr); + if($result){ + throw new Exception('修改成功', API_CODE_SUCCESS); + }else{ + throw new Exception('修改失败', ERR_PARAMS_ERROR); + } + } } diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 7fa7686e..d3623464 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -22,6 +22,7 @@ class Customers extends Wxapp{ $this->load->model('receiver/receiver_customer_oplogs_model','customer_oplogs_model'); $this->load->model('auto/auto_series_model'); $this->load->model('auto/auto_brand_model'); + $this->load->model('auto/auto_attr_model'); } protected function get(){ @@ -77,17 +78,93 @@ class Customers extends Wxapp{ if(!$row){ throw new Exception('数据不存在', ERR_PARAMS_ERROR); } + $car_json = json_decode($row['car_json'],true); $data['baseinfo'] = [ - '客户姓名' => $row['name'], - '客户电话' => mobile_asterisk($row['mobile']), + 'name' => ['value'=>$row['name'],'cn'=>'客户姓名'], + 'mobile' => ['value'=>mobile_asterisk($row['mobile']),'cn'=>'客户电话'], + 'car_id' => ['value'=>$row['s_id'],'cn'=>'品牌车型'], + 'v_id' => ['value'=>$row['v_id'],'cn'=>'车型级别'], + 'color_id' => ['value'=>$car_json['c_id'],'cn'=>'车型颜色'], + 'cf_clues' => ['value'=>$row['cf_clues'],'cn'=>'线索来源'], + 'buy_time' => ['value'=>$row['buy_time'],'cn'=>'预计购车时间'], ]; return $data; } + //修改基本信息 + protected function put_data(){ + $biz_id = $this->session['biz_id']; + + $id = $this->input_param('cus_id'); + $name = $this->input_param('name'); + $mobile = $this->input_param('mobile'); + $car_id = $this->input_param('car_id'); //品牌车型id + $v_id = $this->input_param('v_id'); //车型id + $color_id = $this->input_param('color_id'); //颜色id + $cf_clues = $this->input_param('cf_clues'); //线索来源 + $buy_time = $this->input_param('buy_time'); //预计购车时间 + $row = $this->customers_model->get(['id'=>$id]); + if(!$row){ + throw new Exception('参数错误', ERR_PARAMS_ERROR); + } + $car_json = json_decode($row['car_json'],true); + $update = []; + if($mobile){ + if(!mobile_valid($mobile)){ + throw new Exception('手机号格式错误', ERR_PARAMS_ERROR); + } + if($this->customers_model->count(['biz_id'=>$biz_id,'mobile'=>$mobile])){ + throw new Exception('客户已存在', API_CODE_FAIL); + } + $update['mobile'] = $mobile; + } + $s_row = $this->auto_series_model->get(['id'=>$car_id]); + $ids_arr = []; + if($v_id){ + $car_json['v_id'] = $v_id; + $ids_arr[] = $v_id; + } + if($color_id){ + $car_json['c_id'] = $color_id; + $ids_arr[] = $color_id; + } + $attr_row = $this->auto_attr_model->get_map_by_ids($ids_arr); + if($attr_row[$color_id]){ + $color_row = $attr_row[$color_id][0]; + $color_row['jsondata'] = json_decode($color_row['jsondata'],true); + isset($color_row) && $car_json['color'] = $color_row; + } + if($attr_row[$v_id]){ + $version_row = $attr_row[$v_id][0]; + $version_row['jsondata'] = json_decode($version_row['jsondata'],true); + isset($version_row) && $car_json['version'] = $version_row; + } + $update['car_json'] = json_encode($car_json,JSON_UNESCAPED_UNICODE); + $name && $update['name'] = $name; + $cf_clues && $update['cf_clues'] = $cf_clues; + $v_id && $update['v_id'] = $v_id; + if($s_row){ + $update['s_id'] = $s_row['id']; + $update['brand_id'] = $s_row['brand_id']; + } + $s_row && $update['s_id'] = $s_row; + if($buy_time){ + $this->load->library('receiver/customers_entity'); + $update['level'] = $this->customers_entity->cal_level($buy_time); + $update['buy_time'] = $buy_time; + } + $result = $this->customers_model->update($update,['id'=>$id]); + if($result){ + $uname = $this->session['uname']; + $this->load->library('receiver/customers_entity'); + $this->customers_entity->add_log($id,$this->session['uid'],$uname,"修改用户基本信息"); + throw new Exception('保存成功', API_CODE_SUCCESS); + }else{ + throw new Exception('保存失败', ERR_PARAMS_ERROR); + } + } //创建客户 protected function post(){ $biz_id = $this->session['biz_id']; - $this->load->model('auto/auto_series_model'); - $this->load->model('auto/auto_attr_model'); $name = $this->input_param('name'); $mobile = $this->input_param('mobile'); @@ -95,6 +172,7 @@ class Customers extends Wxapp{ $v_id = $this->input_param('v_id'); //车型id $color_id = $this->input_param('color_id'); //颜色id $back_s_id = $this->input_param('b_s_id'); //备选车型 + $cf_clues = $this->input_param('cf_clues'); //线索来源 $buy_time = $this->input_param('buy_time'); //预计购车时间 if(!mobile_valid($mobile)) throw new Exception('请输入正确的手机号码', ERR_PARAMS_ERROR); @@ -125,7 +203,7 @@ class Customers extends Wxapp{ 'version' => isset($version_row) ? $version_row : '' ]; $this->load->library('receiver/customers_entity'); - $level = $this->customers_entity->cal_level(strtotime($buy_time),time()); + $level = $this->customers_entity->cal_level($buy_time); $add_data = [ 'name' => $name, @@ -141,7 +219,8 @@ class Customers extends Wxapp{ 'cont_time' => date('Y-m-d H:i:s'), 'c_time' => time() ]; - $buy_time && $add_data['buy_time'] = date('Y-m-d H:i:s',strtotime($buy_time)); + $buy_time && $add_data['buy_time'] = $buy_time; + $cf_clues && $add_data['cf_clues'] = $cf_clues; $result = $this->customers_model->add($add_data); if($result){ $uname = $this->session['uname']; @@ -228,16 +307,16 @@ class Customers extends Wxapp{ } return $lists; } - + //获取筛选条件 protected function get_filter(){ - - $this->load->library('receiver/customers_entity'); - $level = $this->customers_entity->get_level(); - $cfrom = ['自行到店','平台分配']; + $level = $this->customers_model->get_sdata('level'); + $cfrom = $this->customers_model->get_sdata(); + $buy_time = $this->customers_model->get_sdata('btime'); $data = [ 'level' => $level, - 'cfrom' => $cfrom + 'cfrom' => $cfrom, + 'buy_time' => $buy_time ]; return $data; } @@ -383,7 +462,7 @@ class Customers extends Wxapp{ if($rid){ //更新线索跟进人 $this->clues_model->update(['admin_id'=>$admin_id,'status'=>2],['id'=>$rid]); } - $log = "【{$uname}】分配客户"; + $log = "分配客户"; $this->customers_entity->add_log($val,$uid,$uname,$log); } throw new Exception('分配成功', API_CODE_SUCCESS); diff --git a/common/libraries/receiver/Customers_entity.php b/common/libraries/receiver/Customers_entity.php index 38495103..2b829f06 100644 --- a/common/libraries/receiver/Customers_entity.php +++ b/common/libraries/receiver/Customers_entity.php @@ -7,7 +7,7 @@ class Customers_entity{ private $ci; - private $level = ['H','A','B','C','D']; + private $level = [3=>'H',7=>'A',15=>'B',30=>'C']; public function __construct(){ $this->ci = & get_instance(); } @@ -21,17 +21,18 @@ class Customers_entity{ * @param $type int 操作类型 (0普通日志 1短信 2拨打电话) * @param $cf_platform string 来源 (wxapp小程序 admin后台) */ - public function add_log($customer_id,$uid,$uname,$content,$type='',$cf_platform='wxapp'){ + public function add_log($customer_id,$uid,$uname,$content,$type='',$cf_platform='wxapp',$imgs = []){ $this->ci->load->model('receiver/receiver_customer_oplogs_model','customer_oplogs_model'); $add_data = [ 'customer_id' => $customer_id, 'uid' => $uid, - 'log' => $content, 'c_time' => time() ]; + $content && $add_data['log'] = $content; $uname && $add_data['uname'] = $uname; $type && $add_data['type'] = $type; $cf_platform && $add_data['cf_platform'] = $cf_platform; + $imgs && $add_data['imgs'] = json_encode($imgs,JSON_UNESCAPED_UNICODE); $result = $this->ci->customer_oplogs_model->add($add_data); if($type==2 && $result){ //更新最后联系时间 $this->ci->load->model('receiver/receiver_customers_model'); @@ -41,29 +42,17 @@ class Customers_entity{ } /** * 购车时间计算用户等级 - * @param $buy_time int 预计购车时间戳 - * @param $c_time int 创建时间 + * @param $buy_time int 预计购车天数 */ - public function cal_level($buy_time,$c_time){ - $time = $buy_time - $c_time; - if($time<=3*24*60*60){ - $level = 'H'; - }elseif($time>3*24*60*60 && $time<=7*24*60*60){ - $level = 'A'; - }elseif($time>7*24*60*60 && $time<=15*24*60*60){ - $level = 'B'; - }elseif($time>15*24*60*60 && $time<=30*24*60*60){ - $level = 'C'; + public function cal_level($buy_time){ + if($this->level[$buy_time]){ + $level = $this->level[$buy_time]; }else{ - $level = 'D'; + $level = 'C'; } return $level; } - //返回用户等级数组 - public function get_level(){ - return $this->level; - } } ?> diff --git a/common/models/auto/Auto_brand_model.php b/common/models/auto/Auto_brand_model.php index c19850bd..06e7db12 100644 --- a/common/models/auto/Auto_brand_model.php +++ b/common/models/auto/Auto_brand_model.php @@ -10,6 +10,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Auto_brand_model extends HD_Model { private $table_name = 'lc_auto_brand'; + private $status_arr = [ '-1' => '删除',0 => '下架',1 => '正常']; public function __construct() { @@ -37,4 +38,8 @@ class Auto_brand_model extends HD_Model } return $rows; } + //获取状态 + public function get_status(){ + return $this->status_arr; + } } diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php index 79ca0bbd..bf8dbde2 100644 --- a/common/models/receiver/Receiver_customers_model.php +++ b/common/models/receiver/Receiver_customers_model.php @@ -13,6 +13,9 @@ 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','D']; + private $cfrom_arr = ['自行到店','平台分配']; + private $buy_time = [3,7,15,30]; public function __construct() { parent::__construct($this->table_name, 'default'); @@ -41,6 +44,23 @@ class Receiver_customers_model extends HD_Model public function get_status(){ return $this->status_arr; } + + public function get_sdata($type='cfrom'){ + switch($type){ + case 'cfrom': + $result = $this->cfrom_arr; + break; + case 'btime': + $result = $this->buy_time; + break; + case 'level': + $result = $this->level; + break; + default: + $result = ''; + } + return $result; + } public function count_order($where){ return $this->select_order($where,'','','','',1); diff --git a/sql/auto.sql b/sql/auto.sql index 2a642cb5..51dcadff 100644 --- a/sql/auto.sql +++ b/sql/auto.sql @@ -12,6 +12,7 @@ create table lc_auto_brand ( u_time timestamp not null default current_timestamp on update current_timestamp, primary key (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='车型库_品牌'; +alter table lc_auto_brand add logo varchar(70) not null default '' comment '品牌logo' after name; -- ---------------------------- -- Title:车型库_车系 diff --git a/sql/receiver/customer.sql b/sql/receiver/customer.sql index ab32da9f..37eb3e9f 100644 --- a/sql/receiver/customer.sql +++ b/sql/receiver/customer.sql @@ -22,7 +22,7 @@ create table lc_receiver_customers ( a_num tinyint(3) not null default '0' comment '到店次数', p_time timestamp not null default '0000-00-00 00:00:00' comment '分配时间', cont_time timestamp not null default '0000-00-00 00:00:00' comment '最后联系时间', - buy_time timestamp not null default '0000-00-00 00:00:00' comment '预计购买时间', + buy_time tinyint(3) not null default '0' comment '预计购买时间', user_json json default null comment '用户其它数据', car_json json default null comment '车信息', jsondata json default null comment '其他信息', @@ -31,6 +31,7 @@ create table lc_receiver_customers ( u_time timestamp not null default current_timestamp on update current_timestamp, primary key (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='客户表'; +alter table lc_receiver_customers add cf_clues varchar(50) not null default '' comment '线索来源' after cf_title; -- ---------------------------- -- Title:客户操作日志表 @@ -50,4 +51,5 @@ create table lc_receiver_customer_oplogs ( u_time timestamp not null default current_timestamp on update current_timestamp, primary key (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='客户操作日志表'; +alter table lc_receiver_customer_oplogs add imgs json default null comment '图片' after log; diff --git a/www/admin/favicon.ico b/www/admin/favicon.ico index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..102deb7b5517849d0460e3e8b200c555b6669824 100644 GIT binary patch literal 1887 zcmaJ?X;c$e7)=lZhEO)yD-3}s2FS*er3r+Xgrx*&K*fqmmJtFZ6EdR&Tnbbak+o6< zK?Td!D7c~0a@^_;TDKxn5kZT#S{2Y%R9ZVh(Ecc$b7tOq-?{gG>pQb4COXU#?}Eo* zFqRSFLMgfe#@8H&e&MXF7wF=Qh~kl0Xa$lX(}9>!B_s!d2(>H;l!7v4X8J{ti@{7I zsp8_1cu5pT0jVi6BZi_^Yf&}^!wu1EWr|b~0pwtkO2Z>QYd=8*R7xIkQJ{n-(ar;t zRpD7WFg7bXPLY+WU@M6s!2nm!K?T$xA_Mg5G!4wr^N8cR9CU9qQ;EPh1WDx)-vt#f zi2>$8IuHn=(EJoM8UtXmDfFO#02a#^V9*#eDve2{)BG3=4lRfi=nqUhMAVy3xq>4V ziYI)bCmt~wL9`qyH6tT~lHpH*bV*b?o6V-u7*qzs4@LOFnHof<_tU_hlL|r*R_Ih( zLtweZ4G}3n|sI~89HSk24(1KC*GA)%(p&3(}1WF|T4^^w*qhUk}eu(!! zh2gkNEl8DuFtk#qKpVHh)96aenWqC~2&9XHptQ*<#w0@s1SdmUfWe^90B?y*q0$&F zbH^zX2`54WBQlKwj1cmOs0c-+QgVdsc`PB5O%n+j3_4v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