diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 218940943..d29b619df 100755 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,11 +1,11 @@ get(Redis::class); } } -/** +/* * server 实例 基于 swoole server */ -if (!function_exists('server')) { +if (! function_exists('server')) { function server() { return container()->get(ServerFactory::class)->getServer()->getServer(); } } - -/** +/* * 缓存实例 简单的缓存 */ -if (!function_exists('cache')) { +if (! function_exists('cache')) { function cache() { return container()->get(Psr\SimpleCache\CacheInterface::class); } } -/** +/* * 控制台日志 */ -if (!function_exists('stdLog')) { +if (! function_exists('stdLog')) { function stdLog() { return container()->get(StdoutLoggerInterface::class); } } -/** +/* * 文件日志 */ -if (!function_exists('logger')) { +if (! function_exists('logger')) { function logger() { return container()->get(LoggerFactory::class)->make(); } } -if (!function_exists('response')) { +if (! function_exists('response')) { function response() { return container()->get(ResponseInterface::class); } } -if (!function_exists('PsrResponse')) { +if (! function_exists('PsrResponse')) { function PsrResponse() { return container()->get(\Psr\Http\Message\ResponseInterface::class); } } -if (!function_exists("ResponseObj")) { +if (! function_exists('ResponseObj')) { function ResponseObj(): Response { return new Response(); } } -if (!function_exists("SwooleStream")) { +if (! function_exists('SwooleStream')) { function SwooleStream($contents): SwooleStream { return new SwooleStream($contents); } } -if (!function_exists("request")) { - function request(): \Hyperf\HttpServer\Request +if (! function_exists('request')) { + function request(): Hyperf\HttpServer\Request { return new Hyperf\HttpServer\Request(); } } -if (!function_exists("path_class")) { +if (! function_exists('path_class')) { function path_class() { $path = request()->path(); - $result = str_replace("/", "-", $path); + $result = str_replace('/', '-', $path); $result = Str::before($result, '.'); - if ($result == "-") { - return "main"; + if ($result == '-') { + return 'main'; } return $result; } } - -if (!function_exists("menu")) { +if (! function_exists('menu')) { function menu() { return \Hyperf\Utils\ApplicationContext::getContainer()->get(MenuInterface::class); } } -if (!function_exists("view")) { +if (! function_exists('view')) { function view(string $view, array $data = [], int $code = 200) { $container = \Hyperf\Utils\ApplicationContext::getContainer(); return $container->get(RenderInterface::class)->render($view, $data, $code); - if (env("APP_ENV")==='dev') { + if (env('APP_ENV') === 'dev') { return $result; } - $body = minify_html((string)$result->getBody()); + $body = minify_html((string) $result->getBody()); return $container->get(RenderInterface::class)->renderR($body, $code); } } -if (!function_exists("menu_pd")) { +if (! function_exists('menu_pd')) { function menu_pd($id) { $i = 0; foreach (menu()->get() as $key => $value) { - if (arr_has($value, "parent_id")) { + if (arr_has($value, 'parent_id')) { if ($value['parent_id'] === $id) { - $i++; + ++$i; } } } @@ -218,12 +210,12 @@ function menu_pd($id) } } -if (!function_exists("menu_pdArr")) { +if (! function_exists('menu_pdArr')) { function menu_pdArr($id) { $arr = []; foreach (menu()->get() as $key => $value) { - if (arr_has($value, "parent_id")) { + if (arr_has($value, 'parent_id')) { if ($value['parent_id'] == $id) { $arr[$key] = $value; } @@ -233,19 +225,19 @@ function menu_pdArr($id) } } -if (!function_exists("Json_Api")) { - function Json_Api(int $code = 200, bool $success = true, object|array|string $result = []): array +if (! function_exists('Json_Api')) { + function Json_Api(int $code = 200, bool $success = true, object | array | string $result = []): array { return [ - "code" => $code, - "success" => $success, - "result" => $result, - "RequestTime" => date("Y-m-d H:i:s") + 'code' => $code, + 'success' => $success, + 'result' => $result, + 'RequestTime' => date('Y-m-d H:i:s'), ]; } } -if (!function_exists("session")) { +if (! function_exists('session')) { function session() { return \Hyperf\Utils\ApplicationContext::getContainer()->get(SessionInterface::class); @@ -253,13 +245,13 @@ function session() } // 获取目录下的所有文件夹 -if (!function_exists("getPath")) { +if (! function_exists('getPath')) { function getPath($path) { - if (!is_dir($path)) { + if (! is_dir($path)) { return false; } - $arr = array(); + $arr = []; $data = scandir($path); foreach ($data as $value) { if ($value != '.' && $value != '..') { @@ -270,84 +262,82 @@ function getPath($path) } } -if (!function_exists("plugin_path")) { +if (! function_exists('plugin_path')) { function plugin_path($path = null): string { - if (!$path) { - return BASE_PATH . "/app/Plugins"; + if (! $path) { + return BASE_PATH . '/app/Plugins'; } - return BASE_PATH . "/app/Plugins/" . $path; + return BASE_PATH . '/app/Plugins/' . $path; } } -if (!function_exists("theme_path")) { +if (! function_exists('theme_path')) { function theme_path($path = null): string { - if (!$path) { - return BASE_PATH . "/app/Themes"; + if (! $path) { + return BASE_PATH . '/app/Themes'; } - return BASE_PATH . "/app/Themes/" . $path; + return BASE_PATH . '/app/Themes/' . $path; } } -if (!function_exists("lang_path")) { +if (! function_exists('lang_path')) { function lang_path($path = null): string { - if (!$path) { - return BASE_PATH . "/app/Languages"; + if (! $path) { + return BASE_PATH . '/app/Languages'; } - return BASE_PATH . "/app/Languages/" . $path; + return BASE_PATH . '/app/Languages/' . $path; } } -if (!function_exists("read_file")) { +if (! function_exists('read_file')) { function read_file($file_path): ?string { if (file_exists($file_path)) { return File::get($file_path); } - + return null; } } - -if (!function_exists("admin_abort")) { +if (! function_exists('admin_abort')) { /** * @param array|string $data - * @param int $code * @return \Psr\Http\Message\ResponseInterface */ - function admin_abort(array|string $data, int $code = 403): \Psr\Http\Message\ResponseInterface + function admin_abort(array | string $data, int $code = 403): Psr\Http\Message\ResponseInterface { if (is_string($data)) { $array = ['msg' => $data]; } else { $array = $data; } - if (request()->isMethod("POST") || request()->input("data") === "json") { + if (request()->isMethod('POST') || request()->input('data') === 'json') { return response()->json(Json_Api($code, false, $array)); } return view('admin.error', [], $code); } } -if (!function_exists("get_plugins_doc")) { +if (! function_exists('get_plugins_doc')) { function get_plugins_doc($class): array { - $re = new ReflectionClass(new $class()); + $re = new ReflectionClass(new $class()); $content = $re->getDocComment(); - $preg = "/@+(.*)/"; + $preg = '/@+(.*)/'; preg_match_all($preg, $content, $result); $result = $result[1]; $arr = []; foreach ($result as $key => $value) { - $result1 = explode(" ", $value); + $result1 = explode(' ', $value); $arr[$result1[0]] = $result1[1]; } $data = []; foreach ($arr as $key => $value) { - if ($key==='package') { + if ($key === 'package') { $data['description'] = $value; } else { $data[$key] = $value; @@ -357,7 +347,7 @@ function get_plugins_doc($class): array } } -if (!function_exists("deldir")) { +if (! function_exists('deldir')) { function deldir($path) { //如果是目录则继续 @@ -368,7 +358,7 @@ function deldir($path) if (count($p) > 2) { foreach ($p as $val) { //排除目录中的.和.. - if ($val != "." && $val != "..") { + if ($val != '.' && $val != '..') { //如果是目录则递归子目录,继续操作 if (is_dir($path . $val)) { //子目录中操作删除文件夹和文件 @@ -386,8 +376,7 @@ function deldir($path) } } - -if (!function_exists("copy_dir")) { +if (! function_exists('copy_dir')) { function copy_dir($src, $dst) { $dir = opendir($src); @@ -398,7 +387,7 @@ function copy_dir($src, $dst) copy_dir($src . '/' . $file, $dst . '/' . $file); continue; } - + copy($src . '/' . $file, $dst . '/' . $file); } } @@ -406,14 +395,14 @@ function copy_dir($src, $dst) } } -if (!function_exists('verify_ip')) { +if (! function_exists('verify_ip')) { function verify_ip($realip) { return filter_var($realip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); } } -if (!function_exists('get_client_ip')) { +if (! function_exists('get_client_ip')) { function get_client_ip() { /** @@ -440,8 +429,8 @@ function get_client_ip() } } -if (!function_exists("make_page")) { - function make_page($page, $default = "default"): \Psr\Http\Message\ResponseInterface +if (! function_exists('make_page')) { + function make_page($page, $default = 'default'): Psr\Http\Message\ResponseInterface { $window = UrlWindow::make($page); @@ -452,76 +441,74 @@ function make_page($page, $default = "default"): \Psr\Http\Message\ResponseInter is_array($window['last']) ? '...' : null, $window['last'], ]); - return view("shared.page.".$default, ['paginator' => $page,'elements' => $elements]); + return view('shared.page.' . $default, ['paginator' => $page, 'elements' => $elements]); } } - -if (!function_exists("get_options")) { - function get_options($name, $default="") +if (! function_exists('get_options')) { + function get_options($name, $default = '') { - if (!cache()->has('admin.options.'.$name)) { - cache()->set("admin.options.".$name, @AdminOption::query()->where("name", $name)->first()->value); + if (! cache()->has('admin.options.' . $name)) { + cache()->set('admin.options.' . $name, @AdminOption::query()->where('name', $name)->first()->value); } - return core_default(cache()->get("admin.options.".$name), $default); + return core_default(cache()->get('admin.options.' . $name), $default); } } -if (!function_exists("get_options_nocache")) { - function get_options_nocache($name, $default="") +if (! function_exists('get_options_nocache')) { + function get_options_nocache($name, $default = '') { - if (!AdminOption::query()->where("name", $name)->exists() || !AdminOption::query()->where("name", $name)->first()->value) { + if (! AdminOption::query()->where('name', $name)->exists() || ! AdminOption::query()->where('name', $name)->first()->value) { return $default; } - return AdminOption::query()->where("name", $name)->first()->value; + return AdminOption::query()->where('name', $name)->first()->value; } } - -if (!function_exists("options_clear")) { +if (! function_exists('options_clear')) { function options_clear() { foreach (AdminOption::query()->get() as $value) { - cache()->delete('admin.options.'.$value->name); + cache()->delete('admin.options.' . $value->name); } } } -if (!function_exists("admin_auth")) { +if (! function_exists('admin_auth')) { function admin_auth(): Admin { return new Admin(); } } -if (!function_exists("de_stringify")) { +if (! function_exists('de_stringify')) { function de_stringify(string $stringify): array { $result = []; - $data = explode("&", $stringify); + $data = explode('&', $stringify); foreach ($data as $value) { - $arr = explode("=", $value); - $result[$arr[0]]=urldecode($arr[1]); + $arr = explode('=', $value); + $result[$arr[0]] = urldecode($arr[1]); } return $result; } } -if (!function_exists("csrf_token")) { +if (! function_exists('csrf_token')) { function csrf_token() { - if (!session()->has("csrf_token")) { - session()->set("csrf_token", Str::random()); + if (! session()->has('csrf_token')) { + session()->set('csrf_token', Str::random()); } - if (!cache()->has("csrf_token".session()->get("csrf_token"))) { - cache()->set("csrf_token".session()->get("csrf_token"), Str::random()); + if (! cache()->has('csrf_token' . session()->get('csrf_token'))) { + cache()->set('csrf_token' . session()->get('csrf_token'), Str::random()); } - return cache()->get("csrf_token".session()->get("csrf_token")); + return cache()->get('csrf_token' . session()->get('csrf_token')); } } -if (!function_exists("recsrf_token")) { +if (! function_exists('recsrf_token')) { function recsrf_token() { return csrf_token(); @@ -533,7 +520,7 @@ function recsrf_token() } } -if (!function_exists("modifyEnv")) { +if (! function_exists('modifyEnv')) { function modifyEnv(array $data) { $envPath = BASE_PATH . '/.env'; @@ -556,171 +543,170 @@ function modifyEnv(array $data) } } -if (!function_exists("Itf_Setting")) { +if (! function_exists('Itf_Setting')) { function Itf_Setting() { return \Hyperf\Utils\ApplicationContext::getContainer()->get(SettingInterface::class); } } -if (!function_exists("Router")) { +if (! function_exists('Router')) { function Router() { return \Hyperf\Utils\ApplicationContext::getContainer()->get(\App\CodeFec\Itf\Route\RouteInterface::class); } } -if (!function_exists("Themes")) { +if (! function_exists('Themes')) { function Themes() { return \Hyperf\Utils\ApplicationContext::getContainer()->get(\App\CodeFec\Itf\Theme\ThemeInterface::class); } } -if (!function_exists("Theme")) { - function Theme(): \App\CodeFec\Themes +if (! function_exists('Theme')) { + function Theme(): App\CodeFec\Themes { return new \App\CodeFec\Themes(); } } -if (!function_exists("Helpers_Str")) { +if (! function_exists('Helpers_Str')) { function Helpers_Str(): Str { return new Str(); } } -if (!function_exists("Itf")) { +if (! function_exists('Itf')) { function Itf() { return \Hyperf\Utils\ApplicationContext::getContainer()->get(\App\CodeFec\Itf\Itf\ItfInterface::class); } } -if (!function_exists("file_hash")) { +if (! function_exists('file_hash')) { function file_hash($path): string { - if (file_exists(BASE_PATH."/public/".$path)) { - return "/".$path."?version=".md5_file(BASE_PATH."/public/".$path); + if (file_exists(BASE_PATH . '/public/' . $path)) { + return '/' . $path . '?version=' . md5_file(BASE_PATH . '/public/' . $path); } - return "/".$path; + return '/' . $path; } } -if (!function_exists("errors")) { +if (! function_exists('errors')) { function errors() { - if (cache()->has("errors")) { - return cache()->get("errors"); + if (cache()->has('errors')) { + return cache()->get('errors'); } return []; } } -if (!function_exists("url")) { - function url($path=null) +if (! function_exists('url')) { + function url($path = null) { - $url = get_options("APP_URL", "http://".request()->getHeader('host')[0]); - if (!$path) { + $url = get_options('APP_URL', 'http://' . request()->getHeader('host')[0]); + if (! $path) { return $url; } - return $url.$path; + return $url . $path; } } -if (!function_exists("url_source")) { - function url_source($path=null) +if (! function_exists('url_source')) { + function url_source($path = null) { - $url = "http://".request()->getHeader('host')[0]; - if (!$path) { + $url = 'http://' . request()->getHeader('host')[0]; + if (! $path) { return $url; } - return $url.$path; + return $url . $path; } } -if (!function_exists("ws_url")) { - function ws_url($path=null) +if (! function_exists('ws_url')) { + function ws_url($path = null) { - $url=get_options("APP_WS_URL"); - if (!$url) { - $url = "ws://".config("server.servers.1.host").":".config("server.servers.1.port"); + $url = get_options('APP_WS_URL'); + if (! $url) { + $url = 'ws://' . config('server.servers.1.host') . ':' . config('server.servers.1.port'); } - if (!$path) { + if (! $path) { return $url; } - return $url.$path; + return $url . $path; } } -if (!function_exists("get_num")) { - function get_num($string): array|string|null +if (! function_exists('get_num')) { + function get_num($string): array | string | null { return preg_replace('/[^0-9]/', '', $string); } } // 已启动插件列表 -if (!function_exists("getEnPlugins")) { +if (! function_exists('getEnPlugins')) { function getEnPlugins() { return (new Plugins())->getEnPlugins(); } } - // 已启动插件列表 -if (!function_exists("plugins")) { +if (! function_exists('plugins')) { function plugins(): Plugins { return new Plugins(); } } -if (!function_exists("http")) { - function http($response_type='array'): Client +if (! function_exists('http')) { + function http($response_type = 'array'): Client { return Client::create([ 'response_type' => $response_type, - 'verify' => false + 'verify' => false, ]); } } -if (!function_exists('EventDispatcher')) { +if (! function_exists('EventDispatcher')) { function EventDispatcher() { return container()->get(EventDispatcherInterface::class); } } -if (!function_exists('captcha')) { - function captcha(): \App\CodeFec\Captcha +if (! function_exists('captcha')) { + function captcha(): App\CodeFec\Captcha { return new \App\CodeFec\Captcha(); } } -if (!function_exists('fileUtil')) { - function fileUtil(): \App\CodeFec\FileUtil +if (! function_exists('fileUtil')) { + function fileUtil(): App\CodeFec\FileUtil { return new \App\CodeFec\FileUtil(); } } -if (!function_exists('allDir')) { +if (! function_exists('allDir')) { function allDir($dir) { //遍历目录下的文件夹 $data = scandir($dir); $arr = []; // 把自身写进去 - $arr[]=$dir; - + $arr[] = $dir; + foreach ($data as $value) { - if ($value !== "." && $value !== '..' && is_dir($dir . "/" . $value)) { - foreach (allDir($dir."/".$value) as $v) { - $arr[]=$v; + if ($value !== '.' && $value !== '..' && is_dir($dir . '/' . $value)) { + foreach (allDir($dir . '/' . $value) as $v) { + $arr[] = $v; } } } @@ -729,41 +715,40 @@ function allDir($dir) } // --压缩-- 美化html -function minify_html($html): array|string|null +function minify_html($html): array | string | null { $beautify = new Beautify_Html([ 'indent_inner_html' => false, - 'indent_char' => " ", + 'indent_char' => ' ', 'indent_size' => 2, 'wrap_line_length' => 32786, - 'unformatted' => ['code', 'pre','span'], + 'unformatted' => ['code', 'pre', 'span'], 'preserve_newlines' => false, 'max_preserve_newlines' => 32786, - 'indent_scripts' => 'keep' // keep|separate|normal + 'indent_scripts' => 'keep', // keep|separate|normal ]); return $beautify->beautify($html); } -if (!function_exists("build_info")) { +if (! function_exists('build_info')) { function build_info() { - $data = include BASE_PATH."/build-info.php"; + $data = include BASE_PATH . '/build-info.php'; return json_decode(json_encode($data)); } } // 获取系统名 -if (!function_exists("system_name")) { - function system_name(): bool|string|null +if (! function_exists('system_name')) { + function system_name(): bool | string | null { - return str_replace("\n", "", shell_exec("echo \$(uname)")); + return str_replace("\n", '', shell_exec('echo $(uname)')); } } - -if (!function_exists("get_user_agent")) { +if (! function_exists('get_user_agent')) { /** - * 获取客户端user agent信息 + * 获取客户端user agent信息. * @return mixed|string */ function get_user_agent() @@ -772,43 +757,42 @@ function get_user_agent() } } -if (!function_exists("get_client_ip_data")) { +if (! function_exists('get_client_ip_data')) { /** - * 获取ip 信息 + * 获取ip 信息. * @param null $ip - * @return array */ - function get_client_ip_data($ip=null): array + function get_client_ip_data($ip = null): array { - $result = http('array')->post('http://pro.ip-api.com/json/'.$ip."?fields=66842623&key=ipapiq9SFY1Ic4&lang=zh-CN", [ - 'fields'=>'66842623', - 'key'=>'ipapiq9SFY1Ic4', - 'lang'=>'zh-CN', + $result = http('array')->post('http://pro.ip-api.com/json/' . $ip . '?fields=66842623&key=ipapiq9SFY1Ic4&lang=zh-CN', [ + 'fields' => '66842623', + 'key' => 'ipapiq9SFY1Ic4', + 'lang' => 'zh-CN', ], [ 'headers' => [ - 'Origin' => 'https://members.ip-api.com' - ] + 'Origin' => 'https://members.ip-api.com', + ], ]); if (Arr::has($result, 'regionName')) { - $result['pro']=$result['regionName']; - }else{ - $result['pro']=''; + $result['pro'] = $result['regionName']; + } else { + $result['pro'] = ''; } return $result; } } -if (!function_exists('language')) { - function language(): \App\CodeFec\Language +if (! function_exists('language')) { + function language(): App\CodeFec\Language { return new \App\CodeFec\Language(); } } -if (!function_exists('content_brief')) { - function content_brief($content, string | int $len=100): string +if (! function_exists('content_brief')) { + function content_brief($content, string | int $len = 100): string { - $len = (int)$len; + $len = (int) $len; // hook post_brief_start.php $content = strip_tags($content); $content = htmlspecialchars($content); @@ -817,26 +801,26 @@ function content_brief($content, string | int $len=100): string } } -if (!function_exists('admin_log')) { - function admin_log(): \App\CodeFec\Admin\LogServer +if (! function_exists('admin_log')) { + function admin_log(): App\CodeFec\Admin\LogServer { - return (new \App\CodeFec\Admin\LogServer()); + return new \App\CodeFec\Admin\LogServer(); } } -if (!function_exists('pay')) { +if (! function_exists('pay')) { /** * 支付服务 * @return \App\Plugins\Core\src\Lib\Pay\PayService */ - function pay(): \App\Plugins\Core\src\Lib\Pay\PayService + function pay(): App\Plugins\Core\src\Lib\Pay\PayService { return new \App\Plugins\Core\src\Lib\Pay\PayService(); } } -if (!function_exists('qr_code')) { - function qr_code(): \SimpleSoftwareIO\QrCode\Generator +if (! function_exists('qr_code')) { + function qr_code(): SimpleSoftwareIO\QrCode\Generator { return new \SimpleSoftwareIO\QrCode\Generator(); } diff --git a/config/autoload/redis.php b/config/autoload/redis.php index 2b5da8626..0827e527f 100644 --- a/config/autoload/redis.php +++ b/config/autoload/redis.php @@ -2,12 +2,11 @@ declare(strict_types=1); /** - * CodeFec - Hyperf - * - * @link https://github.com/zhuchunshu - * @document https://codefec.com - * @contact laravel@88.com - * @license https://github.com/zhuchunshu/CodeFecHF/blob/master/LICENSE + * This file is part of Hyperf. + * @link https://www.hyperf.io + * @document https://hyperf.wiki + * @contact group@hyperf.io + * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ return [ 'default' => [ diff --git a/config/autoload/server.php b/config/autoload/server.php index 4f6b2f2ac..6a53944f3 100644 --- a/config/autoload/server.php +++ b/config/autoload/server.php @@ -2,17 +2,14 @@ declare(strict_types=1); /** - * CodeFec - Hyperf - * - * @link https://github.com/zhuchunshu - * @document https://codefec.com - * @contact laravel@88.com - * @license https://github.com/zhuchunshu/CodeFecHF/blob/master/LICENSE + * This file is part of Hyperf. + * @link https://www.hyperf.io + * @document https://hyperf.wiki + * @contact group@hyperf.io + * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ - use App\Server\CodeFecServer; use Hyperf\Server\Event; -use Hyperf\Server\Server; use Hyperf\Server\ServerInterface; use Swoole\Constant; @@ -22,7 +19,7 @@ [ 'name' => 'http', 'type' => ServerInterface::SERVER_HTTP, - 'host' => (string) env('SERVER_WEB_DOMAIN','0.0.0.0'), + 'host' => (string) env('SERVER_WEB_DOMAIN', '0.0.0.0'), 'port' => (int) env('SERVER_WEB_PORT', 9501), 'sock_type' => SWOOLE_SOCK_TCP, 'callbacks' => [ @@ -32,7 +29,7 @@ [ 'name' => 'socket-io', 'type' => ServerInterface::SERVER_WEBSOCKET, - 'host' => (string) env('SERVER_WEB_DOMAIN','0.0.0.0'), + 'host' => (string) env('SERVER_WEB_DOMAIN', '0.0.0.0'), 'port' => (int) env('SERVER_WS_PORT', 9502), 'sock_type' => SWOOLE_SOCK_TCP, 'callbacks' => [ @@ -42,7 +39,7 @@ ], 'settings' => [ 'open_websocket_protocol' => false, - ] + ], ], ], 'settings' => [ @@ -55,7 +52,7 @@ Constant::OPTION_MAX_REQUEST => 100000, Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024, Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024, - Constant::OPTION_PACKAGE_MAX_LENGTH => 100 * 1024 * 1024, + Constant::OPTION_PACKAGE_MAX_LENGTH => 100 * 1024 * 1024, // 静态资源 'document_root' => BASE_PATH . '/public', 'enable_static_handler' => true, @@ -64,6 +61,5 @@ Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'], Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'], Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'], - ], ]; diff --git a/config/autoload/session.php b/config/autoload/session.php index 3bf6d48bb..2394e1cfc 100644 --- a/config/autoload/session.php +++ b/config/autoload/session.php @@ -2,22 +2,19 @@ declare(strict_types=1); /** - * CodeFec - Hyperf - * - * @link https://github.com/zhuchunshu - * @document https://codefec.com - * @contact laravel@88.com - * @license https://github.com/zhuchunshu/CodeFecHF/blob/master/LICENSE + * This file is part of Hyperf. + * @link https://www.hyperf.io + * @document https://hyperf.wiki + * @contact group@hyperf.io + * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ -use Hyperf\Session\Handler; - return [ 'handler' => Hyperf\Session\Handler\RedisHandler::class, 'options' => [ 'connection' => 'default', 'path' => BASE_PATH . '/runtime/session', 'gc_maxlifetime' => 72 * 60 * 60, - 'session_name' => env("APP_NAME","CODEFEC_SESSION_ID"), + 'session_name' => env('APP_NAME', 'CODEFEC_SESSION_ID'), 'domain' => null, 'cookie_lifetime' => 72 * 60 * 60, ], diff --git a/config/autoload/translation.php b/config/autoload/translation.php index 79b7af065..197690b9c 100644 --- a/config/autoload/translation.php +++ b/config/autoload/translation.php @@ -2,12 +2,11 @@ declare(strict_types=1); /** - * CodeFec - Hyperf - * + * This file is part of zhuchunshu. * @link https://github.com/zhuchunshu - * @document https://codefec.com + * @document https://github.com/zhuchunshu/super-forum * @contact laravel@88.com - * @license https://github.com/zhuchunshu/CodeFecHF/blob/master/LICENSE + * @license https://github.com/zhuchunshu/super-forum/blob/master/LICENSE */ return [ 'locale' => 'zh_CN', diff --git a/config/autoload/view.php b/config/autoload/view.php index f976f5c61..cc979773d 100644 --- a/config/autoload/view.php +++ b/config/autoload/view.php @@ -1,19 +1,17 @@ \App\CodeFec\View\HyperfViewEngine::class, + 'engine' => \App\CodeFec\View\HyperfViewEngine::class, 'mode' => Hyperf\View\Mode::SYNC, 'config' => [ 'view_path' => BASE_PATH . '/resources/views/', diff --git a/config/autoload/watcher.php b/config/autoload/watcher.php index 0b77493de..a27493f5d 100644 --- a/config/autoload/watcher.php +++ b/config/autoload/watcher.php @@ -2,12 +2,11 @@ declare(strict_types=1); /** - * CodeFec - Hyperf - * + * This file is part of zhuchunshu. * @link https://github.com/zhuchunshu - * @document https://codefec.com + * @document https://github.com/zhuchunshu/super-forum * @contact laravel@88.com - * @license https://github.com/zhuchunshu/CodeFecHF/blob/master/LICENSE + * @license https://github.com/zhuchunshu/super-forum/blob/master/LICENSE */ use Hyperf\Watcher\Driver\ScanFileDriver; @@ -16,7 +15,7 @@ 'bin' => env('WATCHER_BIN', 'php'), 'watch' => [ 'dir' => ['app', 'config'], - 'file' => ['.env','build-info.php'], + 'file' => ['.env', 'build-info.php'], 'scan_interval' => 2000, ], ];