Kirin 2 달 전
부모
커밋
f430dd72b2

+ 2 - 0
README.md

@@ -43,6 +43,8 @@ php think make
 -x/-hidden  指定隐藏字段,隐藏字段不显示,也不进默认导出列表,使用","分割。
 ~~~
 
+<b>自动生成的controller里面有自动生成的默认方法路由,复制到路由文件即可使用</b>
+
 * 数据处理
 
 后台默认根控制器(app\common\AdminBaseController)内默认有以下方法,可以进行数据处理

+ 6 - 0
app/controller/admin/system/config/SystemConfigTab.php

@@ -48,11 +48,17 @@ class SystemConfigTab extends AdminBaseController
             ['title', ''],
             'icon',
             ['sort', 0],
+            ['info', ''],
             ['pid', 0],
             ['is_store', 0],
         ];
         $this->saveDeal = $this->updateDeal = function (&$data) {
             if (!$data['title']) throw new ValidateException('请输入分类名称');
+            if ($data['pid'] > 0) {
+                $p = $this->service->getOne(['id' => $data['pid']]);
+                if (!$p) throw new ValidateException('请选择上级分类');
+                if ($p['pid'] > 0) throw new ValidateException('仅支持二级分类');
+            }
         };
     }
 

+ 2 - 2
app/services/system/config/SystemConfigTabServices.php

@@ -99,7 +99,7 @@ class SystemConfigTabServices extends BaseServices
     {
         $menuList = $this->getConfigTabAll([], ['id as value', 'pid', 'title as label']);
         $menus = [['value' => 0, 'label' => '顶级按钮']];
-        $list = get_tree_children($menuList, 0, 'value');
-        return array_merge($menus, $list);
+        $menuList = array_merge($menus, $menuList);
+        return get_tree_children($menuList, 0, 'value');
     }
 }

+ 1 - 0
qiniu/command/MakeAdmin.php

@@ -241,6 +241,7 @@ class MakeAdmin extends Command
                         } else {
                             $this->getAttr($getAttrArr, $field, 'add_time_datetime');
                         }
+                        $this->searchAttr($searchFieldAttr, 'time');
                         $exportAttr[$field] = $langList[$field] ?? '添加时间';
                     } else {
                         $inputType = $this->getFieldType($v);

+ 3 - 1
qiniu/command/stubs/controller.stub

@@ -46,7 +46,9 @@ class {%controllerName%} extends AdminBaseController
     /*
     简易路由
 
-    //{%tableComment%}路由
+    //{%tableComment%}导出
+    Route::get('{%resourceName%}/export', '{%path%}{%controllerName%}')->option(['real_name' => '{%tableComment%}导出']);
+    //{%tableComment%}资源路由
     Route::resource('{%resourceName%}', '{%path%}{%controllerName%}')
         ->only(['index', 'read', 'save', 'update', 'delete'])
         ->option(['real_name' => [