|
@@ -20,14 +20,14 @@ class Banner extends Apic
|
|
|
'company_id' => $this->auth->company_id,
|
|
|
'position' => 0, //首页
|
|
|
];
|
|
|
- $index = Db::name('banner')->where($where)->order('weigh desc,id desc')->select();
|
|
|
+ $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 desc,id desc')->autopage()->select();
|
|
|
+ $store = Db::name('banner')->where($where)->order('weigh asc,id asc')->autopage()->select();
|
|
|
$store = list_domain_image($store,['image']);
|
|
|
|
|
|
$rs = [
|
|
@@ -39,6 +39,53 @@ class Banner extends Apic
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //设置轮播图
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|