|
@@ -23,7 +23,27 @@ class Api extends Core
|
|
|
$content_id = Dever::input('content_id');
|
|
|
|
|
|
# 之后要通过合集id获取名字
|
|
|
- $data['cate'] = Dever::db('community/cate')->getAll();
|
|
|
+ $cate_data = Dever::db('community/cate')->getAll();
|
|
|
+
|
|
|
+ $where['info_id'] = $info_id;
|
|
|
+ $community = Dever::db('collection/community')->one($where);
|
|
|
+
|
|
|
+ $data['cate'] = array();
|
|
|
+ if ($community && $community['cate']) {
|
|
|
+ $cate = $community['cate'];
|
|
|
+ $cate = explode(',', $cate);
|
|
|
+ $cate_name = explode(',', $community['cate_name']);
|
|
|
+ $i = 0;
|
|
|
+ foreach ($cate_data as $k => $v) {
|
|
|
+ if (in_array($v['id'], $cate)) {
|
|
|
+ if (isset($cate_name[$i]) && $cate_name[$i]) {
|
|
|
+ $v['name'] = $cate_name[$i];
|
|
|
+ }
|
|
|
+ $data['cate'][$i] = $v;
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
@@ -43,10 +63,19 @@ class Api extends Core
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ # 获取聊天泡泡
|
|
|
+ public function tips()
|
|
|
+ {
|
|
|
+ $user = Dever::input('user', false);
|
|
|
+ $data = Dever::load('community/lib/tips')->getData('getAll', $this->uid, $this->type, $this->type_id, $user, $this->id);
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
# 发布弹幕、评论
|
|
|
public function addComment()
|
|
|
{
|
|
|
$pic = Dever::input('pic');
|
|
|
+ $playtime = Dever::input('playtime');
|
|
|
$content = Dever::input('content');
|
|
|
if (!$content) {
|
|
|
Dever::alert('请填写内容');
|
|
@@ -61,7 +90,35 @@ class Api extends Core
|
|
|
Dever::alert('错误的信息');
|
|
|
}
|
|
|
|
|
|
- Dever::load('community/lib/comment')->submit($this->uid, $type_id, $type, $pic, $content, 'collection/info', $this->id);
|
|
|
+ Dever::load('community/lib/comment')->submit($this->uid, $type_id, $type, $pic, $content, $playtime, 'collection/info', $this->id);
|
|
|
+
|
|
|
+ return 'yes';
|
|
|
+ }
|
|
|
+
|
|
|
+ # 发布聊天泡泡
|
|
|
+ public function addTips()
|
|
|
+ {
|
|
|
+ $pic = Dever::input('pic');
|
|
|
+ $playtime = Dever::input('playtime');
|
|
|
+ $content = Dever::input('content');
|
|
|
+ if (!$content) {
|
|
|
+ Dever::alert('请填写内容');
|
|
|
+ }
|
|
|
+
|
|
|
+ $type_id = Dever::input('type_id');
|
|
|
+ if (!$type_id) {
|
|
|
+ Dever::alert('错误的信息');
|
|
|
+ }
|
|
|
+ $type = Dever::input('type');
|
|
|
+ if (!$type) {
|
|
|
+ Dever::alert('错误的信息');
|
|
|
+ }
|
|
|
+ $seat = Dever::db('collection/user_seat')->one($type_id);
|
|
|
+ if (!$seat || $seat['uid'] != $this->uid) {
|
|
|
+ Dever::alert('这不是您的座位');
|
|
|
+ }
|
|
|
+
|
|
|
+ Dever::load('community/lib/tips')->submit($this->uid, $type_id, $type, $pic, $content, $playtime, 'collection/info', $this->id);
|
|
|
|
|
|
return 'yes';
|
|
|
}
|