From dc2f3c75d2b1f665ac4fe4f7395cb5e887332a8f Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Tue, 31 Aug 2021 10:01:32 +0800 Subject: [PATCH] add-api-licheb-customer-city --- admin/controllers/receiver/Customer.php | 14 +++++++------- admin/views/receiver/customer/lists.php | 6 +++--- api/controllers/wxapp/licheb/Cusorder.php | 15 +++++++++------ api/controllers/wxapp/licheb/Customers.php | 11 +++++++++++ sql/receiver/customer.sql | 2 +- sql/receiver/order.sql | 2 +- 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index d0535756..911ac9a3 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -50,14 +50,14 @@ class Customer extends HD_Controller } !$params['search_tp'] && $params['search_tp'] = 'mobile'; - //创建时间 - if ($params['c_time']) { - $c_time = explode(' ~ ', $params['c_time']); - if ($c_time[0]) { - $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00'); + //最近联系时间 + if ($params['cont_time']) { + $cont_time = explode(' ~ ', $params['cont_time']); + if ($cont_time[0]) { + $where["cont_time >="] = $cont_time[0] . ' 00:00:00'; } - if ($c_time[1]) { - $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59'); + if ($cont_time[1]) { + $where["cont_time <="] = $cont_time[1] . ' 23:59:59'; } } strlen($params['status']) && $where["status"] = $params['status']; diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index e477fce6..d54d0a9e 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -75,11 +75,11 @@
- +
- +
今天 diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index c4e7fa8e..73e09a61 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -115,14 +115,15 @@ class Cusorder extends Wxapp{ $payway && $data['payway'] = 1; $pack_id && $data['pack_id'] = $pack_id; $main_type && $data['main_type'] = 1; + $info_json = []; if($ifentrust){ $data['ifentrust'] = 1; - $info_json = [ - 'entrust_name' => $entrust_name, - 'entrust_idcard' => $entrust_idcard - ]; - $data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE); + $info_json['entrust_name'] = $entrust_name; + $info_json['entrust_idcard'] = $entrust_idcard; } + $cardid && $info_json['c_cardid'] = $cardid; + $address && $info_json['c_address'] = $address; + $info_json && $data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE); $o_id = $this->orders_model->add($data); if($o_id){ $sign_data = [ @@ -301,11 +302,13 @@ class Cusorder extends Wxapp{ '购车主体' => $row['main_type'] ? '公司' : '个人', '是否委托' => $row['ifentrust'] ? '是' : '否', ]; + $info_json = json_decode($row['info_json'],true); if($row['ifentrust']){ - $info_json = json_decode($row['info_json'],true); $car_data['委托人姓名'] = $info_json['entrust_name'] ? $info_json['entrust_name'] : ''; $car_data['委托人身份证'] = $info_json['entrust_idcard'] ? $info_json['entrust_idcard'] : ''; } + $info_json['c_address'] && $car_data['地址'] = $info_json['c_address']; + $info_json['c_cardid'] && $car_data['身份证号'] = $info_json['c_cardid']; //开票信息 $bill_status = 0; $bill_data = []; diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index be94ac73..d717687b 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -23,6 +23,8 @@ class Customers extends Wxapp{ $this->load->model('auto/auto_series_model'); $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_attr_model'); + + $this->load->model("biz/biz_model"); } protected function get(){ @@ -57,6 +59,7 @@ class Customers extends Wxapp{ 'id' => $row['id'], 'name' => $row['name'], 'mobile' => '****'.substr($row['mobile'],-4), + 'complete_mobile' => $row['mobile'], 'tip' => $tip, 'is_top' => $row['is_top'], 'status' => $row['status'], @@ -182,6 +185,7 @@ class Customers extends Wxapp{ if($this->customers_model->count(['biz_id'=>$biz_id,'mobile'=>$mobile])){ throw new Exception('客户已存在', API_CODE_FAIL); } + $biz_row = $this->biz_model->get(['id'=>$biz_id]); $row = $this->auto_series_model->get(['id'=>$car_id]); $where = [ "id in ($v_id,$color_id)" => null @@ -219,6 +223,8 @@ class Customers extends Wxapp{ 'cont_time' => date('Y-m-d H:i:s'), 'c_time' => time() ]; + $biz_row['city_id'] && $add_data['city_id'] = $biz_row['city_id']; + $biz_row['county_id'] && $add_data['county_id'] = $biz_row['county_id']; $buy_time && $add_data['buy_time'] = $buy_time; $cf_clues && $add_data['cf_clues'] = $cf_clues; $result = $this->customers_model->add($add_data); @@ -343,6 +349,8 @@ class Customers extends Wxapp{ $iscall = $this->input_param('iscall'); $unuse = $this->input_param('unuse'); //未派客户 $ismy = $this->input_param('ismy'); //是否只显示自己 + $name = $this->input_param('name'); + $mobile = $this->input_param('mobile'); !$page && $page = 1; !$size && $size = 10; @@ -380,6 +388,8 @@ class Customers extends Wxapp{ strlen($status) && $where['status'] = $status; $level && $where['level'] = $level; $cfrom && $where['cf_title'] = $cfrom; + $name && $where['name'] = $name; + $mobile && $where['mobile'] = $mobile; $count = $this->customers_model->count($where); $lists = []; @@ -424,6 +434,7 @@ class Customers extends Wxapp{ 'id' => $val['id'], 'name' => $val['name'], 'mobile' => mobile_asterisk($val['mobile']), + 'complete_mobile' => $val['mobile'], 'is_top' => $val['is_top'], 'other_data' => $other_data, 'tags' => $tags diff --git a/sql/receiver/customer.sql b/sql/receiver/customer.sql index 37eb3e9f..f13c4dca 100644 --- a/sql/receiver/customer.sql +++ b/sql/receiver/customer.sql @@ -23,7 +23,7 @@ create table lc_receiver_customers ( 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 tinyint(3) not null default '0' comment '预计购买时间', - user_json json default null comment '用户其它数据', + info_json json default null comment '用户其它数据', car_json json default null comment '车信息', jsondata json default null comment '其他信息', status tinyint(1) not null default '0' comment '状态:-1删除 0未见客户 1到店客户 2订单客户 3战败客户', diff --git a/sql/receiver/order.sql b/sql/receiver/order.sql index ee79a47d..e3f81639 100644 --- a/sql/receiver/order.sql +++ b/sql/receiver/order.sql @@ -153,7 +153,7 @@ create table lc_receiver_order_signs ( -- Title:订单表 -- Author:lcc -- Table:lc_receiver_orders --- info_json entrust_name 代办人姓名 entrust_idcard 代办人身份证 +-- info_json entrust_name 代办人姓名 entrust_idcard 代办人身份证 name 姓名 sex 性别 nation 民族 birth 出生日期 address 家庭地址 cardid 身份证 c_address 创建时输入的地址 c_cardid 创建时输入的身份证 -- --------------------------- drop table if exists lc_receiver_orders; create table lc_receiver_orders (