diff --git a/CHANGELOG.md b/CHANGELOG.md index fc5bd23f..3b1a53cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ ### [v1.7.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.2)(2024-07-31) - +- 更新layui-v2.9.14 +- 优化docker自动化脚本 +- 修正教师直播通知 +- 修正课程分类删选问题 +- 后台增加客户服务入口 +- redis增加expire方法 +- 日志记录增加log.trace参数 +- 精简代码 ### [v1.7.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.1)(2024-06-31) diff --git a/app/Console/Migrations/Migration.php b/app/Console/Migrations/Migration.php index 433999b8..dab29370 100644 --- a/app/Console/Migrations/Migration.php +++ b/app/Console/Migrations/Migration.php @@ -7,11 +7,29 @@ namespace App\Console\Migrations; +use App\Models\Setting as SettingModel; +use App\Repos\Setting as SettingRepo; use App\Traits\Service as ServiceTrait; abstract class Migration { + use ServiceTrait; abstract public function run(); + + protected function saveSetting(array $setting) + { + $settingRepo = new SettingRepo(); + + $item = $settingRepo->findItem($setting['section'], $setting['item_key']); + + if (!$item) { + $item = new SettingModel(); + $item->create($setting); + } else { + $item->update($setting); + } + } + } \ No newline at end of file diff --git a/app/Services/Auth/Admin.php b/app/Services/Auth/Admin.php index 9839b1b5..6eeffc01 100644 --- a/app/Services/Auth/Admin.php +++ b/app/Services/Auth/Admin.php @@ -56,19 +56,4 @@ class Admin extends AuthService return 'admin_auth_info'; } - public function hasPermission($route) - { - $authUser = $this->getAuthInfo(); - - if ($authUser['root'] == 1) { - return true; - } - - if (in_array($route, $authUser['routes'])) { - return true; - } - - return false; - } - } diff --git a/bootstrap/ConsoleErrorHandler.php b/bootstrap/ConsoleErrorHandler.php index a6181f95..20aacad1 100644 --- a/bootstrap/ConsoleErrorHandler.php +++ b/bootstrap/ConsoleErrorHandler.php @@ -33,9 +33,12 @@ class ConsoleErrorHandler extends Injectable $config = $this->getConfig(); - if ($config->get('env') == 'dev') { - $trace = sprintf('%sTrace Content: %s', PHP_EOL, $e->getTraceAsString()); + if ($config->path('env') == 'dev' || $config->path('log.trace')) { + + $trace = sprintf('Trace Content: %s', $e->getTraceAsString()); + $logger->error($trace); + $content .= $trace; } diff --git a/bootstrap/HttpErrorHandler.php b/bootstrap/HttpErrorHandler.php index 97437edd..31683172 100644 --- a/bootstrap/HttpErrorHandler.php +++ b/bootstrap/HttpErrorHandler.php @@ -77,8 +77,10 @@ class HttpErrorHandler extends Injectable $config = $this->getConfig(); - if ($config->get('env') == 'dev') { + if ($config->path('env') == 'dev' || $config->path('log.trace')) { + $content = sprintf('Trace Content: %s', $e->getTraceAsString()); + $logger->error($content); } } diff --git a/config/config.default.php b/config/config.default.php index 2ee61586..901157a4 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -27,6 +27,11 @@ $config['timezone'] = 'Asia/Shanghai'; */ $config['log']['level'] = Phalcon\Logger::INFO; +/** + * 日志链路 + */ +$config['log']['trace'] = false; + /** * 网站根地址,必须以"/"结尾 */