title = '列表'; $this->datum_id = input('datum_id'); $this->url_id = input('url_id'); $sel_where = []; $sel_where[] = ['c.is_deleted','in','0,1']; $sel_where[] = ['c.datum_id','=',$this->datum_id]; $sel_where[] = ['c.url_id','=',$this->url_id]; if($content = $this->request->get('content'))$sel_where[] = ['c.content','like','%'.$content.'%']; if($name = $this->request->get('name'))$sel_where[] = ['u.name','like','%'.$name.'%']; if($id = $this->request->get('id')) $sel_where[] = ['c.id','=',$id]; $query = $this->_query($this->table)->alias('c') ->field('c.*,u.name,u.headimg') ->leftJoin("store_member u",'u.id = c.user_id') ->where($sel_where)->order('is_top desc,id desc')->page(); } /** * 数据列表处理 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _index_page_filter(&$data) { } // 回复 public function reply() { $this->title = '回复'; $this->_form($this->table, 'form'); } /** * 删除 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function del() { $this->_save($this->table, ['is_deleted' => 2]); } /** * 表单数据处理 * @auth true * @menu true * @param array $data */ protected function _form_filter(&$data) { if($this->request->isGet()) { $this->source_id = $data['source_id'] ? $data['source_id'] : $data['id']; } } /** * 置顶设置 * @auth true * @menu true * @param array $data */ public function stick() { $this->_save($this->table, ['is_top' => input('is_top')]); } }