add-common-auto_config
This commit is contained in:
@@ -173,19 +173,25 @@ class Series extends Wxapp{
|
||||
|
||||
//获取车型信息信息
|
||||
protected function get_info(){
|
||||
$biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']);
|
||||
$s_id = $this->input_param('car_id');
|
||||
$v_id = $this->input_param('v_id');
|
||||
|
||||
if(!$s_id || !$v_id){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$city_id = '';
|
||||
if($biz_id){
|
||||
$biz = $this->biz_model->get(['id'=>$biz_id],'city_id');
|
||||
$city_id = $biz['city_id'];
|
||||
}
|
||||
|
||||
$where_car = array(
|
||||
's_id'=>$s_id,
|
||||
'v_id' => $v_id,
|
||||
'status' => 1
|
||||
);
|
||||
$car = $this->auto_cars_model->get($where_car);
|
||||
$car = $this->auto_cars_model->get($where_car,'',$city_id);
|
||||
if(!$car){
|
||||
throw new Exception('当前车型暂无库存', ERR_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,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]);
|
||||
$car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id],'',$biz['city_id']);
|
||||
if(!$car_row){
|
||||
throw new Exception('参数错误', API_CODE_FAIL);
|
||||
}
|
||||
|
||||
@@ -138,14 +138,14 @@ 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]);
|
||||
$biz = $this->biz_model->get(['id'=>$row['biz_id']],'type,city_id');
|
||||
$car_row = $this->auto_cars_model->get(['brand_id'=>$series_row['brand_id'],'s_id'=>$series_row['id'],'v_id'=>$v_id],'',$biz['city_id']);
|
||||
if(!$row || !$series_row || !$car_row){
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if($row['status']>2){ //车辆确认后不可修改
|
||||
throw new Exception('修改失败,信息不可修改', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$biz = $this->biz_model->get(['id'=>$row['biz_id']],'type');
|
||||
if($biz['type'] == 1 || $biz['type']==2){ //直营店必须选择一个代办
|
||||
if(!count($srv_ids)){
|
||||
throw new Exception('请选择代办项目', ERR_PARAMS_ERROR);
|
||||
|
||||
@@ -32,7 +32,7 @@ class Services extends Wxapp{
|
||||
|
||||
$order_row = $this->orders_model->get(['id'=>$id]);
|
||||
$row = $this->customers_model->get(['id'=>$cus_id],'biz_id');
|
||||
$car_row = $this->auto_cars_model->get(['s_id'=>$s_id,'v_id'=>$v_id,'status'=>1]);
|
||||
$car_row = $this->auto_cars_model->get(['s_id'=>$s_id,'v_id'=>$v_id,'status'=>1],'price_insure,price_fine');
|
||||
$where = [];
|
||||
$payway && $where['id !='] = 4; //全款不显示金融
|
||||
$count = $this->services_model->count($where);
|
||||
|
||||
@@ -9,11 +9,48 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*/
|
||||
class Auto_cars_model extends HD_Model{
|
||||
private $table_name = 'lc_auto_cars';
|
||||
private $car_config_arr = [
|
||||
'350900' => [ //宁德
|
||||
//东风EX1
|
||||
['brand_id'=>1,'s_id'=>1,'v_id'=>2,'price_car'=>51700,'price_floor'=>51700],
|
||||
['brand_id'=>1,'s_id'=>1,'v_id'=>3,'price_car'=>55700,'price_floor'=>55700],
|
||||
//雷丁
|
||||
['brand_id'=>2,'s_id'=>3,'v_id'=>12,'price_car'=>38900,'price_floor'=>37400],
|
||||
['brand_id'=>2,'s_id'=>4,'v_id'=>13,'price_car'=>41900,'price_floor'=>40400],
|
||||
['brand_id'=>2,'s_id'=>5,'v_id'=>14,'price_car'=>43900,'price_floor'=>42400],
|
||||
],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车型特殊处理
|
||||
*/
|
||||
public function get($where, $select = '', $city_id = ''){
|
||||
if($select){
|
||||
$this->db->select($select, false);
|
||||
}
|
||||
$row = $this->db->get_where($this->table_name, $where)->row_array();
|
||||
if($city_id && $this->car_config_arr[$city_id]){ //特殊处理城市
|
||||
$car_lists = $this->car_config_arr[$city_id];
|
||||
$brand_id_arr = array_column($car_lists,'brand_id');
|
||||
$s_id_arr = array_column($car_lists,'s_id');
|
||||
$v_id_arr = array_column($car_lists,'v_id');
|
||||
if(in_array($row['brand_id'],$brand_id_arr) && in_array($row['s_id'],$s_id_arr) && in_array($row['v_id'],$v_id_arr)){
|
||||
foreach($car_lists as $key => $val){
|
||||
if($row['brand_id']==$val['brand_id']&&$row['s_id']==$val['s_id']&&$row['v_id']==$val['v_id']){
|
||||
$row['price_car'] = $val['price_car'];
|
||||
$row['price_floor'] = $val['price_floor'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
//获取完整车辆信息
|
||||
public function get_title($id){
|
||||
|
||||
Reference in New Issue
Block a user