rabin 8 anos atrás
commit
da9c227ae5

+ 14 - 0
LICENSE

@@ -0,0 +1,14 @@
+Apache License
+Copyright 2016-2017 Dever(dever.cc)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.

+ 5 - 0
boot.php

@@ -0,0 +1,5 @@
+<?php
+define('DEVER_APP_NAME', 'atom');
+define('DEVER_APP_LANG', 'AtomCMS系统');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(DEVER_APP_PATH . '../framework/boot.php');

+ 4 - 0
common.php

@@ -0,0 +1,4 @@
+<?php
+/**
+ * 公共函数
+ */

+ 15 - 0
config/base.php

@@ -0,0 +1,15 @@
+<?php
+
+$config['base'] = array
+(
+	# 名称
+	'name' => 'atom文章管理系统',
+);
+
+$config['template'] = array
+(
+	'assets' => array(DEVER_PROJECT . '/pc', DEVER_PROJECT . '/m'),
+	'template' => array(DEVER_PROJECT . '/pc', DEVER_PROJECT . '/m'),
+);
+
+return $config;

+ 21 - 0
config/dyna.php

@@ -0,0 +1,21 @@
+<?php
+# 动态配置,可以用于seo配置,请在项目下建立该配置文件
+# 调用方法:
+# Dever::dyna('name', $data, DEVER_PROJECT)
+
+$config = array();
+
+$config['vogue']['name'] = 'VOGUE时尚网';
+
+$config['vogue'] = array
+(
+	# 首页
+	'home' => array
+	(
+		'title' 		=> '时尚图片收藏与分享_分享你的潮流穿搭心经_' . $config['vogue']['name'],
+		'keyword' 		=> '时尚图片,图片收藏,图片分享,时尚潮流图片,$data[name]',
+		'desc' 			=> 'VOGUE时尚网发现社区,发现、收藏、整理、分享你喜欢的时尚图片、潮流服饰图片和搭配图片,你可以用它收集时尚灵感,保存兴趣图片素材,按喜欢的方式整理成不同的图集,分享你独有的时尚穿搭心经。',
+	)
+);
+
+return $config;

+ 6 - 0
config/route.php

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

+ 29 - 0
database/Model/Article.php

@@ -0,0 +1,29 @@
+<?php
+namespace Atom\Database\Model;
+use Dever;
+/**
+ * 文章model兼容类,直接替换database/article里的request方法,必须是静态方法
+ */
+class Article
+{
+	private static $name = 'news_list';
+
+	public static function all($param)
+	{
+		echo 11;die;
+		$data = Dever::db('old')->link()
+		->where($param)
+		//->order($param['order'])
+		->group($param['group'])
+		->table(self::$name)
+		->col('*')
+		->limit($param['limit'])
+		->fetchAll();
+		print_r($data);die;
+
+		//Dever::db('old')->insert();
+		$data = Dever::db('old')->fetchAll('select * from ' . self::$name . ' limit 10');
+
+		return $data;
+	}
+}

+ 275 - 0
database/article.php

@@ -0,0 +1,275 @@
+<?php
+
+# 定义几个常用的选项
+$option = array
+(
+	1 => '发布',
+	2 => '未发布',
+);
+
+$channel = function()
+{
+	$array = array();
+	$channel = Dever::db('atom/channel')->parent();
+	if ($channel) {
+		$array += $channel;
+	}
+	return $array;
+};
+
+$channel_child = function()
+{
+	$channel = Dever::db('atom/channel')->child();
+
+	return $channel;
+};
+
+# 栏目
+$search_channel = function()
+{
+	$array = array
+	(
+		-1 => array('id' => '-1', 'name' => '所有栏目'),
+	);
+	$channel = Dever::load('atom/service/article/channel.all');
+	if ($channel) {
+		$array += $channel;
+	}
+	return $array;
+};
+
+return array
+(
+	# 表名
+	'name' => 'article',
+	# 显示给用户看的名称
+	'lang' => '文章',
+	'order' => 20,
+	# 数据结构
+	'struct' => array
+	(
+	
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			'list'		=> true,
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '请输入主题标题',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+
+		'author'		=> array
+		(
+			'type' 		=> 'varchar-80',
+			'name' 		=> '作者-请填写用户id',
+			'default' 	=> '1',
+			'desc' 		=> '请填写作者',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			//'search'	=> 'select',
+			'list'		=> true,
+		),
+		
+		'channel_id_parent'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '父级栏目',
+			'default' 	=> '0',
+			'desc' 		=> '请选择父级栏目',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			//'search'	=> 'order,select',
+			//'list'		=> '{channel_id_parent} > 0 ? Dever::load("atom/channel-one#name", {channel_id_parent}) : "临时栏目"',
+			'option' 	=> $channel,
+			# 当值改变时,执行下一步操作
+			'child_name' => 'channel_id',
+			'child' => $channel_child,
+			'child_value' => '{channel_id}',
+		),
+		
+		'channel_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '子栏目',
+			'default' 	=> '0',
+			'desc' 		=> '请选择子栏目',
+			'match' 	=> 'is_numeric',
+			//'search'	=> 'order',
+			'list_name'	=> '栏目',
+			'list'		=> '{channel_id} > 0 ? Dever::load("atom/channel-one#name", {channel_id}) : "无子栏目"',
+		),
+		
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'pic'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '封面标准图-请上传等比例图片300X300',
+			'default' 	=> '',
+			'desc' 		=> '封面标准图',
+			'match' 	=> 'is_string',
+			'update'	=> 'image',
+			'key'		=> 1
+		),
+		
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '内容',
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'update'	=> 'editor',
+			'key' 		=> 1,
+		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+			'option' 	=> $option,
+			'update'	=> 'radio',
+			'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,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+	
+	# 管理功能
+	'manage' => array
+	(
+		//'insert' => false,
+		# 列表
+		'list' => array
+		(
+			array
+			(
+				1 => array('分页', '"page&option_article_id={id}"')
+			),
+		),
+	),
+	
+	# request 请求接口定义
+	'request' => array
+	(
+		# 获取默认主题,按照置顶和时间排序的
+		'default' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'cate_id' => 'yes',
+				'cate_id_parent' => 'yes',
+				'uid' => 'yes',
+			),
+			'type' => 'all',
+			'order' => array('top' => 'desc', 'reorder' => 'desc', 'id' => 'desc'),
+			'page' => array(15, 'list'),
+			'col' => '*',
+		),
+
+		# 更新浏览量
+		'addView' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_view' => array('1', '+='),
+			),
+		),
+		
+		# 更新回复数
+		'addReview' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_review' => array('1', '+='),
+			),
+		),
+		
+		# 更新点赞数
+		'addUp' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_up' => array('1', '+='),
+			),
+		),
+		
+		# 更新点赞数
+		'desUp' => array
+		(
+			'type' => 'update',
+			'where' => array
+			(
+				'id' => 'yes',
+			),
+			'set' => array
+			(
+				'num_up' => array('1', '-='),
+			),
+		),
+	),
+);

+ 187 - 0
database/channel.php

@@ -0,0 +1,187 @@
+<?php
+
+$channel = function()
+{
+	$array = array(-1 => array('name' => '父级栏目'));
+	$channel = Dever::db('atom/channel')->parent();
+	if ($channel) {
+		$array += $channel;
+	}
+	return $array;
+};
+
+return array
+(
+	# 表名
+	'name' => 'channel',
+	# 显示给用户看的名称
+	'lang' => '栏目',
+	'order' => 19,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '栏目ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			//'search'	=> 'order',
+			'order'		=> 'desc',
+			'list'		=> true,
+		),
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-60',
+			'name' 		=> '栏目名称',
+			'default' 	=> '',
+			'desc' 		=> '请输入栏目名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+		),
+		
+		'channel_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '上级栏目',
+			'default' 	=> Dever::input('option_channel_id', -1),
+			'desc' 		=> '请选择上级栏目',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'select',
+			'search'	=> 'order,select',
+			//'list'		=> '{channel_id} > 0 ? Dever::load("atom/channel-one#name", {channel_id}) : "父级栏目"',
+			'option' 	=> $channel,
+		),
+		
+		'pic'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '栏目图片-选填,大小为150X150px',
+			'default' 	=> '',
+			'desc' 		=> '请选择栏目图片',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+		
+		'info'		=> array
+		(
+			'type' 		=> 'varchar-500',
+			'name' 		=> '栏目介绍-选填,字数不超过500字,出现栏目头部,如果想清空该介绍,请输入null。',
+			'default' 	=> '',
+			'desc' 		=> '请输入栏目介绍',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+		),
+		
+		'link'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '栏目链接-选填,如果填写了链接,则点击本栏目直接跳转至本链接。',
+			'default' 	=> '',
+			'desc' 		=> '请输入栏目链接',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+		),
+		
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	# 权限精细控制 加入到该项目的详细权限中,注意与top的不同
+	/*
+	'auth' => array
+	(
+		# 类型 1为单一类型,只将表里的数据作为单一权限,2为复杂类型,可以根据获取到的数据分父级子级处理。此处数据来源很重要,这也是和top的区别。
+		'type' => 2,
+		# 数据来源
+		'data' => 'atom/channel.get',
+		# 菜单名
+		'name' => '栏目',
+		# 默认值
+		'value' => 1,
+		# 对应的字段值,设置这个之后,所有设置auth等于这个值的字段,都要遵循这个权限的控制
+		'key' => 'channel',
+		# 本表中代表名称的字段
+		'col' => 'name',
+	),
+	*/
+	
+	'manage' => array
+	(
+		# 列表页的类型
+		'list_type' => 'parent',
+
+		'list_button' => array
+		(
+			21 => array('新增子栏目', '"channel&option_channel_id={id}&oper_parent=channel"', '{channel_id}<=0'),
+		),
+	),
+	
+	# request 请求接口定义
+	'request' => array
+	(
+		# main 取所有主栏目
+		'parent' => array
+		(
+			'where' => array
+			(
+				'channel_id' => -1,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'col' => '*|id',
+		),
+		
+		# 取所有下级栏目
+		'child' => array
+		(
+			'where' => array
+			(
+				'channel_id' => array('1', '>='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'col' => '*|channel_id|id|',
+		),
+	),
+);

+ 110 - 0
database/setting.php

@@ -0,0 +1,110 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'setting',
+	# 显示给用户看的名称
+	'lang' => '站点信息配置',
+	'order' => 10,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '网站ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'hr1'		=> array
+		(
+			'name' 		=> '基本信息',
+			'class'		=> '',//本项必须填写
+			'attr'		=> '',
+		),
+		
+		
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-32',
+			'name' 		=> '网站名称',
+			'default' 	=> '',
+			'desc' 		=> '请输入网站名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+		),
+		
+		'info'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '网站介绍',
+			'default' 	=> '',
+			'desc' 		=> '请输入网站介绍',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+		),
+		
+		'hr3'		=> array
+		(
+			'name' 		=> '版权与介绍',
+			'class'		=> '',//本项必须填写
+			'attr'		=> '',
+		),
+		
+		'copyright'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '版权信息',
+			'default' 	=> '',
+			'desc' 		=> '请输入版权信息',
+			'match' 	=> 'is_string',
+			'update'	=> 'textarea',
+		),
+		
+		'icp'		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> 'icp备案信息-填写别的信息也可以的',
+			'default' 	=> '',
+			'desc' 		=> '请输入icp备案信息',
+			'match' 	=> 'is_string',
+			'update'	=> 'textarea',
+		),
+		
+		'code'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '尾部代码-一般用于填写统计代码',
+			'default' 	=> '',
+			'desc' 		=> '请输入尾部代码',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+		),
+
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> time(),
+			'desc' 		=> '',
+		),
+	),
+
+	'default' => array
+	(
+		'col' => 'name,info,copyright,icp,cdate',
+		'value' => array
+		(
+			'"Vogue时尚网","Vogue时尚网","Made With By Dever","京ICP备15006344号",' . time(),
+		),
+	),
+
+	'manage' => array
+	(
+		# 后台管理不要列表页
+		'list' => 'update',
+	),
+);

+ 6 - 0
manage/vogue.php

@@ -0,0 +1,6 @@
+<?php
+define('DEVER_PROJECT', 'vogue');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_APP_PACKAGE', 'manage');
+define('DEVER_ENTRY', DEVER_PROJECT . '.php');
+include(DEVER_APP_SETUP . '../../package/'.DEVER_APP_PACKAGE.'/index.php');

+ 6 - 0
module/vogue.php

@@ -0,0 +1,6 @@
+<?php
+define('DEVER_PROJECT', 'vogue');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_APP_PACKAGE', 'module');
+define('DEVER_ENTRY', DEVER_PROJECT . '.php');
+include(DEVER_APP_SETUP . '../../package/'.DEVER_APP_PACKAGE.'/index.php');

+ 18 - 0
service/Article/Channel.php

@@ -0,0 +1,18 @@
+<?php
+namespace Atom\Service\Article;
+use Dever;
+/**
+ * 栏目类
+ */
+class Channel
+{
+    public function get()
+    {
+    	$title = Dever::input('title');
+    	if (!$title) {
+    		Dever::alert('错误的标题');
+    	}
+    	$param['option_title'] = $title;
+        return Dever::db('atom/channel')->all($param);
+    }
+}

+ 24 - 0
service/Article/Data.php

@@ -0,0 +1,24 @@
+<?php
+namespace Atom\Service\Article;
+use Dever;
+/**
+ * 文章类
+ */
+class Data
+{
+    public function get_api($callback)
+    {
+        //Dever::debug(11);
+        return $callback;
+    }
+
+    public function get()
+    {
+        return Dever::url();
+    	$param['option_title'] = array('邹游:最具学者胸怀和气质的设计师', 'like');
+        $param['group'] = 'nid';
+        $param['limit'] = '0,10';
+        $data = Dever::db('atom/article')->all($param);
+        return $data;
+    }
+}

+ 12 - 0
service/Article/Page.php

@@ -0,0 +1,12 @@
+<?php
+namespace Atom\Service\Article;
+
+use Dever;
+
+class Page
+{
+    public function get()
+    {
+        
+    }
+}

+ 12 - 0
service/Article/Pic.php

@@ -0,0 +1,12 @@
+<?php
+namespace Atom\Service\Article;
+
+use Dever;
+
+class Pic
+{
+    public function get()
+    {
+        
+    }
+}

+ 16 - 0
service/Article/View.php

@@ -0,0 +1,16 @@
+<?php
+namespace Atom\Service\Article;
+
+use Dever;
+
+/**
+ * 文章详情
+ *
+ */
+class View
+{
+    public function get()
+    {
+        
+    }
+}

+ 6 - 0
vogue.php

@@ -0,0 +1,6 @@
+<?php
+define('DEVER_PROJECT', 'vogue');
+define('DEVER_ENTRY', DEVER_PROJECT . '.php');
+//define('DEVER_MANAGE_ORDER', 20);
+//define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-align-left');
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'boot.php');