dever преди 6 години
ревизия
bae43bf98f
променени са 65 файла, в които са добавени 5625 реда и са изтрити 0 реда
  1. 155 0
      act/database/comment.php
  2. 164 0
      act/database/form_id.php
  3. 116 0
      act/database/like.php
  4. 124 0
      act/database/share.php
  5. 159 0
      act/database/share_reflux.php
  6. 8 0
      act/index.php
  7. 88 0
      act/lib/Comment.php
  8. 53 0
      act/lib/Form.php
  9. 65 0
      act/lib/Like.php
  10. 47 0
      act/lib/Manage.php
  11. 156 0
      act/lib/Share.php
  12. 8 0
      boot.php
  13. 1 0
      common.php
  14. 93 0
      config/base.php
  15. 72 0
      config/env/localhost/default.php
  16. 5 0
      config/route.php
  17. 558 0
      content/database/article.php
  18. 118 0
      content/database/author.php
  19. 114 0
      content/database/cate.php
  20. 88 0
      content/database/page.php
  21. 8 0
      content/index.php
  22. 34 0
      content/lib/Applet.php
  23. 203 0
      content/lib/Article.php
  24. 76 0
      content/lib/Author.php
  25. 19 0
      content/lib/Page.php
  26. 1 0
      data/readme
  27. 110 0
      main/assets/mobile/content.html
  28. 2 0
      main/assets/mobile/css/global.css
  29. 1 0
      main/assets/mobile/css/global.css.map
  30. 0 0
      main/assets/mobile/css/index.css
  31. 1 0
      main/assets/mobile/css/index.css.map
  32. 2 0
      main/assets/mobile/css/rule.css
  33. 1 0
      main/assets/mobile/css/rule.css.map
  34. 72 0
      main/assets/mobile/index.html
  35. 0 0
      main/assets/mobile/js/global.js
  36. 0 0
      main/assets/mobile/js/global.js.map
  37. 2 0
      main/assets/mobile/js/index.js
  38. 1 0
      main/assets/mobile/js/index.js.map
  39. 2 0
      main/assets/mobile/js/rule.js
  40. 1 0
      main/assets/mobile/js/rule.js.map
  41. 103 0
      main/assets/mobile/rule.html
  42. 93 0
      main/database/config.php
  43. 8 0
      main/index.php
  44. 149 0
      main/lib/Core.php
  45. 47 0
      main/lib/Preview.php
  46. 154 0
      main/src/Content.php
  47. 825 0
      main/src/Journal.php
  48. 54 0
      main/src/Preview.php
  49. 289 0
      main/src/User.php
  50. 214 0
      main/src/View.php
  51. 11 0
      main/template/mobile/page.php
  52. 55 0
      manage/config/base.php
  53. 7 0
      manage/daemon/loop.php
  54. 7 0
      manage/daemon/main.php
  55. 4 0
      manage/index.php
  56. 4 0
      oauth/index.php
  57. 3 0
      package.json
  58. 4 0
      passport/index.php
  59. 4 0
      poster/index.php
  60. 325 0
      push/database/data.php
  61. 311 0
      push/database/info.php
  62. 8 0
      push/index.php
  63. 162 0
      push/lib/Data.php
  64. 52 0
      push/lib/Manage.php
  65. 4 0
      upload/index.php

+ 155 - 0
act/database/comment.php

@@ -0,0 +1,155 @@
+<?php
+
+$page = 10;
+$table = Dever::config('base')->type;
+$table[5] = '小刊音视频';
+
+return array
+(
+	# 表名
+	'name' => 'comment',
+	# 显示给用户看的名称
+	'lang' => '评论管理',
+	# 是否显示在后台菜单
+	'order' => 80,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'desc',
+			//'list'		=> true,
+		),
+		
+
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户名',
+			'default' 	=> '0',
+			'desc' 		=> '请选择用户',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+		'type' 		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '评论类别',
+			'default' 	=> '',
+			'desc' 		=> '评论类别',
+			'match' 	=> 'option',
+			'option' 	=> $table,
+			'search'	=> 'select',
+			'list'		=> true,
+		),
+		
+		'data_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+		),
+
+		'data_name' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			'list'		=> true,
+		),
+
+		'num_up'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '点赞数',
+			'default' 	=> '0',
+			'desc' 		=> '点赞数',
+			'match' 	=> 'option',
+			//'search'	=> 'order',
+			'list'		=> true,
+		),
+		
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '内容',
+			'update' 	=> 'editor',
+			'key'		=> 1,
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'search'	=> 'fulltext',
+			//'list'		=> 'table',
+			//'modal'		=> '查看详情',
+			'list'		=> true,
+		),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'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
+	(
+		'insert' => false,
+		'edit' => false,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'type' => array('yes', 'in'),
+				'data_id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('cdate' => 'desc'),
+			'page' => array($page, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 164 - 0
act/database/form_id.php

@@ -0,0 +1,164 @@
+<?php
+$auth = Dever::tops();
+$type = array
+(
+    1 => '普通表单',
+    2 => '支付表单',
+);
+$cate = function() use ($auth)
+{
+    $array = array();
+    if ($auth) {
+        $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
+    } else {
+        $info = Dever::db('journal/cate')->state();
+    }
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+$time = time()+(3600*24*7);
+return array
+(
+    # 表名
+    'name' => 'form_id',
+    # 显示给用户看的名称
+    'lang' => '模板form_id收集表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'      => true,
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '类型',
+            'match'     => 'option',
+            'search'    => 'select',
+            'option'    => $type,
+            'list'      => true,
+        ),
+
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            //'search'    => 'select',
+            'list'      => true,
+        ),
+        
+        'num'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '使用次数',
+            'default'   => '0',
+            'desc'      => '使用次数',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户id',
+            'default'   => '',
+            'desc'      => '用户id',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+        
+        'form_id'       => array
+        (
+            'type'      => 'varchar-700',
+            'name'      => 'form_id',
+            'default'   => '',
+            'desc'      => 'form_id',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+        
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '更新时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            'default'   => '',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'top' => Dever::config('base', 'applet')->top,
+
+    'manage' => array
+    (
+        //'delete' => false,
+        'insert' => false,
+        'edit' => false,
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'num' => array('yes', '<'),
+                'type' => 'yes',
+                'uid' => 'yes',
+                'cdate' => array($time, '<='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'limit' => '0,100',
+            'col' => '*',
+        ),
+
+        'getAllGroupByUid' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'cdate' => array($time, '<='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'group' => 'uid',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 116 - 0
act/database/like.php

@@ -0,0 +1,116 @@
+<?php
+
+$table = Dever::config('base')->type;
+$table[11] = '评论';
+return array
+(
+	# 表名
+	'name' => 'like',
+	# 显示给用户看的名称
+	'lang' => '喜欢日志',
+	# 是否显示在后台菜单
+	'order' => 79,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'desc',
+			//'list'		=> true,
+		),
+		
+
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户名',
+			'default' 	=> '0',
+			'desc' 		=> '请选择用户',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+		'type' 		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '喜欢类别',
+			'default' 	=> '',
+			'desc' 		=> '喜欢类别',
+			'match' 	=> 'option',
+			'search'	=> 'select',
+			'option' 	=> $table,
+			'list'		=> true,
+		),
+		
+		'data_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+		),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'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
+	(
+		'insert' => false,
+		'edit' => false,
+		'delete' => false,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'data_id' => 'yes',
+				'type' => array('yes', 'in'),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'page' => array(15, 'list'),
+			'col' => 'uid,type,data_id,cdate',
+		),
+	)
+);

+ 124 - 0
act/database/share.php

@@ -0,0 +1,124 @@
+<?php
+
+$table = Dever::config('base')->type;
+return array
+(
+	# 表名
+	'name' => 'share',
+	# 显示给用户看的名称
+	'lang' => '分享日志',
+	# 是否显示在后台菜单
+	'order' => 78,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'desc',
+			//'list'		=> true,
+		),
+		
+
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户名',
+			'default' 	=> '0',
+			'desc' 		=> '请选择用户',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+		'type' 		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '分享类别',
+			'default' 	=> '',
+			'desc' 		=> '分享类别',
+			'match' 	=> 'option',
+			'option' 	=> $table,
+			'list'		=> true,
+			'search'	=> 'select',
+		),
+		
+		'data_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+		),
+		
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '内容',
+			'update' 	=> 'editor',
+			'key'		=> 1,
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			//'search'	=> 'fulltext',
+			//'list'		=> 'table',
+			//'modal'		=> '查看详情',
+		),
+
+		'num' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '分享次数',
+			'default' 	=> '',
+			'desc' 		=> '分享次数',
+			'match' 	=> 'option',
+			'list'		=> true,
+		),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'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
+	(
+		'insert' => false,
+		'edit' => false,
+		'delete' => false,
+
+		'list_button' => array
+		(
+			'list' => array('回流', '"share_reflux&search_option_share_id={id}&oper_parent=share"'),
+		),
+	),
+);

+ 159 - 0
act/database/share_reflux.php

@@ -0,0 +1,159 @@
+<?php
+
+$table = Dever::config('base')->type;
+
+$type = array
+(
+    1 => '新用户',
+    2 => '老用户',
+    3 => '未知',
+);
+return array
+(
+    # 表名
+    'name' => 'share_reflux',
+    # 显示给用户看的名称
+    'lang' => '分享回流',
+    # 是否显示在后台菜单
+    'order' => 60,
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'order'     => 'desc',
+            //'list'        => true,
+        ),
+        
+
+        'source_uid'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '分享者',
+            'default'   => '',
+            'desc'      => '分享者',
+            'match'     => 'option',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{source_uid} > 0 ? Dever::load("passport/user-one#username", {source_uid}) : "匿名用户"',
+        ),
+
+
+        'type'      => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '分享类别',
+            'default'   => '',
+            'desc'      => '分享类别',
+            'match'     => 'option',
+            'option'    => $table,
+            'list'      => true,
+            'search'    => 'select',
+        ),
+        
+        'data_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '标题',
+            'default'   => '',
+            'desc'      => '标题',
+            'match'     => 'option',
+            'list'      => 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '回流用户',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            //'search'  => 'select',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'list'      => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+        ),
+
+        'user_type'      => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否新用户',
+            'default'   => '3',
+            'desc'      => '是否新用户',
+            'match'     => 'option',
+            'option'    => $type,
+            'list'      => true,
+            'search'    => 'select',
+        ),
+
+        'gid'       => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '群组id',
+            'default'   => '',
+            'desc'      => '群组id',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            //'list'        => true,
+        ),
+
+        'share_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '分享id',
+            'default'   => '',
+            'desc'      => '分享id',
+            'match'     => 'option',
+        ),
+        
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        '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
+    (
+        'insert' => false,
+        'edit' => false,
+        'delete' => false,
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        
+    ),
+);

+ 8 - 0
act/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'act');
+define('DEVER_APP_LANG', '互动管理');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 199);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-theme');
+include(DEVER_APP_PATH . '../boot.php');

+ 88 - 0
act/lib/Comment.php

@@ -0,0 +1,88 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Comment
+{
+    private function table($type) {
+        if ($type == 3) {
+            $table = 'act/live_comment';
+        } else {
+            $table = 'act/comment';
+        }
+        return $table;
+    }
+    # 获取评论列表
+    public function get($id, $type, $uid = false)
+    {
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $table = $this->table($type);
+        $data = Dever::db($table)->getAll($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $user = Dever::load('passport/api')->info($v['uid']);
+                $data[$k]['time'] = Dever::mdate($v['cdate'], 2);
+                $data[$k]['username'] = $user['username'];
+                $data[$k]['avatar'] = $user['avatar'];
+                $data[$k]['cdate_time'] = date('Y-m-d H:i:s', $v['cdate']);
+
+                # 检查是否点赞
+                if ($uid > 0) {
+                    $data[$k]['up'] = Dever::load('act/lib/like')->get($uid, $v['id'], 11);
+                } else {
+                    $data[$k]['up'] = 2;
+                }
+            }
+        }
+        return $data;
+    }
+
+    # 获取当前用户的评论列表
+    public function getList($uid)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = '1,2,3,6';
+        $info = Dever::db('act/comment')->getAll($where);
+
+        return $info;
+    }
+
+    # 发表评论
+    public function submit($uid, $id, $type, $content)
+    {
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $where['content'] = $content;
+        $table = $this->table($type);
+        $info = Dever::db($table)->one($where);
+        if (!$info) {
+            if (isset($info['name']) && $info['name']) {
+                $where['data_name'] = $info['name'];
+            }
+            
+            Dever::db($table)->insert($where);
+        }
+        Dever::score($uid, 'submit_commit', '发表评论');
+
+        # 更新评论数
+        if ($type == 5) {
+            return true;
+        }
+        $where = array();
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $where['state'] = 1;
+        $total = Dever::db($table)->total($where);
+        $table = Dever::config('base')->type_table[$type];
+        Dever::db($table)->update(array('where_id' => $id, 'num_comment' => $total));
+
+        
+
+        return true;
+    }
+}

+ 53 - 0
act/lib/Form.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Form
+{
+    # 获取当前可用的formid
+    public function get($uid, $type = 1)
+    {
+        $where['uid'] = $uid;
+        if ($type > 0) {
+        	$where['type'] = $type;
+        	if ($type == 2) {
+        		# 支付表单有3次机会
+        		$where['num'] = 3;
+        	} else {
+        		# 普通表单只有一次机会
+        		$where['num'] = 1;
+        	}
+        }
+        $info = Dever::db('act/form_id')->getAll($where);
+
+        if ($info) {
+            $key = array_rand($info);
+            if (isset($info[$key])) {
+            	$update['where_id'] = $info[$key]['id'];
+            	$update['num'] = $info[$key]['num'] + 1;
+            	Dever::db('act/form_id')->update($update);
+            	return $info[$key]['form_id'];
+            }
+        } else {
+            return false;
+        }
+    }
+
+    # 提交formid
+    public function submit($uid, $id, $type = 1, $system = 1)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = $type;
+        $where['cate_id'] = $system;
+        $where['form_id'] = $id;
+        $info = Dever::db('act/form_id')->one($where);
+        if (!$info) {
+        	$where['num'] = 0;
+            Dever::db('act/form_id')->insert($where);
+        }
+
+        return true;
+    }
+}

+ 65 - 0
act/lib/Like.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Like
+{
+    # 获取当前用户是否点赞
+    public function get($uid, $id, $type)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $where['state'] = 1;
+        $info = Dever::db('act/like')->one($where);
+
+        if ($info) {
+            return 1;
+        } else {
+            return 2;
+        }
+    }
+
+    # 获取当前用户的点赞列表
+    public function getList($uid)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = '1,2,3';
+        $info = Dever::db('act/like')->getAll($where);
+
+        return $info;
+    }
+
+    # 点赞+喜欢
+    public function submit($uid, $id, $type)
+    {
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $info = Dever::db('act/like')->one($where);
+        if (!$info) {
+            Dever::db('act/like')->insert($where);
+        } else {
+            if ($info['state'] == 1) {
+                Dever::db('act/like')->update(array('where_id' => $info['id'], 'state' => 2));
+            } else {
+                Dever::db('act/like')->update(array('where_id' => $info['id'], 'state' => 1));
+            }
+        }
+
+        # 更新点赞数
+        $where = array();
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $where['state'] = 1;
+        $total = Dever::db('act/like')->total($where);
+        $table = Dever::config('base')->type_table[$type];
+        Dever::db($table)->update(array('where_id' => $id, 'num_up' => $total));
+
+        Dever::score($uid, 'submit_like', '喜欢');
+
+        return true;
+    }
+}

+ 47 - 0
act/lib/Manage.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Manage
+{
+    //{source_id} > 0 ? ("{name}" ? "{name}" : Dever::load("sad/supply-one#name", {source_id})) : "{name}"
+    public function load($source_table, $id)
+    {
+        $table = Dever::config('base')->type_table[$source_table];
+        $data = Dever::db($table)->one($id);
+
+        if ($data && isset($data['name']) && $data['name']) {
+            return $data['name'];
+        }
+        if ($data && isset($data['content']) && $data['content']) {
+            return $data['content'];
+        }
+        return '未知';
+    }
+
+    # 根据data_id获取data_name
+    public function getName_api()
+    {
+        $data = Dever::db('act/comment')->state();
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $name = $this->load($v['type'], $v['data_id']);
+                if ($name && $name != $v['data_name']) {
+                    Dever::db('act/comment')->update(array('where_id' => $v['id'], 'data_name' => $name));
+                }
+            }
+        }
+
+        $data = Dever::db('act/live_comment')->state();
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $name = $this->load($v['type'], $v['data_id']);
+                if ($name && $name != $v['data_name']) {
+                    Dever::db('act/live_comment')->update(array('where_id' => $v['id'], 'data_name' => $name));
+                }
+            }
+        }
+    }
+}

+ 156 - 0
act/lib/Share.php

@@ -0,0 +1,156 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Share
+{
+    # 获取某个用户在某个图文的分享回流数
+    public function getRefluxNum($uid, $id, $type)
+    {
+        $where['source_uid'] = $uid;
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        return Dever::db('act/share_reflux')->total($where);
+    }
+
+    # 提交分享
+    public function submit($uid, $id, $type)
+    {
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $info = Dever::db('act/share')->one($where);
+        if (!$info) {
+            $where['num'] = 1;
+            Dever::db('act/share')->insert($where);
+        } else {
+            $where['num'] = $info['num'] + 1;
+            $where['where_id'] = $info['id'];
+            Dever::db('act/share')->update($where);
+        }
+
+        Dever::score($uid, 'share_friend', '邀请好友');
+
+        return true;
+    }
+
+    # 回流
+    public function submit_reflux($source_uid, $uid, $id, $type, $system = 1)
+    {
+        if ($source_uid == $uid) {
+            return false;
+        }
+        $where['uid'] = $source_uid;
+        //$where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+
+        $share = Dever::db('act/share')->one($where);
+        if ($share) {
+            $where = array();
+            $user = Dever::db('passport/user')->one($uid);
+
+            $where['user_type'] = 3;
+
+            //if ($user['temp'] == 2 || $user['bind'] == 1) {
+            if ($user) {
+                # 必须是已经绑定手机号或者授权用户才可以增加积分
+
+                # 新用户 增加邀请关系
+                if (Dever::project('invite')) {
+                    $parent = Dever::load('invite/api')->getParent($uid, $level = 1);
+                    if (!$parent) {
+                        # 新用户
+                        $where['user_type'] = 1;
+                        Dever::load('invite/api')->setRelation($uid, $source_uid);
+                    } else {
+                        # 老用户
+                        $where['user_type'] = 2;
+                        
+                    }
+                }
+                if ($type <= 4) {
+                    $method = '';
+                    $name = Dever::config('base')->type[$type];
+                    if ($type == 1) {
+                        $method = 'article';
+                    }
+                    if ($type == 2) {
+                        $method = 'vod';
+                    }
+                    if ($type == 3) {
+                        $method = 'live';
+                    }
+                    if ($type == 4) {
+                        $method = 'journal';
+                    }
+
+                    # 增加积分
+                    if ($where['user_type'] == 1) {
+                        $score = 0;
+                        if ($type == 4) {
+                            $active = Dever::db('journal/active')->one(array('id' => $id));
+                            if ($active && $active['status'] == 1 && time() <= $active['end']) {
+                                $score = $active['invite_score'];
+                            }
+                        }
+                        Dever::score($source_uid, 'share_'.$method.'_new_reflux', '通过'.$name.'邀请到新用户', 'act/lib/score.submit?method=share&type='.$type.'&id=' . $id, $score);
+                        # 插入到邀请列表里
+                        Dever::load('act/lib/invite')->submit($source_uid, $uid, $id, $type);
+
+                        # 小刊订阅
+                        if ($type == 4) {
+                            if (isset($active) && $active) {
+                                $num = $active['invite_num'];
+
+                                $invite_num = Dever::load('act/lib/invite')->getTotal($source_uid, $id, $type);
+
+                                if ($invite_num >= $num) {
+
+                                    # 发消息
+                                    if ($invite_num == $num) {
+                                        $journal = Dever::db('journal/info')->one($id);
+                                        if (Dever::project('message')) {
+                                            Dever::load('message/lib/data')->push(-1, $source_uid, '活动提醒', '邀请人数已达'.$invite_num.'人,您获得了 '.$journal['name'].' 的阅读资格!', 11);
+                                        }
+
+                                        # 发送模板消息 这里没有formid 暂时先不发送模板消息,后续应该通过前端收集formid就好了
+
+                                        # 发短信
+                                        if (isset($user['mobile']) && $user['mobile'] && Dever::project('sms') && $system == 1) {
+                                            $send = array();
+                                            $send['num'] = $invite_num;
+                                            $send['name'] = $journal['name'];
+                                            Dever::load('sms/api.send', 'share_journal', $user['mobile'], $send);
+                                        }
+                                    }
+                                    
+                                    Dever::load('act/lib/subscribe')->submit($source_uid, $id, 3);
+                                }
+                            }
+                        }
+                        
+                    } elseif ($where['user_type'] == 2) {
+                        Dever::score($source_uid, 'share_'.$method.'_reflux', '通过'.$name.'邀请到老用户');
+                    }
+                }
+            }
+
+            
+            $where['source_uid'] = $source_uid;
+            $where['uid'] = $uid;
+            $where['data_id'] = $id;
+            $where['type'] = $type;
+            $where['share_id'] = $share['id'];
+            $info = Dever::db('act/share_reflux')->one($where);
+            if (!$info) {
+                Dever::db('act/share_reflux')->insert($where);
+                return true;
+            }
+        }
+
+        return false;
+    }
+}

+ 8 - 0
boot.php

@@ -0,0 +1,8 @@
+<?php 
+define('DEVER_PROJECT', 'sharepic');
+define('DEVER_PROJECT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+if (defined('DEVER_PACKAGE')) {
+	include('dever_package/'.DEVER_PACKAGE.'/index.php');
+} else {
+	include('dever/boot.php');
+}

+ 1 - 0
common.php

@@ -0,0 +1 @@
+<?php

+ 93 - 0
config/base.php

@@ -0,0 +1,93 @@
+<?php
+$config['base'] = array
+(
+    'name' => '年夜饭',
+    'version' => '1.0.0 Beta',
+
+    # 功能选择
+    'function' => array
+    (
+        1 => '浏览量',
+        2 => '评论',
+        3 => '喜欢',
+    ),
+
+    # 小程序首页
+    'applet_index' => 'template/home/index',
+
+    # 功能类型
+    'type' => array
+    (
+        1 => '图文',
+    ),
+
+    # 功能类型
+    'type_table' => array
+    (
+        1 => 'content/article',
+    ),
+
+    'audit' => array
+    (
+        1 => '未审核',
+        2 => '已审核',
+        3 => '审核未通过',
+    ),
+
+    # 上线状态
+    'status' => array
+    (
+        1 => '下架',
+        2 => '上线发布',
+    ),
+
+    'applet' => array
+    (
+        'project' => 'passport/system',
+        'appid' => 'wxd0590664d0004f23',
+        'secret' => '009bf48ffd5a3ceecb6a933492d641d2',
+        'url' => 'https://api.weixin.qq.com/sns/jscode2session',
+    ),
+
+    # 站点使用邮箱还是手机作为主账号,如果是手机,请填写手机验证码的配置接口
+    'account' => 'mobile',
+    # 性别转换 passport里1为男、2为女 3为未知,如果前端定义与这个不同,请做好转换
+    'sex' => array
+    (
+        # 前面的索引为前端传过来的值
+        2 => 2,
+        1 => 1,
+        3 => 3,
+    ),
+);
+
+
+# 前台通用配置
+$config['template'] = array
+(
+    # 静态页面目录
+    'assets' => 'mobile',
+
+    # 模板编译器目录
+    'template' => 'mobile',
+
+    # 模板html文件的所在目录,默认为html
+    'path' => '',
+
+    'replace' => array
+    (
+        'css' => 'css/',
+        'js' => 'js/',
+        'images' => 'images/',
+    ),
+
+    # 编译器与模板对应关系目录,定义之后,代表可以完全不改动前端的代码,可以为空,为空则一一对应,参考manage
+    'relation' => array
+    (
+        # 首页启动屏幕
+        'home' => 'index',
+        'page' => 'rule',
+    ),
+    
+);
+return $config;

+ 72 - 0
config/env/localhost/default.php

@@ -0,0 +1,72 @@
+<?php
+
+
+# 验证dc是否存在,一般在share目录下
+$dc = array();
+$dc_file = '/share/dc/config.php';
+if (is_file($dc_file)) {
+    $dc = include($dc_file);
+}
+
+if (isset($dc['data'])) {
+    $config['base']['data'] = $dc['data'];
+}
+
+$create = false;
+if (isset($dc['mysql']['create'])) {
+    $create = $dc['mysql']['create'];
+}
+
+$ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
+
+$local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
+
+# 数据库配置
+$config['database'] = array
+(
+    'create' => $create,
+	# 默认数据库配置
+	'default' => array
+	(
+		'type' => 'pdo',
+		'host' => array
+		(
+			'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
+			'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
+		),
+		'database' => 'sharepic',
+		'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
+		'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
+		'charset' => 'utf8',
+	),
+);
+
+$config['debug'] = array
+(
+	'log' => array('type' => 'file'),
+);
+
+
+$host = 'http://'.$local . '/';
+
+$upload = $host . 'upload/';
+$uploadcdn = $host . 'upload/data/';
+
+$config['host'] = array
+(
+    'upload'=> $upload . 'upload/?save',
+    'uploadRes'     => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
+    'project' => array
+    (
+    	/*
+        'upload' => array
+        (
+            //'path' => $host. 'upload/upload/?',
+            'path' => '/share/lib/php/dever_package/upload/',
+            'setup' => '/www/upload/upload/',
+        ),
+        */
+    ),
+);
+
+return $config;

+ 5 - 0
config/route.php

@@ -0,0 +1,5 @@
+<?php
+return array
+(
+'home' => 'home',
+);

+ 558 - 0
content/database/article.php

@@ -0,0 +1,558 @@
+<?php
+
+$audit = Dever::config('base')->audit;
+
+$status = Dever::config('base')->status;
+
+$function = Dever::config('base')->function;
+
+# 每页的数据量
+$page = 15;
+
+$cate = function()
+{
+	$array = array();
+	$info = Dever::db('content/cate')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+$author = function()
+{
+	$array = array();
+	$info = Dever::db('content/author')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+$share = array
+(
+	1 => '显示',
+	2 => '不显示',
+);
+
+$wechat = array
+(
+	1 => '否',
+	2 => '是',
+);
+
+# 常用的col
+$col = 'id,cate_id,name,pic_cover,pic_cover_169,pdate,num_add_view+num_view as num_view,num_up+num_add_up as num_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,author_id';
+
+return array
+(
+	# 表名
+	'name' => 'article',
+	# 显示给用户看的名称
+	'lang' => '图文管理',
+	'order' => 100,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'list'		=> true,
+			'search'	=> 'fulltext',
+			//增加预览
+			'preview'	=> true,
+		),
+		
+		'cate_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '所属栏目',
+			'default' 	=> '1',
+			'desc' 		=> '所属栏目',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $cate,
+			'search'	=> 'select',
+		),
+
+		'author_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '作者',
+			'default' 	=> '1',
+			'desc' 		=> '作者',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			//'option'	=> $author,
+			'search'	=> 'select',
+			'update_search'	=> 'content/lib/author.search',
+		),
+
+		'wechat'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '是否公众号文章',
+			'default' 	=> '1',
+			'desc' 		=> '是否公众号文章',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			'option'	=> $wechat,
+			'search'	=> 'select',
+		),
+
+		'wechat_data_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '微信数据id',
+			'default' 	=> '0',
+			'desc' 		=> '微信数据id',
+			'match' 	=> 'is_numeric',
+		),
+
+		'tag'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '标签',
+			'default' 	=> '',
+			'desc' 		=> '标签',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'selects',
+			//'search'	=> 'fulltext',
+			'update_search'	=> 'tag/lib/core.search',
+		),
+
+  		'pic_cover'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '4:3封面图-图片尺寸750*564px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '封面图',
+			'match' 	=> 'is_string',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+			//直接上传到云端
+			//'upload'	=> 'qiniu',
+			//上传大数据
+			//'large' 	=> true,
+		),
+
+		'pic_cover_169'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '16:9封面图-图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '封面图',
+			'match' 	=> 'is_string',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+			//直接上传到云端
+			//'upload'	=> 'qiniu',
+			//上传大数据
+			//'large' 	=> true,
+		),
+
+		'num_add_view'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '浏览量基数',
+			'default' 	=> '0',
+			'desc' 		=> '浏览量基数',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+		),
+
+		'num_view'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '浏览量pv',
+			'default' 	=> '0',
+			'desc' 		=> '请填写浏览量pv',
+			'match' 	=> 'option',
+			'search'	=> 'order',
+			//'list'		=> '{num_view}+{num_add_view}',
+		),
+
+		'num_add_up'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '喜欢基数',
+			'default' 	=> '0',
+			'desc' 		=> '喜欢基数',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+		),
+		
+		'num_up'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '喜欢数',
+			'default' 	=> '0',
+			'desc' 		=> '请填写喜欢数',
+			'match' 	=> 'option',
+			//'search'	=> 'order',
+			'list'		=> '"喜欢数:{num_up}+{num_add_up}<br />浏览量:{num_view}+{num_add_view}<br />评论数:{num_comment}<br />"',
+			'list_name'	=> '统计数字',
+		),
+
+		'num_comment'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '评论数',
+			'default' 	=> '0',
+			'desc' 		=> '请填写评论数',
+			'search'	=> 'order',
+			'match' 	=> 'option',
+			//'list'		=> true,
+		),
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+
+		'admin_founder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '创建人',
+			'default' 	=> '1',
+			'desc' 		=> '创建人',
+			'match' 	=> 'is_numeric',
+		),
+
+		'admin_editor'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '操作人',
+			'default' 	=> '1',
+			'desc' 		=> '操作人',
+			'match' 	=> 'is_numeric',
+		),
+
+		'pdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '发布时间',
+			'match' 	=> array('is_numeric', time()),
+			'default'	=> '',
+			'desc' 		=> '',
+			'update'	=> 'date',
+			'callback'	=> 'maketime',
+			'insert'	=> true,
+			//'list'		=> 'date("Y-m-d H:i:s", {pdate})',
+			'auth'		=> '"{pdate}" > 0',
+		),
+
+		'share'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '分享海报-选择海报库中的海报',
+			'default' 	=> '',
+			'desc' 		=> '分享海报',
+			'match' 	=> 'option',
+			//'update'	=> 'checkbox',
+			'option'	=> $share,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'search'	=> 'order',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'udate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '更新时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+		),
+
+		'function'		=> array
+		(
+			'type' 		=> 'varchar-100',
+			'name' 		=> '功能选择',
+			'default' 	=> '1,2,3',
+			'desc' 		=> '功能选择',
+			'match' 	=> 'option',
+			'update'	=> 'checkbox',
+			'option'	=> $function,
+		),
+
+		'share_yes'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '是否显示分享按钮',
+			'default' 	=> '1',
+			'desc' 		=> '是否显示分享按钮',
+			'match' 	=> 'option',
+			'update'	=> 'radio',
+			'option'	=> $share,
+			'control'	=> 'share_yes',
+		),
+
+		'share_title'		=> array
+		(
+			'type' 		=> 'varchar-100',
+			'name' 		=> '分享标题',
+			'default' 	=> '',
+			'desc' 		=> '分享标题',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'show'		=> 'share_yes=1',
+		),
+
+		'share_pic'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '分享图片',
+			'match' 	=> 'is_string',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+			'show'		=> 'share_yes=1',
+			//'upload'	=> 'qiniu',
+			//'large' 	=> true,
+		),
+
+		'share_content'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '分享内容',
+			'default' 	=> '',
+			'desc' 		=> '分享内容',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+			'show'		=> 'share_yes=1',
+		),
+
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '内容',
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'update'	=> 'editor',
+			'key'		=> '1',
+			//'media'		=> '5',//下面的音视频已经做到了
+			//直接上传到云端
+			//'upload'	=> 'qiniu',
+			//上传大数据
+			//'large' 	=> true,
+			//自定义编辑器右侧按钮
+			'editor'	=> array
+			(
+				'name' => '选择插入模块',
+				'button' => array
+				(
+					array
+					(
+						# 名称
+						'name' => '图片',
+						# 资源库id
+						'key' => 1,
+						# 类型
+						'type' => 'image',
+					),
+					array
+					(
+						'name' => '音频',
+						'key' => 5,
+						'type' => 'media',
+					),
+					array
+					(
+						'name' => '视频',
+						'key' => 'video/lib/core.vod',
+					),
+					array
+					(
+						'name' => '直播',
+						'key' => 'video/lib/core.live',
+					),
+
+					array
+					(
+						'name' => '小程序',
+						'key' => 'content/lib/applet.update',
+						'type' => 'update',
+					),
+				),
+			),
+		),
+
+		'audit'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '审核状态',
+			'default' 	=> '1',
+			'desc' 		=> '审核',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			'option'	=> $audit,
+			'search'	=> 'select',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '发布状态',
+			'default' 	=> '1',
+			'desc' 		=> '发布状态',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			'option'	=> $status,
+			'search'	=> 'select',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+		),
+	),
+
+	# 索引
+	'index' => array
+	(
+		'version' => 1,
+		
+		1 => array
+		(
+			'i1' => 'uid,cate_id',
+		)
+	),
+	
+	# 管理功能
+	'manage' => array
+	(
+		//'insert' => false,
+		# 列表
+		'list_button' => array
+		(
+			'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
+		),
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'search' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'cate_id' => 'yes',
+				'name' => array('yes', 'like'),
+				'id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'limit' => '0,1000',
+			'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
+		),
+
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'cate_id' => 'yes',
+				'cate_ids' => array('yes-cate_id', 'in'),
+				'id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','id' => 'desc'),
+			'page' => array($page, 'list'),
+			'col' => $col,
+		),
+
+		'getRelation' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'cate_id' => 'yes',
+				'cate_ids' => array('yes-cate_id', 'in'),
+				'noid' => array('yes-id', '!='),
+				'audit' => 2,
+				'status' => 2,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','id' => 'desc'),
+			'limit' => '0,4',
+			'col' => $col,
+		),
+
+		'getOne' => array
+		(
+			# 匹配的正则或函数 选填项
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'type' => 'one',
+			'col' => $col,
+		),
+		
+		# 更新浏览量
+		'addView' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_view' => array('1', '+='),
+			),
+		),
+	),
+);

+ 118 - 0
content/database/author.php

@@ -0,0 +1,118 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'author',
+	# 显示给用户看的名称
+	'lang' => '作者管理',
+	# 后台菜单排序
+	'order' => 8,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'list'		=> true,
+			'order'		=> 'desc',
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '作者名称',
+			'default' 	=> '',
+			'desc' 		=> '请输入名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+		
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'search'	=> 'order',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	# 默认值
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认作者",1,' . time(),
+		),
+	),
+
+	'manage' => array
+	(
+		'insert' => false,
+		'edit' => false,
+
+		# 自定义快捷新增和编辑
+		'button' => array
+		(
+			'新增' => array('fast'),
+		),
+		# 快捷更新
+		'list_button' => array
+		(
+			'edit' => array('编辑'),
+		),
+	),
+
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'name' => array('yes', 'like'),
+				'id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'limit' => '0,1000',
+			'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
+		),
+	),
+);

+ 114 - 0
content/database/cate.php

@@ -0,0 +1,114 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'cate',
+	# 显示给用户看的名称
+	'lang' => '栏目设置',
+	# 后台菜单排序
+	'order' => 9,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'list'		=> true,
+			'order'		=> 'desc',
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '栏目名称',
+			'default' 	=> '',
+			'desc' 		=> '请输入名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+		
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'search'	=> 'order',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	# 默认值
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认栏目",1,' . time(),
+		),
+	),
+
+	'manage' => array
+	(
+		'insert' => false,
+		'edit' => false,
+
+		# 自定义快捷新增和编辑
+		'button' => array
+		(
+			'新增' => array('fast'),
+		),
+		# 快捷更新
+		'list_button' => array
+		(
+			'edit' => array('编辑'),
+		),
+	),
+
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','id' => 'desc'),
+			'col' => '*',
+		),
+	),
+);

+ 88 - 0
content/database/page.php

@@ -0,0 +1,88 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'page',
+    # 显示给用户看的名称
+    'lang' => '单页管理',
+    # 后台菜单排序
+    'order' => 2,
+    'check' => 'key',
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'search'    => 'order',
+            //'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '标题',
+            'default'   => '',
+            'desc'      => '标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'key'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '标识',
+            'default'   => '',
+            'desc'      => '标识',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'content'      => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容',
+            'default'   => '',
+            'desc'      => '内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'list_name'		=> '链接',
+            'list'      => 'Dever::load("content/lib/page.link", {id})',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+);

+ 8 - 0
content/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'content');
+define('DEVER_APP_LANG', '内容管理');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 200);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-tabs');
+include(DEVER_APP_PATH . '../boot.php');

+ 34 - 0
content/lib/Applet.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace Content\Lib;
+
+use Dever;
+
+class Applet
+{
+    # 更新数据
+    public function update_api()
+    {
+        $applet = Dever::db('content/applet')->state();
+
+        $option = '<option parent="" value="" selected>当前小程序</option>';
+        if ($applet) {
+            foreach ($applet as $k => $v) {
+                $option .= '<option parent="" value="'.$v['appid'].'">'.$v['name'].'</option>';
+            }
+        }
+        $html = '<div class="layui-card-body">';
+
+        $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">选择小程序</label></div><div><select lay-ignore="" class="update_value form-control layui-input layui-select   validate[required]" name="editor_applet_id" id="editor_applet_id">'.$option.'</select></div></div></div>';
+
+        $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">路径</label></div><div><input type="text" class="update_value form-control layui-input validate[required]" value="" name="editor_applet_path" id="editor_applet_path" autocomplete="new-password" placeholder=""></div></div></div>';
+
+        $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">链接-为空则使用小程序里的链接</label></div><div><input type="text" class="update_value form-control layui-input validate[required]" value="" name="editor_applet_link" id="editor_applet_link" autocomplete="new-password" placeholder=""></div></div></div>';
+
+        $html .= '<div class="layui-form-item "><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">封面图<span style="font-size:12px;font-weight:normal;font-color:#bababa;margin-left:5px;">[图片宽度750px高度自适应,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式]</span></label></div><div><input type="button" style="width:100px;display:inline;padding-left:0px;" class="form-control layui-input image_upload" v="editor_applet_pic" id="file_applet_pic" key="1" value="本地上传" autocomplete="new-password">
+        <div style="margin-top:5px;">
+        <input type="text" class="update_value form-control layui-input " name="editor_applet_pic" id="editor_applet_pic" value="" autocomplete="new-password"></div></div></div></div>';
+        $html .= '</div>';
+        return $html;
+    }
+}

+ 203 - 0
content/lib/Article.php

@@ -0,0 +1,203 @@
+<?php
+
+namespace Content\Lib;
+
+use Dever;
+
+class Article
+{
+    # 根据文章id 获取文章信息
+    public function get($data, $uid = false)
+    {
+        if (!is_array($data)) {
+            $data = Dever::db('content/article')->getOne($data);
+        }
+        
+        if (!$data) {
+            Dever::alert('错误的文章信息');
+        }
+    
+        $data = $this->getContent($data, $uid);
+
+        return $data;
+    }
+
+    public function getContent($data, $uid = false)
+    {
+        //embed
+        $data['content_array'] = array();
+
+        $data['content'] = Dever::filter($data['content']);
+
+        $content = $data['content'];
+        $replace = array();
+
+        # embed已废弃
+        if (strstr($data['content'], 'embed')) {
+            # 音频
+            preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $content, $matches);
+            if (isset($matches[1])) {
+                foreach ($matches[1] as $k => $v) {
+                    $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
+
+                    if (strstr($v, '.mp4') || strstr($v, '.mov') || strstr($v, '.m3u8')) {
+                        $replace[] = array('type' => 6, 'content' => $v);
+                    } else {
+                        $replace[] = array('type' => 5, 'content' => $v);
+                    }
+                }
+            }
+        }
+
+        if (strstr($data['content'], 'data-applet')) {
+            # 小程序
+            preg_match_all('/<img(.*?)data-applet="(.*?)" \/>/', $content, $matches);
+
+            if (isset($matches[2])) {
+                foreach ($matches[2] as $k => $v) {
+                    $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
+                    $temp = explode('||', $v);
+                    $pic = $temp[0];
+                    $appid = $temp[1];
+                    $path = $temp[2];
+
+                    $appinfo = Dever::db('content/applet')->one(array('appid' => $appid));
+                    if (isset($temp[3]) && $temp[3]) {
+                        $appinfo['link'] = $temp[3];
+                    }
+
+                    $replace[] = array('type' => 7, 'pic_cover' => $pic, 'appid' => $appid, 'path' => $path, 'name' => $appinfo['name'], 'link' => $appinfo['link']);
+                }
+            }
+        }
+
+        if (strstr($data['content'], 'data-file')) {
+            # 音频
+            preg_match_all('/<img src="(.*?)" style="(.*?)" data-file="(.*?)" \/>/', $content, $matches);
+
+            if (!isset($matches[1][0])) {
+                preg_match_all('/<img style="(.*?)" src="(.*?)" data-file="(.*?)" \/>/', $content, $matches);
+                $temp = array();
+                if (isset($matches[2][0])) {
+                    $temp = $matches;
+                    $matches[1] = $temp[2];
+                    unset($temp);
+                }
+            }
+
+            if (isset($matches[1])) {
+                foreach ($matches[1] as $k => $v) {
+                    if (isset($matches[3][$k])) {
+                        $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
+
+                        $file = $matches[3][$k];
+                        $temp = explode('||', $file);
+                        $file = $temp[0];
+                        if (isset($temp[1])) {
+                            $name = $temp[1];
+                        } else {
+                            $name = '';
+                        }
+                        
+                        $cover = $v;
+
+                        if (strstr($v, '.mp4') || strstr($v, '.mov') || strstr($v, '.m3u8')) {
+                            $replace[] = array('type' => 6, 'content' => $file, 'cover' => $cover, 'name' => $name);
+                        } else {
+                            $replace[] = array('type' => 5, 'content' => $file, 'cover' => $cover, 'name' => $name);
+                        }
+                    }
+                }
+            }
+        }
+
+        if (strstr($data['content'], 'data-id')) {
+            # 视频+直播
+            preg_match_all('/<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>/', $content, $matches);
+            
+            
+            if (!isset($matches[2][0])) {
+                preg_match_all('/<img(.*?)data-key="(.*?)" data-id="(.*?)" \/>/', $content, $matches);
+                $temp = array();
+                if (isset($matches[2][0]) && isset($matches[3][0])) {
+                    $temp = $matches;
+                    $matches[2] = $temp[3];
+                    $matches[3] = $temp[2];
+                    unset($temp);
+                }
+            }
+            
+            if (isset($matches[2][0]) && isset($matches[3][0])) {
+                foreach ($matches[2] as $k => $v) {
+                    $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
+                    if ($matches[3][$k] == 'video/lib/core.vod') {
+                        $method = 'video/lib/vod';
+                        $type = 2;
+                    } else {
+                        $type = 3;
+                        $method = 'video/lib/live';
+                    }
+
+                    $info = Dever::load($method)->get($v);
+                    if (isset($info['content'])) {
+                        unset($info['content']);
+                    }
+
+                    if ($type == 3) {
+                        # 查看是否有预约
+                        if ($uid > 0) {
+                            $info['user_act']['note'] = Dever::load('act/lib/note')->get($uid, $v, $type);
+                        } else {
+                            $info['user_act']['note'] = 2;
+                        }
+                    }
+                    $replace[] = array('id' => $v, 'type' => $type, 'content' => $info);
+                }
+            }
+        }
+
+        //$data['content'] = preg_replace('/<div class="dever-drop">([\s\S]*?)<\/div>/i', '', $data['content']);
+
+        $content = explode('{replace}', $content);
+        $data['content_array'] = array();
+        //print_r($content);die;
+        foreach ($content as $k => $v) {
+            $v = trim($v);
+            if (is_numeric($v) && $v >= 0 && isset($replace[$v])) {
+                $data['content_array'][] = $replace[$v];
+            } elseif ($v) {
+                $data['content_array'][] = array
+                (
+                    'type' => 1,
+                    'content' => $v,
+                );
+            }
+        }
+
+        if (!$data['content_array']) {
+            $data['content_array'][] = array
+            (
+                'type' => 1,
+                'content' => $data['content'],
+            );
+        }
+
+        unset($data['content']);
+
+        return $data;
+    }
+
+    # 获取相关推荐
+    public function getRelation($info)
+    {
+        $where['noid'] = $info['id'];
+        $where['cate_id'] = $info['cate_id'];
+        return Dever::db('content/article')->getRelation($where);
+    }
+
+    # 增加浏览量
+    public function addView($id)
+    {
+        Dever::db('content/article')->addView($id);
+    }
+}

+ 76 - 0
content/lib/Author.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace Content\Lib;
+
+use Dever;
+
+class Author
+{
+    # 更新数据
+    public function data($id, $name, $data)
+    {
+        $source_table = Dever::input('source_table');
+
+        $author = Dever::param('author_id', $data);
+
+        if ($author && $id > 0 && $source_table) {
+            $info = Dever::db('content/author')->one($author);
+            if (!$info) {
+                $insert['name'] = $author;
+                $author = Dever::db('content/author')->insert($insert);
+            }
+
+            Dever::db($source_table)->update(array('where_id' => $id, 'author_id' => $author));
+        }
+    }
+
+    # 搜索
+    public function search_api()
+    {
+        $keyword = Dever::input('keyword');
+
+        $yes = Dever::input('yes');
+
+        $where = array();
+
+        if ($yes) {
+            $yes = Dever::db('content/author')->getAll(array('ids' => $yes));
+        }
+        if (!$keyword) {
+            $where['limit'] = '0,50';
+            $data = Dever::db('content/author')->getAll($where);
+        } else {
+            $where['name'] = $keyword;
+            $data = Dever::db('content/author')->getAll($where);
+        }
+
+        $insert = array();
+        if (!$data && $keyword) {
+            $insert[0]['name'] = $keyword . '[新增]';
+            $insert[0]['value'] = $keyword;
+        }
+
+        $result = array();
+        if ($yes) {
+            foreach ($yes as $k => $v) {
+                if (isset($data[$k])) {
+                    unset($data[$k]);
+                }
+                $yes[$k]['selected'] = 'selected';
+            }
+            $data = $insert + $yes + $data;
+
+            $data = array_merge($data, array());
+        } else {
+            $data = $insert + $data;
+
+            $data = array_merge($data, array());
+        }
+
+        if (!$data) {
+            Dever::alert('暂无数据');
+        }
+
+        return $data;
+    }
+}

+ 19 - 0
content/lib/Page.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace Content\Lib;
+
+use Dever;
+
+class Page
+{
+    # 更新数据
+    public function link($id)
+    {
+    	$info = Dever::db('content/page')->one($id);
+        $url = Dever::url('page?key=' . $info['key'], 'main');
+
+        $html = '<a href="'.$url.'" target="_blank">点此查看</a>';
+
+        return $html;
+    }
+}

+ 1 - 0
data/readme

@@ -0,0 +1 @@
+dever create

+ 110 - 0
main/assets/mobile/content.html

@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+    <title></title>
+<link href="css/global.css?v=6e375888" rel="stylesheet"><link href="css/index.css?v=6e375888" rel="stylesheet"></head>
+
+<body>
+    <div class="rich-wrapper">
+        <{loop($content):}>  
+
+        <{if($v['type'] == 1):}>
+        <{$v['content']}>
+
+        <{elseif($v['type'] == 2):}>
+
+        <!--视频-->
+        <div class="p-img">
+            <a class="poster" id="video_<{$k}>" href="jstyle://video?id=<{$k}>&vod_id=<{$v['content']['id']}>&file=<{$v['content']['video']}>">
+                <img src="<{$v['content']['pic_cover']}>" alt="" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit"><{$v['content']['name']}></div>
+            <!--视频/图片副标题-->
+            <div class="tit-mini">已有 <{$v['content']['num_view']}> 人观看了视频</div>
+        </div>
+
+        <{elseif($v['type'] == 3):}>
+
+        <div class="p-img">
+            <a class="poster" id="live_<{$k}>" href="jstyle://live?id=<{$k}>&live_id=<{$v['content']['id']}>&live_status=<{$v['content']['status']}>&file=<{$v['content']['url']}>">
+                <img src="<{$v['content']['pic_cover']}>" alt="" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+        </div>
+
+        <!--直播-->
+        <{if($v['content']['status'] == 2):}>
+        <div class="live-notice">
+            <div class="online-user"><{$v['content']['num_user']}>人在线</div>
+        </div>
+        <{elseif($v['content']['status'] == 3):}>
+        <div class="live-notice">
+            <div class="watch-user"><{$v['content']['num_view']}>人观看</div>
+        </div>
+        <{elseif($v['content']['status'] == 1):}>
+        <!--直播-->
+        <div class="live-notice">
+            <div class="notice-time">开播时间 <{$v['content']['sdate_time']}></div>
+            <{if($v['content']['user_act'] == 1):}>
+            <a id="live_note_<{$k}>" href="jstyle://live_note?id=<{$k}>&live_id=<{$v['content']['id']}>&live_status=<{$v['content']['status']}>&note=1" class="btn-notice">已设置提醒</a>
+            <{else:}>
+            <a id="live_note_<{$k}>" href="jstyle://live_note?id=<{$k}>&live_id=<{$v['content']['id']}>&live_status=<{$v['content']['status']}>&note=2" class="btn-notice">提醒我</a>
+            <{endif}>
+        </div>
+        <!--直播-->
+        
+        <{endif}>
+
+        <{elseif($v['type'] == 5 && isset($v['cover'])):}>
+        <!--音频-->
+        <a class="p-voice" id="auido_<{$k}>" href="jstyle://auido?id=<{$k}>&file=<{$v['content']}>">
+            <img src="<{$v['cover']}>" alt="<{$v['name']}>" class="mavatar">
+            <div class="sound"></div>
+        </a>
+
+        <{elseif($v['type'] == 6 && isset($v['cover'])):}>
+        <!--视频-->
+        <div class="p-img">
+            <a class="poster" id="video_<{$k}>" href="jstyle://video?id=<{$k}>&file=<{$v['content']}>">
+                <img src="<{$v['cover']}>" alt="<{$v['name']}>" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit"><{$v['name']}></div>
+        </div>
+
+        <{elseif($v['type'] == 7 && isset($v['link'])):}>
+        <!--图片-->
+        <div class="p-img">
+            <a id="link_<{$k}>" href="$v['link']">
+
+                <img class="img" src="<{$v['pic_cover']}>" alt="">
+
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit" style="display:none;"><{$v['name']}></div>
+        </div>
+
+        <{endif}>
+
+        <{endloop}>
+    </div>
+<script type="text/javascript" src="js/global.js?v=6e375888"></script><script type="text/javascript" src="js/index.js?v=6e375888"></script></body>
+<script>
+function audioPlay(id){
+    $('#auido_'+ id).find('.sound').addClass('playing');
+}
+function audioPause(id){
+    $('#auido_'+ id).find('.sound').removeClass('playing');
+}
+function emit(id,txt){
+    $('#live_note_'+ id).html(txt);
+}
+
+</script>
+</html>

+ 2 - 0
main/assets/mobile/css/global.css

@@ -0,0 +1,2 @@
+body{font-family:Roboto,Droid Sans,Helvetica,Helvetica Neue,Heiti SC,sans-serif}abbr,address,article,aside,audio,b,blockquote,body,canvas,caption,cite,code,dd,del,details,dfn,div,dl,dt,em,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,samp,section,small,span,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,ul,var,video{margin:0;padding:0;border:none;outline:none}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}address,caption,cite,code,dfn,td,th,var{font-weight:400;font-style:normal}nav,ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}a,ins{text-decoration:none}table{border-collapse:collapse;border-spacing:0}caption,td,th{text-align:left}a,div,img,input{-webkit-tap-highlight-color:transparent;-webkit-appearance:none}input:focus::-webkit-input-placeholder,textarea:focus::-webkit-input-placeholder{color:transparent}.clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.fn-hide{display:none}.fn-nocallout{-webkit-touch-callout:none}.fn-noselect{-webkit-user-select:none}.fn-noadjust{-webkit-text-size-adjust:none}.fn-nodrag{-webkit-user-drag:none}
+/*# sourceMappingURL=global.css.map?v=6bc526e8*/

+ 1 - 0
main/assets/mobile/css/global.css.map

@@ -0,0 +1 @@
+{"version":3,"sources":[],"names":[],"mappings":"","file":"css/global.css?v=6bc526e8","sourceRoot":""}

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
main/assets/mobile/css/index.css


+ 1 - 0
main/assets/mobile/css/index.css.map

@@ -0,0 +1 @@
+{"version":3,"sources":[],"names":[],"mappings":"","file":"css/index.css?v=6bc526e8","sourceRoot":""}

+ 2 - 0
main/assets/mobile/css/rule.css

@@ -0,0 +1,2 @@
+body{padding:.64rem!important}body h1{padding-top:.64rem;text-align:center;font-size:.4rem;font-weight:700;margin-bottom:.64rem}body h2{line-height:1.6;font-weight:700}body h2,body p{font-size:.32rem}body p{min-height:.32rem;line-height:1.8}body img{max-width:100%}
+/*# sourceMappingURL=rule.css.map?v=6bc526e8*/

+ 1 - 0
main/assets/mobile/css/rule.css.map

@@ -0,0 +1 @@
+{"version":3,"sources":[],"names":[],"mappings":"","file":"css/rule.css?v=6bc526e8","sourceRoot":""}

+ 72 - 0
main/assets/mobile/index.html

@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+    <title></title>
+<link href="css/global.css?v=6e375888" rel="stylesheet"><link href="css/index.css?v=6e375888" rel="stylesheet"></head>
+
+<body>
+    <div class="rich-wrapper">
+        <!--音频-->
+        <a class="p-voice" id="auido_1" href="jstyle://auido?id=1">
+            <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/679a48b2efcf2c88af7754ac23461ecc.jpg" alt="" class="mavatar">
+            <div class="sound"></div>
+        </a>
+        <!--视频-->
+        <div class="p-img">
+            <a class="poster" id="video_2" href="jstyle://video?id=2">
+                <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg" alt="" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit">段宜恩:强大精神力的猫系偶像</div>
+            <!--视频/图片副标题-->
+            <div class="tit-mini">已有 112212 人观看了视频</div>
+        </div>
+
+        <!--视频-->
+        <div class="p-img">
+            <a class="poster" id="video_3" href="jstyle://video?id=3">
+                <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg" alt="" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit">段宜恩:强大精神力的猫系偶像</div>
+        </div>
+        <!--直播-->
+        <div class="live-notice">
+            <div class="watch-user">548 人观看</div>
+        </div>
+        <!--直播-->
+        <div class="live-notice">
+            <div class="notice-time">开播时间 2018.8.8 15:00</div>
+            <a id="live_1" href="jstyle://live?id=1" class="btn-notice">提醒我</a>
+        </div>
+        <!--直播-->
+        <div class="live-notice">
+            <div class="online-user">9999人在线</div>
+        </div>
+
+        <!--段落-->
+        <p>漫威宇宙里不只有英勇帅气的男英雄,深入民心的女英雄角色也不少,像复联系列的黑寡妇、绯红女巫,X战警中的凤凰女、暴风女,还有即将登场的惊奇队长,男女英雄无比默契地并肩作战场景总能让我们肾上腺素飙升。作为女英雄,除了拥有超高的武力值,身材、颜值一样在线,不知道斯坦李爷爷笔下的这些女英雄,有哪个镜头惊艳到你?</p>
+
+        <!--图片-->
+        <div class="p-img">
+            <img class="img" src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg" alt="">
+            <!--视频/图片标题-->
+            <div class="tit">段宜恩:强大精神力的猫系偶像</div>
+        </div>
+
+    </div>
+<script type="text/javascript" src="js/global.js?v=6e375888"></script><script type="text/javascript" src="js/index.js?v=6e375888"></script></body>
+<script>
+function audioPlay(id){
+    $('#auido_'+ id).find('.sound').addClass('playing');
+}
+function audioPause(id){
+    $('#auido_'+ id).find('.sound').removeClass('playing');
+}
+</script>
+</html>

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
main/assets/mobile/js/global.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
main/assets/mobile/js/global.js.map


+ 2 - 0
main/assets/mobile/js/index.js

@@ -0,0 +1,2 @@
+webpackJsonp([1],{1:function(n,t,c){"use strict";c(0),c(6)},6:function(n,t){},9:function(n,t,c){n.exports=c(1)}},[9]);
+//# sourceMappingURL=index.js.map?v=6e375888

+ 1 - 0
main/assets/mobile/js/index.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js","webpack:///./mobile/src/router/index.js"],"names":["webpackJsonp","1","module","exports","__webpack_require__","6","9"],"mappings":"AAAAA,cAAc,IAERC,EACA,SAAUC,EAAQC,EAASC,GAEjC,YCLAA,GAAA,GACAA,EAAA,IDaMC,EACA,SAAUH,EAAQC,KAMlBG,EACA,SAAUJ,EAAQC,EAASC,GAEjCF,EAAOC,QAAUC,EAAoB,MAKlC","file":"js/index.js?v=6e375888","sourcesContent":["webpackJsonp([1],{\n\n/***/ 1:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n__webpack_require__(0);\n\n__webpack_require__(6);\n\n/***/ }),\n\n/***/ 6:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 9:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(1);\n\n\n/***/ })\n\n},[9]);\n\n\n// WEBPACK FOOTER //\n// js?v=6e375888","import './global';\r\nimport '../css/index.css';\r\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/index.js"],"sourceRoot":""}

+ 2 - 0
main/assets/mobile/js/rule.js

@@ -0,0 +1,2 @@
+webpackJsonp([0],{10:function(n,t,c){n.exports=c(2)},2:function(n,t,c){"use strict";c(0),c(7)},7:function(n,t){}},[10]);
+//# sourceMappingURL=rule.js.map?v=6e375888

+ 1 - 0
main/assets/mobile/js/rule.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/rule.js","webpack:///./mobile/src/router/rule.js"],"names":["webpackJsonp","10","module","exports","__webpack_require__","2","7"],"mappings":"AAAAA,cAAc,IAERC,GACA,SAAUC,EAAQC,EAASC,GAEjCF,EAAOC,QAAUC,EAAoB,IAK/BC,EACA,SAAUH,EAAQC,EAASC,GAEjC,YCbAA,GAAA,GACAA,EAAA,IDqBME,EACA,SAAUJ,EAAQC,OAMrB","file":"js/rule.js?v=6e375888","sourcesContent":["webpackJsonp([0],{\n\n/***/ 10:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(2);\n\n\n/***/ }),\n\n/***/ 2:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n__webpack_require__(0);\n\n__webpack_require__(7);\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n},[10]);\n\n\n// WEBPACK FOOTER //\n// js/rule.js?v=6e375888","import './global';\r\nimport '../css/rule.css';\r\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/rule.js"],"sourceRoot":""}

+ 103 - 0
main/assets/mobile/rule.html

@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+    <title></title>
+<link href="css/global.css?v=6e375888" rel="stylesheet"><link href="css/rule.css?v=6e375888" rel="stylesheet"></head>
+
+<body>
+<h1>Jstyle精美隐私政策</h1>
+<div id="content">
+<p>2018年【11】月【2】日</p>
+<p>【精美(北京)科技有限公司】(以下简称“我们”)深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。同时,我们承诺,我们将按业界成熟的安全标准,采取相应的安全保护措施来保护您的个人信息。</p>
+<p>请在使用我们的产品(或服务)前,仔细阅读并了解本《隐私权政策》。</p>
+<p></p>
+<h2>一、我们如何收集和使用您的个人信息</h2>
+<p>个人信息是指以电子或者其他方式记录的能够单独或者与其他信息结合识别特定自然人身份或者反映特定自然人活动情况的各种信息。</p>
+<p>我们仅会出于本政策所述的以下目的,收集和使用您的个人信息:</p>
+<p>(一)注册成为用户</p>
+<p>为完成创建账号,您需提供以下信息:手机号码、短信验证码。</p>
+<p>在注册过程中,如果您提供以下额外信息,将有助于我们给您提供更好的服务和体验:微信头像、微信昵称。但如果您不提供这些信息,将不会影响使用本服务的基本功能。</p>
+<p>您提供的上述信息,将在您使用本服务期间持续授权我们使用。</p>
+<p>(二)开展内部数据分析和研究,第三方SDK统计服务,改善我们的产品或服务</p>
+<p>我们收集数据是根据您与我们的互动和您所做出的选择,包括您的隐私设置以及您使用的产品和功能。我们收集的数据可能包括SDK/API/JS代码版本、浏览器、互联网服务提供商、IP地址、平台、时间戳、应用标识符、应用程序版本、应用分发渠道、独立设备标识符、iOS广告标识符(IDFA)、安卓广告主标识符、网卡(MAC)地址、国际移动设备识别码(IMEI)、设备型号、终端制造厂商、终端设备操作系统版本、会话启动/停止时间、语言所在地、时区和网络状态(WiFi等)、硬盘、CPU和电池使用情况等。</p>
+<p>(三)本应用通过合法途径从商业伙伴处取得的用户个人数据。</p>
+<p></p>
+<p>当我们要将信息用于本策略未载明的其它用途时,会事先征求您的同意。</p>
+<p>当我们要将基于特定目的收集而来的信息用于其他目的时,会事先征求您的同意。</p>
+<p></p>
+<p>(四)您了解并同意,以下信息不适用本隐私权政策:</p>
+<p>1、	本应用收集到的您在本应用发布的有关信息数据,包括但不限于参与活动、成交信息及评价详情;</p>
+<p>2、	违反法律规定或违反本应用规则行为及本应用已对您采取的措施。</p>
+<p></p>
+<h2>二、我们如何使用 Cookie 和同类技术</h2>
+<p>(一)Cookie</p>
+<p>为确保网站或应用正常运转,我们会在您的计算机或移动设备上存储名为 Cookie 的小数据文件。Cookie 通常包含标识符、站点名称以及一些号码和字符。借助于 Cookie,网站或应用能够存储您的偏好或购物篮内的商品等数据。</p>
+<p>在您未拒绝接受cookies的情况下,本应用会在您的计算机或移动设备上设定或取用cookies ,以便您能登录或使用依赖于cookies的本应用平台服务或功能。本应用使用cookies可为您提供更加周到的个性化服务,包括推广服务。</p>
+<p>我们不会将 Cookie 用于本政策所述目的之外的任何用途。您有权选择接受或拒绝接受cookies。您可以通过修改浏览器设置的方式拒绝接受cookies。但如果您选择拒绝接受cookies,则您可能无法登录或使用依赖于cookies的本应用网络服务或功能。</p>
+<p>(二)网站信标和像素标签</p>
+<p>除 Cookie 外,我们还会在网站或应用上使用网站信标和像素标签等其他同类技术。</p>
+<p>(三)Do Not Track(请勿追踪)</p>
+<p>很多网络浏览器均设有 Do Not Track 功能,该功能可向网站发布 Do Not Track 请求。目前,主要互联网标准组织尚未设立相关政策来规定网站应如何应对此类请求。但如果您的浏览器启用了 Do Not Track,那么我们的所有网站都会尊重您的选择。</p>
+<p></p>
+<h2>三、我们如何共享、转让、公开披露您的个人信息</h2>
+<p>(一)共享</p>
+<p>我们不会向其他任何公司、组织和个人分享您的个人信息,但以下情况除外:</p>
+<p>1、在获取明确同意的情况下共享:获得您的明确同意后,我们会与其他方共享您的个人信息。</p>
+<p>2、我们可能会根据法律法规规定,或按政府主管部门的强制性要求,对外共享您的个人信息。</p>
+<p>3、与我们的关联公司共享:您的个人信息可能会与我们关联公司共享。我们只会共享必要的个人信息,且受本隐私政策中所声明目的的约束。关联公司如要改变个人信息的处理目的,将再次征求您的授权同意。</p>
+<p>4、与授权合作伙伴共享:仅为实现本隐私权政策中声明的目的,我们的某些服务将由授权合作伙伴提供。我们可能会与合作伙伴共享您的某些个人信息,以提供更好的客户服务和用户体验。例如,我们聘请来提供第三方数据统计和分析服务的公司可能需要采集和访问个人数据以进行数据统计和分析。在这种情况下,这些公司 必须遵守我们的数据隐私和安全要求。我们仅会出于合法、正当、必要、特定、明确的目的共享您的个人信息,并且只会共享提供服务所必要的个人信息。</p>
+<p>对我们与之共享个人信息的公司、组织和个人,我们会与其签署严格的保密协定,要求他们按照我们的说明、本隐私政策以及其他任何相关的保密和安全措施来处理个人信息。</p>
+<p>(二)转让</p>
+<p>我们不会将您的个人信息转让给任何公司、组织和个人,但以下情况除外:</p>
+<p>1、在获取明确同意的情况下转让:获得您的明确同意后,我们会向其他方转让您的个人信息;</p>
+<p>2、在涉及合并、收购或破产清算时,如涉及到个人信息转让,我们会在要求新的持有您个人信息的公司、组织继续受此隐私政策的约束,否则我们将要求该公司、组织重新向您征求授权同意。</p>
+<p>(三)公开披露</p>
+<p>我们仅会在以下情况下,公开披露您的个人信息:</p>
+<p>1、	获得您明确同意后;</p>
+<p>2、	为提供您所要求的产品和服务,而必须和第三方分享您的个人信息;</p>
+<p>3、	基于法律的披露:在法律、法律程序、诉讼或政府主管部门强制性要求的情况下,我们可能会公开披露您的个人信息。</p>
+<p>4、	如您出现违反中国有关法律、法规或者本应用服务协议或相关规则的情况,需要向第三方披露。</p>
+<p></p>
+<h2>四、我们如何保护您的个人信息</h2>
+<p>(一)我们已使用符合业界标准的安全防护措施保护您提供的个人信息,防止数据遭到未经授权访问、公开披露、使用、修改、损坏或丢失。我们会采取一切合理可行的措施,保护您的个人信息。例如,在您的浏览器与“服务”之间交换数据(如信用卡信息)时受 SSL 加密保护;我们会使用加密技术确保数据的保密性;我们会使用受信赖的保护机制防止数据遭到恶意攻击;我们会部署访问控制机制,确保只有授权人员才可访问个人信息。</p>
+<p>(二)我们会采取一切合理可行的措施,确保未收集无关的个人信息。我们只会在达成本政策所述目的所需的期限内保留您的个人信息,除非需要延长保留期或受到法律的允许。</p>
+<p>(三)互联网环境并非百分之百安全,我们将尽力确保或担保您发送给我们的任何信息的安全性。</p>
+<p></p>
+<h2>五、您如何管理个人信息</h2>
+<p>按照中国相关的法律、法规、标准,以及其他国家、地区的通行做法,我们保障您对自己的个人信息行使以下权利:</p>
+<p>(一)访问您的个人信息</p>
+<p>您有权访问您的个人信息,法律法规规定的例外情况除外。如果您想行使数据访问权,可以通过以下方式自行访问:</p>
+<p>个人信息——如果您希望访问或编辑您的账户中的个人资料信息、添加安全信息等,您可以通过访问Jstyle精美APP中的个人信息执行此类操作。</p>
+<p>操作信息——您可以在Jstyle精美APP中访问或查看、修改操作信息以及管理其他数据。</p>
+<p>如果您无法通过上述链接访问这些个人信息,您可以随时使用我们问题反馈表单联系,或发送电子邮件至jmkf@sg.com.cn。我们将在30天内回复您的访问请求。</p>
+<p>(二)调整您的个人信息</p>
+<p>当您发现我们处理的关于您的个人信息有错误时,您有权要求我们做出更正。您可以通过“(一)访问您的个人信息”中罗列的方式调整。</p>
+<p>如果您无法通过上述链接更正这些个人信息,您可以随时发送电子邮件至jmkf@sg.com.cn。我们将在30天内回复您的更正请求。</p>
+<p>(三)响应您的上述请求</p>
+<p>为保障安全,您可能需要提供书面请求,或以其他方式证明您的身份。我们可能会先要求您验证自己的身份,然后再处理您的请求。</p>
+<p>对于您合理的请求,我们原则上不收取费用,但对多次重复、超出合理限度的请求,我们将视情收取一定成本费用。对于那些无端重复、需要过多技术手段(例如,需要开发新系统或从根本上改变现行惯例)、给他人合法权益带来风险或者非常不切实际(例如,涉及备份磁带上存放的信息)的请求,我们可能会予以拒绝。</p>
+<p>在以下情形中,按照法律法规要求,我们将无法响应您的请求:</p>
+<p>1、与国家安全、国防安全有关的;</p>
+<p>2、与公共安全、公共卫生、重大公共利益有关的;</p>
+<p>3、与犯罪侦查、起诉和审判等有关的;</p>
+<p>4、有充分证据表明您存在主观恶意或滥用权利的;</p>
+<p>5、响应您的请求将导致您或其他个人、组织的合法权益受到严重损害的。</p>
+<p></p>
+<h2>六、您的个人信息如何在全球范围转移</h2>
+<p>由于我们应用收集的有关您的信息和资料将保存在本应用及(或)其关联公司的服务器上,这意味着,您的个人信息和资料可能传送至您所在国家、地区或本应用收集信息和资料所在地的境外管辖区并在境外被访问、存储和展示。</p>
+<p></p>
+<h2>七、本隐私权政策如何更新</h2>
+<p>我们可能适时会对本隐私权政策进行调整或变更,本隐私权政策的任何更新将以标注更新时间的方式公布在我们网站上,除法律法规或监管规定另有强制性规定外,经调整或变更的内容一经通知或公布后的3日后生效。如您在隐私权政策调整或变更后继续使用我们提供的任一服务或访问我们相关应用的,我们相信这代表您已充分阅读、理解并接受修改后的隐私权政策并受其约束。</p>
+<p>本公司保留随时修改本政策的权利。</p>
+<p></p>
+<h2>八、如何联系我们</h2>
+<p>如果您对本隐私政策有任何疑问、意见或建议,通过以下方式与我们联系:</p>
+<p>邮箱:【jmkf@sg.com.cn】;电话:【010-62423789】</p>
+<p>我们设立了个人信息保护专职部门(或个人信息保护专员),您可以通过以下方式与其联系:【010-62423789】 </p>
+<p>一般情况下,我们将在三十天内回复。</p>
+</div>
+<script type="text/javascript" src="js/global.js?v=6e375888"></script><script type="text/javascript" src="js/rule.js?v=6e375888"></script></body>
+</html>

+ 93 - 0
main/database/config.php

@@ -0,0 +1,93 @@
+<?php
+
+$video = array
+(
+	1 => '显示',
+	2 => '不显示',
+);
+
+return array
+(
+	# 表名
+	'name' => 'config',
+	# 显示给用户看的名称
+	'lang' => '基本配置',
+	'order' => 1,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '系统ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'hr1'		=> array
+		(
+			'name' 		=> '通用设置',
+			'class'		=> '',//本项必须填写
+			'attr'		=> '',
+		),
+		
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '系统名称',
+			'default' 	=> '',
+			'desc' 		=> '请输入系统名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+		),
+		
+		'info'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '系统介绍',
+			'default' 	=> '',
+			'desc' 		=> '请输入系统介绍',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+		),
+
+		'logo'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> 'logo图片',
+			'default' 	=> '',
+			'desc' 		=> 'logo图片',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+		),
+	),
+
+	'default' => array
+	(
+		'col' => 'name,info,cdate',
+		'value' => array
+		(
+			'"年夜饭","年夜饭",' . time(),
+		),
+	),
+
+	'manage' => array
+	(
+		# 后台管理不要列表页
+		'list' => 'update',
+	),
+);

+ 8 - 0
main/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'main');
+define('DEVER_APP_LANG', '基础设置');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 98);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-component');
+include(DEVER_APP_PATH . '../boot.php');

+ 149 - 0
main/lib/Core.php

@@ -0,0 +1,149 @@
+<?php
+
+namespace Main\Lib;
+
+use Dever;
+
+class Core
+{
+    protected $checkUser = false;
+    protected $data;
+    public function __construct()
+    {
+        # 获取用户信息
+        if ($this->checkUser) {
+            $this->data['uid'] = Dever::load('passport/applet')->check();
+        } else {
+            $this->data['uid'] = Dever::load('passport/applet')->check(false);
+        }
+        if ($this->data['uid'] < 0) {
+            $this->data['uid'] = 0;
+        }
+        //$this->data['uid'] = 1;
+
+        # 获取基本配置
+        $this->data['config'] = Dever::db('main/config')->one();
+        $this->data['system'] = Dever::input('system', 1);
+
+        $source_type = Dever::input('source_type');
+        $this->app = false;
+        if ($source_type == 'ios' || $source_type == 'android') {
+            $this->app = true;
+        }
+    }
+
+    # 图片处理
+    public function pic($data, $type = 't1')
+    {
+        //?imageView2/1/w/100/h/100/q/75
+        $config = array
+        (
+            'pic','pic_cover', 'pic_cover_169', 'content', 'share_pic'
+        );
+
+        foreach ($config as $k => $v) {
+            if (isset($data[$v]) && $data[$v]) {
+                $data[$v] = $this->replacePic($data[$v], $type);
+            }
+        }
+
+        return $data;
+    }
+
+    public function replacePic($pic, $type = 't1')
+    {
+        //$pic = Dever::pic($pic, $type);
+
+        if (strstr($pic, 'http://')) {
+            $pic = str_replace('http://', 'https://', $pic);
+        }
+
+        return $pic;
+    }
+
+    # 列表页里的数据 根据类型,解析内容
+    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);
+            $info = Dever::db($table)->one($id);
+            if ($info) {
+                return $this->getInfo($type, $info, $content);
+            } else {
+                return array();
+            }
+            
+        }
+        return array();
+    }
+
+    protected function getInfo($type, $info, $content = false)
+    {
+        $info = $this->pic($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['cate_id']) && $info['cate_id']) {
+            $cate = Dever::db('content/cate')->one($info['cate_id']);
+            $info['cate_name'] = $cate['name'];
+        }
+
+        if (isset($info['author_id']) && $info['author_id']) {
+            $author = Dever::db('content/author')->one($info['author_id']);
+            $info['author_name'] = $author['name'];
+        }
+
+        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']);
+        }
+
+        if (isset($info['name']) && $info['name']) {
+            $info['name'] = Dever::cut($info['name'], 20, '...');
+        }
+        return $info;
+    }
+
+    protected function getSourceUid($error = true)
+    {
+        return Dever::load('invite/api')->getSourceUid($this->data['uid'], $error);
+    }
+
+    protected function log()
+    {
+        $input = Dever::json_encode(Dever::input());
+        $url = Dever::url();
+        Dever::log($url . '||' . $input, 'request');
+    }
+}

+ 47 - 0
main/lib/Preview.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace Main\Lib;
+
+use Dever;
+
+class Preview
+{
+    public function article_api()
+    {
+        $id = Dever::input('id');
+
+        $data = Dever::load('content/lib/article')->get($id);
+    
+        return $data;
+
+    }
+
+    public function vod_api()
+    {
+        $id = Dever::input('id');
+
+        $data = Dever::load('content/lib/article')->get($id);
+    
+        return $data;
+
+    }
+
+    public function live_api()
+    {
+        $id = Dever::input('id');
+
+        $data = Dever::load('content/lib/article')->get($id);
+    
+        return $data;
+
+    }
+
+    public function journal_api()
+    {
+        $id = Dever::input('id');
+
+        $data = Dever::load('content/lib/article')->get($id);
+    
+        return $data;
+    }
+}

+ 154 - 0
main/src/Content.php

@@ -0,0 +1,154 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class Content extends Core
+{
+    /*
+    public function del()
+    {
+        $uid = Dever::input('uid');
+        Dever::db('passport/user')->delete($uid);
+        $info = Dever::db('passport/wechat')->state(array('uid' => $uid));
+        if ($info) {
+            foreach ($info as $k => $v) {
+                Dever::db('passport/wechat')->delete($v['id']);
+            }
+        }
+
+        return 'ok';
+    }
+    */
+
+    public function test()
+    {
+        $journal = Dever::db('journal/info')->one(8);
+        # 发模板消息
+        $uid = Dever::input('uid');
+        $user = Dever::db('passport/user')->one($uid);
+        $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid));
+
+        print_r($wechat);die;
+        if ($wechat && Dever::project('wechat_applet')) {
+            $send['key'] = 'buy_journal';
+            $send['project_id'] = 1;
+            $send['touser'] = $wechat['openid'];
+            $send['page'] = Dever::config('base')->applet_index . '?scene=' . Dever::login($uid) . ',' . '4,' . $order['product_id'];
+            $send['data'] = json_encode(array
+            (
+                'keyword1' => array('value' => date('Y年m月d日 H:i', $order['cdate'])),
+                'keyword2' => array('value' => '购买成功,您获得了 '.$journal['name'].' 的阅读资格!'),
+            ));
+            $send['form_id'] = Dever::load('act/lib/form')->get($uid, 2);
+
+            if ($send['form_id']) {
+                Dever::load('wechat_applet/msg.send', $send);
+            }
+        }
+
+        # 发短信
+        if (isset($user['mobile']) && $user['mobile'] && Dever::project('sms')) {
+            $send = array();
+            $send['name'] = $journal['name'];
+            Dever::load('sms/api.send', 'buy_journal', $user['mobile'], $send);
+        }
+    }
+
+    # 开屏广告
+    public function ad()
+    {
+        $this->data['push_screen_ad'] = Dever::load('push/lib/data')->get('app_screen_ad', 'APP开屏广告', 1);
+
+        return $this->data;
+    }
+    
+    # 首页精选
+    public function home()
+    {
+        //1 Y2JhNGRwc0hhMEt5akp2bHBPeWIwc08tTDRWcG1DVURrUUZ4ZjV0Um85U01QMlZkOEtTcGEtR3c=
+        //2 ZTdjNjBHUTY4QUpoZk16QVlZRlg0d3locDFRcll5a3FQcWhFdEo1M1QzaFhmNGhrUlAyTTdGVWc= 
+        //9 ZTBiZWN5dW9ublpnSzR2dmlXUUc5MWJJQWk5d3pFQmx0TEp6a0VJVkU4NG5HVTYtcjhFNTdfdnc=
+        # 栏目
+        //$this->data['push_menu'] = Dever::load('push/lib/data')->get('menu', '头部导航');
+
+        $this->data['menu'] = Dever::db('content/cate')->getAll();
+
+        if ($this->app) {
+            # 焦点图
+            $this->data['push_focus'] = Dever::load('push/lib/data')->get('app_focus', 'APP精选焦点图');
+
+            # 广告
+            $this->data['push_ad'] = Dever::load('push/lib/data')->get('app_ad', 'APP精选广告位');
+
+            # 广告弹窗
+            $this->data['push_open_ad'] = Dever::load('push/lib/data')->get('app_open_ad', 'APP精选弹窗广告位');
+        } else {
+            # 焦点图
+            $this->data['push_focus'] = Dever::load('push/lib/data')->get('focus', '精选焦点图');
+
+            # 广告
+            $this->data['push_ad'] = Dever::load('push/lib/data')->get('ad', '精选广告位');
+
+            # 广告弹窗
+            $this->data['push_open_ad'] = Dever::load('push/lib/data')->get('open_ad', '精选弹窗广告位');
+        }
+        
+        # 开屏广告
+        $this->data['push_screen_ad'] = Dever::load('push/lib/data')->get('app_screen_ad', 'APP开屏广告', 1);
+
+        # 推荐位
+        $this->data['push_link'] = Dever::load('push/lib/data')->get('link', '精选分类');
+
+        # 精选推荐
+        $this->data['push_up'] = Dever::load('push/lib/data')->get('up', '精选推荐');
+
+        $this->news();
+
+        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();
+
+        $cate = Dever::input('menu');
+        $where = array();
+        if ($cate > 0) {
+            $where['cate_id'] = $cate;
+        }
+
+        $type = Dever::input('type');
+        if ($type > 0) {
+            $where['type'] = $type;
+        }
+
+        if (checkVersion()->video == 2) {
+            $where['type_no'] = 2;
+        }
+
+    	$data = Dever::db('audit/data')->getAll($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->content($v);
+            }
+            $this->data['news'] = $data;
+        } else {
+            $this->data['news'] = array();
+        }
+
+        return $this->data;
+    }
+}

+ 825 - 0
main/src/Journal.php

@@ -0,0 +1,825 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class Journal extends Core
+{
+    private function getCate()
+    {
+        $id = Dever::input('system', 1);
+
+        $cate = array();
+        if ($id > 0) {
+            $cate = Dever::db('journal/cate')->one($id);
+        }
+
+        if (!$cate) {
+            Dever::alert('分类错误');
+        }
+
+        $this->data['cate'] = $cate;
+
+        return $cate;
+    }
+
+    # 小刊首页
+    public function home()
+    {
+        # 精选推荐
+        $this->jingxuan(-1, 5);
+
+        $cate = $this->getCate();
+
+        # 小刊列表
+        $where = array();
+        $where['cate_id'] = $cate['id'];
+        if (checkVersion()->journal_buy == 2) {
+            # 隐藏支付的小刊
+            //$where['buy'] = 2;
+        }
+        $data = Dever::db('journal/info')->getAll($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->info($v);
+            }
+            $this->data['journal'] = $data;
+        } else {
+            $this->data['journal'] = array();
+        }
+
+        return $this->data;
+    }
+
+    # 根据分类获取小刊列表
+    public function getList()
+    {
+        $cate = $this->getCate();
+
+        $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
+
+        # 小刊列表
+        $where = array();
+        $where['cate_id'] = $cate['id'];
+        $data = Dever::db('journal/info')->getAllByPage($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->info($v);
+            }
+            $this->data['journal'] = $data;
+        } else {
+            $this->data['journal'] = array();
+        }
+
+        return $this->data;
+    }
+
+    # 根据分类获取我已订阅的小刊列表
+    public function getMyList()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $cate = $this->getCate();
+
+        $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
+
+        # 获取我的信息
+        $this->data['user'] = Dever::load('passport/api')->info($this->data['uid']);
+        
+        # 我的小刊列表
+        $where = array();
+        $where['type'] = 4;
+        $where['source'] = '1,2,3,4';
+        $where['cate_id'] = $cate['id'];
+        $data = Dever::db('act/subscribe')->getMyAll($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->info($v);
+            }
+            $this->data['journal'] = $data;
+        } else {
+            $this->data['journal'] = array();
+        }
+
+        return $this->data;
+    }
+
+    # 获取详细信息
+    private function info($data, $subscribe = true)
+    {
+        if ($data['pdate'] > 0) {
+            $data['pdate_time'] = date('Y-m-d H:i:s', $data['pdate']);
+        }
+
+        if ($data['pic_view_bg']) {
+            $data['pic_view_bg'] = explode(',', $data['pic_view_bg']);
+        } else {
+            $data['pic_view_bg'] = array();
+        }
+
+        $data['buy'] = intval($data['buy']);
+
+        # 获取订阅列表
+        if ($subscribe) {
+            $data['subscribe'] = Dever::load('act/lib/subscribe')->getList($data['id'], 4);
+
+            if (!$data['subscribe']) {
+                $data['subscribe'] = array();
+            }
+        }
+
+        return $data;
+    }
+
+    # 精选推荐更多
+    public function jingxuan($page = true, $num = 4)
+    {
+        if (!$page) {
+            $page = true;
+        }
+        if ($page === -1) {
+            $page = false;
+        }
+        if (!$num) {
+            $num = 4;
+        }
+        $this->data['push_jingxuan'] = Dever::load('push/lib/data')->get('jingxuan', '小刊精选推荐', 4, $page, $num);
+
+        $count = count($this->data['push_jingxuan']);
+
+        
+        if ($num == 5) {
+            if ($count < 4 || !$this->data['push_jingxuan']) {
+                $this->data['push_jingxuan'] = array();
+            }
+
+            $this->data['push_jingxuan_more'] = 2;
+            # 是否有更多按钮
+            if ($count > 4 && isset($this->data['push_jingxuan'][4])) {
+                unset($this->data['push_jingxuan'][4]);
+                $this->data['push_jingxuan_more'] = 1;
+            }
+        } else {
+            $page = Dever::pageInfo();
+            if ($page['status'] != 1) {
+                Dever::$global['page']['current']['next_page'] = 1;
+            }
+        }
+
+        return $this->data;
+    }
+
+    # 小刊查看详情
+    public function view()
+    {
+        $id = $this->check();
+        $this->data['info'] = $this->info($this->data['info'], false);
+        $this->button($this->data['info']);
+
+        if ($this->data['uid'] > 0) {
+            Dever::score($this->data['uid'], 'view_journal', '浏览小刊首页');
+        }
+
+        return $this->data;
+    }
+
+    # 按钮设置
+    private function button($info)
+    {
+        $this->data['button'] = array();
+        $this->setButton();
+
+        $uid = $this->data['uid'];
+
+        # 查看是否订阅
+        $subscribe = Dever::load('act/lib/subscribe')->get($info['id'], $uid, 4);
+        $this->data['info']['subscribe'] = 2;
+
+        # 查看是否有活动
+        $active = Dever::db('journal/active')->one(array('id' => $info['id']));
+        $this->data['info']['active'] = 2;
+        if ($active && $active['status'] == 1) {
+            $this->data['info']['active'] = 1;
+        }
+
+        if (isset($this->data['info']['share_content'])) {
+            $source = Dever::db('source/info')->one(1);
+            $this->data['info']['share_link'] = $source['code'];
+        }
+        
+        $time = time();
+        if ($active && $time >= $active['start'] && $time < $active['end']) {
+            $this->data['info']['active'] = 1;
+        }
+
+        if ($this->data['info']['active'] == 1) {
+            $this->setButton('share', 1);
+        } else {
+            $this->setButton('share', -1);
+        }
+
+        if ($info['buy'] == 2) {
+            # 免费的
+            $this->setButton('read', 1, '开始阅读');
+            $this->setButton('code', -1);
+            $this->setButton('share', -1);
+        } elseif ($subscribe == 1) {
+            $this->data['info']['subscribe'] = 1;
+            # 已订阅
+            $this->setButton('read', 1, '开始阅读');
+            $this->setButton('code', 2, '再次购买');
+
+            if (checkVersion()->journal_buy == 2) {
+                $this->setButton('code', 1, '兑换码阅读');
+                $this->setButton('share', -1);
+            }
+        } elseif ($info['buy'] == 1 || $info['buy'] == 3) {
+            # 需要购买
+            $this->setButton('read', 2, '购买阅读');
+            $this->setButton('code', 1, '兑换码阅读');
+
+            if (checkVersion()->journal_buy == 2) {
+                $this->setButton('read', -1);
+                $this->setButton('share', -1);
+            }
+        }
+
+        $applet_type = Dever::input('applet_type');
+        if ($applet_type == 2 && isset($this->data['config']['ios_pay']) && $this->data['config']['ios_pay'] == 1 && $info['buy'] == 1) {
+            # 关闭支付
+            if ($subscribe == 1) {
+                $this->data['info']['subscribe'] = 1;
+                $this->setButton('read', 1, '开始阅读');
+            } else {
+                $this->setButton('read', -1);
+            }
+            
+            $this->setButton('code', 1, '兑换码阅读');
+            //$this->setButton('share', -1);
+        }
+    }
+
+    private function setButton($key = false, $status = false, $name = false)
+    {
+        # 按钮状态,-1为不显示
+        if (!$this->data['button']) {
+            $this->data['button'] = array
+            (
+                # 第一个按钮
+                'read' => array('status' => -1, 'name' => '购买阅读'),
+                # 第二个按钮
+                'code' => array('status' => -1, 'name' => '兑换码阅读'),
+                # 第三个按钮 免费阅读赢取大礼包 改为
+                'share' => array('status' => 1, 'name' => '积分打榜赢奖品'),
+            );
+        }
+
+        if ($key && isset($this->data['button'][$key])) {
+            if ($status) {
+                $this->data['button'][$key]['status'] = $status;
+            }
+            if ($name) {
+                $this->data['button'][$key]['name'] = $name;
+            }
+        }
+    }
+
+    # 购买阅读页
+    public function buy()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+        $id = $this->check();
+
+        # 获取购买说明
+        $buy = Dever::db('journal/buy')->one(array('id' => $id));
+
+        $this->data['buy_desc'] = '';
+        if ($buy) {
+            $this->data['buy_desc'] = $buy['buy_content'];
+        }
+
+        if ($this->data['info']['buy'] == 2) {
+            $this->data['buy_list'] = array();
+            return $this->data;
+        }
+        # 获取购买列表
+        $this->data['buy_list'] = Dever::db('journal/buy_num')->getAll(array('info_id' => $id));
+
+        if ($this->data['info']['cash'] <= 0) {
+            $this->data['info']['cash'] = 100000;
+        }
+        if ($this->data['buy_list']) {
+            foreach ($this->data['buy_list'] as $k => $v) {
+                if (!$v['name']) {
+                    $this->data['buy_list'][$k]['name'] = '购买' . $v['num'] . '本';
+                }
+
+                $price = $v['num'] * $this->data['info']['cash'];
+                if (!$v['price']) {
+                    $this->data['buy_list'][$k]['price'] = $price;
+                }
+
+                $this->data['buy_list'][$k]['cash'] = $price;
+            }
+        }
+
+        return $this->data;
+    }
+
+    # 小刊邀请活动页
+    public function active()
+    {
+        $id = $this->check();
+
+        # 获取购买说明
+        $buy = Dever::db('journal/buy')->one(array('id' => $id));
+
+        # 获取活动说明
+        $this->data['active'] = Dever::db('journal/active')->one(array('id' => $id));
+
+
+        if (!$this->data['active']) {
+            $this->data['active'] = (object) array();
+            return $this->data;
+        }
+
+        $time = time();
+        if ($this->data['active'] && $time >= $this->data['active']['start'] && $time < $this->data['active']['end']) {
+            $this->data['active']['status'] = 1;
+        } else {
+            $this->data['active']['status'] = 2;
+        }
+
+        if ($time < $this->data['active']['start']) {
+            $this->data['active']['status'] = 3;
+        }
+
+        $this->data['active']['buy_title'] = '';
+        $this->data['active']['buy_desc'] = '';
+        if ($buy) {
+            $this->data['active']['buy_title'] = $buy['buy_title'];
+            $this->data['active']['buy_desc'] = $buy['buy_desc'];
+        }
+
+        # 获取我邀请的好友
+        if ($this->data['uid']) {
+            $this->data['invite'] = Dever::load('act/lib/invite')->getList($this->data['uid'], $id);
+        }
+
+        # 是否显示购买按钮 1显示 2不显示
+        $this->data['buy'] = 1;
+        if (checkVersion()->journal_buy == 2) {
+            $this->data['buy'] = 2;
+        }
+
+        return $this->data;
+    }
+
+    # 积分排行榜
+    public function score()
+    {
+        $id = $this->check();
+
+        $this->data['score'] = Dever::load('act/lib/score')->getList($id);
+
+        # 获取活动说明
+        $this->data['active'] = Dever::db('journal/active')->one(array('id' => $id));
+
+
+        if (!$this->data['active']) {
+            $this->data['active'] = (object) array();
+            return $this->data;
+        }
+
+        $time = time();
+        if ($this->data['active'] && $time >= $this->data['active']['start'] && $time < $this->data['active']['end']) {
+            $this->data['active']['status'] = 1;
+        } else {
+            $this->data['active']['status'] = 2;
+        }
+
+        if ($time < $this->data['active']['start']) {
+            $this->data['active']['status'] = 3;
+        }
+
+        return $this->data;
+    }
+
+    # 邀请好友排行榜
+    public function invite()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $id = $this->check();
+
+        $this->data['invite'] = Dever::load('act/lib/invite')->getList($this->data['uid'], $id);
+
+        return $this->data;
+    }
+
+
+    # 小刊阅读页
+    public function read()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+        # 验证是否可以阅读
+        $id = $this->check();
+        $this->data['info'] = $this->info($this->data['info'], false);
+
+        # 是否转码
+        //$this->data['info']['bgmusic'] = convert($this->data['info']['bgmusic'], 'mp3', 'journal/info', $this->data['info']['id'], 'bgmusic');
+
+        $subscribe = Dever::load('act/lib/subscribe')->get($id, $this->data['uid'], 4);
+
+        if ($this->data['info']['buy'] == 1 && $subscribe == 2) {
+            Dever::alert('未订阅');
+        }
+
+        if ($this->data['info']['buy'] == 2) {
+            Dever::load('act/lib/subscribe')->submit($this->data['uid'], $id, 4);
+        }
+
+        if ($this->data['uid'] > 0) {
+            Dever::score($this->data['uid'], 'read_journal', '阅读小刊');
+        }
+
+        # 获取最新10条内容
+        $where = array();
+        $where['info_id'] = $id;
+        $data = Dever::db('journal/content')->getAll($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->readContent($v);
+            }
+            $this->data['content'] = $data;
+        } else {
+            $this->data['content'] = array();
+        }
+
+        # 浏览量+1
+        Dever::db('journal/info')->addView($id);
+
+        return $this->data;
+    }
+
+    public function readContent($info)
+    {
+        $name = $info['name'];
+        $focus = $info['focus'];
+        $author_id = $info['author_id'];
+        $content = $info['content'];
+        unset($info['name']);
+        unset($info['focus']);
+        unset($info['author_id']);
+        unset($info['content']);
+
+        if ($info['type'] == 1 && $info['text']) {
+            $info['text'] = Dever::array_decode($info['text']);
+            if ($info['text']) {
+                foreach ($info['text'] as $k => $v) {
+                    if (isset($info['text'][$k]['bgcolor_type']) && $info['text'][$k]['bgcolor_type'] == array(2)) {
+                        $info['text'][$k]['bgcolor'] = '';
+                    }
+                }
+            }
+            
+        } else {
+            unset($info['text']);
+        }
+
+        if ($info['type'] == 3) {
+            $info['info'] = array();
+            $info['info']['name'] = $name;
+            $info['info']['focus'] = $focus;
+            $info['info']['author_id'] = $author_id;
+            $info['info']['content'] = $content;
+            $info['info'] = Dever::load('content/lib/article')->getContent($info['info'], $this->data['uid']);
+        } elseif ($info['type'] == 4 || $info['type'] == 5) {
+            $info['video'] = convert($info['video'], 'mp4', 'journal/content', $info['id'], 'video');
+            if ($info['type'] == 5) {
+                $info['name'] = $name;
+            }
+        } elseif ($info['type'] == 6) {
+            $info['name'] = $name;
+            //音频先不转码
+            //$info['music'] = convert($info['music'], 'mp3', 'journal/content', $info['id'], 'music');
+        } elseif ($info['type'] == 11) {
+            $info['info'] = Dever::load('content/lib/article')->get($info['article_id']);
+        } elseif ($info['type'] == 12) {
+            $info['info'] = Dever::load('video/lib/vod')->get($info['vod_id']);
+        } elseif ($info['type'] == 13) {
+            $info['info'] = Dever::load('video/lib/live')->get($info['live_id']);
+
+            if ($this->data['uid'] > 0) {
+                $info['info']['note'] = Dever::load('act/lib/note')->get($this->data['uid'], $info['info']['id'], 3);
+                
+            } else {
+                $info['info']['note'] = 2;
+            }
+        }
+
+        if (isset($info['info']['author_id']) && $info['info']['author_id']) {
+            $info['info']['author'] = Dever::db('content/author')->one($info['info']['author_id']);
+        }
+
+        if (isset($info['pic']) && $info['pic']) {
+            $info['pic'] = str_replace('http://', 'https://', $info['pic']);
+        }
+
+        return $info;
+    }
+
+    private function check()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('小刊已下架');
+        }
+
+        $where['id'] = $id;
+        $this->data['info'] = Dever::db('journal/info')->one($where);
+
+        if (!$this->data['info']) {
+            Dever::alert('小刊已下架');
+        }
+
+        return $id;
+    }
+
+    # 购买
+    public function buy_action()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+        $source_uid = $this->getSourceUid(false);
+        $buy_id = Dever::input('buy_id');
+        $journal_id = Dever::input('journal_id');
+        $cate = $this->getCate();
+
+        if (!$buy_id) {
+            Dever::alert('请传入正确的支付ID');
+        }
+        if (!$journal_id) {
+            Dever::alert('请传入正确的小刊ID');
+        }
+
+        $info = Dever::db('journal/info')->one($journal_id);
+        $buy = Dever::db('journal/buy_num')->one($buy_id);
+
+        if (!$buy || !$info) {
+            Dever::alert('请传入正确的小刊ID');
+        }
+
+        if (!$buy['name']) {
+            $buy['name'] = '购买' . $buy['num'] . '本';
+        }
+
+        $user = Dever::db('passport/user')->one($this->data['uid']);
+        $wechat = Dever::db('passport/wechat')->one(array('uid' => $this->data['uid'], 'type' => 1, 'system_id' => $this->data['system']));
+
+        $source_type = Dever::input('source_type');
+
+        if ($source_type == 'ios') {
+            $method = 'apple';
+            $order_data['system'] = 3;
+            $account_id = 3;
+            # 使用苹果内购支付
+            $receipt = Dever::input('receipt');
+            if (!$receipt) {
+                Dever::alert('苹果内购支付失败,没有receipt参数');
+            }
+        } elseif ($source_type == 'android') {
+            $method = 'app';
+            $order_data['system'] = 4;
+            $account_id = 3;
+        } else {
+            $method = 'applet';
+            $order_data['system'] = 1;
+            $account_id = 1;
+            # 根据cate_id走不同的支付id,暂时不需要
+            if ($cate && $cate['id'] == 2) {
+                $account_id = 4;
+            } elseif ($cate && $cate['id'] == 2) {
+                $account_id = 5;
+            }
+            //$account_id = $cate['pay_id'];
+        }
+
+        $order_id = $this->createOrder('JP');
+        $order_data['cate_id'] = $cate['id'];
+        $order_data['order_id'] = $order_id;
+        $order_data['product_id'] = $journal_id;
+        $order_data['buy_id'] = $buy_id;
+        $order_data['uid'] = $this->data['uid'];
+        if ($source_uid > 0) {
+            $order_data['source_uid'] = $source_uid;
+        }
+        
+        $order_data['type'] = 1;
+        $order_data['status'] = 1;
+        $order_data['name'] = $info['name'] . '-' . $buy['name'];
+        //$order_data['num'] = Dever::input('num', 1);
+        $order_data['num'] = $buy['num'];
+        if (isset($buy['price']) && $buy['price'] && $buy['price'] > 0) {
+            $order_data['cash'] = $buy['price'];
+        } else {
+            $order_data['cash'] = $info['cash'] * $order_data['num'];
+        }
+
+        $source = Dever::input('source');
+        if ($source) {
+            $order_data['source'] = $source;
+        }
+        $seller = Dever::input('seller');
+        if ($seller) {
+            $order_data['seller_id'] = $seller;
+        }
+
+        $id = Dever::db('journal/order')->insert($order_data);
+
+        if (!$id) {
+            Dever::alert('支付失败');
+        }
+
+        //$param参数
+        $param = array
+        (
+            'account_id' => $account_id,
+            'project_id' => 1,
+            'uid' => $this->data['uid'],
+            'username' => $user['username'],
+            'name' => $order_data['name'],
+            'cash' => $order_data['cash'],
+            //'cash' => '0.01',
+            'openid' => $wechat['openid'],
+            'product_id' => $journal_id . '-' . $buy_id,
+            'order_id' => $order_id,
+        );
+
+        if ($method == 'apple') {
+            $param['other'] = $receipt;
+        }
+
+        $this->data['pay'] = Dever::load('pay/api.' . $method, $param);
+
+        if ($order_data['system'] == 1) {
+            if (isset($this->data['pay']['prepay_id'])) {
+                Dever::load('act/lib/form')->submit($this->data['uid'], $this->data['pay']['prepay_id'], 2, $this->data['system']);
+            } else {
+                Dever::alert('支付失败');
+            }
+        }
+
+        return $this->data;
+    }
+
+    # 根据code检索是否存在
+    public function checkCode()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+        $code = trim(Dever::input('code'));
+
+        if ($code) {
+
+            $info = Dever::db('code/info')->one(array('code' => $code));
+
+            if (!$info) {
+                Dever::alert('兑换码不存在');
+            }
+
+            if ($info['type'] == 3) {
+                Dever::alert('兑换码已被使用');
+            }
+
+            if ($info['type'] == 2 && $this->data['uid'] != $info['uid']) {
+                //Dever::alert('兑换码已被领取');
+            }
+
+            $order = Dever::db('journal/order')->one(array('code' => $code));
+
+            if ($order) {
+                Dever::alert('兑换码已被使用');
+            }
+
+            if ($info['product_id']) {
+                $product = Dever::db('journal/info')->one($info['product_id']);
+                $this->data['product'] = $product;
+
+                return $this->data;
+            }
+
+        } else {
+            Dever::alert('请输入正确的兑换码');
+        }
+
+        return true;
+    }
+
+    # 兑换
+    public function code()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+        $journal_id = Dever::input('journal_id', false, '> 0', '请传入正确的小刊id');
+
+        $code = Dever::input('code');
+
+        $source_uid = $this->getSourceUid(false);
+
+        if ($code) {
+
+            $code = trim($code);
+
+            $code = str_replace("\n", '', $code);
+
+            $product = Dever::db('journal/info')->one($journal_id);
+
+            $info = Dever::db('code/info')->one(array('product_id' => $journal_id, 'code' => $code));
+
+            if (!$info) {
+                Dever::alert('兑换码不存在');
+            }
+
+            if ($info['type'] == 3) {
+                Dever::alert('兑换码已被使用');
+            }
+
+            if ($info['type'] == 2 && $this->data['uid'] != $info['uid']) {
+                //Dever::alert('兑换码已被领取');
+            }
+
+            $order = Dever::db('journal/order')->one(array('product_id' => $journal_id, 'code' => $code, 'type' => 2, 'uid' => $this->data['uid']));
+
+            if ($order) {
+                Dever::alert('您已经使用过该兑换码');
+            }
+
+            Dever::db('code/info')->update(array('where_id' => $info['id'], 'type' => 3, 'uid' => $this->data['uid'], 'ldate' => time()));
+
+            $order_id = $this->createOrder('JC');
+
+            $order_data['order_id'] = $order_id;
+            $order_data['product_id'] = $journal_id;
+            $order_data['uid'] = $this->data['uid'];
+            $order_data['code'] = $code;
+            if ($source_uid > 0) {
+                $order_data['source_uid'] = $source_uid;
+            }
+            
+            $order_data['type'] = 2;
+            $order_data['status'] = 2;
+            $order_data['name'] = $product['name'];
+
+            $id = Dever::db('journal/order')->insert($order_data);
+
+            # 订阅
+            Dever::load('act/lib/subscribe')->submit($this->data['uid'], $journal_id, 2);
+
+            $score = false;
+            $num = false;
+            if (isset($info['product_num']) && $info['product_num'] > 0) {
+                if ($product && $product['dh_score'] > 0) {
+                    $score = $info['product_num'] * $product['dh_score'];
+                } elseif ($product) {
+                    $num = $info['product_num'];
+                }
+            }
+            # 增加积分
+            Dever::score($this->data['uid'], 'dh_journal', '兑换小刊', 'act/lib/score.submit?method=code&type=4&id=' . $journal_id, $score, $num);
+
+        } else {
+            Dever::alert('请输入正确的兑换码');
+        }
+
+        return array('order_id' => $order_id);
+    }
+
+    private function createOrder($prefix = 'JC')
+    {
+        $order = Dever::order($prefix);
+
+        //$order = Dever::rand(2, 2) . Dever::rand(6, 0);
+
+        $info = Dever::db('journal/order')->one(array('order_id' => $order));
+
+        if ($info) {
+            return $this->createOrder($prefix);
+        }
+
+        return $order;
+    }
+}

+ 54 - 0
main/src/Preview.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+
+class Preview
+{
+    # 获取二维码
+    public function get()
+    {
+        $type = Dever::input('type');
+        $id = Dever::input('id');
+
+        $audit = Dever::input('audit');
+        if ($audit) {
+            $audit = Dever::db('audit/data')->one($id);
+            $id = $audit['data_id'];
+            $type = $audit['type'];
+        }
+
+    	$table = Dever::config('base')->type_table[$type];
+
+        $info = Dever::db($table)->one($id);
+
+    	$table = array();
+
+        $path = Dever::config('base')->applet_index;
+        //$scene = Dever::login(-1) . ',' . $type . ',' . $id;
+        $scene = -1 . ',' . $type . ',' . $id;
+
+        //echo $scene;die;
+        $send['project'] = 1;
+        $send['send'] = $scene;
+        $send['width'] = 152;
+        $send['path'] = $path; 
+        $logo = Dever::load('wechat_applet/code.get', $send);
+        $html = '<img src="'.$logo.'" width="150">';
+
+        $table['预览小程序码'] = $html;
+        //$table['测试二维码'] = '暂时没有';
+
+        /*
+        if ($type == 3) {
+            if ($info['url_m3u8']) {
+                $table['m3u8回放地址'] = $info['url_m3u8'];
+                $table['mp4回放地址'] = $info['url_mp4'];
+            }
+        }
+        */
+
+        return Dever::table($table);
+    }
+}

+ 289 - 0
main/src/User.php

@@ -0,0 +1,289 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class User extends Core
+{
+    protected $checkUser = true;
+
+    # 我的页面
+    public function my()
+    {
+        # 获取用户信息
+        $this->data['user'] = Dever::load('passport/api')->info($this->data['uid']);
+        if ($this->data['user']) {
+            $level = Dever::db('score/user_level')->one(array('uid' => $this->data['uid']));
+            $this->data['user']['level'] = '';
+            if ($level) {
+                $level_info = Dever::db('score/level')->one($level['level_id']);
+                if ($level_info && $level_info['state'] == 1) {
+                    $this->data['user']['level'] = $level_info['name'];
+                }
+            }
+
+            $score = Dever::db('score/user')->all(array('uid' => $this->data['uid']));
+            $score_num = 0;
+            if ($score) {
+                foreach ($score as $k => $v) {
+                    $score_info = Dever::db('score/config')->one($v['config_id']);
+                    if ($score_info && $score_info['type'] == 1) {
+                        $score_num = $v['score'];
+                        break;
+                    }
+                }
+            }
+            $this->data['user']['score'] = $score_num;
+
+            # 查看当前用户的消息
+            $this->data['user_msg'] = Dever::load('message/lib/data')->num($this->data['uid']);
+        }
+
+        return $this->data;
+    }
+
+    # 我的消息页面
+    public function my_msg()
+    {
+        $this->data['msg'] = Dever::load('message/lib/data')->read($this->data['uid'], false, true, false);
+
+        if ($this->data['msg']) {
+            foreach ($this->data['msg'] as $k => $v) {
+                $this->data['msg'][$k]['cdate_time'] = date('Y-m-d H:i:s', $v['cdate']);
+            }
+        }
+
+        return $this->data;
+    }
+
+    # 我喜欢的页面
+    public function my_up()
+    {
+        $this->data['like'] = Dever::load('act/lib/like')->getList($this->data['uid']);
+
+        if ($this->data['like']) {
+            foreach ($this->data['like'] as $k => $v) {
+                $this->data['like'][$k]['cdate_time'] = date('Y-m-d H:i:s', $v['cdate']);
+                if ($v) {
+                    $this->data['like'][$k]['info'] = (object) $this->content($v);
+                } else {
+                    $this->data['like'][$k]['info'] = (object) array();
+                }
+                
+            }
+        }
+        return $this->data;
+    }
+
+    # 我评论的页面
+    public function my_comment()
+    {
+        $this->data['comment'] = Dever::load('act/lib/comment')->getList($this->data['uid']);
+
+        if ($this->data['comment']) {
+            foreach ($this->data['comment'] as $k => $v) {
+                $this->data['comment'][$k]['cdate_time'] = date('Y-m-d H:i:s', $v['cdate']);
+                $this->data['comment'][$k]['time'] = Dever::mdate($v['cdate'], 2);
+                if ($v) {
+                    $this->data['comment'][$k]['info'] = (object) $this->content($v);
+                } else {
+                    $this->data['comment'][$k]['info'] = (object) array();
+                }
+            }
+        }
+        return $this->data;
+    }
+
+    # 商品订单
+    public function my_order()
+    {
+        return $this->data;
+    }
+
+    # 获取海报
+    public function poster()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+
+        $template = Dever::input('template', 'share');
+        //$path = Dever::input('path', 'pages/choice/index/index');
+        $path = Dever::config('base')->applet_index;
+
+        $table = Dever::config('base')->type_table[$type];
+        $info = Dever::db($table)->one($id);
+        //$scene = Dever::login($this->data['uid']) . ',' . $type . ',' . $id;
+        $scene = $this->data['uid'] . ',' . $type . ',' . $id;
+        //echo $scene;die;
+        $send['project'] = Dever::input('project', $this->data['system']);
+        $send['send'] = $scene;
+        $send['width'] = 152;
+        $send['path'] = $path; 
+        $logo = Dever::load('wechat_applet/code.get', $send);
+
+        if (!$info['share_pic']) {
+            return array('img' => '');
+        }
+        if (!$info['share_title']) {
+            $info['share_title'] = $info['name'];
+        }
+        $user = Dever::db('passport/user')->one($this->data['uid']);
+        $model = array
+        (
+            'pic' => Dever::local($info['share_pic']),
+            'name' => $info['share_title'],
+            'logo' => Dever::local(str_replace('https', 'http', $logo)),
+            //'logo' => 'http://cm.5dev.cn/applet_on/data/upload/1/2018/06/06/239fa207778aa923f4ff7594dfbdfcca.png',
+        );
+
+        if ($user) {
+            $model['username'] = $user['username'] . '邀您一起看';
+        }
+
+        if ($info['share']) {
+            $template = $info['share'];
+        }
+
+        $img = Dever::load('poster/api.get', $scene, $template, $model);
+        return array('img' => $img);
+    }
+
+    # 分享
+    public function submit_share()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+
+        Dever::load('act/lib/share')->submit($this->data['uid'], $id, $type);
+
+        return array('id' => $id, 'type' => $type);
+    }
+
+    # 回流
+    public function submit_share_reflux()
+    {
+        $source_uid = $this->getSourceUid();
+
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+
+        Dever::load('act/lib/share')->submit_reflux($source_uid, $this->data['uid'], $id, $type, $this->data['system']);
+
+        return array('id' => $id, 'type' => $type);
+    }
+
+
+    # 点赞
+    public function submit_up()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+
+        Dever::load('act/lib/like')->submit($this->data['uid'], $id, $type);
+
+        return array('id' => $id, 'type' => $type);
+    }
+
+    # 预约提醒
+    public function submit_note()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        $formid = Dever::input('formid');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+
+        Dever::load('act/lib/note')->submit($this->data['uid'], $id, $type, $formid, $this->data['system']);
+
+        return array('id' => $id, 'type' => $type);
+    }
+
+
+    # 发布评论
+    public function submit_comment()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+        $content = Dever::input('content');
+        if (!$content) {
+            Dever::alert('错误的内容');
+        }
+
+        Dever::load('act/lib/comment')->submit($this->data['uid'], $id, $type, $content);
+
+        return array('id' => $id, 'type' => $type);
+    }
+
+    # 发布反馈
+    public function submit_feedback()
+    {
+        $username = Dever::input('username');
+        if (!$username) {
+            //Dever::alert('错误的用户姓名');
+        }
+        $name = Dever::input('name');
+        if (!$name) {
+            //Dever::alert('错误的标题');
+        }
+        $type_id = Dever::input('type_id');
+        if (!$type_id) {
+            Dever::alert('请选择反馈类型');
+        }
+        $contact = Dever::input('contact');
+        if (!$contact) {
+            Dever::alert('请填写联系方式');
+        }
+        $content = Dever::input('content');
+        if (!$content) {
+            Dever::alert('请填写内容');
+        }
+
+        $id = Dever::load('act/lib/feedback')->submit($this->data['uid'], $username, $name, $type_id, $contact, $content);
+
+        return array('id' => $id);
+    }
+
+    # 发布反馈
+    public function get_feedback_type()
+    {
+        $this->data['type'] = Dever::db('act/feedback_type')->getAll();
+
+        return $this->data;
+    }
+}

+ 214 - 0
main/src/View.php

@@ -0,0 +1,214 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class View extends Core
+{
+    # 获取评论列表
+    public function comment()
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的ID');
+        }
+        $type = Dever::input('type');
+        if (!$type) {
+            Dever::alert('错误的类型');
+        }
+
+        $this->data['comment'] = Dever::load('act/lib/comment')->get($id, $type, $this->data['uid']);
+
+        if ($type == 3) {
+            $this->data['live_status'] = 2;
+            # 获取直播的状态
+            $live = Dever::db('video/live')->one($id);
+            if ($live && $live['stream_id']) {
+                $this->data['live_status'] = Dever::load('live/api')->status($live['stream_id']);
+            }
+        }
+
+        return $this->data;
+    }
+
+    private function get($method, $name, $type = 1, $key = '')
+    {
+        $id = Dever::input('id');
+        if (!$id) {
+            Dever::alert('错误的'.$name.'ID');
+        }
+        $this->data['info'] = Dever::load($method)->get($id, $this->data['uid']);
+        if (!$this->data['info']) {
+            Dever::alert('错误的'.$name.'ID');
+        }
+
+        $this->data['info'] = $this->pic($this->data['info']);
+
+        if ($this->data['info']['pdate'] > 0) {
+            $this->data['info']['pdate_time'] = date('Y-m-d H:i:s', $this->data['info']['pdate']);
+        }
+
+        if (isset($this->data['info']['share_content'])) {
+            $source = Dever::db('source/info')->one(1);
+            $this->data['info']['share_link'] = $source['code'];
+        }
+
+        if ($this->data['info']['num_view'] > 100000) {
+            //$this->data['info']['num_view'] = '10w+';
+        }
+
+        if (isset($this->data['info']['cate_id']) && $this->data['info']['cate_id']) {
+            $this->data['info']['cate'] = Dever::db('content/cate')->one($this->data['info']['cate_id']);
+        }
+
+        if (isset($this->data['info']['author_id']) && $this->data['info']['author_id']) {
+            $this->data['info']['author'] = Dever::db('content/author')->one($this->data['info']['author_id']);
+        }
+
+        # 获取评论列表
+        $this->data['comment'] = Dever::load('act/lib/comment')->get($id, $type, $this->data['uid']);
+
+        # 获取相关推荐
+        $this->data['relation'] = Dever::load($method)->getRelation($this->data['info']);
+        if ($this->data['relation']) {
+            foreach ($this->data['relation'] as $k => $v) {
+                $this->data['relation'][$k] = $this->getInfo($type, $v);
+            }
+        }
+
+        # 用户行为数据
+        $this->data['user_act'] = array();
+
+        # 获取当前用户分享数
+        if ($this->data['uid'] > 0) {
+            $this->data['user_act']['share'] = Dever::load('act/lib/share')->getRefluxNum($this->data['uid'], $id, $type);
+
+            # 当前用户是否点赞
+            $this->data['user_act']['up'] = Dever::load('act/lib/like')->get($this->data['uid'], $id, $type);
+
+            Dever::score($this->data['uid'], 'view_' . $key, '浏览' . $name);
+            
+        } else {
+            $this->data['user_act']['share'] = 0;
+            $this->data['user_act']['up'] = 2;
+        }
+
+        # 用户预约
+        if ($type == 3) {
+            if ($this->data['uid'] > 0) {
+                $this->data['user_act']['note'] = Dever::load('act/lib/note')->get($this->data['uid'], $id, $type);
+                
+            } else {
+                $this->data['user_act']['note'] = 2;
+            }
+
+            if (isset($this->data['info']['status']) && $this->data['info']['status'] == 2) {
+                # 直播中
+                Dever::load('act/lib/watch')->submit($this->data['uid'], $id, $type);
+            }
+        }
+        
+
+        # 浏览量+1
+        Dever::load($method)->addView($id);
+
+        return $this->data;
+    }
+
+    # 获取图文详情
+    public function article()
+    {
+    	return $this->get('content/lib/article', '图文', 1, 'article');
+    }
+
+    # 获取视频详情
+    public function vod()
+    {
+        return $this->get('video/lib/vod', '视频', 2, 'vod');
+    }
+
+    # 获取直播详情
+    public function live()
+    {
+    	return $this->get('video/lib/live', '直播', 3, 'live');
+    }
+
+    # 获取专题详情
+    public function feature()
+    {
+        return $this->get('feature/lib/info', '专题', 6, 'feature');
+    }
+
+    # 获取单页详情
+    public function getPage()
+    {
+        $this->data['info'] = $this->page();
+
+        return $this->data;
+    }
+
+    # 获取单页详情
+    public function page()
+    {
+        $key = Dever::input('key');
+        if (!$key) {
+            Dever::alert('您访问的页面有误');
+        }
+
+        $info = Dever::db('content/page')->one(array('key' => $key . '_' . $this->data['system']));
+        if (!$info) {
+            $info = Dever::db('content/page')->one(array('key' => $key));
+        }
+
+        return $info;
+    }
+
+    # 根据类型,获取详情的html页面
+    public function getHtml()
+    {
+        $type = Dever::input('type');
+        $id = Dever::input('id');
+        $signature = Dever::input('signature');
+        $data = array();
+        switch($type) {
+            case 1:
+                $data = $this->article();
+                break;
+            case 2:
+                $data = $this->vod();
+                break;
+            case 3:
+                $data = $this->live();
+                break;
+            case 4:
+                # 这个有点特殊
+                $info = Dever::db('journal/content')->one($id);
+                if (!$info) {
+                    Dever::alert('错误的数据');
+                }
+                $data = Dever::load('main/journal')->readContent($info);
+                break;
+            case 6:
+                $data = $this->feature();
+                break;
+        }
+
+        if ($data) {
+            if (isset($data['info']['content_array'])) {
+                $data['content'] = $data['info']['content_array'];
+            } elseif (isset($data['info']['content'])) {
+                $data['content'][] = array
+                (
+                    'type' => 1,
+                    'content' => $data['info']['content']
+                );
+            }
+            
+            return Dever::render('content', $data);
+        } else {
+            Dever::alert('错误的数据');
+        }
+    }
+}

+ 11 - 0
main/template/mobile/page.php

@@ -0,0 +1,11 @@
+<?php
+
+
+$view
+
+->fetch('h1','main/view.page#name')
+->fetch('h1@style','display:none;')
+->fetch('#content','main/view.page#content')
+
+# display
+->display();

+ 55 - 0
manage/config/base.php

@@ -0,0 +1,55 @@
+<?php
+
+$url = function()
+{
+	$url = Dever::input('loading') ? 'loading=1' : '';
+	$url .= Dever::input('ms') ? '&ms=' . Dever::input('ms') : '';
+
+	return $url;
+};
+
+# 一些基本配置
+$config['base'] = array
+(
+	'url' => $url(),
+
+	# 针对管理系统的配置,开启这个则每次刷新都读取admin的最新数据,测试功能
+	'getAdmin' => true,
+
+	# 开启批量更新
+	'mul_type' => 1,
+
+	# 地图配置
+	'map' => array
+	(
+		'url' => 'https://webapi.amap.com/maps?v=1.4.8&key=b51a0d5f8f977726eeaa070a30bcf3cd',
+	),
+);
+
+# 模板配置
+$config['template'] = array
+(
+	# 使用的模板 注意:定义这个之后,将会强制将本项目模板变成这个
+	'assets' => 'layadmin',
+	'template' => 'layadmin',
+
+	'replace' => array
+	(
+		'css' => '../css/',
+		'lib' => '../lib/',
+		'img' => '../img/',
+		'images' => '../images/',
+		'js' => '../js/',
+		'script' => '../script/',
+
+		# 以下的替换主要用于合并操作(host里的merge项)
+		'font' => '../fonts/',
+	),
+
+	'path' => 'html',
+	'layout' => '',
+
+	'relation' => array(),
+);
+
+return $config;

+ 7 - 0
manage/daemon/loop.php

@@ -0,0 +1,7 @@
+<?php
+
+define('DEVER_DAEMON', true);
+
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../index.php');
+
+Dever::load('manage/project.loop');

+ 7 - 0
manage/daemon/main.php

@@ -0,0 +1,7 @@
+<?php
+
+define('DEVER_DAEMON', true);
+
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../index.php');
+
+Dever::load('manage/project.cron');

+ 4 - 0
manage/index.php

@@ -0,0 +1,4 @@
+<?php 
+define('DEVER_PACKAGE', 'manage');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
oauth/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'oauth');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 3 - 0
package.json

@@ -0,0 +1,3 @@
+{
+	"rely": "manage,passport,oauth,poster,sms"
+}

+ 4 - 0
passport/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'passport');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
poster/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'poster');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 325 - 0
push/database/data.php

@@ -0,0 +1,325 @@
+<?php
+
+# 定义几个常用的选项
+$option = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
+
+$type = Dever::config('base')->type;
+$type[10] = '链接';
+
+
+$list = function()
+{
+    return Dever::db('push/info')->state();
+};
+$info = Dever::input('search_option_info_id');
+$type_default = 1;
+if ($info) {
+    $info = Dever::load('push/info-one', $info);
+
+    if (!$info) {
+        echo 'error';die;
+    }
+    $function = explode(',', $info['function']);
+    
+    foreach ($type as $k => $v) {
+        if (!in_array($k, $function)) {
+            unset($type[$k]);
+        } else {
+            $type_default = $k;
+        }
+    }
+    $info['name'] .= '下的推送数据管理';
+    $info['col'] = explode(',', $info['col']);
+    /*
+    $preview = $info['preview'];
+    $preview_height = $info['preview_height'] ? $info['preview_height'] : 500;
+    */
+
+    $name_state = in_array(1, $info['col']);
+    $link_state = in_array(2, $info['col']);
+    $pic_state = in_array(3, $info['col']);
+    $content_state = in_array(4, $info['col']);
+
+    /*
+    if ($info['data_type']) {
+        $type = explode("\r\n", $info['data_type']);
+    }
+    */
+} else {
+    $info = array();
+    $info['name'] = '推送数据管理';
+    $info['col_pic'] = '100X100';
+    $info['col_content'] = '30';
+    $info['type'] = 1;
+    $name_state = true;
+    $link_state = false;
+    $pic_state = false;
+    $content_state = false;
+    $preview = '';
+    $preview_height = 0;
+}
+
+
+return array
+(
+    # 表名
+    'name' => 'data',
+    # 显示给用户看的名称
+    'lang' => $info['name'],
+    'order' => 20,
+    //'menu' => false,
+
+    //'desc' => '预览地址:<br /><iframe id="preview" height="'.$preview_height.'" width="100%"  frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes" src="'.$preview.'" ></iframe>',
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'search'  => 'order',
+            'order'     => 'desc',
+            //'list'        => true,
+        ),
+
+        'info_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '选择推送位',
+            'default'   => Dever::input('search_option_info_id', '1'),
+            'desc'      => '推送位',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'update'    => 'hidden',
+            'option'    => $list,
+            'list'      => true,
+            'value'     => Dever::input('search_option_info_id', '1'),
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '类型',
+            'default'   => ''.$type_default.'',
+            'desc'      => '请选择类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'search'    => 'select',
+            'option'    => $type,
+            'control'   => 'type',
+        ),
+
+        'article_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联图文-如不选择,则点击进入图文列表',
+            'default'   => '',
+            'desc'      => '关联图文',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=1',
+            'update_search' => 'journal/lib/manage.search_article',
+        ),
+
+        'vod_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联视频-如不选择,则点击进入视频列表',
+            'default'   => '',
+            'desc'      => '关联视频',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=2',
+            'update_search' => 'journal/lib/manage.search_vod',
+        ),
+
+        'live_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联直播-如不选择,则点击进入直播列表',
+            'default'   => '',
+            'desc'      => '关联直播',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=3',
+            'update_search' => 'journal/lib/manage.search_live',
+        ),
+
+        'journal_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联小刊-如不选择,则点击进入小刊列表',
+            'default'   => '',
+            'desc'      => '关联小刊',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=4,13',
+            'update_search' => 'journal/lib/manage.search_journal',
+        ),
+
+        'feature_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联专题-如不选择,则点击进入专题列表',
+            'default'   => '',
+            'desc'      => '关联专题',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=6',
+            'update_search' => 'journal/lib/manage.search_feature',
+        ),
+
+        'applet_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联小程序',
+            'default'   => '',
+            'desc'      => '关联小程序',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=7',
+            'update_search' => 'journal/lib/manage.search_applet',
+        ),
+
+        'olink'      => array
+        (
+            'type'      => 'varchar-400',
+            'name'      => '链接',
+            'default'   => '',
+            'desc'      => '请输入链接',
+            'match'     => 'option',
+            'update'    => 'text',
+            'show'      => 'type=10',
+            //'search'    => 'fulltext',
+            //'list'        => true,
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-60',
+            'name'      => '标题-手动干扰项,如想修改当前推送位的标题请在此修改',
+            'default'   => '',
+            'desc'      => '请输入标题',
+            'match'     => $name_state ? 'option' : 'option',
+            'update'    => $name_state ? 'text' : 'hidden',
+            'search'    => $name_state ? 'fulltext' : '',
+            'list'      => $name_state ? 'Dever::load("push/lib/manage.name", {id})' : false,
+            'edit'      => $name_state ? true : false,
+        ),
+
+        'link'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '链接-手动干扰项,如想修改当前推送位的链接请在此修改',
+            'default'   => '',
+            'desc'      => '请输入链接',
+            'match'     => $link_state ? 'option' : 'option',
+            //'update'    => $link_state ? 'text' : 'hidden',
+            //'search'    => $link_state ? 'fulltext' : '',
+            //'list'        => $link_state ? true : false,
+            //'edit'      => $link_state ? true : false,
+        ),
+
+        'pic'       => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '图片或图标-手动干扰项,请上传' . $info['col_pic'] . '大小的图片',
+            'default'   => '',
+            'desc'      => '请选择图片',
+            'match'     => $pic_state ? 'option' : 'option',
+            'update'    => $pic_state ? 'image' : 'hidden',
+            'search'    => $pic_state ? 'fulltext' : '',
+            //'list'        => $pic_state ? true : false,
+            'key'       => 1
+        ),
+
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '描述-手动干扰项,字数请不要超过' . $info['col_content'] . '个汉字,前台展示时会自动过滤',
+            'default'   => '',
+            'desc'      => '请输入描述',
+            'match'     => $content_state ? 'option' : 'option',
+            //'update'    => $content_state ? 'editor' : 'hidden',
+        ),
+        
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        # 获取列表页
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'type_no' => array('yes-type', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'limit' => '0,10',
+            'col' => 'name,pic,olink as link,type,article_id,vod_id,live_id,journal_id,feature_id,applet_id,cdate',
+        ),
+
+        # 获取列表页 带有分页的
+        'getAllPage' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'type_no' => array('yes-type', '!='),
+                '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,feature_id,applet_id,cdate',
+        ),
+    ),
+);

+ 311 - 0
push/database/info.php

@@ -0,0 +1,311 @@
+<?php
+
+$type = array
+(
+    1 => '手动输入',
+    /*
+    2 => '调取其他推送位',
+    3 => '预定义方法',
+    4 => '自定义方法',
+    5 => '自定义SQL',
+    6 => '自定义接口',
+    */
+);
+
+//$define = Dever::config('base')->module;
+
+$function = array();
+$function[10] = '链接';
+
+$col = array
+(
+    1 => '标题',
+    //2 => '链接',
+    3 => '图片',
+    //4 => '描述',
+);
+
+return array
+(
+    # 表名
+    'name' => 'info',
+    # 显示给用户看的名称
+    'lang' => '推送位管理',
+    'order' => 10,
+    'check' => 'key',
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '推送位ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'search'  => 'order',
+            'order'     => 'desc',
+            //'list'        => true,
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-60',
+            'name'      => '推送位标题',
+            'default'   => '',
+            'desc'      => '请输入推送位标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'key'       => array
+        (
+            'type'      => 'varchar-60',
+            'name'      => '推送位标识',
+            'default'   => '',
+            'desc'      => '推送位标识',
+            'match'     => 'is_string',
+            'update'    => Dever::input('where_id') ? 'hidden' : 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+            //'auth'      => '!{key}'
+        ),
+
+        'num'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '数据显示条数-为空或小于0则取默认值20,只对前台有效,当有分页时,则为每页显示的条数',
+            'default'   => '20',
+            'desc'      => '数据显示条数',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '推送位类型',
+            'default'   => '1',
+            'desc'      => '请选择推送位类型',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+            'update'    => 'radio',
+            'search'    => 'select',
+            //'list'        => true,
+            'control'       => 'type',
+        ),
+
+        /*
+        'data_type'     => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '数据类型定义-多个用换行隔开,必须有一个值,主要用于该推送位有多种不同类型的值',
+            'default'   => '默认类型',
+            'desc'      => '请选择推送位类型',
+            'match'     => 'is_string',
+            //'update'  => 'textarea',
+            //'show'        => array('type_1'),
+        ),
+
+        'code'      => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '自定义内容',
+            'default'   => '',
+            'desc'      => '请输入自定义内容',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'show'      => 'type=4,5,6',
+        ),
+
+        'sql_method'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '选择sql执行之后的方法',
+            'default'   => '1',
+            'desc'      => '选择sql执行之后的方法',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $sqlMethod,
+            'show'      => 'type=5',
+        ),
+
+        'define'        => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '选择预定义方法',
+            'default'   => '',
+            'desc'      => '请选择预定义方法',
+            'match'     => 'is_string',
+            'update'    => 'select',
+            'option'    => $define,
+            'show'      => 'type=3'
+        ),
+        */
+
+        'function'       => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '启用的功能',
+            'default'   => '1,2,3,4,6,7,10',
+            'desc'      => '启用的功能',
+            'match'     => 'is_string',
+            'option'    => $function,
+            'update'    => 'checkbox',
+            'show'      => 'type=1',
+        ),
+
+        'col'       => array
+        (
+            'type'      => 'varchar-30',
+            'name'      => '启用的字段',
+            'default'   => '1',
+            'desc'      => '请选择启用的字段',
+            'match'     => 'is_string',
+            'option'    => $col,
+            'update'    => 'checkbox',
+            'show'      => 'type=1',
+            'control'   => 'col',
+        ),
+
+        'col_pic'       => array
+        (
+            'type'      => 'varchar-20',
+            'name'      => '图片尺寸提醒-请直接输入提醒的文字即可,如100X100',
+            'default'   => '100X100',
+            'desc'      => '图片尺寸提醒',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'show'      => 'col=3',
+        ),
+
+        'col_content'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '内容长度限制-必须是数字',
+            'default'   => '30',
+            'desc'      => '内容长度限制',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'show'      => 'col=4',
+        ),
+
+        /*
+        'relate_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '请输入推送位id',
+            'default'   => '',
+            'desc'      => '请输入推送位id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'show'      => 'type=2',
+        ),
+
+        'preview'       => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '推送位预览地址',
+            'default'   => '',
+            'desc'      => '推送位预览地址',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'preview_height'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '推送位预览的高度',
+            'default'   => '500',
+            'desc'      => '推送位预览的高度',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+        */
+        
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            'list'      => true,
+            'order'     => 'desc',
+            //'edit'        => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    # 权限精细控制 加入到该项目的详细权限中,注意与top的不同
+    /*
+    'auth' => array
+    (
+        # 数据来源
+        'data' => 'all',
+        # 所属项目
+        'project' => 'module',
+        # 项目名称
+        'project_name' => '推送位管理',
+    ),
+    */
+
+    'manage' => array
+    (
+        'delete' => false,
+        //'edit' => false,
+        //'insert' => $curPage ? true : false,
+        'list_button' => array
+        (
+            'add' => array('新增数据', '"data&search_option_info_id={id}&oper_parent=info"', '{type} == 1'),
+
+            'list' => array('数据列表', '"data&search_option_info_id={id}&oper_parent=info"'),
+        ),
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        # 获取列表页
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                //'page_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 8 - 0
push/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'push');
+define('DEVER_APP_LANG', '推送管理');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 199);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-template-1');
+include(DEVER_APP_PATH . '../boot.php');

+ 162 - 0
push/lib/Data.php

@@ -0,0 +1,162 @@
+<?php
+
+namespace Push\Lib;
+
+use Dever;
+
+class Data
+{
+    public function get($key, $name, $total = 10, $page = false, $limit = false)
+    {
+        $info = Dever::db('push/info')->one(array('key' => $key));
+
+        if (!$info) {
+            $insert['key'] = $key;
+            $insert['name'] = $name;
+            $insert['num'] = $total;
+            $insert['col'] = '1,3';
+            $info['id'] = Dever::db('push/info')->insert($insert);
+            $info['num'] = $insert['num'];
+        }
+
+        $data = array();
+        if ($info) {
+            if (!$info['num']) {
+                $info['num'] = 20;
+            }
+            if ($limit > 0) {
+                $info['num'] = $limit;
+            }
+
+            $where = array();
+            $where['info_id'] = $info['id'];
+
+            
+            if (checkVersion()->video == 2) {
+                $where['type_no'] = 2;
+            }
+
+            if ($page) {
+                $where['page'] = array($info['num'], 'list');
+                $data = Dever::db('push/data')->getAllPage($where);
+            } else {
+                $where['limit'] = '0,' . $info['num'];
+                $data = Dever::db('push/data')->getAll($where);
+            }
+
+            if ($data) {
+                foreach ($data as $k => $v) {
+                    $data[$k] = $this->getOne($v);
+                }
+            }
+        }
+
+        return $data;
+    }
+
+    private function getOne($info)
+    {
+        $info['id'] = 0;
+        if ($info['type'] < 10 || $info['type'] == 13) {
+            $table = Dever::config('base')->type_table[$info['type']];
+            $method = 'one';
+            if ($info['type'] == 1) {
+                $id = $info['article_id'];
+            } elseif ($info['type'] == 2) {
+                $id = $info['vod_id'];
+            } elseif ($info['type'] == 3) {
+                $id = $info['live_id'];
+            } elseif ($info['type'] == 4) {
+                $id = $info['journal_id'];
+                $method = 'getOne';
+            } elseif ($info['type'] == 6) {
+                $id = $info['feature_id'];
+            } elseif ($info['type'] == 7) {
+                $id = $info['applet_id'];
+            } elseif ($info['type'] == 13) {
+                $id = $info['journal_id'];
+            }
+
+            unset($info['article_id']);
+            unset($info['vod_id']);
+            unset($info['live_id']);
+            unset($info['journal_id']);
+            unset($info['feature_id']);
+            unset($info['applet_id']);
+            if ($id > 0) {
+                $info['id'] = $id;
+                $data = Dever::db($table)->$method($id);
+                if (isset($data) && $data) {
+                    if (isset($data['name']) && $data['name'] && !$info['name']) {
+                        $info['name'] = $data['name'];
+                    }
+
+                    if (isset($data['pic_cover']) && $data['pic_cover'] && !$info['pic']) {
+                        $info['pic'] = $data['pic_cover'];
+                    }
+                    if (isset($data['pic_cover_169']) && $data['pic_cover_169']) {
+                        $info['pic_169'] = $data['pic_cover_169'];
+                    }
+                    if (isset($data['pic_view_cover']) && $data['pic_view_cover'] && !$info['pic']) {
+                        $info['pic'] = $data['pic_view_cover'];
+                    }
+
+                    if (isset($data['num_ding'])) {
+                        $info['num_ding'] = $data['num_ding'];
+                    }
+
+                    if (isset($data['buy'])) {
+                        $info['buy'] = $data['buy'];
+                    }
+
+                    if (isset($data['pdate']) && $data['pdate']) {
+                        $info['cdate'] = $data['pdate'];
+                    }
+
+                    if (isset($data['cate_id']) && $data['cate_id']) {
+                        $cate = Dever::db('content/cate')->one($data['cate_id']);
+                        $info['cate_name'] = $cate['name'];
+                    }
+
+                    if (isset($data['author_id']) && $data['author_id']) {
+                        $author = Dever::db('content/author')->one($data['author_id']);
+                        $info['author_name'] = $author['name'];
+                    }
+
+                    if (isset($data['appid']) && $data['appid']) {
+                        $info['appid'] = $data['appid'];
+                    }
+
+                    if (isset($data['link']) && $data['link']) {
+                        $info['link'] = $data['link'];
+                    }
+                }
+            }
+        } else {
+            unset($info['article_id']);
+            unset($info['vod_id']);
+            unset($info['live_id']);
+            unset($info['journal_id']);
+            unset($info['feature_id']);
+            unset($info['applet_id']);
+        }
+
+        if ($info['link']) {
+            if (!strstr($info['link'], 'http')) {
+                $info['link'] = 'http://' . $info['link'];
+            }
+        }
+
+        $info['cdate'] = date('Y-m-d', $info['cdate']);
+
+        if (isset($info['pic']) && $info['pic']) {
+            $info['pic'] = Dever::load('main/lib/core')->replacePic($info['pic']);
+        }
+
+        if (isset($info['name']) && $info['name']) {
+            $info['name'] = Dever::cut($info['name'], 20, '...');
+        }
+
+        return $info;
+    }
+}

+ 52 - 0
push/lib/Manage.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace Push\Lib;
+
+use Dever;
+
+class Manage
+{
+    //{source_id} > 0 ? ("{name}" ? "{name}" : Dever::load("sad/supply-one#name", {source_id})) : "{name}"
+    public function name($id)
+    {
+        $info = Dever::db('push/data')->one($id);
+
+        if ($info['name']) {
+            return $info['name'];
+        }
+
+        if ($info['type'] < 10) {
+            $table = Dever::config('base')->type_table[$info['type']];
+            $audit = array
+            (
+                //'audit' => 2,
+                //'status' => 2,
+                'state' => 1,
+            );
+            if ($info['type'] == 1) {
+                $audit['id'] = $info['article_id'];
+                $data = Dever::db($table)->one($audit);
+            } elseif ($info['type'] == 2) {
+                $audit['id'] = $info['vod_id'];
+                $data = Dever::db($table)->one($audit);
+            } elseif ($info['type'] == 3) {
+                $audit['id'] = $info['live_id'];
+                $data = Dever::db($table)->one($audit);
+            } elseif ($info['type'] == 4) {
+                $audit['id'] = $info['journal_id'];
+                $data = Dever::db($table)->one($audit);
+            } elseif ($info['type'] == 6) {
+                $audit['id'] = $info['feature_id'];
+                $data = Dever::db($table)->one($audit);
+            } elseif ($info['type'] == 7) {
+                $data = Dever::db($table)->one(array('state' => 1, 'id' => $info['applet_id']));
+            }
+
+            if (isset($data) && $data && isset($data['name'])) {
+                return $data['name'];
+            }
+        }
+
+        return $info['name'];
+    }
+}

+ 4 - 0
upload/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'upload');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

Някои файлове не бяха показани, защото твърде много файлове са промени