dever 6 years ago
parent
commit
13ca0d672b
3 changed files with 154 additions and 1 deletions
  1. 151 0
      main/database/version.php
  2. 2 0
      main/lib/Core.php
  3. 1 1
      main/src/Journal.php

+ 151 - 0
main/database/version.php

@@ -0,0 +1,151 @@
+<?php
+
+$up = array
+(
+	1 => '是',
+	2 => '否',
+);
+
+$source_type = array (
+	'ios' => 'ios',
+	'android' => 'android',
+);
+return array
+(
+	# 表名
+	'name' => 'version',
+	# 显示给用户看的名称
+	'lang' => '版本管理',
+	# 后台菜单排序
+	'order' => 9,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			//'list'		=> true,
+			'order'		=> 'desc',
+		),
+
+		'source_type'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '平台',
+			'default' 	=> '1',
+			'desc' 		=> '平台',
+			'match' 	=> 'is_string',
+			'update'	=> 'select',
+			'search'	=> 'select',
+			'option'	=> $source_type,
+			'list'		=> true,
+		),
+
+		'appname'		=> array
+		(
+			'type' 		=> 'varchar-50',
+			'name' 		=> 'app名称',
+			'default' 	=> '',
+			'desc' 		=> 'app名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			//'list'		=> true,
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '版本名称',
+			'default' 	=> '',
+			'desc' 		=> '请输入名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+
+		'code'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '版本号-只能填写数字',
+			'default' 	=> '',
+			'desc' 		=> '版本号',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'order'		=> 'desc',
+			'list'		=> true,
+		),
+
+		'desc'		=> array
+		(
+			'type' 		=> 'varchar-500',
+			'name' 		=> '版本描述',
+			'default' 	=> '',
+			'desc' 		=> '版本描述',
+			'match' 	=> 'is_string',
+			'update'	=> 'textarea',
+		),
+
+		'up'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '是否强制升级',
+			'default' 	=> '2',
+			'desc' 		=> '是否强制升级',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'option'	=> $up,
+		),
+
+		'link'		=> array
+		(
+			'type' 		=> 'varchar-400',
+			'name' 		=> '下载链接',
+			'default' 	=> '',
+			'desc' 		=> '下载链接',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+		),
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'request' => array
+	(
+		'getOne' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('code' => 'desc', 'cdate' => 'desc'),
+			'col' => '*',
+		),
+	),
+);

+ 2 - 0
main/lib/Core.php

@@ -30,6 +30,8 @@ class Core
         if ($source_type == 'ios' || $source_type == 'android') {
             $this->app = true;
         }
+
+        $this->data['version'] = Dever::db('main/version')->getOne();
     }
 
     # 图片处理

+ 1 - 1
main/src/Journal.php

@@ -93,7 +93,7 @@ class Journal extends Core
         # 我的小刊列表
         $where = array();
         $where['type'] = 4;
-        $where['source'] = '1,2,3,4';
+        $where['source'] = '1,2';
         $where['cate_id'] = $cate['id'];
         $data = Dever::db('act/subscribe')->getMyAll($where);
         if ($data) {