Browse Source

pc端,操作规范类型,操作规范

lizhen_gitee 8 tháng trước cách đây
mục cha
commit
3f8fc3a9e0

+ 92 - 0
application/company/controller/Caozuoguifan.php

@@ -0,0 +1,92 @@
+<?php
+
+namespace app\company\controller;
+
+use app\common\controller\Apic;
+use think\Db;
+/**
+ * 操作规范
+ */
+class Caozuoguifan extends Apic
+{
+    protected $noNeedLogin = [];
+    protected $noNeedRight = [];
+
+    protected $table = 'caozuoguifan';
+
+    public function index(){
+        $type_id = input('type_id',0);
+
+        $where = [];
+        if($type_id){
+            $where['type_id'] = $type_id;
+        }
+
+        $list = Db::name($this->table)->field('content',true)->where('company_id',$this->auth->company_id)->where($where)->select();
+        $list = list_domain_image($list,['image']);
+
+        $this->success(1,$list);
+    }
+
+    public function add(){
+        $data = [
+            'company_id' => $this->auth->company_id,
+            'title'   => input('title',''),
+            'type_id' => input('type_id',0),
+            'image' => input('image',''),
+            'content' => input('content',''),
+            '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',''),
+            'type_id' => input('type_id',0),
+            '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();
+    }
+
+
+
+
+
+
+}

+ 74 - 0
application/company/controller/Caozuoguifantype.php

@@ -0,0 +1,74 @@
+<?php
+
+namespace app\company\controller;
+
+use app\common\controller\Apic;
+use think\Db;
+/**
+ * 操作规范type
+ */
+class Caozuoguifantype extends Apic
+{
+    protected $noNeedLogin = [];
+    protected $noNeedRight = [];
+
+    protected $table = 'caozuoguifan_type';
+   
+    public function index(){
+        $list = Db::name($this->table)->where('company_id',$this->auth->company_id)->select();
+
+        $this->success(1,$list);
+    }
+
+    public function add(){
+        $data = [
+            'name' => input('name',''),
+            'company_id' => $this->auth->company_id,
+        ];
+
+        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();
+
+        $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 = [
+            'name' => input('name',''),
+        ];
+
+        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();
+    }
+
+
+
+
+
+
+}