diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 61b327f6..dfcc48cc 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -44,7 +44,8 @@ class Customer extends HD_Controller !$params['cf_title'] && $params['cf_title'] = ''; !$params['qdjl_id'] && $params['qdjl_id'] = ''; !$params['level'] && $params['level'] = ''; - !$params['cf_clues'] && $params['cf_clues'] = ''; + !$params['of_id'] && $params['of_id'] = ''; + !$params['of2_id'] && $params['of2_id'] = ''; !$params['brand_id'] && $params['brand_id'] = ''; $page = $params['page'] = $params['page'] ? intval($params['page']) : 1; $size = $params['size'] = $params['size'] ? intval($params['size']) : 20; @@ -64,8 +65,11 @@ class Customer extends HD_Controller if ($params['level']) { $where['level'] = $params['level']; } - if ($params['cf_clues']) { - $where['cf_clues'] = $params['cf_clues']; + if ($params['of_id']) { + $where['of_id'] = $params['of_id']; + } + if ($params['of2_id']) { + $where['of2_id'] = $params['of2_id']; } !$params['search_tp'] && $params['search_tp'] = 'mobile'; strlen($params['status']) && $where["status"] = $params['status']; @@ -173,8 +177,9 @@ class Customer extends HD_Controller } $count = $this->customers_model->count($where); $lists = []; + $offlineSources = $this->customers_model->offlineSources(); if ($count) { - $fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,cf_id,level'; + $fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,cf_id,level,of_id,of2_id'; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); //获取来源 $cf_id_arr = array_unique(array_column($rows, 'cf_id')); @@ -186,11 +191,17 @@ class Customer extends HD_Controller $biz_id_arr = array_unique(array_column($rows, 'biz_id')); $biz_id_arr && $biz_rows = $this->biz_model->get_map_by_ids($biz_id_arr, 'id,biz_name'); foreach ($rows as $key => $val) { - if (SUPER_ADMIN == $this->role || $this->role==35) { + if (SUPER_ADMIN == $this->role || $this->role == 35) { $mobile_sub = $val['mobile']; } else { $mobile_sub = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : ''; } + $of_title = ''; + if ($val['of_id']) { + $of_ary = $offlineSources[$val['of_id']]; + $of_title = $of_ary['name']; + $val['of2_id'] && $of_title .= '-' . $of_ary['list'][$val['of2_id']]; + } $lists[] = array( 'id' => $val['id'], 'name' => $val['name'], @@ -198,7 +209,7 @@ class Customer extends HD_Controller 'mobile_sub' => $mobile_sub, 'level' => $val['level'], 'cf_title' => $val['cf_title'], - 'cf_clues' => $val['cf_clues'], + 'of_title' => $of_title, 'cf_name' => isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '', 'status_name' => $status_arr[$val['status']], 'admin_name' => isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '', @@ -210,9 +221,9 @@ class Customer extends HD_Controller //渠道经理 $qdjl_lists = $this->app_licheb_users_model->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name'); $show_info['levelAry'] = $this->customers_model->get_sdata('level'); - $show_info['cfCluesAry'] = $this->customers_model->get_sdata('cfrom_clues'); $show_info['cfTitleAry'] = $this->customers_model->get_sdata('cfrom'); - $show_info['brandAry'] = $this->auto_brand_model->select(['status'=>1],'id desc','','','id,name'); + $show_info['brandAry'] = $this->auto_brand_model->select(['status' => 1], 'id desc', '', '', 'id,name'); + $show_info['offlineSourcesAry'] = $offlineSources; $this->data['show_info'] = $show_info; $this->data['lists'] = $lists; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); @@ -239,9 +250,9 @@ class Customer extends HD_Controller $if_driver = 1 == $row['if_driver'] ? '是' : '否'; $is_top = 1 == $row['is_top'] ? '是' : '否'; - $car_json = json_decode($row['car_json'],true); - $version = $this->auto_attr_model->get(['id'=>$car_json['v_id']],'title'); - $color = $this->auto_attr_model->get(['id'=>$car_json['c_id']],'title'); + $car_json = json_decode($row['car_json'], true); + $version = $this->auto_attr_model->get(['id' => $car_json['v_id']], 'title'); + $color = $this->auto_attr_model->get(['id' => $car_json['c_id']], 'title'); $side = $version ? $version['title'] : ''; $color = $color ? $color['title'] : ''; @@ -255,32 +266,38 @@ class Customer extends HD_Controller $rows_log = $this->customer_oplogs_model->select(array('customer_id' => $id), 'c_time desc', 0, 0); //用户信息 - if (SUPER_ADMIN == $this->role||35==$this->role) { + if (SUPER_ADMIN == $this->role || 35 == $this->role) { $mobile_sub = $row['mobile']; } else { $mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : ''; } - $cf_row = $this->clues_cfrom_model->get(['id'=>$row['cf_id']], 'id,title'); + $cf_row = $this->clues_cfrom_model->get(['id' => $row['cf_id']], 'id,title'); //获取分销用户 $cf_user = ''; - $clues = $this->clues_model->get(['id'=>$row['rid']],'recommend_id'); - if($clues['recommend_id']){ + $clues = $this->clues_model->get(['id' => $row['rid']], 'recommend_id'); + if ($clues['recommend_id']) { $this->load->model('app/liche/app_liche_users_model'); - $user = $this->app_liche_users_model->get(['id'=>$clues['recommend_id']],'id,nickname,up_uid'); - $user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id'=>$user['up_uid']],'id,nickname'); //上一级分销用户 - if($up_user){ + $user = $this->app_liche_users_model->get(['id' => $clues['recommend_id']], 'id,nickname,up_uid'); + $user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id' => $user['up_uid']], 'id,nickname'); //上一级分销用户 + if ($up_user) { $cf_user = "{$up_user['nickname']}(一级) => {$user['nickname']}(二级)"; - }else{ + } else { $cf_user = $user['nickname']; } } + $of_title = ''; + if ($row['of_id']) { + $of_ary = $this->customers_model->offlineSources()[$row['of_id']]; + $of_title = $of_ary['name']; + $row['of2_id'] && $of_title .= '-' . $of_ary['list'][$row['of2_id']]; + } $info = array( 'id' => $row['id'], 'name' => $row['name'], 'mobile' => $mobile_sub, 'cf_title' => $row['cf_title'], 'cf_name' => $cf_row['title'], - 'cf_clues' => $row['cf_clues'], + 'of_title' => $of_title, 'cf_user' => $cf_user, 'c_time' => date('Y-m-d H:i:s', $row['c_time']), 'status' => $row['status'], @@ -451,14 +468,14 @@ class Customer extends HD_Controller public function del() { $id = $this->input->post('id'); - $row = $this->customers_model->get(['id'=>$id,'cf_title'=>'平台分配']); - if(!$row){ + $row = $this->customers_model->get(['id' => $id, 'cf_title' => '平台分配']); + if (!$row) { return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); } - $res = $this->customers_model->update(['status'=>-1],['id'=>$id]); - if($res){ + $res = $this->customers_model->update(['status' => -1], ['id' => $id]); + if ($res) { return $this->show_json(SYS_CODE_SUCCESS, '删除成功'); - }else{ + } else { return $this->show_json(SYS_CODE_FAIL, '删除失败'); } } @@ -472,29 +489,32 @@ class Customer extends HD_Controller { // TODO: Implement export() method. } + //改派 - public function edit_adviser(){ + public function edit_adviser() + { $id = $this->input->get_post('id'); $biz_id = $this->input->post('biz_id'); - $row = $this->customers_model->get(['id'=>$id,'cf_title'=>'平台分配']); - if(!$row){ + $row = $this->customers_model->get(['id' => $id, 'cf_title' => '平台分配']); + if (!$row) { return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); } - if($this->input->post()){ - if(!$biz_id) return $this->show_json(SYS_CODE_FAIL, '请选择门店'); - if($biz_id == $row['biz_id']) return $this->show_json(SYS_CODE_FAIL, '请选择不同门店'); - $res = $this->customers_model->update(['biz_id'=>$biz_id,'admin_id'=>0],['id'=>$id]); - if($res){ + if ($this->input->post()) { + if (!$biz_id) return $this->show_json(SYS_CODE_FAIL, '请选择门店'); + if ($biz_id == $row['biz_id']) return $this->show_json(SYS_CODE_FAIL, '请选择不同门店'); + $res = $this->customers_model->update(['biz_id' => $biz_id, 'admin_id' => 0], ['id' => $id]); + if ($res) { $log = "改派订单"; - $this->addLog(['customer_id'=>$row['id'],'log'=>$log,'type'=>0]); + $this->addLog(['customer_id' => $row['id'], 'log' => $log, 'type' => 0]); return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); - }else{ + } else { return $this->show_json(SYS_CODE_FAIL, '保存失败'); } } $this->data['id'] = $id; return $this->show_view('receiver/customer/get_adviser'); } + /** * Notes:增加日志 * Created on: 2021/7/23 10:48 diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php index 9abdc285..000516e4 100644 --- a/admin/views/receiver/customer/get.php +++ b/admin/views/receiver/customer/get.php @@ -64,12 +64,12 @@
-
线上来源:
- {{info.cf_name}}  +
线下来源:
+ {{info.of_title}} 
- 线下来源:{{info.cf_clues}} + 线上来源:{{info.cf_name}} diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index 8a3da74b..4098708c 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -33,7 +33,6 @@ -
@@ -43,12 +42,37 @@
+
+ +
+ +
+
+
+ +
+ +
+
+
-
- - + + +
+
+
@@ -112,24 +136,6 @@ -
- -
- -
-
-
- -
- -
-
$value) { ?>
@@ -192,7 +198,7 @@ {{v.mobile_sub}} {{v.level}} {{v.cf_title}} - {{v.cf_clues}} + {{v.of_title}} {{v.cf_name}} {{v.biz_name}} {{v.status_name}} @@ -206,11 +212,11 @@
log_file = 'temp.log'; } + /** + * Notes:更新客户线下来源 + * Created on: 2022/3/09 11:58 + * Created by: dengbw + * https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer_of + * https://api.liche.cn/plan/temp/receiver_customer_of + */ + public function receiver_customer_of() + { + $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $param = $this->input->get(); + $param['page'] = intval($param['page']); + $param['size'] = intval($param['size']); + !$param['size'] && $param['size'] = 50; + !$param['page'] && $param['page'] = 1; + $counts = intval($param['counts']); + ob_start(); //打开缓冲区 + $where = array("cf_clues !=''" => null, 'of_id' => 0); + $res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,cf_clues'); + if (!$res) { + echo '
本次更新客户线下来源完成了:'; + echo '

成功更新 ' . $counts . ' 条'; + echo '

点击将再次更新客户线下来源>>>'; + exit; + } + $log = array(); + foreach ($res as $key => $value) { + $of_id = 0; + $cf_clues = $value['cf_clues']; + if ($cf_clues == '自然进店') { + $of_id = 1; + } else if ($cf_clues == '外展' || $cf_clues == 'DM' || $cf_clues == '外展外拓') { + $of_id = 4; + } else if ($cf_clues == '转介绍') { + $of_id = 2; + } else if ($cf_clues == '网站' || $cf_clues == '垂直媒体') { + $of_id = 3; + } else if ($cf_clues == '自媒体' || $cf_clues == '其他') { + $of_id = 5; + } + if ($of_id) { + $this->mdCustomers->update(['of_id' => $of_id], ['id' => $value['id']]); + $log[] = array('id' => $value['id'], 'of_id' => $of_id); + $counts++; + } + } + echo '
成功更新:'; + $log && print_r($log); + echo '

数据库获取:'; + echo json_encode($res, JSON_UNESCAPED_UNICODE); + header('refresh:3;url=/plan/temp/receiver_customer_of?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1)); + ob_end_flush();//输出全部内容到浏览器 + } + /** * Notes:新增街道 * Created on: 2021/12/14 11:58 @@ -238,9 +292,10 @@ class Temp extends HD_Controller echo 'finish'; } } - + //创建支付订单 - public function c_payorder(){ + public function c_payorder() + { $this->load->model('receiver/order/receiver_orders_model'); $this->load->model('app/liche/app_liche_users_model'); $this->load->model('app/liche/app_liche_orders_model'); @@ -252,30 +307,30 @@ class Temp extends HD_Controller !$params['size'] && $params['size'] = 10; !$params['page'] && $params['page'] = 1; - if($params['id']){ + if ($params['id']) { $where = [ 'id' => $params['id'] ]; - }else{ + } else { $where = [ 'status>' => 0, 'status<' => 3, 'biz_id !=' => 1 ]; } - $rows = $this->receiver_orders_model->select($where,'id asc',$params['page'],$params['size']); - if($rows){ + $rows = $this->receiver_orders_model->select($where, 'id asc', $params['page'], $params['size']); + if ($rows) { $data = []; - foreach($rows as $key=>$val){ - $userinfo = $this->app_liche_users_model->get(['mobile'=>$val['mobile']]); - $result = $this->orders_entity->check_finish_v2($val['id'],$userinfo); + foreach ($rows as $key => $val) { + $userinfo = $this->app_liche_users_model->get(['mobile' => $val['mobile']]); + $result = $this->orders_entity->check_finish_v2($val['id'], $userinfo); $data[] = [ 'id' => $val['id'], 'result' => $result, ]; } - echo json_encode($data,JSON_UNESCAPED_UNICODE); - }else{ + echo json_encode($data, JSON_UNESCAPED_UNICODE); + } else { echo 'finish'; } } diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 2a5160b0..dae86292 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -62,7 +62,7 @@ class Customers extends Wxapp $data = [ 'id' => $row['id'], 'name' => $row['name'], - 'mobile' => '****' . substr($row['mobile'], -4), + 'mobile' => $this->get_mobile(['mobile' => $row['mobile'], 'cf_title' => $row['cf_title'], 'type' => 1]), 'complete_mobile' => $row['mobile'], 'tip' => $tip, 'is_top' => $row['is_top'], @@ -88,14 +88,20 @@ class Customers extends Wxapp throw new Exception('数据不存在', ERR_PARAMS_ERROR); } $car_json = json_decode($row['car_json'], true); + $of_title = ''; + if ($row['of_id']) { + $of_ary = $this->customers_model->offlineSources()[$row['of_id']]; + $of_title = $of_ary['name']; + $row['of2_id'] && $of_title .= '-' . $of_ary['list'][$row['of2_id']]; + } $data['baseinfo'] = [ 'name' => ['value' => $row['name'], 'cn' => '客户姓名'], - 'mobile' => ['value' => mobile_asterisk($row['mobile']), 'cn' => '客户电话'], - 'brand_id' => ['value' => $row['brand_id'], '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' => '线索来源'], + 'mobile' => ['value' => $this->get_mobile(['mobile' => $row['mobile'], 'cf_title' => $row['cf_title']]), 'cn' => '客户电话'], + 'brand_id' => ['value' => intval($row['brand_id']), 'cn' => '车辆品牌'], + 'car_id' => ['value' => intval($row['s_id']), 'cn' => '车辆车系'], + 'v_id' => ['value' => intval($row['v_id']), 'cn' => '车型级别'], + 'color_id' => ['value' => intval($car_json['c_id']), 'cn' => '车型颜色'], + 'of_id' => ['value' => $of_title, 'of_id' => intval($row['of_id']), 'of2_id' => intval($row['of2_id']), 'cn' => '线索来源'], 'buy_time' => ['value' => $row['buy_time'], 'cn' => '预计购车时间'], ]; return $data; @@ -112,7 +118,8 @@ class Customers extends Wxapp $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'); //线索来源 + $of_id = $this->input_param('of_id'); //线下来源一级 + $of2_id = $this->input_param('of2_id'); //线下来源一级 $buy_time = $this->input_param('buy_time'); //预计购车时间 $row = $this->customers_model->get(['id' => $id]); if (!$row) { @@ -154,7 +161,8 @@ class Customers extends Wxapp } $update['car_json'] = json_encode($car_json, JSON_UNESCAPED_UNICODE); $name && $update['name'] = $name; - $cf_clues && $update['cf_clues'] = $cf_clues; + $of_id && $update['of_id'] = $of_id; + $of2_id && $update['of2_id'] = $of2_id; $v_id && $update['v_id'] = $v_id; if ($s_row) { $update['s_id'] = $s_row['id']; @@ -187,8 +195,9 @@ 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'); //预计购车时间 + $of_id = $this->input_param('of_id'); //线下来源一级 + $of2_id = $this->input_param('of2_id'); //线下来源一级 if (!mobile_valid($mobile)) throw new Exception('请输入正确的手机号码', ERR_PARAMS_ERROR); if (!$name || !$car_id || !$v_id || !$color_id) { @@ -238,7 +247,8 @@ class Customers extends Wxapp $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; + $of_id && $add_data['of_id'] = $of_id; + $of2_id && $add_data['of2_id'] = $of2_id; $result = $this->customers_model->add($add_data); if ($result) { $uname = $this->session['uname']; @@ -369,7 +379,15 @@ class Customers extends Wxapp if (strlen($status) && $status == 0) {//未见客户 unset($offline_sources[1]); } - return $offline_sources; + $show = []; + foreach ($offline_sources as $key => $val) { + $list = []; + foreach ($val['list'] as $key2 => $val2) { + $list[] = ['id' => $key2, 'name' => $val2]; + } + $show[] = ['id' => $key, 'name' => $val['name'], 'list' => $list]; + } + return $show; } //获取客户列表 @@ -401,10 +419,12 @@ class Customers extends Wxapp $ismy = $this->input_param('ismy'); //是否只显示自己 $name = $this->input_param('name'); $mobile = $this->input_param('mobile'); - $cf_clues = $this->input_param('cf_clues');//线索来源 + //$cf_clues = $this->input_param('cf_clues');//线索来源 $admin_id = $this->input_param('admin_id'); $id = $this->input_param('cus_id'); $a_id = intval($this->input_param('a_id'));//私域通活动id + $of_id = intval($this->input_param('of_id'));//线下来源一级 + $of2_id = intval($this->input_param('of2_id'));//线下来源二级 !$page && $page = 1; !$size && $size = 10; @@ -424,12 +444,16 @@ class Customers extends Wxapp 'biz_id' => $biz_id, 'status>=' => 0 ]; - + if ($of_id) { + $where["of_id"] = $of_id; + } + if ($of2_id) { + $where["of2_id"] = $of2_id; + } if ($a_id) { $where["cf_id"] = 35; $where["t_id"] = $a_id; } - if ($group_id == 1 || $ismy) { $where["admin_id"] = $uid; } @@ -440,7 +464,6 @@ class Customers extends Wxapp $where['c_time >='] = strtotime($s_time); $where['c_time <='] = strtotime(date('Y-m-d 23:59:59', strtotime($e_time))); } - if (strlen($iscall)) { if ($iscall) { $where['cont_time!='] = '0000-00-00 00:00:00'; @@ -459,7 +482,7 @@ class Customers extends Wxapp $cfrom && $where['cf_title'] = $cfrom; $name && $where["name like '%{$name}%'"] = null; $mobile && $where["mobile like '%$mobile%'"] = null; - $cf_clues && $where['cf_clues'] = $cf_clues; + //$cf_clues && $where['cf_clues'] = $cf_clues; $count = $this->customers_model->count($where); $lists = []; @@ -509,7 +532,7 @@ class Customers extends Wxapp $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], - 'mobile' => mobile_asterisk($val['mobile']), + 'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'cf_title' => $val['cf_title']]), 'complete_mobile' => $val['mobile'], 'is_top' => $val['is_top'], 'other_data' => $other_data, @@ -619,7 +642,7 @@ class Customers extends Wxapp $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], - 'mobile' => mobile_asterisk($val['mobile']), + 'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'cf_title' => $val['cf_title']]), 'complete_mobile' => $val['mobile'], 'is_top' => $val['is_top'], 'other_data' => $other_data, @@ -658,7 +681,7 @@ class Customers extends Wxapp $count = $this->customers_model->count($where); $lists = []; if ($count) { - $fileds = 'id,name,mobile,jsondata'; + $fileds = 'id,name,mobile,jsondata,cf_title'; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); foreach ($rows as $key => $val) { $jsondata = $val['jsondata'] ? json_decode($val['jsondata'], true) : array(); @@ -666,7 +689,7 @@ class Customers extends Wxapp $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], - 'mobile' => mobile_asterisk($val['mobile']), + 'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'cf_title' => $val['cf_title']]), 'reason' => $reason, ]; } @@ -723,4 +746,30 @@ class Customers extends Wxapp } throw new Exception('操作失败', ERR_PARAMS_ERROR); } + + /** + * Notes:显示电话格式 + * Created on: 2022/3/9 14:38 + * Created by: dengbw + * @param $params + * @return string + */ + private function get_mobile($params) + { + $mobile = $params['mobile']; + if (!$mobile) { + return ''; + } + $group_id = $this->session['group_id']; + $group_id = 3; + if ($params['cf_title'] == '自有资源' && ($group_id == 2 || $group_id == 3)) {//2店长,3老板显示全部电话 + return $mobile; + } + if ($params['type'] == 1) { + $mobile = '****' . substr($mobile, -4); + } else { + $mobile = mobile_asterisk($mobile); + } + return $mobile; + } } diff --git a/api/controllers/wxapp/licheb/Goods.php b/api/controllers/wxapp/licheb/Goods.php index c354d8e7..b1fd66b0 100644 --- a/api/controllers/wxapp/licheb/Goods.php +++ b/api/controllers/wxapp/licheb/Goods.php @@ -46,6 +46,7 @@ class Goods extends Wxapp $res = $this->mdItems->select($where, 'id DESC', 0, 0, 'id,in_time,biz_id'); $total = count($res); $warning = ''; + $if_warning = 0; if ($total) { $list = []; foreach ($res as $key => $val) { @@ -58,12 +59,15 @@ class Goods extends Wxapp $list[] = ['title' => $item_info['title'], 'vin' => $item_info['vin'] , 'days' => "已库存:{$days}天", 'img' => $item_info['cor_img']]; } + if ($days > 30) { + $if_warning = 1; + } } } $list && $warning = ['title' => '库存超期预警', 'note' => '库存天数已超过20天,请尽快销售,以免造成损失!', 'list' => $list]; } - if ($warning) {//库存预警 + if ($if_warning) {//库存预警 $inventory_title = '库存超期'; $inventory_color = '#f00'; } else { diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php index a1815747..14c5674e 100644 --- a/common/models/receiver/Receiver_customers_model.php +++ b/common/models/receiver/Receiver_customers_model.php @@ -78,17 +78,6 @@ class Receiver_customers_model extends HD_Model */ public function offlineSources($id = 0) { -// $arr[1] = ['id' => 1, 'name' => '自然到店', 'list' => []]; -// $arr[2] = ['id' => 2, 'name' => '转介绍', 'list' => [20 => ['id' => 20, 'name' => '其他4S店'], 21 => ['id' => 21, 'name' => '其他二网'] -// , 22 => ['id' => 22, 'name' => '汽车美容'], 23 => ['id' => 23, 'name' => '二手车'], 24 => ['id' => 24, 'name' => '修车厂'] -// , 25 => ['id' => 25, 'name' => '驾校'], 26 => ['id' => 26, 'name' => '老车主']]]; -// $arr[3] = ['id' => 3, 'name' => '网络推广', 'list' => [30 => ['id' => 30, 'name' => '抖音'], 31 => ['id' => 31, 'name' => '区域媒体'] -// , 32 => ['id' => 32, 'name' => '懂车帝'], 33 => ['id' => 33, 'name' => '易车'], 34 => ['id' => 34, 'name' => '汽车之家'] -// , 35 => ['id' => 35, 'name' => '网红']]]; -// $arr[4] = ['id' => 4, 'name' => '外展外拓', 'list' => [40 => ['id' => 40, 'name' => '巡展'], 41 => ['id' => 41, 'name' => '车展'] -// , 42 => ['id' => 42, 'name' => '静展'], 43 => ['id' => 43, 'name' => '大客户']]]; -// $arr[5] = ['id' => 5, 'name' => '自媒体', 'list' => [50 => ['id' => 50, 'name' => '小红书'], 51 => ['id' => 51, 'name' => '咸鱼'] -// , 52 => ['id' => 52, 'name' => '抖音'], 53 => ['id' => 53, 'name' => '狸车']]]; $arr[1] = ['name' => '自然到店', 'list' => []]; $arr[2] = ['name' => '转介绍', 'list' => [20 => '其他4S店', 21 => '其他二网', 22 => '汽车美容', 23 => '二手车', 24 => '修车厂', 25 => '驾校', 26 => '老车主']]; $arr[3] = ['name' => '网络推广', 'list' => [30 => '抖音', 31 => '区域媒体', 32 => '懂车帝', 33 => '易车', 34 => '汽车之家', 35 => '网红']];