Jelajahi Sumber

pc端,动态,政策

lizhen_gitee 8 bulan lalu
induk
melakukan
dc5a60b746

+ 83 - 0
application/company/controller/Dongtai.php

@@ -0,0 +1,83 @@
+<?php
+
+namespace app\company\controller;
+
+use app\common\controller\Apic;
+use think\Db;
+/**
+ * 动态
+ */
+class Dongtai extends Apic
+{
+    protected $noNeedLogin = [];
+    protected $noNeedRight = [];
+
+    protected $table = 'dongtai';
+
+    public function index(){
+        $list = Db::name($this->table)->field('content',true)->where('company_id',$this->auth->company_id)->select();
+        $list = list_domain_image($list,['image']);
+
+        $this->success(1,$list);
+    }
+
+    public function add(){
+        $data = [
+            'title'      => input('title',''),
+            'image'      => input('image',''),
+            'content'    => input('content',''),
+            'company_id' => $this->auth->company_id,
+            'createtime' => time(),
+            'updatetime' => time(),
+        ];
+
+        Db::name($this->table)->insertGetId($data);
+
+        $this->success();
+    }
+
+    public function info(){
+        $id = input('id',0);
+        $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
+        $info = info_domain_image($info,['image']);
+
+        $this->success(1,$info);
+    }
+
+    public function edit(){
+        $id = input('id',0);
+        $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
+        if(empty($info)){
+            $this->error('没找到该信息,请刷新重试');
+        }
+
+        $data = [
+            'title'      => input('title',''),
+            'image'      => input('image',''),
+            'content'    => input('content',''),
+            'updatetime' => time(),
+        ];
+
+        Db::name($this->table)->where('id',$id)->update($data);
+
+        $this->success();
+    }
+
+    public function del(){
+        $ids = input('ids','');
+        $ids = explode(',',$ids);
+
+        if (empty($ids)) {
+            $this->error();
+        }
+
+        Db::name($this->table)->where('id','IN',$ids)->where('company_id',$this->auth->company_id)->delete();
+        $this->success();
+    }
+
+
+
+
+
+
+}

+ 1 - 1
application/company/controller/Password.php

@@ -12,7 +12,7 @@ class Password extends Apic
     protected $noNeedLogin = [];
     protected $noNeedRight = [];
 
-    protected $table = 'Password';
+    protected $table = 'password';
 
     public function index(){
         $list = Db::name($this->table)->where('company_id',$this->auth->company_id)->select();

+ 83 - 0
application/company/controller/Zhengce.php

@@ -0,0 +1,83 @@
+<?php
+
+namespace app\company\controller;
+
+use app\common\controller\Apic;
+use think\Db;
+/**
+ * 政策
+ */
+class Zhengce extends Apic
+{
+    protected $noNeedLogin = [];
+    protected $noNeedRight = [];
+
+    protected $table = 'zhengce';
+
+    public function index(){
+        $list = Db::name($this->table)->field('content',true)->where('company_id',$this->auth->company_id)->select();
+        $list = list_domain_image($list,['image']);
+
+        $this->success(1,$list);
+    }
+
+    public function add(){
+        $data = [
+            'title'      => input('title',''),
+            'image'      => input('image',''),
+            'content'    => input('content',''),
+            'company_id' => $this->auth->company_id,
+            'createtime' => time(),
+            'updatetime' => time(),
+        ];
+
+        Db::name($this->table)->insertGetId($data);
+
+        $this->success();
+    }
+
+    public function info(){
+        $id = input('id',0);
+        $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
+        $info = info_domain_image($info,['image']);
+
+        $this->success(1,$info);
+    }
+
+    public function edit(){
+        $id = input('id',0);
+        $info = Db::name($this->table)->where('id',$id)->where('company_id',$this->auth->company_id)->find();
+        if(empty($info)){
+            $this->error('没找到该信息,请刷新重试');
+        }
+
+        $data = [
+            'title'      => input('title',''),
+            'image'      => input('image',''),
+            'content'    => input('content',''),
+            'updatetime' => time(),
+        ];
+
+        Db::name($this->table)->where('id',$id)->update($data);
+
+        $this->success();
+    }
+
+    public function del(){
+        $ids = input('ids','');
+        $ids = explode(',',$ids);
+
+        if (empty($ids)) {
+            $this->error();
+        }
+
+        Db::name($this->table)->where('id','IN',$ids)->where('company_id',$this->auth->company_id)->delete();
+        $this->success();
+    }
+
+
+
+
+
+
+}