lizhen_gitee преди 8 месеца
родител
ревизия
3d4452efd5
променени са 1 файла, в които са добавени 110 реда и са изтрити 0 реда
  1. 110 0
      application/company/controller/Wentihuizong.php

+ 110 - 0
application/company/controller/Wentihuizong.php

@@ -0,0 +1,110 @@
+<?php
+
+namespace app\company\controller;
+
+use app\common\controller\Apic;
+use think\Db;
+/**
+ * 问题汇总
+ */
+class Wentihuizong extends Apic
+{
+    protected $noNeedLogin = [];
+    protected $noNeedRight = [];
+
+    protected $table = 'wentihuizong';
+
+    public function index(){
+        $map = [];
+
+        $uc_id = input('uc_id',0);
+        if($uc_id){
+            $map['uc_id'] = $uc_id;
+        }
+
+        $list = Db::name($this->table)->alias('hz')
+            ->join('user_company uc','hz.uc_id = uc.id','LEFT')
+            ->field('hz.*,uc.projectname')
+            ->where('hz.company_id',$this->auth->company_id)
+            ->where($map)
+            ->paginate();
+        $total = $list->total();
+        $list = $list->items();
+
+        $rs = [
+            'list' => $list,
+            'total'=> $total,
+        ];
+
+        $this->success(1,$rs);
+    }
+
+    public function add(){
+        $uc_id = input('uc_id','');
+        $uc_info = Db::name('user_company')->where('id',$uc_id)->where('company_id',$this->auth->company_id)->find();
+        if(empty($uc_info)){
+            $this->error('不存在的客户');
+        }
+
+        $data = [
+            'company_id' => $this->auth->company_id,
+            'uc_id'      => $uc_id,
+            'title'      => input('title',''),
+            'findtime'   => input('findtime',''),
+            'finishtime' => input('finishtime',''),
+            'jiedian'    => input('jiedian',''),
+            'remark'     => input('remark',''),
+            'result'     => input('result',1),
+        ];
+
+        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 = [
+            'title'      => input('title',''),
+            'findtime'   => input('findtime',''),
+            'finishtime' => input('finishtime',''),
+            'jiedian'    => input('jiedian',''),
+            'remark'     => input('remark',''),
+            'result'     => input('result',1),
+        ];
+
+        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();
+    }
+
+
+
+
+
+
+}