rabin 5 år sedan
förälder
incheckning
3f5849ab68
100 ändrade filer med 9806 tillägg och 0 borttagningar
  1. 156 0
      act/database/comment.php
  2. 149 0
      act/database/form_id.php
  3. 121 0
      act/database/journal_num.php
  4. 568 0
      act/database/order.php
  5. 569 0
      act/database/order_temp.php
  6. 197 0
      act/database/subscribe.php
  7. 8 0
      act/index.php
  8. 90 0
      act/lib/Comment.php
  9. 38 0
      act/lib/Cron.php
  10. 33 0
      act/lib/Feedback.php
  11. 54 0
      act/lib/Form.php
  12. 67 0
      act/lib/Invite.php
  13. 65 0
      act/lib/Like.php
  14. 47 0
      act/lib/Manage.php
  15. 131 0
      act/lib/Note.php
  16. 151 0
      act/lib/Num.php
  17. 272 0
      act/lib/Pay.php
  18. 135 0
      act/lib/Score.php
  19. 163 0
      act/lib/Share.php
  20. 109 0
      act/lib/Subscribe.php
  21. 47 0
      act/lib/Watch.php
  22. 478 0
      act/src/Order.php
  23. 8 0
      boot.php
  24. 112 0
      code/database/config.php
  25. 359 0
      code/database/info.php
  26. 69 0
      code/database/seller.php
  27. 8 0
      code/index.php
  28. 138 0
      code/lib/Core.php
  29. 122 0
      code/lib/Manage.php
  30. 46 0
      common.php
  31. 188 0
      config/base.php
  32. 273 0
      config/env/localhost/default.php
  33. 6 0
      config/route.php
  34. 1 0
      data/readme
  35. 11 0
      doc/apidoc.json
  36. 765 0
      doc/apidoc.php
  37. 56 0
      journal/assets/manage/html/journal.html
  38. 216 0
      journal/database/active.php
  39. 145 0
      journal/database/buy.php
  40. 231 0
      journal/database/buy_num.php
  41. 289 0
      journal/database/cate.php
  42. 673 0
      journal/database/content.php
  43. 693 0
      journal/database/info.php
  44. 99 0
      journal/database/mobile.php
  45. 57 0
      journal/database/mobile_upload.php
  46. 8 0
      journal/index.php
  47. 549 0
      journal/lib/Manage.php
  48. 224 0
      journal/lib/Pay.php
  49. 37 0
      journal/src/Api.php
  50. 71 0
      journal/template/manage/journal.php
  51. 7 0
      main/assets/html/preview/article.html
  52. 1 0
      main/assets/html/preview/journal.html
  53. 1 0
      main/assets/html/preview/live.html
  54. 1 0
      main/assets/html/preview/vod.html
  55. 194 0
      main/assets/jstyleh5/jstyleh5/article.html
  56. 0 0
      main/assets/jstyleh5/jstyleh5/css/article.css
  57. 1 0
      main/assets/jstyleh5/jstyleh5/css/article.css.map
  58. 2 0
      main/assets/jstyleh5/jstyleh5/css/global.css
  59. 1 0
      main/assets/jstyleh5/jstyleh5/css/global.css.map
  60. 0 0
      main/assets/jstyleh5/jstyleh5/css/index.css
  61. 1 0
      main/assets/jstyleh5/jstyleh5/css/index.css.map
  62. 2 0
      main/assets/jstyleh5/jstyleh5/css/rule.css
  63. 1 0
      main/assets/jstyleh5/jstyleh5/css/rule.css.map
  64. 0 0
      main/assets/jstyleh5/jstyleh5/css/video.css
  65. 1 0
      main/assets/jstyleh5/jstyleh5/css/video.css.map
  66. BIN
      main/assets/jstyleh5/jstyleh5/images/back.png
  67. BIN
      main/assets/jstyleh5/jstyleh5/images/exp-mask.png
  68. BIN
      main/assets/jstyleh5/jstyleh5/images/expand.png
  69. BIN
      main/assets/jstyleh5/jstyleh5/images/logo.png
  70. 2 0
      main/assets/jstyleh5/jstyleh5/js/article.js
  71. 1 0
      main/assets/jstyleh5/jstyleh5/js/article.js.map
  72. 0 0
      main/assets/jstyleh5/jstyleh5/js/global.js
  73. 0 0
      main/assets/jstyleh5/jstyleh5/js/global.js.map
  74. 2 0
      main/assets/jstyleh5/jstyleh5/js/index.js
  75. 1 0
      main/assets/jstyleh5/jstyleh5/js/index.js.map
  76. 2 0
      main/assets/jstyleh5/jstyleh5/js/rule.js
  77. 1 0
      main/assets/jstyleh5/jstyleh5/js/rule.js.map
  78. 2 0
      main/assets/jstyleh5/jstyleh5/js/video.js
  79. 1 0
      main/assets/jstyleh5/jstyleh5/js/video.js.map
  80. 162 0
      main/assets/jstyleh5/jstyleh5/video.html
  81. 128 0
      main/assets/mobile/content.html
  82. 0 0
      main/assets/mobile/css/feature.css
  83. 1 0
      main/assets/mobile/css/feature.css.map
  84. 2 0
      main/assets/mobile/css/global.css
  85. 1 0
      main/assets/mobile/css/global.css.map
  86. 0 0
      main/assets/mobile/css/index.css
  87. 1 0
      main/assets/mobile/css/index.css.map
  88. 2 0
      main/assets/mobile/css/rule.css
  89. 1 0
      main/assets/mobile/css/rule.css.map
  90. BIN
      main/assets/mobile/images/ico-download.png
  91. BIN
      main/assets/mobile/images/ico-gif.png
  92. BIN
      main/assets/mobile/images/ico-share.png
  93. 72 0
      main/assets/mobile/index.html
  94. 0 0
      main/assets/mobile/js/global.js
  95. 0 0
      main/assets/mobile/js/global.js.map
  96. 2 0
      main/assets/mobile/js/index.js
  97. 1 0
      main/assets/mobile/js/index.js.map
  98. 2 0
      main/assets/mobile/js/rule.js
  99. 1 0
      main/assets/mobile/js/rule.js.map
  100. 103 0
      main/assets/mobile/rule.html

+ 156 - 0
act/database/comment.php

@@ -0,0 +1,156 @@
+<?php
+
+$page = 10;
+$table = Dever::config('base')->type;
+$table[5] = '小刊音视频';
+
+return array
+(
+	# 表名
+	'name' => 'comment',
+	# 显示给用户看的名称
+	'lang' => '评论管理',
+	# 是否显示在后台菜单
+	'order' => 80,
+	'menu'	=> 'stat',
+	# 数据结构
+	'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' => '*',
+		),
+	)
+);

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

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

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

+ 197 - 0
act/database/subscribe.php

@@ -0,0 +1,197 @@
+<?php
+
+$table = Dever::config('base')->type;
+
+$source = array
+(
+	1 => '购买',
+	2 => '兑换码',
+	3 => '邀请活动',
+	4 => '免费阅读',
+);
+$note = array
+(
+	1 => '未发送',
+	2 => '已发送',
+);
+return array
+(
+	# 表名
+	'name' => 'subscribe',
+	# 显示给用户看的名称
+	'lang' => '订阅日志',
+	# 是否显示在后台菜单
+	'order' => 68,
+	'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}) . "({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',
+		),
+	)
+);

+ 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;
+    }
+}

+ 8 - 0
boot.php

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

+ 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' => 'stat',
+	'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';
+	}
+}

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

+ 1 - 0
data/readme

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

+ 11 - 0
doc/apidoc.json

@@ -0,0 +1,11 @@
+{
+  "name": "火星计划电子刊平台接口文档",
+  "version": "1.0.0",
+  "description": "火星计划电子刊平台接口文档",
+  "title": "火星计划电子刊平台接口文档",
+  "url" : "http://www.huoxingkandiqiu.com/",
+  "template": {
+    "withCompare": true,
+    "withGenerator": true
+  }
+}

+ 765 - 0
doc/apidoc.php

@@ -0,0 +1,765 @@
+<?php 
+
+/**
+ * @api {get} common.public 公共参数说明
+ * @apiVersion 1.0.0
+ * @apiName common.public
+ * @apiGroup Common
+ *
+ * @apiDescription 介绍公共参数
+ *
+ * @apiParam {Number} json 是否返回json格式的数据1为返回2为不返回
+ * @apiParam {Number} signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ * @apiParam {Number} pg 分页数,第几页,列表页瀑布流使用该参数
+ *
+ * @apiSuccess {Number}   status  状态,1为有效2为无效
+ * @apiSuccess {String}   msg 请求的数据是否成功的提示
+ * @apiSuccess {String}   data 如果status为1,data有值
+ * @apiSuccess {Object[]}   page 分页信息
+ * @apiSuccess {Number}   page.total 分页总数
+ * @apiSuccess {Number}   page.current_page 当前页
+ * @apiSuccess {Number}   page.total_page 总页数
+ * @apiSuccess {Number}   page.next_page 下一页
+ * @apiSuccess {Number}   page.prev_page 上一页
+ * @apiSuccess {Number}   page.status 是否有下一页数据,0为没有
+ */
+
+/**
+ * @api {get} common.type 类型设置说明
+ * @apiVersion 1.0.0
+ * @apiName common.type
+ * @apiGroup Common
+ *
+ * @apiDescription 类型设置说明
+ *
+ * @apiParam {String} source_type 请在header中定义,ios:ios | android:android | 移动h5:h5  | 小程序:applet | 公众号:service | pc网站:pc
+ * @apiParam {Number} type 图文:1 | 视频:2 | 直播:3 | 小刊:4 | 小刊音视频:5 | 专题:6 | 小程序:7 | 商品:8 | 链接:10 | 评论: 11 || 直播评论:12 | 小刊活动页:13
+ * @apiParam {Number} push_ 所有带push_开头的返回参数,返回字典都是一样的,参考获取首页数据中的push_focus
+ */
+
+/**
+ * @api {post} upload/upload/?save.start 上传图片接口
+ * @apiVersion 1.0.0
+ * @apiName save.start
+ * @apiGroup Common
+ *
+ * @apiParam {Number} key 值为6,写死即可
+ * @apiParam {String} file 文件流 multipart/form-data形式
+ *
+ * @apiSuccess {String}   url  图片地址
+*/
+
+/**
+ * @api {get} mars/passport/?l=applet.login 用户登录
+ * @apiVersion 2.0.0
+ * @apiName applet.login
+ * @apiGroup AppletPassport
+ *
+ * @apiDescription 用户登录
+ *
+ * @apiParam {String} code 微信登录返回的code
+ * @apiParam {String} nickname 用户昵称
+ * @apiParam {String} avatarurl 用户头像
+ * @apiParam {String} gender 性别
+ * @apiParam {String} city 城市
+ * @apiParam {String} province 省份
+ * @apiParam {String} country 县区
+ * @apiParam {String} iv 微信的加密参数
+ * @apiParam {String} encryptedData 微信的加密参数
+ *
+ * @apiSuccess {Number}   vid  微信id,请保存在本地
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=applet.update 更新用户信息
+ * @apiVersion 1.0.0
+ * @apiName applet.update
+ * @apiGroup AppletPassport
+ *
+ * @apiDescription 更新用户信息
+ *
+ * @apiParam {String} nickname 用户昵称
+ * @apiParam {String} avatarurl 用户头像
+ * @apiParam {String} gender 性别
+ * @apiParam {String} city 城市
+ * @apiParam {String} province 省份
+ * @apiParam {String} country 县区
+ * @apiParam {String} iv 微信的加密参数
+ * @apiParam {String} encryptedData 微信的加密参数
+ * @apiParam {Number} vid 微信id
+ * @apiParam {Number} uid 用户id
+ * @apiParam {String} signature signature
+ *
+ *
+ * @apiSuccess {Number}   vid  微信id,请保存在本地
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+
+/**
+ * @api {get} wonderful/passport/?l=applet.mobile 更新用户手机号-微信绑定
+ * @apiVersion 1.0.0
+ * @apiName applet.mobile
+ * @apiGroup AppletPassport
+ *
+ * @apiDescription 更新用户手机号-微信绑定
+ *
+ * @apiParam {String} iv 微信的加密参数
+ * @apiParam {String} encryptedData 微信的加密参数
+ * @apiParam {Number} vid 微信id
+ * @apiParam {Number} uid 用户id
+ * @apiParam {String} signature signature
+ *
+ *
+ * @apiSuccess {Number}   vid  微信id,请保存在本地
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=applet.bind_mobile 更新用户手机号-验证码绑定
+ * @apiVersion 1.0.0
+ * @apiName applet.bind_mobile
+ * @apiGroup AppletPassport
+ *
+ * @apiDescription 更新用户手机号-验证码绑定
+ *
+ * @apiParam {Number} uid 用户id
+ * @apiParam {Number} mobile 手机号
+ * @apiParam {String} mcode 验证码
+ * @apiParam {String} signature signature
+ *
+
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=reg.getMCode 获取手机验证码
+ * @apiVersion 1.0.0
+ * @apiName reg.getMCode
+ * @apiGroup AppletPassport
+ *
+ * @apiDescription 获取手机验证码
+ *
+ * @apiParam {Number} mobile 手机号
+ *
+ * @apiSuccess {String}   msg 验证码已发送至您的手机,请注意查收,十分钟之内有效
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=reg.getMCode 获取手机验证码,未登录状态
+ * @apiVersion 1.0.0
+ * @apiName reg.getMCode
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 获取手机验证码,未登录状态
+ *
+ * @apiParam {Number} mobile 手机号
+ *
+ * @apiSuccess {String}   msg 验证码已发送至您的手机,请注意查收,十分钟之内有效
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=reg.getMCodeLogin 获取手机验证码,已登录状态
+ * @apiVersion 1.0.0
+ * @apiName reg.getMCode
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 获取手机验证码,已登录状态
+ *
+ * @apiParam {Number} mobile 手机号
+ * @apiParam {String} signature signature
+ *
+ * @apiSuccess {String}   msg 验证码已发送至您的手机,请注意查收,十分钟之内有效
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=app.login 登录与注册
+ * @apiVersion 1.0.0
+ * @apiName app.login
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 登录与注册
+ *
+ * @apiParam {Number} mobile 手机号
+ * @apiParam {String} mcode 验证码
+ *
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=app.login_uuid UUID登录
+ * @apiVersion 1.0.0
+ * @apiName app.login_uuid
+ * @apiGroup AppPassport
+ *
+ * @apiDescription UUID登录
+ *
+ * @apiParam {Number} uuid UUID
+ *
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=app.bind_mobile 更新用户手机号-验证码绑定
+ * @apiVersion 1.0.0
+ * @apiName app.bind_mobile
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 更新用户手机号-验证码绑定
+ *
+ * @apiParam {Number} uid 用户id
+ * @apiParam {Number} mobile 手机号
+ * @apiParam {String} mcode 验证码
+ * @apiParam {String} signature signature
+ *
+
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=app.wechat_reg 第三方登录-已经拥有openid
+ * @apiVersion 1.0.0
+ * @apiName app.wechat_reg
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 第三方登录-已经拥有openid
+ *
+ * @apiParam {String} username 用户名
+ * @apiParam {String} avatar 头像
+ * @apiParam {String} sex 性别
+ * @apiParam {String} city 城市
+ * @apiParam {String} province 省份
+ * @apiParam {String} country 县区
+ * @apiParam {String} openid openid
+ * @apiParam {String} unionid unionid
+ * @apiParam {String} access_token access_token
+ * @apiParam {String} refresh_token refresh_token
+ * @apiParam {String} expires_in 失效时间
+ *
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {Number}   mobile  手机号,判断手机号是否存在,不存在则需要进行绑定,请直接使用app.bind_mobile接口进行绑定即可
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/oauth/?l=request.callback 第三方登录
+ * @apiVersion 1.0.0
+ * @apiName request.callback
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 第三方登录
+ *
+ * @apiParam {Number} account 第三方登录的账号,写死为2吧
+ * @apiParam {Number} system 系统id,写死为1,后续做ok精彩和精品时再加
+ * @apiParam {String} source 渠道来源,写死为1,默认1则为官网渠道
+ * @apiParam {String} source_type 渠道类型,写死为ios或者android
+ * @apiParam {String} code 用户授权后返回的code
+ *
+
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {Number}   mobile  手机号,判断手机号是否存在,不存在则需要进行绑定,请直接使用app.bind_mobile接口进行绑定即可
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/passport/?l=app.update 更新用户信息
+ * @apiVersion 1.0.0
+ * @apiName app.update
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 更新用户信息
+ *
+ * @apiParam {Number} signature 用户signature
+ * @apiParam {String} username 用户昵称
+ * @apiParam {String} avatar 用户头像
+ * @apiParam {String} gender 性别
+ * @apiParam {String} city 城市
+ * @apiParam {String} province 省份
+ * @apiParam {String} country 县区
+ *
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
+/**
+ * @api {get} wonderful/main/?l=view.getHtml 获取富文本内容
+ * @apiVersion 1.0.0
+ * @apiName view.getHtml
+ * @apiGroup App
+ *
+ * @apiDescription 获取富文本内容
+ *
+ * @apiParam {Number} signature 用户signature
+ * @apiParam {String} type 类型1为图文、2为视频、3为直播、4为小刊内容,6为专题
+ * @apiParam {String} id 图文等内容id,如果为4,则为小刊的内容id,而非小刊id
+ *
+ * @apiSuccess {String}   html 直接返回html的信息,请注意里面的协议:jstyle://live_note?id=0&live_id=1&file=test
+
+ 其中有几个:
+
+ jstyle://video?id=0&vod_id=1&file=test 播放视频 id=0为content_array里的数组索引,vod_id为视频id,file为视频文件地址
+
+ jstyle://live?id=0&live_id=1&file=test 播放直播 id=0为content_array里的数组索引,live_id为直播id,file为直播文件地址
+
+ jstyle://live_note?id=0&live_id=1&file=test&note=1 设置直播提醒 id=0为content_array里的数组索引,live_id为直播id,file为直播文件地址,note值为1是已设置提醒,2为未设置提醒
+
+ jstyle://auido?id=0&file=test&note=1 播放视频 id=0为content_array里的数组索引,file为直播文件地址
+ */
+
+/**
+ * @api {get} wonderful/main/?l=user.submit_comment 提交评论
+ * @apiVersion 1.0.0
+ * @apiName user.submit_comment
+ * @apiGroup UserAction
+ *
+ * @apiDescription 提交评论
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} type type类型
+ * @apiParam {Number} id 当前的数据id
+ * @apiParam {String} content 评论内容
+ *
+ * @apiSuccess {Number}  id 当前的数据id
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.getList 小程序小刊列表
+ * @apiVersion 2.0.0
+ * @apiName journal.getList
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊列表,按照分类读取,根据获取的信息,可以直接进入到小刊详情页,无需再次请求接口。
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} system 分类id,默认为1,传入-1就是获取全部
+ *
+ * @apiSuccess {Object[]} journal 小刊数据列表
+ * @apiSuccess {String}   journal.id 小刊id
+ * @apiSuccess {String}   journal.name 名称
+ * @apiSuccess {String}   journal.subname 期号
+ * @apiSuccess {String}   journal.pic_cover 列表封面图片 暂时无效
+ * @apiSuccess {String}   journal.pic_view_cover 小刊封面图片 封面图都用这个
+ * @apiSuccess {String}   journal.pic_view_bg 全屏背景图,多张图片,这是一个数组
+ * @apiSuccess {String}   journal.pic_gd 小刊推广图
+ * @apiSuccess {String}   journal.pdate 时间
+ * @apiSuccess {String}   journal.num_ding 订阅数
+ * @apiSuccess {String}   journal.buy 小刊是否收费 1收费 2免费 3会员
+ * @apiSuccess {String}   journal.bgmusic 小刊背景音乐
+ * @apiSuccess {Object[]}   journal.button 按钮判断 如果不需要这个,可以不用
+ * @apiSuccess {Object[]}   journal.button.read 第一个按钮 阅读按钮
+ * @apiSuccess {String}   journal.button.read.status 状态 -1不显示 1为进入阅读 2为兑换 3为预售,注意,当值为2时,必须在阅读按钮上,当用户点击按钮时,绑定一个事件,该事件的接口为journal.subscribe
+ * @apiSuccess {String}   journal.button.read.name 按钮上的名字
+ * @apiSuccess {Object[]}   journal.button.buy 第二个按钮 购买按钮
+ * @apiSuccess {String}   journal.button.buy.status 状态 -1不显示 1为购买
+ * @apiSuccess {String}   journal.button.buy.name 按钮上的名字
+ * @apiSuccess {Object[]}   journal.button.share 第三个按钮 排行榜按钮
+ * @apiSuccess {String}   journal.button.share.status 状态 -1不显示 1为排行榜
+ * @apiSuccess {String}   journal.button.share.name 按钮上的名字
+ *
+ * @apiSuccess {Object[]} push 主推小刊
+ * @apiSuccess {String}   push.id 小刊id
+ * @apiSuccess {String}   push.name 名称
+ * @apiSuccess {String}   push.num_ding 订阅数
+
+ * @apiSuccess {Object[]} cate 当前分类
+ * @apiSuccess {String}   cate.id 分类id
+ * @apiSuccess {String}   cate.name 名称
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.getAppList APP小刊列表
+ * @apiVersion 2.0.0
+ * @apiName journal.getAppList
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊列表,按照分类读取,根据获取的信息,可以直接进入到小刊详情页,无需再次请求接口。
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} system 分类id,默认为1,传入-1就是获取全部
+ *
+ * @apiSuccess {Object[]} journal 小刊数据列表
+ * @apiSuccess {String}   journal.id 小刊id
+ * @apiSuccess {String}   journal.name 名称
+ * @apiSuccess {String}   journal.subname 期号
+ * @apiSuccess {String}   journal.pic_cover 列表封面图片 暂时无效
+ * @apiSuccess {String}   journal.pic_view_cover 小刊封面图片 封面图都用这个
+ * @apiSuccess {String}   journal.pic_view_bg 全屏背景图,多张图片,这是一个数组
+ * @apiSuccess {String}   journal.pic_gd 小刊推广图
+ * @apiSuccess {String}   journal.pdate 时间
+ * @apiSuccess {String}   journal.num_ding 订阅数
+ * @apiSuccess {String}   journal.buy 小刊是否收费 1收费 2免费 3会员
+ * @apiSuccess {String}   journal.bgmusic 小刊背景音乐
+ * @apiSuccess {Object[]}   journal.button 按钮判断 如果不需要这个,可以不用
+ * @apiSuccess {Object[]}   journal.button.read 第一个按钮 阅读按钮
+ * @apiSuccess {String}   journal.button.read.status 状态 -1不显示 1为进入阅读 2为兑换 3为预售,注意,当值为2时,必须在阅读按钮上,当用户点击按钮时,绑定一个事件,该事件的接口为journal.subscribe
+ * @apiSuccess {String}   journal.button.read.name 按钮上的名字
+ * @apiSuccess {Object[]}   journal.button.buy 第二个按钮 购买按钮
+ * @apiSuccess {String}   journal.button.buy.status 状态 -1不显示 1为购买
+ * @apiSuccess {String}   journal.button.buy.name 按钮上的名字
+ * @apiSuccess {Object[]}   journal.button.share 第三个按钮 排行榜按钮
+ * @apiSuccess {String}   journal.button.share.status 状态 -1不显示 1为排行榜
+ * @apiSuccess {String}   journal.button.share.name 按钮上的名字
+ *
+ * @apiSuccess {Object[]} push 主推小刊
+ * @apiSuccess {String}   push.id 小刊id
+ * @apiSuccess {String}   push.name 名称
+ * @apiSuccess {String}   push.num_ding 订阅数
+
+ * @apiSuccess {Object[]} cate 当前分类
+ * @apiSuccess {String}   cate.id 分类id
+ * @apiSuccess {String}   cate.name 名称
+
+ * @apiSuccess {Object[]} cateList 分类列表
+ * @apiSuccess {String}   cateList.id 分类id
+ * @apiSuccess {String}   cateList.name 名称
+ */
+
+/**
+ * @api {get} mars/act/?l=order.getMyList 我的订单列表
+ * @apiVersion 2.0.0
+ * @apiName order.getMyList
+ * @apiGroup UserActionV1
+ *
+ * @apiDescription 我的订单列表
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} system 分类id
+ *
+ * @apiSuccess {Object[]} order 订单信息
+ * @apiSuccess {String}   order.name 名称
+ * @apiSuccess {String}   order.order_id 订单id
+ * @apiSuccess {String}   order.buy_num 购买本数
+ * @apiSuccess {String}   order.cdate 购买时间
+ */
+
+/**
+ * @api {get} mars/act/?l=order.getMyCodeList 我的兑换码列表
+ * @apiVersion 2.0.0
+ * @apiName order.getMyCodeList
+ * @apiGroup UserActionV1
+ *
+ * @apiDescription 我的兑换码列表
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} order_id 订单id
+ *
+ * @apiSuccess {Object[]} code 兑换码列表
+ * @apiSuccess {String}   code.code 兑换码
+ * @apiSuccess {String}   code.type 类型 1为未使用 3为已使用 4为已作废
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.read 小刊阅读页
+ * @apiVersion 2.0.0
+ * @apiName journal.read
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊阅读页
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 小刊id
+ *
+ * @apiSuccess {Object[]} content 内容数据列表,每页显示10条,请在翻到第7或者第8条时,请求第2页
+ * @apiSuccess {String}   content.id 内容id
+ * @apiSuccess {String}   content.type 内容类型1全屏图、2长图、3图文内容、11关联图文、12关联视频、13关联直播、4全屏视频、5留言视频、6留言音频|||新增:7长屏图、8横屏图、9无边框图片、10四宫格图片、21对话模板
+ * @apiSuccess {String}   content.name 标题。type=5,6时有效
+ * @apiSuccess {String}   content.cover 音频或者视频的封面图,type=4,5,6时有效
+ * @apiSuccess {String}   content.video 视频地址。type=4,5时有效
+ * @apiSuccess {String}   content.music 音频地址。type=6时有效
+ * @apiSuccess {String}   content.pic 全屏图或者长图,type=1,2,7,8,9时有效
+ * @apiSuccess {String}   content.pic_info 全屏图或者长图的图片信息,type=1,2,7,8,9时有效,值如1024_768_548.12_35,请用_分隔成数组使用,1024为宽度,768为高度,548.12为图片大小,35为图片id
+ * @apiSuccess {String}   content.is_button 全屏图上的保存按钮,1显示2不显示,type=1时有效
+ * @apiSuccess {String}   content.button_name 全屏图上的保存按钮的文字,type=1时有效
+ * @apiSuccess {String}   content.button_color 全屏图上的保存按钮的文字颜色,type=1时有效
+ * @apiSuccess {String}   content.note 是否预约提醒1为已预约,2为未预约
+ * @apiSuccess {Object[]}   content.text 全屏图上的九个文字位置,type=1时有效
+ * @apiSuccess {String}   content.text.text 文字位置,1上左2上中3上右4中左5正中6中右7下左8下中9下右
+ * @apiSuccess {String}   content.text.name 文字内容 换行用\n隔开
+ * @apiSuccess {String}   content.text.color 文字颜色
+ * @apiSuccess {String}   content.text.bgcolor 文字背景颜色
+ * @apiSuccess {String}   content.text.bgcolor_type 是否设置文字背景颜色,1设置,2不设置,不设置则文字背景颜色为透明。
+ * @apiSuccess {String}   content.text.size 文字像素大小
+ * @apiSuccess {Object[]}   content.info type=3,11,12,13时有效,当等于11,12,13时,分别对应图文详情、视频详情、直播详情里的字段,等于3时,请查看以下字段
+ * @apiSuccess {String}   content.info.name 标题
+ * @apiSuccess {String}   content.info.focus 焦点图
+ * @apiSuccess {String}   content.info.content 内容
+ * @apiSuccess {String}   content.info.content_array 数组内容
+ * @apiSuccess {Object[]}   content.info.author 作者
+
+ * @apiSuccess {Object[]}   content.palaces 四宫格图片的四个图片,type=10时有效
+ * @apiSuccess {String}   content.palaces.palaces 图片位置,1上左2上右3下左4下右
+ * @apiSuccess {String}   content.palaces.pic 图片
+
+ * @apiSuccess {String}   content.talk_pic 对话模板的置顶图片,为空则不显示,type=21时有效
+ * @apiSuccess {Object[]}   content.talk 对话模板里的对话内容,type=21时有效
+ * @apiSuccess {String}   content.talk.talk_location 对话位置,1左2右
+ * @apiSuccess {String}   content.talk.talk_type 对话类型,1文字,2图片,3音频
+ * @apiSuccess {String}   content.talk.avatar 头像
+ * @apiSuccess {String}   content.talk.text 文字
+ * @apiSuccess {String}   content.talk.pic 图片
+ * @apiSuccess {String}   content.talk.audio 音频
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.getView 小刊详情页
+ * @apiVersion 2.0.0
+ * @apiName journal.getView
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊详情页,如果是分享进来的,请求这个接口来获取按钮
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 小刊id
+ *
+ * @apiSuccess {Object[]} info 小刊详情
+ * @apiSuccess {String}   info.id 小刊id
+ * @apiSuccess {String}   info.name 名称
+ * @apiSuccess {String}   journal.subname 期号
+ * @apiSuccess {String}   info.pic_cover 列表封面图片 暂时无效
+ * @apiSuccess {String}   info.pic_view_cover 小刊封面图片 封面图都用这个
+ * @apiSuccess {String}   info.pic_view_bg 全屏背景图,多张图片,这是一个数组
+ * @apiSuccess {String}   info.pic_gd 小刊推广图
+ * @apiSuccess {String}   info.pdate 时间
+ * @apiSuccess {String}   info.ydate 预售时间
+ * @apiSuccess {String}   info.ytype 预售状态,1为可以阅读2显示预售弹窗,如果用button就不用判断该字段了
+ * @apiSuccess {String}   info.num_ding 订阅数
+ * @apiSuccess {String}   info.buy 小刊是否收费 1收费 2不收费
+ * @apiSuccess {String}   info.subscribe 是否订阅,1为已订阅2为未订阅
+ * @apiSuccess {String}   info.active 是否有活动,1为有2为没有,有则显示排行榜按钮
+
+ * @apiSuccess {Object[]}   button 按钮判断 如果不需要这个,可以不用
+ * @apiSuccess {Object[]}   button.read 第一个按钮 阅读按钮
+ * @apiSuccess {String}   button.read.status 状态 -1不显示 1为进入阅读 2为兑换 3为预售,注意,当值为2时,必须在阅读按钮上,当用户点击按钮时,绑定一个事件,该事件的接口为journal.subscribe
+ * @apiSuccess {String}   button.read.name 按钮上的名字
+ * @apiSuccess {Object[]}   button.buy 第二个按钮 购买按钮
+ * @apiSuccess {String}   button.buy.status 状态 -1不显示 1为购买
+ * @apiSuccess {String}   button.buy.name 按钮上的名字
+ * @apiSuccess {Object[]}   button.share 第三个按钮 排行榜按钮
+ * @apiSuccess {String}   button.share.status 状态 -1不显示 1为排行榜
+ * @apiSuccess {String}   button.share.name 按钮上的名字
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.getAppView APP小刊详情页
+ * @apiVersion 2.0.0
+ * @apiName journal.getAppView
+ * @apiGroup Journal
+ *
+ * @apiDescription APP小刊详情页,如果是分享进来的,请求这个接口来获取按钮
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 小刊id
+ *
+ * @apiSuccess {Object[]} info 小刊详情
+ * @apiSuccess {String}   info.id 小刊id
+ * @apiSuccess {String}   info.name 名称
+ * @apiSuccess {String}   journal.subname 期号
+ * @apiSuccess {String}   info.pic_cover 列表封面图片 暂时无效
+ * @apiSuccess {String}   info.pic_view_cover 小刊封面图片 封面图都用这个
+ * @apiSuccess {String}   info.pic_view_bg 全屏背景图,多张图片,这是一个数组
+ * @apiSuccess {String}   info.pic_gd 小刊推广图
+ * @apiSuccess {String}   info.pdate 时间
+ * @apiSuccess {String}   info.ydate 预售时间
+ * @apiSuccess {String}   info.ytype 预售状态,1为可以阅读2显示预售弹窗,如果用button就不用判断该字段了
+ * @apiSuccess {String}   info.num_ding 订阅数
+ * @apiSuccess {String}   info.buy 小刊是否收费 1收费 2不收费
+ * @apiSuccess {String}   info.subscribe 是否订阅,1为已订阅2为未订阅
+ * @apiSuccess {String}   info.active 是否有活动,1为有2为没有,有则显示排行榜按钮
+
+ * @apiSuccess {Object[]}   button 按钮判断 如果不需要这个,可以不用
+ * @apiSuccess {Object[]}   button.read 第一个按钮 阅读按钮
+ * @apiSuccess {String}   button.read.status 状态 -1不显示 1为进入阅读 2为兑换 3为预售,注意,当值为2时,必须在阅读按钮上,当用户点击按钮时,绑定一个事件,该事件的接口为journal.subscribe
+ * @apiSuccess {String}   button.read.name 按钮上的名字
+ * @apiSuccess {Object[]}   button.buy 第二个按钮 购买按钮
+ * @apiSuccess {String}   button.buy.status 状态 -1不显示 1为购买
+ * @apiSuccess {String}   button.buy.name 按钮上的名字
+ * @apiSuccess {Object[]}   button.share 第三个按钮 排行榜按钮
+ * @apiSuccess {String}   button.share.status 状态 -1不显示 1为排行榜
+ * @apiSuccess {String}   button.share.name 按钮上的名字
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.subscribe 检测小刊是否可以阅读
+ * @apiVersion 2.0.0
+ * @apiName journal.subscribe
+ * @apiGroup Journal
+ *
+ * @apiDescription 检测小刊是否可以阅读
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 小刊id
+ *
+ * @apiSuccess {String}   subscribe 1为已订阅可以阅读,2为未订阅不能阅读,弹出兑换码
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.buy 小刊购买页
+ * @apiVersion 2.0.0
+ * @apiName journal.buy
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊购买页
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 小刊id
+ *
+ * @apiSuccess {Object[]} info 小刊详情
+ * @apiSuccess {String}   info.id 小刊id
+ * @apiSuccess {String}   info.name 名称
+ *
+ * @apiSuccess {String} buy_desc 购买说明
+ * @apiSuccess {Object[]}   buy_list 购买列表
+ * @apiSuccess {String}   buy_list.id 购买id 支付时使用
+ * @apiSuccess {String}   buy_list.name 名称
+ * @apiSuccess {String}   buy_list.price 标价
+ * @apiSuccess {String}   buy_list.cash 实际支付价格
+ */
+
+/**
+ * @api {get} mars/act/?l=order.pay 发起支付
+ * @apiVersion 2.0.0
+ * @apiName order.pay
+ * @apiGroup UserActionV1
+ *
+ * @apiDescription 发起支付:请注意,如果是苹果支付,请在发起苹果支付之后,将苹果返回的验证数据,传入该接口
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} journal_id 小刊id
+ * @apiParam {String} buy_id 购买本数id
+ * @apiParam {String} receipt 当header中的source_type为ios时,请传入该参数,参数的值为苹果支付后返回的参数,即可发起支付验证。
+*
+ * @apiSuccess {Object[]} pay 微信支付返回的数据
+ * @apiSuccess {String}   pay.time 服务器时间戳
+ * @apiSuccess {String}   pay.nonce_str 随机字符串
+ * @apiSuccess {String}   pay.prepay_id 统一下单接口返回的 prepay_id 参数值,通过'prepay_id=' + prepay_id 拼装成package
+ * @apiSuccess {String}   pay.sign_type 签名算法
+ * @apiSuccess {String}   pay.sign 签名
+ * @apiSuccess {String}   pay.yes 苹果支付时显示改参数,1为支付成功2为支付失败
+ * @apiSuccess {String}   pay.order_id 支付的订单id
+ */
+
+/**
+ * @api {get} mars/act/?l=order.code 兑换码兑换
+ * @apiVersion 2.0.0
+ * @apiName order.code
+ * @apiGroup UserActionV1
+
+ * @apiDescription 兑换码兑换
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} journal_id 小刊id
+ * @apiParam {String} code 兑换码
+ *
+ * @apiSuccess {String}   ok 兑换成功
+ */
+
+/**
+ * @api {get} mars/main/?l=journal.top 小刊本数排行榜
+ * @apiVersion 2.0.0
+ * @apiName journal.top
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊本数排行榜
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} id 小刊id
+ *
+ * @apiSuccess {Object[]} info 小刊详情
+ * @apiSuccess {String}   info.id 小刊id
+ * @apiSuccess {String}   info.name 名称
+ *
+ * @apiSuccess {Object[]}   top 本数排行
+ * @apiSuccess {String}   top.uid 用户id
+ * @apiSuccess {String}   top.num 本数
+ * @apiSuccess {String}   top.username 用户名
+ * @apiSuccess {String}   top.avatar 头像
+  *
+ * @apiSuccess {Object[]}   active 活动说明表
+ * @apiSuccess {String}   active.name 名称
+ * @apiSuccess {String}   active.status 活动状态 1活动进行中 2活动已结束
+ * @apiSuccess {String}   active.desc 描述
+ * @apiSuccess {String}   active.invite_title 邀请好友标题
+ * @apiSuccess {String}   active.invite_desc 邀请好友描述 换行用\n隔开
+ * @apiSuccess {String}   active.content 活动说明,富文本
+ */
+
+/**
+ * @api {get} wonderful/main/?l=user.my 获取用户信息
+ * @apiVersion 1.0.0
+ * @apiName user.my
+ * @apiGroup User
+ *
+ * @apiDescription 获取用户信息
+ *
+ * @apiParam {String} signature signature
+ *
+ * @apiSuccess {Object[]} user 用户基本信息
+ * @apiSuccess {String}   user.id 用户id
+ * @apiSuccess {String}   user.username 用户名
+ * @apiSuccess {String}   user.mobile 手机号
+ * @apiSuccess {String}   user.avatar 头像
+ * @apiSuccess {String}   user.level 等级
+ * @apiSuccess {String}   user.score 积分
+ * @apiSuccess {String}   user.vip_type 会员状态,-1为未开通,-2为已过期,大于0则为正式会员的过期时间戳
+ * @apiSuccess {String}   user.vip_end 当vip_type>0时存在,正式会员的过期时间
+ * @apiSuccess {String}   user.vip_state vip_state=1则显示购买按钮,=2则不显示
+ * @apiSuccess {Number}   user_msg 用户新消息数
+ */
+
+/**
+ * @api {get} wonderful/main/?l=user.my_msg 获取我的消息
+ * @apiVersion 1.0.0
+ * @apiName user.my_msg
+ * @apiGroup User
+ *
+ * @apiDescription 获取我的消息
+ *
+ * @apiParam {String} signature signature
+ *
+ * @apiSuccess {Object[]} msg 消息列表
+ * @apiSuccess {String}   msg.uid 用户id
+ * @apiSuccess {String}   msg.from_uid 消息来源uid,暂时不用管
+ * @apiSuccess {String}   msg.name 消息标题
+ * @apiSuccess {String}   msg.content 消息内容
+ * @apiSuccess {String}   msg.cdate 时间戳
+ * @apiSuccess {String}   msg.cdate_time 转换成了Y-m-d H:i:s的时间
+ * @apiSuccess {String}   msg.status 消息已读状态1未读2已读
+ * @apiSuccess {String}   msg.type 消息类型,暂时不用管,目前都为11
+ * @apiSuccess {String}   msg.param 消息传入参数,这是一个数组:name消息名称,type是上述公共参数所定义的类型,id是底层页id,link是链接地址,有则跳转到该地址
+ */
+
+/**
+ * @api {get} wonderful/main/?l=user.my_comment 获取我评论的信息
+ * @apiVersion 1.0.0
+ * @apiName user.my_comment
+ * @apiGroup User
+ *
+ * @apiDescription 获取我喜欢的信息
+ *
+ * @apiParam {String} signature signature
+ *
+ * @apiSuccess {Object[]} comment 用户基本信息
+ * @apiSuccess {String}   comment.uid 用户id
+ * @apiSuccess {String}   comment.data_id 数据id
+ * @apiSuccess {String}   comment.content 评论内容
+ * @apiSuccess {String}   comment.time 时间:x小时前
+ * @apiSuccess {String}   comment.cdate 时间戳
+ * @apiSuccess {String}   comment.cdate_time 转换成了Y-m-d H:i:s的时间
+ * @apiSuccess {String}   comment.type 类型,参考公共参数中的类型设置说明中的type说明
+ * @apiSuccess {Object[]}   comment.info 基本信息 根据type不同,里面的字段有所不同
+ * @apiSuccess {String}   comment.info.id 数据id
+ * @apiSuccess {String}   comment.info.name 名称
+ * @apiSuccess {String}   comment.info.cate_id 栏目ID
+ * @apiSuccess {String}   comment.info.cate_name 栏目名称
+ * @apiSuccess {String}   comment.info.pic_cover 4:3图片
+ * @apiSuccess {String}   comment.info.pic_cover_169 16:9图片
+ * @apiSuccess {String}   comment.info.pdate 发布时间
+ */

+ 56 - 0
journal/assets/manage/html/journal.html

@@ -0,0 +1,56 @@
+<style>
+.layui-col-md2
+{
+    height: 250px;
+    border:1px solid #bababa;
+    margin:5px;
+}
+.layui-col-md2 .img
+{
+    text-align: center;overflow: hidden;text-align: center;
+}
+</style>
+<div class="layui-fluid layadmin-cmdlist-fluid">
+  <ul class="layui-row layui-col-space30" id="sortable">
+    <li class="layui-col-md2 layui-col-sm4" id="data" style="">
+        <div class="cmdlist-container">
+            <div href="javascript:;" class="img" style="height: 154px;">
+              <img src="../../layuiadmin/style/res/template/portrait.png">
+            </div>
+            <a href="javascript:;" >
+              <div class="cmdlist-text" style="text-align:center;">
+                <p class="info">2018春夏季新款港味短款白色T恤+网纱中长款chic半身裙套装两件套</p>
+                <div class="price">
+                    <b></b>
+                </div>
+
+                <div class="text"></div>
+                
+
+                <div style="margin-top:10px;text-align:center;">
+                <div class="layui-table-cell"><a href="javascript:;" class="edit" onclick=""><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">编辑</button></a>&nbsp;&nbsp;<a href="#" class="oper_delete"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-danger layui-btn-xs"><span class="am-icon-trash-o"></span>删除</button></a>&nbsp;&nbsp;</div>
+                </div>
+              </div>
+            </a>
+        </div>
+    </li>
+  </ul>
+</div>
+
+<script id="url">var url = ""</script>
+<script>
+  $( function() {
+    var sort = $( "#sortable" ).sortable({
+        opacity: 0.7,
+        stop:function(){
+          var arr = $( "#sortable" ).sortable('toArray');
+          arr = arr.join(',');
+          $.post(url, {data:arr}, function()
+          {
+
+          })
+        }
+    });
+    $( "#sortable" ).disableSelection();
+  } );
+  </script>

+ 216 - 0
journal/database/active.php

@@ -0,0 +1,216 @@
+<?php
+
+$status = array
+(
+    1 => '开启',
+    2 => '关闭',
+);
+return array
+(
+    # 表名
+    'name' => 'active',
+    # 显示给用户看的名称
+    'lang' => '活动设置',
+    'menu' => false,
+    'end' => array
+    (
+        'insert' => 'journal/lib/manage.setActiveCache',
+        'update' => 'journal/lib/manage.setActiveCache',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            'value'     => Dever::input('where_id')
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'status'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '活动状态',
+            'default'   => '1',
+            'desc'      => '活动状态',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $status,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '活动标题',
+            'default'   => '',
+            'desc'      => '活动标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'start'       => array
+        (
+            'type'      => 'int-11',
+            'default'   => '',
+            'name'      => '活动开始时间',
+            'match'     => 'is_string',
+            'desc'      => '活动开始时间',
+            'update'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {start})',
+            'callback'  => 'maketime',
+        ),
+
+        'end'       => array
+        (
+            'type'      => 'int-11',
+            'default'   => '',
+            'name'      => '活动结束时间',
+            'match'     => 'is_string',
+            'desc'      => '活动结束时间',
+            'update'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {end})',
+            'callback'  => 'maketime',
+        ),
+
+        'desc'      => array
+        (
+            'type'      => 'text-255',
+            'name'      => '活动描述',
+            'default'   => '',
+            'desc'      => '活动描述',
+            'match'     => 'option',
+            'update'    => 'editor',
+            'key'       => 1,
+            //'search'  => 'fulltext',
+            //'list'        => true,
+        ),
+
+        'invite_num'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '邀请多少个好友开启免费阅读',
+            'default'   => '10',
+            'desc'      => '邀请多少个好友开启免费阅读',
+            'match'     => 'option',
+            //'update'    => 'text',
+        ),
+
+        'invite_score'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '每邀请一个好友获得积分-仅支持邀请新用户,设置之后,积分规则里的设置将失效',
+            'default'   => '2',
+            'desc'      => '每邀请一个好友获得积分',
+            'match'     => 'option',
+            //'update'    => 'text',
+        ),
+
+        'invite_title'     => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '邀请好友标题',
+            'default'   => '邀请好友获得积分',
+            'desc'      => '邀请好友标题',
+            'match'     => 'option',
+            //'update'    => 'text',
+        ),
+
+        'invite_desc'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '邀请好友标题介绍',
+            'default'   => '邀请10人开启免费阅读',
+            'desc'      => '邀请好友标题介绍',
+            'match'     => 'option',
+            //'update'    => 'textarea',
+        ),
+
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '活动规则说明',
+            'default'   => '',
+            'desc'      => '活动规则说明',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'key'       => 1,
+        ),
+        
+
+        '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})',
+        ),
+    ),
+
+    # 更新表结构
+    'alter' => array
+    (
+        2 => array
+        (
+            array('update', 'desc', 'desc', 'text-255  描述'),
+            //array('add', 'config', 'config', 'int-11 1 配置'),
+        ),
+        'version' => 2,
+    ),
+
+    'manage' => array
+    (
+
+    ),
+
+    'request' => array
+    (
+        # 获取提交订单超过12个小时
+        'getDataByTime' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'end' => array('yes', '<='),
+                'ends' => array('yes-end', '>'),
+                'state' => 1,
+                'status' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 145 - 0
journal/database/buy.php

@@ -0,0 +1,145 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'buy',
+    # 显示给用户看的名称
+    'lang' => '购买设置',
+    'menu' => false,
+    'end' => array
+    (
+        //'update' => 'service/lib/manage.feedback',
+        //'insert' => 'service/lib/manage.feedback',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            'value'     => Dever::input('where_id')
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'buy_score'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '每购买一本刊获得多少积分',
+            'default'   => '20',
+            'desc'      => '每购买一本刊获得多少积分',
+            'match'     => 'is_numeric',
+            //'update'    => 'text',
+        ),
+
+        'buy_title'     => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '购买小刊标题',
+            'default'   => '购买小刊获得积分',
+            'desc'      => '购买小刊标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'buy_applet_notice'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '购买提示-小程序与APP内直接购买小刊的提示',
+            'default'   => '在此购买单本可直接阅读电子刊,购买多本,直接累计积分,不会生成兑换码。',
+            'desc'      => '购买提示',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+        ),
+
+        'buy_notice'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '购买一个兑换码提示-h5页面购买兑换码时的提示语',
+            'default'   => '一次购买多本将生成一个兑换码用于兑换,如需多个兑换码,请多次购买。',
+            'desc'      => '购买小刊提示',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+        ),
+
+        'buy_notices'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '购买多个兑换码提示-h5页面购买兑换码时的提示语',
+            'default'   => '购买兑换码赠送好友:点击下方购买后,将生成多个兑换码。
+积分规则:使用兑换码兑换后,使用人获得积分,购买人不增加积分。',
+            'desc'      => '购买小刊提示',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+        ),
+
+        'buy_desc'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '购买小刊介绍',
+            'default'   => '每购买一本刊获得20积分',
+            'desc'      => '购买小刊介绍',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+        ),
+
+        'buy_content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '购买说明',
+            'default'   => "<p>1、兑换成功后可直接点击【开始阅读】查看电子刊内容;</p>
+<p>2、电子刊为虚拟商品,如无系统问题,兑换后不可退款;</p>
+<p>3、每兑换一本电子刊增加20个积分,以此类推,谁使用兑换码则积分累计在谁的账号中;</p>
+<p>4、想赠送朋友,可在下方点击【购买10本生成10个兑换码】按钮,如购买后自己使用,则需要全部兑换后方可换取积分;</p>
+<p>5、如有其它问题可咨询在线客服。</p>",
+            'desc'      => '请输入内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'key'       => 1,
+        ),
+        
+        '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
+    (
+
+    ),
+);

+ 231 - 0
journal/database/buy_num.php

@@ -0,0 +1,231 @@
+<?php
+
+# 定义几个常用的选项
+$status = array
+(
+    1 => '在线',
+    2 => '下线',
+);
+
+return array
+(
+    # 表名
+    'name' => 'buy_num',
+    # 显示给用户看的名称
+    'lang' => '购买本数设置',
+    'order' => 100,
+    'menu' => false,
+    'end' => array
+    (
+        'insert' => 'journal/lib/manage.setBuyCache',
+        'update' => 'journal/lib/manage.setBuyCache',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'        => true,
+        ),
+
+        'info_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'num'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买本数-直接填写购买的小刊本数数字即可',
+            'default'   => '1',
+            'desc'      => '购买本数',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '购买名称-一般为“购买n本”,如购买1本,如果为空,则根据购买本数自动生成如“购买n本”',
+            'default'   => '',
+            'desc'      => '购买名称',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'search'    => 'fulltext',
+            'list'      => 'Dever::load("journal/lib/manage.getName", {id})',
+        ),
+
+        'price'     => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '购买时的标价-为空则自动根据小刊的单本支付价格计算',
+            'default'   => '',
+            'desc'      => '购买时的标价',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => 'Dever::load("journal/lib/manage.getPrice", {id})',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '支付价格-实际支付价格,单位元,直接填写数字即可',
+            'default'   => '',
+            'desc'      => '支付价格',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+        ),
+
+        'score'         => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '增加积分数-直接填写购买当前本数设置,用户能获得的积分,设置之后,积分规则里的设置将失效',
+            'default'   => '',
+            'desc'      => '增加积分数',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+        ),
+
+        'code'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '生成兑换码数量-直接填写购买当前本数所能得到的兑换码数,默认为1',
+            'default'   => '1',
+            '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_name' => '排序',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '添加时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            //'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                //'code' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getAlls' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'code' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 最低价格的
+        'getDataByMin' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('cash' => 'asc','reorder' => 'desc', 'cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getAllCode' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'code' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getAllCodes' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                //'code' => array(1, '>'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 289 - 0
journal/database/cate.php

@@ -0,0 +1,289 @@
+<?php
+# 获取小刊分类权限
+$auth = Dever::tops();
+$status = Dever::config('base')->status;
+$type = array
+(
+    # 默认类型
+    3 => '图文内容',
+    1 => '全屏图',
+    
+    # 2019-03-27 增加两个类型
+    7 => '长图(文字)',
+    8 => '横屏图',
+
+    2 => '长图',
+    9 => '无边框图片',
+    10 => '四宫格图片',
+
+    # 2018-12-11 增加3个类型
+    4 => '全屏视频',
+    5 => '留言视频',
+    6 => '留言音频',
+
+    # 2019-03-27 增加三个类型
+    21 => '对话模板',
+
+    # 关联类型 > 10
+    //11 => '关联图文',
+    //12 => '关联视频',
+    //13 => '关联直播',
+);
+
+$list = array
+(
+    # 匹配的正则或函数 选填项
+    'option' => array
+    (
+
+        'name' => array('yes', 'like'),
+        'title' => array('yes', 'like'),
+        'id' => array($auth, 'in'),
+        'journal_id' => 'yes',
+        'state' => 'yes',
+    ),
+    'type' => 'all',
+    'order' => array('reorder' => 'desc', 'id' => 'desc'),
+    'page' => array(20, 'list'),
+    'col' => '*|id',
+);
+
+
+$id = Dever::input('where_id');
+return array
+(
+    # 表名
+    'name' => 'cate',
+    # 显示给用户看的名称
+    'lang' => '刊物设置',
+    # 后台菜单排序
+    'order' => 9,
+    'end' => array
+    (
+        'update' => array
+        (
+            'passport/lib/manage.updateSystem',
+            'manage/top.sync',
+        ),
+        'insert' => array
+        (
+            'passport/lib/manage.updateSystem',
+            'manage/top.sync',
+        )
+    ),
+    # 数据结构
+    '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,
+        ),
+
+        'type'     => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '内容类型-定义小刊下的内页内容类型',
+            'default'   => '1,2,3,4,5,6,11,12,13',
+            'desc'      => '内容类型',
+            'match'     => 'is_numeric',
+            'update'    => 'checkbox',
+            'option'    => $type,
+        ),
+
+        'journal_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '主推小刊',
+            'default'   => '',
+            'desc'      => '主推小刊',
+            'match'     => 'is_numeric',
+            'update'    => $id ? 'select' : 'hidden',
+            'update_search' => 'journal/lib/manage.search_journal?cate=' . $id,
+        ),
+
+        'title'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '页面title-公众号支付中的页面标题',
+            'default'   => '',
+            'desc'      => '页面title',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+           // 'list'      => true,
+        ),
+
+        'desc'     => array
+        (
+            'type'      => 'text-255',
+            'name'      => '简介',
+            'default'   => '',
+            'desc'      => '简介',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'cover'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '封面图-公众号支付中的封面图,图片尺寸460*759px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => '封面图',
+            'match'     => 'option',
+            'update'  => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+
+        'logo'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => 'logo图-当前分类的logo图,图片尺寸100*100px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => 'logo图',
+            'match'     => 'option',
+            'update'  => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+        
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'code_desc'     => array
+        (
+            'type'      => 'text-255',
+            'name'      => '兑换说明',
+            'default'   => '',
+            'desc'      => '兑换说明',
+            'match'     => 'option',
+            'update'    => 'editor',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '上线状态',
+            'default'   => '2',
+            'desc'      => '上线状态',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            '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,
+        'delete' => false,
+    ),
+
+    'top' => array
+    (
+        # 数据来源
+        'data' => 'state',
+        # 菜单名
+        'name' => '项目选择',
+        # 默认值
+        'value' => 1,
+        # 对应的字段值,设置这个之后,所有设置等于这个值的字段,都要遵循这个权限的控制
+        'key' => Dever::config('base')->top,
+        # 本表中代表名称的字段
+        'col' => 'name',
+    ),
+
+    'request' => array
+    (
+        'list' => $list,
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'state' => 1,
+                'status' => 2,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc','id' => 'desc'),
+            'col' => 'id,name,logo,journal_id',
+        ),
+
+        'getIds' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'ids' => array('yes-id', 'in'),
+                'status' => 2,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc','id' => 'desc'),
+            'col' => '*,id as value|id',
+        ),
+    ),
+);

+ 673 - 0
journal/database/content.php

@@ -0,0 +1,673 @@
+<?php
+
+$id = Dever::input('search_option_info_id');
+$cate = array();
+if ($id) {
+    $journal = Dever::db('journal/info')->one($id);
+    $cate = Dever::db('journal/cate')->one($journal['cate_id']);
+}
+
+$type_config = array
+(
+    # 默认类型
+    3 => '图文内容',
+    1 => '全屏图',
+    
+    # 2019-03-27 增加两个类型
+    7 => '长图(文字)',
+    8 => '横屏图',
+
+    2 => '长图',
+    9 => '无边框图片',
+    10 => '四宫格图片',
+
+    # 2018-12-11 增加3个类型
+    4 => '全屏视频',
+    5 => '留言视频',
+    6 => '留言音频',
+
+    # 2019-03-27 增加三个类型
+    21 => '对话模板',
+
+    # 关联类型 > 10
+    //11 => '关联图文',
+    //12 => '关联视频',
+    //13 => '关联直播',
+);
+
+$type_default = 3;
+
+if ($cate) {
+    $type = array();
+    $cate_type = explode(',', $cate['type']);
+    $i = 0;
+    foreach ($cate_type as $k => $v) {
+        if (isset($type_config[$v])) {
+            if ($i == 0) {
+                $type_default = $v;
+            }
+            $type[$v] = $type_config[$v];
+            $i++;
+        }
+    }
+} else {
+    $type = $type_config;
+}
+
+$is_button = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
+
+$text = array
+(
+    1 => '上左',
+    2 => '上中',
+    3 => '上右',
+    4 => '中左',
+    5 => '正中',
+    6 => '中右',
+    7 => '下左',
+    8 => '下中',
+    9 => '下右',
+    //10 => '自定义',
+);
+
+
+$palaces = array
+(
+    1 => '上左',
+    2 => '上右',
+    3 => '下左',
+    4 => '下右',
+);
+
+$bgcolor_type = array
+(
+    1 => '设置背景颜色',
+    2 => '不设置背景颜色',
+);
+$talk_type = array
+(
+    1 => '文字',
+    2 => '图片',
+    3 => '音频',
+);
+
+$talk_location = array
+(
+    1 => '显示在左侧',
+    2 => '显示在右侧',
+);
+
+$author = function()
+{
+    $array = array();
+    $info = Dever::db('content/author')->state();
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
+return array
+(
+    # 表名
+    'name' => 'content',
+    # 显示给用户看的名称
+    'lang' => '内页管理',
+    'menu' => false,
+    'gettype' => $type,
+    'text' => $text,
+    'end' => array
+    (
+        'insert' => 'journal/lib/manage.addContent',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'search'    => 'order',
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'type'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '类型',
+            'default'   => $type_default,
+            'desc'      => '类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'control'   => 'type',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '标题',
+            'default'   => '',
+            'desc'      => '标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+            //增加预览
+            'preview'   => true,
+            'show'      => 'type=3,5,6',      
+        ),
+
+        'video'     => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '上传视频-视频格式mp4,上传大小不能超过4G',
+            'default'   => '',
+            'desc'      => '上传点播视频',
+            'match'     => 'is_string',
+            'update'    => 'upload',
+            'key'       => '3',
+            'place'     => '150',
+            'upload'    => 'qiniu',
+            'large'     => true,
+            //不覆盖原文件,生成新文件
+            'cover'     => 2,
+            'show'      => 'type=4,5',      
+        ),
+
+        'video_info'        => array
+        (
+            'type'      => 'text-255',
+            'name'      => '视频信息',
+            'default'   => '',
+            'desc'      => '视频信息',
+            'match'     => 'is_string',
+        ),
+
+        'music'     => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '上传音频-视频格式mp3,上传大小不能超过100M',
+            'default'   => '',
+            'desc'      => '上传音频',
+            'match'     => 'is_string',
+            'update'    => 'upload',
+            'key'       => '2',
+            'place'     => '150',
+            'upload'    => 'qiniu',
+            'large'     => true,
+            //不覆盖原文件,生成新文件
+            'cover'     => 2,
+            'show'      => 'type=6',      
+        ),
+
+        'cover'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '封面图-全屏视频的封面图图片尺寸750*1386px或等比尺寸,留言视频的封面图图片尺寸750*422px或等比尺寸,留言音频的封面图图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => '封面图',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+            'show'      => 'type=4,5,6',      
+        ),
+
+        'focus'     => array
+        (
+            'type'      => 'text-255',
+            'name'      => '焦点图',
+            'default'   => '',
+            'desc'      => '焦点图',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+            'show'      => 'type=3',      
+        ),
+
+        'author_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '作者',
+            'default'   => '1',
+            'desc'      => '作者',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $author,
+            //'search'    => 'select',
+            'show'      => 'type=3',      
+        ),
+
+        'content'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容',
+            'default'   => '',
+            'desc'      => '请输入内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            'show'      => 'type=3',
+            //自定义编辑器右侧按钮
+            'editor'    => array
+            (
+                'name' => '选择插入模块',
+                'button' => array
+                (
+                    array
+                    (
+                        # 名称
+                        'name' => '图片',
+                        # 资源库id
+                        'key' => 1,
+                        # 类型
+                        'type' => 'image',
+                    ),
+                    array
+                    (
+                        'name' => '音频',
+                        'key' => 2,
+                        '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',
+                    ),
+                ),
+            ),
+        ),
+
+        'pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '图片-全屏图图片尺寸750*1386px或等比尺寸,长屏图图片尺寸750*高度不限或等比尺寸,横屏图图片尺寸宽度不限*1386px或等比尺寸,长图图片尺寸750*高度不限或等比尺寸,无边框图片尺寸长和宽均没有限制,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => '图片',
+            'match'     => 'option',
+            'update'  => 'image',
+            'key'       => '1',
+            'place'     => '150',
+            'show'      => 'type=1,2,7,8,9',      
+        ),
+
+        'pic_info'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '图片信息',
+            'default'   => '',
+            'desc'      => '图片信息',
+            'match'     => 'is_string',
+            'update'    => 'hidden',
+        ),
+
+        'is_button'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '是否显示保存按钮',
+            'default'   => '1',
+            'desc'      => '是否显示保存按钮',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $is_button,
+           // 'search'    => 'select',
+            'show'      => 'type=1,7,8',      
+            'control'   => 'is_button',
+        ),
+
+        'button_name'     => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '保存按钮文字内容',
+            'default'   => '保存图片',
+            'desc'      => '保存按钮文字内容',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            'show'      => 'type=1,7,8',      
+        ),
+
+        'button_color'     => array
+        (
+            'type'      => 'varchar-10',
+            'name'      => '保存按钮文字颜色',
+            'default'   => '#000000',
+            'desc'      => '保存按钮文字颜色',
+            'match'     => 'option',
+            'update'    => 'color',
+            'show'      => 'type=1,7,8',      
+        ),
+
+        'article_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联图文',
+            'default'   => '',
+            'desc'      => '关联图文',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=11',
+            'update_search' => 'journal/lib/manage.search_article',
+        ),
+
+        'vod_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联视频',
+            'default'   => '',
+            'desc'      => '关联视频',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=12',
+            'update_search' => 'journal/lib/manage.search_vod',
+        ),
+
+        'live_id'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联直播',
+            'default'   => '',
+            'desc'      => '关联直播',
+            'match'     => 'option',
+            'update'    => 'select',
+            'show'      => 'type=13',
+            'update_search' => 'journal/lib/manage.search_live',
+        ),
+
+        'text'       => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '文字设置',
+            'default'   => '',
+            'desc'      => '文字设置',
+            'match'     => 'is_string',
+            'option'    => $text,
+            'show'      => 'type=1,7,8',
+            'update'    => array
+            (
+                array
+                (
+                    'col'       => 'name',
+                    'name'      => '文字内容',
+                    'default'   => '',
+                    'desc'      => '文字内容',
+                    'match'     => 'is_string',
+                    'update'    => 'textarea',
+                ),
+
+                array
+                (
+                    'col'       => 'color',
+                    'name'      => '文字颜色',
+                    'default'   => '#000000',
+                    'desc'      => '文字颜色',
+                    'match'     => 'is_string',
+                    'update'    => 'color',
+                ),
+
+                array
+                (
+                    'col'       => 'bgcolor_type',
+                    'name'      => '是否设置背景颜色',
+                    'default'   => '2',
+                    'desc'      => '是否设置背景颜色',
+                    'match'     => 'is_string',
+                    'update'    => 'radio',
+                    'option'    => $bgcolor_type,
+                    'control'   => 'bgcolor_type',
+                ),
+
+                array
+                (
+                    'col'       => 'bgcolor',
+                    'name'      => '背景颜色',
+                    'default'   => '#000000',
+                    'desc'      => '背景颜色',
+                    'match'     => 'is_string',
+                    'update'    => 'color',
+                    'show'      => 'bgcolor_type=1'
+                ),
+
+                array
+                (
+                    'col'       => 'size',
+                    'name'      => '文字大小-直接输入像素数字',
+                    'default'   => '16',
+                    'desc'      => '结果描述',
+                    'match'     => 'is_numeric',
+                    'update'    => 'text',
+                ),
+            ),
+        ),
+
+        'palaces'       => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '四宫格图片',
+            'default'   => '',
+            'desc'      => '四宫格图片',
+            'match'     => 'is_string',
+            'option'    => $palaces,
+            'show'      => 'type=10',
+            'update'    => array
+            (
+                array
+                (
+                    'col'       => 'pic',
+                    'name'      => '图片',
+                    'default'   => '',
+                    'desc'      => '图片',
+                    'match'     => 'is_string',
+                    'update'    => 'image',
+                    'key'       => 1,
+                ),
+            ),
+        ),
+
+        'talk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '置顶图片-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式。为空则不显示',
+            'default'   => '',
+            'desc'      => '图片',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+            'show'      => 'type=21',      
+        ),
+
+        'talk'       => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '对话设置',
+            'default'   => '',
+            'desc'      => '对话设置',
+            'match'     => 'is_string',
+            'show'      => 'type=21',
+            'update'    => array
+            (
+                array
+                (
+                    'col'       => 'talk_location',
+                    'name'      => '对话位置',
+                    'default'   => '1',
+                    'desc'      => '对话位置',
+                    'match'     => 'is_string',
+                    'update'    => 'radio',
+                    'option'    => $talk_location,
+                ),
+
+                array
+                (
+                    'col'       => 'avatar',
+                    'name'      => '头像-图片尺寸120*120px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式。',
+                    'default'   => '',
+                    'desc'      => '头像',
+                    'match'     => 'option',
+                    'update'    => 'image',
+                    'key'       => 1,
+                ),
+
+                array
+                (
+                    'col'       => 'talk_type',
+                    'name'      => '对话类型',
+                    'default'   => '1',
+                    'desc'      => '对话类型',
+                    'match'     => 'is_string',
+                    'update'    => 'radio',
+                    'option'    => $talk_type,
+                    'control'   => 'talk_type',
+                ),
+
+                array
+                (
+                    'col'       => 'text',
+                    'name'      => '文字内容-为空则不显示',
+                    'default'   => '',
+                    'desc'      => '文字内容',
+                    'match'     => 'option',
+                    'update'    => 'textarea',
+                    'show'      => 'talk_type=1'
+                ),
+
+                array
+                (
+                    'col'       => 'pic',
+                    'name'      => '图片-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,可以上传GIF格式。为空则不显示',
+                    'default'   => '',
+                    'desc'      => '图片',
+                    'match'     => 'option',
+                    'update'    => 'image',
+                    'key'       => 1,
+                    'show'      => 'talk_type=2'
+                ),
+
+                array
+                (
+                    'col'       => 'audio',
+                    'name'      => '音频-音频格式mp3,上传大小不能超过100M,为空则不显示',
+                    'default'   => '',
+                    'desc'      => '音频',
+                    'match'     => 'option',
+                    'update'    => 'upload',
+                    'key'       => 2,
+                    'show'      => 'talk_type=3'
+                ),
+            ),
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '页号',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'asc',
+            '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,
+            //'search'    => 'date',
+            //'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'insert' => false,
+        'edit' => false,
+        //'delete' => false,
+        'num' => false,
+        'page_list_table' => 'journal',
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增内页' => array('location', 'add'),
+            '预览' => array('fast', 'main/preview.get?type=4&id=' . Dever::input('search_option_info_id')),
+        ),
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'asc', 'id' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
+        'getAllByReorder' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+    )
+);

+ 693 - 0
journal/database/info.php

@@ -0,0 +1,693 @@
+<?php
+$time = (7*86400);
+$audit = Dever::config('base')->audit;
+
+$status = Dever::config('base')->status;
+
+$share = function()
+{
+	$array = array();
+	$info = Dever::db('poster/template')->state();
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+# 获取小刊分类权限
+$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;
+};
+
+
+$share = array
+(
+	1 => '显示',
+	2 => '不显示',
+);
+
+$top = array
+(
+	1 => '显示',
+	2 => '不显示',
+);
+
+$buy = array
+(
+	1 => '收费',
+	2 => '免费',
+	//3 => '会员',
+);
+
+$hot = array
+(
+	1 => '热门',
+	2 => '普通',
+);
+
+
+$page = 15;
+
+# 常用的col
+$col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_view,num_ding,num_add_ding,num_ratio_ding,num_comment,num_up,buy,share_yes,share_title,share_pic,share_content,pic_gd,cate_id,cash,bgmusic,top,hot';
+
+$config = array
+(
+	# 表名
+	'name' => 'info',
+	# 显示给用户看的名称
+	'lang' => '发刊管理',
+	'order' => 100,
+	'end' => array
+	(
+		'insert' => 'journal/lib/manage.setJournalCache',
+		'update' => 'journal/lib/manage.setJournalCache',
+	),
+
+	# 同步更新另外一个或多个表的数据 小刊不需要同步到审核页面
+	/*
+	'syncone' => array
+	(
+		'audit/data' => array
+		(
+			# 更新另外一个表的字段 => 本表的字段
+			'where' => array('data_id' => 'id', 'type' => 4),
+			# 要更新的数据
+			'update' => array('data_id' => 'id', 'type' => 4, 'pdate' => 'pdate', 'reorder' => 'reorder', 'name' => 'name', 'audit' => 'audit', 'state' => 'state'),
+		)
+	),
+	*/
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-180',
+			'name' 		=> '小刊标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+
+		'subname'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '子标题-一般为杂志的期数,如第1期',
+			'default' 	=> '',
+			'desc' 		=> '子标题',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			//'list'		=> true,
+		),
+
+		'cate_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '小刊分类',
+			'default' 	=> '1',
+			'desc' 		=> '小刊分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $cate,
+			'search'	=> 'select',
+			//'list'		=> true,
+		),
+
+  		'pic_cover'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '列表页封面图-4:3比例的图片',
+			'default' 	=> '',
+			'desc' 		=> '列表封面图',
+			'match' 	=> 'is_string',
+			//'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
+		'pic_view_cover'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '封面图-图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '封面图',
+			'match' 	=> 'is_string',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
+		'pic_view_bg'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '全屏背景图-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '全屏背景图',
+			'match' 	=> 'is_string',
+			'update'	=> 'images',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
+		'pic_gd'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '小刊推广图-图片尺寸512*688px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+			'default' 	=> '',
+			'desc' 		=> '小刊推广图',
+			'match' 	=> 'is_string',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
+		'bgmusic'		=> array
+		(
+			'type' 		=> 'varchar-800',
+			'name' 		=> '背景音乐-音频格式mp3,上传大小不能超过100M',
+			'default' 	=> '',
+			'desc' 		=> '背景音乐',
+			'match' 	=> 'option',
+			'update'	=> 'upload',
+			'key' 		=> '2',
+			'place'		=> '150',
+			'upload'	=> 'qiniu',
+			'large' 	=> true,
+			//不覆盖原文件,生成新文件
+			'cover'		=> 2,
+		),
+
+		'num_ratio_ding'		=> array
+		(
+			'type' 		=> 'varchar-20',
+			'name' 		=> '订阅系数-系数不能小于等于0,支持两位小数,电子刊总订阅量=(用户当前订阅数+订阅基数)*订阅系数',
+			'default' 	=> '1',
+			'desc' 		=> '手动增加订阅系数',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+		),
+
+		'num_add_ding'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '订阅基数',
+			'default' 	=> '0',
+			'desc' 		=> '手动增加阅读数',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+		),
+
+		'num_ding'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '订阅数',
+			'default' 	=> '0',
+			'desc' 		=> '请填写订阅数',
+			'match' 	=> 'option',
+			'search'	=> 'order',
+			//'list'		=> '{num_view}+{num_add_view}',
+		),
+
+		'num_add_view'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '阅读数基数-废弃',
+			'default' 	=> '0',
+			'desc' 		=> '手动增加阅读数',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+		),
+
+		'num_view'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '阅读数-废弃',
+			'default' 	=> '0',
+			'desc' 		=> '请填写阅读数',
+			'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'		=> 'Dever::load("journal/lib/manage.ding?id={id}")',
+			'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',
+		),
+
+		'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,
+		),
+
+		'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',
+		),
+
+		'ydate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '预售时间',
+			'match' 	=> 'option',
+			'default'	=> '',
+			'desc' 		=> '',
+			//'update'	=> 'date',
+			'callback'	=> 'maketime',
+			//'insert'	=> true,
+			//'list'		=> 'date("Y-m-d H:i:s", {pdate})',
+			//'auth'		=> '"{ydate}" > 0',
+		),
+
+		'top'		=> array
+		(
+			'type' 		=> 'tinyint-11',
+			'name' 		=> '是否显示排行榜',
+			'default' 	=> '1',
+			'desc' 		=> '是否显示排行榜',
+			'match' 	=> 'option',
+			'update'	=> 'radio',
+			'option'	=> $top,
+			'list'		=> true,
+			'search'	=> 'select',
+			'edit'		=> true,
+		),
+
+		'buy'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '是否收费',
+			'default' 	=> '1',
+			'desc' 		=> '是否收费',
+			'match' 	=> 'option',
+			'update'	=> 'radio',
+			'option'	=> $buy,
+			'control'	=> 'buy',
+			//'list'		=> true,
+			'search'	=> 'select',
+		),
+
+		'hot'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '是否热门电子刊',
+			'default' 	=> '2',
+			'desc' 		=> '是否热门电子刊',
+			'match' 	=> 'option',
+			'update'	=> 'radio',
+			'option'	=> $hot,
+			'search'	=> 'select',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'cash'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '单本支付价格-实际的小刊单本支付价格,单位元,直接填写数字即可',
+            'default'   => '',
+            'desc'      => '支付价格',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'show'		=> 'buy=1',
+        ),
+
+		'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',
+		),
+
+		'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' 		=> '',
+		),
+
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+		),
+	),
+
+	'top' => Dever::config('base')->top,
+
+	# 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info');
+	'top_option' => array
+	(
+		array
+		(
+			'value' => $auth,
+			'col' => 'cate_id',
+		),
+		array
+		(
+			'value' => Dever::load('manage/auth.authData'),
+			'col' => 'id',
+		),
+	),
+	
+	# 管理功能
+	'manage' => array
+	(
+		//'insert' => false,
+		'delete' => false,
+		# 列表
+		'list_button' => array
+		(
+			'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
+			'edit1' => array('活动预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=13')), '{audit} == 1 && {buy} == 1'),
+			'br2' => array('<br />'),
+			'list10' => array('排行榜', '"journal_num&project=act&search_type=4&search_option_journal_id={id}&oper_parent=info&oper_project=journal"' , '{audit} == 1 && {buy} == 1'),
+			//'list11' => array('邀请排行', '"invite&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"'),
+			'br1' => array('<br />'),
+			'list' => array('内页管理', '"content&search_option_info_id={id}&oper_parent=info&page_type=1"' , '{audit} == 1'),
+			'br2' => array('<br />'),
+			'add' => array('购买设置', '"buy&project=journal&search_option_info_id={id}&oper_parent=info&oper_project=journal&oper_save_jump=info&where_id={id}"', '{audit} == 1 && {buy} == 1'),
+			'add1' => array('活动设置', '"active&project=journal&search_option_info_id={id}&oper_parent=info&oper_project=journal&oper_save_jump=info&where_id={id}"', '{audit} == 1 && {buy} == 1'),
+			'br3' => array('<br />'),
+			'list1' => array('购买本数管理', '"buy_num&search_option_info_id={id}&oper_parent=info"' , '{audit} == 1 && {buy} == 1'),
+		),
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+
+		'search' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'cate_id' => 'yes',
+				'name' => array('yes', 'like'),
+				'id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'limit' => '0,1000',
+			'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
+		),
+
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				//'audit' => 2,
+				'buy' => 'yes',
+				'cate_id' => 'yes',
+				'status' => 2,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			//'page' => array(10, 'list'),
+			'col' => $col,
+		),
+
+		'getAllByPage' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				//'audit' => 2,
+				'cate_id_1' => array('yes-cate_id', '=', 'and('),
+				'time' => array('yes-pdate', '<=', 'or)'),
+				'buy' => 'yes',
+				'cate_id' => 'yes',
+				'status' => 2,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'page' => array(10, 'list'),
+			'col' => $col,
+		),
+		
+		# 更新浏览量
+		'addView' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_view' => array('1', '+='),
+			),
+		),
+
+		# 更新订阅量
+		'addDing' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_up' => array('1', '+='),
+			),
+		),
+
+		'getIds' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'cate_id' => array('yes-cate_id', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc','id' => 'desc'),
+            'col' => '*,id as value|id',
+        ),
+
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => $col,
+        ),
+
+        'getNew' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+            	'cate_id_1' => array('yes-cate_id', '=', 'and('),
+				'time' => array('yes-pdate', '<=', 'or)'),
+				'cate_id' => 'yes',
+            	'status' => 2,
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('ssdate' => 'desc'),
+            'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate',
+        ),
+	),
+);
+
+/* 由top_option取代
+if ($auth) {
+	$config['request']['list'] = array
+	(
+		'type' => 'all',
+        'order' => array('id' => 'desc'),
+        'col' => '*|id',
+        'page' => array(15, 'list'),
+        'option' => array
+        (
+        	'cate_id' => array($auth, 'in'),
+        ),
+	);
+}
+*/
+
+return $config;

+ 99 - 0
journal/database/mobile.php

@@ -0,0 +1,99 @@
+<?php
+
+$product = function()
+{
+    return Dever::db('journal/info')->state();
+};
+
+return array
+(
+    # 表名
+    'name' => 'mobile',
+    # 显示给用户看的名称
+    'lang' => '电子刊导入用户',
+    'order' => 1,
+    'menu' => false,
+
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '手机号',
+            'default'   => '',
+            'desc'      => '手机号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'        => true,
+            //'list'        => '"{order_id}" ? "{order_id}" : "{code}"',
+        ),
+
+        'product_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊',
+            'default'   => '',
+            'desc'      => '小刊',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $product,
+            'search'    => 'select',
+            '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'   => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            'list'        => 'date("Y-m-d H:i:s", {cdate})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+    ),
+
+    'manage' => array
+    (
+        //'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            '导入用户' => array('fast', 1, 'mobile_upload&where_id=1'),
+            '下载导入模板' => array('location', 'journal/lib/manage.mobileTemplate'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 57 - 0
journal/database/mobile_upload.php

@@ -0,0 +1,57 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'mobile_upload',
+	# 显示给用户看的名称
+	'lang' => '导入用户',
+	'order' => 1,
+	'menu' => false,
+	'end' => array
+	(
+		'update' => 'journal/lib/manage.mobileImport',
+		'insert' => 'journal/lib/manage.mobileImport',
+	),
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '系统ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'value'		=> Dever::input('where_id'),
+		),
+
+		'file'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '导入用户-请先下载模板',
+			'default' 	=> '',
+			'desc' 		=> '导入用户',
+			'match' 	=> 'is_string',
+			'update'	=> 'upload',
+			'key' 		=> '4',
+			'value'		=> '',
+		),
+
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+		),
+	),
+
+	'manage' => array
+	(
+		# 后台管理不要列表页
+		'list' => 'update',
+	),
+);

+ 8 - 0
journal/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'journal');
+define('DEVER_APP_LANG', '电子刊');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 190);
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-tower layui-icon-cellphone-fine');
+include(DEVER_APP_PATH . '../boot.php');

+ 549 - 0
journal/lib/Manage.php

@@ -0,0 +1,549 @@
+<?php
+
+namespace Journal\Lib;
+
+use Dever;
+
+class Manage
+{
+    public function getManageData()
+    {
+        $data = array();
+
+        $data = Dever::db('journal/cate')->state();
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['child'] = Dever::db('journal/info')->state(array('cate_id' => $v['id']));
+            }
+        }
+        return $data;
+    }
+
+    public function showOrderUser($id)
+    {
+        $info = Dever::db('journal/order')->one($id);
+
+        $table = array();
+
+        $user = Dever::db('passport/user')->one($info['uid']);
+
+        $table['用户名'] = $user['username'] . '('.$info['uid'].')';
+        $table['手机号'] = $user['mobile'];
+        $table['产品名'] = $info['name'];
+        if ($info['type'] == 1) {
+            $table['支付方式'] = '购买小刊';
+            $table['支付金额'] = $info['cash'];
+        } elseif ($info['type'] == 3) {
+            $table['支付方式'] = '购买小刊兑换码';
+            $table['兑换码'] = $info['code'];
+            $table['支付金额'] = $info['cash'];
+        } elseif ($info['type'] == 2) {
+            $table['支付方式'] = '兑换小刊';
+            $table['兑换码'] = $info['code'];
+        } elseif ($info['type'] == 4) {
+            $table['支付方式'] = '使用通用兑换码';
+            $table['兑换码'] = $info['code'];
+        }
+        //$table['购买数量'] = $info['num'];
+        
+        if ($info['source_uid'] && $info['source_uid'] != $info['uid']) {
+            $user = Dever::db('passport/user')->one($info['source_uid']);
+            $table['邀请人'] = $user['username'];
+        }
+
+        return Dever::table($table);
+    }
+
+    public function showOrderUserV1($id)
+    {
+        $info = Dever::db('act/order')->one($id);
+
+        $table = array();
+
+        $user = Dever::db('passport/user')->one($info['uid']);
+
+        $table['用户名'] = $user['username'] . '('.$info['uid'].')';
+        $table['手机号'] = $user['mobile'];
+        $table['产品名'] = $info['name'];
+        if ($info['type'] == 1) {
+            $table['支付方式'] = '购买小刊';
+            $table['支付金额'] = $info['cash'];
+        } elseif ($info['type'] == 3) {
+            $table['支付方式'] = '购买小刊兑换码';
+            $table['兑换码'] = $info['code'];
+            $table['支付金额'] = $info['cash'];
+        } elseif ($info['type'] == 2) {
+            $table['支付方式'] = '兑换小刊';
+            $table['兑换码'] = $info['code'];
+        } elseif ($info['type'] == 4) {
+            $table['支付方式'] = '使用通用兑换码';
+            $table['兑换码'] = $info['code'];
+        }
+        //$table['购买数量'] = $info['num'];
+        
+        if ($info['source_uid'] && $info['source_uid'] != $info['uid']) {
+            $user = Dever::db('passport/user')->one($info['source_uid']);
+            $table['邀请人'] = $user['username'];
+        }
+
+        return Dever::table($table);
+    }
+
+    # 获取订阅本数
+    public function ding($id)
+    {
+        $data = Dever::db('journal/info')->one($id);
+        $data = Dever::load('journal/api')->ding($data);
+
+        $num_ding = $data['num_ding'];
+        $num_add_ding = $data['num_add_ding'];
+        $num_ratio_ding = $data['num_ratio_ding'];
+
+        $num_view = $data['num_view'];
+        $num_add_view = $data['num_add_view'];
+        $num_comment = $data['num_comment'];
+
+        $buy_num = $data['buy_num'];
+
+        //$html = '订阅本数:('.$buy_num.'+'.$num_add_ding.')*'.$num_ratio_ding.'='.$num_ding.'<br />阅读数:'.$num_view.'+'.$num_add_view.'<br />评论数:'.$num_comment.'<br />';
+
+        $cate = Dever::db('journal/cate')->one($data['cate_id']);
+        $html = '《' . $cate['name'] . '》<br />';
+
+        if ($data['buy'] == 1) {
+            $html .= '<font style="color:red">收费电子刊</font><br />';
+            $html .= '订阅本数:('.$buy_num.'+'.$num_add_ding.')*'.$num_ratio_ding.'='.$num_ding;
+        } else {
+            $html .= '<font style="color:blue">免费电子刊</font><br />';
+            $html .= '订阅数:('.$buy_num.'+'.$num_add_ding.')*'.$num_ratio_ding.'='.$num_ding;
+        }
+        
+        return $html;
+    }
+
+    public function showOrderStatus($id)
+    {
+        $info = Dever::db('journal/order')->one($id);
+        if ($info) {
+            if ($info['status'] == 1) {
+                #return '*已支付';
+                return '待支付';
+            } elseif ($info['status'] == 2) {
+                return '已支付';
+            } elseif ($info['status'] == 3) {
+                return '支付失败';
+            } elseif ($info['status'] == 5) {
+                $table['状态'] = '已退款';
+                $manage = Dever::db('manage/admin')->one($info['tk_admin']);
+                $table['备注'] = $info['tk_desc'];
+                $table['截图'] = '<a><img src="'.$info['tk_pic'].'" style="width:150px" /></a>';
+                //$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
+                $table['操作人'] = $manage['username'];
+                return Dever::table($table);
+            }
+        }
+    }
+
+    public function showOrderStatusV1($id)
+    {
+        $info = Dever::db('act/order')->one($id);
+        if ($info) {
+            if ($info['status'] == 1) {
+                #return '*已支付';
+                return '待支付';
+            } elseif ($info['status'] == 2) {
+                return '已支付';
+            } elseif ($info['status'] == 3) {
+                return '支付失败';
+            } elseif ($info['status'] == 5) {
+                $table['状态'] = '已退款';
+                $manage = Dever::db('manage/admin')->one($info['tk_admin']);
+                $table['备注'] = $info['tk_desc'];
+                $table['截图'] = '<a><img src="'.$info['tk_pic'].'" style="width:150px" /></a>';
+                //$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
+                $table['操作人'] = $manage['username'];
+                return Dever::table($table);
+            }
+        }
+    }
+
+	private function search($table = 'content/article')
+	{
+		$keyword = Dever::input('keyword');
+
+        $yes = Dever::input('yes');
+
+        $where = array();
+
+        $cate = Dever::input('cate');
+        if ($cate) {
+            $where['cate_id'] = $cate;
+        }
+
+        if ($yes) {
+            $yes = Dever::db($table)->search(array('ids' => $yes));
+        }
+        if (!$keyword) {
+            $where['limit'] = '0,50';
+            $data = Dever::db($table)->search($where);
+        } else {
+            $where['name'] = $keyword;
+            $data = Dever::db($table)->search($where);
+        }
+
+        $result = array();
+        if ($yes) {
+            foreach ($yes as $k => $v) {
+                if (isset($data[$k])) {
+                    unset($data[$k]);
+                }
+                $yes[$k]['selected'] = 'selected';
+            }
+            $data = $yes + $data;
+
+            $data = array_merge($data, array());
+        } else {
+            $data = array_merge($data, array());
+        }
+
+        if (!$data) {
+            Dever::alert('暂无数据');
+        }
+
+        return $data;
+	}
+
+	# 搜索文章
+    public function search_article_api()
+    {
+        return $this->search('content/article');
+    }
+
+    # 搜索视频
+    public function search_vod_api()
+    {
+        return $this->search('video/vod');
+    }
+
+    # 搜索直播
+    public function search_live_api()
+    {
+        return $this->search('video/live');
+    }
+
+    # 搜索小刊
+    public function search_journal_api()
+    {
+        return $this->search('journal/info');
+    }
+
+    # 搜索专题
+    public function search_feature_api()
+    {
+        return $this->search('feature/info');
+    }
+
+    # 搜索小程序
+    public function search_applet_api()
+    {
+        return $this->search('content/applet');
+    }
+
+    # 按照分类搜索小刊
+    public function search_cate_journal_api()
+    {
+        $level_num = Dever::input('level_num');
+        $level_id = Dever::input('level_id');
+        
+        $auth = Dever::tops();
+        $where = array();
+        if ($level_num == 1) {
+            $default = array
+            (
+                'value' => -1,
+                'name' => '选择分类',
+            );
+            if ($auth) {
+                $where['ids'] = $auth;
+            }
+
+            $data = Dever::db('journal/cate')->getIds($where);
+        } elseif ($level_num == 2 && $level_id > 0) {
+            $default = array
+            (
+                'value' => -1,
+                'name' => '选择小刊',
+            );
+            if ($level_id > 0) {
+                $where['cate_id'] = $level_id;
+            } elseif ($auth) {
+                $where['cate_id'] = $auth;
+            }
+            
+            $data = Dever::db('journal/info')->getIds($where);
+        } else {
+            return array();
+        }
+
+        
+        array_unshift($data, $default);
+        $result['level_total'] = 2;
+        $result['list'] = $data;
+        return $result;
+    }
+
+    # 显示杂志内页
+    public function journalContent()
+    {
+        $where['info_id'] = Dever::input('search_option_info_id');
+        $where['state'] = Dever::input('search_option_state');
+        $data = Dever::db('journal/content')->all($where);
+
+        $database = Dever::load('manage/database');
+        $type = Dever::db('journal/content')->config['gettype'];
+        
+        if ($data) {
+            foreach ($data as $k => $v) {
+
+                $data[$k]['height'] = 'height: 154px;';
+                $data[$k]['info_height'] = 'height: auto;';
+                if ($v['type'] > 2) {
+                    $data[$k]['height'] = 'height: 104px;';
+                    $data[$k]['info_height'] = 'height: 47px;';
+                }
+                if ($v['type'] <= 2) {
+                    $data[$k]['name'] = '';
+                } elseif ($v['type'] == 3) {
+                    $data[$k]['pic'] = $v['focus'];
+                }
+
+                if ($v['type'] == 4 || $v['type'] == 5 || $v['type'] == 6) {
+                    $data[$k]['name'] = '';
+                    $data[$k]['pic'] = $v['cover'];
+                }
+
+                if ($v['type'] == 11) {
+                    # 图文
+                    $info = Dever::load('content/lib/article')->get($v['article_id']);
+                    if ($info) {
+                        $data[$k]['pic'] = $info['pic_cover'];
+                        $data[$k]['name'] = $info['name'];
+                    }
+                } elseif ($v['type'] == 12) {
+                    # 视频
+                    $info = Dever::load('video/lib/vod')->get($v['vod_id']);
+                    if ($info) {
+                        $data[$k]['pic'] = $info['pic_cover'];
+                        $data[$k]['name'] = $info['name'];
+                    }
+                } elseif ($v['type'] == 13) {
+                    # 直播
+                    $info = Dever::load('video/lib/live')->get($v['live_id']);
+                    if ($info) {
+                        $data[$k]['pic'] = $info['pic_cover'];
+                        $data[$k]['name'] = $info['name'];
+                    }
+                }
+
+                if ($v['type'] == 10) {
+                    $palaces = Dever::array_decode($v['palaces']);
+                    if (isset($palaces[0])) {
+                        $data[$k]['pic'] = $palaces[0]['pic'];
+                    }
+                }
+
+                if ($v['type'] == 21) {
+                    if ($data[$k]['talk_pic']) {
+                        $data[$k]['pic'] = $data[$k]['talk_pic'];
+                    } else {
+                        $talk = Dever::array_decode($v['talk']);
+                        if ($talk) {
+                            foreach ($talk as $tk => $tv) {
+                                if ($tv['pic']) {
+                                    $data[$k]['pic'] = $tv['pic'];
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+
+                $data[$k]['typename'] = $type[$v['type']];
+
+                /*
+                if ($v['type'] == 1) {
+                    $data[$k]['text'] = $this->text($database, $v['id'], $where['info_id']);
+                } else {
+                    $data[$k]['text'] = '';
+                }
+                */
+                $data[$k]['text'] = '';
+
+                $link = $database->url('edit', $v['id']) . '&search_option_info_id=' . $where['info_id'];
+
+                $data[$k]['edit'] = "fastEdit($(this), '".$link."', '编辑内页', '', 1)";
+
+                $data[$k]['editurl'] = $link;
+
+                $data[$k]['delete'] = $database->url('delete', $v['id']);
+            }
+        }
+
+        return $data;
+    }
+
+    private function text_name($link, $content_id, $info_id, $location, $name)
+    {
+        $where['info_id'] = $info_id;
+        $where['content_id'] = $content_id;
+        $where['location'] = $location;
+        $info = Dever::db('journal/content_text')->one($where);
+
+        $link .= '&search_option_info_id=' . $info_id. '&search_option_content_id=' . $content_id.'&table=content_text&search_option_location='.$location;
+
+        if ($info) {
+            $link .= '&where_id=' . $info['id'];
+        }
+
+        $html = '<a style="cursor:pointer;" href="javascript:;" onclick="fastEdit($(this), \''.$link.'\', \'编辑'.$name.'文字\', \'\')">'.$name.'</a>';
+
+        return $html;
+    }
+
+    public function text($database, $content_id, $info_id)
+    {
+        $link = $database->url('edit');
+
+        $location = Dever::db('journal/content_text')->config['location'];
+
+        $html = '<table class="layui-table"><tbody><tr>';
+        $i = 0;
+        foreach ($location as $k => $v) {
+            $name = $this->text_name($link, $content_id, $info_id, $k, $v);
+            $html .= '<td>'.$name.'</td>';
+
+            if ($i == 2 || $i == 5) {
+                $html .= '</tr><tr>';
+            }
+
+            $i++;
+        }
+
+        $html .= '</tr></tbody></table>';
+
+        return $html;
+    }
+
+    public function updateJournalContent_api()
+    {
+        $data = Dever::input('data');
+
+        if ($data) {
+            $data = explode(',', str_replace('data-', '', $data));
+            foreach ($data as $k => $v) {
+                $k = $k + 1;
+                $where['where_id'] = $v;
+                $where['reorder'] = $k;
+                Dever::db('journal/content')->update($where);
+            }
+
+        }
+
+        return $data;
+    }
+
+    public function addContent($id, $name, $data)
+    {
+        # 获取最新的reorder
+        $info_id = Dever::param('info_id', $data);
+        $data = Dever::db('journal/content')->getAllByReorder(array('info_id' => $info_id));
+
+        if ($data) {
+            $update['where_id'] = $id;
+            $update['reorder'] = $data['reorder'] + 1;
+            Dever::db('journal/content')->update($update);
+        }
+    }
+
+    public function getName($id)
+    {
+        $info = Dever::db('journal/buy_num')->one($id);
+        if ($info && $info['name']) {
+            return $info['name'];
+        } else {
+            return '购买' . $info['num'] . '本';
+        }
+    }
+
+    public function getPrice($id)
+    {
+        $info = Dever::db('journal/buy_num')->one($id);
+
+        $journal = Dever::db('journal/info')->one($info['info_id']);
+        if ($info && $info['price']) {
+            return $info['price'];
+        } else {
+            return $info['num'] * $journal['cash'] . '元';
+        }
+    }
+
+    public function mobileTemplate_api()
+    {
+        $host = 'http://' . $_SERVER['HTTP_HOST'] . '/wonderful/';
+        $file = $host . 'doc/mobile.xlsx';
+
+        Dever::location($file);
+    }
+
+    public function setJournalCache($id, $name, $param)
+    {
+        Dever::load('act/order')->setCache($id, 1);
+    }
+
+    public function setBuyCache($id, $name, $param)
+    {
+        Dever::load('act/order')->setCache($id, 2);
+    }
+
+    public function setActiveCache($id, $name, $param)
+    {
+        Dever::load('act/order')->setCache($id, 3);
+    }
+
+    /**
+     * 导入用户
+     *
+     * @return mixed
+     */
+    public function mobileImport($id, $name, $param)
+    {
+        $file = Dever::param('file', $param);
+        if ($file) {
+            $file = str_replace('wonderful', 'upload', Dever::local($file));
+            $file = str_replace('https://api.huoxingkandiqiu.com/', '/www/', $file);
+            //$file = '/www/upload/data/upload/4/2019/04/11/f730437f0b5764790baed3c96c5264b2.xlsx';
+            $data = Dever::excelImport($file);
+            if ($data) {
+                foreach ($data as $k => $v) {
+                    if ($k > 1) {
+                        if (isset($v['A']) && isset($v['B'])) {
+                            if ($v['A']) {
+                                $name = $v['A'];
+                            }
+                            
+                            $journal = Dever::db('journal/info')->one(array('name' => $name));
+                            if ($journal) {
+                                $info = Dever::db('journal/mobile')->one(array('product_id' => $journal['id'], 'mobile' => $v['B']));
+
+                                if (!$info) {
+                                    Dever::db('journal/mobile')->insert(array('product_id' => $journal['id'], 'mobile' => $v['B']));
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 224 - 0
journal/lib/Pay.php

@@ -0,0 +1,224 @@
+<?php
+namespace Journal\Lib;
+
+use Dever;
+
+class Pay
+{
+    private $key = 'jmss_2018';
+
+    
+    /*
+    public function go_api()
+    {
+        $where['code'] = 'null';
+        $where['type'] = 3;
+        $where['status'] = 2;
+        $data = Dever::db('act/order')->getUnCode($where);
+        echo Dever::sql();
+        if ($data) {
+            print_r($data);die;
+            foreach ($data as $k => $v) {
+                # 购买兑换码
+                $order = $v;
+                $product_num = 1;
+                $code_num = 1;
+                $uid = $order['uid'];
+                if ($order['buy_id'] > 0) {
+                    $buy = Dever::db('journal/buy_num')->one($order['buy_id']);
+                    $product_num = $buy['num'];
+                    $code_num = $buy['code'];
+                }
+                
+                if ($code_num > 1) {
+                    $product_num = intval($product_num/$code_num);
+                    for ($i = 0; $i < $code_num; $i++) {
+                        $update['code'] = Dever::load('code/lib/core')->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $uid, $order['order_id']);
+                    }
+                } else {
+                    $update['code'] = Dever::load('code/lib/core')->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $uid, $order['order_id']);
+                }
+
+                $update['where_id'] = $order['id'];
+                Dever::db('act/order')->update($update);
+            }
+        }
+    }
+
+
+    public function test_api()
+    {
+        $data['status'] = 1;
+        $this->order(1, 'test', $data);
+    }
+    */
+
+    # 退款操作
+    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);
+            $send['pay_project_id'] = 1;
+            $send['pay_uid'] = $info['uid'];
+            $send['pay_order_id'] = $info['order_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_status'] = $status;
+            $send['dever_token'] = $this->key;
+
+            # 减少积分
+
+            Dever::load('pay/lib/set.updateStatus', $send);
+        }
+    }
+
+	/**
+	 * 支付成功后,调取的接口 这里的安全以后再升级吧,升级成和pay/lib/set.updateStatus一样的
+	 *
+	 * @return mixed
+	 */
+	public function act_api($param = array())
+	{
+        $send = Dever::preInput('pay_');
+        $key = md5($this->key);
+        ksort($send);
+        $send['signature'] = md5($key . '&' . http_build_query($send));
+        $signature = Dever::input('signature');
+        if ($send['signature'] == $signature) {
+            $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'];
+
+            $order = Dever::db('act/order')->one(array('order_id' => $order_id, 'uid' => $uid));
+
+            if ($send['pay_status'] == 2 && $order) {
+                
+                $update = array();
+                $update['where_id'] = $order['id'];
+                $update['status'] = 2;
+                if ($order['type'] == 3 && !$order['code']) {
+                    $code = Dever::load('code/lib/core')->createCodeByOrder($order);
+                    if ($code) {
+                        $update['code'] = $code;
+                    }
+                }
+
+                /*
+                if ($order['type'] == 3 && !$order['code']) {
+                    # 购买兑换码
+                    $product_num = 1;
+                    $code_num = 1;
+                    if ($order['buy_id'] > 0) {
+                        $buy = Dever::db('journal/buy_num')->one($order['buy_id']);
+                        $product_num = $buy['num'];
+                        $code_num = $buy['code'];
+                    }
+                    
+                    if ($code_num > 1) {
+                        $product_num = intval($product_num/$code_num);
+                        for ($i = 0; $i < $code_num; $i++) {
+                            $update['code'] = Dever::load('code/lib/core')->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $uid, $order['order_id']);
+                        }
+                    } else {
+                        $update['code'] = Dever::load('code/lib/core')->createCode($order['cate_id'] . ',' . $order['product_id'], $order['cate_id'], $order['product_id'], $order['seller_id'], $product_num, $uid, $order['order_id']);
+                    }
+                }
+                */
+
+                Dever::db('act/order')->update($update);
+
+                if ($order['type'] != 1) {
+                    return;
+                }
+
+                # 订阅
+                Dever::load('act/lib/subscribe')->submit($uid, $order['product_id'], 1);
+
+                $score = false;
+                $num = false;
+                if ($order['buy_id'] > 0) {
+                    $info = Dever::db('journal/info')->one($order['product_id']);
+                    $buy = Dever::db('journal/buy_num')->one($order['buy_id']);
+                    if ($info && $buy && $info['score'] > 0) {
+                        $score = $buy['num'] * $info['score'];
+                    } elseif ($info && $buy) {
+                        $num = $buy['num'];
+                    }
+                }
+                Dever::score($uid, 'buy_journal', '购买小刊', 'act/lib/score.submit?method=pay&type=4&id=' . $order['product_id'], $score, $num);
+
+                # 发消息
+                $journal = Dever::db('journal/info')->one($order['product_id']);
+
+                if (Dever::project('message')) {
+                    Dever::load('message/lib/data')->push(-1, $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($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' => $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=' . 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);
+                    }
+                }
+
+            } else {
+                Dever::db('act/order')->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);
+            }
+        }
+    }
+}

+ 37 - 0
journal/src/Api.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace Journal\Src;
+
+use Dever;
+
+class Api
+{
+	public function data()
+	{
+		return Dever::db('journal/info')->state();
+	}
+
+	public function ding($data)
+    {
+        if (isset($data['num_add_ding']) && isset($data['num_ratio_ding'])) {
+
+            if ($data['buy'] == 1 && !$data['num_ding']) {
+                $stat = Dever::db('stat/journal')->getNumByJournal(array('journal_id' => $data['id']));
+                if (!$stat) {
+                    $stat['buy_num'] = 0;
+                }
+
+                if (!$stat['buy_num']) {
+                    $stat['buy_num'] = 0;
+                }
+                $data['num_ding'] = $stat['buy_num'];
+            }
+            
+            $data['num_ding'] = $data['num_ding'] + $data['num_up'];
+            $data['buy_num'] = $data['num_ding'];
+            $data['num_ding'] = round(($data['num_ding']+$data['num_add_ding'])*$data['num_ratio_ding']);
+        }
+
+        return $data;
+    }
+}

+ 71 - 0
journal/template/manage/journal.php

@@ -0,0 +1,71 @@
+<?php
+
+/*
+|--------------------------------------------------------------------------
+| home
+|--------------------------------------------------------------------------
+ */
+$view
+
+->fetch('.layui-fluid@test', '公告')
+
+->fetch('#url', 'var url="<{Dever::url("journal/lib/manage.updateJournalContent")}>"')
+
+->loop
+(
+    '.layui-col-md2',
+    'journal/lib/manage.journalContent',
+    array
+    (
+        'self' => array
+        (
+            'id' => 'data-<{$v.id}>',
+        ),
+        'b' => array
+        (
+            'html' => '<{date("Y/m/d", $v.cdate)}>',
+            'html' => '',
+        ),
+
+        '.img' => array
+        (
+            'style' => '<{$v.height}>',
+        ),
+
+        'img' => array
+        (
+            'src' => '<{$v.pic}>',
+            'width' => '150',
+        ),
+
+        '.info' => array
+        (
+            'html' => '<{Dever::cut($v.name, 20)}>',
+            'style' => '<{$v.info_height}>',
+        ),
+
+        '.edit' => array
+        (
+            //'onclick' => '<{$v.edit}>',
+            'href' => '<{$v.editurl}>',
+        ),
+
+        '.oper_delete' => array
+        (
+            'href' => '<{$v.delete}>',
+        ),
+
+        '.text' => array
+        (
+            'html' => '<{$v.text}>',
+        ),
+
+        'b' => array
+        (
+            'html' => '<{$v.typename}>',
+        ),
+    )
+)
+
+# display
+->display();

+ 7 - 0
main/assets/html/preview/article.html

@@ -0,0 +1,7 @@
+<div id="test"></div>
+
+<div class="layui-container">
+  <div class="layui-row">
+    ……
+  </div>
+</div>

+ 1 - 0
main/assets/html/preview/journal.html

@@ -0,0 +1 @@
+journal.html

+ 1 - 0
main/assets/html/preview/live.html

@@ -0,0 +1 @@
+live.html

+ 1 - 0
main/assets/html/preview/vod.html

@@ -0,0 +1 @@
+video.html

+ 194 - 0
main/assets/jstyleh5/jstyleh5/article.html

@@ -0,0 +1,194 @@
+<!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=5b71eb04" rel="stylesheet"><link href="css/article.css?v=5b71eb04" rel="stylesheet"></head>
+
+<body>
+  <header>
+    <a class="back"></a>
+    段宜恩电子刊
+  </header>
+  <div class="main">
+    <h1 class="h1">段宜恩:强大精神力的猫系偶像</h1>
+    <div class='article-infos'>
+      <div class='author'>作者:美小刊</div>
+      <div class='div-nums'>
+        <span class='ico-view'></span> 10w+</div>
+    </div>
+    <div class="no-expanded">
+      <div class="rich-wrapper">
+          <!--音频-->
+          <a class="p-voice" id="audio_1" href="jstyle://audio?id=1">
+              <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/679a48b2efcf2c88af7754ac23461ecc.jpg" alt="" class="mavatar">
+              <div class="sound"></div>
+          </a>
+          <!--段落-->
+          <p>漫威宇宙里不只有英勇帅气的男英雄,深入民心的女英雄角色也不少,像复联系列的黑寡妇、绯红女巫,X战警中的凤凰女、暴风女,还有即将登场的惊奇队长,男女英雄无比默契地并肩作战场景总能让我们肾上腺素飙升。作为女英雄,除了拥有超高的武力值,身材、颜值一样在线,不知道斯坦李爷爷笔下的这些女英雄,有哪个镜头惊艳到你?</p>
+
+          <!--图片-->
+          <div class="p-img">
+              <img class="img" src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg" alt="">
+              <!--视频/图片标题-->
+              <div class="tit">段宜恩:强大精神力的猫系偶像</div>
+          </div>
+
+          <!--视频-->
+          <div class="p-img">
+              <a class="poster" id="video_2" href="jstyle://video?id=2">
+                  <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg" alt="" class="media-cover">
+                  <div class="ico-video-play"></div>
+              </a>
+              <!--视频/图片标题-->
+              <div class="tit">段宜恩:强大精神力的猫系偶像</div>
+              <!--视频/图片副标题-->
+              <div class="tit-mini">已有 112212 人观看了视频</div>
+          </div>
+
+          <!--视频-->
+          <div class="p-img">
+              <a class="poster" id="video_3" href="jstyle://video?id=3">
+                  <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg" alt="" class="media-cover">
+                  <div class="ico-video-play"></div>
+                  <span class="tip">开播时间:2018.8.8 15:00</span>
+              </a>
+              <!--视频/图片标题-->
+              <div class="tit">段宜恩:强大精神力的猫系偶像</div>
+          </div>
+          <!--直播-->
+          <div class="live-notice">
+              <div class="watch-user">548 人观看</div>
+          </div>
+          <!--直播-->
+          <div class="live-notice">
+              <div class="notice-time">开播时间 2018.8.8 15:00</div>
+              <a id="live_1" href="jstyle://live?id=1" class="btn-notice">提醒我</a>
+          </div>
+          <!--直播-->
+          <div class="live-notice">
+              <div class="online-user">9999人在线</div>
+          </div>
+      </div>
+      <a class="btn-expand">&nbsp;</a>
+    </div>
+    <div class="comments">
+        <div class='title'><span>热门评论</span></div>
+        <div class="comments-list">
+          <div class='comment'>
+            <div class='user'>
+              <image src='http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTINObH6BicJCasLsYEMyQAmVaybyibp3sZ9pURK3yMLWYJOGJST7Nx32azias6XjMh8iaTibDPfVsu5VaQ/132'></image>
+            </div>
+            <div class='info'>
+              <div class='username'>
+                <span>谢琪琪</span>
+              </div>
+              <div class='date'>
+                <span>1天前</span>
+              </div>
+              <div class='p'>
+                <span>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容</span>
+              </div>
+            </div>
+          </div>
+          <div class='comment'>
+            <div class='user'>
+              <image src='http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTINObH6BicJCasLsYEMyQAmVaybyibp3sZ9pURK3yMLWYJOGJST7Nx32azias6XjMh8iaTibDPfVsu5VaQ/132'></image>
+            </div>
+            <div class='info'>
+              <div class='username'>
+                <span>谢琪琪</span>
+              </div>
+              <div class='date'>
+                <span>1天前</span>
+              </div>
+              <div class='p'>
+                <span>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容</span>
+              </div>
+            </div>
+          </div>
+          <div class='comment'>
+            <div class='user'>
+              <image src='http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTINObH6BicJCasLsYEMyQAmVaybyibp3sZ9pURK3yMLWYJOGJST7Nx32azias6XjMh8iaTibDPfVsu5VaQ/132'></image>
+            </div>
+            <div class='info'>
+              <div class='username'>
+                <span>谢琪琪</span>
+              </div>
+              <div class='date'>
+                <span>1天前</span>
+              </div>
+              <div class='p'>
+                <span>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容</span>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <a class="app-open" href="#">打开JSTYLE精美APP,查看全部评论</a>
+      <div class="recommends">
+        <div class='title'><span>相关推荐</span></div>
+        <div class="recommends-list">
+          <div class='article clearfix'>
+            <div class='cover'>
+              <img class='default' src='https://api.huoxingkandiqiu.com/upload/data/upload/1/2019/01/08/aa1de668b99bc39833f4bbb258b7fc72.jpg' />
+              <div class='ico-play'></div>
+            </div>
+            <div class='tit'><span>
+                段宜恩:超强大精神力的猫系偶像
+              </span></div>
+            <div class='date'>
+              <!-- <span class='type'>{{item.author_name}}</span> -->
+              <span class='d'>吉亚 2018-10-22</span>
+            </div>
+          </div>
+          <div class='article clearfix'>
+            <div class='cover'>
+              <img class='default' src='https://api.huoxingkandiqiu.com/upload/data/upload/1/2019/01/08/aa1de668b99bc39833f4bbb258b7fc72.jpg' />
+              <div class='ico-play'></div>
+            </div>
+            <div class='tit'><span>
+                段宜恩:超强大精神力的猫系偶像
+              </span></div>
+            <div class='date'>
+              <!-- <span class='type'>{{item.author_name}}</span> -->
+              <span class='d'>吉亚 2018-10-22</span>
+            </div>
+          </div>
+          <div class='article clearfix'>
+            <div class='cover'>
+              <img class='default' src='https://api.huoxingkandiqiu.com/upload/data/upload/1/2019/01/08/aa1de668b99bc39833f4bbb258b7fc72.jpg' />
+              <div class='ico-play'></div>
+            </div>
+            <div class='tit'><span>
+                段宜恩:超强大精神力的猫系偶像
+              </span></div>
+            <div class='date'>
+              <!-- <span class='type'>{{item.author_name}}</span> -->
+              <span class='d'>吉亚 2018-10-22</span>
+            </div>
+          </div>
+        </div>
+      </div>
+  </div>
+  <dl class="fixed-app-open">
+      <dt>
+        <img src="images/logo.png" alt="">
+        <div>
+          <h3>JSTYLE精美</h3>
+          <span>我的时尚指南</span>
+        </div>
+      </dt>
+      <dd>
+        <a href="#">打开APP</a>
+      </dd>
+    </dl>
+<script type="text/javascript" src="js/global.js?v=5b71eb04"></script><script type="text/javascript" src="js/article.js?v=5b71eb04"></script></body>
+<script>
+  $('.btn-expand').click(function(){
+    $('.no-expanded').addClass('expanded')
+  })
+</script>
+</html>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/jstyleh5/jstyleh5/css/article.css


+ 1 - 0
main/assets/jstyleh5/jstyleh5/css/article.css.map

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

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

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

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

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

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/jstyleh5/jstyleh5/css/index.css


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

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

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

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

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

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

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/jstyleh5/jstyleh5/css/video.css


+ 1 - 0
main/assets/jstyleh5/jstyleh5/css/video.css.map

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

BIN
main/assets/jstyleh5/jstyleh5/images/back.png


BIN
main/assets/jstyleh5/jstyleh5/images/exp-mask.png


BIN
main/assets/jstyleh5/jstyleh5/images/expand.png


BIN
main/assets/jstyleh5/jstyleh5/images/logo.png


+ 2 - 0
main/assets/jstyleh5/jstyleh5/js/article.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=article.js.map?v=5b71eb04

+ 1 - 0
main/assets/jstyleh5/jstyleh5/js/article.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/article.js","webpack:///./mobile/src/router/article.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/article.js?v=5b71eb04","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/article.js?v=5b71eb04","import './global';\r\nimport '../css/article.css';\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/article.js"],"sourceRoot":""}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/jstyleh5/jstyleh5/js/global.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/jstyleh5/jstyleh5/js/global.js.map


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

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

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

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js","webpack:///./mobile/src/router/index.js"],"names":["webpackJsonp","14","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,GACAA,EAAA,IDqBME,EACA,SAAUJ,EAAQC,OAMrB","file":"js/index.js?v=5b71eb04","sourcesContent":["webpackJsonp([2],{\n\n/***/ 14:\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},[14]);\n\n\n// WEBPACK FOOTER //\n// js?v=5b71eb04","import './global';\r\nimport '../css/index.css';\r\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/index.js"],"sourceRoot":""}

+ 2 - 0
main/assets/jstyleh5/jstyleh5/js/rule.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=rule.js.map?v=5b71eb04

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

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/rule.js","webpack:///./mobile/src/router/rule.js"],"names":["webpackJsonp","10","module","exports","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/rule.js?v=5b71eb04","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/rule.js?v=5b71eb04","import './global';\r\nimport '../css/rule.css';\r\n\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/rule.js"],"sourceRoot":""}

+ 2 - 0
main/assets/jstyleh5/jstyleh5/js/video.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=video.js.map?v=5b71eb04

+ 1 - 0
main/assets/jstyleh5/jstyleh5/js/video.js.map

@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///js/video.js","webpack:///./mobile/src/router/video.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/video.js?v=5b71eb04","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/video.js?v=5b71eb04","import './global';\r\nimport '../css/video.css';\n\n\n// WEBPACK FOOTER //\n// ./mobile/src/router/video.js"],"sourceRoot":""}

+ 162 - 0
main/assets/jstyleh5/jstyleh5/video.html

@@ -0,0 +1,162 @@
+<!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=5b71eb04" rel="stylesheet"><link href="css/video.css?v=5b71eb04" rel="stylesheet"></head>
+
+<body>
+  <div class="main">
+    <!--视频-->
+    <div class="banner">
+      <div class="poster">
+        <img src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg"
+          alt="" class="media-cover">
+        <div class="ico-video-play"></div>
+      </div>
+      <a class="btn-open" href="#">打开JSTYLE精美APP,查看更多精彩视频>></a>
+    </div>
+    <h1 class="h1">段宜恩:强大精神力的猫系偶像</h1>
+    <div class='article-infos'>
+      <div class='author'>作者:美小刊</div>
+      <div class='div-nums' wx:if="{{divs_yes}}">
+        <span class='ico-view'></span> 10w+</div>
+    </div>
+    <div class="rich-wrapper">
+      <!--段落-->
+      <p>漫威宇宙里不只有英勇帅气的男英雄,深入民心的女英雄角色也不少,像复联系列的黑寡妇、绯红女巫,X战警中的凤凰女、暴风女,还有即将登场的惊奇队长,男女英雄无比默契地并肩作战场景总能让我们肾上腺素飙升。作为女英雄,除了拥有超高的武力值,身材、颜值一样在线,不知道斯坦李爷爷笔下的这些女英雄,有哪个镜头惊艳到你?</p>
+      <!--图片-->
+      <div class="p-img">
+        <img class="img" src="https://api.huoxingkandiqiu.com/upload/data/upload/1/2018/12/03/946feca18080901497c4d2a22d0f9733.jpg"
+          alt="">
+      </div>
+    </div>
+    <div class="comments">
+      <div class='title'><span>热门评论</span></div>
+      <div class="comments-list">
+        <div class='comment'>
+          <div class='user'>
+            <image src='http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTINObH6BicJCasLsYEMyQAmVaybyibp3sZ9pURK3yMLWYJOGJST7Nx32azias6XjMh8iaTibDPfVsu5VaQ/132'></image>
+          </div>
+          <div class='info'>
+            <div class='username'>
+              <span>谢琪琪</span>
+            </div>
+            <div class='date'>
+              <span>1天前</span>
+            </div>
+            <div class='p'>
+              <span>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容</span>
+            </div>
+          </div>
+        </div>
+        <div class='comment'>
+          <div class='user'>
+            <image src='http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTINObH6BicJCasLsYEMyQAmVaybyibp3sZ9pURK3yMLWYJOGJST7Nx32azias6XjMh8iaTibDPfVsu5VaQ/132'></image>
+          </div>
+          <div class='info'>
+            <div class='username'>
+              <span>谢琪琪</span>
+            </div>
+            <div class='date'>
+              <span>1天前</span>
+            </div>
+            <div class='p'>
+              <span>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容</span>
+            </div>
+          </div>
+        </div>
+        <div class='comment'>
+          <div class='user'>
+            <image src='http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTINObH6BicJCasLsYEMyQAmVaybyibp3sZ9pURK3yMLWYJOGJST7Nx32azias6XjMh8iaTibDPfVsu5VaQ/132'></image>
+          </div>
+          <div class='info'>
+            <div class='username'>
+              <span>谢琪琪</span>
+            </div>
+            <div class='date'>
+              <span>1天前</span>
+            </div>
+            <div class='p'>
+              <span>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容</span>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <a class="app-open" href="#">打开JSTYLE精美APP,查看全部评论</a>
+    <div class="recommends">
+      <div class='title'><span>相关推荐</span></div>
+      <div class="recommends-list">
+        <div class='article clearfix'>
+          <div class='cover'>
+            <img class='default' src='https://api.huoxingkandiqiu.com/upload/data/upload/1/2019/01/08/aa1de668b99bc39833f4bbb258b7fc72.jpg' />
+            <div class='ico-play'></div>
+          </div>
+          <div class='tit'><span>
+              段宜恩:超强大精神力的猫系偶像
+            </span></div>
+          <div class='date'>
+            <!-- <span class='type'>{{item.author_name}}</span> -->
+            <span class='d'>吉亚 2018-10-22</span>
+          </div>
+        </div>
+        <div class='article clearfix'>
+          <div class='cover'>
+            <img class='default' src='https://api.huoxingkandiqiu.com/upload/data/upload/1/2019/01/08/aa1de668b99bc39833f4bbb258b7fc72.jpg' />
+            <div class='ico-play'></div>
+          </div>
+          <div class='tit'><span>
+              段宜恩:超强大精神力的猫系偶像
+            </span></div>
+          <div class='date'>
+            <!-- <span class='type'>{{item.author_name}}</span> -->
+            <span class='d'>吉亚 2018-10-22</span>
+          </div>
+        </div>
+        <div class='article clearfix'>
+          <div class='cover'>
+            <img class='default' src='https://api.huoxingkandiqiu.com/upload/data/upload/1/2019/01/08/aa1de668b99bc39833f4bbb258b7fc72.jpg' />
+            <div class='ico-play'></div>
+          </div>
+          <div class='tit'><span>
+              段宜恩:超强大精神力的猫系偶像
+            </span></div>
+          <div class='date'>
+            <!-- <span class='type'>{{item.author_name}}</span> -->
+            <span class='d'>吉亚 2018-10-22</span>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+  <dl class="fixed-app-open">
+    <dt>
+      <img src="images/logo.png" alt="">
+      <div>
+        <h3>JSTYLE精美</h3>
+        <span>我的时尚指南</span>
+      </div>
+    </dt>
+    <dd>
+      <a href="#">打开APP</a>
+    </dd>
+  </dl>
+<script type="text/javascript" src="js/global.js?v=5b71eb04"></script><script type="text/javascript" src="js/video.js?v=5b71eb04"></script></body>
+<script>
+  function audioPlay(id) {
+    $('#audio' + id).find('.sound').addClass('playing');
+  }
+
+  function audioPause(id) {
+    $('#audio' + id).find('.sound').removeClass('playing');
+  }
+
+  function emit(id, txt) {
+    $('#live_' + id).html(txt);
+  }
+</script>
+
+</html>

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

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

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/mobile/css/feature.css


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

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

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

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

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

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

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/mobile/css/index.css


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

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

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

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

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

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

BIN
main/assets/mobile/images/ico-download.png


BIN
main/assets/mobile/images/ico-gif.png


BIN
main/assets/mobile/images/ico-share.png


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

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

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/mobile/js/global.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
main/assets/mobile/js/global.js.map


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

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

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

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

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

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

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

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

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

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

Vissa filer visades inte eftersom för många filer har ändrats