dever 5 rokov pred
rodič
commit
4ac1ba95f5
100 zmenil súbory, kde vykonal 8962 pridanie a 0 odobranie
  1. 155 0
      act/database/comment.php
  2. 168 0
      act/database/feedback.php
  3. 114 0
      act/database/feedback_type.php
  4. 149 0
      act/database/form_id.php
  5. 148 0
      act/database/invite.php
  6. 121 0
      act/database/journal_num.php
  7. 116 0
      act/database/like.php
  8. 143 0
      act/database/live_comment.php
  9. 145 0
      act/database/live_note.php
  10. 568 0
      act/database/order.php
  11. 569 0
      act/database/order_temp.php
  12. 158 0
      act/database/score.php
  13. 124 0
      act/database/share.php
  14. 159 0
      act/database/share_reflux.php
  15. 196 0
      act/database/subscribe.php
  16. 116 0
      act/database/watch.php
  17. 8 0
      act/index.php
  18. 90 0
      act/lib/Comment.php
  19. 38 0
      act/lib/Cron.php
  20. 33 0
      act/lib/Feedback.php
  21. 54 0
      act/lib/Form.php
  22. 67 0
      act/lib/Invite.php
  23. 65 0
      act/lib/Like.php
  24. 47 0
      act/lib/Manage.php
  25. 131 0
      act/lib/Note.php
  26. 151 0
      act/lib/Num.php
  27. 272 0
      act/lib/Pay.php
  28. 135 0
      act/lib/Score.php
  29. 163 0
      act/lib/Share.php
  30. 109 0
      act/lib/Subscribe.php
  31. 47 0
      act/lib/Watch.php
  32. 478 0
      act/src/Order.php
  33. 245 0
      audit/database/data.php
  34. 8 0
      audit/index.php
  35. 106 0
      audit/lib/Core.php
  36. 8 0
      boot.php
  37. 20 0
      buy/assets/mobile/auth.html
  38. 114 0
      buy/assets/mobile/codedetail.html
  39. 2 0
      buy/assets/mobile/css/auth.css
  40. 1 0
      buy/assets/mobile/css/auth.css.map
  41. 2 0
      buy/assets/mobile/css/codedetail.css
  42. 1 0
      buy/assets/mobile/css/codedetail.css.map
  43. 0 0
      buy/assets/mobile/css/global.css
  44. 1 0
      buy/assets/mobile/css/global.css.map
  45. 0 0
      buy/assets/mobile/css/list.css
  46. 1 0
      buy/assets/mobile/css/list.css.map
  47. 0 0
      buy/assets/mobile/css/pay.css
  48. 1 0
      buy/assets/mobile/css/pay.css.map
  49. BIN
      buy/assets/mobile/images/ico-close.png
  50. BIN
      buy/assets/mobile/images/ico-code.png
  51. BIN
      buy/assets/mobile/images/ico-selected.png
  52. BIN
      buy/assets/mobile/images/ico-unselected.png
  53. BIN
      buy/assets/mobile/images/list.png
  54. BIN
      buy/assets/mobile/images/logo.jpg
  55. BIN
      buy/assets/mobile/images/mag.png
  56. BIN
      buy/assets/mobile/images/qrcode.png
  57. 20 0
      buy/assets/mobile/index.html
  58. 2 0
      buy/assets/mobile/js/auth.js
  59. 1 0
      buy/assets/mobile/js/auth.js.map
  60. 2 0
      buy/assets/mobile/js/codedetail.js
  61. 1 0
      buy/assets/mobile/js/codedetail.js.map
  62. 3 0
      buy/assets/mobile/js/config.js
  63. 0 0
      buy/assets/mobile/js/global.js
  64. 0 0
      buy/assets/mobile/js/global.js.map
  65. 2 0
      buy/assets/mobile/js/index.js
  66. 1 0
      buy/assets/mobile/js/index.js.map
  67. 2 0
      buy/assets/mobile/js/list.js
  68. 1 0
      buy/assets/mobile/js/list.js.map
  69. 2 0
      buy/assets/mobile/js/pay.js
  70. 1 0
      buy/assets/mobile/js/pay.js.map
  71. 88 0
      buy/assets/mobile/list.html
  72. 41 0
      buy/assets/mobile/my_code.html
  73. 95 0
      buy/assets/mobile/pay.html
  74. 11 0
      buy/index.php
  75. 128 0
      buy/src/Base.php
  76. 368 0
      buy/src/Buy.php
  77. 20 0
      buy/src/Data.php
  78. 32 0
      buy/template/mobile/codedetail.php
  79. 21 0
      buy/template/mobile/home.php
  80. 14 0
      buy/template/mobile/inc/foot.php
  81. 10 0
      buy/template/mobile/inc/head.php
  82. 46 0
      buy/template/mobile/list.php
  83. 38 0
      buy/template/mobile/my_code.php
  84. 68 0
      buy/template/mobile/pay.php
  85. 112 0
      code/database/config.php
  86. 359 0
      code/database/info.php
  87. 69 0
      code/database/seller.php
  88. 8 0
      code/index.php
  89. 138 0
      code/lib/Core.php
  90. 122 0
      code/lib/Manage.php
  91. 8 0
      combine/index.php
  92. 101 0
      combine/lib/Core.php
  93. 46 0
      common.php
  94. 188 0
      config/base.php
  95. 273 0
      config/env/localhost/default.php
  96. 6 0
      config/route.php
  97. 136 0
      content/database/applet.php
  98. 586 0
      content/database/article.php
  99. 118 0
      content/database/author.php
  100. 127 0
      content/database/cate.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'		=> '"<span style=\'display:none;\' class=dever-emoji>{content}</span>"',
+		),
+		
+		'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' => '*',
+		),
+	)
+);

+ 168 - 0
act/database/feedback.php

@@ -0,0 +1,168 @@
+<?php
+
+$page = 10;
+$table = Dever::config('base')->type;
+
+$type = function()
+{
+	$array = array();
+	$info = Dever::db('act/feedback_type')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+return array
+(
+	# 表名
+	'name' => 'feedback',
+	# 显示给用户看的名称
+	'lang' => '反馈管理',
+	# 是否显示在后台菜单
+	'order' => 100,
+	# 数据结构
+	'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}) : "匿名用户"',
+		),
+
+		'username' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '用户姓名',
+			'default' 	=> '',
+			'desc' 		=> '用户姓名',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'list'		=> true,
+		),
+
+		'type_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '反馈类型',
+			'default' 	=> '1',
+			'desc' 		=> '反馈类型',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $type,
+			'search'	=> 'select',
+			'list'		=> true,
+		),
+
+		'contact' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '联系方式',
+			'default' 	=> '',
+			'desc' 		=> '联系方式',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'list'		=> true,
+			'list'		=> true,
+		),
+
+		'name' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'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',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'page' => array($page, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 114 - 0
act/database/feedback_type.php

@@ -0,0 +1,114 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'feedback_type',
+	# 显示给用户看的名称
+	'lang' => '反馈分类设置',
+	# 后台菜单排序
+	'order' => 1,
+	# 数据结构
+	'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' => '*',
+		),
+	),
+);

+ 149 - 0
act/database/form_id.php

@@ -0,0 +1,149 @@
+<?php
+$type = array
+(
+    1 => '普通表单',
+    2 => '支付表单',
+);
+$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',
+            //'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',
+                'cate_id' => 'yes',
+                'cdate' => array($time, '<='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'limit' => '0,100',
+            'col' => '*',
+        ),
+
+        'getAllGroupByUid' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'cate_id' => 'yes',
+                'cdate' => array($time, '<='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'group' => 'uid',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 148 - 0
act/database/invite.php

@@ -0,0 +1,148 @@
+<?php
+
+$table = Dever::config('base')->type;
+
+return array
+(
+	# 表名
+	'name' => 'invite',
+	# 显示给用户看的名称
+	'lang' => '邀请排行榜',
+	# 是否显示在后台菜单
+	'order' => 1,
+	'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'      => '邀请者-填写uid',
+            'default'   => '',
+            'desc'      => '邀请者',
+            'match'     => 'option',
+            'update'	=> 'text',
+            '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',
+			'update'	=> 'select',
+			//'search'	=> 'select',
+			'option' 	=> $table,
+			'list'		=> true,
+		),
+		
+		'data_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '标题-填写id',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'update'	=> 'text',
+			'match' 	=> 'option',
+			'list'		=> '{type} >0 ? Dever::load("act/lib/manage.load", "{type}", "{data_id}") : "未知"',
+		),
+
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '被邀请者-填写uid',
+			'default' 	=> '0',
+			'desc' 		=> '被邀请者',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+		
+		'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
+			(
+				'source_uid' => 'yes',
+				'uid' => 'yes',
+				'data_id' => 'yes',
+				'type' => 'yes',
+				'avatar' => array('yes-t_2.avatar', '!='),
+				'state' => 1,
+			),
+			# 联表
+			'join' => array
+			(
+				array
+				(
+					'table' => 'passport/user',
+					'type' => 'left join',
+					'on' => array('uid','id'),
+					'col' => 't_2.username,t_2.avatar',
+				),
+			),
+			'type' => 'all',
+			'order' => array('t_1.id' => 'desc'),
+			'page' => array(50, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 121 - 0
act/database/journal_num.php

@@ -0,0 +1,121 @@
+<?php
+
+$table = Dever::config('base')->type;
+
+return array
+(
+	# 表名
+	'name' => 'journal_num',
+	# 显示给用户看的名称
+	'lang' => '本数排行榜',
+	# 是否显示在后台菜单
+	'order' => 1,
+	'menu' => false,
+	# 数据结构
+	'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'	=> 'text',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+		
+		'journal_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '小刊ID',
+			'default' 	=> '',
+			'desc' 		=> '小刊ID',
+			'update'	=> 'text',
+			'match' 	=> 'option',
+		),
+
+		'num' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '购买本数',
+			'default' 	=> '',
+			'desc' 		=> '购买本数',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'order'		=> 'desc',
+			'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,
+		'button' => array
+		(
+			'导出排行榜' => array('location', 'act/lib/num.out?id=' . Dever::input('search_option_journal_id')),
+		),
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'journal_id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('num' => 'desc','id' => 'desc'),
+			//'page' => array(100, 'list'),
+			'limit' => '0,50',
+			'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',
+		),
+	)
+);

+ 143 - 0
act/database/live_comment.php

@@ -0,0 +1,143 @@
+<?php
+
+$table = Dever::config('base')->type;
+unset($table[1]);
+unset($table[2]);
+unset($table[4]);
+return array
+(
+	# 表名
+	'name' => 'live_comment',
+	# 显示给用户看的名称
+	'lang' => '直播留言管理',
+	# 是否显示在后台菜单
+	'order' => 70,
+	# 数据结构
+	'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,
+		),
+		
+		'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
+			(
+				'data_id' => 'yes',
+				'type' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'page' => array(50, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 145 - 0
act/database/live_note.php

@@ -0,0 +1,145 @@
+<?php
+
+$table = Dever::config('base')->type;
+return array
+(
+    # 表名
+    'name' => 'live_note',
+    # 显示给用户看的名称
+    'lang' => '直播提醒用户',
+    # 是否显示在后台菜单
+    'order' => 69,
+    # 数据结构
+    '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})',
+        ),
+
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            //'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'formid'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => 'formid',
+            'default'   => '',
+            'desc'      => 'formid',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        
+        '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' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cate_id' => 'yes',
+                'uid' => 'yes',
+                'note' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 568 - 0
act/database/order.php

@@ -0,0 +1,568 @@
+<?php
+
+$type = array
+(
+    //1 => '购买小刊',
+    //2 => '兑换小刊',
+    3 => '购买兑换码',
+    //4 => '使用通用兑换码',
+);
+
+# 系统
+$system = array
+(
+    1 => '小程序',
+    2 => 'H5',
+    3 => 'ios',
+    4 => '安卓',
+);
+
+# 渠道
+$source = function()
+{
+    return Dever::db('source/info')->state();
+};
+
+$status = array
+(
+    1 => '待支付',
+    2 => '已支付',
+    3 => '支付失败',
+    //4 => '申请退款',
+    5 => '已退款',
+);
+
+$product = function()
+{
+    return Dever::db('journal/info')->state();
+};
+
+$buy = function()
+{
+    return Dever::db('journal/buy_num')->state();
+};
+# 获取小刊分类权限
+$auth = Dever::tops();
+$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;
+};
+
+$seller = function()
+{
+    return Dever::db('code/seller')->state();
+};
+
+return array
+(
+    # 表名
+    'name' => 'order',
+    # 显示给用户看的名称
+    'lang' => '订单管理',
+    'order' => 1,
+    'menu' => 'journal',
+
+    'end' => array
+    (
+        'update' => 'act/lib/pay.order',
+    ),
+
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID/订单表ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            //'list'        => true,
+            'list'        => 'Dever::load("act/order.getOrderId", {id})',
+        ), 
+
+        'cate_journal'     => array
+        (
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'search'    => 'linkage',
+            'search_col' => 'cate_id,product_id',
+            'option'    => Dever::url('lib/manage.search_cate_journal', 'journal'),
+        ),
+
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            //'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '订单名称',
+            'default'   => '',
+            'desc'      => '订单名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list_name' => '订单信息',
+            'list'      => 'Dever::load("journal/lib/manage.showOrderUserV1", "{id}")',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '',
+            'desc'      => '用户id',
+            'match'     => 'is_numeric',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'update'    => 'text',
+        ),
+
+        'source_uid'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '邀请人',
+            'default'   => '',
+            'desc'      => '邀请人',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'product_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $product,
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'buy_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买本数',
+            'default'   => '',
+            'desc'      => '购买本数',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $buy,
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'buy_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买本数',
+            'default'   => '',
+            'desc'      => '购买本数',
+            'match'     => 'is_numeric',
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '支付方式',
+            'default'   => '1',
+            'desc'      => '支付方式',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+            'search'    => 'select',
+            'update'    => 'radio',
+            //'list'        => true,
+            'control'   => 'type',
+        ),
+
+        'system'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '系统',
+            'default'   => '1',
+            'desc'      => '系统',
+            'match'     => 'is_numeric',
+            'option'    => $system,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'        => true,
+        ),
+
+        'source'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '渠道来源',
+            'default'   => '1',
+            'desc'      => '支付方式',
+            'match'     => 'is_numeric',
+            'option'    => $source,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'        => true,
+        ),
+
+        'seller_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '销售商',
+            'default'   => '1',
+            'desc'      => '销售商',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $seller,
+            'search'    => 'select',
+            //'list'      => true,
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
+            'match'     => 'is_numeric',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '支付金额',
+            'default'   => '',
+            'desc'      => '支付金额',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'show'      => 'type=1',
+        ),
+
+        'code'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '使用的兑换码',
+            'default'   => '',
+            'desc'      => '使用的兑换码',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'show'      => 'type=2',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '请选择订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'      => 'Dever::load("journal/lib/manage.showOrderStatusV1", "{id}")',
+            'control'   => 'status',
+        ),
+
+        'tk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '退款截图',
+            'default'   => '',
+            'desc'      => '退款截图',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => 1
+        ),
+
+        'tk_time'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款时间',
+            'default'   => '',
+            'desc'      => '退款时间',
+            'match'     => 'option',
+            //'list'        => true,
+            //'update'    => 'date',
+            'callback'  => 'maketime',
+            'show'      => 'status=5',
+        ),
+
+        'tk_admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款审核人',
+            'default'   => '1',
+            'desc'      => '退款审核人',
+            'match'     => 'option',
+            //'list'        => true,
+            'show'      => 'status=5',
+        ),
+
+        'tk_desc'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5',
+        ),
+
+        '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})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '备注',
+            'default'   => '',
+            'desc'      => '备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5'
+            //'list'      => '"{info}" ? "{info}" : "双击添加备注"',
+            //'edit'      => true,
+        ),
+
+        'mobile'        => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '手机号',
+            'default'   => '',
+            'desc'      => '手机号',
+            'match'     => 'option',
+            //'show'        => 'status=5'
+            'search'    => array
+            (
+                'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
+                'col' => 'mobile',//要查询的字段
+                'result' => 'id',//返回的字段
+                'search' => 'uid',//本表的字段,默认为当前的字段
+            ),
+        ),
+    ),
+
+    'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
+    'manage' => array
+    (
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            //'导出订单' => array('location', 'journal/lib/manage.out'),
+        ),
+
+        'list_button' => array(
+            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} >= 2 && ({type} == 1 || {type} == 3)'),
+            //'delete' => array('删除', '', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'create_uid' => 'yes',
+                'status' => array('1', '!='),
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getYes' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'product_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取提交订单超过12个小时
+        'getDataByTime' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cdate' => array('yes', '>='),
+                'notice' => 'yes',
+                'note' => 'yes',
+                'type' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取没有兑换码的订单
+        'getUnCode' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'code' => array('yes', '='),
+                'status' => 'yes',
+                'type' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'limit' => '0,100',
+            'col' => '*',
+        ),
+
+        # 获取1,2
+        'getBuy' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'status' => 'yes',
+                'type' => array('yes', 'in'),
+                'product_id' => 'yes',
+                'order_id' => 'yes',
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getMyAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'uid' => 'yes',
+                'status' => 'yes',
+                'cate_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => 'id,order_id,name,buy_num,cdate,cash,product_id,buy_id',
+        ),
+
+        # 删除未支付订单
+        'drop' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'delete',
+            'col' => 'id,order_id',
+        ),
+
+        # 获取数据
+        'getAllByDate' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+            ),
+            'type' => 'all',
+            'col' => 'id,order_id',
+        ),
+    ),
+);

+ 569 - 0
act/database/order_temp.php

@@ -0,0 +1,569 @@
+<?php
+
+$type = array
+(
+    //1 => '购买小刊',
+    //2 => '兑换小刊',
+    3 => '购买兑换码',
+    //4 => '使用通用兑换码',
+);
+
+# 系统
+$system = array
+(
+    1 => '小程序',
+    2 => 'H5',
+    3 => 'ios',
+    4 => '安卓',
+);
+
+# 渠道
+$source = function()
+{
+    return Dever::db('source/info')->state();
+};
+
+$status = array
+(
+    1 => '待支付',
+    2 => '已支付',
+    3 => '支付失败',
+    //4 => '申请退款',
+    5 => '已退款',
+);
+
+$product = function()
+{
+    return Dever::db('journal/info')->state();
+};
+
+$buy = function()
+{
+    return Dever::db('journal/buy_num')->state();
+};
+# 获取小刊分类权限
+$auth = Dever::tops();
+$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;
+};
+
+$seller = function()
+{
+    return Dever::db('code/seller')->state();
+};
+
+return array
+(
+    # 表名
+    'name' => 'order_temp',
+    # 显示给用户看的名称
+    'lang' => '临时订单管理',
+    'order' => 1,
+    'menu' => false,
+
+    'end' => array
+    (
+        'update' => 'act/lib/pay.order',
+    ),
+
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID/订单表ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            //'list'        => true,
+            'list'        => 'Dever::load("act/order.getOrderTempId", {id})',
+        ), 
+
+        'cate_journal'     => array
+        (
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'search'    => 'linkage',
+            'search_col' => 'cate_id,product_id',
+            'option'    => Dever::url('lib/manage.search_cate_journal', 'journal'),
+        ),
+
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            //'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '订单名称',
+            'default'   => '',
+            'desc'      => '订单名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list_name' => '订单信息',
+            'list'      => 'Dever::load("journal/lib/manage.showOrderUserV1", "{id}")',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '',
+            'desc'      => '用户id',
+            'match'     => 'is_numeric',
+            'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            'update'    => 'text',
+        ),
+
+        'source_uid'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '邀请人',
+            'default'   => '',
+            'desc'      => '邀请人',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'product_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $product,
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'buy_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买本数',
+            'default'   => '',
+            'desc'      => '购买本数',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $buy,
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'buy_num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买本数',
+            'default'   => '',
+            'desc'      => '购买本数',
+            'match'     => 'is_numeric',
+            //'search'    => 'select',
+            //'list'        => true,
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '支付方式',
+            'default'   => '1',
+            'desc'      => '支付方式',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+            'search'    => 'select',
+            'update'    => 'radio',
+            //'list'        => true,
+            'control'   => 'type',
+        ),
+
+        'system'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '系统',
+            'default'   => '1',
+            'desc'      => '系统',
+            'match'     => 'is_numeric',
+            'option'    => $system,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'        => true,
+        ),
+
+        'source'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '渠道来源',
+            'default'   => '1',
+            'desc'      => '支付方式',
+            'match'     => 'is_numeric',
+            'option'    => $source,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'        => true,
+        ),
+
+        'seller_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '销售商',
+            'default'   => '1',
+            'desc'      => '销售商',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $seller,
+            'search'    => 'select',
+            //'list'      => true,
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
+            'match'     => 'is_numeric',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '支付金额',
+            'default'   => '',
+            'desc'      => '支付金额',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'show'      => 'type=1',
+        ),
+
+        'code'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '使用的兑换码',
+            'default'   => '',
+            'desc'      => '使用的兑换码',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'show'      => 'type=2',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '请选择订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'update'    => 'radio',
+            'list'		=> true,
+            //'list'      => 'Dever::load("journal/lib/manage.showOrderStatusV1", "{id}")',
+            'control'   => 'status',
+        ),
+
+        'tk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '退款截图',
+            'default'   => '',
+            'desc'      => '退款截图',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => 1
+        ),
+
+        'tk_time'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款时间',
+            'default'   => '',
+            'desc'      => '退款时间',
+            'match'     => 'option',
+            //'list'        => true,
+            //'update'    => 'date',
+            'callback'  => 'maketime',
+            'show'      => 'status=5',
+        ),
+
+        'tk_admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款审核人',
+            'default'   => '1',
+            'desc'      => '退款审核人',
+            'match'     => 'option',
+            //'list'        => true,
+            'show'      => 'status=5',
+        ),
+
+        'tk_desc'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5',
+        ),
+
+        '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})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '备注',
+            'default'   => '',
+            'desc'      => '备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5'
+            //'list'      => '"{info}" ? "{info}" : "双击添加备注"',
+            //'edit'      => true,
+        ),
+
+        'mobile'        => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '手机号',
+            'default'   => '',
+            'desc'      => '手机号',
+            'match'     => 'option',
+            //'show'        => 'status=5'
+            'search'    => array
+            (
+                'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
+                'col' => 'mobile',//要查询的字段
+                'result' => 'id',//返回的字段
+                'search' => 'uid',//本表的字段,默认为当前的字段
+            ),
+        ),
+    ),
+
+    'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
+    'manage' => array
+    (
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            //'导出订单' => array('location', 'journal/lib/manage.out'),
+        ),
+
+        'list_button' => array(
+            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2 && ({type} == 1 || {type} == 3)'),
+            //'delete' => array('删除', '', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'create_uid' => 'yes',
+                'status' => array('1', '!='),
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getYes' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'product_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取提交订单超过12个小时
+        'getDataByTime' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cdate' => array('yes', '>='),
+                'notice' => 'yes',
+                'note' => 'yes',
+                'type' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 获取没有兑换码的订单
+        'getUnCode' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'code' => array('yes', '='),
+                'status' => 'yes',
+                'type' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'limit' => '0,100',
+            'col' => '*',
+        ),
+
+        # 获取1,2
+        'getBuy' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'status' => 'yes',
+                'type' => array('yes', 'in'),
+                'product_id' => 'yes',
+                'order_id' => 'yes',
+                'uid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getMyAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'uid' => 'yes',
+                'status' => 'yes',
+                'cate_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => 'id,order_id,name,buy_num,cdate,cash,product_id,buy_id',
+        ),
+
+        # 删除未支付订单
+        'drop' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'delete',
+            'col' => 'id,order_id',
+        ),
+
+        # 获取数据
+        'getAllByDate' => array
+        (
+            # 匹配的正则或函数 选填项
+            'where' => array
+            (
+                'time' => array('yes-cdate', '<='),
+            ),
+            'type' => 'all',
+            'col' => 'id,order_id',
+        ),
+    ),
+);

+ 158 - 0
act/database/score.php

@@ -0,0 +1,158 @@
+<?php
+
+$table = Dever::config('base')->type;
+
+return array
+(
+	# 表名
+	'name' => 'score',
+	# 显示给用户看的名称
+	'lang' => '积分排行榜',
+	# 是否显示在后台菜单
+	'order' => 1,
+	'menu' => false,
+	# 数据结构
+	'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'	=> 'text',
+			//'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',
+			'update'	=> 'select',
+			//'search'	=> 'select',
+			'option' 	=> $table,
+			//'list'		=> true,
+			'list_name'	=> '手机号',
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#mobile", {uid}) : "无"',
+		),
+		
+		'data_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'update'	=> 'text',
+			'match' 	=> 'option',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", "{data_id}")',
+		),
+
+		'user_log_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户积分日志id',
+			'default' 	=> '',
+			'desc' 		=> '用户积分日志id',
+			'update'	=> 'text',
+			'match' 	=> 'option',
+		),
+
+		'score' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '积分',
+			'default' 	=> '',
+			'desc' 		=> '积分',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'order'		=> 'desc',
+			'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,
+		'button' => array
+		(
+			'导出排行榜' => array('location', 'act/lib/score.out?id=' . Dever::input('search_option_data_id')),
+		),
+	),
+
+	# 更新表结构
+	'alter' => array
+	(
+		1 => array
+		(
+			array('update', 'score', 'score', 'int-11 0 积分'),
+			//array('add', 'config', 'config', 'int-11 1 配置'),
+		),
+		'version' => 1,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'data_id' => 'yes',
+				'type' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('score' => 'desc','id' => 'desc'),
+			'page' => array(50, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 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
+    (
+        
+    ),
+);

+ 196 - 0
act/database/subscribe.php

@@ -0,0 +1,196 @@
+<?php
+
+$table = Dever::config('base')->type;
+
+$source = array
+(
+	1 => '购买',
+	2 => '兑换码',
+	3 => '邀请活动',
+	4 => '免费阅读',
+);
+$note = array
+(
+	1 => '未发送',
+	2 => '已发送',
+);
+return array
+(
+	# 表名
+	'name' => 'subscribe',
+	# 显示给用户看的名称
+	'lang' => '订阅日志',
+	# 是否显示在后台菜单
+	'order' => 68,
+	# 数据结构
+	'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'	=> 'text',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) . "({uid})" : "匿名用户"',
+		),
+
+		'type' 		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '订阅类别',
+			'default' 	=> '',
+			'desc' 		=> '订阅类别',
+			'match' 	=> 'option',
+			'update'	=> 'select',
+			//'search'	=> 'select',
+			'option' 	=> $table,
+			//'list'		=> true,
+		),
+		
+		'data_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'update'	=> 'text',
+			'match' 	=> 'option',
+			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id}, "{id}")',
+		),
+
+		'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+            'option'	=> $note,
+            'edit'		=> true,
+            'list'		=> true,
+        ),
+
+		'source' 		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '来源',
+			'default' 	=> '',
+			'desc' 		=> '来源',
+			'match' 	=> 'option',
+			'update'	=> 'select',
+			'search'	=> 'select',
+			'option' 	=> $source,
+			'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,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'data_id' => 'yes',
+				'type' => 'yes',
+				'avatar' => array('yes-t_2.avatar', '!='),
+				'state' => 1,
+				'status' => 'yes-t_2.status',
+			),
+			# 联表
+			'join' => array
+			(
+				array
+				(
+					'table' => 'passport/user',
+					'type' => 'left join',
+					'on' => array('uid','id'),
+					'col' => 't_2.username,t_2.avatar',
+				),
+			),
+			'type' => 'all',
+			'order' => array('t_2.id' => 'desc'),
+			'page' => array(6, 'list'),
+			'col' => '*',
+		),
+
+		'getMyAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'data_id' => 'yes',
+				'type' => 'yes',
+				'uid' => 'yes',
+				'source' => array('yes', 'in'),
+				'cate_id' => 'yes-t_2.cate_id',
+				'state' => 1,
+				'status' => 'yes-t_2.status',
+			),
+			# 联表
+			'join' => array
+			(
+				array
+				(
+					'table' => 'journal/info',
+					'type' => 'left join',
+					'on' => array('data_id','id'),
+				),
+			),
+			'type' => 'all',
+			'order' => array('t_1.id' => 'desc'),
+			'page' => array(10000, 'list'),
+			'col' => '*,t_2.*,t_2.num_add_view+t_2.num_view as num_view,ROUND((t_2.num_ding+t_2.num_add_ding)*t_2.num_ratio_ding) as num_ding,t_2.num_add_ding,t_2.num_ratio_ding',
+		),
+	)
+);

+ 116 - 0
act/database/watch.php

@@ -0,0 +1,116 @@
+<?php
+
+$table = Dever::config('base')->type;
+return array
+(
+    # 表名
+    'name' => 'watch',
+    # 显示给用户看的名称
+    'lang' => '观看人数',
+    # 是否显示在后台菜单
+    'order' => 79,
+    'menu' => false,
+    # 数据结构
+    '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',
+        ),
+    )
+);

+ 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');

+ 90 - 0
act/lib/Comment.php

@@ -0,0 +1,90 @@
+<?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'] = Dever::emoji($content);
+        $table = $this->table($type);
+        $info = Dever::db($table)->one($where);
+        if (!$info) {
+            $data_table = Dever::config('base')->type_table[$type];
+            $data = Dever::db($data_table)->one($id);
+            if (isset($data['name']) && $data['name']) {
+                $where['data_name'] = $data['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;
+    }
+}

+ 38 - 0
act/lib/Cron.php

@@ -0,0 +1,38 @@
+<?php
+#计划任务
+namespace Act\Lib;
+
+use Dever;
+
+class Cron
+{
+	# 清理一小时前的待支付数据
+	public function drop_order_api()
+	{
+		$where['where_time'] = time() - 3600;
+		Dever::db('act/order')->drop($where);
+		return 'ok';
+	}
+
+	# 将七天前的数据进行迁移 废弃
+	public function mv_order()
+	{
+		return 'error';
+		$where['where_time'] = time() - (86400 * 7);
+		$data = Dever::db('act/order')->getAllByDate($where);
+		if ($data) {
+			$db = Dever::db('act/order_bak');
+			foreach ($data as $k => $v) {
+				$info = $db->one(array('order_id' => $v['order_id']));
+				if (!$info) {
+					$id = $v['id'];
+					unset($v['id']);
+					$db->insert($v);
+					Dever::db('act/order')->delete($id);
+				}
+			}
+		}
+
+		return 'ok';
+	}
+}

+ 33 - 0
act/lib/Feedback.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Feedback
+{
+    # 发表反馈
+    public function submit($uid, $username, $name, $type_id, $contact, $content)
+    {
+        $where['uid'] = $uid;
+        $where['username'] = $username;
+        $where['name'] = $name;
+        $where['content'] = Dever::emoji($content);
+        $table = 'act/feedback';
+        $info = Dever::db($table)->one($where);
+        if (!$info) {
+            $where['type_id'] = $type_id;
+            $where['contact'] = $contact;
+            $id = Dever::db($table)->insert($where);
+        } else {
+            $where['where_id'] = $info['id'];
+            $where['type_id'] = $type_id;
+            $where['contact'] = $contact;
+            Dever::db($table)->update($where);
+            $id = $info['id'];
+        }
+        Dever::score($uid, 'submit_feedback', '发表反馈');
+
+        return $id;
+    }
+}

+ 54 - 0
act/lib/Form.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Form
+{
+    # 获取当前可用的formid
+    public function get($uid, $type = 1, $system = 1)
+    {
+        $where['uid'] = $uid;
+        if ($type > 0) {
+        	$where['type'] = $type;
+        	if ($type == 2) {
+        		# 支付表单有3次机会
+        		$where['num'] = 3;
+        	} else {
+        		# 普通表单只有一次机会
+        		$where['num'] = 1;
+        	}
+        }
+        $where['cate_id'] = $system;
+        $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;
+    }
+}

+ 67 - 0
act/lib/Invite.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Invite
+{
+    # 获取小刊的邀请排行
+    public function getList($uid, $id, $type = 4, $num = false)
+    {
+        $key = 'invite_' . $uid . '_' . $type . '_' . $id;
+        //$data = Dever::cache($key);
+        $data = array();
+        if (!$data) {
+        	$where['source_uid'] = $uid;
+            $where['type'] = $type;
+            $where['data_id'] = $id;
+            if ($num > 0) {
+                $where['page'] = array(6, 'list');
+            }
+            $where['avatar'] = 'null';
+            $data = Dever::db('act/invite')->getAll($where);
+
+            if ($data) {
+                //Dever::cache($key, $data, 900);
+            }
+        }
+
+        /*
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $user = Dever::load('passport/api')->info($v['uid']);
+                $data[$k]['username'] = $user['username'];
+                $data[$k]['avatar'] = $user['avatar'];
+            }
+        }
+        */
+        return $data;
+    }
+
+    # 获取小刊的邀请数量
+    public function getTotal($uid, $id, $type = 4)
+    {
+        $where['source_uid'] = $uid;
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $data = Dever::db('act/invite')->total($where);
+
+        return $data;
+    }
+
+    public function submit($source_uid, $uid, $id, $type = 4)
+    {
+        $where['source_uid'] = $source_uid;
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $table = 'act/invite';
+        $info = Dever::db($table)->one($where);
+        if (!$info) {
+            Dever::db($table)->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,6';
+        $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, $mid = false)
+    {
+        $table = Dever::config('base')->type_table[$source_table];
+        $data = Dever::db($table)->one($id);
+
+        if ($data && isset($data['name']) && $data['name']) {
+            return $data['name'] . '('.$mid.')';
+        }
+        if ($data && isset($data['content']) && $data['content']) {
+            return $data['content'] . '('.$mid.')';
+        }
+        return '未知' . '('.$mid.')';
+    }
+
+    # 根据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));
+                }
+            }
+        }
+    }
+}

+ 131 - 0
act/lib/Note.php

@@ -0,0 +1,131 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Note
+{
+    # 获取message的push信息
+    public function push($type, $id, $name, $link = '')
+    {
+        $param = array('type' => $type, 'id' => $id, 'name' => $name, 'link' => $link);
+
+        $push = array(json_encode($param), 'jstyle://cn.jstyle.app/route?' . http_build_query($param));
+        return $push;
+    }
+    # 获取当前用户是否预约
+    public function get($uid, $id, $type)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $where['state'] = 1;
+        $info = Dever::db('act/live_note')->one($where);
+
+        if ($info && $info['state'] == 1) {
+            return 1;
+        } else {
+            return 2;
+        }
+    }
+
+    # 预约
+    public function submit($uid, $id, $type, $formid = '', $system = 1)
+    {
+        if ($formid) {
+            Dever::load('act/lib/form')->submit($uid, $formid, 1, $system);
+        }
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $where['cate_id'] = $system;
+        $info = Dever::db('act/live_note')->one($where);
+        if (!$info) {
+            if ($formid) {
+                $where['formid'] = $formid;
+            }
+            
+            Dever::db('act/live_note')->insert($where);
+        } else {
+            $update['cate_id'] = $system;
+            $update['where_id'] = $info['id'];
+            if ($formid) {
+                $update['formid'] = $formid;
+            }
+            $update['cdate'] = time();
+            if ($info['state'] == 1) {
+                $update['state'] = 2;
+                Dever::db('act/live_note')->update($update);
+            } else {
+                $update['state'] = 1;
+                Dever::db('act/live_note')->update($update);
+            }
+        }
+
+        return true;
+    }
+
+    # 提醒 后续实现 需要加入到cron里:act/lib/note.cron
+    public function cron()
+    {
+        $data = Dever::db('act/live_note')->getAll();
+
+        if ($data) {
+            $time = time();
+            $day = 7 * 86400;
+            $date = 800;
+            foreach ($data as $k => $v) {
+                $table = Dever::config('base')->type_table[$v['type']];
+                $info = Dever::db($table)->one($v['data_id']);
+                if ($info && $v['type'] == 3 && isset($info['sdate']) && $info['sdate'] > 0 && $info['sdate'] > $time && $info['sdate'] - $time <= $date) {
+
+                    $user = Dever::db('passport/user')->one($v['uid']);
+                    if (!$user) {
+                        continue;
+                    }
+                    Dever::db('act/live_note')->update(array('where_id' => $v['id'], 'note' => 2));
+
+                    if (Dever::project('message')) {
+                        Dever::load('message/lib/data')->push(-1, $v['uid'], '直播提醒', $info['name'] . '直播即将开始,马上观看!', 11, $v['cate_id'], 1, Dever::load('act/lib/note')->push(3, $info['id'], $info['name']));
+                    }
+                    
+                    # 发送短消息
+                    if (isset($user['mobile']) && $user['mobile'] && Dever::project('sms')) {
+                        $send = array();
+                        $send['name'] = $info['name'];
+                        Dever::load('sms/api.send', 'note_live', $user['mobile'], $send);
+                    }
+
+                    //$formid = Dever::load('act/lib/form')->get($v['uid'], 1);
+                    $formid = $v['formid'];
+                    if ($formid) {
+                        # 发送模板消息
+                        $wechat = Dever::db('passport/wechat')->one(array('uid' => $v['uid'], 'type' => 1, 'system_id' => $v['cate_id']));
+                        if ($wechat && Dever::project('wechat_applet')) {
+                            $send['key'] = 'note_live';
+                            $send['project_id'] = $v['cate_id'];
+                            $send['touser'] = $wechat['openid'];
+                            $send['page'] = Dever::config('base')->applet_index . '?scene=' . Dever::login($v['uid']) . ',' . $v['type'] . ',' . $v['id'];
+                            $send['data'] = array
+                            (
+                                'keyword1' => array('value' => $info['name']),
+                                'keyword2' => array('value' => $info['name'] . '直播即将开始,马上观看!'),
+                            );
+                            $send['data'] = json_encode($send['data']);
+                            $send['form_id'] = $formid;
+                            Dever::load('wechat_applet/msg.send', $send);
+                        }
+                    }
+                }
+            }
+        }
+
+        return 'ok';
+    }
+
+    public function cron_api()
+    {
+        
+    }
+}

+ 151 - 0
act/lib/Num.php

@@ -0,0 +1,151 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Num
+{
+    # 获取我在这个小刊中的本数
+    public function get($id, $uid)
+    {
+        $where['uid'] = $uid;
+        $where['journal_id'] = $id;
+        $where['state'] = 1;
+        $data = Dever::db('act/journal_num')->one($where);
+
+        if ($data) {
+            return $data['num'];
+        } else {
+            return 0;
+        }
+    }
+    
+    # 获取小刊的积分排行
+    public function getList($id, $uid = false)
+    {
+        $key = 'journal_num_' . $id;
+        $data = Dever::cache($key);
+        if (!$data) {
+            $where['journal_id'] = $id;
+            if ($uid > 0) {
+                $where['uid'] = $uid;
+            }
+            $data = Dever::db('act/journal_num')->getAll($where);
+
+            if ($data) {
+                foreach ($data as $k => $v) {
+                    $user = Dever::load('passport/api')->info($v['uid']);
+                    $data[$k]['username'] = $user['username'];
+                    $data[$k]['avatar'] = $user['avatar'];
+                    $data[$k]['mobile'] = $user['mobile'];
+                }
+
+                Dever::cache($key, $data, 600);
+            }
+        }
+        
+        return $data;
+    }
+
+    public function submit($id, $uid = false, $num = false, $update = true)
+    {
+        $where['uid'] = $uid;
+        $where['journal_id'] = $id;
+        $table = 'act/journal_num';
+        $db = Dever::db($table);
+        $info = $db->one($where);
+        if (!$info) {
+            $where['num'] = $num;
+            $db->insert($where);
+        } else {
+            if ($update) {
+                $where['where_id'] = $info['id'];
+                if (!$info['num'] || $info['num'] < 0) {
+                    $info['num'] = 0;
+                }
+                $where['num'] = $info['num'] + $num;
+                $db->update($where);
+            }
+        }
+
+        return true;
+    }
+
+    # 矫正数据用的,放到计划任务中
+    public function cron()
+    {
+        
+
+        return true;
+    }
+
+    # 订阅数计数器
+    public function setCounter($id, $num = 0)
+    {
+        $key = 'journal_buy_num3_' . $id;
+        /*
+        $callback = function() use($id) {
+            $journal = Dever::db('journal/info')->one($id);
+            return $journal['num_ding'];
+        };
+        Dever::counter($key, $num, $callback);
+        */
+        Dever::cache($key, $num);
+        return true;
+    }
+
+    # 订阅数计数器
+    public function getCounter($id)
+    {
+        $key = 'journal_buy_num3_' . $id;
+        //return Dever::counter($key);
+        return Dever::cache($key);
+    }
+
+    /**
+     * 导出成excel
+     *
+     * @return mixed
+     */
+    public function out_api()
+    {
+        $id = Dever::input('id');
+        $journal = Dever::db('journal/info')->one($id);
+
+        if (!$journal) {
+            return;
+        }
+
+        $score = $this->getList($id);
+        $header = $data = array();
+        $name = $journal['name'];
+        if ($score) {
+            $i = 0;
+            foreach ($score as $k => $v) {
+                $data[$i] = array
+                (
+                    $i+1,
+                    $v['username'],
+                    $v['mobile'],
+                    $v['num'],
+                );
+                $i++;
+            }
+        }
+
+        $header = array
+        (
+            '排序', '用户名', '手机号', '本数'
+        );
+
+        $file = $name . '_排行榜';
+        if (Dever::input('test')) {
+            print_r($header);
+            print_r($data);die;
+        }
+        
+        Dever::excelExport($data, $header, $file, $sheet = 0, $sheetName = $name);
+        return;
+    }
+}

+ 272 - 0
act/lib/Pay.php

@@ -0,0 +1,272 @@
+<?php
+#新版本的异步支付
+namespace Act\Lib;
+
+use Dever;
+
+class Pay
+{
+    private $key = 'jmss_2018';
+
+    # 退款操作
+    public function order($id, $name, $data)
+    {
+        $status = Dever::param('status', $data);
+
+        if ($status == 5 && $id > 0) {
+            $send = array();
+            $info = Dever::db('act/order')->one($id);
+            if ($info['system'] == 1) {
+                if ($info['cate_id'] == 1) {
+                    $account_id = 1;
+                }
+                if ($info['cate_id'] == 2) {
+                    $account_id = 4;
+                }
+                if ($info['cate_id'] == 3) {
+                    $account_id = 5;
+                }
+            } elseif ($info['system'] == 2) {
+                $account_id = 2;
+            } else {
+                $account_id = 3;
+            }
+            $send['pay_project_id'] = 3;
+            $send['pay_uid'] = $info['uid'];
+            $send['pay_order_id'] = $info['order_id'] ? $info['order_id'] : Dever::load('act/order')->createOrderId($info, $info['id']);
+            $send['pay_tk_pic'] = Dever::param('tk_pic', $data);
+            $send['pay_tk_time'] = Dever::param('tk_time', $data);
+            $send['pay_tk_desc'] = Dever::param('tk_desc', $data);
+            $send['pay_account_id'] = $account_id;
+            $send['pay_cash'] = $info['cash'];
+            $send['pay_status'] = $status;
+            $send['dever_token'] = $this->key;
+            Dever::load('pay/lib/set.updateStatus', $send);
+            if ($info['buy_id'] > 0) {
+                $buy = Dever::db('journal/buy_num')->one($info['buy_id']);
+
+                if ($buy) {
+                    if ($info['buy_num'] > 0) {
+                        $num = $info['buy_num'];
+                    } else {
+                        $num = $buy['num'];
+                    }
+                    # 减少积分
+                    $score = $num * 20;
+
+                    $user = Dever::db('score/user')->one(array('uid' => $info['uid']));
+                    if ($user) {
+                        $user_id = $user['id'];
+                        $user_score = $user['score'];
+                        $user_score = $user_score - $score;
+                        if ($user_score < 0) {
+                            $user_score = 0;
+                        }
+                        Dever::db('score/user')->update(array('where_id' => $user_id, 'score' => $user_score));
+                    }
+
+                    # 减少排行榜
+                    $journal_num = Dever::db('act/journal_num')->one(array('uid' => $info['uid'], 'journal_id' => $info['product_id']));
+                    if ($journal_num) {
+                        $journal_num_id = $journal_num['id'];
+                        $journal_num = $journal_num['num'];
+                        $journal_num = $journal_num - $num;
+                        if ($journal_num < 0) {
+                            $journal_num = 0;
+                        }
+                        Dever::db('act/journal_num')->update(array('where_id' => $journal_num_id, 'num' => $journal_num));
+                    }
+
+                    # 减少订阅本数 这个定时跑就行了 不管了
+                    $journal = Dever::db('journal/info')->one($info['product_id']);
+                    if ($journal) {
+                        $journal_id = $journal['id'];
+                        $journal_num = $journal['num_ding'];
+                        $journal_num = $journal_num - $num;
+                        if ($journal_num < 0) {
+                            $journal_num = 0;
+                        }
+                        Dever::db('journal/info')->update(array('where_id' => $journal_id, 'num_ding' => $journal_num));
+                    }
+                }
+            }
+        }
+        return 'reload';
+    }
+
+    /**
+     * 支付成功后,调取的接口 这里的安全以后再升级吧,升级成和pay/lib/set.updateStatus一样的
+     *
+     * @return mixed
+     */
+    public function act($param = array())
+    {
+        $this->act_action($param);
+        return 'ok';
+
+        $send = Dever::preInput('pay_');
+        $send = $param;
+        $key = md5($this->key);
+        ksort($send);
+        $send['signature'] = md5($key . '&' . http_build_query($send));
+        $signature = Dever::input('signature');
+        if ($send['signature'] == $signature) {
+            $this->act_action($send);
+        }
+
+        return 'ok';
+    }
+
+    public function act_action($send)
+    {
+        //$product_id = $send['pay_product_id'];
+        //$uid = $send['pay_uid'];
+        //$cash = $send['pay_cash'];
+        $order_id = $send['pay_order_id'];
+        $status = $send['pay_status'];
+        $msg = $send['pay_msg'];
+
+        $temp = explode('D', $order_id);
+        $id = $temp[1];
+
+        //$order = Dever::db('act/order_temp')->one(array('order_id' => $order_id, 'uid' => $uid));
+        $order = Dever::db('act/order_temp')->one($id);
+
+        if ($send['pay_status'] == 2 && $order) {
+
+            $update = $order;
+            //$update['where_id'] = $order['id'];
+            $update['status'] = 2;
+            if ($order['type'] == 3 && !$order['code']) {
+                if ($order['system'] == 2) {
+                    $code = Dever::load('code/lib/core')->createCodeByOrder($order);
+                } else {
+                    $code = Dever::load('code/lib/core')->createCodeByOrder($order, -1);
+                }
+                
+                if ($code) {
+                    $update['code'] = $code;
+                }
+            }
+
+            Dever::db('act/order')->insert($update);
+
+            $score = false;
+            $num = false;
+            $journal = Dever::load('act/order')->getJournal($order['product_id']);
+            if ($order['buy_id'] > 0) {
+                $buy = Dever::load('act/order')->getBuy($order['buy_id']);
+                if ($buy && $buy['score'] > 0) {
+                    $score = $buy['num'] * $buy['score'];
+                } else {
+                    if ($order['type'] == 1) {
+                        # 直接购买
+                        $col = 'score';
+                    } elseif ($order['type'] == 3) {
+                        $col = 'dh_score';
+                    }
+
+                    if ($journal && $buy && $journal[$col] > 0) {
+                        $score = $buy['num'] * $journal[$col];
+                    } elseif ($journal && $buy) {
+                        $num = $buy['num'];
+                    }
+                }
+
+                if ($buy && $buy['num']) {
+
+                    $active = Dever::load('act/order')->getActive($order['product_id']);
+                    $active_state = true;
+                    if ($active && $active['status'] == 1 && time() > $active['end']) {
+                        $active_state = false;
+                    }
+                    if ($active_state) {
+                        # 增加本数
+                        Dever::load('act/lib/num')->submit($order['product_id'], $order['uid'], $buy['num']);
+                    }
+
+                    # 增加订阅数
+                    //Dever::load('act/lib/num')->setCounter($order['product_id'], $buy['num']);
+                }
+            }
+            # 积分
+            Dever::score($order['uid'], 'buy_journal', '购买小刊', '', $score, $num);
+
+            if ($order['system'] == 2) {
+                return;
+            }
+
+            # 发消息
+            $journal['id'] = $order['product_id'];
+            $journal['name'] = $order['name'];
+            if (strstr('-', $journal['name'])) {
+                $name = explode('-', $journal['name']);
+                $journal['name'] = $name[0];
+            }
+            
+            //$journal = Dever::db('journal/info')->one($order['product_id']);
+
+            if (Dever::project('message')) {
+                Dever::load('message/lib/data')->push(-1, $order['uid'], '购买提醒', '购买成功,您获得了 '.$journal['name'].' 的阅读资格!', 11, $order['cate_id'], 1, Dever::load('act/lib/note')->push(4, $journal['id'], $journal['name']));
+            }
+
+            $user = Dever::db('passport/user')->one($order['uid']);
+
+            # 发短信
+            /*
+            if (isset($user['mobile']) && $user['mobile'] && Dever::project('sms') && $order['cate_id'] == 1) {
+                $send = array();
+                $send['name'] = $journal['name'];
+                Dever::load('sms/api.send', 'buy_journal', $user['mobile'], $send);
+            }
+            */
+
+            # 发模板消息
+            $wechat = Dever::db('passport/wechat')->one(array('uid' => $order['uid'], 'type' => 1, 'system_id' => $order['cate_id']));
+            if ($wechat && Dever::project('wechat_applet')) {
+                $send['key'] = 'buy_journal';
+                $send['project_id'] = $order['cate_id'];
+                $send['touser'] = $wechat['openid'];
+                $send['page'] = Dever::config('base')->applet_index . '?scene=' . $order['uid'] . ',' . '4,' . $order['product_id'];
+                $send['data'] = array
+                (
+                    'keyword1' => array('value' => date('Y年m月d日 H:i', $order['cdate'])),
+                    'keyword2' => array('value' => '购买成功,您获得了 '.$journal['name'].' 的阅读资格!'),
+                );
+                $send['data'] = json_encode($send['data']);
+                $send['form_id'] = Dever::load('act/lib/form')->get($order['uid'], 2, $order['cate_id']);
+
+                if ($send['form_id']) {
+                    Dever::load('wechat_applet/msg.send', $send);
+                }
+            }
+
+        } else {
+            Dever::db('act/order_temp')->update(array('where_id' => $order['id'], 'status' => 3));
+        }
+    }
+
+    public function send_api()
+    {
+        $uid = Dever::input('uid', 8);
+        # 发模板消息
+        $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid));
+        if ($wechat && Dever::project('wechat_applet')) {
+            $send['key'] = 'buy_journal';
+            $send['project_id'] = 2;
+            $send['touser'] = $wechat['openid'];
+            $send['page'] = Dever::config('base')->applet_index . '?scene=' . Dever::login($uid) . ',' . '4,' . $order['product_id'];
+            $send['data'] = array
+            (
+                'keyword1' => array('value' => date('Y年m月d日 H:i', $order['cdate'])),
+                'keyword2' => array('value' => '购买成功,您获得了 '.$journal['name'].' 的阅读资格!'),
+            );
+            $send['data'] = json_encode($send['data']);
+            $send['form_id'] = Dever::load('act/lib/form')->get($uid, 2, $order['cate_id']);
+
+            if ($send['form_id']) {
+                Dever::load('wechat_applet/msg.send', $send);
+            }
+        }
+    }
+}

+ 135 - 0
act/lib/Score.php

@@ -0,0 +1,135 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Score
+{
+    # 获取我在这个小刊中的积分
+    public function get($id, $uid, $type = 4)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $where['state'] = 1;
+        $data = Dever::db('act/score')->one($where);
+
+        if ($data) {
+            return $data['score'];
+        } else {
+            return 0;
+        }
+    }
+    
+    # 获取小刊的积分排行
+    public function getList($id, $type = 4, $uid = false)
+    {
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        if ($uid > 0) {
+            $where['uid'] = $uid;
+        }
+        $data = Dever::db('act/score')->getAll($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $user = Dever::load('passport/api')->info($v['uid']);
+                $data[$k]['username'] = $user['username'];
+                $data[$k]['avatar'] = $user['avatar'];
+                $data[$k]['mobile'] = $user['mobile'];
+            }
+        }
+        return $data;
+    }
+
+    public function submit()
+    {
+        $user_log_id = Dever::input('user_log_id');
+        $type = Dever::input('type', 4);
+        $id = Dever::input('id');
+        $method = Dever::input('method');
+
+        $user_log = Dever::db('score/user_log')->one($user_log_id);
+
+        if ($user_log) {
+            if ($method == 'share' || $method == 'pay' || $method == 'code') {
+                # 活动结束后,无法增加当前小刊积分
+                if ($type == 4) {
+                    $journal = Dever::db('journal/active')->one(array('info_id' => $id, 'state' => 1));
+                    if (!$journal) {
+                        return;
+                    }
+                    if ($journal && $journal['status'] == 2) {
+                        return;
+                    }
+                    if ($journal && time() > $journal['end']) {
+                        return;
+                    }
+                }
+            }
+            //$where['user_log_id'] = $user_log_id;
+            $where['uid'] = $user_log['uid'];
+            $where['data_id'] = $id;
+            $where['type'] = $type;
+            $table = 'act/score';
+            $info = Dever::db($table)->one($where);
+            if (!$info) {
+                $where['score'] = $user_log['num'];
+                Dever::db($table)->insert($where);
+            } else {
+                $where['where_id'] = $info['id'];
+                $where['score'] = $info['score'] + $user_log['num'];
+                Dever::db($table)->update($where);
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * 导出成excel
+     *
+     * @return mixed
+     */
+    public function out_api()
+    {
+        $id = Dever::input('id');
+        $journal = Dever::db('journal/info')->one($id);
+
+        if (!$journal) {
+            return;
+        }
+
+        $score = $this->getList($id);
+        $header = $data = array();
+        $name = $journal['name'];
+        if ($score) {
+            $i = 0;
+            foreach ($score as $k => $v) {
+                $data[$i] = array
+                (
+                    $i+1,
+                    $v['username'],
+                    $v['mobile'],
+                    $v['score'],
+                );
+                $i++;
+            }
+        }
+
+        $header = array
+        (
+            '排序', '用户名', '手机号', '积分'
+        );
+
+        $file = $name . '_邀请积分排行榜';
+        if (Dever::input('test')) {
+            print_r($header);
+            print_r($data);die;
+        }
+        
+        Dever::excelExport($data, $header, $file, $sheet = 0, $sheetName = $name);
+        return;
+    }
+}

+ 163 - 0
act/lib/Share.php

@@ -0,0 +1,163 @@
+<?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'];
+                            }
+                            */
+                            if ($active) {
+                                $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, $journal['cate_id'], 1, Dever::load('act/lib/note')->push(4, $journal['id'], $journal['name']));
+                                        }
+
+                                        # 发送模板消息 这里没有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;
+    }
+}

+ 109 - 0
act/lib/Subscribe.php

@@ -0,0 +1,109 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Subscribe
+{
+    private $key = 'use_sub_';
+
+    # 获取小刊是否被人订阅
+    public function get($id, $uid, $type = 4, $cache = false)
+    {
+        $key = $this->key . $uid . '_' . $id;
+        $data = Dever::cache($key);
+        if ($data == 1) {
+            return 1;
+        } else {
+            if (!$cache) {
+                $where['uid'] = $uid;
+                $where['type'] = $type;
+                $where['data_id'] = $id;
+                $where['state'] = 1;
+                $data = Dever::db('act/subscribe')->one($where);
+
+                if ($data) {
+                    Dever::cache($key, 1, 864000);
+                    return 1;
+                } else {
+                    return 2;
+                }
+            }
+            return 2;
+        }
+    }
+
+    public function getInfo($id, $uid, $type = 4)
+    {
+        $where['uid'] = $uid;
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $where['state'] = 1;
+        $data = Dever::db('act/subscribe')->one($where);
+
+        return $data;
+    }
+    
+    # 获取小刊订阅列表
+    public function getList($id, $type = 4)
+    {
+        $key = 'subscribe_' . $type . '_' . $id;
+        //$data = Dever::cache($key);
+        $data = array();
+        if (!$data) {
+            $where['type'] = $type;
+            $where['data_id'] = $id;
+            $where['avatar'] = 'null';
+            $data = Dever::db('act/subscribe')->getAll($where);
+
+            if ($data) {
+                //Dever::cache($key, $data, 900);
+            }
+        }
+        
+
+        /*
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $user = Dever::load('passport/api')->info($v['uid']);
+                $data[$k]['username'] = $user['username'];
+                $data[$k]['avatar'] = $user['avatar'];
+            }
+        }
+        */
+        return $data;
+    }
+
+    # 订阅
+    public function submit($uid, $id, $source = 1, $type = 4)
+    {
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $table = 'act/subscribe';
+        $info = Dever::db($table)->one($where);
+
+        $key = $this->key . $uid . '_' . $id;
+        Dever::cache($key, 1, 864000);
+
+        if (!$info) {
+            $where['source'] = $source;
+            Dever::db($table)->insert($where);
+            return true;
+        }
+
+        return false;
+
+        # 更新订阅数
+        $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_ding' => $total));
+
+        return false;
+    }
+}

+ 47 - 0
act/lib/Watch.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Watch
+{
+    # 获取当前小刊的观看数
+    public function get($id, $type = 3)
+    {
+        $where['type'] = $type;
+        $where['data_id'] = $id;
+        $where['state'] = 1;
+        $info = Dever::db('act/watch')->total($where);
+
+        return $info;
+    }
+
+    # 观看
+    public function submit($uid, $id, $type = 3)
+    {
+        $where['uid'] = $uid;
+        $where['data_id'] = $id;
+        $where['type'] = $type;
+        $info = Dever::db('act/watch')->one($where);
+        if (!$info) {
+            Dever::db('act/watch')->insert($where);
+        }
+
+        if ($type == 3) {
+            # 更新观看数
+            $where = array();
+            $where['data_id'] = $id;
+            $where['type'] = $type;
+            $where['state'] = 1;
+            $total = Dever::db('act/watch')->total($where);
+            $table = Dever::config('base')->type_table[$type];
+            Dever::db($table)->update(array('where_id' => $id, 'num_user' => $total));
+
+            Dever::score($uid, 'submit_watch', '观看直播');
+        }
+        
+
+        return true;
+    }
+}

+ 478 - 0
act/src/Order.php

@@ -0,0 +1,478 @@
+<?php
+# 电子刊购买接口,本接口下所有接口都无需缓存 做好配置:act/order
+namespace Act\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class Order extends Core
+{
+    public function setCache($id, $type)
+    {
+        # 清空缓存,重新生成
+        if ($type == 1) {
+            $key = 'journal_infos_' . $id;
+            $journal = Dever::db('journal/info')->one($id);
+            Dever::cache($key, $journal);
+        } elseif ($type == 2) {
+            $key = 'journal_buys_' . $id;
+            $buy = Dever::db('journal/buy_num')->one($id);
+
+            if (!$buy['name']) {
+                $buy['name'] = '购买' . $buy['num'] . '本';
+            }
+            Dever::cache($key, $buy);
+        } elseif ($type == 3) {
+            $key = 'journal_actives_' . $id;
+            $active = Dever::db('journal/active')->one($id);
+            Dever::cache($key, $active);
+        }
+    }
+
+    # 获取电子刊信息,走缓存,先不走接口
+    public function getActive($journal_id = false)
+    {
+        $journal_id = Dever::input('journal_id', $journal_id, '> 0', '请传入正确的小刊ID');
+
+        $key = 'journal_actives_' . $journal_id;
+
+        $active = Dever::cache($key);
+
+        if (!$active) {
+            $active = Dever::db('journal/active')->one(array('info_id' => $journal_id, 'state' => 1));
+
+            Dever::cache($key, $active);
+        }
+        return $active;
+    }
+
+	# 获取电子刊信息,走缓存,先不走接口
+	public function getJournal($journal_id = false)
+	{
+        $journal_id = Dever::input('journal_id', $journal_id);
+
+        $status = false;
+        if (strstr($journal_id, 'preview_')) {
+            $journal_id = str_replace('preview_', '', $journal_id);
+            $status = true;
+        }
+
+        if (!$journal_id) {
+            Dever::alert('请传入正确的小刊ID');
+        }
+
+        $key = 'journal_infos_' . $journal_id;
+
+        $journal = Dever::cache($key);
+
+        if (!$journal) {
+        	$journal = Dever::db('journal/info')->one($journal_id);
+	        if (!$journal) {
+	            Dever::alert('请传入正确的小刊ID');
+	        }
+
+	        Dever::cache($key, $journal);
+        }
+        return $journal;
+	}
+
+	# 获取购买的信息,走缓存,先不走接口
+	public function getBuy($buy_id = false)
+	{
+        $buy_id = Dever::input('buy_id', $buy_id, '> 0', '请传入正确的支付ID');
+
+        $key = 'journal_buys_' . $buy_id;
+
+        $buy = Dever::cache($key);
+
+        if (!$buy) {
+	        $buy = Dever::db('journal/buy_num')->one($buy_id);
+
+	        if (!$buy) {
+	            Dever::alert('请传入正确的小刊ID');
+	        }
+
+	        if (!$buy['name']) {
+	            $buy['name'] = '购买' . $buy['num'] . '本';
+	        }
+
+	        Dever::cache($key, $buy);
+        }
+        return $buy;
+	}
+
+	# 根据分类获取我已订阅的小刊列表,我的订单列表,此处要修改为我的订单列表 getMyAll待增加
+    public function getMyList()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $cate = Dever::input('system', -1);
+
+        if (!$cate) {
+            Dever::alert('错误的信息');
+        }
+
+        # 我的订单列表
+        $where = array();
+        $where['uid'] = $this->data['uid'];
+        if ($cate > 0) {
+            $where['cate_id'] = $cate;
+        }
+        
+        $where['status'] = 2;
+        $where['type'] = 3;
+
+        $this->data['order'] = Dever::db('act/order')->getMyAll($where);
+
+        if ($this->data['order']) {
+            foreach ($this->data['order'] as $k => $v) {
+                $this->data['order'][$k]['cdate'] = date('Y年m月d日 H:i:s', $v['cdate']);
+                $name = explode('-', $v['name']);
+                $this->data['order'][$k]['name'] = $name[0];
+
+                if (isset($v['buy_num']) && $v['buy_num'] <= 0 && $v['buy_id']) {
+                    $buy = $this->getBuy($v['buy_id']);
+                    $this->data['order'][$k]['buy_num'] = $buy['num']; 
+                }
+
+                if (!$v['order_id']) {
+                    $this->data['order'][$k]['order_id'] = $v['id'];
+                }
+            }
+        }
+
+        return $this->data;
+    }
+
+    # 根据订单id获取我的兑换码列表
+    public function getMyCodeList()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $order_id = Dever::input('order_id');
+
+        if (!$order_id) {
+            Dever::alert('错误的信息');
+        }
+
+        if (strstr($order_id, 'D')) {
+            $temp = explode('D', $order_id);
+            $order_id = $temp[1];
+        }
+
+        # 我的订单列表
+        $order = $this->getOrder($order_id);
+
+        $where = array();
+        $where['create_uid'] = $this->data['uid'];
+        $where['order_id'] = $order['order_id'];
+        $where['type'] = 4;
+
+        Dever::setInput('set_product_id', $order['product_id']);
+
+        $this->data['code'] = Dever::db('code/info')->getMyAll($where);
+
+        if ($this->data['code']) {
+            foreach ($this->data['code'] as $k => $v) {
+                $this->data['code'][$k]['code'] = Dever::load('code/lib/core')->view($v['id'], $v['create_uid']);
+            }
+        }
+
+        return $this->data;
+    }
+
+    # 购买 改成直接购买兑换码
+    public function pay()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $journal = $this->getJournal();
+        $buy = $this->getBuy();
+
+        $user = Dever::db('passport/user')->one($this->data['uid']);
+        $wechat = Dever::db('passport/wechat')->one(array('uid' => $this->data['uid'], 'type' => 1, 'system_id' => $journal['cate_id']));
+
+        $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 ($journal['cate_id'] == 2) {
+                $account_id = 4;
+            } elseif ($journal['cate_id'] == 3) {
+                $account_id = 5;
+            }
+            //$account_id = $cate['pay_id'];
+        }
+
+        //$order_id = $this->createOrder('JP');
+        $order_data['cate_id'] = $journal['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']; 
+        $order_data['type'] = 3;
+        $order_data['status'] = 1;
+
+        $order_data['name'] = $journal['name'] . '-' . $buy['name'];
+        $order_data['buy_num'] = $buy['num'];
+
+        if (isset($buy['price']) && $buy['price'] && $buy['price'] > 0) {
+            $order_data['cash'] = $buy['price'];
+        } else {
+            $order_data['cash'] = $journal['cash'] * $order_data['buy_num'];
+        }
+
+        $source = Dever::input('source');
+        $system = Dever::input('system', 1);
+        if (!$source) {
+            $source = $system;
+        }
+        if ($source) {
+            $order_data['source'] = $source;
+        }
+        $seller = Dever::input('seller');
+        if ($seller) {
+            $order_data['seller_id'] = $seller;
+        }
+
+        $id = Dever::db('act/order_temp')->insert($order_data);
+
+        if (!$id) {
+            Dever::alert('支付失败');
+        }
+
+        $order_id = $this->createOrderId($order_data, $id);
+
+        //$param参数
+        $param = array
+        (
+            'account_id' => $account_id,
+            'project_id' => 3,
+            '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, $journal['cate_id']);
+            } else {
+                Dever::alert('支付失败');
+            }
+        }
+
+        $this->data['order_id'] = $order_id;
+        //$this->data['order_id'] = $id;
+
+        return $this->data;
+    }
+
+    # 开始兑换
+    public function checkCode()
+    {
+        return 'ok';
+    }
+
+    # 开始兑换
+    public function code()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $code = Dever::input('code');
+
+        if ($code) {
+            $code = trim($code);
+            $code = str_replace("\n", '', $code);
+
+            $journal_id = Dever::input('journal_id');
+            if (strstr($journal_id, 'preview_')) {
+                $journal_id = str_replace('preview_', '', $journal_id);
+            }
+
+            if (!$journal_id) {
+                Dever::alert('请传入正确的小刊ID');
+            }
+
+            if (strpos($code, 'M') === 0) {
+                Dever::setInput('set_product_id', $journal_id);
+                $code = substr($code, 1);
+                $code = Dever::uid($code, 'decode');
+                $code = $code / 10000000;
+                $info = Dever::db('code/info')->one($code);
+
+                /*
+                $check = true;
+                $uid = substr($code, 1, 4);
+                $code = substr($code, 1);
+                
+                
+                $info = Dever::db('code/info')->one($code);
+
+                if (!$info) {
+                    $check = false;
+                    $code = str_replace('M', '', $code);
+                    $info = Dever::db('code/info')->one($code);
+                }
+
+                if ($check) {
+                    $uid = Dever::uid($uid, 'decode');
+                    if ($info && $info['create_uid'] != $uid) {
+                        Dever::alert('请正确使用小刊兑换码');
+                    }
+                }
+                */
+                
+            } else {
+                $info = Dever::db('code/info')->one(array('code' => $code));
+            }
+
+            if (!$info) {
+                Dever::alert('兑换码不存在');
+            }
+
+            if ($info['type'] == 3) {
+                Dever::alert('兑换码已被使用');
+            }
+
+            if ($info['state'] != 1) {
+                Dever::alert('兑换码已作废');
+            }
+
+            if ($info['type'] == 4) {
+                Dever::alert('兑换码已作废');
+            }
+
+            /*
+            if ($info['type'] == 2 && $this->data['uid'] != $info['uid']) {
+                //Dever::alert('兑换码已被领取');
+            }
+            */
+
+            if ($info['product_id'] > 0 && $info['product_id'] != $journal_id) {
+                Dever::alert('请正确使用小刊兑换码');
+            }
+
+            if (isset($info['order_id']) && $info['order_id']) {
+                $order_info = $this->getOrder($info['order_id']);
+                if (!$order_info) {
+                    Dever::alert('您要使用的兑换码还未支付');
+                }
+
+                if ($order_info && $order_info['status'] != 2) {
+                    Dever::alert('您要使用的兑换码还未支付');
+                }
+            } else {
+                # 通用兑换码 只加本数
+                if ($info['product_num'] > 0) {
+                    # 增加本数 用通用码的人不多,所以直接跨库查询吧
+                    $journal = Dever::db('journal/info')->one($journal_id);
+                    if ($journal) {
+                        $num = $journal['num_up'] + $info['product_num'];
+                        Dever::db('journal/info')->update(array('where_id' => $journal_id, 'num_up' => $num));
+                    }
+                }
+            }
+
+            Dever::db('code/info')->update(array('where_id' => $info['id'], 'type' => 3, 'uid' => $this->data['uid'], 'ldate' => time()));
+
+            # 订阅
+            Dever::load('act/lib/subscribe')->submit($this->data['uid'], $journal_id, 2);
+
+        } else {
+            Dever::alert('请输入正确的兑换码');
+        }
+
+        return 'ok';
+    }
+
+    public function createOrder($prefix = 'JP')
+    {
+        $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;
+    }
+
+    public function createOrderId($data, $id)
+    {
+        # O 是 支付系统里的project_id的标识符,带有此项标识的均为无需支付系统进行订单记录
+        $order_id = 'JMO3OC' . $data['cate_id'] . 'P' . $data['product_id'] . 'B' . $data['buy_id'] . 'U' . $data['uid'] . 'D' . $id;
+
+        //$order_id = 'JM_' . $id;
+
+        return $order_id;
+    }
+
+    public function getOrderId($id)
+    {
+        if (is_numeric($id)) {
+            $info = Dever::db('act/order')->one($id);
+            if ($info['order_id']) {
+                return $info['order_id'] . '/' . $id;
+            }
+
+            return $this->createOrderId($info, $id) . '/' . $id;
+        }
+        return '';
+    }
+
+    public function getOrderTempId($id)
+    {
+        $info = Dever::db('act/order')->one($id);
+        return $this->createOrderId($info, $id) . '/' . $id;
+    }
+
+    public function getOrder($order_id)
+    {
+        if (!is_numeric($order_id)) {
+            $order = Dever::db('act/order')->one(array('order_id' => $order_id));
+        } else {
+            $order = Dever::db('act/order')->one($order_id);
+            $order['order_id'] = $order['id'];
+        }
+
+        return $order;
+    }
+}

+ 245 - 0
audit/database/data.php

@@ -0,0 +1,245 @@
+<?php
+
+$type = Dever::config('base')->type;
+
+$audit = Dever::config('base')->audit;
+
+$status = Dever::config('base')->status;
+
+$cate = function()
+{
+	$array = array();
+	$info = Dever::db('content/cate')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+$push = array
+(
+	1 => '不推送',
+	2 => '推送到精品网',
+);
+
+return array
+(
+	# 表名
+	'name' => 'data',
+	# 显示给用户看的名称
+	'lang' => '审核管理',
+	# 后台菜单排序
+	'order' => 7,
+	'menu'	=> 'content',
+	'end' => array
+	(
+		'update_audit' => 'audit/lib/core.audit',
+		'update_status' => 'audit/lib/core.status',
+		'update_reorder' => 'audit/lib/core.reorder',
+		'update_push' => 'audit/lib/core.push',
+		'updatemul' => 'audit/lib/core.updatemul',
+	),
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			//'list'		=> true,
+			'order'		=> 'desc',
+		),
+
+		'cate_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '所属栏目',
+			'default' 	=> '1',
+			'desc' 		=> '所属栏目',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $cate,
+			'search'	=> 'select',
+			'list'		=> true,
+		),
+
+		'type'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '类型',
+			'default' 	=> '1',
+			'desc' 		=> '类型',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $type,
+			'search'	=> 'select',
+			'list'		=> true,
+			//'edit'		=> true,
+		),
+
+		'data_id'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '数据ID',
+			'default' 	=> '',
+			'desc' 		=> '数据id',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			//'search'	=> 'fulltext',
+			//'list'		=> true,
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+
+		'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,
+		),
+
+		'push'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '推送设置',
+			'default' 	=> '1',
+			'desc' 		=> '推送设置',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			'option'	=> $push,
+			'search'	=> 'select',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+		
+		'pdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '发布时间',
+			'match' 	=> 'is_numeric',
+			'default'	=> '',
+			'desc' 		=> '',
+			'update'	=> 'date',
+			'callback'	=> 'maketime',
+			'list'		=> 'date("Y-m-d H:i:s", {pdate})',
+		),
+
+		'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',
+			'edit'		=> false,
+		),
+		
+		'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
+	(
+		'delete' => false,
+		'edit' => false,
+		'insert' => false,
+		'mul' => true,
+
+		'list_button' => array
+		(
+			'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?audit=1'))),
+		),
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'cate_id' => 'yes',
+				'type' => 'yes',
+				'type_no' => array('yes-type', '!='),
+				'audit' => 2,
+				'status' => 2,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','pdate' => 'desc'),
+			'page' => array(15, 'list'),
+			'col' => '*',
+		),
+
+		'getIn' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'id' => array('yes', 'in'),
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'col' => '*',
+		),
+	)
+);

+ 8 - 0
audit/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'audit');
+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-tabs');
+include(DEVER_APP_PATH . '../boot.php');

+ 106 - 0
audit/lib/Core.php

@@ -0,0 +1,106 @@
+<?php
+
+namespace Audit\Lib;
+
+use Dever;
+
+class Core
+{
+    public function audit($id, $name, $data)
+    {
+        $audit = Dever::param('audit', $data);
+        if ($audit) {
+            $info = Dever::db('audit/data')->getIn($id);
+            if ($info) {
+                foreach($info as $k => $v) {
+                    $table = Dever::config('base')->type_table[$v['type']];
+
+                    $source = Dever::db($table)->one($v['data_id']);
+
+                    if ($source && $source['audit'] != $audit) {
+                        Dever::config('base')->after = false;
+                        Dever::db($table)->update(array('where_id' => $v['data_id'], 'audit' => $audit));
+                    }
+                }
+            }
+        }
+    }
+
+    public function status($id, $name, $data)
+    {
+        $status = Dever::param('status', $data);
+        if ($status) {
+            $info = Dever::db('audit/data')->getIn($id);
+            if ($info) {
+                foreach ($info as $k => $v) {
+                    $table = Dever::config('base')->type_table[$v['type']];
+
+                    $source = Dever::db($table)->one($v['data_id']);
+
+                    if ($source && $source['status'] != $status) {
+                        Dever::config('base')->after = false;
+                        Dever::db($table)->update(array('where_id' => $v['data_id'], 'status' => $status));
+                    }
+                }
+            }
+        }
+    }
+
+    public function updatemul($id, $name, $data)
+    {
+        //$this->audit($id, $name, $data);
+        //$this->status($id, $name, $data);
+        $this->push($id, $name, $data);
+    }
+
+    public function push($id, $name, $data)
+    {
+        $push = Dever::param('push', $data);
+        if ($push) {
+            $info = Dever::db('audit/data')->getIn($id);
+            if ($info) {
+                foreach ($info as $k => $v) {
+                    if ($v['type'] > 2) {
+                        continue;
+                    }
+                    $table = Dever::config('base')->type_table[$v['type']];
+
+                    $source = Dever::db($table)->one($v['data_id']);
+
+                    if ($source && $push == 2) {
+                        $content = Dever::load('content/lib/article')->getContent($source);
+                        $send['source_id'] = $v['id'];
+                        $send['name'] = $source['name'];
+                        $send['cate_id'] = $source['cate_id'];
+                        $send['pic_cover'] = Dever::pic($source['share_pic']);
+                        $send['pic_index'] = Dever::pic($source['pic_cover_169']);
+                        $send['pdate'] = $source['pdate'];
+                        $send['desc'] = $source['share_title'];
+                        $send['template'] = $v['type'];
+                        if (isset($source['video'])) {
+                            $send['video'] = $source['video'];
+                        }
+                        
+                        $send['content'] = Dever::json_encode($content['content_array']);
+
+                        $data = Dever::load('jingpin/lib/article.up', $send);
+                    }
+                }
+            }
+        }
+    }
+
+    public function reorder($id, $name, $data)
+    {
+        $reorder = Dever::param('reorder', $data);
+        $info = Dever::db('audit/data')->one($id);
+        $table = Dever::config('base')->type_table[$info['type']];
+
+        $source = Dever::db($table)->one($info['data_id']);
+
+        if ($source && $source['reorder'] != $reorder) {
+            Dever::config('base')->after = false;
+            Dever::db($table)->update(array('where_id' => $info['data_id'], 'reorder' => $reorder));
+        }
+    }
+}

+ 8 - 0
boot.php

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

+ 20 - 0
buy/assets/mobile/auth.html

@@ -0,0 +1,20 @@
+<!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>JSTYLE精美</title>
+    <style>
+
+    </style>
+<link href="css/global.css?v=3f8cf811" rel="stylesheet"><link href="css/auth.css?v=3f8cf811" rel="stylesheet"></head>
+
+<body>
+    <img class="logo" src="http://www.huoxingkandiqiu.com/files/img/ico-auth.png" alt="">
+    <div class='txt'><span>授权后才可以使用精美时尚服务<br>感谢您的支持</span></div>
+    <a href="#" class='button'>授权登录</a>
+<script type="text/javascript" src="js/global.js?v=3f8cf811"></script><script type="text/javascript" src="js/auth.js?v=3f8cf811"></script></body>
+
+</html>

+ 114 - 0
buy/assets/mobile/codedetail.html

@@ -0,0 +1,114 @@
+<!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>JSTYLE精美</title>
+<link href="css/global.css?v=3f8cf811" rel="stylesheet"><link href="css/codedetail.css?v=3f8cf811" rel="stylesheet"></head>
+
+<body>
+    <div class="tips">
+        <p>温馨提示:</p>
+        <p>兑换码只能被激活一次,当您购买成功后,可进入小程序使用兑换码查看电子刊,若您购买了多本,可将剩余兑换码赠送好友。</p>
+    </div>
+    <div class="btn-wrap">
+        <a href="javascript:;" node-act="read" class="button black">阅读电子刊</a>
+    </div>
+    <div class="code-list pages">
+        <dl>
+            <dd>
+                <p><i class="ico-code"></i>兑换码:675386834</p>
+                <span class="used">已使用</span>
+            </dd>
+            <dt>
+                <a href="javascript:;" class="button disabled">复制</a>
+            </dt>
+        </dl>
+        <dl>
+            <dd>
+                <p><i class="ico-code"></i>兑换码:675386834</p>
+                <span>未使用</span>
+            </dd>
+            <dt>
+                <a href="javascript:;" class="button" node-id="copy" data-clipboard-text="675386834">复制</a>
+            </dt>
+        </dl>
+        <dl>
+            <dd>
+                <p><i class="ico-code"></i>兑换码:675386834</p>
+                <span class="used">已使用</span>
+            </dd>
+            <dt>
+                <a href="javascript:;" class="button disabled">复制</a>
+            </dt>
+        </dl>
+        <dl>
+            <dd>
+                <p><i class="ico-code"></i>兑换码:675386834</p>
+                <span>未使用</span>
+            </dd>
+            <dt>
+                <a href="javascript:;" class="button" node-id="copy" data-clipboard-text="675386833">复制</a>
+            </dt>
+        </dl>
+        <dl>
+            <dd>
+                <p><i class="ico-code"></i>兑换码:675386834</p>
+                <span class="used">已使用</span>
+            </dd>
+            <dt>
+                <a href="javascript:;" class="button disabled">复制</a>
+            </dt>
+        </dl>
+        <dl>
+            <dd>
+                <p><i class="ico-code"></i>兑换码:675386834</p>
+                <span>未使用</span>
+            </dd>
+            <dt>
+                <a href="javascript:;" class="button" node-id="copy" data-clipboard-text="675386832">复制</a>
+            </dt>
+        </dl>
+    </div>
+    <div class="success fn-hide" id="success">复制成功</div>
+    <div class="mask fn-hide" id="layer">
+        <div class="layer read-layer">
+            <div class="qrcode-wrap">
+                <img src="images/qrcode.png" alt="" class="default" id="code">
+                <p>长按识别小程序阅读电子刊</p>
+            </div>
+            <a href="javascript:;" class="btn-close" id="close"></a>
+        </div>
+    </div>
+<script type="text/javascript" src="js/global.js?v=3f8cf811"></script><script type="text/javascript" src="js/codedetail.js?v=3f8cf811"></script></body>
+<script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js"></script>
+<script>
+    function init(){
+        var timer;
+        var clipboard = new ClipboardJS('[node-id="copy"]');
+
+        clipboard.on('success', function (e) {
+            $('#success').removeClass('fn-hide');
+            clearTimeout(timer);
+            timer = setTimeout(function () {
+                $('#success').addClass('fn-hide');
+            }, 3000)
+
+            console.log(e.trigger)
+
+            e.clearSelection();
+        });
+
+        $('[node-act="read"]').on('click',function(){
+            $('#layer').show();
+        })
+
+        $('#close').on('click',function(){
+            $('#layer').hide();
+        });
+    }
+    init();
+</script>
+</html>

+ 2 - 0
buy/assets/mobile/css/auth.css

@@ -0,0 +1,2 @@
+.logo{margin:3.13333rem auto .6rem;width:2.66667rem;height:2.66667rem;display:block}.txt{margin-bottom:.73333rem;color:#000;line-height:1.6;text-align:center}.button,.txt{font-size:.4rem}.button{margin:0 auto;background:#cc1619;width:7.06667rem;height:1.06667rem;line-height:1.06667rem;color:#fff}
+/*# sourceMappingURL=auth.css.map?v=4b099281*/

+ 1 - 0
buy/assets/mobile/css/auth.css.map

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

+ 2 - 0
buy/assets/mobile/css/codedetail.css

@@ -0,0 +1,2 @@
+.tips{width:8.66667rem;margin:.58667rem auto .26667rem;line-height:.53333rem}.button,.tips{font-size:.32rem}.button{margin:0;width:2.4rem;line-height:.86667rem;height:.86667rem}.button.black{background-color:#000}.button.disabled{background-color:#ccc}.btn-wrap{width:8.66667rem;margin:0 auto .54667rem}.code-list{border-top:1px solid #ccc;width:8.66667rem;margin:0 auto}.code-list dl{-ms-flex-pack:justify;justify-content:space-between;padding:.53333rem 0;border-bottom:1px solid #ccc}.code-list dl,.code-list dl dd p{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.code-list dl dd p{font-size:.37333rem;line-height:.56rem;margin-bottom:.2rem}.code-list dl dd p .ico-code{display:block;width:.45333rem;height:.4rem;background:url(../images/ico-code.png) no-repeat;background-size:.45333rem .4rem;margin-right:.13333rem}.code-list dl dd p b{font-weight:400}.code-list dl dd span{font-size:.32rem}.code-list dl dd span.used{color:#d1171a}.success{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,.75);border-radius:.2rem;width:6.6667rem;height:1.0667rem;line-height:1.0667rem;font-size:.4rem;text-align:center;color:#fff}
+/*# sourceMappingURL=codedetail.css.map?v=4b099281*/

+ 1 - 0
buy/assets/mobile/css/codedetail.css.map

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

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
buy/assets/mobile/css/global.css


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

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

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
buy/assets/mobile/css/list.css


+ 1 - 0
buy/assets/mobile/css/list.css.map

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

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
buy/assets/mobile/css/pay.css


+ 1 - 0
buy/assets/mobile/css/pay.css.map

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

BIN
buy/assets/mobile/images/ico-close.png


BIN
buy/assets/mobile/images/ico-code.png


BIN
buy/assets/mobile/images/ico-selected.png


BIN
buy/assets/mobile/images/ico-unselected.png


BIN
buy/assets/mobile/images/list.png


BIN
buy/assets/mobile/images/logo.jpg


BIN
buy/assets/mobile/images/mag.png


BIN
buy/assets/mobile/images/qrcode.png


+ 20 - 0
buy/assets/mobile/index.html

@@ -0,0 +1,20 @@
+<!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>JSTYLE精美</title>
+    <style>
+
+    </style>
+<link href="css/global.css?v=3f8cf811" rel="stylesheet"><link href="css/auth.css?v=3f8cf811" rel="stylesheet"></head>
+
+<body>
+    <img class="logo" src="http://www.huoxingkandiqiu.com/files/img/ico-auth.png" alt="">
+    <div class='txt'><span>授权后才可以使用精美时尚服务<br>感谢您的支持</span></div>
+    <a href="#" class='button'>授权登录</a>
+<script type="text/javascript" src="js/global.js?v=3f8cf811"></script><script type="text/javascript" src="js/auth.js?v=3f8cf811"></script></body>
+
+</html>

+ 2 - 0
buy/assets/mobile/js/auth.js

@@ -0,0 +1,2 @@
+webpackJsonp([3],{1:function(n,t,c){"use strict";c(0),c(7)},12:function(n,t,c){n.exports=c(1)},7:function(n,t){}},[12]);
+//# sourceMappingURL=auth.js.map?v=4b099281

+ 1 - 0
buy/assets/mobile/js/auth.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/auth.js","webpack:///./mobile/src/router/auth.js"],"names":["webpackJsonp","1","module","exports","__webpack_require__","12","7"],"mappings":"AAAAA,cAAc,IAERC,EACA,SAAUC,EAAQC,EAASC,GAEjC,YCLAA,GAAA,GACAA,EAAA,IDaMC,GACA,SAAUH,EAAQC,EAASC,GAEjCF,EAAOC,QAAUC,EAAoB,IAK/BE,EACA,SAAUJ,EAAQC,OAMrB","file":"js/auth.js?v=4b099281","sourcesContent":["webpackJsonp([3],{\n\n/***/ 1:\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/***/ 12:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(1);\n\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n},[12]);\n\n\n// WEBPACK FOOTER //\n// js/auth.js?v=4b099281","import './global';\r\nimport '../css/auth.css';\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/auth.js"],"sourceRoot":""}

+ 2 - 0
buy/assets/mobile/js/codedetail.js

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

+ 1 - 0
buy/assets/mobile/js/codedetail.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/codedetail.js","webpack:///./mobile/src/router/codedetail.js"],"names":["webpackJsonp","13","module","exports","__webpack_require__","2","9"],"mappings":"AAAAA,cAAc,IAERC,GACA,SAAUC,EAAQC,EAASC,GAEjCF,EAAOC,QAAUC,EAAoB,IAK/BC,EACA,SAAUH,EAAQC,EAASC,GAEjC,YCbAA,GAAA,GAEAA,EAAA,IDoBME,EACA,SAAUJ,EAAQC,OAMrB","file":"js/codedetail.js?v=4b099281","sourcesContent":["webpackJsonp([2],{\n\n/***/ 13:\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__(9);\n\n/***/ }),\n\n/***/ 9:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n},[13]);\n\n\n// WEBPACK FOOTER //\n// js/codedetail.js?v=4b099281","import './global';\r\n// import '../js/clipboard.js';\r\nimport '../css/codedetail.css';\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/codedetail.js"],"sourceRoot":""}

+ 3 - 0
buy/assets/mobile/js/config.js

@@ -0,0 +1,3 @@
+//定义瀑布流
+Dever.Page().name = '#page';
+//Dever.Page().loading = '.loadding';

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
buy/assets/mobile/js/global.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
buy/assets/mobile/js/global.js.map


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

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

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

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js","webpack:///./mobile/src/router/index.js"],"names":["webpackJsonp","11","module","exports","17","__webpack_require__","3"],"mappings":"AAAAA,cAAc,IAERC,GACA,SAAUC,EAAQC,KAMlBC,GACA,SAAUF,EAAQC,EAASE,GAEjCH,EAAOC,QAAUE,EAAoB,IAK/BC,EACA,SAAUJ,EAAQC,EAASE,GAEjC,YCpBAA,GAAA,GACAA,EAAA,OD4BG","file":"js/index.js?v=d6fd028b","sourcesContent":["webpackJsonp([2],{\n\n/***/ 11:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 17:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(3);\n\n\n/***/ }),\n\n/***/ 3:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n__webpack_require__(0);\n\n__webpack_require__(11);\n\n/***/ })\n\n},[17]);\n\n\n// WEBPACK FOOTER //\n// js?v=d6fd028b","import './global';\nimport '../css/index.css';\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/index.js"],"sourceRoot":""}

+ 2 - 0
buy/assets/mobile/js/list.js

@@ -0,0 +1,2 @@
+webpackJsonp([1],{10:function(n,t){},15:function(n,t,c){n.exports=c(3)},3:function(n,t,c){"use strict";c(0),c(10)}},[15]);
+//# sourceMappingURL=list.js.map?v=4b099281

+ 1 - 0
buy/assets/mobile/js/list.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/list.js","webpack:///./mobile/src/router/list.js"],"names":["webpackJsonp","10","module","exports","15","__webpack_require__","3"],"mappings":"AAAAA,cAAc,IAERC,GACA,SAAUC,EAAQC,KAMlBC,GACA,SAAUF,EAAQC,EAASE,GAEjCH,EAAOC,QAAUE,EAAoB,IAK/BC,EACA,SAAUJ,EAAQC,EAASE,GAEjC,YCpBAA,GAAA,GACAA,EAAA,OD4BG","file":"js/list.js?v=4b099281","sourcesContent":["webpackJsonp([1],{\n\n/***/ 10:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 15:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(3);\n\n\n/***/ }),\n\n/***/ 3:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n__webpack_require__(0);\n\n__webpack_require__(10);\n\n/***/ })\n\n},[15]);\n\n\n// WEBPACK FOOTER //\n// js/list.js?v=4b099281","import './global';\nimport '../css/list.css';\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/list.js"],"sourceRoot":""}

+ 2 - 0
buy/assets/mobile/js/pay.js

@@ -0,0 +1,2 @@
+webpackJsonp([0],{11:function(n,t){},16:function(n,t,c){n.exports=c(4)},4:function(n,t,c){"use strict";c(0),c(11)}},[16]);
+//# sourceMappingURL=pay.js.map?v=4b099281

+ 1 - 0
buy/assets/mobile/js/pay.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/pay.js","webpack:///./mobile/src/router/pay.js"],"names":["webpackJsonp","11","module","exports","16","__webpack_require__","4"],"mappings":"AAAAA,cAAc,IAERC,GACA,SAAUC,EAAQC,KAMlBC,GACA,SAAUF,EAAQC,EAASE,GAEjCH,EAAOC,QAAUE,EAAoB,IAK/BC,EACA,SAAUJ,EAAQC,EAASE,GAEjC,YCpBAA,GAAA,GACAA,EAAA,OD4BG","file":"js/pay.js?v=4b099281","sourcesContent":["webpackJsonp([0],{\n\n/***/ 11:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 16:\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(4);\n\n\n/***/ }),\n\n/***/ 4:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n__webpack_require__(0);\n\n__webpack_require__(11);\n\n/***/ })\n\n},[16]);\n\n\n// WEBPACK FOOTER //\n// js/pay.js?v=4b099281","import './global';\nimport '../css/pay.css';\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/pay.js"],"sourceRoot":""}

+ 88 - 0
buy/assets/mobile/list.html

@@ -0,0 +1,88 @@
+<!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=3f8cf811" rel="stylesheet"><link href="css/list.css?v=3f8cf811" rel="stylesheet"></head>
+
+<body>
+    <div class="logo"><img src="images/logo.jpg" />精品购物指南</div>
+    <div class="info-txt">这里加一行简介</div>
+    <div class="tab" node-id="tab">
+        <a class="li active"><span>预购杂志</span></a>
+        <a class="li"><span>兑换码</span></a>
+    </div>
+    <div class="list pages" node-id="list">
+        <div class="item">
+            <img src="images/mag.png" class="default" />
+            <div class="info">
+                <h2>段宜恩电子刊段宜恩电子刊段宜恩电子刊</h2>
+            </div>
+            <div class="ctrls-cont">
+                <p class="clearfix">
+                    <span class="price">免费</span>
+                </p>
+                <button class="button" node-act="read" data-src="images/qrcode.png">阅读</button>
+            </div>
+        </div>
+        <div class="item">
+            <img src="images/mag.png" class="default" />
+            <div class="info">
+                <h2>Yamy魔幻星际女战士的异度空间</h2>
+            </div>
+            <div class="ctrls-cont">
+                 <p class="clearfix">
+                    <span class="price">¥6.00</span>
+                </p>
+                <button class="button">订阅</button>
+            </div>
+        </div>
+    </div>
+
+    <div class="mask fn-hide" id="layer">
+        <div class="layer read-layer">
+            <div class="qrcode-wrap">
+                <img src="images/qrcode.png" alt="" class="default" id="code">
+                <p>长按识别小程序阅读电子刊</p>
+            </div>
+            <a href="javascript:;" class="btn-close" id="close"></a>
+        </div>
+    </div>
+
+<script type="text/javascript" src="js/global.js?v=3f8cf811"></script><script type="text/javascript" src="js/list.js?v=3f8cf811"></script></body>
+<script>
+
+    function init(){
+        /*
+        var tabIndex = 0;
+        $('[node-id="tab"]').on('click','.li',function(){
+            tabIndex = $(this).index();
+            $(this).addClass('active').siblings('.li').removeClass('active');
+            $('[node-id="list"]').hide().eq(tabIndex).show();
+        });
+*/
+
+        $('[node-act="read"]').on('click',function(){
+            $('#code').attr('src',$(this).data('src'));
+            $('#layer').show();
+        })
+
+        $('[node-act="pay"]').on('click',function(){
+            pay($(this).data('src'));
+        })
+
+        $('#close').on('click',function(){
+            $('#layer').hide();
+        });
+
+    }
+    
+    init();
+    function pay(url)
+    {
+        location.href = url;
+    }
+</script>
+</html>

+ 41 - 0
buy/assets/mobile/my_code.html

@@ -0,0 +1,41 @@
+<!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=3f8cf811" rel="stylesheet"><link href="css/list.css?v=3f8cf811" rel="stylesheet"></head>
+
+<body>
+    <div class="logo"><img src="images/logo.jpg" />精品购物指南</div>
+    <div class="info-txt">这里加一行简介</div>
+    <div class="tab" node-id="tab">
+        <a class="li "><span>预购杂志</span></a>
+        <a class="li active"><span>兑换码</span></a>
+    </div>
+
+    <div class="list pages" node-id="list">
+        <div class="item2 clearfix">
+            <div class="order-info">
+                <p>2019年4月30日  15:20</p>
+                <a href="#">查看>></a>
+            </div>
+            <div class="mag-info">
+                <p>《段宜恩电子刊段宜恩电子刊段宜恩电子刊》</p>
+                <span>100本  ¥798.00</span>
+            </div>
+        </div>
+        <div class="item2 clearfix">
+            <div class="order-info">
+                <p>2019年4月30日  15:20</p>
+                <a href="#">查看>></a>
+            </div>
+            <div class="mag-info">
+                <p>《段宜恩电子刊段宜恩电子刊段宜恩电子刊》</p>
+                <span>100本  ¥798.00</span>
+            </div>
+        </div>
+    </div>
+
+<script type="text/javascript" src="js/global.js?v=3f8cf811"></script><script type="text/javascript" src="js/list.js?v=3f8cf811"></script></body>

+ 95 - 0
buy/assets/mobile/pay.html

@@ -0,0 +1,95 @@
+<!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=3f8cf811" rel="stylesheet"><link href="css/pay.css?v=3f8cf811" rel="stylesheet"></head>
+
+<body>
+    <div class="container">
+        <div>
+            <div class="h1">正在购买《xxxx》</div>
+            <div class='buytip' id="open">
+                <p>查看购买说明</p>
+            </div>
+            <div class="list">
+                <a class="item active" bind-id="item" href="#">
+                    <p>购买10本</p>
+                    <p>¥6</p>
+                </a>
+                <a class="item" bind-id="item" href="#">
+                    <p>购买10本</p>
+                    <p>¥6</p>
+                </a>
+                <a class="item" bind-id="item" href="#">
+                    <p>购买10本</p>
+                    <p>¥6</p>
+                </a>
+            </div>
+        </div>
+        <div class='fix-footer'>
+            <a href="javascript:history.go(-1)" class='back-btn'>返回</a>
+            <a href="javascript:;" id="dopay" class="fix-button">确认购买</a>
+        </div>
+    </div>
+    <div class="mask fn-hide" id="layer">
+        <div class="layer ">
+            <h3 class="title">购买说明</h3>
+            <div class="richtext">asdfsdf</div>
+            <div class="btn-wrapper">
+                <div class="button opposite" node-act="close">我知道了</div>
+            </div>
+        </div>
+    </div>
+
+    <div class="mask fn-hide" id="pay-layer">
+        <div class="layer buy-result">
+            <h3 class="title">购买提示</h3>
+            <div class="res" id="buyyes">您已成功购买1000本电子刊</div>
+            <div class="btn-wrapper">
+                <a href="codedetail.html" class="button" id="viewcode">查看兑换码</a>
+                <div class="button" node-act="close">继续购买</div>
+            </div>
+        </div>
+    </div>
+    <div id="pay"></div>
+<script type="text/javascript" src="js/global.js?v=3f8cf811"></script><script type="text/javascript" src="js/pay.js?v=3f8cf811"></script></body>
+<script>
+    
+    var payStatus = false;
+    $(document).on('click', '[bind-id="item"]', function(){
+        $(this).addClass('active').siblings('.item').removeClass('active');
+        //$('#pay-layer').show();
+    });
+
+    $('#dopay').on('click',function(){
+        if (payStatus == false) {
+            $(this).html('支付中...');
+            var url = $('.active').attr('data-pay');
+            payStatus = true;
+            pay(url);
+        }
+    });
+
+    $('#open').on('click',function(){
+        $('#layer').show();
+    });
+
+    $('[node-act="close"]').on('click',function(){
+        $(this).closest('.mask').hide();
+    });
+
+    function pay(url)
+    {
+        $.get(url, function(t) {
+            $("#pay").html(t);
+            payStatus = false;
+            $('#dopay').html('确认购买');
+        })
+    }
+
+</script>
+</html>

+ 11 - 0
buy/index.php

@@ -0,0 +1,11 @@
+<?php
+
+# 取代service
+# 启动session,用以记录用户信息
+define('DEVER_SESSION', 1);
+define('DEVER_APP_NAME', 'buy');
+define('DEVER_APP_LANG', '公众号支付');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 1);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-dollar');
+include(DEVER_APP_PATH . '../boot.php');

+ 128 - 0
buy/src/Base.php

@@ -0,0 +1,128 @@
+<?php namespace Buy\Src;
+
+use Dever;
+
+class Base
+{
+    public $key = 'jmbuybuybuyv1';
+
+	public function __construct()
+    {
+        $p = Dever::input('p');
+        if ($p) {
+            $this->config = Dever::json_decode(Dever::decode($p, $this->key));
+        }
+        # 第三方账户
+        $this->account = $this->getConfig('account', 1);
+        # 小刊分类
+        $this->cate = $this->getConfig('cate', 1);
+        # 渠道
+        $this->source = $this->getConfig('source', 1);
+        # 销售商
+        $this->seller = $this->getConfig('seller', 1);
+
+        $this->signature = Dever::input('signature');
+        $this->source_type = Dever::input('source_type');
+
+        $this->user = Dever::load('passport/user')->data();
+        # 用户信息
+        if (!$this->user && $this->signature) {
+            $uid = Dever::load('passport/applet')->check();
+            $this->user = Dever::db('passport/user')->one($uid);
+        } elseif ($this->source_type) {
+            $this->user = array();
+            $this->user['id'] = -1;
+            $this->user['username'] = '未登录用户';
+            $this->user['mobile'] = '';
+        }
+    }
+
+    # 创建url
+    public function createUrl()
+    {
+        # 第三方账户
+        $this->account = Dever::input('account', 1);
+        # 分类
+        $this->cate = Dever::input('cate', 1);
+        # 渠道
+        $this->source = Dever::input('source', 1);
+        # 销售商
+        $this->seller = Dever::input('seller', 1);
+        
+        $url = $this->url('home');
+
+        return $url;
+    }
+
+    private function getConfig($key, $value)
+    {
+        if (isset($this->config[$key]) && $this->config[$key]) {
+            return $this->config[$key];
+        }
+        $value = Dever::input($key, $value);
+        return $value;
+    }
+
+    # 获取基本配置
+    public function config()
+    {
+        $key = 'buy_config_' . $this->cate . '_' . $this->account . '_' . $this->source;
+
+        $cate = Dever::cache($key);
+
+        if (!$cate) {
+            $cate = Dever::db('journal/cate')->one($this->cate);
+
+            $cate['login_title'] = '<span>授权后才可以使用' . $cate['name'] . '服务<br>感谢您的支持</span>';
+
+            $cate['bglogo'] = 'background-image:url('.$cate['logo'].');';
+
+            $cate['logotxt'] = '<img src="'.$cate['logo'].'" />' . $cate['name'];
+
+            $url = urlencode($this->url('list'));
+            $cate['login'] = 'location.href=\'' . Dever::url('request.auth?account='.$this->account.'&source='.$this->source.'&refer=' . $url, 'oauth') . '\'';
+
+            $info = Dever::db('journal/info')->getOne($cate['journal_id']);
+
+            if ($info && $info['pic_gd']) {
+                $cate['cover'] = $info['pic_gd'];
+            }
+
+            $cate['list_link'] = $this->url('list');
+            $cate['my_link'] = $this->url('my_code');
+
+            Dever::cache($key, $cate);
+        }
+        
+        return $cate;
+    }
+
+    # 生成url
+    protected function url($uri, $param = array(), $project = 'buy')
+    {
+    	$send['cate'] = $this->cate;
+    	$send['source'] = $this->source;
+        $send['seller'] = $this->seller;
+        $param['p'] = Dever::encode(Dever::json_encode($send), $this->key);
+        if ($this->signature) {
+            $param['signature'] = $this->signature;
+        }
+        if ($this->source_type) {
+            $param['source_type'] = $this->source_type;
+        }
+    	$param = http_build_query($param);
+    	$url = Dever::url($uri . '?' . $param, $project);
+
+    	return $url;
+    }
+
+    protected function location($uri, $param = array(), $project = 'buy')
+    {
+    	return Dever::location($this->url($uri, $param, $project));
+    }
+
+    protected function createOrder($prefix = 'JP')
+    {
+        return Dever::load('act/order')->createOrder($prefix);
+    }
+}

+ 368 - 0
buy/src/Buy.php

@@ -0,0 +1,368 @@
+<?php namespace Buy\Src;
+
+use Dever;
+
+# 必须登录才能购买小刊
+class Buy extends Base
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+    
+    # 列表页
+    public function lists()
+    {
+        # 记录列表页渠道pv、uv数
+        /*
+        if (Dever::project('source')) {
+            Dever::load('source/lib/core')->save($this->user['id'], 'list', $this->source);
+        }
+        */
+        $where['cate_id'] = $this->cate;
+        //$where['buy'] = 1;
+        $data = Dever::db('journal/info')->getAllByPage($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                if ($v['buy'] == 1 && $v['cash'] > 0) {
+                    $data[$k]['price'] = '¥' . number_format($v['cash'], 2);
+                } else {
+                    $data[$k]['price'] = '免费';
+                }
+
+                //$data[$k]['ding'] = '销量:' . $v['num_ding'];
+
+                $data[$k]['pic_gd'] .= '?imageView2/2/w/375';
+
+                if ($v['buy'] == 1) {
+                    $data[$k]['button'] = '订阅';
+                    $data[$k]['act'] = 'pay';
+                    $data[$k]['code'] = $this->url('pay', array('id' => $v['id']));
+                } else {
+                    $data[$k]['act'] = 'read';
+                    # 小刊阅读码
+                    $data[$k]['code'] = $this->create_code($v['id']);
+                    $data[$k]['button'] = '阅读';
+                }
+            }
+        }
+
+        return $data;
+    }
+
+    # 列表页 我已购买的兑换码
+    public function lists_code()
+    {
+        $where['cate_id'] = $this->cate;
+        $where['uid'] = $this->user['id'];
+        $where['status'] = 2;
+        $where['type'] = 3;
+        $data = Dever::db('act/order')->getMyAll($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['cdate'] = date('Y年m月d日 H:i', $v['cdate']);
+                if (!$v['order_id']) {
+                    $v['order_id'] = $v['id'];
+                }
+                $data[$k]['link'] = $this->url('codedetail', array('order_id' => $v['order_id'], 'id' => $v['product_id']));
+                if (isset($v['buy_num']) && $v['buy_num'] <= 0 && $v['buy_id']) {
+                    $buy = Dever::load('act/order')->getBuy($v['buy_id']);
+                    $data[$k]['buy_num'] = $v['buy_num'] = $buy['num']; 
+                }
+                $data[$k]['desc'] = $v['buy_num'] . '本 ¥' . number_format($v['cash'], 2);
+                $name = explode('-', $v['name']);
+                $data[$k]['name'] = $name[0];
+            }
+        }
+
+        return $data;
+    }
+
+    # 列表页 我已购买的兑换码
+    public function code_detail()
+    {
+        $where['cate_id'] = $this->cate;
+        $where['create_uid'] = $this->user['id'];
+        $where['order_id'] = Dever::input('order_id');
+        if (!$where['order_id']) {
+            Dever::alert('错误的订单');
+        }
+        $where['type'] = 4;
+        $order = Dever::load('act/order')->getOrder($where['order_id']);
+        Dever::setInput('set_product_id', $order['product_id']);
+        $where['order_id'] = $order['order_id'];
+        $data = Dever::db('code/info')->getAll($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $code = Dever::load('code/lib/core')->view($v['id'], $v['create_uid']);
+                $data[$k]['code'] = '<i class="ico-code"></i>兑换码:'.$code;
+                if ($v['type'] == 1) {
+                    $data[$k]['txt'] = '未使用';
+                    $data[$k]['class'] = '';
+                    $data[$k]['copy'] = '<a href="javascript:;" class="button" node-id="copy" data-clipboard-text="'.$code.'">复制</a>';
+                } else {
+                    $data[$k]['txt'] = '已使用';
+                    $data[$k]['class'] = 'used';
+                    $data[$k]['copy'] = '<a href="javascript:;" class="button disabled">复制</a>';
+                }
+            }
+        }
+
+        return $data;
+    }
+
+    # 详细信息
+    public function info()
+    {
+        $id = Dever::input('id');
+
+        # 记录购买页渠道pv、uv数
+        if (Dever::project('source')) {
+            Dever::load('source/lib/core')->save($this->user['id'], 'buy', $this->source, array('journal_id' => $id));
+        }
+
+        $info = Dever::db('journal/info')->one($id);
+
+        $info['buy'] = '正在购买《' . $info['name'] . '》';
+
+        $buy = Dever::db('journal/buy')->one(array('id' => $id));
+
+        $info['buy_desc'] = '';
+        $info['buy_notice'] = '一次购买多本将生成一个兑换码用于兑换,如需多个兑换码,请多次购买。';
+        $info['buy_notices'] = '购买兑换码赠送好友:点击下方购买后,将生成多个兑换码。
+积分规则:使用兑换码兑换后,使用人获得积分,购买人不增加积分。';
+        if ($buy) {
+            $info['buy_desc'] = $buy['buy_content'];
+            if ($buy['buy_notice']) {
+                $info['buy_notice'] = $buy['buy_notice'];
+            }
+            if ($buy['buy_notices']) {
+                $info['buy_notices'] = $buy['buy_notices'];
+            }
+        }
+
+        $info['buy_notices'] = str_replace("\n", '<br />', $info['buy_notices']);
+
+        
+        $buy_num = Dever::input('buy_num');
+        if ($buy_num > 0) {
+            $info += $this->success();
+        } else {
+            $info['buy_class'] = 'mask fn-hide';
+            $info['buy_code'] = '';
+            $info['buy_yes'] = '';
+        }
+        
+        return $info;
+    }
+
+    # 生成二维码
+    public function code()
+    {
+        $id = Dever::input('id');
+
+        return $this->create_code($id);
+    }
+
+    private function create_code($id)
+    {
+        $type = 4;
+        $uid = $this->user['id'];
+        
+        $scene = $uid . ',' . $type . ',' . $id;
+
+        $path = Dever::config('base')->applet_index;
+        $send['project'] = Dever::input('project', $this->cate);
+        $send['send'] = $scene;
+        $send['width'] = 152;
+        $send['path'] = $path; 
+        $code = Dever::load('wechat_applet/code.get', $send);
+
+        return $code;
+    }
+
+    # 小刊购买成功
+    public function success()
+    {
+        $id = Dever::input('id');
+        $buy_id = Dever::input('buy');
+        
+        $order_id = Dever::input('order_id');
+        $create = Dever::input('create');
+        if ($order_id && $create == 1) {
+            $order = Dever::load('act/order')->getOrder($order_id);
+
+            if ($order['uid'] != $this->user['id']) {
+                $this->location('list');
+            }
+
+            $uid = $this->user['id'];
+
+            $code = Dever::load('code/lib/core')->createCodeByOrder($order, -1);
+            if ($code) {
+                $update['where_id'] = $order['id'];
+                $update['code'] = $code;
+                Dever::db('act/order')->update($update);
+            }
+        }
+
+        $result['buy_code'] = $this->url('codedetail', array('order_id' => $order_id, 'id' => $id));
+        $result['buy_yes'] = '您已成功购买' . Dever::input('buy_num') . '本电子刊';
+        $result['buy_class'] = 'mask';
+        return $result;
+    }
+
+    # 小刊购买 一个兑换码的
+    public function buy()
+    {
+        $id = Dever::input('id');
+        $data = Dever::db('journal/buy_num')->getAllCode(array('info_id' => $id));
+        $info = Dever::db('journal/info')->one($id);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                if ($v['price'] > 0) {
+                    $data[$k]['price'] = '¥' . number_format($v['price'], 2);
+                } elseif ($info['cash'] > 0) {
+                    $data[$k]['price'] = '¥' . number_format($info['cash'] * $v['num'], 2);
+                } else {
+                    $data[$k]['price'] = '免费';
+                }
+
+                if (!$v['name']) {
+                    $data[$k]['name'] = '购买' . $v['num'] . '本';
+                }
+                $data[$k]['cate'] = $info['cate_id'];
+
+                $data[$k]['pay_url'] = $this->url('buy.pay', array('buy_id' => $v['id'], 'journal_id' => $v['info_id']));
+            }
+        }
+        return $data;
+    }
+
+    # 小刊购买 多个兑换码的
+    public function buys()
+    {
+        $id = Dever::input('id');
+        $data = Dever::db('journal/buy_num')->getAllCodes(array('info_id' => $id));
+        $info = Dever::db('journal/info')->one($id);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['class'] = 'item';
+                if ($k == 0) {
+                    $data[$k]['class'] .= ' active';
+                }
+                if ($v['price'] > 0) {
+                    $data[$k]['price'] = '¥' . number_format($v['price'], 2);
+                } elseif ($info['cash'] > 0) {
+                    $data[$k]['price'] = '¥' . number_format($info['cash'] * $v['num'], 2);
+                } else {
+                    $data[$k]['price'] = '免费';
+                }
+
+                if (!$v['name']) {
+                    $data[$k]['name'] = '购买' . $v['num'] . '本';
+                }
+                $data[$k]['cate'] = $info['cate_id'];
+
+                $data[$k]['pay_url'] = $this->url('buy.pay', array('buy_id' => $v['id'], 'journal_id' => $v['info_id']));
+            }
+        }
+        return $data;
+    }
+
+    # 小刊购买
+    public function pay()
+    {
+        if (!$this->user) {
+            //return $this->location('home');
+        }
+        $uid = $this->user['id'];
+
+        $buy_id = Dever::input('buy_id');
+        $journal_id = Dever::input('journal_id');
+
+        if (!$buy_id) {
+            Dever::alert('请传入正确的支付ID');
+        }
+        if (!$journal_id) {
+            Dever::alert('请传入正确的小刊ID');
+        }
+
+        $info = Dever::load('act/order')->getJournal($journal_id);
+        $buy = Dever::load('act/order')->getBuy($buy_id);
+
+        if (!$buy || !$info) {
+            Dever::alert('请传入正确的小刊ID');
+        }
+
+        $user = Dever::db('passport/user')->one($uid);
+        $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid, 'type' => 2));
+
+        //$order_id = $this->createOrder('JP');
+        $order_data['cate_id'] = $this->cate;
+        //$order_data['order_id'] = $order_id;
+        $order_data['product_id'] = $journal_id;
+        $order_data['buy_id'] = $buy_id;
+        $order_data['uid'] = $uid;
+
+        $order_data['type'] = 3;
+        $order_data['status'] = 1;
+        $order_data['name'] = $info['name'] . '-' . $buy['name'];
+        $order_data['buy_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['buy_num'];
+        }
+
+        $order_data['system'] = 2;
+        if ($this->source) {
+            $order_data['source'] = $this->source;
+        }
+
+        if ($this->seller) {
+            $order_data['seller_id'] = $this->seller;
+        }
+
+        $id = Dever::db('act/order_temp')->insert($order_data);
+
+        if (!$id) {
+            Dever::alert('支付失败');
+        }
+
+        $order_id = Dever::load('act/order')->createOrderId($order_data, $id);
+
+        //$param参数
+        $param['id'] = $journal_id;
+        $parma['buy'] = $buy_id;
+        $param['buy_num'] = $order_data['buy_num'];
+        $param['order_id'] = $id;
+        # 立刻创建兑换码
+        //$param['create'] = 1;
+        $refer = $this->url('pay', $param);
+        //$refer = 'callback.success';
+        $param = array
+        (
+            'account_id' => 2,
+            'project_id' => 3,
+            'uid' => $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,
+            'refer' => $refer
+        );
+
+        $result = Dever::load('pay/api.page', $param);
+        return $result;
+    }
+}

+ 20 - 0
buy/src/Data.php

@@ -0,0 +1,20 @@
+<?php namespace Buy\Src;
+
+use Dever;
+
+# 未登录
+class Data extends Base
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function checkLogin()
+    {
+        //return $this->location('list');
+        if ($this->user) {
+            return $this->location('list');
+        }
+    }
+}

+ 32 - 0
buy/template/mobile/codedetail.php

@@ -0,0 +1,32 @@
+<?php
+
+$view
+
+->set('name', 'codedetail')
+
+->import('inc/head')
+
+->fetch('#code@src', 'buy/buy.code')
+
+->loop
+(
+    '.code-list dl',
+    'buy/buy.code_detail',
+    array
+    (
+        'p' => '$v.code',
+        'span' => array
+        (
+            'class' => '$v.class',
+            'html' => '$v.txt',
+        ),
+        'dt' => '$v.copy',
+    )
+)
+
+# 暂无记录
+->append('body', '<div id="page" dever-page-link="<{Dever::pageInfo()["link"]}>" dever-page-list=".pages" dever-page-call="init()"></div>') 
+
+->import('inc/foot')
+
+->display();

+ 21 - 0
buy/template/mobile/home.php

@@ -0,0 +1,21 @@
+<?php
+
+$view
+
+->set('name', 'auth')
+
+->import('inc/head')
+
+->fetch('.logo@src',    'buy/base.config#logo')
+
+->fetch('.txt@check', 'buy/data.checkLogin')
+
+->fetch('.txt', 'buy/base.config#login_title')
+
+//->fetch('.ellipsis', 'buy/base.config#title')
+
+->fetch('.button@onclick', 'buy/base.config#login')
+
+->import('inc/foot')
+
+->display();

+ 14 - 0
buy/template/mobile/inc/foot.php

@@ -0,0 +1,14 @@
+<?php
+
+$view
+
+->fetch(array('script@src', 0),     Dever::assets('global.js'))
+->fetch(array('script@src', 1),     Dever::assets('<{(isset($name) ? $name : "index")}>.js', 'js'))
+
+
+->append('body',    '<script src="'.Dever::assets('lib/jquery/jquery.min.js', 'script').'"></script>')
+->append('body',    '<script src="'.Dever::assets('dever/core.js', 'script').'"></script>')
+->append('body',    '<script src="'.Dever::assets('config.js').'"></script>')
+->append('body',    '<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>')
+
+;

+ 10 - 0
buy/template/mobile/inc/head.php

@@ -0,0 +1,10 @@
+<?php
+
+$view
+->fetch('title',                    '<{isset($title) ? $title . "_" . Dever::load("buy/base.config#title") : Dever::load("buy/base.config#title")}>')
+
+->fetch(array('link@href', 0),      Dever::assets("global.css"))
+->fetch(array('link@href', 1),      Dever::assets('<{(isset($name) ? $name : "index")}>.css', "css"))
+
+
+->append('head',    '<script><{Dever::script()}>config.uid=<{Dever::load("passport/user.data") ? Dever::load("passport/user.data#id") : -1}></script>');

+ 46 - 0
buy/template/mobile/list.php

@@ -0,0 +1,46 @@
+<?php
+
+$view
+
+->set('name', 'list') 
+
+->import('inc/head')
+
+->fetch('.logo', 'buy/base.config#logotxt')
+
+->fetch('.info-txt', 'buy/base.config#desc')
+
+->fetch(array('.tab .li@href', 0), 'buy/base.config#list_link')
+->fetch(array('.tab .li@href', 1), 'buy/base.config#my_link')
+
+# 循环
+->loop
+(
+    '.item',
+    'buy/buy.lists',
+    array
+    (
+        'h2' => '$v.name',
+        '.price' => '$v.price',
+
+        'img' => array
+        (
+            'src' => '$v.pic_gd',
+        ),
+
+        '.button' => array
+        (
+            'node-act' => '$v.act',
+            'data-src' => '$v.code',
+            'html' => '$v.button'
+        )
+        
+    )
+)
+
+# 暂无记录
+->append('body', '<div id="page" dever-page-link="<{Dever::pageInfo()["link"]}>" dever-page-list=".pages" dever-page-call="init()"></div>') 
+
+->import('inc/foot')
+
+->display();

+ 38 - 0
buy/template/mobile/my_code.php

@@ -0,0 +1,38 @@
+<?php
+
+$view
+
+->set('name', 'list')
+
+->import('inc/head')
+
+->fetch('.logo', 'buy/base.config#logotxt')
+
+->fetch('.info-txt', 'buy/base.config#desc')
+
+->fetch(array('.tab .li@href', 0), 'buy/base.config#list_link')
+->fetch(array('.tab .li@href', 1), 'buy/base.config#my_link')
+
+->loop
+(
+    '.item2',
+    'buy/buy.lists_code',
+    array
+    (
+        'p|0' => '$v.cdate',
+        'a|0' => array
+        (
+            'href' => '$v.link',
+        ),
+        'p|1' => '$v.name',
+        'span' => '$v.desc',
+        
+    )
+)
+
+# 暂无记录
+->append('body', '<div id="page" dever-page-link="<{Dever::pageInfo()["link"]}>" dever-page-list=".pages"></div>')
+
+->import('inc/foot')
+ 
+->display();

+ 68 - 0
buy/template/mobile/pay.php

@@ -0,0 +1,68 @@
+<?php
+
+$view
+
+->set('name', 'pay')
+
+->import('inc/head')
+
+->fetch('.h1', 'buy/buy.info#buy')
+
+->fetch('.richtext', 'buy/buy.info#buy_desc')
+
+//->fetch('#notice', 'buy/buy.info#buy_notice')
+//->fetch('#notices', 'buy/buy.info#buy_notices')
+->fetch('#buyyes', 'buy/buy.info#buy_yes')
+->fetch('#pay-layer@class', 'buy/buy.info#buy_class')
+->fetch('#viewcode@href', 'buy/buy.info#buy_code')
+
+
+# 循环
+/*
+->loop
+(
+    '.code',
+    'buy/buy.buy',
+    array
+    (
+        'p|0' => '$v.name',
+        'p|1' => '$v.price',
+
+        'self' => array
+        (
+            'href' => 'javascript:;',
+            'onclick' => 'pay(\'<{$v.pay_url}>\')',
+        ),
+    )
+)
+*/
+
+# 循环
+->loop
+(
+    '.item',
+    'buy/buy.buys',
+    array
+    (
+        'p|0' => '$v.name',
+        'p|1' => '$v.price',
+
+        'self' => array
+        (
+            'href' => 'javascript:;',
+            'class' => '$v.class', 
+            'data-pay' => '$v.pay_url',
+            'data-click' => 'pay(\'<{$v.pay_url}>\')',
+        ),
+    )
+)
+
+->fetch(array('script@src', 0),     Dever::assets('global.js'))
+
+
+->append('body',    '<script src="'.Dever::assets('lib/jquery/jquery.min.js', 'script').'"></script>')
+->append('body',    '<script src="'.Dever::assets('dever/core.js', 'script').'"></script>')
+->append('body',    '<script src="'.Dever::assets('config.js').'"></script>')
+->append('body',    '<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>')
+
+->display();

+ 112 - 0
code/database/config.php

@@ -0,0 +1,112 @@
+<?php
+$seller = function()
+{
+	return Dever::db('code/seller')->state();
+};
+return array
+(
+	# 表名
+	'name' => 'config',
+	# 显示给用户看的名称
+	'lang' => '新增兑换码',
+	'order' => 1,
+	'menu' => false,
+	'end' => array
+	(
+		'update' => 'code/lib/manage.create',
+		'insert' => 'code/lib/manage.create',
+	),
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '系统ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'value'		=> Dever::input('where_id'),
+		),
+
+		'product'     => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '选择小刊',
+            'default'   => '',
+            'desc'      => '选择小刊',
+            'search'	=> 'linkage',
+			'update'	=> 'linkage',//多级联动 用于搜索
+			'option'	=> Dever::url('lib/manage.search_cate_journal', 'journal'),
+        ),
+		
+		'product_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '选择小刊',
+            'default'   => '',
+            'desc'      => '选择小刊',
+            'match'     => 'option',
+            //'update'    => 'select',
+            //'update_search' => 'journal/lib/manage.search_journal',
+        ),
+
+        'seller_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '选择销售商',
+            'default'   => '1',
+            'desc'      => '选择销售商',
+            'match'     => 'option',
+            'update'    => 'select',
+          	'option'	=> $seller,
+        ),
+		
+		'num'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '兑换码数量',
+			'default' 	=> '',
+			'desc' 		=> '请输入兑换码数量',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'value'		=> '',
+		),
+
+		'product_num'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '兑换本数-填写0则不增加售出本数',
+			'default' 	=> '0',
+			'desc' 		=> '兑换本数',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+		),
+
+		'score'         => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效,当设置为0时,直接使用积分规则中的设置。当设置为负1时,不增加积分数',
+            'default'   => '',
+            'desc'      => '增加积分数',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+		),
+	),
+
+	'manage' => array
+	(
+		# 后台管理不要列表页
+		'list' => 'update',
+	),
+);

+ 359 - 0
code/database/info.php

@@ -0,0 +1,359 @@
+<?php
+
+# 定义几个常用的选项
+$type = array
+(
+	1 => '未领取',
+	2 => '已领取',
+	3 => '已使用',
+	4 => '已作废',
+);
+
+$status = array
+(
+	1 => '不可用',
+	2 => '可用',
+);
+
+$product = function()
+{
+	return Dever::load('journal/api.data');
+};
+
+$seller = function()
+{
+	return Dever::db('code/seller')->state();
+};
+
+# 获取小刊分类权限
+$auth = Dever::tops();
+$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;
+};
+
+$name = 'info';
+$create = Dever::config('database')->create;
+$data = Dever::input('search_linkage_product');
+if (isset($data[1])) {
+	$product_id = $data[1];
+} else {
+	$product_id = Dever::input('set_product_id');
+}
+
+if ($product_id && $product_id > 0) {
+	$name .= '_' . $product_id;
+	$create = false;
+}
+
+return array
+(
+	# 表名
+	'name' => $name,
+	# 显示给用户看的名称
+	'lang' => '兑换码列表',
+	'menu' => 'journal',
+	'order' => 1,
+	'create' => $create,
+	'auto' => 10000000,
+	# 数据结构
+	'struct' => array
+	(
+	
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'order'		=> 'desc',
+			//'list'		=> true,
+		),
+
+		'create_uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '创建人',
+			'default' 	=> '-1',
+			'desc' 		=> '创建人',
+			'match' 	=> 'is_numeric',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			//'list'		=> 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")',
+		),
+
+		'product'     => array
+        (
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'search'	=> 'linkage',
+            'search_col' => 'cate_id,product_id',
+			'option'	=> Dever::url('lib/manage.search_cate_journal', 'journal'),
+        ),
+
+		'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            //'search'    => 'select',
+            'list'      => true,
+        ),
+
+		'product_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '小刊',
+			'default' 	=> '',
+			'desc' 		=> '小刊',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $product,
+			//'search'	=> 'select',
+			'list'		=> '{product_id} > 0 ? Dever::load("journal/info-one#name", {product_id}) : "通用"',
+		),
+
+		'code'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '兑换码',
+			'default' 	=> '',
+			'desc' 		=> '兑换码',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> 'Dever::load("code/lib/manage.showCode", "{id}")',
+			//'list'		=> true,
+		),
+
+		'score'         => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效,当设置为0时,直接使用积分规则中的设置。当设置为-1时,不增加积分数',
+            'default'   => '',
+            'desc'      => '增加积分数',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+        ),
+
+		'product_num'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '兑换本数',
+            'default'   => '0',
+            'desc'      => '兑换本数',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+		'type'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '使用状态',
+			'default' 	=> '1',
+			'desc' 		=> '使用状态',
+			'match' 	=> 'is_numeric',
+			'option' 	=> $type,
+			'search'	=> 'select',
+			'update'	=> 'select',
+			'list'		=> true,
+			'mul'		=> array(1 => '恢复使用', 4 => '已作废'),
+		),
+
+		'seller_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '销售商',
+			'default' 	=> '1',
+			'desc' 		=> '销售商',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $seller,
+			'search'	=> 'select',
+			'list'		=> true,
+		),
+
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户信息',
+			'default' 	=> '0',
+			'desc' 		=> '用户信息',
+			'match' 	=> 'is_numeric',
+			'list'		=> 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}", "{type}")',
+		),
+
+		'order_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单表ID',
+            'default'   => '',
+            'desc'      => '订单表ID',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'	=> 'fulltext',
+            'list'        => true,
+            //'list'        => '"{order_id}" ? "{order_id}" : "{code}"',
+        ), 
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+
+		'ldate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '领取时间',
+			'match' 	=> 'option',
+			'default' 	=> '',
+			'desc' 		=> '',
+			//'search'	=> 'date',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '生成时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'search'	=> 'date',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	//'top' => Dever::config('base')->top,
+
+    # 增加这个,为了给当前的list增加一个option
+    'top_option' => array
+    (
+        'value' => $auth,
+        'col' => 'cate_id',
+    ),
+
+    # 更新表结构
+	'alter' => array
+	(
+		2 => array
+		(
+			array('update', 'product_num', 'product_num', 'varchar-32 0 兑换本数'),
+			//array('add', 'config', 'config', 'int-11 1 配置'),
+		),
+		'version' => 2,
+	),
+
+	# 索引
+	'index' => array
+	(
+		4 => array
+		(
+			'order_id' => 'order_id',
+		),
+		
+		# 版本号 更改版本号会更新当前表的索引
+		'version' => 4,
+	),
+
+	'manage' => array
+	(
+		'excel'	=> true,
+		'delete' => false,
+		'edit' => false,
+		'insert' => false,
+		'mul' => '{type} == 1 || {type} == 4',
+
+		# 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增兑换码' => array('fast', 1, 'config&where_id=1'),
+            '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
+            '新增销售商' => array('fast', 1, 'seller'),
+        ),
+
+        'list_button' => array
+		(
+			'oper' => array('作废', 'code/lib/manage.drop?id={id}&journal_id={product_id}&code={code}', '{type} == 1'),
+
+			'oper2' => array('恢复使用', 'code/lib/manage.recovery?id={id}&journal_id={product_id}&code={code}', '{type} == 4'),
+		),
+	),
+
+	'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cate_id' => 'yes',
+                'create_uid' => 'yes',
+                'order_id' => 'yes',
+                'type' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('type' => 'asc', 'id' => 'desc'),
+            'page' => array(30, 'list'),
+            'col' => '*',
+        ),
+
+        'getMyAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'order_id' => 'yes',
+                'create_uid' => 'yes',
+                'type' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('type' => 'asc', 'id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => 'id,code,type,create_uid',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'order_id' => 'yes',
+                'type' => array('yes', '!='),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('type' => 'asc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+    )
+);

+ 69 - 0
code/database/seller.php

@@ -0,0 +1,69 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'seller',
+	# 显示给用户看的名称
+	'lang' => '新增销售商',
+	'order' => 1,
+	'menu' => false,
+	# 数据结构
+	'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,
+		),
+
+		'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,
+		),
+	),
+
+	'manage' => array
+	(
+		
+	),
+
+	# 默认值
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"官方",1,' . time(),
+		),
+	),
+);

+ 8 - 0
code/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'code');
+define('DEVER_APP_LANG', '兑换码管理');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 99);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-credit-card layui-icon-read');
+include(DEVER_APP_PATH . '../boot.php');

+ 138 - 0
code/lib/Core.php

@@ -0,0 +1,138 @@
+<?php
+
+namespace Code\Lib;
+
+use Dever;
+
+class Core
+{
+    public function create_test()
+    {
+        $order_id = Dever::input('order_id');
+        $order = Dever::db('act/order')->one(array('order_id' => $order_id));
+        print_r($order);
+        $code = $this->createCodeByOrder($order, -1);
+
+        return $code;
+    }
+	public function createCodeByOrder($order, $num = 0)
+	{
+		$code = '';
+        if ($order['type'] == 3 && !$order['code']) {
+            if (!$order['order_id']) {
+                $order['order_id'] = $order['id'];
+            }
+        	Dever::setInput('set_product_id', $order['product_id']);
+            # 购买兑换码
+            $product_num = 1;
+            $code_num = 1;
+            if ($order['buy_id'] > 0) {
+                $buy = Dever::load('act/order')->getBuy($order['buy_id']);
+                $product_num = $buy['num'];
+                $code_num = $buy['code'];
+            }
+            
+            # 检查之前有多少个兑换码,防止多发
+            $code_where['order_id'] = $order['order_id'];
+        	$total = Dever::db('code/info')->total($code_where);
+        	if ($total && $total > 0) {
+        		if ($code_num > $total) {
+        			$code_num = $code_num - $total;
+        		} else {
+        			$one = Dever::db('code/info')->one($code_where);
+        			return $one['code'];
+        		}
+        	}
+
+            if ($code_num > 1) {
+                $product_num = intval($product_num/$code_num);
+
+                if ($num < 0) {
+                    # 订阅
+                    $state = Dever::load('act/lib/subscribe')->submit($order['uid'], $order['product_id'], 1);
+                    if ($state) {
+                        $code = $this->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $order['uid'], $order['order_id'], 0, 3, 1);
+                    } else {
+                        $num = 0;
+                    }
+                	
+                }
+                $result = $this->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $order['uid'], $order['order_id'], 0, 1, $code_num + $num);
+                if ($num == 0) {
+                    $code = $result;
+                }
+            } else {
+                # 订阅
+                $state = false;
+                if ($num < 0) {
+                    $state = Dever::load('act/lib/subscribe')->submit($order['uid'], $order['product_id'], 1);
+                }
+                
+                if ($state) {
+                    $code = $this->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $order['uid'], $order['order_id'], 0, 3);
+                } else {
+                    $code = $this->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $order['uid'], $order['order_id'], 0, 1);
+                }
+            }
+        }
+
+        return $code;
+	}
+
+	public function createCode($product, $cate_id, $product_id, $seller_id, $product_num = 0, $create_uid = -1, $order_id = false, $score = 0, $type = 1, $num = 1)
+	{
+        if ($product_id > 0) {
+            Dever::setInput('set_product_id', $product_id);
+        }
+        
+		//$data['product'] = $product;
+		$data['cate_id'] = $cate_id;
+		$data['product_id'] = $product_id;
+		$data['seller_id'] = $seller_id;
+		$data['product_num'] = $product_num;
+		
+		$data['type'] = $type;
+		if ($order_id) {
+			$data['order_id'] = $order_id;
+		}
+		if ($create_uid > 0) {
+			$data['create_uid'] = $create_uid;
+            if ($type == 3) {
+                $data['ldate'] = time();
+                $data['uid'] = $create_uid;
+            }
+		}
+        $data['score'] = $score;
+
+        $db = Dever::db('code/info');
+        if ($product_id > 0) {
+            $code = $db->insert($data, $num);
+            $code = $this->view($code, true);
+            return $code;
+        } else {
+            for ($i = 0; $i < $num; $i++) {
+                $data['i'] = $i;
+                $id = $db->insert($data);
+                if ($id) {
+                    $code = $this->view($id, false);
+                    $db->update(array('code' => $code, 'where_id' => $id));
+                }
+            }
+
+            return $code;
+        }
+	}
+
+    public function view($id, $state)
+    {
+        if ($state) {
+            $code = Dever::uid($id * 10000000);
+            $code = 'M' . $code;
+        } else {
+            $code = Dever::rand(4);
+            $code = 'T' . $code . $id;
+        }
+        
+        return $code;
+    }
+}

+ 122 - 0
code/lib/Manage.php

@@ -0,0 +1,122 @@
+<?php
+
+namespace Code\Lib;
+
+use Dever;
+
+class Manage
+{
+	public function showCode($id)
+	{
+		$info = Dever::db('code/info')->one($id);
+
+		if ($info['code']) {
+			return $info['code'];
+		}
+		
+		/*
+		if ($info['create_uid'] > 0) {
+			return Dever::load('code/lib/core')->view($info['id'], true);
+			return '用户创建';
+		}
+		*/
+
+		if ($info['product_id'] > 0) {
+			return Dever::load('code/lib/core')->view($info['id'], true);
+		}
+
+		return 'T' . $id;
+	}
+
+	/**
+	 * 显示用户信息
+	 *
+	 * @return mixed
+	 */
+	public function showUserInfo($create_uid, $uid, $ldate = false, $type = 1)
+	{
+		$table = array();
+		if ($create_uid && $create_uid > 0) {
+			$user = Dever::load('passport/user-one', $create_uid);
+			$table['创建人'] = $user['username'] . '('.$create_uid.')';
+		}
+		if ($type == 3 && $uid && $uid > 0) {
+			$user = Dever::load('passport/user-one', $uid);
+			if ($user) {
+				$table['领取人'] = $user['username'] . '('.$uid.')';
+				$table['手机号'] = $user['mobile'];
+				$table['领取时间'] = date('Y-m-d H:i:s', $ldate);
+			}
+		}
+
+		return Dever::table($table);
+	}
+
+    /**
+	 * 创建兑换码
+	 *
+	 * @return mixed
+	 */
+	public function create($id, $name, $param)
+	{
+		$code = Dever::param('num', $param);
+		$score = Dever::param('score', $param);
+		$product_num = Dever::param('product_num', $param);
+		$product = Dever::param('product', $param);
+		//$product_id = Dever::param('product_id', $param);
+		$seller_id = Dever::param('seller_id', $param);
+
+		$cate_id = $product_id = 0;
+		if ($product && isset($product[0])) {
+			$cate_id = $product[0];
+			if (isset($product[1])) {
+				$product_id = $product[1];
+			}
+			
+			$product = implode(',', $product);
+		}
+
+		if ($cate_id <= 0){
+			Dever::alert('生成失败,请选择分类');
+		}
+
+
+		//$total = Dever::db('code/info')->total(array('product_id' => $product_id, 'type' => 1));
+		$total = 0;
+		$core = Dever::load('code/lib/core');
+		if ($code > 0 && $code > $total) {
+			$num = $code - $total;
+
+			$core->createCode($product, $cate_id, $product_id, $seller_id, $product_num, -1, false, $score, 1, $num);
+		}
+	}
+
+	/**
+	 * 作废
+	 *
+	 * @return mixed
+	 */
+	public function drop_api($id, $journal_id, $code)
+	{
+		if (!$code && $journal_id > 0) {
+			Dever::setInput('set_product_id', $journal_id);
+		}
+		
+		$update['where_id'] = $id;
+		$update['type'] = 4;
+		Dever::db('code/info')->update($update);
+		return 'ok';
+	}
+
+	public function recovery_api($id, $journal_id, $code)
+	{
+		if (!$code && $journal_id > 0) {
+			Dever::setInput('set_product_id', $journal_id);
+		}
+
+		$update['where_id'] = $id;
+		$update['type'] = 1;
+		Dever::db('code/info')->update($update);
+		return 'ok';
+	}
+}

+ 8 - 0
combine/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'combine');
+define('DEVER_APP_LANG', '合并用户工具');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', -100);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-tabs');
+include(DEVER_APP_PATH . '../boot.php');

+ 101 - 0
combine/lib/Core.php

@@ -0,0 +1,101 @@
+<?php
+
+namespace Combine\Lib;
+
+use Dever;
+
+class Core
+{
+
+    # 合并用户数据
+    public function handle($uid, $drop)
+    {
+        $table = array
+        (
+            'passport/app',
+            'passport/wechat',
+            'act/feedback',
+            'act/comment',
+            'act/form_id',
+            'act/invite',
+            'act/like',
+            'act/live_comment',
+            'act/live_note',
+            //'act/score',//积分相关的要加上,不能直接修改
+            'act/share',
+            'act/share_reflux',
+            'act/subscribe',
+            'act/watch',
+            //'code/info',
+            'source/user',
+            'score/action_log',
+            //'score/user',//积分相关的要加上,不能直接修改
+            //'score/user_level',//等级,不做合并,保留即可
+            'score/user_log',//积分日志
+            'message/inbox',
+            'invite/relation',
+            //'pay/order',//支付系统单独建立,如果通过接口会有安全问题,因为数据是独立的,暂时不做合并
+            'journal/order',
+            'act/order',
+        );
+        if (is_string($drop)) {
+            $drop = explode(',', $drop);
+        }
+        foreach ($drop as $k => $v) {
+            if ($v == $uid) {
+                continue;
+            }
+            foreach ($table as $k1 => $v1) {
+                Dever::db($v1)->updates(array('set_uid' => $uid, 'option_uid' => $v));
+            }
+
+            # 处理一些特殊的情况
+            $this->other($uid, $v);
+
+            # 积分相关 要把积分加上,再删掉之前的
+            $this->score($uid, $v, 'score/user');
+            $this->score($uid, $v, 'act/score');
+        }
+    }
+
+    private function other($uid, $drop_uid)
+    {
+        Dever::db('code/info')->updates(array('set_uid' => $uid, 'option_uid' => $drop_uid));
+        Dever::db('code/info')->updates(array('set_create_uid' => $uid, 'option_create_uid' => $drop_uid));
+
+        $journal = Dever::db('journal/info')->state();
+        if ($journal) {
+            foreach ($journal as $k => $v) {
+                Dever::setInput('set_product_id', $v['id']);
+                Dever::db('code/info')->updates(array('set_uid' => $uid, 'option_uid' => $drop_uid));
+                Dever::db('code/info')->updates(array('set_create_uid' => $uid, 'option_create_uid' => $drop_uid));
+            }
+        }
+        
+        Dever::db('invite/relation')->updates(array('set_to_uid' => $uid, 'option_to_uid' => $drop_uid));
+    }
+
+    private function score($uid, $drop_uid, $table, $col = 'score')
+    {
+        $db = Dever::db($table);
+        $user_score = $db->one(array('uid' => $uid));
+        $user_drop_score = $db->one(array('uid' => $drop_uid));
+        if ($user_score && $user_drop_score) {
+            $score = $user_score[$col] + $user_drop_score[$col];
+
+            $update['where_id'] = $user_score['id'];
+            $update['score'] = $score;
+            $db->update($update);
+            
+            $db->delete($user_drop_score['id']);
+        } elseif (!$user_score && $user_drop_score) {
+
+            $score = $user_drop_score[$col];
+
+            $update['where_id'] = $user_drop_score['id'];
+            $update['uid'] = $uid;
+            $update['score'] = $score;
+            $db->update($update);
+        }
+    }
+}

+ 46 - 0
common.php

@@ -0,0 +1,46 @@
+<?php
+
+# return array(video, journal_buy) 1为可以、2为不可以
+function checkVersion()
+{
+	$video = 1;
+	$journal_buy = 1;
+    $mobile = 1;
+	$config = Dever::db('main/config')->one();
+    $source_type = Dever::input('source_type');
+
+    #小程序去掉视频
+    $app = false;
+    if ($source_type == 'ios' || $source_type == 'android') {
+        $app = true;
+    }
+    $app = true;
+    if ((isset($config['video']) && $config['video'] == 2) || !$app) {
+        $video = 2;
+    } elseif (isset($config['version']) && Dever::input('version') && $config['version'] == Dever::input('version')) {
+        $video = 2;
+        $journal_buy = 2;
+        $mobile = 2;
+    }
+
+    return (object) array('video' => $video, 'journal_buy' => $journal_buy, 'mobile' => $mobile);
+}
+
+/**
+ * 音视频转换
+ */
+function convert($url, $ext = 'mp4', $table = false, $id = false, $col = '')
+{
+    if ($url && !strstr($url, '_c.' . $ext)) {
+        $file = $url . '_c.' . $ext;
+        if (Dever::is_file($file)) {
+            $url = $file;
+
+            if ($table) {
+                Dever::db($table)->update(array('where_id' => $id, $col => $file));
+            }
+        }
+    }
+
+    return $url;
+}

+ 188 - 0
config/base.php

@@ -0,0 +1,188 @@
+<?php
+$config['base'] = array
+(
+	'name' => '精美时尚',
+	'version' => '1.0.0 Beta',
+
+	# 路由结束时要执行的方法
+	'route' => array
+	(
+		'end' => array
+		(
+			'main/view.article' => 'main/lib/view.end',
+			'main/view.vod' => 'main/lib/view.end',
+			'main/view.live' => 'main/lib/view.end',
+			'main/view.feature' => 'main/lib/view.end',
+			'main/journal_v1.read' => 'main/lib/journal.end',
+		),
+	),
+  
+  
+	'replace' => array('https://pili-live-hls.jstyle.cn/' =>'http://pili-live-hls.jstyle.cn/'),
+
+	# 后台头部菜单
+	'top' => 'passport/system_id',
+
+	# 功能选择
+	'function' => array
+	(
+		1 => '浏览量',
+		2 => '评论',
+		3 => '喜欢',
+		//4 => '邀请阅读',
+	),
+
+	# 小程序首页
+	'applet_index' => 'pages/choice/index/index',
+
+	# 功能类型 5小刊留言视频 6小刊留言音频
+	'type' => array
+	(
+		1 => '图文',
+		2 => '视频',
+		3 => '直播',
+		4 => '小刊',
+		//5 => '小刊音视频留言',
+		6 => '专题',
+		7 => '小程序',
+		//8 => '商品',
+		//11 => '评论',
+		//12 => '直播评论',
+		13 => '小刊活动页',
+	),
+
+	# 功能类型
+	'type_table' => array
+	(
+		1 => 'content/article',
+		2 => 'video/vod',
+		3 => 'video/live',
+		4 => 'journal/info',
+		5 => 'journal/content',
+		6 => 'feature/info',
+		7 => 'content/applet',
+		//8 => 'shop/product',
+		11 => 'act/comment',
+		12 => 'act/live_comment',
+		13 => 'journal/active',
+	),
+
+	'audit' => array
+	(
+		1 => '未审核',
+		2 => '已审核',
+		3 => '审核未通过',
+	),
+
+	# 上线状态
+	'status' => array
+	(
+		1 => '下架',
+		2 => '上线发布',
+	),
+
+	# 产品表设置 主要给survey使用
+	'product' => 'service/product',
+
+	'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,
+	),
+	'mobileCode' => array
+	(
+		# debug模式
+		'debug' => true,
+		# 发送短信的接口
+		'url' => 'https://feginesms.market.alicloudapi.com/codeNotice',
+		# 发送方法 get、post
+		'method' => 'get',
+		# 是否json编码
+		'json' => false,
+		# header信息
+		'header' => 'Authorization:APPCODE ca584ae21ce54c999067e77b5995a27b',
+		# body信息
+		'body' => 'param={code}&phone={mobile}&sign={sign}&skin={skin}',
+		# 短信模板 发送短信时,请加上参数skin=1
+		'skin' => array
+		(
+			'reg' => 35247,
+			'order' => 35246,
+			'code' => 35245,
+			# 需要增加一个notice
+			'notice' => 38099,
+			# order的反馈方案修改后
+			'feedback' => 38747,
+		),
+		# 短信签名
+		'sign' => 47159,
+		# 验证码有效期 默认10分钟
+		'timeout' => 600,
+		# 一天之内的最大发送次数,默认为10次
+		'total' => 10,
+		# 不允许多久之内重复发送,默认为60秒
+		'time' => 60,
+		# 验证码长度
+		'length' => 6,
+	),
+	# 注册成功后,调取的接口
+	'regAction' => '',
+
+	# 注册成功后,是否发送短信,直接使用skin的key即可
+	//'regSendSms' => 'reg',
+
+	'passport_list_button' => array
+	(
+		'list1' => array('订单', '"order&project=act&search_option_uid={id}&oper_parent=user&oper_project=passport"'),
+		'list2' => array('兑换码', '"info&project=code&search_option_create_uid={id}&oper_parent=user&oper_project=passport"'),
+		'list3' => array('积分', '"user&project=score&search_option_uid={id}&oper_parent=user&oper_project=passport"'),
+	),
+
+	# 支付成功后,调用的接口
+	'pay_notify' => 'service/lib/pay.act',
+);
+
+
+# 前台通用配置
+$config['template'] = array
+(
+    # 静态页面目录
+    'assets' => 'mobile',
+
+    # 模板编译器目录
+    'template' => 'mobile',
+
+    # 模板html文件的所在目录,默认为html
+    'path' => '',
+
+    'replace' => array
+    (
+        'css' => 'css/',
+        'js' => 'js/',
+        'images' => 'images/',
+        'script' => 'script/',
+    ),
+
+    # 编译器与模板对应关系目录,定义之后,代表可以完全不改动前端的代码,可以为空,为空则一一对应,参考manage
+    'relation' => array
+    (
+        # 首页启动屏幕
+        'home' => 'index',
+        'page' => 'rule',
+    ),
+    
+);
+return $config;

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

@@ -0,0 +1,273 @@
+<?php
+
+
+# 验证dc是否存在,一般在share目录下
+$dc = array();
+$dc_file = '/share/dc/config.php';
+if (is_file($dc_file)) {
+    $dc = include($dc_file);
+}
+
+if (isset($dc['php'])) {
+    $config['base']['php'] = $dc['php'];
+}
+
+if (isset($dc['data'])) {
+    $config['base']['data'] = $dc['data'];
+}
+
+$create = false;
+if (isset($dc['mysql']['create'])) {
+    $create = $dc['mysql']['create'];
+}
+//$create = true;
+$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',
+            'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
+		),
+		'database' => 'wonderful',
+		'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
+		'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
+		'charset' => 'utf8mb4',
+	),
+
+    'session' => array
+    (
+        'type' => 'redis',
+        'host' => isset($dc['redis']) ? $dc['redis'][0]['host'] : 'server-redis',
+        'port' => isset($dc['redis']) ? $dc['redis'][0]['port'] : '6379',
+        'password' => isset($dc['redis']) ? $dc['redis'][0]['password'] : 'dm_redis_123',
+    ),
+
+    'session1' => array
+    (
+        'type' => 'memcache',
+        'host' => isset($dc['memcache']) ? $dc['memcache'][0]['host'] : 'server-memcached',
+        'port' => isset($dc['memcache']) ? $dc['memcache'][0]['port'] : '11211',
+        'password' => isset($dc['memcache']) ? $dc['memcache'][0]['password'] : '',
+    )
+);
+
+/*
+$dc['mysql_user'] = array
+(
+    'host' => array
+    (
+        'read' => 'web-mysql:3306',
+        'update' => 'web-mysql:3306',
+    ),
+    'database' => 'wonderful',
+    'username' => 'root',
+    'password' => '123456',
+);
+*/
+
+
+# 设置哪些项目需要切换到弹性数据库
+if (isset($dc['mysql_user'])) {
+    $dc['mysql_user']['charset'] = 'utf8';
+    $dc['mysql_user']['database'] = 'wonderful_act';
+    $dc['mysql_user']['type'] = 'pdo';
+    $config['database']['code'] = $dc['mysql_user'];
+    $config['database']['act'] = $dc['mysql_user'];
+    $config['database']['passport'] = $dc['mysql_user'];
+    $config['database']['pay'] = $dc['mysql_user'];
+    $config['database']['score'] = $dc['mysql_user'];
+    $config['database']['message'] = $dc['mysql_user'];
+    $config['database']['oauth'] = $dc['mysql_user'];
+    $config['database']['wechat'] = $dc['mysql_user'];
+}
+
+if (DEVER_APP_NAME == 'tests' && isset($dc['mysql_test'])) {
+    # 测试
+    $dc['mysql_test']['charset'] = 'utf8';
+    $dc['mysql_test']['database'] = 'wonderful_test';
+    $dc['mysql_test']['type'] = 'pdo';
+    $config['database']['default'] = $dc['mysql_test'];
+    $config['database']['code'] = $dc['mysql_test'];
+    $config['database']['act'] = $dc['mysql_test'];
+    $config['database']['passport'] = $dc['mysql_test'];
+    $config['database']['pay'] = $dc['mysql_test'];
+    $config['database']['score'] = $dc['mysql_test'];
+    $config['database']['message'] = $dc['mysql_test'];
+    $config['database']['oauth'] = $dc['mysql_test'];
+    $config['database']['wechat'] = $dc['mysql_test'];
+}
+
+# 缓存配置
+$config['cache'] = array
+(
+    # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
+    'mysql' => 0,
+    # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
+    'html' => 0,
+    # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
+    'data' => 1800,
+    # 启用load加载器缓存,一般不加载
+    'load' => 0,
+    # 启用load加载器的远程加载缓存
+    'curl' => 0,
+    # 启用路由缓存
+    'route' => 1800,
+
+    # 缓存精细控制,根据uri来控制,0则无需缓存
+    'routeKey' => array
+    (
+        'journal.buy_action' => 0,
+        'journal.code' => 0,
+        'passport' => 0,
+        'oauth' => 0,
+        'cron' => 0,
+        //'act' => 0,
+        'combine' => 0,
+        'service_' => 0,
+        'vip_' => 0,
+        'order.' => 0,
+        'pay.' => 0,
+        'buy_home' => 0,
+        'buy_my_code' => 0,
+        'buy_codedetail' => 0,
+        'buy.pay' => 0,
+        'journal_v1.top' => 600,
+        'journal_v1.subscribe' => 0,
+        'journal_v1.getView' => 0,
+        //'journal_v1.getList' => 0,
+        'journal_v1.view' => 0,
+        'tests_api.user' => 0,
+        'tests_api.buy' => 0,
+        'stat_' => 0,
+        'buy_' => 0,
+        'order_' => 0,
+        'pay_' => 0,
+    ),
+
+    # 哪些路由中的参数不参与生成缓存的key
+    'routeNoParam' => array
+    (
+        'signature' => array
+        (
+            'content.home',
+            'content.news',
+            'content.up',
+            'content.ad',
+            'journal.home',
+            'journal.getList',
+            'journal_v1.home',
+            'journal_v1.getList',
+            'journal_v1.top',
+            'journal_v1.buy',
+            'journal_v1.read',
+            'journal_v1.getAppList',
+            'journal_v1.getView',
+            'journal_v1.getAppView',
+            'buy_list',
+            'buy_pay',
+        ),
+
+        'uid' => array
+        (
+            'content.home',
+            'content.news',
+            'content.up',
+            'content.ad',
+            'journal.home',
+            'journal.getList',
+            'journal_v1.home',
+            'journal_v1.getList',
+            'journal_v1.top',
+            'journal_v1.buy',
+            'journal_v1.read',
+            'journal_v1.getAppList',
+            'journal_v1.getView',
+            'journal_v1.getAppView',
+            'buy_list',
+            'buy_pay',
+        ),
+    ),
+    
+    # 缓存清理的参数名,请通过shell=clearcache执行
+    'shell' => 'clearcache',
+
+    # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
+    'expire' => true,
+
+    # 缓存类型
+    'type' => 'redis',//memcache、redis
+
+    # 缓存保存方式,支持多个数据源、多台缓存服务器
+    'store' => array
+    (
+        array
+        (
+            'host' => 'server-redis',
+            'port' => '6379',
+            'weight' => 100,
+            'password' => 'dm_redis_123',
+        ),
+    ),
+);
+
+if (isset($dc['redis']) && $config['cache']['type'] == 'redis') { 
+    $config['cache']['store'] = $dc['redis'];
+}
+if (isset($dc['memcache'])  && $config['cache']['type'] == 'memcache') {
+    $config['cache']['store'] = $dc['memcache'];
+}
+
+$config['debug'] = array
+(
+	'log' => false
+);
+
+/*
+if (DEVER_APP_NAME == 'source') {
+    $config['debug']['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/?',
+        ),
+        'pays' => array
+        (
+            'path' => $host. 'pay/pay/?',
+        ),
+        'wechat_applet' => array
+        (
+            'path' => $host. 'wechat/wechat_applet/?',
+        ),
+        'jingpin' => array
+        (
+            'path' => 'http://192.168.33.10/jingpin/content/?'
+        ),
+    ),
+);
+
+return $config;

+ 6 - 0
config/route.php

@@ -0,0 +1,6 @@
+<?php
+return array
+(
+	'home' => 'home',
+	'c=v(.*?)_(.*?)' => 'view.get?type=$1&id=$2',
+);

+ 136 - 0
content/database/applet.php

@@ -0,0 +1,136 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'applet',
+    # 显示给用户看的名称
+    'lang' => '外链小程序管理',
+    # 后台菜单排序
+    'order' => 1,
+    # 数据结构
+    '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,
+        ),
+
+        'appid'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '小程序appid',
+            'default'   => '',
+            'desc'      => '小程序appid',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'link'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '小程序跳转链接-可以为空,为空则不跳转',
+            'default'   => '',
+            'desc'      => '小程序名称',
+            'match'     => 'option',
+            '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})',
+        ),
+    ),
+
+    'manage' => 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',
+        ),
+
+        'search' => 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',
+        ),
+    ),
+);

+ 586 - 0
content/database/article.php

@@ -0,0 +1,586 @@
+<?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 = function()
+{
+	$array = array();
+	$info = Dever::db('poster/template')->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,
+
+	# 同步更新另外一个或多个表的数据
+	'syncone' => array
+	(
+		'audit/data' => array
+		(
+			# 更新另外一个表的字段 => 本表的字段
+			'where' => array('data_id' => 'id', 'type' => 1),
+			# 要更新的数据
+			'update' => array('data_id' => 'id', 'type' => 1, 'pdate' => 'pdate', 'reorder' => 'reorder', 'name' => 'name', 'audit' => 'audit', 'status' => 'status', 'cate_id' => 'cate_id', 'state' => 'state'),
+		)
+	),
+
+	'end' => array
+	(
+		'insert' => 'tag/lib/core.data?source_table=content/article',
+		'update' => 'tag/lib/core.data?source_table=content/article',
+	),
+	# 数据结构
+	'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', 'pdate' => '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','pdate' => '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','pdate' => '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' 		=> '作者名称-长度不能超过16个字',
+			'default' 	=> '',
+			'desc' 		=> '请输入作者名称,长度不能超过16个字',
+			'match' 	=> Dever::rule('name', '/u', '1,16'),
+			'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',
+		),
+	),
+);

+ 127 - 0
content/database/cate.php

@@ -0,0 +1,127 @@
+<?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
+	(
+		'state' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','id' => 'desc'),
+			'col' => '*',
+		),
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+				# 小程序去掉视频栏目
+				'id_no' => array('yes-id', '!='),
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc','id' => 'desc'),
+			'col' => '*',
+		),
+	),
+);

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov