123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace app\company\controller;
- use app\common\controller\Apic;
- use think\Db;
- /**
- * 问题汇总
- */
- class Wentihuizong extends Apic
- {
- protected $noNeedLogin = [];
- protected $noNeedRight = ['info'];
- 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)
- ->order('hz.id desc')
- ->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,
- 'createtime' => time(),
- 'title' => input('title',''),
- 'finishtime' => input('finishtime','','strtotime'),
- 'remark' => input('remark',''),
- 'status' => input('status',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',''),
- 'finishtime' => input('finishtime','','strtotime'),
- 'remark' => input('remark',''),
- 'status' => input('status',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();
- }
- }
|