diff --git a/crmeb/app/common.php b/crmeb/app/common.php index 5d8f78a6..38c5e693 100644 --- a/crmeb/app/common.php +++ b/crmeb/app/common.php @@ -150,4 +150,32 @@ if (!function_exists('sysData')) { { return app('sysGroupData')->getData($name); } +} + +if (!function_exists('sort_list_tier')) { + /** + * 分级排序 + * @param $data + * @param int $pid + * @param string $field + * @param string $pk + * @param string $html + * @param int $level + * @param bool $clear + * @return array + */ + function sort_list_tier($data, $pid = 0, $field = 'pid', $pk = 'id', $html = '|-----', $level = 1, $clear = true) + { + static $list = []; + if ($clear) $list = []; + foreach ($data as $k => $res) { + if ($res[$field] == $pid) { + $res['html'] = str_repeat($html, $level); + $list[] = $res; + unset($data[$k]); + sort_list_tier($data, $res[$pk], $field, $pk, $html, $level + 1, false); + } + } + return $list; + } } \ No newline at end of file diff --git a/crmeb/crmeb/services/CacheService.php b/crmeb/crmeb/services/CacheService.php index a42e411a..5ffd469d 100644 --- a/crmeb/crmeb/services/CacheService.php +++ b/crmeb/crmeb/services/CacheService.php @@ -85,6 +85,6 @@ class CacheService */ public static function clear() { - return CacheStatic::clear(self::$globalCacheName); + return self::handler()->clear(); } } \ No newline at end of file