dever 4 éve
szülő
commit
b0c3fb462c

+ 100 - 0
app/collection/database/community.php

@@ -0,0 +1,100 @@
+<?php
+$community_cate = function()
+{
+    $array = array();
+    $info = Dever::db('community/cate')->state();
+    
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
+return array
+(
+    # 表名
+    'name' => 'community',
+    # 显示给用户看的名称
+    'lang' => '社区设置',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合集',
+            'default'   => '',
+            'desc'      => '合集',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+       'cate'     => array
+        (
+            'type'      => 'varchar-180',
+            'name'      => '社区分类',
+            'default'   => '1,2,3',
+            'desc'      => '社区分类',
+            'match'     => 'is_numeric',
+            'update'    => 'checkbox',
+            'option'    => $community_cate,
+        ),
+
+        'cate_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '社区分类自定义名称-多个用逗号隔开,更上面选择的社区分类对应',
+            'default'   => '',
+            'desc'      => '社区分类自定义名称',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            //'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 2 - 0
app/collection/database/function.php

@@ -182,6 +182,8 @@ return array
         'list_button' => array
         (
             'list' => array('商品管理', '"product&search_option_info_id={info_id}&oper_table=function&top_table=info&top_project=collection"' , '"{type}" == "shop"'),
+
+            'fast' => array('社区管理', '"community&search_option_info_id={info_id}&oper_table=function&top_table=info&top_project=collection&where_id={id}"' , '"{type}" == "community"'),
         ),
     ),
 

+ 193 - 0
app/collection/database/user_seat.php

@@ -0,0 +1,193 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'user_seat',
+    # 显示给用户看的名称
+    'lang' => '用户座位购买记录',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户名',
+			'default' 	=> '0',
+			'desc' 		=> '请选择用户',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合集',
+            'default'   => '',
+            'desc'      => '合集',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'parent_page_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '父级章节id',
+            'default'   => '',
+            'desc'      => '章节id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'page_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '章节id',
+            'default'   => '',
+            'desc'      => '章节id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'times_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '时光id',
+            'default'   => '',
+            'desc'      => '时光id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'day'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '时光下的日期',
+            'default'   => '-1',
+            'desc'      => '时光下的日期',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'content_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '内容id',
+            'default'   => '',
+            'desc'      => '内容id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'index'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '内容索引值',
+            'default'   => '',
+            'desc'      => '内容索引值',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'hall'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '大厅数值',
+            'default'   => '',
+            'desc'      => '大厅数值',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'seat_row'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '座位所属行',
+            'default'   => '',
+            'desc'      => '座位所属行',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'seat_column'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '座位所属列',
+            'default'   => '',
+            'desc'      => '座位所属列',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '操作时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        'getMyData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'uid' => 'yes',
+                'info_id' => 'yes',
+                'times_id' => 'yes',
+                'content_id' => 'yes',
+                'hall' => 'yes',
+                'seat_row' => 'yes',
+                'seat_column' => 'yes',
+                'day' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 2 - 1
app/collection/lib/Core.php

@@ -23,7 +23,8 @@ class Core
     	# 获取当前的用户信息
         $this->token = Dever::input('token');
         $this->uid = 1;
-        $this->user = Dever::load('passport/api')->info($this->uid);
+        $this->user = Dever::load('collection/lib/user')->get($this->uid, $this->id);
+        $this->user['id'] = $this->uid;
     }
 
     protected function checkInfo()

+ 115 - 0
app/collection/lib/Seat.php

@@ -0,0 +1,115 @@
+<?php
+
+namespace Collection\Lib;
+
+use Dever;
+
+class Seat
+{
+	# 获取座位信息
+	public function get($uid, $info_id, $parent_page_id, $page_id, $times_id, $day, $content_id, $index, $hall)
+	{
+		//$where['uid'] = $uid;
+		$where['info_id'] = $info_id;
+		$where['times_id'] = $times_id;
+		$where['content_id'] = $content_id;
+		if ($day && $day > 0) {
+            $where['day'] = $day;
+        } else {
+            $where['day'] = -1;
+        }
+        $where['hall'] = $hall;
+		$my = Dever::db('collection/user_seat')->getMyData($where);
+
+		$data = array();
+		if ($my) {
+			foreach ($my as $k => $v) {
+				$key = $v['hall'] . '_' . $v['seat_row'] . '_' . $v['seat_column'];
+				$v['user'] = Dever::load('collection/lib/user')->get($v['uid'], $info_id);
+				$data[$key] = $v;
+			}
+		}
+
+		$id = $info_id . '#' . $hall;
+		$type = 'seat_' . $info_id . '_' . $times_id . '_' . $content_id . '_' . $day . '_' . $hall;
+		$data['seat'] = $this->getAll($id, $type, $hall, $data);
+
+		return $data;
+	}
+
+	# 选取座位
+	public function save($uid, $info_id, $parent_page_id, $page_id, $times_id, $day, $content_id, $index, $seat)
+	{
+		$seat = explode(',', $seat);
+
+		# 先检查是否被购买了
+		$where['info_id'] = $info_id;
+		$where['times_id'] = $times_id;
+		$where['content_id'] = $content_id;
+		if ($day && $day > 0) {
+            $where['day'] = $day;
+        } else {
+            $where['day'] = -1;
+        }
+        foreach ($seat as $k => $v) {
+        	$v = Dever::decode($v);
+        	$v = explode('#', $v);
+        	$where['hall'] = $v[1];
+        	$where['seat_row'] = $v[2];
+	        $where['seat_column'] = $v[3];
+			$info = Dever::db('collection/user_seat')->one($where);
+			if (!$info) {
+				$where['uid'] = $uid;
+				Dever::db('collection/user_seat')->insert($where);
+			}
+        }
+		return true;
+	}
+
+	# 获取默认所有座位
+	public function getAll($id, $type, $hall, $my)
+	{
+		# 5行
+		$row = 8;
+		# 15列
+		$column = 15;
+
+		# x轴初始位置
+		$x = 24;
+		# y轴初始位置
+		$y = 3;
+
+		$data = array();
+
+		for($i = 1; $i <= $row ; $i++) {
+			$x = 24;
+			for($j = 1; $j <= $column ; $j++) {
+				$key = $hall . '_' . $i . '_' . $j;
+
+				$info = array
+				(
+					'YCoord' => $y,
+					'XCoord' => $x,
+					'SeatCode' => Dever::encode($id . '#' . $i.'#' . $j),
+					'RowNum' => $i,
+					'Tips' => $type,
+					'ColumnNum' => $j,
+					'Status' => 0, 
+					'User' => array(), 
+					'Id' => 0,
+				);
+
+				if (isset($my[$key])) {
+					$info['Status'] = 2;
+					$info['User'] = $my[$key]['user'];
+					$info['Id'] = $my[$key]['id'];
+				}
+				$data[] = $info;
+				$x--;
+			}
+			$y++;
+		}
+
+		return $data;
+	}
+}

+ 30 - 15
app/collection/lib/User.php

@@ -6,30 +6,45 @@ use Dever;
 
 class User
 {
+	private $user = array();
+
 	# 获取用户信息
 	public function get($user, $id)
 	{
 		if (is_numeric($user)) {
+			if (isset($this->user[$user])) {
+				return $this->user[$user];
+			}
 			$user = Dever::load('passport/api')->info($user);
+		} else {
+			if (isset($this->user[$user['id']])) {
+				return $this->user[$user['id']];
+			}
 		}
 		$result = array();
 		if ($user) {
-			# 获取合集扩展信息
-	        $result = Dever::db('collection/user')->one(array('uid' => $user['id'], 'info_id' => $id));
-	        if (!$result) {
-	        	$result['uid'] = $user['id'];
-	            $result['username'] = $user['username'];
-	            $result['avatar'] = $user['avatar'];
-	            $result['info'] = $user['info'];
-	            $result['sex'] = $user['sex'];
-	            $result['title'] = '';
-	        } else {
-	        	!$result['username'] && $result['username'] = $user['username'];
-	        	!$result['avatar'] && $result['avatar'] = $user['avatar'];
-	        	!$result['info'] && $result['info'] = $user['info'];
-	        	!$result['sex'] && $result['sex'] = $user['sex'];
-	        }
+			if ($id) {
+				# 获取合集扩展信息
+		        $result = Dever::db('collection/user')->one(array('uid' => $user['id'], 'info_id' => $id));
+		        if (!$result) {
+		        	$result['uid'] = $user['id'];
+		            $result['username'] = $user['username'];
+		            $result['avatar'] = $user['avatar'];
+		            $result['info'] = $user['info'];
+		            $result['sex'] = $user['sex'];
+		            $result['title'] = '';
+		        } else {
+		        	!$result['username'] && $result['username'] = $user['username'];
+		        	!$result['avatar'] && $result['avatar'] = $user['avatar'];
+		        	!$result['info'] && $result['info'] = $user['info'];
+		        	!$result['sex'] && $result['sex'] = $user['sex'];
+		        }
+			} else {
+				$result = $user;
+			}
 		}
+
+		$this->user[$user['id']] = $result;
 		
 		return $result;
 	}

+ 24 - 0
app/collection/src/User.php

@@ -88,4 +88,28 @@ class User extends Core
     	$data['chat'] = Dever::load('community/lib/chat')->getUser($this->uid, $this->id);
         return $data;
     }
+
+    # 查看座位
+    public function seat()
+    {
+        $content_id = Dever::input('content_id');
+        $hall = Dever::input('hall', 1);
+
+        $data = Dever::load('collection/lib/seat')->get($this->uid, $this->id, $this->parent_page_id, $this->page_id, $this->times, $this->day, $content_id, $this->index, $hall);
+
+        $data['user'] = $this->user;
+        $data['hall'] = $hall;
+        return $data;
+    }
+
+    # 保存座位
+    public function seatSave()
+    {
+        $content_id = Dever::input('content_id');
+        $seat = Dever::input('seat');
+
+        $data = Dever::load('collection/lib/seat')->save($this->uid, $this->id, $this->parent_page_id, $this->page_id, $this->times, $this->day, $content_id, $this->index, $seat);
+
+        return 'ok';
+    }
 }

+ 1 - 1
app/community/database/cate.php

@@ -98,7 +98,7 @@ return array
 				'state' => 1,
 			),
 			'type' => 'all',
-			'order' => array('id' => 'desc'),
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
 			'col' => '*',
 		),
 	)

+ 18 - 4
app/community/database/comment.php

@@ -65,7 +65,7 @@ return array
 
 		'pic'		=> array
 		(
-			'type' 		=> 'text-255',
+			'type' 		=> 'varchar-2000',
 			'name' 		=> '图片-图片尺寸不等,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
 			'default' 	=> '',
 			'desc' 		=> '图片',
@@ -76,7 +76,7 @@ return array
 
 		'content'		=> array
 		(
-			'type' 		=> 'text-255',
+			'type' 		=> 'varchar-800',
 			'name' 		=> '内容',
 			'update' 	=> 'editor',
 			'key'		=> 1,
@@ -88,6 +88,18 @@ return array
 			//'modal'		=> '查看详情',
 			//'list'		=> 'Dever::load("community/lib/info.content", "{content}", {id})',
 		),
+
+		'playtime'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '播放时间',
+            'default'   => '',
+            'desc'      => '播放时间',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
 		
 		'state'		=> array
 		(
@@ -129,11 +141,13 @@ return array
 				'type' => 'yes',
 				'type_id' => 'yes',
 				'noid' => array('yes-id', '!='),
+				'playtime_start' => array('yes-playtime', '>='),
+				'playtime_end' => array('yes-playtime', '<'),
 				'state' => 1,
 			),
 			'type' => 'all',
-			'order' => array('id' => 'desc'),
-			'page' => array(30, 'list'),
+			'order' => array('playtime' => 'asc', 'id' => 'asc'),
+			'page' => array(1000, 'list'),
 			'col' => '*',
 		),
 	)

+ 154 - 0
app/community/database/tips.php

@@ -0,0 +1,154 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'tips',
+	# 显示给用户看的名称
+	'lang' => '聊天泡泡',
+	# 是否显示在后台菜单
+	'menu' => false,
+	'order' => 80,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'desc',
+			//'list'		=> true,
+		),
+		
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户名',
+			'default' 	=> '0',
+			'desc' 		=> '请选择用户',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+		'type' 		=> array
+		(
+			'type' 		=> 'varchar-50',
+			'name' 		=> '数据源表名',
+			'default' 	=> '',
+			'desc' 		=> '数据源表名',
+			'match' 	=> 'option',
+			'search'	=> 'select',
+			'update'	=> 'text',
+			'list'		=> true,
+		),
+		
+		'type_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '数据源id',
+			'default' 	=> '',
+			'desc' 		=> '数据源id',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+		),
+
+		'pic'		=> array
+		(
+			'type' 		=> 'varchar-2000',
+			'name' 		=> '图片-图片尺寸不等,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '图片',
+			'match' 	=> 'is_string',
+			'update'	=> 'images',
+			'key' 		=> '1',
+		),
+
+		'content'		=> array
+		(
+			'type' 		=> 'varchar-800',
+			'name' 		=> '内容',
+			'update' 	=> 'editor',
+			'key'		=> 1,
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'search'	=> 'fulltext',
+			//'list'		=> 'table',
+			//'modal'		=> '查看详情',
+			//'list'		=> 'Dever::load("community/lib/info.content", "{content}", {id})',
+		),
+
+		'playtime'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '播放时间',
+            'default'   => '',
+            'desc'      => '播放时间',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'search'	=> 'date',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+		//'insert' => false,
+		//'edit' => false,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'type' => 'yes',
+				'type_id' => 'yes',
+				'noid' => array('yes-id', '!='),
+				'playtime_start' => array('yes-playtime', '>='),
+				'playtime_end' => array('yes-playtime', '<'),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('playtime' => 'asc', 'id' => 'asc'),
+			'page' => array(1000, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 5 - 1
app/community/lib/Comment.php

@@ -17,6 +17,7 @@ class Comment
             foreach ($info as $k => $v) {
             	$data['info'][$k]['uid'] = $v['uid'];
                 $data['info'][$k]['content'] = $v['content'];
+                $data['info'][$k]['playtime'] = $v['playtime'];
                 if ($v['pic']) {
                     $data['info'][$k]['pic'] = explode(',', $v['pic']);
                 }
@@ -31,7 +32,7 @@ class Comment
     }
 
     # 发表信息
-    public function submit($uid, $id, $type, $pic, $content, $score_type = false, $score_type_id = false)
+    public function submit($uid, $id, $type, $pic, $content, $playtime, $score_type = false, $score_type_id = false)
     {
         # 如果是商品,要先验证是否购买
         if ($type == 'content/product') {
@@ -44,6 +45,9 @@ class Comment
         if ($pic) {
             $where['pic'] = $pic;
         }
+        if ($playtime) {
+            $where['playtime'] = $playtime;
+        }
         $table = 'community/comment';
         $info = false;
         if (!$info) {

+ 60 - 0
app/community/lib/Tips.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace Community\Lib;
+
+use Dever;
+
+class Tips
+{
+    public function getData($method = 'getAll', $uid, $type = false, $type_id = false, $user = false, $collection_id = false)
+    {
+        $where['type'] = $type;
+        $info = Dever::db('community/tips')->$method($where);
+        $data['info'] = array();
+        $data['total'] = Dever::total();
+        if ($info) {
+        	$temp = array();
+            foreach ($info as $k => $v) {
+            	$temp['type'] = $v['type'];
+            	$temp['type_id'] = $v['type_id'];
+            	$temp['uid'] = $v['uid'];
+                $temp['content'] = $v['content'];
+                $temp['playtime'] = $v['playtime'];
+                if ($v['pic']) {
+                    $temp['pic'] = explode(',', $v['pic']);
+                }
+                if ($user) {
+                    $temp['user'] = Dever::load('collection/lib/user')->get($v['uid'], $collection_id);
+                    $temp['cdate_string'] = Dever::mdate($v['cdate'], 2);
+                }
+
+                $data['info'][$v['playtime']][] = $temp;
+            }
+        }
+
+        return $data;
+    }
+
+    # 发表信息
+    public function submit($uid, $id, $type, $pic, $content, $playtime, $score_type = false, $score_type_id = false)
+    {
+        $where['uid'] = $uid;
+        $where['type_id'] = $id;
+        $where['type'] = $type;
+        $where['content'] = $content;
+        if ($pic) {
+            $where['pic'] = $pic;
+        }
+        if ($playtime) {
+            $where['playtime'] = $playtime;
+        }
+        $table = 'community/tips';
+        $info = false;
+        if (!$info) {
+            Dever::db($table)->insert($where);
+            Dever::score($uid, 'submit_tips', '发布聊天泡泡', false, false, false, $score_type, $score_type_id);
+        }
+
+        return true;
+    }
+}

+ 59 - 2
app/community/src/Api.php

@@ -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';
     }

+ 6 - 0
app/community/src/Chat.php

@@ -36,6 +36,12 @@ class Chat extends Core
 		return 'ok';
 	}
 
+	# 加入分组
+	public function joinGroup()
+	{
+		
+	}
+
 	# 发送消息
 	public function send()
 	{

+ 31 - 0
app/content/database/audio_comment.php

@@ -2,6 +2,12 @@
 
 $status = Dever::config('base')->status;
 
+$type = array
+(
+    1 => '座位',
+    2 => '弹幕',
+);
+
 return array
 (
     # 表名
@@ -66,6 +72,31 @@ return array
             'preview'   => true,
         ),
 
+        'title'     => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '发布窗口标题',
+            'default'   => '',
+            'desc'      => '发布窗口标题',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+            'search'    => 'fulltext',
+            //增加预览
+            'preview'   => true,
+        ),
+
+        'type'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '交流方式',
+            'default'   => '1',
+            'desc'      => '交流方式',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+        ),
+
         'desc'      => array
         (
             'type'      => 'varchar-500',

+ 31 - 0
app/content/database/live.php

@@ -2,6 +2,12 @@
 
 $status = Dever::config('base')->status;
 
+$type = array
+(
+    1 => '座位',
+    2 => '弹幕',
+);
+
 return array
 (
 	# 表名
@@ -66,6 +72,31 @@ return array
             'preview'   => true,
         ),
 
+        'title'     => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '发布窗口标题',
+            'default'   => '',
+            'desc'      => '发布窗口标题',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+            'search'    => 'fulltext',
+            //增加预览
+            'preview'   => true,
+        ),
+
+        'type'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '交流方式',
+            'default'   => '1',
+            'desc'      => '交流方式',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+        ),
+
         'desc'      => array
         (
             'type'      => 'varchar-500',

+ 31 - 0
app/content/database/video_comment.php

@@ -2,6 +2,12 @@
 
 $status = Dever::config('base')->status;
 
+$type = array
+(
+	1 => '座位',
+	2 => '弹幕',
+);
+
 return array
 (
 	# 表名
@@ -66,6 +72,31 @@ return array
 			'preview'	=> true,
 		),
 
+		'title'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '发布窗口标题',
+			'default' 	=> '',
+			'desc' 		=> '发布窗口标题',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'list'		=> true,
+			'search'	=> 'fulltext',
+			//增加预览
+			'preview'	=> true,
+		),
+
+		'type'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '交流方式',
+            'default'   => '1',
+            'desc'      => '交流方式',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+        ),
+
 		'desc'		=> array
 		(
 			'type' 		=> 'varchar-500',