data['comment'] = Dever::load('act/lib/comment')->get($id, $type, $this->data['uid']); if ($type == 3) { $this->data['live_status'] = 2; # 获取直播的状态 $live = Dever::db('video/live')->one($id); if ($live && $live['stream_id']) { $this->data['live_status'] = Dever::load('live/api')->status($live['stream_id']); } } return $this->data; } private function get($method, $name, $type = 1, $key = '') { $id = Dever::input('id'); if (!$id) { Dever::alert('错误的'.$name.'ID'); } $this->data['info'] = Dever::load($method)->get($id); if (!$this->data['info']) { Dever::alert('错误的'.$name.'ID'); } $this->data['info'] = $this->pic($this->data['info']); if ($this->data['info']['pdate'] > 0) { $this->data['info']['pdate_time'] = date('Y-m-d H:i:s', $this->data['info']['pdate']); } if ($this->data['info']['num_view'] > 100000) { $this->data['info']['num_view'] = '10w+'; } if (isset($this->data['info']['cate_id']) && $this->data['info']['cate_id']) { $this->data['info']['cate'] = Dever::db('content/cate')->one($this->data['info']['cate_id']); } if (isset($this->data['info']['author_id']) && $this->data['info']['author_id']) { $this->data['info']['author'] = Dever::db('content/author')->one($this->data['info']['author_id']); } # 获取评论列表 $this->data['comment'] = Dever::load('act/lib/comment')->get($id, $type, $this->data['uid']); # 获取相关推荐 $this->data['relation'] = Dever::load($method)->getRelation($this->data['info']); if ($this->data['relation']) { foreach ($this->data['relation'] as $k => $v) { $this->data['relation'][$k] = $this->getInfo($type, $v); } } # 用户行为数据 $this->data['user_act'] = array(); # 获取当前用户分享数 if ($this->data['uid'] > 0) { $this->data['user_act']['share'] = Dever::load('act/lib/share')->getRefluxNum($this->data['uid'], $id, $type); # 当前用户是否点赞 $this->data['user_act']['up'] = Dever::load('act/lib/like')->get($this->data['uid'], $id, $type); Dever::score($this->data['uid'], 'view_' . $key, '浏览' . $name); } else { $this->data['user_act']['share'] = 0; $this->data['user_act']['up'] = 2; } # 用户预约 if ($type == 3) { if ($this->data['uid'] > 0) { $this->data['user_act']['note'] = Dever::load('act/lib/note')->get($this->data['uid'], $id, $type); } else { $this->data['user_act']['note'] = 2; } if (isset($this->data['info']['status']) && $this->data['info']['status'] == 2) { # 直播中 Dever::load('act/lib/watch')->submit($this->data['uid'], $id, $type); } } # 浏览量+1 Dever::load($method)->addView($id); return $this->data; } # 获取图文详情 public function article() { return $this->get('content/lib/article', '图文', 1, 'article'); } # 获取视频详情 public function vod() { return $this->get('video/lib/vod', '视频', 2, 'vod'); } # 获取直播详情 public function live() { return $this->get('video/lib/live', '直播', 3, 'live'); } }