table)->field('content',true)->where('company_id',$this->auth->company_id)->order('id desc')->paginate(); $total = $list->total(); $list = $list->items(); $list = list_domain_image($list,['image']); $rs = [ 'list' => $list, 'total'=> $total, ]; $this->success(1,$rs); } public function add(){ $data = [ 'title' => input('title',''), 'image' => input('image',''), 'content' => input('content','','htmlspecialchars_decode'), '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','','htmlspecialchars_decode'), '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(); } }