Jelajahi Sumber

新轮播图

lizhen_gitee 1 tahun lalu
induk
melakukan
74145dc2de
1 mengubah file dengan 60 tambahan dan 0 penghapusan
  1. 60 0
      application/api/controller/company/Newbanner.php

+ 60 - 0
application/api/controller/company/Newbanner.php

@@ -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();
+    }
+
+
+
+
+}