rabin hace 6 años
padre
commit
acca97b93f
Se han modificado 1 ficheros con 21 adiciones y 0 borrados
  1. 21 0
      src/Api.php

+ 21 - 0
src/Api.php

@@ -68,6 +68,27 @@ class Api
 		return $result;
 	}
 
+	public function getInfoAttr($category)
+	{
+	    $all = Dever::db('category/attr')->all();
+
+	    $table = '';
+	    $attr = array();
+	    $create = Dever::config('database')->create;
+
+	    if ($category) {
+	        if (is_array($category)) {
+	            $category = implode(',', $category);
+	        }
+	        $table = '_' . str_replace(',', '_', $category);
+	        # 自动建表开启并且自动添加字段
+	        $create = false;
+	        $attr = $this->getAttrByCate($category);
+	    }
+
+	    return array($category, $attr, $table, $create);
+	}
+
 	/**
 	 * 设置数据库的结构信息
 	 *