123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\api\controller\company;
- use app\common\controller\Apic;
- use think\Db;
- /**
- * 门店印象轮播图管理
- */
- class Newbanner extends Apic
- {
- protected $noNeedLogin = [];
- protected $noNeedRight = '*';
- //某门店的轮播图
- public function banner_list(){
- $where = [
- 'company_id' => $this->auth->company_id,
- ];
- $store = Db::name('banner')->where($where)->order('weigh asc,id asc')->select();
- $store = list_domain_image($store,['image']);
- $this->success(1,$store);
- }
- //设置轮播图
- public function edit(){
- $index = input('images','');
- 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($data)){
- Db::name('banner')->insertAll($data);
- }
- $this->success();
- }
- }
|