dever 6 years ago
parent
commit
ec81f323e1

+ 7 - 4
content/database/article.php

@@ -48,6 +48,9 @@ $share = array
 	2 => '不显示',
 );
 
+# 常用的col
+$col = 'id,cate_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';
+
 return array
 (
 	# 表名
@@ -476,7 +479,7 @@ return array
 			'type' => 'all',
 			'order' => array('reorder' => 'desc','id' => 'desc'),
 			'page' => array($page, 'list'),
-			'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',
+			'col' => $col,
 		),
 
 		'getRelation' => array
@@ -486,13 +489,13 @@ return array
 			(
 				'cate_id' => 'yes',
 				'cate_ids' => array('yes-cate_id', 'in'),
-				'noid' => array('yes', '!='),
+				'noid' => array('yes-id', '!='),
 				'state' => 1,
 			),
 			'type' => 'all',
 			'order' => array('reorder' => 'desc','id' => 'desc'),
 			'limit' => '0,4',
-			'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',
+			'col' => $col,
 		),
 
 		'getOne' => array
@@ -503,7 +506,7 @@ return array
 				'id' => 'yes',
 			),
 			'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',
+			'col' => $col,
 		),
 		
 		# 更新浏览量

+ 26 - 1
content/lib/Article.php

@@ -19,16 +19,41 @@ class Article
     
         //embed
         $data['content_array'] = array();
+
+        /*
         if (strstr($data['content'], 'embed')) {
             //print_r($data['content']);die;
+            # 音频
             preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $data['content'], $matches);
             if (isset($matches[1])) {
                 foreach ($matches[1] as $k => $v) {
 
                 }
             }
-            //print_r($matches);die;
+            print_r($matches);die;
+        }
+
+        if (strstr($data['content'], 'dever-video')) {
+            # 视频
+            //print_r($data['content']);die;
+            preg_match_all('/<div class="dever-video">([\s\S]*?)<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>([\s\S]*?)<\/div>/i', $data['content'], $matches);
+            if (isset($matches[3][0]) && isset($matches[4][0])) {
+                foreach ($matches[3] as $k => $v) {
+                    $data['content'] = str_replace($matches[0][$k], '{replace}', $data['content']);
+                }
+            }
+
+            $data['content'] = preg_replace('/<div class="dever-drop">([\s\S]*?)<\/div>/i', '', $data['content']);
+            //$data['content'] = preg_replace('/<p>([\s\S]*?){replace}([\s\S]*?)<\/p>/i', '', $data['content']);
+            print_r($data['content']);die;
+            
+
+            echo $data['content'];
+            $content = explode('{replace}', $data['content']);
+            print_r($content);
+            print_r($matches);die;
         }
+        */
 
         
         return $data;

+ 7 - 1
data/compile/wonderful/manage/layadmin/inc/script.cmp.php

@@ -35,8 +35,14 @@
 <script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/ui/ui.min.js"></script>
 
 
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/qiniu/upload/plupload.full.min.js"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/qiniu/qiniu.upload.js"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/tool/md5.js"></script>
+
+
 <script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/layui/upload.js?v1"></script>
 <script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/layui/layui.js"></script>
 
 
-<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/manage/main.js?v7"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/manage/main.js?v10"></script>

+ 9 - 0
push/lib/Data.php

@@ -52,6 +52,10 @@ class Data
                 $id = $info['journal_id'];
             }
 
+            unset($info['article_id']);
+            unset($info['vod_id']);
+            unset($info['live_id']);
+            unset($info['journal_id']);
             if ($id > 0) {
                 $info['id'] = $id;
                 $data = Dever::db($table)->one($id);
@@ -71,6 +75,11 @@ class Data
                     }
                 }
             }
+        } else {
+            unset($info['article_id']);
+            unset($info['vod_id']);
+            unset($info['live_id']);
+            unset($info['journal_id']);
         }
 
         $info['cdate'] = date('Y-m-d', $info['cdate']);

+ 6 - 4
video/database/live.php

@@ -44,6 +44,8 @@ $share = array
 	2 => '不显示',
 );
 
+$col = 'id,name,pic_cover,pdate,num_add_user,num_user,num_add_view,num_view,num_up,num_add_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,url_m3u8,url_mp4,cate_id,stream_id';
+
 return array
 (
 	# 表名
@@ -494,7 +496,7 @@ return array
 			'type' => 'all',
 			'order' => array('id' => 'desc'),
 			'page' => array($page, 'list'),
-			'col' => 'id,name,pic_cover,pdate,num_add_user,num_user,num_add_view,num_view,num_up,num_add_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,url_m3u8,url_mp4',
+			'col' => $col,
 		),
 
 		'getRelation' => array
@@ -504,13 +506,13 @@ return array
 			(
 				'cate_id' => 'yes',
 				'cate_ids' => array('yes-cate_id', 'in'),
-				'noid' => array('yes', '!='),
+				'noid' => array('yes-id', '!='),
 				'state' => 1,
 			),
 			'type' => 'all',
 			'order' => array('reorder' => 'desc','id' => 'desc'),
 			'limit' => '0,4',
-			'col' => 'id,name,pic_cover,pdate,num_add_user,num_user,num_add_view,num_view,num_up,num_add_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,url_m3u8,url_mp4',
+			'col' => $col,
 		),
 
 		'getOne' => array
@@ -521,7 +523,7 @@ return array
 				'id' => 'yes',
 			),
 			'type' => 'one',
-			'col' => 'id,name,pic_cover,pdate,num_add_user,num_user,num_add_view,num_view,num_up,num_add_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,url_m3u8,url_mp4',
+			'col' => $col,
 		),
 		
 		# 更新浏览量

+ 6 - 4
video/database/vod.php

@@ -42,6 +42,8 @@ $share = array
 	2 => '不显示',
 );
 
+$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,cate_id';
+
 return array
 (
 	# 表名
@@ -450,7 +452,7 @@ return array
 			'type' => 'all',
 			'order' => array('id' => 'desc'),
 			'page' => array($page, 'list'),
-			'col' => '*',
+			'col' => $col,
 		),
 
 		'getRelation' => array
@@ -460,13 +462,13 @@ return array
 			(
 				'cate_id' => 'yes',
 				'cate_ids' => array('yes-cate_id', 'in'),
-				'noid' => array('yes', '!='),
+				'noid' => array('yes-id', '!='),
 				'state' => 1,
 			),
 			'type' => 'all',
 			'order' => array('reorder' => 'desc','id' => 'desc'),
 			'limit' => '0,4',
-			'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',
+			'col' => $col,
 		),
 
 		'getOne' => array
@@ -477,7 +479,7 @@ return array
 				'id' => 'yes',
 			),
 			'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',
+			'col' => $col,
 		),
 
 		

+ 19 - 1
video/lib/Live.php

@@ -17,8 +17,26 @@ class Live
         }
     
         //embed
-
+        $time = time();
+        if ($data['sdate'] <= $time && $time <= $data['edate']) {
+            $stream = Dever::db('live/stream')->one($data['stream_id']);
+            $data['stream'] = $stream['live'];
+        }
         
         return $data;
     }
+
+    # 获取相关推荐
+    public function getRelation($info)
+    {
+        $where['noid'] = $info['id'];
+        $where['cate_id'] = $info['cate_id'];
+        return Dever::db('video/live')->getRelation($where);
+    }
+
+    # 增加浏览量
+    public function addView($id)
+    {
+        Dever::db('video/live')->addView($id);
+    }
 }

+ 15 - 0
video/lib/Vod.php

@@ -21,4 +21,19 @@ class Vod
         
         return $data;
     }
+
+
+    # 获取相关推荐
+    public function getRelation($info)
+    {
+        $where['noid'] = $info['id'];
+        $where['cate_id'] = $info['cate_id'];
+        return Dever::db('video/vod')->getRelation($where);
+    }
+
+    # 增加浏览量
+    public function addView($id)
+    {
+        Dever::db('video/vod')->addView($id);
+    }
 }