rabin 2 mesiacov pred
rodič
commit
a557d24f4c
19 zmenil súbory, kde vykonal 293 pridanie a 338 odobranie
  1. 13 13
      api/Admin.php
  2. 2 2
      api/Cron.php
  3. 2 2
      api/Icon.php
  4. 5 5
      api/Login.php
  5. 12 15
      api/Menu.php
  6. 26 27
      api/Page/Data.php
  7. 6 6
      api/Page/Oper.php
  8. 58 58
      api/Page/Update.php
  9. 1 1
      api/Page/View.php
  10. 6 6
      lib/Auth.php
  11. 85 118
      lib/Common.php
  12. 3 4
      lib/Config.php
  13. 5 6
      lib/Group.php
  14. 7 7
      lib/Menu.php
  15. 3 4
      lib/Module.php
  16. 33 37
      lib/Page.php
  17. 3 3
      lib/Recycler.php
  18. 13 13
      lib/Role.php
  19. 10 11
      lib/System.php

+ 13 - 13
api/Admin.php

@@ -10,20 +10,20 @@ class Admin extends Auth
         $this->user['module']['name'] = '当前模块';
         $this->user['module']['list'] = $this->module();
         $this->user['module']['login'] = 'login';
-        $this->user['module']['uri'] = array('system' => $this->system['key'], 'number' => $this->system_info['number']);
+        $this->user['module']['uri'] = ['system' => $this->system['key'], 'number' => $this->system_info['number']];
         return $this->user;
     }
 
     # 获取当前的模块列表
     public function module()
     {
-        $where = array();
+        $where = [];
         if ($this->user['auth']['module']) {
-            $where['id'] = array('in', $this->user['auth']['module']);
+            $where['id'] = ['in', $this->user['auth']['module']];
         } else {
             $where['system'] = $this->system['key'];
         }
-        $result = array();
+        $result = [];
         $module = Dever::db('system_module', 'manage')->select($where);
         $i = 0;
         foreach ($module as $k => $v) {
@@ -34,12 +34,12 @@ class Admin extends Auth
                 }
                 $data_where = Dever::json_decode($data_where);
             } else {
-                $data_where = array();
+                $data_where = [];
             }
             $child = Dever::db($v['data_table'])->select($data_where);
             
             if ($child) {
-                $data = array();
+                $data = [];
                 foreach ($child as $k1 => $v1) {
                     $v1['select'] = false;
                     if ($v['id'] == $this->user['select']['module_id'] && $v1['id'] == $this->user['select']['data_id']) {
@@ -72,16 +72,16 @@ class Admin extends Auth
     public function getModuleData($value = false)
     {
         if (!$value) {
-            $result['module_data']['option'] = array();
+            $result['module_data']['option'] = [];
             return $result;
         }
-        $result = array();
-        $role = Dever::db($this->system['role_table'])->select(array('id' => array('in', $value)));
+        $result = [];
+        $role = Dever::db($this->system['role_table'])->select(array('id' => ['in', $value]));
         if ($role) {
-            $info = $module = array();
+            $info = $module = [];
             foreach ($role as $k => $v) {
                 if ($v['module']) {
-                    $child = Dever::db('system_module', 'manage')->select(array('id' => array('in', $v['module'])));
+                    $child = Dever::db('system_module', 'manage')->select(array('id' => ['in', $v['module']]));
                     if ($child) {
                         foreach ($child as $k1 => $v1) {
                             if (isset($info[$v1['id']])) {
@@ -90,7 +90,7 @@ class Admin extends Auth
                             $info[$v1['id']] = true;
                             $v1['value'] = 's-' . $v1['id'];
                             $v1['label'] = $v1['name'];
-                            $v1['children'] = array();
+                            $v1['children'] = [];
                             $data = Dever::db($v1['data_table'])->select([], array('col' => 'concat('.$v1['id'].', "-", id) as value, name as label'));
                             if ($data) {
                                 $v1['children'] = array_merge($v1['children'], $data);
@@ -124,7 +124,7 @@ class Admin extends Auth
     {
         $username = Dever::input('username');
         $password = Dever::input('password');
-        $data = array();
+        $data = [];
         if ($username) {
             $data['name'] = $username;
         }

+ 2 - 2
api/Cron.php

@@ -7,10 +7,10 @@ class Cron
     {
         $time = time();
         # 获取所有的计划任务
-        $data = Dever::db('cron', 'manage')->load(array('ldate' => array('<=', $time)));
+        $data = Dever::db('cron', 'manage')->load(array('ldate' => ['<=', $time]));
         if ($data) {
             foreach ($data as $k => $v) {
-                Cmd::run($v['interface'], array(), $v['project']);
+                Cmd::run($v['interface'], [], $v['project']);
                 $param['ldate'] = $v['ldate'] + $v['time'];
                 if ($param['ldate'] < $time) {
                     $param['ldate'] = $time + $v['time'];

+ 2 - 2
api/Icon.php

@@ -7,9 +7,9 @@ class Icon extends Auth
     {
         $set['num'] = Dever::input('pgnum', '', '', 16);
         $key = Dever::input('title');
-        $where = array();
+        $where = [];
         if ($key) {
-            $where['key'] = array('like', $key);
+            $where['key'] = ['like', $key];
         }
         $data['list'] = Dever::db('icon', 'manage')->select($where, $set);
         $data['total'] = Dever::page('total');

+ 5 - 5
api/Login.php

@@ -8,7 +8,7 @@ class Login
     public function getSystem()
     {
         $system = Dever::input('system', 'is_string', '系统', 'platform');
-        $system = Dever::db('system', 'manage')->find(array('key' => $system));
+        $system = Dever::db('system', 'manage')->find(['key' => $system]);
         if (!$system) {
             Dever::error('当前系统不存在');
         }
@@ -22,7 +22,7 @@ class Login
         //$this->checkCode();
         $system = $this->getSystem();
         $number = Dever::input('number', '', $system['name'] . '号', 'default');
-        $info = Dever::db($system['info_table'])->find(array('number' => $number));
+        $info = Dever::db($system['info_table'])->find(['number' => $number]);
         if (!$info) {
             Dever::error('登录失败,当前' . $system['name'] . '号错误');
         }
@@ -66,21 +66,21 @@ class Login
             Dever::error('登录失败,账户密码无效');
         }
         # 根据角色获取module_id
-        $system_user = Dever::db('system_user', 'manage')->find(array('uid' => $admin['id'], 'system_id' => $system['id'], 'info_id' => $info['id']));
+        $system_user = Dever::db('system_user', 'manage')->find(['uid' => $admin['id'], 'system_id' => $system['id'], 'info_id' => $info['id']]);
         $module_id = $data_id = 0;
         if ($system_user) {
             $module_id = $system_user['module_id'];
             $data_id = $system_user['data_id'];
         } elseif ($admin['role']) {
             $module = '';
-            $role = $role_db->select(array('id' => array('in', $admin['role'])));
+            $role = $role_db->select(array('id' => ['in', $admin['role']]));
             foreach ($role as $k => $v) {
                 if ($v['module']) {
                     $module .= $v['module'] . ',';
                 }
             }
             if ($module) {
-                $where['id'] = array('in', $module);
+                $where['id'] = ['in', $module];
             } else {
                 $where['system'] = $system['key'];
             }

+ 12 - 15
api/Menu.php

@@ -9,19 +9,18 @@ class Menu extends Auth
     {
         # 如果后续增加Root,就要这里置为false
         $this->top = true;
-        $top = Dever::db('menu', 'manage')->select(array('parent_id' => '0', 'module_id' => $this->user['select']['module_id']));
-        $result = $menu = array();
+        $top = Dever::db('menu', 'manage')->select(['parent_id' => '0', 'module_id' => $this->user['select']['module_id']]);
+        $result = $menu = [];
         $result[] = array
         (
             'path' => '/',
             'name' => 'Root',
             'component' => 'Layout',
-            'meta' => array
-            (
+            'meta' => [
                 'title' => '首页',
                 'icon' => 'home-2-line',
                 'breadcrumbHidden' => true,
-            ),
+            ],
             'children' => array
             (
                 array
@@ -29,23 +28,22 @@ class Menu extends Auth
                     'path' => 'index',
                     'name' => 'Index',
                     'component' => '@/dever/index/index',
-                    'meta' => array
-                    (
+                    'meta' => [
                         'title' => '控制台',
                         'icon' => 'home-2-line',
                         'noClosable' => true,
-                    )
+                    ]
                 ),
             )
         );
-        $this->opened = array();
+        $this->opened = [];
         foreach ($top as $v) {
             $v = $this->getMenu($v, '');
             if ($v) {
                 $result[] = $v;
             }
         }
-        return array('list' => $result, 'opened' => $this->opened);
+        return ['list' => $result, 'opened' => $this->opened];
     }
     private function getMenu($v, $parent = '')
     {
@@ -53,14 +51,13 @@ class Menu extends Auth
         (
             'path' => $parent ? '/' . $parent . '/' . $v['key'] : $v['key'],
             'name' => $parent ? $parent . '_' . $v['key'] : $v['key'],
-            'meta' => array
-            (
+            'meta' => [
                 'title' => $v['name'],
                 'icon' => $v['icon'],
                 //'noClosable' => true,
                 'breadcrumbHidden' => false,
                 'dynamicNewTab' => true,
-            )
+            ]
         );
         if ($v['show'] > 1) {
             $info['meta']['hidden'] = true;
@@ -77,7 +74,7 @@ class Menu extends Auth
             }
             $info['component'] = 'Layout';
         }
-        $where = array('parent_id' => $v['id'], 'module_id' => $this->user['select']['module_id']);
+        $where = ['parent_id' => $v['id'], 'module_id' => $this->user['select']['module_id']];
         $child = Dever::db('menu', 'manage')->select($where);
         if ($child) {
             foreach ($child as $v1) {
@@ -93,7 +90,7 @@ class Menu extends Auth
                 }
             }
             if (empty($info['children'])) {
-                return array();
+                return [];
             }
         } elseif ($v['path']) {
             $info['component'] = '@/dever/page/' . $v['path'];

+ 26 - 27
api/Page/Data.php

@@ -22,26 +22,25 @@ class Data extends Page
         $data['height'] = $this->config['height'] ?? '100%';
         $data['type'] = $this->config['type'] ?? 'table';
         $data['desc'] = $this->config['desc'] ?? '';
-        $data['layout'] = $this->config['layout'] ?? array();
+        $data['layout'] = $this->config['layout'] ?? [];
         $data['exportButton'] = $this->export();
-        $data['show'] = array
-        (
+        $data['show'] = [
             'selection' => $this->config['selection'] ?? false,
             'expand' => $this->expand,
             'index' => $this->config['index'] ?? false,
-        );
+        ];
         $this->column($data);
         return $data;
     }
     public function out()
     {
-        $where = $this->config['where'] ?? array();
-        $set = $this->config['set'] ?? array();
-        $data['field'] = $data['head'] = array();
+        $where = $this->config['where'] ?? [];
+        $set = $this->config['set'] ?? [];
+        $data['field'] = $data['head'] = [];
         $data['search'] = $this->search($where);
         $ids = Dever::input('ids');
         if ($ids) {
-            $where['id'] = array('in', $ids);
+            $where['id'] = ['in', $ids];
         }
         $set['num'] = Dever::input('pgnum', '', '', 10);
         $order_col = Dever::input('order_col');
@@ -52,7 +51,7 @@ class Data extends Page
             }
         }
         if (isset($this->config['data'])) {
-            $result = Dever::call($this->config['data'], array($where, $set));
+            $result = Dever::call($this->config['data'], [$where, $set]);
             $data = array_merge($data, $result);
         } else {
             $data['field'] = $this->setting('field', $data['head'], true, 'show');
@@ -60,25 +59,25 @@ class Data extends Page
         }
         $method = Dever::input('method');
         if ($method && strstr($method, '.')) {
-            $result = Dever::call($method, array($data));
+            $result = Dever::call($method, [$data]);
             unset($data);
             $data['field'] = $result['head'];
             $data['body'] = $result['body'];
         }
-        $data['stat'] = array();
+        $data['stat'] = [];
         if (isset($this->config['stat'])) {
-            $data['stat'] = Dever::call($this->config['stat'], array($where));
+            $data['stat'] = Dever::call($this->config['stat'], [$where]);
         }
         return $data;
     }
 
-    private function data($where, $set = array())
+    private function data($where, $set = [])
     {
         if (isset($this->config['tree'])) {
-            return $this->db->tree($where, $this->config['tree'], array($this, 'handleData'));
+            return $this->db->tree($where, $this->config['tree'], [$this, 'handleData']);
         }
         $data = $this->db->select($where, $set);
-        $result = array();
+        $result = [];
         if ($data) {
             foreach ($data as $k => $v) {
                 $result[$k] = $this->handleData($k, $v);
@@ -109,7 +108,7 @@ class Data extends Page
             } elseif (strpos($key, '/')) {
                 $other = $this->getOther($key, $value, $v);
                 if ($other) {
-                    $otherName = array();
+                    $otherName = [];
                     foreach ($other as $k1 => $v1) {
                         if (isset($v1['name'])) {
                             $otherName[] = $v1['name'];
@@ -129,7 +128,7 @@ class Data extends Page
             }
         }
         if (isset($this->config['expand']) && $this->config['expand']) {
-            $result['expand'] = Dever::call($this->config['expand'], array($v));
+            $result['expand'] = Dever::call($this->config['expand'], [$v]);
             $this->expand = true;
         }
         return $result;
@@ -139,7 +138,7 @@ class Data extends Page
     {
         $result = false;
         if (isset($this->config['export']) && $this->config['export']) {
-            $result = array();
+            $result = [];
             foreach ($this->config['export'] as $k => $v) {
                 $func = $this->getFunc($k, $v, 300);
                 if ($func) {
@@ -154,8 +153,8 @@ class Data extends Page
     {
         $search = Dever::input('search');
         $set = Dever::input('set');
-        $list_search = $result = array();
-        $result['form'] = $result['field'] = $result['option'] = array();
+        $list_search = $result = [];
+        $result['form'] = $result['field'] = $result['option'] = [];
         $this->setting('search', $list_search, false, 'text');
         if ($list_search) {
             foreach ($list_search as $v) {
@@ -188,8 +187,8 @@ class Data extends Page
                         $value = $v['search']($v['key'], $v['type'], $value);
                     } elseif (isset($v['search']['table'])) {
                         $v['search']['where'] = Dever::json_decode(str_replace('{value}', $value, Dever::json_encode($v['search']['where'])));
-                        $search = Dever::db($v['search']['table'])->select($v['search']['where'], $v['search']['set'] ?? array());
-                        $value = array();
+                        $search = Dever::db($v['search']['table'])->select($v['search']['where'], $v['search']['set'] ?? []);
+                        $value = [];
                         if ($search) {
                             foreach ($search as $v1) {
                                 $value[] = $v1[$v['search']['field']];
@@ -203,19 +202,19 @@ class Data extends Page
                     }
                 }
                 if ($v['type'] == 'group') {
-                    $where[$v['key']] = array('group', $value);
+                    $where[$v['key']] = ['group', $value];
                 } elseif ($v['type'] == 'selects') {
-                    $where[$v['key']] = array('group', $value);
+                    $where[$v['key']] = ['group', $value];
                 } elseif ($v['type'] == 'cascader') {
                     $t = $value;
                     if (is_array($value)) {
                         $t = implode(',', $value);
                     }
-                    $where[$v['key']] = array('like', $t);
+                    $where[$v['key']] = ['like', $t];
                 } elseif ($v['type'] == 'like') {
-                    $where[$v['key']] = array('like', $value);
+                    $where[$v['key']] = ['like', $value];
                 } elseif ($v['type'] == 'in') {
-                    $where[$v['key']] = array('in', $value);
+                    $where[$v['key']] = ['in', $value];
                 } elseif ($v['type'] == 'date') {
                     if (strstr($v['date_type'], 'range')) {
                         $where[$v['key']] = array('>=', \Dever\Helper\Date::mktime($value[0]));

+ 6 - 6
api/Page/Oper.php

@@ -29,13 +29,13 @@ class Oper extends Page
             }
         }
         if (isset($this->config['up_start']) && $this->config['up_start']) {
-            list($this->id, $data) = Dever::call($this->config['up_start'], array($this->id, $data));
+            list($this->id, $data) = Dever::call($this->config['up_start'], [$this->id, $data]);
         }
-        $where['id'] = array('in', $this->id);
+        $where['id'] = ['in', $this->id];
         $state = $this->db->update($where, $data);
         if ($state) {
             if (isset($this->config['up_end']) && $this->config['up_end']) {
-                Dever::call($this->config['up_end'], array($this->id, $data));
+                Dever::call($this->config['up_end'], [$this->id, $data]);
             }
             return '操作成功';
         } else {
@@ -47,7 +47,7 @@ class Oper extends Page
     public function recycle_commit(){}
     public function recycle()
     {
-        $where['id'] = array('in', $this->id);
+        $where['id'] = ['in', $this->id];
         $data = $this->db->select($where);
         if ($data) {
             foreach ($data as $k => $v) {
@@ -71,7 +71,7 @@ class Oper extends Page
     public function recover_commit(){}
     public function recover()
     {
-        $where['id'] = array('in', $this->id);
+        $where['id'] = ['in', $this->id];
         $data = $this->db->select($where);
         if ($data) {
             foreach ($data as $k => $v) {
@@ -93,7 +93,7 @@ class Oper extends Page
     public function delete_commit(){}
     public function delete()
     {
-        $where['id'] = array('in', $this->id);
+        $where['id'] = ['in', $this->id];
         $state = $this->db->delete($where);
         if (!$state) {
             Dever::error('删除失败,请重试');

+ 58 - 58
api/Page/Update.php

@@ -10,11 +10,11 @@ class Update extends Page
     {
         parent::__construct('update', $load, $input);
     }
-    public function get(&$value = array(), &$option = array())
+    public function get(&$value = [], &$option = [])
     {
         $func = $this->checkFunc();
-        $remote = $show = $spec = $source = $default = array();
-        $data['update'] = $data['field'] = $data['option'] = array();
+        $remote = $show = $spec = $source = $default = [];
+        $data['update'] = $data['field'] = $data['option'] = [];
         $this->setting('field', $data['update'], true, 'text');
         foreach ($data['update'] as $k => $v) {
             if ($v['type'] == 'tree' || $v['type'] == 'upload' || $v['type'] == 'cascader' || $v['type'] == 'checkbox' || isset($v['multiple'])) {
@@ -26,26 +26,26 @@ class Update extends Page
                         }
                     }
                 } else {
-                    $v['value'] = array();
+                    $v['value'] = [];
                 }
             }
             if (isset($v['source'])) {
                 $source[$v['key']] = $v['source'];
             }
             if (isset($v['remote'])) {
-                $remote[$v['key']] = array($k, $v['remote'], $v['key']);
+                $remote[$v['key']] = [$k, $v['remote'], $v['key']];
                 if (isset($v['remote_default']) && !$v['remote_default']) {
                     unset($remote[$v['key']][2]);
                 }
             }
             if (isset($v['spec_data'])) {
-                $spec[$v['key']] = array($k, $v['spec_data'], $v['key'] . '_spec', $v['spec'], $v['spec_field']);
+                $spec[$v['key']] = [$k, $v['spec_data'], $v['key'] . '_spec', $v['spec'], $v['spec_field']];
             }
             if (isset($v['show']) && is_string($v['show'])) {
-                $show[$v['key']] = array($k, $v['show']);
+                $show[$v['key']] = [$k, $v['show']];
             }
             if (isset($v['default']) && is_string($v['default']) && strstr($v['default'], '{')) {
-                $default[$v['key']] = array($k, $v['default']);
+                $default[$v['key']] = [$k, $v['default']];
             }
             $data['field'][$v['key']] = $v['value'];
             if ($v['type'] == 'sku') {
@@ -80,15 +80,15 @@ class Update extends Page
             $this->setInfo($info, $data, $remote, $show, $source, $default, 1, $this->config['field']);
             if ($spec) {
                 foreach ($spec as $k => $v) {
-                    $data['update'][$spec[$k][0]]['remote'] = Dever::url($spec[$k][1], array('value' => '', 'table' => $this->db->config['load'], 'id' => false));
-                    $result = Dever::call($spec[$k][1], array($spec[$k][3], $spec[$k][4], $this->info['id']));
+                    $data['update'][$spec[$k][0]]['remote'] = Dever::url($spec[$k][1], ['value' => '', 'table' => $this->db->config['load'], 'id' => false]);
+                    $result = Dever::call($spec[$k][1], [$spec[$k][3], $spec[$k][4], $this->info['id']]);
                     if ($result) {
                         $data['field'][$spec[$k][2]] = $result;
                     }
                 }
             }
         } elseif ($value) {
-            $field = array();
+            $field = [];
             if (isset($this->config['field']) && $this->config['field']) {
                 foreach ($this->config['field'] as $k => $v) {
                     if (isset($v['field'])) {
@@ -115,13 +115,13 @@ class Update extends Page
             }
         } else {
             if ($remote) {
-                $info = array();
+                $info = [];
                 foreach ($remote as $k => $v) {
-                    $data['update'][$v[0]]['remote'] = Dever::url($v[1], array('value' => '', 'table' => $this->db->config['load'], 'id' => false));
+                    $data['update'][$v[0]]['remote'] = Dever::url($v[1], ['value' => '', 'table' => $this->db->config['load'], 'id' => false]);
                     if (isset($v[2]) && isset($data['option'][$v[2]]) && $data['option'][$v[2]] && $m = Dever::issets($data['option'][$v[2]][0], 'id')) {
                         $path = 'api';
                         if (strstr($v[1], 'mapi')) $path = 'manage';
-                        $result = Dever::call($v[1], array($m, $this->db->config['load'], false), $path);
+                        $result = Dever::call($v[1], [$m, $this->db->config['load'], false], $path);
                         if ($result) {
                             $this->setUpdate($info, $data, $result);
                         }
@@ -146,11 +146,11 @@ class Update extends Page
         return $data;
     }
 
-    private function setInfo(&$info, &$data, $remote, $show, $source, $default, $type = 1, $field = array())
+    private function setInfo(&$info, &$data, $remote, $show, $source, $default, $type = 1, $field = [])
     {
         if ($source) {
             foreach ($source as $k => $v) {
-                $t = array();
+                $t = [];
                 foreach ($v as $v1) {
                     $t[] = $info[$v1] ?? '';
                 }
@@ -171,7 +171,7 @@ class Update extends Page
                             }
                         }
                     } else {
-                        $v = array();
+                        $v = [];
                     }
                     $info[$k] = $v;
                 }
@@ -188,13 +188,13 @@ class Update extends Page
                     $data['field'][$k] = $v;
                 }
                 if (isset($remote[$k])) {
-                    $data['update'][$remote[$k][0]]['remote'] = Dever::url($remote[$k][1], array('value' => '', 'table' => $this->db->config['load'], 'id' => false));
+                    $data['update'][$remote[$k][0]]['remote'] = Dever::url($remote[$k][1], ['value' => '', 'table' => $this->db->config['load'], 'id' => false]);
                     if ($field[$k]['type'] == 'cascader' && !isset($field[$k]['option'])) {
                         
                     } else {
                         $path = 'api';
                         if (strstr($remote[$k][1], 'mapi')) $path = 'manage';
-                        $result = Dever::call($remote[$k][1], array($v, $this->db->config['load'], $info['id'] ?? false), $path);
+                        $result = Dever::call($remote[$k][1], [$v, $this->db->config['load'], $info['id'] ?? false], $path);
                         if ($result) {
                             $this->setUpdate($info, $data, $result);
                         }
@@ -219,7 +219,7 @@ class Update extends Page
         }
     }
 
-    private function setUpdate(&$info, &$data, $result, $remote = array())
+    private function setUpdate(&$info, &$data, $result, $remote = [])
     {
         foreach ($data['update'] as $k => $v) {
             if (isset($result[$v['key']])) {
@@ -248,7 +248,7 @@ class Update extends Page
 
     private function control(&$data)
     {
-        $result = array();
+        $result = [];
         if (isset($this->config['control']) && $this->config['control']) {
             foreach ($this->config['control'] as $k => $v) {
                 if (is_string($v)) {
@@ -309,12 +309,12 @@ class Update extends Page
     private function tab(&$data, $type = 'tab')
     {
         $field = $this->input('field', '');
-        $data[$type] = array();
+        $data[$type] = [];
         //if (empty($data['layout']) && !$field && isset($this->config[$type])) {
         if (empty($data['layout']) && isset($this->config[$type])) {
             foreach ($this->config[$type] as $k => $v) {
                 if (is_string($v)) {
-                    $field = array();
+                    $field = [];
                     $data[$type][] = array
                     (
                         'name' => $k,
@@ -322,8 +322,8 @@ class Update extends Page
                         'field' => $field,
                     );
                 } else {
-                    $field = array();
-                    $result = array();
+                    $field = [];
+                    $result = [];
                     $result['name'] = $k;
                     foreach ($v as $v1) {
                         $result['layout'][] = $this->getUpdate($v1, $data['update'], $field);
@@ -332,26 +332,26 @@ class Update extends Page
                     $data[$type][] = $result;
                 }
             }
-            $data['update'] = array();
+            $data['update'] = [];
         }
     }
 
     private function layout(&$data)
     {
         $field = $this->input('field', '');
-        $data['layout'] = array();
+        $data['layout'] = [];
         if (!$field && isset($this->config['layout'])) {
             foreach ($this->config['layout'] as $k => $v) {
-                $field = array();
+                $field = [];
                 $data['layout'][] = $this->getUpdate($v, $data['update'], $field);
             }
-            $data['update'] = array();
+            $data['update'] = [];
         }
     }
 
     private function getUpdate($set, $update, &$field)
     {
-        $result = array();
+        $result = [];
         if (is_string($set)) {
             $set = explode(',', $set);
             foreach ($set as $k => $v) {
@@ -366,7 +366,7 @@ class Update extends Page
             foreach ($set as $k => $v) {
                 foreach ($update as $value) {
                     if ($value['key'] == $k) {
-                        $result[] = array('span' => $v, 'update' => array($value));
+                        $result[] = array('span' => $v, 'update' => [$value]);
                         $field[] = $k;
                     }
                 }
@@ -379,10 +379,10 @@ class Update extends Page
     public function do()
     {
         $this->checkFunc();
-        $update = array();
+        $update = [];
         $this->setting('field', $update, true, 'text');
         if ($update) {
-            $data = $other = $sku = array();
+            $data = $other = $sku = [];
             $input = Dever::input();
             $id = false;
             if (isset($input['id']) && $input['id'] > 0) {
@@ -396,7 +396,7 @@ class Update extends Page
                     }
                     if ($v['type'] == 'sku') {
                         if (isset($input[$v['key'] . '_spec']) && isset($input[$v['key']])) {
-                            $sku[$v['key']] = array($v['where'], $v['content']['field'], $v['spec'], $v['spec_field'], $input[$v['key'] . '_spec'], $input[$v['key']]);
+                            $sku[$v['key']] = [$v['where'], $v['content']['field'], $v['spec'], $v['spec_field'], $input[$v['key'] . '_spec'], $input[$v['key']]];
                         }
                         
                     } elseif (strpos($v['key'], '/') && $v['type'] != 'hidden') {
@@ -408,15 +408,15 @@ class Update extends Page
                             $other_id = $input[$v['key'] . '_id'] ?? 0;
                             $value = array
                             (
-                                0 => array('id' => $other_id, $v['field'] => $value)
+                                0 => ['id' => $other_id, $v['field'] => $value]
                             );
                             if (isset($other[$v['key']])) {
                                 $other[$v['key']][3][0] += $value[0];
                             } else {
-                                $other[$v['key']] = array($v['where'], false, false, $value);
+                                $other[$v['key']] = [$v['where'], false, false, $value];
                             }
                         } else {
-                            $other[$v['key']] = array($v['where'], $v['content']['field'], $v['content']['drag'], $input[$v['key']]);
+                            $other[$v['key']] = [$v['where'], $v['content']['field'], $v['content']['drag'], $input[$v['key']]];
                         }
                     } else {
                         $this->doData($data, $v['key'], $input[$v['key']], $this->config['field'], $control);
@@ -464,7 +464,7 @@ class Update extends Page
         }
     }
 
-    private function doData(&$data, $key, $value, $field = array(), $control = array())
+    private function doData(&$data, $key, $value, $field = [], $control = [])
     {
         if (is_array($value)) {
             if (isset($value[0])) {
@@ -490,7 +490,7 @@ class Update extends Page
             }
         }
         if ($value && isset($field[$key]) && $handle = Dever::issets($field[$key], 'handle')) {
-            $value = Dever::call($handle, array($value));
+            $value = Dever::call($handle, [$value]);
             if (is_array($value) && isset($value[$key])) {
                 foreach ($value as $k => $v) {
                     $data[$k] = trim($v);
@@ -511,8 +511,8 @@ class Update extends Page
     private function exists($db, $check, $id, $data, $field)
     {
         $check = explode(',', $check);
-        $where = array();
-        $name = array();
+        $where = [];
+        $name = [];
         foreach ($check as $k => $v) {
             if (isset($data[$v]) && $data[$v]) {
                 if (isset($field[$v]) && isset($field[$v]['name'])) {
@@ -528,7 +528,7 @@ class Update extends Page
         }
         if ($where) {
             if ($id) {
-                $where['id'] = array('!=', $id);
+                $where['id'] = ['!=', $id];
             }
             $info = $db->find($where);
             if ($info) {
@@ -545,10 +545,10 @@ class Update extends Page
             if (is_array($this->config['start'])) {
                 $result = $data;
                 foreach ($this->config['start'] as $k => $v) {
-                    $result = Dever::call($v, array($this->db, $result));
+                    $result = Dever::call($v, [$this->db, $result]);
                 }
             } else {
-                $result = Dever::call($this->config['start'], array($this->db, $data));
+                $result = Dever::call($this->config['start'], [$this->db, $data]);
             }
             if ($result) {
                 if ($result == 'end') {
@@ -569,10 +569,10 @@ class Update extends Page
             $data['id'] = $id;
             if (is_array($this->config['end'])) {
                 foreach ($this->config['end'] as $k => $v) {
-                    Dever::call($v, array($this->db, $data));
+                    Dever::call($v, [$this->db, $data]);
                 }
             } else {
-                Dever::call($this->config['end'], array($this->db, $data));
+                Dever::call($this->config['end'], [$this->db, $data]);
             }
         }
     }
@@ -589,7 +589,7 @@ class Update extends Page
                 $update = $v[1];
                 $drag = $v[2];
                 $input = $v[3];
-                $value = array();
+                $value = [];
                 foreach ($input as $k1 => $v1) {
                     if (isset($v1['id']) && $v1['id']) {
                         $value['id'] = $v1['id'];
@@ -652,11 +652,11 @@ class Update extends Page
                 $spec_field = $v[3];
                 $spec = $v[4];
                 $input = $v[5];
-                $value = $spec_value = array();
-                Dever::db($spec_table)->update(array($spec_field => $rid), array('state' => 2));
-                Dever::db($spec_value_table)->update(array($spec_field => $rid), array('state' => 2));
+                $value = $spec_value = [];
+                Dever::db($spec_table)->update([$spec_field => $rid], ['state' => 2]);
+                Dever::db($spec_value_table)->update([$spec_field => $rid], ['state' => 2]);
                 foreach ($spec as $k1 => &$v1) {
-                    $spec_data = array();
+                    $spec_data = [];
                     $spec_data['state'] = 1;
                     $spec_data[$spec_field] = $rid;
                     $spec_data['name'] = $v1['name'];
@@ -668,7 +668,7 @@ class Update extends Page
                     }
                     if ($v1['id']) {
                         foreach ($v1['value'] as $k2 => &$v2) {
-                            $spec_value_data = array();
+                            $spec_value_data = [];
                             $spec_value_data['state'] = 1;
                             $spec_value_data[$spec_field] = $rid;
                             $spec_value_data['spec_id'] = $v1['id'];
@@ -680,13 +680,13 @@ class Update extends Page
                             } else {
                                 $v2['id'] = Dever::db($spec_value_table)->insert($spec_value_data);
                             }
-                            $spec_value[$v1['key']][$spec_value_data['value']] = array($v2['id'], $spec_data['sort']);
+                            $spec_value[$v1['key']][$spec_value_data['value']] = [$v2['id'], $spec_data['sort']];
                         }
                     }
                 }
-                Dever::db($spec_table)->delete(array($spec_field => $rid, 'state' => 2));
-                Dever::db($spec_value_table)->delete(array($spec_field => $rid, 'state' => 2));
-                Dever::db($k)->update(array($spec_field => $rid), array('state' => 2));
+                Dever::db($spec_table)->delete([$spec_field => $rid, 'state' => 2]);
+                Dever::db($spec_value_table)->delete([$spec_field => $rid, 'state' => 2]);
+                Dever::db($k)->update([$spec_field => $rid], ['state' => 2]);
                 foreach ($input as $k1 => $v1) {
                     if (isset($v1['id'])) {
                         $value['id'] = $v1['id'];
@@ -707,7 +707,7 @@ class Update extends Page
                             $value[$k2] = $v1[$k2];
                         }
                     }
-                    $value['key'] = array();
+                    $value['key'] = [];
                     foreach ($v1 as $k2 => $v2) {
                         if (isset($spec_value[$k2]) && isset($spec_value[$k2][$v2])) {
                             $value['key'][$spec_value[$k2][$v2][1]] = $spec_value[$k2][$v2][0];
@@ -725,7 +725,7 @@ class Update extends Page
                         Dever::db($k)->insert($value);
                     }
                 }
-                Dever::db($k)->delete(array($spec_field => $rid, 'state' => 2));
+                Dever::db($k)->delete([$spec_field => $rid, 'state' => 2]);
             }
         }
     }

+ 1 - 1
api/Page/View.php

@@ -11,7 +11,7 @@ class View extends Page
     public function get()
     {
         $this->checkFunc();
-        $data = Dever::call($this->config, array($this));
+        $data = Dever::call($this->config, [$this]);
         return $data;
     }
 }

+ 6 - 6
lib/Auth.php

@@ -9,7 +9,7 @@ class Auth
     protected $system_info;
     protected $info;
     protected $func;
-    public $data = array();
+    public $data = [];
     public function __construct($set = false)
     {
         $info = Dever::load('common', 'manage')->auth();
@@ -37,9 +37,9 @@ class Auth
             Dever::error('请先登录');
         }
         $this->user['table'] = $this->system['user_table'];
-        $this->user['auth'] = array('module' => '', 'menu' => '', 'func' => '');
+        $this->user['auth'] = ['module' => '', 'menu' => '', 'func' => ''];
         if ($this->user['role']) {
-            $role = Dever::db($this->system['role_table'])->select(array('id' => array('in', $this->user['role'])));
+            $role = Dever::db($this->system['role_table'])->select(array('id' => ['in', $this->user['role']]));
             foreach ($role as $k => $v) {
                 $this->user['auth']['module'] .= $v['module'] . ',';
                 $this->user['auth']['menu'] .= $v['menu'] . ',';
@@ -58,7 +58,7 @@ class Auth
         $this->user['select'] = $info['extend'] ?? false;
         if (!$this->user['select']) {
             # 分别为系统id,系统基本信息id,模块id,模块数据id
-            $this->user['select'] = array('partition' => 'no', 'system_id' => 1, 'info_id' => 1, 'module_id' => 1, 'data_id' => 1);
+            $this->user['select'] = ['partition' => 'no', 'system_id' => 1, 'info_id' => 1, 'module_id' => 1, 'data_id' => 1];
         }
         $this->checkModule($this->user['select']['module_id']);
         if ($set) {
@@ -96,14 +96,14 @@ class Auth
             $data['name'] = $name;
             $data['sort'] = $sort;
             $id = Dever::db('menu_func', 'manage')->insert($data);
-            Dever::db('menu', 'manage')->update($this->menu['id'], array('func' => 1));
+            Dever::db('menu', 'manage')->update($this->menu['id'], ['func' => 1]);
         } else {
             /*
             if ($info['name'] != $name) {
                 $data['name'] = $name;
                 $data['sort'] = $sort;
                 Dever::db('menu_func', 'manage')->update($info['id'], $data);
-                Dever::db('menu', 'manage')->update($this->menu['id'], array('func' => 1));
+                Dever::db('menu', 'manage')->update($this->menu['id'], ['func' => 1]);
             }*/
             $id = $this->func[$key]['id'];
         }

+ 85 - 118
lib/Common.php

@@ -49,7 +49,7 @@ class Common
     }
 
     # 获取页面类
-    public function page($load, $config = array(), $key = 'list', $input = true)
+    public function page($load, $config = [], $key = 'list', $input = true)
     {
         $page = new Page($key, $load, $input, $config);
         return $page;
@@ -64,7 +64,7 @@ class Common
         if ($info && isset($info['info_id']) && isset($info['partition'])) {
             # 这里后续增加从数据库中获取
             $value = $info['system_id'] . '_' . $info['info_id'];
-            $result = array();
+            $result = [];
             if (strpos($info['partition'], '.')) {
                 $temp = explode('.', $info['partition']);
                 $result = $this->partition($result, $temp[0], $info['system_key'], $value);
@@ -91,17 +91,15 @@ class Common
     private function partition(&$result, $type, $key, $value)
     {
         if ($type == 'field') {
-            $result[$type] = array
-            (
+            $result[$type] = [
                 'type' => 'key',
                 'field' => $key,
                 'value' => $value,
-            );
+            ];
         } elseif ($type == 'where') {
-            $result[$type] = array
-            (
+            $result[$type] = [
                 $key => $value
-            );
+            ];
         } else {
             $result[$type] = $value;
         }
@@ -174,9 +172,9 @@ class Common
     {
         if ($data['name'] && !$data['key']) {
             if (Dever::project('pinyin')) {
-                $where = array();
+                $where = [];
                 if (isset($data['id']) && $data['id']) {
-                    $where['id'] = array('!=', $data['id']);
+                    $where['id'] = ['!=', $data['id']];
                 }
                 $data['key'] = Dever::load('convert', 'pinyin')->getPinyin($data['name']);
 
@@ -214,7 +212,7 @@ class Common
     # 根据load获取db
     public function db($load)
     {
-        $menu = array();
+        $menu = [];
         $load = explode('/', ltrim($load, '/'));
         if (isset($load[2])) {
             $app = $load[1];
@@ -223,9 +221,9 @@ class Common
             $app = $load[0];
             $table = $load[1];
         }
-        $parent = Dever::db('menu', 'manage')->find(array('key' => $app));
+        $parent = Dever::db('menu', 'manage')->find(['key' => $app]);
         if ($parent) {
-            $menu = Dever::db('menu', 'manage')->find(array('parent_id' => $parent['id'], 'key' => $table));
+            $menu = Dever::db('menu', 'manage')->find(['parent_id' => $parent['id'], 'key' => $table]);
             if ($menu) {
                 $app = $menu['app'];
             }
@@ -246,20 +244,19 @@ class Common
         }
         $db = Dever::db($table, $app);
         $db->config['manage'] = $manage;
-        return array($db, $menu);
+        return [$db, $menu];
     }
 
     # 获取项目
     public function project()
     {
-        $result = array();
+        $result = [];
         $app = \Dever\Project::read();
         foreach ($app as $k => $v) {
-            $result[] = array
-            (
+            $result[] = [
                 'id' => $k,
                 'name' => $v['lang'] ?? $k,
-            );
+            ];
         }
         return $result;
     }
@@ -267,11 +264,11 @@ class Common
     # 仅为测试用
     public function out($data)
     {
-        $result = array();
-        $result['head'] = array('id', '姓名', '时间');
-        $result['body'] = array();
+        $result = [];
+        $result['head'] = ['id', '姓名', '时间'];
+        $result['body'] = [];
         foreach ($data['body'] as $k => $v) {
-            $result['body'][$k] = array($v['id'], $v['name'], $v['cdate']);
+            $result['body'][$k] = [$v['id'], $v['name'], $v['cdate']];
         }
         return $result;
     }
@@ -284,11 +281,11 @@ class Common
         $result['content'] = 'ddddd';
 
         $result['type'] = 'table';
-        $result['head'] = array('id' => 'id', 'name' => '姓名');
+        $result['head'] = ['id' => 'id', 'name' => '姓名'];
         $result['body'] = array
         (
-            array('id' => '1', 'name' => 'test'),
-            array('id' => '2', 'name' => 'test2'),
+            ['id' => '1', 'name' => 'test'],
+            ['id' => '2', 'name' => 'test2'],
         );
 
         $result['type'] = 'card';
@@ -296,18 +293,17 @@ class Common
         (
             'title' => '订单信息',
             'shadow' => 'never',//always | never | hover
-            'content' => array
-            (
+            'content' => [
                 '1111',
                 '2222',
-            ), 
+            ], 
         );
 
         $result['type'] = 'list';
         $result['content'] = array
         (
-            array('日志类型', 'test'),
-            array('姓名', 'test1'),
+            ['日志类型', 'test'],
+            ['姓名', 'test1'],
         );
         return $result;
     }
@@ -340,47 +336,41 @@ class Common
                     # 增加权限,第三个参数是排序,建议大一些
                     //'func' => $page->getFunc('view_fastedit', '详情页-编辑角色', 1000),
                     # 这里是按钮用到的参数数据
-                    'row' => array
-                    (
+                    'row' => [
                         'id' => 1,
-                    ),
+                    ],
                 ),
             ),
             # 具体内容
             'content' => array
             (
-                array
-                (
+                [
                     'name' => '标题',
                     # 类型,text普通文本,tag标签,link链接,image图片 progress进度条 stat统计 timeline时间线 table表格
                     'type' => 'text',
                     'content' => '内容',
                     # 样式primary success warning danger info exception
                     'style' => 'primary',
-                ),
-                array
-                (
+                ],
+                [
                     'name' => '标题',
                     'type' => 'tag',
                     'content' => '内容',
                     'style' => 'warning',
-                ),
-                array
-                (
+                ],
+                [
                     'name' => '标题',
                     'type' => 'link',
                     'content' => '内容',
-                ),
-                array
-                (
+                ],
+                [
                     'name' => '图片',
                     'type' => 'image',
                     'content' => 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
                     # 'fill', 'contain', 'cover', 'none', 'scale-down'
                     'fit' => 'fill',
-                ),
-                array
-                (
+                ],
+                [
                     'name' => '进度条',
                     'type' => 'progress',
                     'content' => '10',
@@ -393,38 +383,34 @@ class Common
                     'striped' => true,
                     # 开启动画
                     'indeterminate' => true,
-                ),
+                ],
                 array
                 (
                     'name' => '统计',
                     'type' => 'stat',
                     'content' => array
                     (
-                        array
-                        (
+                        [
                             # 一共24
                             'span' => '6',
                             'name' => '测试',
                             'value' => '1000',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'span' => '6',
                             'name' => '测试1',
                             'value' => '1000',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'span' => '6',
                             'name' => '测试2',
                             'value' => '1000',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'span' => '6',
                             'name' => '测试2',
                             'value' => '1000',
-                        ),
+                        ],
                     ),
                 ),
 
@@ -434,30 +420,26 @@ class Common
                     'type' => 'timeline',
                     'content' => array
                     (
-                        array
-                        (
+                        [
                             'time' => '2020-10-11',
                             'name' => '测试',
                             'color' => '#0bbd87',
                             'size' => 'large',
                             'type' => 'primary',
                             'hollow' => true,
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'time' => '2020-10-11',
                             'name' => '测试',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'time' => '2020-10-11',
                             'name' => '测试',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'time' => '2020-10-11',
                             'name' => '测试',
-                        ),
+                        ],
                     ),
                 ),
 
@@ -469,36 +451,32 @@ class Common
                     'height' => '200',
                     'head' => array
                     (
-                        array
-                        (
+                        [
                             'key' => 'name',
                             'name' => '姓名',
                             'fixed' => 'fixed',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'key' => 'desc',
                             'name' => '描述',
                             'fixed' => 'fixed',
-                        ),
+                        ],
                     ),
                     'button' => array
                     (
-                        array
-                        (
+                        [
                             'name' => '编辑',
                             'type' => 'fastedit',
                             'load' => 'platform/role',
-                        ),
+                        ],
                     ),
                     'body' => array
                     (
-                        array
-                        (
+                        [
                             'id' => 1,
                             'name' => 'test',
                             'desc' => 'dfdf',
-                        ),
+                        ],
                     ),
                 ),
             ),
@@ -512,18 +490,16 @@ class Common
             'height' => '200',
             'head' => array
             (
-                array
-                (
+                [
                     'key' => 'name',
                     'name' => '姓名',
                     'fixed' => 'fixed',
-                ),
-                array
-                (
+                ],
+                [
                     'key' => 'desc',
                     'name' => '描述',
                     'fixed' => 'fixed',
-                ),
+                ],
             ),
             'button' => array
             (
@@ -538,12 +514,11 @@ class Common
             ),
             'body' => array
             (
-                array
-                (
+                [
                     'id' => 1,
                     'name' => 'test',
                     'desc' => 'dfdf',
-                ),
+                ],
             ),
         );
         $tab = array
@@ -551,14 +526,13 @@ class Common
             'active' => 'table1',
             'content' => array
             (
-                'table1' => array
-                (
+                'table1' => [
                     # 这里跟desc一样
                     'name' => '标题',
                     'type' => 'text',
                     'content' => '内容',
                     'style' => 'primary',
-                ),
+                ],
 
                 'tab2' => array
                 (
@@ -568,66 +542,59 @@ class Common
                     'height' => '200',
                     'head' => array
                     (
-                        array
-                        (
+                        [
                             'key' => 'name',
                             'name' => '姓名',
                             'fixed' => 'fixed',
-                        ),
-                        array
-                        (
+                        ],
+                        [
                             'key' => 'desc',
                             'name' => '描述',
                             'fixed' => 'fixed',
-                        ),
+                        ],
                     ),
                     'button' => array
                     (
-                        array
-                        (
+                        [
                             'name' => '编辑',
                             'type' => 'fastedit',
                             'load' => 'platform/role',
-                        ),
+                        ],
                     ),
                     'body' => array
                     (
-                        array
-                        (
+                        [
                             'id' => 1,
                             'name' => 'test',
                             'desc' => 'dfdf',
-                        ),
+                        ],
                     ),
                 ),
             )
         );
-        return array('info' => $info, 'tab' => $tab);
+        return ['info' => $info, 'tab' => $tab];
     }
 
     public function stat($where)
     {
         return array
         (
-            array
-            (
+            [
                 # 一共24
                 'span' => '8',
                 'name' => '测试',
                 'value' => '1000',
-            ),
-            array
-            (
+            ],
+            [
                 'span' => '8',
                 'name' => '测试1',
                 'value' => '1000',
-            ),
-            array
-            (
+            ],
+            [
                 'span' => '8',
                 'name' => '测试2',
                 'value' => '1000',
-            ),
+            ],
         );
     }
 }

+ 3 - 4
lib/Config.php

@@ -6,13 +6,12 @@ class Config extends Auth
     public function getTree()
     {
         $data = Dever::db('config', 'manage')->select([]);
-        $result = array();
-        $result[] = array
-        (
+        $result = [];
+        $result[] = [
             'id' => 'root',
             'name' => '全部配置',
             'children' => $data,
-        );
+        ];
         return $result;
     }
 }

+ 5 - 6
lib/Group.php

@@ -6,13 +6,12 @@ class Group extends Auth
     public function getTree()
     {
         $data = Dever::db('group', 'manage')->select([]);
-        $result = array();
-        $result[] = array
-        (
+        $result = [];
+        $result[] = [
             'id' => 'root',
             'name' => '全部集团',
             'children' => $data,
-        );
+        ];
         return $result;
     }
 
@@ -50,12 +49,12 @@ class Group extends Auth
             $data['partition'] = $system['partition'];
             $db = Dever::db($system['user_table'], '', 'default', Dever::load('common', 'manage')->system($data));
 
-            $info = $db->find(array('mobile' => $mobile));
+            $info = $db->find(['mobile' => $mobile]);
             if ($state && $info) {
                 Dever::error('手机号' . $mobile . '已存在,请更换手机号');
             }
 
-            $module = Dever::db('system_module', 'manage')->find(array('key' => $module, 'system' => 'group'));
+            $module = Dever::db('system_module', 'manage')->find(['key' => $module, 'system' => 'group']);
             $insert['name'] = $name;
             $insert['mobile'] = $mobile;
             $insert['role'] = 2;

+ 7 - 7
lib/Menu.php

@@ -31,7 +31,7 @@ class Menu
     {
         if (isset($core['system'])) {
             foreach ($core['system'] as $k => $v) {
-                $where = array();
+                $where = [];
                 $where['key'] = $k;
                 $data = $where;
                 $data['name'] = $v['name'];
@@ -45,7 +45,7 @@ class Menu
         }
         if (isset($core['module'])) {
             foreach ($core['module'] as $k => $v) {
-                $where = array();
+                $where = [];
                 $where['key'] = $k;
                 $data = $where;
                 $data['name'] = $v['name'];
@@ -60,14 +60,14 @@ class Menu
         }
         if (isset($core['menu'])) {
             foreach ($core['menu'] as $k => $v) {
-                $where = array();
+                $where = [];
                 if (isset($v['app'])) {
                     $app = $v['app'];
                 }
                 $where['app'] = $app;
                 $where['key'] = $k;
                 if (isset($v['parent'])) {
-                    $parent = Dever::db('menu', 'manage')->find(array('key' => $v['parent']));
+                    $parent = Dever::db('menu', 'manage')->find(['key' => $v['parent']]);
                     if ($parent) {
                         $where['parent_id'] = $parent['id'];
                         $where['module_id'] = $parent['module_id'];
@@ -80,7 +80,7 @@ class Menu
                     $where['level'] = 1;
                 }
                 if (isset($v['module'])) {
-                    $module = Dever::db('system_module', 'manage')->find(array('key' => $v['module']));
+                    $module = Dever::db('system_module', 'manage')->find(['key' => $v['module']]);
                     if ($module) {
                         $where['module_id'] = $module['id'];
                     }
@@ -114,7 +114,7 @@ class Menu
     }
     public function getAll()
     {
-        $data = Dever::db('menu', 'manage')->select(array('parent_id' => '0'));
+        $data = Dever::db('menu', 'manage')->select(['parent_id' => '0']);
         return $data;
     }
 
@@ -125,7 +125,7 @@ class Menu
         }
         $key = array_rand($this->icon, 1);
         $icon = $this->icon[$key]['key'];
-        $info = Dever::db('menu', 'manage')->find(array('icon' => $icon));
+        $info = Dever::db('menu', 'manage')->find(['icon' => $icon]);
         if ($info) {
             return $this->getIcon();
         }

+ 3 - 4
lib/Module.php

@@ -6,13 +6,12 @@ class Module extends Auth
     public function getTree()
     {
         $data = Dever::db('system_module', 'manage')->select([]);
-        $result = array();
-        $result[] = array
-        (
+        $result = [];
+        $result[] = [
             'id' => 'root',
             'name' => '系统模块',
             'children' => $data,
-        );
+        ];
         return $result;
     }
 }

+ 33 - 37
lib/Page.php

@@ -8,11 +8,11 @@ class Page extends Auth
     protected $id = 0;
     protected $input = false;
     protected $recycler = false;
-    protected $menu = array();
-    protected $config = array();
-    protected $field = array();
-    public $info = array();
-    public function __construct($key = '', $load = '', $input = true, $config = array())
+    protected $menu = [];
+    protected $config = [];
+    protected $field = [];
+    public $info = [];
+    public function __construct($key = '', $load = '', $input = true, $config = [])
     {
         parent::__construct();
         $this->key = $key;
@@ -25,7 +25,7 @@ class Page extends Auth
         if ($this->menu && $this->menu['show'] == 1) {
             $this->checkMenu($this->menu['id'], false);
         }
-        $this->config = $this->db->config['manage'][$key] ?? array();
+        $this->config = $this->db->config['manage'][$key] ?? [];
         if ($config) {
             $this->config = array_merge($this->config, $config);
         }
@@ -54,12 +54,12 @@ class Page extends Auth
     }
 
     # 获取某个数据的具体展示值
-    public function getValue($key, $value, $data, $field = array())
+    public function getValue($key, $value, $data, $field = [])
     {
         if ($key == 'cdate') {
             $this->db->config['manage']['update']['field'][$key]['type'] = 'date';
         }
-        $update = $this->db->config['manage']['update']['field'] ?? array();
+        $update = $this->db->config['manage']['update']['field'] ?? [];
         if ($show = Dever::issets($field, 'show')) {
             $value = $this->getShow($show, $data);
         } elseif ($value && isset($this->db->config['struct'][$key]['value']) && $this->db->config['struct'][$key]['value']) {
@@ -90,7 +90,7 @@ class Page extends Auth
     # 获取关联数据
     public function getOther($key, $set, $data)
     {
-        $where = $config = array();
+        $where = $config = [];
         if (isset($set['where'])) {
             foreach ($set['where'] as $k => $v) {
                 if (!is_array($v) && isset($data[$v])) {
@@ -106,7 +106,7 @@ class Page extends Auth
         if ($where) {
             return Dever::db($key)->select($where, $config);
         }
-        return array();
+        return [];
     }
 
     public function getShow($show, $data)
@@ -156,12 +156,11 @@ class Page extends Auth
             if (!is_array($set['rules'])) {
                 $set['rules'] = array
                 (
-                    array
-                    (
+                    [
                         'required' => true,
                         'trigger' => 'blur',
                         'message' => $set['name'] . '不能为空',
-                    ),
+                    ],
                 );
             }
             foreach ($set['rules'] as $k => $v) {
@@ -209,7 +208,7 @@ class Page extends Auth
 
     private function setData($setting, &$data, $field, $type, $disable)
     {
-        $result = array();
+        $result = [];
         foreach ($setting as $k => $v) {
             if (!is_array($v)) {
                 if (is_numeric($k)) {
@@ -217,13 +216,13 @@ class Page extends Auth
                     $v = $type;
                 }
                 if ($k == 'id') {
-                    $v = array('name' => 'ID', 'type' => $v);
+                    $v = ['name' => 'ID', 'type' => $v];
                 } elseif ($k == 'cdate') {
-                    $v = array('name' => '创建时间', 'type' => $v);
+                    $v = ['name' => '创建时间', 'type' => $v];
                 } elseif(isset($this->db->config['struct'][$k])) {
-                    $v = array('name' => $this->db->config['struct'][$k]['name'], 'type' => $v);
+                    $v = ['name' => $this->db->config['struct'][$k]['name'], 'type' => $v];
                 } else {
-                    $v = array('name' => $v);
+                    $v = ['name' => $v];
                 }
             } else {
                 if (isset($v['only'])) {
@@ -296,12 +295,11 @@ class Page extends Auth
                     $value = array_merge($value, $manage['update']['field'][$value['field']]);
                 }
                 if ($value['value']) {
-                    $data[$key . '_id'] = array
-                    (
+                    $data[$key . '_id'] = [
                         'key' => $key . '_id',
                         'type' => 'hidden',
                         'value' => $value['value'][0]['id'],
-                    );
+                    ];
                     $value['value'] = $value['value'][0][$value['field']];
                 }
                 $this->setRules($value);
@@ -310,7 +308,7 @@ class Page extends Auth
                 return $value['name'] ?? 'test';
             }
             $update = new \Manage\Api\Page\Update($key, false);
-            $value['option'] = array();
+            $value['option'] = [];
             $value['content'] = $update->get($value['value'], $value['option'], $sku);
             $data[] = $value;
             return $value['name'];
@@ -328,7 +326,7 @@ class Page extends Auth
                 if (!isset($value['tip'])) {
                     $value['tip'] = false;
                 }
-                $in = array('switch', 'select', 'input');
+                $in = ['switch', 'select', 'input'];
                 if (in_array($value['type'], $in)) {
                     $value['func'] = $this->getFunc('list_edit_' . $value['key'], '列表更新-' . $value['name'], 104);
                     if (!$value['func']) {
@@ -339,7 +337,7 @@ class Page extends Auth
                     }
                 }
                 if (isset($value['child'])) {
-                    $child = array();
+                    $child = [];
                     $this->setData($value['child'], $child, $field, $type, $disable);
                     $value['child'] = $child;
                 } else {
@@ -387,7 +385,7 @@ class Page extends Auth
             if (is_array($value['upload'])) {
                 $upload += $value['upload'];
             } else {
-                $upload += array('id' => $value['upload']);
+                $upload += ['id' => $value['upload']];
             }
             if (empty($upload['id'])) {
                 Dever::error('上传配置错误');
@@ -432,7 +430,7 @@ class Page extends Auth
         foreach ($key as $k) {
             if ($v = Dever::issets($value['editorMenu'], $k)) {
                 if (!is_array($v)) {
-                    $v = array('upload' => $v);
+                    $v = ['upload' => $v];
                 }
                 $upload['id'] = $v['upload'];
                 $v['server'] = Dever::url('upload/save.wangEditor', $upload, true);
@@ -476,7 +474,7 @@ class Page extends Auth
         $send['table'] = $this->db->config['load'];
         if ($option = $this->db->value($value['key'], false, 'id,name', $send)) {
             if ($value['type'] == 'checkbox') {
-                $value['value'] = $value['value'] ? explode(',', $value['value']) : array();
+                $value['value'] = $value['value'] ? explode(',', $value['value']) : [];
             }
             $value['option'] = $option;
             if ($value['type'] == 'text') {
@@ -494,12 +492,11 @@ class Page extends Auth
             if (!is_array($value['rules'])) {
                 $value['rules'] = array
                 (
-                    array
-                    (
+                    [
                         'required' => true,
                         'trigger' => 'blur',
                         'message' => $value['name'] . '不能为空',
-                    ),
+                    ],
                 );
             }
             foreach ($value['rules'] as $k => $v) {
@@ -524,9 +521,9 @@ class Page extends Auth
         return $this->input ? Dever::input($key) : $value;
     }
 
-    public function button($key = 'button', $data = array())
+    public function button($key = 'button', $data = [])
     {
-        $result = array();
+        $result = [];
         if (!isset($this->config[$key])) {
             $num = 0;
             if (isset($this->db->config['manage']['update']['field'])) {
@@ -539,9 +536,9 @@ class Page extends Auth
                 $fast = '';
             }
             if ($key == 'button') {
-                $this->config[$key] = array('新增' => $fast . 'add');
+                $this->config[$key] = ['新增' => $fast . 'add'];
             } else {
-                $this->config[$key] = array('编辑' => $fast . 'edit', '删除' => 'recycle');
+                $this->config[$key] = ['编辑' => $fast . 'edit', '删除' => 'recycle'];
             }
         }
         $sort = 1;
@@ -643,15 +640,14 @@ class Page extends Auth
             if ($i) {
                 $icon = $i;
             }
-            $result[] = array
-            (
+            $result[] = [
                 'name' => $k,
                 'type' => $v,
                 'param' => $p,
                 'icon' => $icon,
                 'button' => $button,
                 'func' => $func,
-            );
+            ];
             if (!$this->recycler && $v == 'recycle') {
                 $this->recycler = true;
             }

+ 3 - 3
lib/Recycler.php

@@ -8,14 +8,14 @@ class Recycler extends Auth
         if (empty($where['table'])) {
             Dever::error('参数错误');
         }
-        $data['head'] = $data['body'] = array();
+        $data['head'] = $data['body'] = [];
         $page = new Page('list', $where['table']);
         $data['title'] = $page->getTitle() . '【回收站】';
         $data['field'] = $page->setting('field', $data['head']);
 
         $set['num'] = Dever::input('pgnum', '', '', 10);
         list($db, $menu) = Dever::load('common', 'manage')->db($where['table']);
-        $recycler = Dever::db('recycler', 'manage')->select(array('table' => $db->config['load']), $set);
+        $recycler = Dever::db('recycler', 'manage')->select(['table' => $db->config['load']], $set);
         foreach ($recycler as $k => $v) {
             $content = Dever::json_decode($v['content']);
             foreach ($content as $key => $value) {
@@ -25,7 +25,7 @@ class Recycler extends Auth
             $data['body'][] = $content;
         }
         if ($data['head']) {
-            $head = array();
+            $head = [];
             foreach ($data['head'] as $k => $v) {
                 if ($v['type'] == 'show') {
                     $head[] = $v;

+ 13 - 13
lib/Role.php

@@ -6,8 +6,8 @@ class Role extends Auth
     {
         if ($data['auth']) {
             $auth = explode(',', $data['auth']);
-            $data['auth'] = array();
-            $module = $menu = $func = array();
+            $data['auth'] = [];
+            $module = $menu = $func = [];
             foreach ($auth as $k => $v) {
                 if (!strstr($v, '-')) {
                     if (strstr($v, 'v')) {
@@ -19,11 +19,11 @@ class Role extends Auth
                 }
             }
             if ($func) {
-                $funcData = Dever::db('menu_func', 'manage')->select(array('id' => array('in', $func)), array('group' => 'menu_id'));
+                $funcData = Dever::db('menu_func', 'manage')->select(array('id' => ['in', $func]), ['group' => 'menu_id']);
                 foreach ($funcData as $k => $v) {
                     $menu[] = $v['menu_id'];
                 }
-                $menuData = Dever::db('menu', 'manage')->select(array('id' => array('in', $menu)), array('group' => 'module_id'));
+                $menuData = Dever::db('menu', 'manage')->select(array('id' => ['in', $menu]), ['group' => 'module_id']);
                 foreach ($menuData as $k => $v) {
                     $module[] = $v['module_id'];
                 }
@@ -37,7 +37,7 @@ class Role extends Auth
 
     public function getAuthData()
     {
-        $result = array();
+        $result = [];
         $extend = Dever::load('common', 'manage')->extend();
         if ($extend && $extend['system_id']) {
             $system_id = $extend['system_id'];
@@ -45,13 +45,13 @@ class Role extends Auth
             $system_id = 1;
         }
         $info = Dever::db('system', 'manage')->find($system_id);
-        $where = array();
+        $where = [];
         $where['system'] = $info['key'];
         $module = Dever::db('system_module', 'manage')->select($where);
         foreach ($module as $k => $v) {
             $result[$k]['value'] = 's-' . $v['id'];
             $result[$k]['label'] = $v['name'];
-            $result[$k]['children'] = Dever::db('menu', 'manage')->tree(array('module_id' => $v['id'], 'show' => array('<', '3')), array('parent_id', '0', 'id'), array($this, 'getAuthInfo'), array('col' => 'id,name as label,parent_id,`key`,func'));
+            $result[$k]['children'] = Dever::db('menu', 'manage')->tree(array('module_id' => $v['id'], 'show' => ['<', '3']), ['parent_id', '0', 'id'], [$this, 'getAuthInfo'], ['col' => 'id,name as label,parent_id,`key`,func']);
         }
         return $result;
     }
@@ -59,9 +59,9 @@ class Role extends Auth
     {
         if ($info['func'] == 1) {
             $info['value'] = 'm-' . $info['id'];
-            $info['children'] = Dever::db('menu_func', 'manage')->select(array('menu_id' => $info['id']), array('col' => 'id as value,name as label'));
+            $info['children'] = Dever::db('menu_func', 'manage')->select(['menu_id' => $info['id']], ['col' => 'id as value,name as label']);
             if (!$info['children']) {
-                return array();
+                return [];
             }
         } else {
             $info['value'] = 'v' . $info['id'];
@@ -71,21 +71,21 @@ class Role extends Auth
     # 展示系统
     public function showSystem($data)
     {
-        return Dever::db('system', 'manage')->show(array('id' => array('in', $data)));
+        return Dever::db('system', 'manage')->show(array('id' => ['in', $data]));
     }
     # 展示系统模块
     public function showModule($data)
     {
-        return Dever::db('system_module', 'manage')->show(array('id' => array('in', $data)));
+        return Dever::db('system_module', 'manage')->show(array('id' => ['in', $data]));
     }
     # 展示菜单
     public function showMenu($data)
     {
-        return Dever::db('menu', 'manage')->show(array('id' => array('in', $data)));
+        return Dever::db('menu', 'manage')->show(array('id' => ['in', $data]));
     }
     # 展示权限
     public function showFunc($data)
     {
-        return Dever::db('menu_func', 'manage')->show(array('id' => array('in', $data)));
+        return Dever::db('menu_func', 'manage')->show(array('id' => ['in', $data]));
     }
 }

+ 10 - 11
lib/System.php

@@ -7,13 +7,12 @@ class System extends Auth
     public function getTree()
     {
         $data = Dever::db('system', 'manage')->select([]);
-        $result = array();
-        $result[] = array
-        (
+        $result = [];
+        $result[] = [
             'id' => 'root',
             'name' => '全部系统',
             'children' => $data,
-        );
+        ];
         return $result;
     }
 
@@ -21,13 +20,13 @@ class System extends Auth
     public function update($system, $db, $data)
     {
         if (isset($data['mobile']) && $data['mobile']) {
-            $system = Dever::db('system', 'manage')->find(array('key' => $system));
+            $system = Dever::db('system', 'manage')->find(['key' => $system]);
             $data['system_key'] = $system['key'];
             $data['system_id'] = $system['id'];
             $data['info_id'] = $data['id'];
             $data['partition'] = $system['partition'];
             $db = Dever::db($system['user_table'], '', true, 'default', Dever::load('common', 'manage')->system($data));
-            $info = $db->find(array('mobile' => $data['mobile']));
+            $info = $db->find(['mobile' => $data['mobile']]);
             if (!$info) {
                 $password = '123456';
                 $insert['name'] = Str::hide($data['mobile']);
@@ -38,9 +37,9 @@ class System extends Auth
             }
 
             $db = Dever::db($system['role_table'], '', true, 'default', Dever::load('common', 'manage')->system($data));
-            $info = $db->find(array('id' => 1));
+            $info = $db->find(['id' => 1]);
             if (!$info) {
-                $insert = array();
+                $insert = [];
                 $insert['name'] = '超级管理员';
                 $db->insert($insert);
             }
@@ -53,19 +52,19 @@ class System extends Auth
         if (isset($data['mobile']) && $data['mobile'] && isset($data['password']) && $data['password']) {
             $info = Dever::db($data['table'])->find($data['id']);
             if ($info) {
-                $system = Dever::db('system', 'manage')->find(array('key' => $data['system']));
+                $system = Dever::db('system', 'manage')->find(['key' => $data['system']]);
                 $set['system_key'] = $system['key'];
                 $set['system_id'] = $system['id'];
                 $set['info_id'] = 1;
                 $set['partition'] = $system['partition'];
                 $db = Dever::db($system['user_table'], '', 'default', Dever::load('common', 'manage')->system($set));
 
-                $user = $db->find(array('mobile' => $data['mobile']));
+                $user = $db->find(['mobile' => $data['mobile']]);
                 if ($state && $user) {
                     Dever::error('手机号' . $data['mobile'] . '已存在,请更换手机号');
                 }
 
-                $module = Dever::db('system_module', 'manage')->find(array('key' => $data['module'], 'system' => 'group'));
+                $module = Dever::db('system_module', 'manage')->find(['key' => $data['module'], 'system' => 'group']);
                 $insert['name'] = $info['name'];
                 $insert['mobile'] = $data['mobile'];
                 $insert['role'] = 2;