123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace app\operate\controller;
- use library\Controller;
- /**
- * 问答评论
- * Class ReplyComment
- * @package app\operate\controller
- */
- class ReplyComment extends Controller
- {
- /**
- * 绑定数据表
- * @var string
- */
- protected $table = 'ForumReplyComment';
- /**
- * 列表
- * @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 index()
- {
- $this->title = '列表';
- $this->forum_id = input('forum_id');
- $this->reply_id = input('reply_id');
- $sel_where = [];
- $sel_where[] = ['c.is_deleted','=',0];
- $sel_where[] = ['c.forum_id','=',$this->forum_id];
- $sel_where[] = ['c.reply_id','=',$this->reply_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.'%'];
- $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('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' => 1]);
- }
- /**
- * 表单数据处理
- * @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')]);
- }
- }
|