dever 4 years ago
parent
commit
c6c84755b8

+ 1 - 1
app/collection/database/content.php

@@ -188,7 +188,7 @@ return array
             ),
             'type' => 'all',
             'order' => array('reorder' => 'asc', 'id' => 'desc'),
-            'page' => array(10, 'list'),
+            'page' => array(30, 'list'),
             'col' => 'id,type,name,pic,info_id,page_id',
         ),
 

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

@@ -1,20 +1,5 @@
 <?php
 
-$table = Dever::config('base')->table;
-$table_name = Dever::config('base')->table_name;
-
-$cate = function()
-{
-	$array = array();
-	$info = Dever::load('attr/cate-state');
-	if($info)
-	{
-		$array += $info;
-	}
-	return $array;
-};
-
-
 return array
 (
 	# 表名
@@ -58,14 +43,13 @@ return array
 
 		'type' 		=> array
 		(
-			'type' 		=> 'tinyint-1',
-			'name' 		=> '所属数据源',
+			'type' 		=> 'varchar-50',
+			'name' 		=> '数据源表名',
 			'default' 	=> '',
-			'desc' 		=> '所属数据源',
+			'desc' 		=> '数据源表名',
 			'match' 	=> 'option',
-			'option' 	=> $table,
 			'search'	=> 'select',
-			'update'	=> 'select',
+			'update'	=> 'text',
 			'list'		=> true,
 		),
 		

+ 2 - 9
app/community/lib/Comment.php

@@ -6,18 +6,12 @@ use Dever;
 
 class Comment
 {
-    private function table($type)
-    {
-        $table = Dever::db('community/comment')->config['set']['table_name'][$type];
-        return $table;
-    }
-
     public function getData($method = 'getAll', $uid, $type = false, $type_id = false)
     {
         $where['type'] = $type;
         $where['type_id'] = $type_id;
         $info = Dever::db('community/comment')->$method($where);
-        $data['info'] = $info;
+        $data['info'] = array();
         $data['total'] = Dever::total();
         if ($info) {
             foreach ($info as $k => $v) {
@@ -30,7 +24,7 @@ class Comment
     }
 
     # 发表信息
-    public function submit($uid, $id, $type, $pic, $content, $to_id, $to_uid)
+    public function submit($uid, $id, $type, $content)
     {
         $where['uid'] = $uid;
         $where['type_id'] = $id;
@@ -38,7 +32,6 @@ class Comment
         $where['content'] = $content;
         $table = 'community/comment';
         $info = false;
-        $data_table = $this->table($type);
         if (!$info) {
             Dever::db($table)->insert($where);
             Dever::score($uid, 'submit_comment', '发布弹幕');

+ 3 - 0
app/community/lib/Info.php

@@ -87,12 +87,15 @@ class Info
             Dever::score($uid, 'submit_community', '发表帖子');
 
             # 更新评论数
+            /*
             $where = array();
             $where['type_id'] = $id;
             $where['type'] = $type;
             $where['state'] = 1;
             $total = Dever::db($table)->total($where);
+            echo $data_table;die;
             Dever::db($data_table)->update(array('where_id' => $id, 'num_comment' => $total));
+            */
         }
 
         return true;

+ 22 - 0
app/community/src/Api.php

@@ -42,6 +42,28 @@ class Api
         return $data;
     }
 
+    # 发布弹幕、评论
+    public function addComment()
+    {
+        $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('错误的信息');
+        }
+        
+        Dever::load('community/lib/comment')->submit($this->uid, $type_id, $type, $content);
+
+        return 'yes';
+    }
+
     # 发布信息
     public function add()
     {

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

@@ -114,6 +114,17 @@ return array
             'match'     => 'is_string',
         ),
 
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容',
+            'default'   => '',
+            'desc'      => '请输入内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'key'       => '1',
+        ),
+
         'udate'     => array
         (
             'type'      => 'int-11',

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

@@ -115,6 +115,17 @@ return array
             'cover'     => 2,   
         ),
 
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容',
+            'default'   => '',
+            'desc'      => '请输入内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'key'       => '1',
+        ),
+
         'udate'     => array
         (
             'type'      => 'int-11',

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

@@ -114,6 +114,17 @@ return array
             'match'     => 'is_string',
         ),
 
+        'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '内容',
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'update'	=> 'editor',
+			'key'		=> '1',
+		),
+
 		'udate'		=> array
 		(
 			'type' 		=> 'int-11',