|
@@ -0,0 +1,60 @@
|
|
|
+<?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')->autopage()->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();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|