dever 6 년 전
부모
커밋
a59990a0cc

+ 3 - 3
act/database/comment.php

@@ -43,7 +43,7 @@ return array
 			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
 		),
 
-		'source_table' 		=> array
+		'type' 		=> array
 		(
 			'type' 		=> 'tinyint-1',
 			'name' 		=> '评论类别',
@@ -54,14 +54,14 @@ return array
 			'list'		=> true,
 		),
 		
-		'source_id' 		=> array
+		'data_id' 		=> array
 		(
 			'type' 		=> 'int-11',
 			'name' 		=> '标题',
 			'default' 	=> '',
 			'desc' 		=> '标题',
 			'match' 	=> 'option',
-			'list'		=> 'Dever::load("act/lib/manage.load", "{source_table}", {source_id})',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
 		),
 		
 		'content'		=> array

+ 5 - 5
act/database/like.php

@@ -42,25 +42,25 @@ return array
 			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
 		),
 
-		'source_table' 		=> array
+		'type' 		=> array
 		(
 			'type' 		=> 'tinyint-1',
-			'name' 		=> '类别',
+			'name' 		=> '评论类别',
 			'default' 	=> '',
-			'desc' 		=> '类别',
+			'desc' 		=> '评论类别',
 			'match' 	=> 'option',
 			'option' 	=> $table,
 			'list'		=> true,
 		),
 		
-		'source_id' 		=> array
+		'data_id' 		=> array
 		(
 			'type' 		=> 'int-11',
 			'name' 		=> '标题',
 			'default' 	=> '',
 			'desc' 		=> '标题',
 			'match' 	=> 'option',
-			'list'		=> 'Dever::load("act/lib/manage.load", "{source_table}", {source_id})',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
 		),
 		
 		'content'		=> array

+ 3 - 3
act/database/live_comment.php

@@ -45,7 +45,7 @@ return array
 			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
 		),
 
-		'source_table' 		=> array
+		'type' 		=> array
 		(
 			'type' 		=> 'tinyint-1',
 			'name' 		=> '评论类别',
@@ -56,14 +56,14 @@ return array
 			'list'		=> true,
 		),
 		
-		'source_id' 		=> array
+		'data_id' 		=> array
 		(
 			'type' 		=> 'int-11',
 			'name' 		=> '标题',
 			'default' 	=> '',
 			'desc' 		=> '标题',
 			'match' 	=> 'option',
-			'list'		=> 'Dever::load("act/lib/manage.load", "{source_table}", {source_id})',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
 		),
 		
 		'content'		=> array

+ 5 - 5
act/database/share.php

@@ -42,25 +42,25 @@ return array
 			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
 		),
 
-		'source_table' 		=> array
+		'type' 		=> array
 		(
 			'type' 		=> 'tinyint-1',
-			'name' 		=> '类别',
+			'name' 		=> '评论类别',
 			'default' 	=> '',
-			'desc' 		=> '类别',
+			'desc' 		=> '评论类别',
 			'match' 	=> 'option',
 			'option' 	=> $table,
 			'list'		=> true,
 		),
 		
-		'source_id' 		=> array
+		'data_id' 		=> array
 		(
 			'type' 		=> 'int-11',
 			'name' 		=> '标题',
 			'default' 	=> '',
 			'desc' 		=> '标题',
 			'match' 	=> 'option',
-			'list'		=> 'Dever::load("act/lib/manage.load", "{source_table}", {source_id})',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
 		),
 		
 		'content'		=> array

+ 5 - 6
act/database/share_reflux.php

@@ -43,27 +43,26 @@ return array
         ),
 
 
-        'source_table'      => array
+        'type'      => array
         (
             'type'      => 'tinyint-1',
-            'name'      => '类别',
+            'name'      => '评论类别',
             'default'   => '',
-            'desc'      => '类别',
+            'desc'      => '评论类别',
             'match'     => 'option',
             'option'    => $table,
             'list'      => true,
         ),
         
-        'source_id'         => array
+        'data_id'       => array
         (
             'type'      => 'int-11',
             'name'      => '标题',
             'default'   => '',
             'desc'      => '标题',
             'match'     => 'option',
-            'list'      => 'Dever::load("act/lib/manage.load", "{source_table}", {source_id})',
+            'list'      => 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
         ),
-        
 
         'uid'       => array
         (

+ 5 - 57
content/database/article.php

@@ -471,68 +471,16 @@ return array
 			'col' => '*',
 		),
 
-		# 获取默认主题,按照置顶和时间排序的
-		'default' => array
+		'getOne' => array
 		(
 			# 匹配的正则或函数 选填项
-			'option' => array
-			(
-				'cate_id' => 'yes',
-				'uid' => 'yes',
-			),
-			'type' => 'all',
-			'order' => array('id' => 'desc'),
-			'page' => array($page, 'list'),
-			'col' => '*',
-		),
-
-		# 获取最新主题
-		'new' => array
-		(
-			# 匹配的正则或函数 选填项
-			'option' => array
-			(
-				'name' => array('yes', 'like'),
-				'cate_id' => 'yes',
-				'uid' => 'yes',
-			),
-			'type' => 'all',
-			'order' => array('id', 'desc'),
-			'page' => array($page, 'list'),
-			'col' => '*',
-		),
-		
-		# 获取热门主题
-		'hot' => array
-		(
-			# 匹配的正则或函数 选填项
-			'option' => array
-			(
-				'cate_id' => 'yes',
-				'uid' => 'yes',
-			),
-			'type' => 'all',
-			'order' => array('num_view`+`num_add_view' => 'desc', 'id' => 'desc'),
-			'page' => array($page, 'list'),
-			'col' => '*',
-		),
-
-		# 获取冷门主题
-		'cold' => array
-		(
-			# 匹配的正则或函数 选填项
-			'option' => array
+			'where' => array
 			(
-				'cate_id' => 'yes',
-				'uid' => 'yes',
+				'id' => 'yes',
 			),
-			'type' => 'all',
-			'order' => array('num_view`+`num_add_view' => 'asc', 'id' => 'desc'),
-			'page' => array($page, 'list'),
-			'col' => '*',
+			'type' => 'one',
+			'col' => 'id,name,pic_cover,pdate,num_add_view,num_view,num_up,num_add_up,num_comment,share_yes,share_title,share_pic,share_content,function,content',
 		),
-
-
 		
 		# 更新浏览量
 		'addView' => array

+ 1 - 1
content/lib/Article.php

@@ -10,7 +10,7 @@ class Article
     public function get($data)
     {
         if (!is_array($data)) {
-            $data = Dever::db('content/article')->one($data);
+            $data = Dever::db('content/article')->getOne($data);
         }
         
         if (!$data) {

+ 122 - 5
doc/apidoc.php

@@ -154,7 +154,7 @@
 /**
  * @api {get} wonderful/main/?l=content.home 获取首页数据
  * @apiVersion 1.0.0
- * @apiName api.home
+ * @apiName content.home
  * @apiGroup Content
  *
  * @apiDescription 获取首页数据
@@ -184,11 +184,128 @@
 
  * @apiSuccess {Object[]} push_up 栏目,字段同上
 
- * @apiSuccess {Object[]} news 更多数据
- * @apiSuccess {String}   news.id id的值
+ * @apiSuccess {Object[]} news 更多图文等数据
+ * @apiSuccess {String}   news.id 图文id
  * @apiSuccess {String}   news.name 名称
- * @apiSuccess {String}   news.pic 图片
- * @apiSuccess {String}   news.type 类型,参考公共参数中的类型设置说明中的type说明
+ * @apiSuccess {String}   news.pic_cover 图片
+ * @apiSuccess {String}   news.type 类型,参考公共参数中的类型设置说明中的type说明,根据它生成path
+ * @apiSuccess {String}   news.pdate 时间
+ * @apiSuccess {String}   news.num_view 浏览量
+ * @apiSuccess {String}   news.num_up 点赞量
+ * @apiSuccess {String}   news.num_comment 评论量
+ * @apiSuccess {String}   news.num_ding 订阅量
+ * @apiSuccess {String}   news.num_user 在线人数
+ * @apiSuccess {String}   news.share_yes 是否显示分享按钮 1显示 2不显示
+ * @apiSuccess {String}   news.share_title 分享标题
+ * @apiSuccess {String}   news.share_pic 分享图片
+ * @apiSuccess {String}   news.share_content 分享内容
+
+ */
+
+
+/**
+ * @api {get} wonderful/main/?l=content.up 精选推荐更多
+ * @apiVersion 1.0.0
+ * @apiName content.up
+ * @apiGroup Content
+ *
+ * @apiDescription 精选推荐更多
+ *
+ * @apiParam {String} signature signature
+ *
+ *
+ * @apiSuccess {Object[]} push_up 栏目,字段同上
+ * @apiSuccess {String}   push_up.name 名称
+ * @apiSuccess {String}   push_up.pic 图片
+ * @apiSuccess {String}   push_up.type 类型,参考公共参数中的类型设置说明中的type说明
+ * @apiSuccess {String}   push_up.id 源表id,根据type计算路径,然后把这个source_id加上就是最终的path,小程序和app同样。
+ * @apiSuccess {String}   push_up.link 当type==10时有效,链接
+ * @apiSuccess {String}   push_up.cdate 时间
+
+ */
+
+
+/**
+ * @api {get} wonderful/main/?l=content.news 精选页图文内容下拉更多
+ * @apiVersion 1.0.0
+ * @apiName content.news
+ * @apiGroup Content
+ *
+ * @apiDescription 精选页图文内容下拉更多
+ *
+ * @apiParam {String} signature signature
+ *
+ * @apiSuccess {Object[]} news 更多图文等数据
+ * @apiSuccess {String}   news.id 图文id
+ * @apiSuccess {String}   news.name 名称
+ * @apiSuccess {String}   news.pic_cover 图片
+ * @apiSuccess {String}   news.type 类型,参考公共参数中的类型设置说明中的type说明,根据它生成path
+ * @apiSuccess {String}   news.pdate 时间
+ * @apiSuccess {String}   news.num_view 浏览量
+ * @apiSuccess {String}   news.num_up 点赞量
+ * @apiSuccess {String}   news.num_comment 评论量
+ * @apiSuccess {String}   news.num_ding 订阅量
+ * @apiSuccess {String}   news.num_user 在线人数
+ * @apiSuccess {String}   news.share_yes 是否显示分享按钮 1显示 2不显示
+ * @apiSuccess {String}   news.share_title 分享标题
+ * @apiSuccess {String}   news.share_pic 分享图片
+ * @apiSuccess {String}   news.share_content 分享内容
+ */
 
 
+/**
+ * @api {get} wonderful/main/?l=view.article 查看图文内容
+ * @apiVersion 1.0.0
+ * @apiName view.article
+ * @apiGroup Content
+ *
+ * @apiDescription 查看图文内容
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 图文id
+ *
+ * @apiSuccess {Object[]} info 更多图文等数据
+ * @apiSuccess {String}   info.id 
+ * @apiSuccess {String}   info.name 名称
+ * @apiSuccess {String}   info.pic_cover 图片
+ * @apiSuccess {String}   info.type 类型,参考公共参数中的类型设置说明中的type说明,根据它生成path
+ * @apiSuccess {String}   info.pdate 时间
+ * @apiSuccess {String}   info.num_view 浏览量
+ * @apiSuccess {String}   info.num_up 点赞量
+ * @apiSuccess {String}   info.num_comment 评论量
+ * @apiSuccess {String}   info.share_yes 是否显示分享按钮 1显示 2不显示
+ * @apiSuccess {String}   info.share_title 分享标题
+ * @apiSuccess {String}   info.share_pic 分享图片
+ * @apiSuccess {String}   info.share_content 分享内容
+ * @apiSuccess {String}   info.function 开启的功能,这是一个字符串,用逗号隔开的,1代表显示浏览量,2代表显示评论,3代表显示喜欢,4代表显示邀请阅读,如值为1,2,3,则显示浏览量、评论、喜欢,不显示邀请阅读
+ * @apiSuccess {String}   info.content 内容
+ * @apiSuccess {String}   info.content_array 数组内容,请使用该字段循环
+ */
+
+/**
+ * @api {get} wonderful/main/?l=view.vod 查看视频内容
+ * @apiVersion 1.0.0
+ * @apiName view.vod
+ * @apiGroup Content
+ *
+ * @apiDescription 查看视频内容
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 视频id
+ *
+ * @apiSuccess {Object[]} info 更多图文等数据
+ * @apiSuccess {String}   info.id 
+ * @apiSuccess {String}   info.name 名称
+ * @apiSuccess {String}   info.pic_cover 图片
+ * @apiSuccess {String}   info.type 类型,参考公共参数中的类型设置说明中的type说明,根据它生成path
+ * @apiSuccess {String}   info.pdate 时间
+ * @apiSuccess {String}   info.num_view 浏览量
+ * @apiSuccess {String}   info.num_up 点赞量
+ * @apiSuccess {String}   info.num_comment 评论量
+ * @apiSuccess {String}   info.share_yes 是否显示分享按钮 1显示 2不显示
+ * @apiSuccess {String}   info.share_title 分享标题
+ * @apiSuccess {String}   info.share_pic 分享图片
+ * @apiSuccess {String}   info.share_content 分享内容
+ * @apiSuccess {String}   info.function 开启的功能,这是一个字符串,用逗号隔开的,1代表显示浏览量,2代表显示评论,3代表显示喜欢,4代表显示邀请阅读,如值为1,2,3,则显示浏览量、评论、喜欢,不显示邀请阅读
+ * @apiSuccess {String}   info.content 内容
  */

+ 54 - 0
main/lib/Core.php

@@ -17,6 +17,60 @@ class Core
         $this->data['config'] = Dever::db('main/config')->one();
     }
 
+    # 根据类型,解析内容
+    protected function content($data, $content = false)
+    {
+        $type = $id = false;
+        if (isset($data['type']) && isset($data['data_id'])) {
+            $type = $data['type'];
+            $id = $data['data_id'];
+        }
+
+        if ($type && $id) {
+            $table = Dever::config('base')->type_table[$type];
+            $info = Dever::db($table)->getOne($id);
+            if ($info) {
+                $info['type'] = $type;
+                $info['data_id'] = $info['id'];
+                if (isset($info['content']) && !$content) {
+                    unset($info['content']);
+                }
+                if (isset($info['pdate']) && $info['pdate'] > 0) {
+                } else {
+                    $info['pdate'] = time();
+                }
+                $info['pdate'] = date('Y-m-d', $info['pdate']);
+
+                if (isset($info['num_add_view']) && isset($info['num_view'])) {
+                    $info['num_view'] = $info['num_add_view'] + $info['num_view'];
+                    unset($info['num_add_view']);
+                }
+                if (isset($info['num_add_up']) && isset($info['num_up'])) {
+                    $info['num_up'] = $info['num_add_up'] + $info['num_up'];
+                    unset($info['num_add_up']);
+                }
+                if (isset($info['num_add_user']) && isset($info['num_user'])) {
+                    $info['num_user'] = $info['num_add_user'] + $info['num_user'];
+                    unset($info['num_add_user']);
+                }
+                if (isset($info['num_add_user']) && isset($info['num_user'])) {
+                    $info['num_user'] = $info['num_add_user'] + $info['num_user'];
+                    unset($info['num_add_user']);
+                }
+                if (isset($info['num_add_ding']) && isset($info['num_ding'])) {
+                    $info['num_ding'] = $info['num_add_ding'] + $info['num_ding'];
+                    unset($info['num_add_ding']);
+                }
+
+                return $info;
+            } else {
+                return (object) array();
+            }
+            
+        }
+        return (object) array();
+    }
+
     protected function log()
     {
         $input = Dever::json_encode(Dever::input());

+ 20 - 6
main/src/Content.php

@@ -25,20 +25,34 @@ class Content extends Core
         # 精选推荐
         $this->data['push_up'] = Dever::load('push/lib/data')->get('up', '精选推荐');
 
-        # 更多 直接从已审核的列表中读取
-        $this->data['news'] = array();
+        $this->news();
 
-        $data = Dever::db('audit/data')->getAll();
+        return $this->data;
+    }
+
+    # 精选推荐更多
+    public function up()
+    {
+    	$this->data['push_up'] = Dever::load('push/lib/data')->get('up', '精选推荐', 10, true);
+
+    	return $this->data;
+    }
+
+    # 下拉更多
+    public function news()
+    {
+    	# 直接从已审核的列表中读取
+    	$this->data['news'] = array();
+    	$data = Dever::db('audit/data')->getAll();
         if ($data) {
             foreach ($data as $k => $v) {
-                
+                $data[$k] = $this->content($v);
             }
+            $this->data['news'] = $data;
         } else {
             $this->data['news'] = (object) array();
         }
 
         return $this->data;
     }
-
-    # 查看详情
 }

+ 16 - 1
push/database/data.php

@@ -273,7 +273,22 @@ return array
             ),
             'type' => 'all',
             'order' => array('reorder' => 'desc', 'id' => 'desc'),
-            //'col' => '*|type|',
+            'limit' => 10,
+            'col' => 'name,pic,olink as link,type,article_id,vod_id,live_id,journal_id,cdate',
+        ),
+
+        # 获取列表页 带有分页的
+        'getAllPage' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'page' => array(10, 'list'),
             'col' => 'name,pic,olink as link,type,article_id,vod_id,live_id,journal_id,cdate',
         ),
     ),

+ 8 - 3
push/lib/Data.php

@@ -6,21 +6,26 @@ use Dever;
 
 class Data
 {
-    public function get($key, $name, $num = 10)
+    public function get($key, $name, $total = 10, $page = false)
     {
         $info = Dever::db('push/info')->one(array('key' => $key));
 
         if (!$info) {
             $insert['key'] = $key;
             $insert['name'] = $name;
-            $insert['num'] = $num;
+            $insert['num'] = $total;
             $insert['col'] = '1,3';
             $info['id'] = Dever::db('push/info')->insert($insert);
+            $info['num'] = $insert['num'];
         }
 
         $data = array();
         if ($info) {
-            $data = Dever::db('push/data')->getAll(array('info_id' => $info['id']));
+            if ($page) {
+                $data = Dever::db('push/data')->getAllPage(array('info_id' => $info['id'], 'page' => array($info['num'], 'list')));
+            } else {
+                $data = Dever::db('push/data')->getAll(array('info_id' => $info['id'], 'limit' => $info['num']));
+            }
 
             if ($data) {
                 foreach ($data as $k => $v) {

+ 2 - 2
video/database/live.php

@@ -174,9 +174,9 @@ return array
 		'num_add_view'		=> array
 		(
 			'type' 		=> 'int-11',
-			'name' 		=> '手动增加浏览量pv数',
+			'name' 		=> '浏览量基数',
 			'default' 	=> '0',
-			'desc' 		=> '请填写手动增加浏览量pv',
+			'desc' 		=> '浏览量基数',
 			'match' 	=> 'option',
 			'update'	=> 'text',
 		),

+ 2 - 2
video/database/vod.php

@@ -163,9 +163,9 @@ return array
 		'num_add_view'		=> array
 		(
 			'type' 		=> 'int-11',
-			'name' 		=> '手动增加浏览量pv数',
+			'name' 		=> '浏览量基数',
 			'default' 	=> '0',
-			'desc' 		=> '请填写手动增加浏览量pv',
+			'desc' 		=> '浏览量基数',
 			'match' 	=> 'option',
 			'update'	=> 'text',
 		),