dever 6 years ago
parent
commit
52ed7865a5

+ 11 - 0
content/lib/Article.php

@@ -18,6 +18,17 @@ 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;
+        }
 
         
         return $data;

+ 1 - 41
journal/database/buy_num.php

@@ -7,12 +7,6 @@ $status = array
     2 => '下线',
 );
 
-$type = array
-(
-    1 => '购买',
-    2 => '兑换',
-);
-
 return array
 (
     # 表名
@@ -21,11 +15,6 @@ return array
     'lang' => '购买本数设置',
     'order' => 100,
     'menu' => false,
-    'end' => array
-    (
-        //'update' => 'code/lib/manage.create',
-        //'insert' => 'code/lib/manage.create',
-    ),
     # 数据结构
     'struct' => array
     (
@@ -74,20 +63,6 @@ return array
             'update'    => 'text',
         ),
 
-        'type'      => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '获取方式',
-            'default'   => '1',
-            'desc'      => '获取方式',
-            'match'     => 'is_numeric',
-            'option'    => $type,
-            'search'    => 'select',
-            'update'    => 'checkbox',
-            'list'      => true,
-            'control'   => 'type',
-        ),
-
         'cash'      => array
         (
             'type'      => 'varchar-50',
@@ -96,18 +71,6 @@ return array
             'desc'      => '支付价格',
             'match'     => 'is_string',
             'update'    => 'text',
-            'show'      => 'type=1',
-        ),
-
-        'code'      => array
-        (
-            'type'      => 'varchar-50',
-            'name'      => '兑换码数量-直接填写数字即可,系统将自动生成对应数量的兑换码',
-            'default'   => '',
-            'desc'      => '兑换码数量',
-            'match'     => 'is_string',
-            'update'    => 'text',
-            'show'      => 'type=2',
         ),
 
         'reorder'       => array
@@ -149,10 +112,7 @@ return array
 
     'manage' => array
     (
-        'list_button' => array
-        (
-            'list' => array('兑换码列表', '"code&project=journal&search_option_product_id={info_id}&search_option_product_price_id={id}&oper_parent=buy_num&oper_project=journal"'),
-        ),
+        
     ),
 
 

+ 0 - 143
journal/database/code.php

@@ -1,143 +0,0 @@
-<?php
-
-# 定义几个常用的选项
-$type = array
-(
-	1 => '未领取',
-	2 => '已领取',
-	3 => '已使用',
-);
-
-$product = function()
-{
-	return Dever::db('journal/info')->state();
-};
-
-$product_price = function()
-{
-	return Dever::db('journal/buy')->state();
-};
-
-return array
-(
-	# 表名
-	'name' => 'info',
-	# 显示给用户看的名称
-	'lang' => '兑换码列表',
-	'order' => 10,
-	# 数据结构
-	'struct' => array
-	(
-	
-		'id' 		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> 'ID',
-			'default' 	=> '',
-			'desc' 		=> '',
-			'match' 	=> 'is_numeric',
-			'search'	=> 'order',
-			//'list'		=> true,
-		),
-
-		'product_id'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '小刊',
-			'default' 	=> '',
-			'desc' 		=> '小刊',
-			'match' 	=> 'is_numeric',
-			'update'	=> 'select',
-			'option'	=> $product,
-			'search'	=> 'select',
-			'list'		=> true,
-		),
-
-		'product_price_id'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '小刊价格',
-			'default' 	=> '',
-			'desc' 		=> '小刊价格',
-			'match' 	=> 'is_numeric',
-			//'update'	=> 'select',
-			'option'	=> $product_price,
-			'search'	=> 'select',
-			'list'		=> true,
-		),
-
-		'code'		=> array
-		(
-			'type' 		=> 'varchar-32',
-			'name' 		=> '兑换码',
-			'default' 	=> '',
-			'desc' 		=> '兑换码',
-			'match' 	=> 'is_string',
-			'update'	=> 'text',
-			//'search'	=> 'fulltext',
-			'list'		=> true,
-		),
-
-		'type'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '使用状态',
-			'default' 	=> '1',
-			'desc' 		=> '使用状态',
-			'match' 	=> 'is_numeric',
-			'option' 	=> $type,
-			'search'	=> 'select',
-			'update'	=> 'select',
-			'list'		=> true,
-		),
-
-		'uid'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '用户信息',
-			'default' 	=> '0',
-			'desc' 		=> '用户信息',
-			'match' 	=> 'is_numeric',
-			//'list'		=> 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")',
-		),
-
-		'state'		=> array
-		(
-			'type' 		=> 'tinyint-1',
-			'name' 		=> '状态',
-			'default' 	=> '1',
-			'desc' 		=> '请选择状态',
-			'match' 	=> 'is_numeric',
-		),
-
-		'ldate'		=> array
-		(
-			'type' 		=> 'int-11',
-			'name' 		=> '领取时间',
-			'match' 	=> 'option',
-			'default' 	=> '',
-			'desc' 		=> '',
-			'search'	=> 'date',
-		),
-		
-		'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
-	(
-		'excel'	=> true,
-		'delete' => false,
-		'edit' => false,
-		'insert' => false,
-	),
-);

+ 1 - 1
journal/database/content.php

@@ -109,7 +109,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'select',
             'option'    => $author,
-            'search'    => 'select',
+            //'search'    => 'select',
             'show'      => 'type=3',      
         ),
 

+ 1 - 0
journal/database/content_text.php

@@ -20,6 +20,7 @@ return array
     # 显示给用户看的名称
     'lang' => '内页管理的文字设置',
     'menu' => false,
+    'location' => $location,
     # 数据结构
     'struct' => array
     (

+ 59 - 102
journal/lib/Manage.php

@@ -6,85 +6,6 @@ use Dever;
 
 class Manage
 {
-	/**
-	 * 显示用户信息
-	 *
-	 * @return mixed
-	 */
-	public function showUserInfo($uid, $ldate = false)
-	{
-		if ($uid) {
-			$user = Dever::db('passport/user')->one($uid);
-			if ($user) {
-				$table = array();
-				$table['用户名'] = $user['username'];
-				$table['手机号'] = $user['mobile'];
-				$table['领取时间'] = date('Y-m-d H:i:s', $ldate);
-				return Dever::table($table);
-			}
-		} else {
-			return '';
-		}
-	}
-
-    /**
-	 * 创建兑换码
-	 *
-	 * @return mixed
-	 */
-	public function create($id, $name, $data)
-	{
-		$code = Dever::param('code', $data);
-		$type = Dever::param('type', $data);
-		$product_id = Dever::param('product_id', $data);
-		//$product_id = $id;
-		if (!in_array(2, $type)) {
-			return;
-		}
-
-		$total = Dever::db('journal/code')->total(array('product_id' => $product_id,'product_price_id' => $id, 'type' => 1));
-		if ($code > 0 && $code > $total) {
-			$num = $code - $total;
-
-			for ($i = 0; $i < $num; $i++) {
-				$this->createCode($product_id, $id);
-			}
-		}
-	}
-
-	private function createCode($product_id, $id)
-	{
-		$code = Dever::rand(8, 0);
-		$data['product_id'] = $product_id;
-		$data['product_price_id'] = $id;
-		$data['code'] = $code;
-		$total = Dever::db('journal/code')->total($data);
-		if ($total > 0) {
-			return $this->createCode($product_id, $id);
-		}
-		$data['type'] = 1;
-		Dever::db('code/info')->insert($data);
-		return $code;
-	}
-
-	/**
-	 * 资料审核
-	 *
-	 * @return mixed
-	 */
-	public function info_audit($id, $name, $data)
-	{
-		$info = Dever::db('task/user_info')->one($id);
-		$status = Dever::param('status', $data);
-		$desc = Dever::param('status_desc', $data);
-		if ($info && $status == 3) {
-			$uid = $info['uid'];
-			$name = '用户认证未通过';
-			$content = '原因:' . $desc;
-			Dever::load('message/lib/data.push', -1, $uid, $name, $content, 11);
-		}
-	}
-
 	private function search($table = 'content/article')
 	{
 		$keyword = Dever::input('keyword');
@@ -155,6 +76,29 @@ class Manage
                     $data[$k]['pic'] = $v['focus'];
                 }
 
+                if ($v['type'] == 11) {
+                    # 图文
+                    $info = Dever::load('content/lib/article')->get($v['article_id']);
+                    if ($info) {
+                        $data[$k]['pic'] = $info['pic_cover'];
+                        $data[$k]['name'] = $info['name'];
+                    }
+                } elseif ($v['type'] == 12) {
+                    # 视频
+                    $info = Dever::load('video/lib/vod')->get($v['vod_id']);
+                    if ($info) {
+                        $data[$k]['pic'] = $info['pic_cover'];
+                        $data[$k]['name'] = $info['name'];
+                    }
+                } elseif ($v['type'] == 13) {
+                    # 直播
+                    $info = Dever::load('video/lib/live')->get($v['live_id']);
+                    if ($info) {
+                        $data[$k]['pic'] = $info['pic_cover'];
+                        $data[$k]['name'] = $info['name'];
+                    }
+                }
+
                 if ($v['type'] == 2) {
                     $data[$k]['text'] = $this->text($database, $v['id'], $where['info_id']);
                 } else {
@@ -172,31 +116,44 @@ class Manage
         return $data;
     }
 
+    private function text_name($link, $content_id, $info_id, $location, $name)
+    {
+        $where['info_id'] = $info_id;
+        $where['content_id'] = $content_id;
+        $where['location'] = $location;
+        $info = Dever::db('journal/content_text')->one($where);
+
+        $link .= '&search_option_info_id=' . $info_id. '&search_option_content_id=' . $content_id.'&table=content_text&search_option_location='.$location;
+
+        if ($info) {
+            $link .= '&where_id=' . $info['id'];
+        }
+
+        $html = '<a style="cursor:pointer;" href="javascript:;" onclick="fastEdit($(this), \''.$link.'\', \'编辑'.$name.'文字\', \'\')">'.$name.'</a>';
+
+        return $html;
+    }
+
     public function text($database, $content_id, $info_id)
     {
-        $id = 1;
-        $link = $database->url('edit') . '&search_option_info_id=' . $info_id . '&search_option_content_id=' . $content_id . '&table=content_text&where_id=' . $id;
-        $edit = 
-
-        $html = '<table class="layui-table">
-  <tbody>
-    <tr>
-      <td><a href="javascript:;" onclick="fastEdit($(this), \''.$link . '&search_option_location=1'.'\', \'编辑上左文字\', \'\')">上左</a></td>
-      <td>上中</td>
-      <td>上右</td>
-    </tr>
-    <tr>
-      <td>中左</td>
-      <td>正中</td>
-      <td>中右</td>
-    </tr>
-    <tr>
-      <td>下左</td>
-      <td>下中</td>
-      <td>下右</td>
-    </tr>
-  </tbody>
-</table>';
+        $link = $database->url('edit');
+
+        $location = Dever::db('journal/content_text')->config['location'];
+
+        $html = '<table class="layui-table"><tbody><tr>';
+        $i = 0;
+        foreach ($location as $k => $v) {
+            $name = $this->text_name($link, $content_id, $info_id, $k, $v);
+            $html .= '<td>'.$name.'</td>';
+
+            if ($i == 2 || $i == 5) {
+                $html .= '</tr><tr>';
+            }
+
+            $i++;
+        }
+
+        $html .= '</tr></tbody></table>';
 
         return $html;
     }

+ 13 - 0
journal/src/Api.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace Journal\Src;
+
+use Dever;
+
+class Api
+{
+	public function data()
+	{
+		return Dever::db('journal/info')->state();
+	}
+}

+ 24 - 0
video/lib/Live.php

@@ -0,0 +1,24 @@
+<?php
+namespace Video\Lib;
+
+use Dever;
+
+class Live
+{
+	# 根据id 获取信息
+    public function get($data)
+    {
+        if (!is_array($data)) {
+            $data = Dever::db('video/live')->one($data);
+        }
+        
+        if (!$data) {
+            Dever::alert('错误的信息');
+        }
+    
+        //embed
+
+        
+        return $data;
+    }
+}

+ 24 - 0
video/lib/Vod.php

@@ -0,0 +1,24 @@
+<?php
+namespace Video\Lib;
+
+use Dever;
+
+class Vod
+{
+	# 根据id 获取信息
+    public function get($data)
+    {
+        if (!is_array($data)) {
+            $data = Dever::db('video/vod')->one($data);
+        }
+        
+        if (!$data) {
+            Dever::alert('错误的信息');
+        }
+    
+        //embed
+
+        
+        return $data;
+    }
+}