| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 | <?phpnamespace app\api\controller\company;use app\common\controller\Apic;use think\Db;/** * 轮播图管理 * 由于数据结构改变,全部废弃 */class Banner extends Apic{    protected $noNeedLogin = [];    protected $noNeedRight = '*';    //某门店的轮播图    public function banner_list(){        $where = [            'company_id' => $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();    }}
 |