123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- namespace app\Nutrition\controller;
- use app\common\model\DatumIntro;
- use app\common\model\VideoIntro;
- use library\Controller;
- use app\common\model\VideoCate;
- use function AlibabaCloud\Client\value;
- /**
- * 视频评论
- * Class VideoComment
- * @package app\Nutrition\controller
- */
- class VideoComment extends Controller
- {
- /**
- * 绑定数据表
- * @var string
- */
- protected $table = 'VideoComment';
- /**
- * 列表
- * @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->video_id = input('video_id');
- $this->url_id = input('url_id');
- $sel_where = [];
- $sel_where[] = ['c.is_deleted','=',0];
- $sel_where[] = ['c.video_id','=',$this->video_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.'%'];
- $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' => 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')]);
- }
- }
|