From 9debaa932d1912c096736511c9c35c2d06ff9123 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Wed, 18 Aug 2021 10:38:15 +0800 Subject: [PATCH] edit-api-auto-series --- api/controllers/wxapp/app/Series.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/api/controllers/wxapp/app/Series.php b/api/controllers/wxapp/app/Series.php index b6502fad..3a61d2b6 100644 --- a/api/controllers/wxapp/app/Series.php +++ b/api/controllers/wxapp/app/Series.php @@ -23,8 +23,7 @@ class Series extends Wxapp{ //获取车型列表 protected function get_cars(){ - $biz_id = $this->session['biz_id']; - + $uid = $this->session['uid']; $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_series_model'); $this->load->model("biz/biz_model"); @@ -33,12 +32,16 @@ class Series extends Wxapp{ $where = [ 'status' => 1 ]; - $biz = $this->biz_model->get(['id'=>$biz_id],'jsondata'); - $jsondata = json_decode($biz['jsondata'],true); - $auto_brands = $jsondata['auto_brands'] ? $jsondata['auto_brands'] : [0]; + $user = $this->app_user_model->get(array('id' => $uid)); + if(isset($user['biz_id'])){ + $biz_id = $this->session['biz_id']; + $biz = $this->biz_model->get(['id'=>$biz_id],'jsondata'); + $jsondata = json_decode($biz['jsondata'],true); + $auto_brands = $jsondata['auto_brands'] ? $jsondata['auto_brands'] : [0]; - $str_brands = implode(',',$auto_brands); - $where["id in ($str_brands)"] = null; + $str_brands = implode(',',$auto_brands); + $where["id in ($str_brands)"] = null; + } $rows = $this->auto_series_model-> select($where,'',1,20,'id,brand_id,name'); $list = [];