rabin 6 年之前
父節點
當前提交
3924c68b35
共有 3 個文件被更改,包括 100 次插入2 次删除
  1. 95 0
      database/attr.php
  2. 1 1
      index.php
  3. 4 1
      src/Api.php

+ 95 - 0
database/attr.php

@@ -0,0 +1,95 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| attr.php 分类属性关联表
+|--------------------------------------------------------------------------
+*/
+$menu = false;
+if (Dever::project('attr')) {
+	$menu = 'category';
+}
+$attr = function()
+{
+	$auth = Dever::load('attr/api.get', false);
+	return $auth;
+};
+return array
+(
+	# 表名
+	'name' => 'attr',
+	# 显示给用户看的名称
+	'lang' => '分类属性设置',
+	'order' => 100,
+	'menu' => $menu,
+	'check' => 'category',
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'order',
+			//'list'		=> true,
+		),
+
+		'category'		=> array
+		(
+			'type' 		=> 'varchar-500',
+			'name' 		=> '分类',
+			'default' 	=> '',
+			'desc' 		=> '该分类下已有属性设置',
+			'match' 	=> 'is_string',
+			//'search'	=> 'linkage',
+			'update'	=> 'linkage',
+			'option'	=> Dever::url('api.get', 'category'),
+			'list'		=> 'Dever::load("category/api.string", "{category}")',
+		),
+		
+		'attr'		=> array
+		(
+			'type' 		=> 'varchar-800',
+			'name' 		=> '属性设置',
+			'default' 	=> '',
+			'desc' 		=> '属性设置',
+			'match' 	=> 'option',
+			'update'	=> 'checkbox',
+			'option'	=> $attr,
+			'update_input' => '',
+			'update_input_default' => '',
+			'update_parent' => 'checkbox',
+			'list'		=> 'Dever::load("attr/api.string", "{attr}", "{attr_input}")',
+		),
+
+		'attr_input'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '属性值设置',
+			'default' 	=> '',
+			'desc' 		=> '属性值设置',
+			'match' 	=> 'option',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '录入时间',
+			'match' 	=> array('is_numeric', DEVER_TIME),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+		//'delete' => false,
+		//'edit' => false,
+		//'insert' => false,
+	),
+);

+ 1 - 1
index.php

@@ -4,5 +4,5 @@ define('DEVER_APP_NAME', 'category');
 define('DEVER_APP_LANG', '分类管理');
 define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 define('DEVER_MANAGE_ORDER', 10);
-define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-credit-card');
+define('DEVER_MANAGE_ICON', 'glyphicon glyphicon-credit-card layui-icon-templeate-1');
 include(DEVER_APP_PATH . '../boot.php');

+ 4 - 1
src/Api.php

@@ -94,7 +94,10 @@ class Api
             foreach ($cate as $k => $v) {
                 $result[$k] = $this->getName($v);
             }
-            return implode($im, $result);
+            $result = implode($im, $result);
+            return $result;
+            $table[] = $result;
+            return Dever::table($table);
         }
         return '';
     }