From cdbe15eb0512566763bfaa5375c9a6e2a76e838d Mon Sep 17 00:00:00 2001
From: lccsw <1127794702@qq.com>
Date: Thu, 28 Oct 2021 09:47:39 +0800
Subject: [PATCH] edit-auto-cars
---
admin/controllers/auto/Cars.php | 37 ++++---------
admin/controllers/receiver/Customer.php | 9 ++--
admin/views/auto/cars/get.php | 23 +++-----
admin/views/auto/cars/lists.php | 17 +++---
api/controllers/wxapp/app/Series.php | 59 +++++++++------------
api/controllers/wxapp/liche/User.php | 4 +-
api/controllers/wxapp/licheb/Cusorder.php | 24 +++++----
api/controllers/wxapp/licheb/Cusorder2.php | 2 +-
api/controllers/wxapp/licheb/Finance.php | 2 +-
api/controllers/wxapp/licheb/Loan.php | 2 -
api/controllers/wxapp/licheb/Protocol.php | 36 +++++++------
common/libraries/entity/Deal_entity.php | 2 -
common/libraries/receiver/Orders_entity.php | 1 -
sql/auto.sql | 1 +
14 files changed, 96 insertions(+), 123 deletions(-)
diff --git a/admin/controllers/auto/Cars.php b/admin/controllers/auto/Cars.php
index 9e98943d..51ad3978 100644
--- a/admin/controllers/auto/Cars.php
+++ b/admin/controllers/auto/Cars.php
@@ -69,14 +69,8 @@ class Cars extends HD_Controller{
$select = '*';
$rows = $this->auto_cars_model->select($where, $orderby, $page, $size, $select);
if($rows){
- $s_ids = array();
- $attr_ids = array();
- foreach($rows as $v){
- !in_array($v['s_id'], $s_ids) && $s_ids[] = $v['s_id'];
- $v['v_id'] && !in_array($v['v_id'], $attr_ids) && $attr_ids[] = $v['v_id'];
- $v['cor_id'] && !in_array($v['cor_id'], $attr_ids) && $attr_ids[] = $v['cor_id'];
- $v['incor_id'] && !in_array($v['incor_id'], $attr_ids) && $attr_ids[] = $v['incor_id'];
- }
+ $s_ids = array_unique(array_column($rows,'s_id'));
+ $attr_ids = array_unique(array_column($rows,'v_id'));
//获取车系列表
$map_sery = array();
if($s_ids){
@@ -90,22 +84,19 @@ class Cars extends HD_Controller{
$where_attr = array("id in ({$str_ids})" => null);
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type');
}
-
//属性按'车型-车身颜色-内饰颜色'排序
foreach($rows as $v){
- $attr_title = "{$map_attr[$v['v_id']]}-{$map_attr[$v['cor_id']]}-内饰{$map_attr[$v['incor_id']]}";
- $title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$attr_title}";
+ $title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]}";
$lists[] = array(
'id' => $v['id'],
'title' => $title,
'status' => $v['status'],
'price_car' => $v['price_car'] > 0 ? $v['price_car'] : '0.00',
+ 'price_floor' => $v['price_floor'] > 0 ? $v['price_floor'] : '0.00',
'price_book' => $v['price_book'] > 0 ? $v['price_book'] : '0.00',
'price_insure' => $v['price_insure'] > 0 ? $v['price_insure'] : '0.00',
'price_fine' => $v['price_fine'] > 0 ? $v['price_fine'] : '0.00',
'price_finance' => $v['price_finance'] > 0 ? $v['price_finance'] : '0.00',
- 'first_pay' => $v['first_pay'] > 0 ? $v['first_pay'] : '0.00',
- 'month_pay' => $v['month_pay'] > 0 ? $v['month_pay'] : '0.00',
'price_coplus' => $v['price_coplus'] > 0 ? $v['price_coplus'] : '0.00',
'brokerage_1' => $v['brokerage_1'] > 0 ? $v['brokerage_1'] : '0.00',
'brokerage_2' => $v['brokerage_2'] > 0 ? $v['brokerage_2'] : '0.00',
@@ -152,12 +143,11 @@ class Cars extends HD_Controller{
'sery_name' => $row_sery['name'],
'attr' => $attr,
'price_car' => $row['price_car'] > 0 ? $row['price_car'] : '',
+ 'price_floor' => $row['price_floor'] > 0 ? $row['price_floor'] : '',
'price_book' => $row['price_book'] > 0 ? $row['price_book'] : '',
'price_insure' => $row['price_insure'] > 0 ? $row['price_insure'] : '',
'price_fine' => $row['price_fine'] > 0 ? $row['price_fine'] : '',
'price_finance' => $row['price_finance'] > 0 ? $row['price_finance'] : '',
- 'first_pay' => $row['first_pay'] > 0 ? $row['first_pay'] : '',
- 'month_pay' => $row['month_pay'] > 0 ? $row['month_pay'] : '0.00',
'price_coplus' => $row['price_coplus'] > 0 ? $row['price_coplus'] : '',
'brokerage_1' => $row['brokerage_1'] > 0 ? $row['brokerage_1'] : '',
'brokerage_2' => $row['brokerage_2'] > 0 ? $row['brokerage_2'] : '',
@@ -185,7 +175,7 @@ class Cars extends HD_Controller{
$brand_id = $info['brand_id'];
$s_id = $info['s_id'];
- $where = array('s_id' => $s_id);
+ $where = array('s_id' => $s_id,'type'=>1);
$orderby = 'type asc, id asc';
$select = 'id,type';
$map = $this->auto_attr_model->map('type', '', $where, $orderby, 0, 0, $select);
@@ -214,15 +204,13 @@ class Cars extends HD_Controller{
$rows_car = $this->auto_cars_model->select($where, 'id desc', 0, 0, 'id, v_id, cor_id, incor_id');
$map_cars = array();
foreach($rows_car as $v){
- $k = "{$v['cor_id']}_{$v['v_id']}_{$v['incor_id']}";
+ $k = "{$v['v_id']}";
$map_cars[$k] = $v;
}
$adds = array();
foreach($attrs as $attr){
- $cor_id = $attr[0] ? $attr[0] : 0;//0-车身颜色
$v_id = $attr[1] ? $attr[1] : 0;//1-车型
- $incor_id = $attr[2] ? $attr[2] : 0;//2-内饰颜色
- $k = "{$cor_id}_{$v_id}_{$incor_id}";
+ $k = "{$v_id}";
if($map_cars[$k]){
$map_cars[$k]['ok'] = 1;//保留
} else {
@@ -230,8 +218,6 @@ class Cars extends HD_Controller{
'brand_id' => $brand_id,
's_id' => $s_id,
'v_id' => $v_id,
- 'cor_id' => $cor_id,
- 'incor_id' => $incor_id,
'status' => 1,
'c_time' => time()
);
@@ -273,12 +259,11 @@ class Cars extends HD_Controller{
$upd = array(
'price_car' => floatval($info['price_car']),
+ 'price_floor' => floatval($info['price_floor']),
'price_book' => floatval($info['price_book']),
'price_insure' => floatval($info['price_insure']),
'price_fine' => floatval($info['price_fine']),
'price_finance' => floatval($info['price_finance']),
- 'first_pay' => floatval($info['first_pay']),
- 'month_pay' => floatval($info['month_pay']),
'price_coplus' => floatval($info['price_coplus']),
'brokerage_1' => floatval($info['brokerage_1']),
'brokerage_2' => floatval($info['brokerage_2']),
@@ -349,8 +334,6 @@ class Cars extends HD_Controller{
'brand_id' => $brand_id,
's_id' => $s_id,
'v_id' => $v_id,
- 'cor_id' => $cor_id,
- 'incor_id' => $incor_id,
);
$row = $this->auto_cars_model->get($where);
@@ -392,4 +375,4 @@ class Cars extends HD_Controller{
exit("total:{$total}; count:{$count}; done:{$done};");
}
-}
\ No newline at end of file
+}
diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php
index 9f412c91..50356391 100644
--- a/admin/controllers/receiver/Customer.php
+++ b/admin/controllers/receiver/Customer.php
@@ -223,6 +223,7 @@ class Customer extends HD_Controller
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
+ $this->load->model('auto/auto_attr_model');
$row = $this->customers_model->get(array('id' => $id));
if (!$row) {
@@ -231,9 +232,11 @@ 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);
- $side = $car_json['version']['title'] ? $car_json['version']['title'] : '';
- $color = $car_json['color']['title'] ? $car_json['color']['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'] : '';
$row_biz = $this->biz_model->get(array('id' => $row['biz_id']));
$row_brand = $this->auto_brand_model->get(array('id' => $row['brand_id']), 'name');
diff --git a/admin/views/auto/cars/get.php b/admin/views/auto/cars/get.php
index 232f182e..c71254a6 100644
--- a/admin/views/auto/cars/get.php
+++ b/admin/views/auto/cars/get.php
@@ -6,6 +6,13 @@
元
+
-
-
@@ -132,4 +125,4 @@
watch:{}
});
});
-
\ No newline at end of file
+
diff --git a/admin/views/auto/cars/lists.php b/admin/views/auto/cars/lists.php
index 8f857c61..79ade805 100644
--- a/admin/views/auto/cars/lists.php
+++ b/admin/views/auto/cars/lists.php
@@ -49,23 +49,22 @@
ID
-
裸车报价 |
+ 裸车报价 |
+ 车辆底价 |
定金 |
保险报价 |
精品报价 |
金融报价 |
- 分期首付 |
- 月供金额 |
公司加价 |
- 一级分销佣金 |
- 二级分销佣金 |
+ 一级分销佣金 |
+ 二级分销佣金 |
操作 |
- | 车型:{{v.title}} |
+ 车型:{{v.title}} |
|
@@ -74,24 +73,22 @@
|
|
+ |
|
|
|
|
- |
- |
|
|
|
{{v.price_car}} |
+ {{v.price_floor}} |
{{v.price_book}} |
{{v.price_insure}} |
{{v.price_fine}} |
{{v.price_finance}} |
- {{v.first_pay}} |
- {{v.month_pay}} |
{{v.price_coplus}} |
{{v.brokerage_1}} |
{{v.brokerage_2}} |
diff --git a/api/controllers/wxapp/app/Series.php b/api/controllers/wxapp/app/Series.php
index 809a601e..d576b18e 100644
--- a/api/controllers/wxapp/app/Series.php
+++ b/api/controllers/wxapp/app/Series.php
@@ -20,6 +20,8 @@ class Series extends Wxapp{
$this->check_headimg =array();//授权微信信息
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
+ $this->load->model('auto/auto_attr_model');
+ $this->load->model('auto/auto_cars_model');
$this->load->model("biz/biz_model");
}
//获取车系
@@ -134,41 +136,37 @@ class Series extends Wxapp{
!$page && $page = 1;
!$size && $size = 20;
- $this->load->model('auto/auto_cars_model');
- $this->load->model('auto/auto_attr_model');
-
- $where = [
- 's_id' => $s_id,
- 'status' => 1
- ];
- if($type==2){ //内饰颜色
- $where['v_id'] = $v_id;
- $where['cor_id'] = $cor_id;
- $groupby = "incor_id";
- }elseif($type==1){ //颜色
- $where['v_id'] = $v_id;
- $groupby = "cor_id";
- }else{ //车辆级别
- $groupby = "v_id";
- }
$lists = [];
- $rows = $this->auto_cars_model->select_groupby($groupby,$where,'',$page,$size,'id,s_id,v_id,cor_id,incor_id');
- if($rows){
- $target_arr = array_column($rows,$groupby);
- $attrs = $this->auto_attr_model->get_map_by_ids($target_arr,'id,title');
- foreach($rows as $key => $val){
- $attr_id = $val[$groupby];
- if($attrs[$attr_id]){
+ if($type==2 || $type==1){ //1颜色 2内饰颜色
+ $type = $type==1 ? 0 : $type;
+ $where = [
+ 's_id' => $s_id,
+ 'type' => $type,
+ 'status' => 1
+ ];
+ $count = $this->auto_attr_model->count($where);
+ $lists = $this->auto_attr_model->select($where,'',$page,$size,'id,title');
+ }else{ //车辆级别
+ $where = [
+ 's_id' => $s_id,
+ 'status' => 1
+ ];
+ $rows = $this->auto_cars_model->select($where,'id desc',$page,$size,'id,s_id,v_id');
+ if($rows){
+ $target_arr = array_unique(array_column($rows,'v_id'));
+ $attrs = $this->auto_attr_model->get_map_by_ids($target_arr,'id,title');
+ foreach($attrs as $key => $val){
$lists[] = [
- 'id' => $attr_id,
- 'title' => $attrs[$attr_id][0]['title']
+ 'id' => $key,
+ 'title' => $val[0]['title']
];
}
}
+ $count = count($lists);
}
$data = [
'list' => $lists,
- 'total' => count($lists)
+ 'total' => $count
];
return $data;
}
@@ -177,19 +175,14 @@ class Series extends Wxapp{
protected function get_info(){
$s_id = $this->input_param('car_id');
$v_id = $this->input_param('v_id');
- $color_id = $this->input_param('color_id');
- $incolor_id = $this->input_param('incolor_id');
- $this->load->model('auto/auto_cars_model');
- if(!$s_id || !$v_id || !$color_id || !$incolor_id){
+ if(!$s_id || !$v_id){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
$where_car = array(
's_id'=>$s_id,
'v_id' => $v_id,
- 'cor_id' => $color_id,
- 'incor_id' => $incolor_id,
'status' => 1
);
$car = $this->auto_cars_model->get($where_car);
diff --git a/api/controllers/wxapp/liche/User.php b/api/controllers/wxapp/liche/User.php
index 07f44346..01f73236 100644
--- a/api/controllers/wxapp/liche/User.php
+++ b/api/controllers/wxapp/liche/User.php
@@ -407,9 +407,9 @@ class User extends Wxapp{
foreach($rows as $key=>$val){
$item = $this->items_model->get(['id'=>$val['item_id']],'vin');
$agent = $this->agents_model->get(['o_id'=>$val['id']]);
+ $color = $this->auto_attr_model->get(['id'=>$val['cor_id']],'title,jsondata');
+ $color && $color['jsondata'] = json_decode($color['jsondata'],true);
$agent['ins_time'] = $agent['ins_time'] ? date('Y.m.d',strtotime($agent['ins_time'])):'';
- $car_json = json_decode($val['car_json'],true);
- $color = isset($car_json['color']) ? $car_json['color'] : '';
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php
index bdbfbb86..e9824ae0 100644
--- a/api/controllers/wxapp/licheb/Cusorder.php
+++ b/api/controllers/wxapp/licheb/Cusorder.php
@@ -33,7 +33,6 @@ class Cusorder extends Wxapp{
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
$this->load->model('auto/auto_cars_model');
- $this->load->model('auto/auto_finance_model');
$this->load->model('apporder/order_purchase_model');
$this->load->model('app/liche/app_liche_orders_model');
@@ -97,7 +96,7 @@ class Cusorder extends Wxapp{
$this->orders_model->update(['status'=>-1],['id'=>$o_order['id']]);
// throw new Exception('该手机号用户存在未完成订单', API_CODE_FAIL);
}
- $car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id,'cor_id'=>$color_id,'incor_id'=>$incolor_id]);
+ $car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id]);
if(!$car_row){
throw new Exception('参数错误', API_CODE_FAIL);
}
@@ -288,7 +287,7 @@ class Cusorder extends Wxapp{
}else{
strlen($status) && $where['status'] = $status;
}
- $fileds = 'id,name,mobile,car_json,brand_id,s_id,deposit,payway,status,c_time';
+ $fileds = 'id,name,mobile,brand_id,s_id,v_id,cor_id,incor_id,deposit,payway,status,c_time';
$count = $this->orders_model->count($where);
$lists = [];
if($count){
@@ -300,15 +299,19 @@ class Cusorder extends Wxapp{
$series_arr = array_unique(array_column($rows,'s_id'));
$series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
+ //获取车辆属性
+ $version_arr = array_unique(array_column($rows,'v_id'));
+ $color_arr = array_unique(array_column($rows,'cor_id'));
+ $attrs_arr = array_merge($version_arr,$color_arr);
+ $attrs = $this->auto_attr_model->get_map_by_ids($attrs_arr,'id,title');
+
$status_arr = $this->orders_model->get_status();
foreach($rows as $key=>$val){
- $car_json = json_decode($val['car_json'],true);
- $color = isset($car_json['color']) ? $car_json['color']['title'] : '';
- $version = isset($car_json['version']) ? $car_json['version']['title'] : '';
-
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
+ $color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : '';
+ $version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : '';
$other_data = [
'品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}",
@@ -342,9 +345,10 @@ class Cusorder extends Wxapp{
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
- $car_json = json_decode($row['car_json'],true);
- $color = isset($car_json['color']) ? $car_json['color']['title'] : '';
- $version = isset($car_json['version']) ? $car_json['version']['title'] : '';
+ $color = $this->auto_attr_model->get(['id'=>$row['cor_id']],'title');
+ $version = $this->auto_attr_model->get(['id'=>$row['v_id']],'title');
+ $color = $color ? $color['title'] : '';
+ $version = $version ? $version['title'] : '';
//贷款信息
$loan_data = [];
diff --git a/api/controllers/wxapp/licheb/Cusorder2.php b/api/controllers/wxapp/licheb/Cusorder2.php
index e57094fa..91d6b5e1 100644
--- a/api/controllers/wxapp/licheb/Cusorder2.php
+++ b/api/controllers/wxapp/licheb/Cusorder2.php
@@ -130,7 +130,7 @@ class Cusorder2 extends Wxapp{
$row = $this->orders_model->get(['id'=>$id]);
$series_row = $this->auto_series_model->get(['id'=>$car_id]);
- $car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id,'cor_id'=>$color_id,'incor_id'=>$incolor_id]);
+ $car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id]);
if(!$row || !$series_row || !$car_row){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
diff --git a/api/controllers/wxapp/licheb/Finance.php b/api/controllers/wxapp/licheb/Finance.php
index 49f5138a..8273d7dc 100644
--- a/api/controllers/wxapp/licheb/Finance.php
+++ b/api/controllers/wxapp/licheb/Finance.php
@@ -70,7 +70,7 @@ class Finance extends Wxapp{
if(!$series_row || !$row){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
- $car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id,'cor_id'=>$color_id,'incor_id'=>$incolor_id],'id,price_car');
+ $car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id],'id,price_car');
$where = [
'car_id' => $car_row['id'],
diff --git a/api/controllers/wxapp/licheb/Loan.php b/api/controllers/wxapp/licheb/Loan.php
index 154f2b1c..82845734 100644
--- a/api/controllers/wxapp/licheb/Loan.php
+++ b/api/controllers/wxapp/licheb/Loan.php
@@ -29,8 +29,6 @@ class Loan extends Wxapp{
$where_car = array(
's_id'=>$row['s_id'],
'v_id' => $row['v_id'],
- 'cor_id' => $row['cor_id'],
- 'incor_id' => $row['incor_id']
);
$car = $this->auto_cars_model->get($where_car,'first_pay');
$money = $car['first_pay'] ? $car['first_pay'] * 36 : 0;
diff --git a/api/controllers/wxapp/licheb/Protocol.php b/api/controllers/wxapp/licheb/Protocol.php
index 7ad0a272..d75c6104 100644
--- a/api/controllers/wxapp/licheb/Protocol.php
+++ b/api/controllers/wxapp/licheb/Protocol.php
@@ -23,7 +23,6 @@ class Protocol extends CI_Controller{
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
- $this->load->model('auto/auto_cars_model');
$this->load->model('auto/auto_attr_model');
$this->load->model("biz/biz_model");
@@ -45,10 +44,12 @@ class Protocol extends CI_Controller{
if($row){
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
- $car_json = json_decode($row['car_json'],true);
- $row['color'] = isset($car_json['color']) ? $car_json['color']['title'] : '';
- $row['incolor'] = isset($car_json['incolor']) ? $car_json['incolor']['title'] : '';
- $row['version'] = isset($car_json['version']) ? $car_json['version']['title'] : '';
+ $version = $this->auto_attr_model->get(['id'=>$row['v_id']],'title');
+ $color = $this->auto_attr_model->get(['id'=>$row['cor_id']],'title');
+ $incolor = $this->auto_attr_model->get(['id'=>$row['incor_id']],'title');
+ $row['version'] = $version['title'] ? $version['title'] : '';
+ $row['color'] = $color['title'] ? $color['title'] : '';
+ $row['incolor'] = $incolor['title'] ? $incolor['title'] : '';
$row['brand_name'] = $brand['name'];
$row['series_name'] = $series['name'];
//获取门店信息
@@ -114,9 +115,8 @@ class Protocol extends CI_Controller{
if($row){
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
- $car_json = json_decode($row['car_json'],true);
- $version = isset($car_json['version']) ? $car_json['version']['title'] : '';
- $row['brand_name'] = $brand['name'].$series['name'].' '.$version;
+ $version = $this->auto_attr_model->get(['id'=>$row['v_id']],'title');
+ $row['brand_name'] = $brand['name'].$series['name'].' '.$version['title'];
//获取门店信息
$biz = $this->biz_model->get(['id'=>$row['biz_id']]);
if($row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司
@@ -150,12 +150,14 @@ class Protocol extends CI_Controller{
}
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
- $car_json = json_decode($row['car_json'],true);
$money_json = json_decode($row['money_json'],true);
$row['info_json'] = $info_json = json_decode($row['info_json'],true);
- $row['color'] = isset($car_json['color']) ? $car_json['color']['title'] : '';
- $row['incolor'] = isset($car_json['incolor']) ? $car_json['incolor']['title'] : '';
- $row['version'] = isset($car_json['version']) ? $car_json['version']['title'] : '';
+ $version = $this->auto_attr_model->get(['id'=>$row['v_id']],'title');
+ $color = $this->auto_attr_model->get(['id'=>$row['cor_id']],'title');
+ $incolor = $this->auto_attr_model->get(['id'=>$row['incor_id']],'title');
+ $row['version'] = $version['title'] ? $version['title'] : '';
+ $row['color'] = $color['title'] ? $color['title'] : '';
+ $row['incolor'] = $incolor['title'] ? $incolor['title'] : '';
$row['brand_name'] = $brand['name'];
$row['series_name'] = $series['name'];
$row['cardid'] = $info_json['cardid'];
@@ -201,10 +203,12 @@ class Protocol extends CI_Controller{
if($row){
$brand = $this->auto_brand_model->get(['id'=>$row['brand_id']],'name');
$series = $this->auto_series_model->get(['id'=>$row['s_id']],'name');
- $car_json = json_decode($row['car_json'],true);
- $row['color'] = isset($car_json['color']) ? $car_json['color']['title'] : '';
- $row['incolor'] = isset($car_json['incolor']) ? $car_json['incolor']['title'] : '';
- $row['version'] = isset($car_json['version']) ? $car_json['version']['title'] : '';
+ $version = $this->auto_attr_model->get(['id'=>$row['v_id']],'title');
+ $color = $this->auto_attr_model->get(['id'=>$row['cor_id']],'title');
+ $incolor = $this->auto_attr_model->get(['id'=>$row['incor_id']],'title');
+ $row['version'] = $version['title'] ? $version['title'] : '';
+ $row['color'] = $color['title'] ? $color['title'] : '';
+ $row['incolor'] = $incolor['title'] ? $incolor['title'] : '';
$row['brand_name'] = $brand['name'];
$row['series_name'] = $series['name'];
//获取门店信息
diff --git a/common/libraries/entity/Deal_entity.php b/common/libraries/entity/Deal_entity.php
index 6975de85..9b1c0e9e 100755
--- a/common/libraries/entity/Deal_entity.php
+++ b/common/libraries/entity/Deal_entity.php
@@ -54,8 +54,6 @@ class Deal_entity
'brand_id' => $order['brand_id'],
's_id' => $order['s_id'],
'v_id' => $order['v_id'],
- 'cor_id' => $order['cor_id'],
- 'incor_id' => $order['incor_id'],
'status' => 1
];
$car = $this->ci->auto_cars_model->get($where);
diff --git a/common/libraries/receiver/Orders_entity.php b/common/libraries/receiver/Orders_entity.php
index 9d0a683e..c9b49631 100644
--- a/common/libraries/receiver/Orders_entity.php
+++ b/common/libraries/receiver/Orders_entity.php
@@ -28,7 +28,6 @@ class Orders_entity{
$this->ci->load->model('apporder/order_purchase_model');
$this->ci->load->model('auto/auto_brand_model');
$this->ci->load->model('auto/auto_series_model');
- $this->ci->load->model('auto/auto_cars_model');
$this->ci->load->model("biz/biz_model");
$this->ci->load->model('app/liche/app_liche_orders_model');
diff --git a/sql/auto.sql b/sql/auto.sql
index 036b91ae..4d37013d 100644
--- a/sql/auto.sql
+++ b/sql/auto.sql
@@ -83,6 +83,7 @@ alter table lc_auto_cars
add column incor_id int unsigned not null default '0' comment '内饰颜色' after cor_id;
alter table lc_auto_cars modify attrs char(30) not null default '' comment '属性组合:{type0id}_{type1id}_{type2id}';
alter table lc_auto_cars drop index attrs;
+alter table lc_auto_cars add price_floor double(10,2) not null default '0.00' comment '车辆底价' after price_car;
-- ----------------------------