$this->auth->company_id, 'position' => 0, //首页 ]; $index = Db::name('banner')->where($where)->order('weigh asc,id asc')->select(); $index = list_domain_image($index,['image']); $where = [ 'company_id' => $this->auth->company_id, 'position' => 1, //门店印象 ]; $store = Db::name('banner')->where($where)->order('weigh asc,id asc')->autopage()->select(); $store = list_domain_image($store,['image']); $rs = [ 'index' => $index, 'store' => $store, ]; $this->success(1,$rs); } //设置轮播图 public function edit(){ $index = input('index',''); $store = input('store',''); $where = [ 'company_id' => $this->auth->company_id, 'position' => 0, //首页 ]; Db::name('banner')->where('company_id',$this->auth->company_id)->delete(); $data = []; if(!empty($index)){ $index = explode(',',$index); foreach($index as $key => $val){ $data[] = [ 'company_id' => $this->auth->company_id, 'image' => $val, 'position' => 0, 'status' => 1, 'createtime' => time(), 'updatetime' => time(), ]; } } if(!empty($store)){ $store = explode(',',$store); foreach($store as $key => $val){ $data[] = [ 'company_id' => $this->auth->company_id, 'image' => $val, 'position' => 1, 'status' => 1, 'createtime' => time(), 'updatetime' => time(), ]; } } if(!empty($data)){ Db::name('banner')->insertAll($data); } $this->success(); } }