dever 3 years ago
parent
commit
b107f8d702
3 changed files with 15 additions and 8 deletions
  1. 1 1
      database/data.php
  2. 6 6
      lib/Core.php
  3. 8 1
      src/Api.php

+ 1 - 1
database/data.php

@@ -118,7 +118,7 @@ return array
 			),
 			'type' => 'all',
 			'order' => array('cdate' => 'desc'),
-			'page' => array(10, 'list'),
+			'page' => array(12, 'list'),
 			'col' => '*',
 		)
 	)

+ 6 - 6
lib/Core.php

@@ -35,12 +35,12 @@ class Core
                 }
 
                 if ($tag_id > 0) {
-                     $tag_data = array
-                     (
-                         'tag_id' => $tag_id,
-                         'source_table' => $source_table,
-                         'source_id' => $id,
-                     );
+                    $tag_data = array
+                    (
+                        'tag_id' => $tag_id,
+                        'type' => $source_table,
+                        'type_id' => $id,
+                    );
                     $data_info = Dever::db('tag/data')->one($tag_data);
 
                     if (!$data_info) {

+ 8 - 1
src/Api.php

@@ -44,7 +44,7 @@ class Api
 
 	public function tag($type_id, $type)
 	{
-		$result = Dever::db('tag/data')->state(array('type_id' => $type_id,'type' => $type));
+		$result = Dever::db('tag/data')->select(array('type_id' => $type_id,'type' => $type));
 		if (!$result) {
 			return array();
 		}
@@ -65,4 +65,11 @@ class Api
 	{
 		return Dever::db('tag/info')->getList();
 	}
+
+	# 根据标签id获取标签数据
+	public function getData($id)
+	{
+		$where['tag_id'] = $id;
+		return Dever::db('tag/data')->getAll($where);
+	}
 }