From d927e619e8d26dea6548ea56ef842d886d12ebe9 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 2 May 2025 07:55:38 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E7=A7=BB=E9=99=A4Throttle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Api/Controllers/Controller.php | 2 - app/Http/Home/Controllers/Controller.php | 2 - app/Http/Home/Controllers/LayerController.php | 2 - app/Services/Logic/Order/OrderConfirm.php | 1 - app/Services/Throttle.php | 65 ------------------- app/Traits/Security.php | 7 -- app/Validators/Security.php | 13 ---- config/config.default.php | 15 ----- config/errors.php | 1 - 9 files changed, 108 deletions(-) delete mode 100644 app/Services/Throttle.php diff --git a/app/Http/Api/Controllers/Controller.php b/app/Http/Api/Controllers/Controller.php index 60c3dac3..74d227b9 100644 --- a/app/Http/Api/Controllers/Controller.php +++ b/app/Http/Api/Controllers/Controller.php @@ -30,8 +30,6 @@ class Controller extends \Phalcon\Mvc\Controller $this->setCors(); } - $this->checkRateLimit(); - return true; } diff --git a/app/Http/Home/Controllers/Controller.php b/app/Http/Home/Controllers/Controller.php index 8ceeeb3f..43cac9a0 100644 --- a/app/Http/Home/Controllers/Controller.php +++ b/app/Http/Home/Controllers/Controller.php @@ -77,8 +77,6 @@ class Controller extends \Phalcon\Mvc\Controller $this->checkCsrfToken(); } - $this->checkRateLimit(); - return true; } diff --git a/app/Http/Home/Controllers/LayerController.php b/app/Http/Home/Controllers/LayerController.php index 18f58473..0c1ca60f 100644 --- a/app/Http/Home/Controllers/LayerController.php +++ b/app/Http/Home/Controllers/LayerController.php @@ -37,8 +37,6 @@ class LayerController extends \Phalcon\Mvc\Controller $this->checkCsrfToken(); } - $this->checkRateLimit(); - return true; } diff --git a/app/Services/Logic/Order/OrderConfirm.php b/app/Services/Logic/Order/OrderConfirm.php index 06882b11..57a85041 100644 --- a/app/Services/Logic/Order/OrderConfirm.php +++ b/app/Services/Logic/Order/OrderConfirm.php @@ -121,7 +121,6 @@ class OrderConfirm extends LogicService 'lesson_count' => $course->lesson_count, 'study_expiry' => $course->study_expiry, 'refund_expiry' => $course->refund_expiry, - 'origin_price' => $course->origin_price, 'market_price' => $course->market_price, 'vip_price' => $course->vip_price, ]; diff --git a/app/Services/Throttle.php b/app/Services/Throttle.php deleted file mode 100644 index 77bc8cbc..00000000 --- a/app/Services/Throttle.php +++ /dev/null @@ -1,65 +0,0 @@ -getConfig(); - - if (!$config->path('throttle.enabled')) { - return true; - } - - $cache = $this->getCache(); - - $sign = $this->getRequestSignature(); - - $cacheKey = $this->getCacheKey($sign); - - if ($cache->ttl($cacheKey) < 1) { - $cache->save($cacheKey, 0, $config->path('throttle.lifetime')); - } - - $rateLimit = $cache->get($cacheKey); - - if ($rateLimit >= $config->path('throttle.rate_limit')) { - return false; - } - - $cache->increment($cacheKey, 1); - - return true; - } - - protected function getRequestSignature() - { - $authUser = $this->getAuthUser(); - - if (!empty($authUser['id'])) { - return md5($authUser['id']); - } - - $httpHost = $this->request->getHttpHost(); - $clientAddress = $this->request->getClientAddress(); - - if ($httpHost && $clientAddress) { - return md5($httpHost . '|' . $clientAddress); - } - - throw new \RuntimeException('Unable to generate request signature'); - } - - protected function getCacheKey($sign) - { - return "throttle:{$sign}"; - } - -} diff --git a/app/Traits/Security.php b/app/Traits/Security.php index 7934d654..d0b14b6b 100644 --- a/app/Traits/Security.php +++ b/app/Traits/Security.php @@ -28,13 +28,6 @@ trait Security $validator->checkHttpReferer(); } - public function checkRateLimit() - { - $validator = new SecurityValidator(); - - $validator->checkRateLimit(); - } - public function isNotSafeRequest() { /** diff --git a/app/Validators/Security.php b/app/Validators/Security.php index 411077db..45c6f7fb 100644 --- a/app/Validators/Security.php +++ b/app/Validators/Security.php @@ -8,9 +8,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Exceptions\ServiceUnavailable as ServiceUnavailableException; use App\Library\CsrfToken as CsrfTokenService; -use App\Services\Throttle as ThrottleService; class Security extends Validator { @@ -53,17 +51,6 @@ class Security extends Validator } } - public function checkRateLimit() - { - $service = new ThrottleService(); - - $result = $service->checkRateLimit(); - - if (!$result) { - throw new ServiceUnavailableException('security.too_many_requests'); - } - } - protected function getCsrfWhitelist() { return []; diff --git a/config/config.default.php b/config/config.default.php index 901157a4..38926da4 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -147,21 +147,6 @@ $config['cors']['allow_headers'] = '*'; */ $config['cors']['allow_methods'] = ['GET', 'POST', 'OPTIONS']; -/** - * 限流开启 - */ -$config['throttle']['enabled'] = true; - -/** - * 有效期(秒) - */ -$config['throttle']['lifetime'] = 60; - -/** - * 限流频率 - */ -$config['throttle']['rate_limit'] = 60; - /** * 客户端ping服务端间隔(秒) */ diff --git a/config/errors.php b/config/errors.php index 74a3e970..207c509d 100644 --- a/config/errors.php +++ b/config/errors.php @@ -22,7 +22,6 @@ $error['sys.unknown_error'] = '未知错误'; /** * 安全相关 */ -$error['security.too_many_requests'] = '请求过于频繁'; $error['security.invalid_csrf_token'] = '无效的CSRF令牌'; $error['security.invalid_http_referer'] = '无效请求来源'; From 7a9fee5545cc23f08687d7b222cd5d01d6a7675a Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 8 May 2025 17:18:20 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=BE=E6=97=B6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9B=B4=E6=92=AD=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Views/chapter/edit_lesson.volt | 4 ++-- app/Http/Home/Views/course/show_catalog.volt | 2 ++ public/static/home/css/common.css | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Admin/Views/chapter/edit_lesson.volt b/app/Http/Admin/Views/chapter/edit_lesson.volt index 586ed9e7..f0ece145 100644 --- a/app/Http/Admin/Views/chapter/edit_lesson.volt +++ b/app/Http/Admin/Views/chapter/edit_lesson.volt @@ -88,7 +88,7 @@ layer.open({ type: 2, title: '推流测试', - area: ['720px', '500px'], + area: ['720px', '540px'], content: [url, 'no'] }); }); @@ -97,4 +97,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Home/Views/course/show_catalog.volt b/app/Http/Home/Views/course/show_catalog.volt index d693b836..70594315 100644 --- a/app/Http/Home/Views/course/show_catalog.volt +++ b/app/Http/Home/Views/course/show_catalog.volt @@ -101,6 +101,8 @@ 倒计时 {% elseif lesson.attrs.end_time < time() %} 已结束 + {% elseif lesson.attrs.stream.status == 'inactive' %} + 未推流 {% endif %} {%- endmacro %} diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index 6225ac8f..db3d9580 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -1106,6 +1106,11 @@ color: red; } +.lesson-item .flag-inactive { + border: 1px solid gray; + color: gray; +} + .lesson-item .flag-ended { border: 1px solid gray; color: gray; From 27440fe67905a239a63332fae2627bf699c7327d Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Tue, 20 May 2025 18:06:11 +0800 Subject: [PATCH 03/13] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=BB=98=E8=AE=A4=E5=80=BC=202.=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=203.=E7=B2=BE=E7=AE=80=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Tasks/SyncAppInfoTask.php | 6 +- app/Http/Admin/Views/templates/main.volt | 3 +- .../Home/Controllers/ConnectController.php | 19 +++--- app/Validators/Order.php | 53 +++++----------- app/Validators/Trade.php | 2 +- config/errors.php | 10 ++- db/migrations/20210403184518.php | 63 +++++++------------ public/static/admin/js/fixbar.js | 7 +++ 8 files changed, 66 insertions(+), 97 deletions(-) create mode 100644 public/static/admin/js/fixbar.js diff --git a/app/Console/Tasks/SyncAppInfoTask.php b/app/Console/Tasks/SyncAppInfoTask.php index 361d029e..d2d73f6d 100644 --- a/app/Console/Tasks/SyncAppInfoTask.php +++ b/app/Console/Tasks/SyncAppInfoTask.php @@ -13,12 +13,12 @@ use GuzzleHttp\Client; class SyncAppInfoTask extends Task { + const API_BASE_URL = 'https://www.koogua.com/api'; + public function mainAction() { echo '------ start sync app info ------' . PHP_EOL; - $url = 'https://www.koogua.com/api/instance/collect'; - $site = $this->getSettings('site'); $serverHost = parse_url($site['url'], PHP_URL_HOST); @@ -38,6 +38,8 @@ class SyncAppInfoTask extends Task $client = new Client(); + $url = sprintf('%s/instance/collect', self::API_BASE_URL); + $client->request('POST', $url, ['form_params' => $params]); echo '------ end sync app info ------' . PHP_EOL; diff --git a/app/Http/Admin/Views/templates/main.volt b/app/Http/Admin/Views/templates/main.volt index a4a8a8ea..9eb4baee 100644 --- a/app/Http/Admin/Views/templates/main.volt +++ b/app/Http/Admin/Views/templates/main.volt @@ -20,9 +20,10 @@ {{ js_include('lib/layui/layui.js') }} {{ js_include('admin/js/common.js') }} +{{ js_include('admin/js/fixbar.js') }} {% block include_js %}{% endblock %} {% block inline_js %}{% endblock %} - \ No newline at end of file + diff --git a/app/Http/Home/Controllers/ConnectController.php b/app/Http/Home/Controllers/ConnectController.php index 9653c43d..2a155f83 100644 --- a/app/Http/Home/Controllers/ConnectController.php +++ b/app/Http/Home/Controllers/ConnectController.php @@ -120,19 +120,16 @@ class ConnectController extends Controller $service = new ConnectService(); $openUser = $service->getOpenUserInfo($code, $state, $provider); - $connect = $service->getConnectRelation($openUser['id'], $openUser['provider']); - if ($this->authUser->id > 0) { - if ($openUser) { - $service->bindUser($openUser); - return $this->response->redirect(['for' => 'home.uc.account']); - } - } else { - if ($connect) { - $service->authConnectLogin($connect); - return $this->response->redirect(['for' => 'home.index']); - } + if ($this->authUser->id > 0 && $openUser) { + $service->bindUser($openUser); + return $this->response->redirect(['for' => 'home.uc.account']); + } + + if ($this->authUser->id == 0 && $connect) { + $service->authConnectLogin($connect); + return $this->response->redirect(['for' => 'home.index']); } $this->seo->prependTitle('绑定帐号'); diff --git a/app/Validators/Order.php b/app/Validators/Order.php index 9a390ba4..8cc3422f 100644 --- a/app/Validators/Order.php +++ b/app/Validators/Order.php @@ -11,10 +11,7 @@ use App\Exceptions\BadRequest as BadRequestException; use App\Models\Order as OrderModel; use App\Models\Refund as RefundModel; use App\Models\Trade as TradeModel; -use App\Repos\Course as CourseRepo; use App\Repos\Order as OrderRepo; -use App\Repos\Package as PackageRepo; -use App\Repos\Vip as VipRepo; class Order extends Validator { @@ -50,54 +47,36 @@ class Order extends Validator return $order; } - public function checkItemType($itemType) + public function checkItemType($type) { - $list = OrderModel::itemTypes(); + $types = OrderModel::itemTypes(); - if (!array_key_exists($itemType, $list)) { + if (!array_key_exists($type, $types)) { throw new BadRequestException('order.invalid_item_type'); } - return $itemType; + return $type; } - public function checkCourse($itemId) + public function checkCourse($id) { - $courseRepo = new CourseRepo(); + $validator = new Course(); - $course = $courseRepo->findById($itemId); - - if (!$course || $course->published == 0) { - throw new BadRequestException('order.item_not_found'); - } - - return $course; + return $validator->checkCourse($id); } - public function checkPackage($itemId) + public function checkPackage($id) { - $packageRepo = new PackageRepo(); + $validator = new Package(); - $package = $packageRepo->findById($itemId); - - if (!$package || $package->published == 0) { - throw new BadRequestException('order.item_not_found'); - } - - return $package; + return $validator->checkPackage($id); } - public function checkVip($itemId) + public function checkVip($id) { - $vipRepo = new VipRepo(); + $validator = new Vip(); - $vip = $vipRepo->findById($itemId); - - if (!$vip || $vip->deleted == 1) { - throw new BadRequestException('order.item_not_found'); - } - - return $vip; + return $validator->checkVip($id); } public function checkAmount($amount) @@ -105,7 +84,7 @@ class Order extends Validator $value = $this->filter->sanitize($amount, ['trim', 'float']); if ($value < 0.01 || $value > 100000) { - throw new BadRequestException('order.invalid_pay_amount'); + throw new BadRequestException('order.invalid_amount'); } return $value; @@ -148,7 +127,7 @@ class Order extends Validator ]; if (!in_array($order->item_type, $types)) { - throw new BadRequestException('order.refund_item_unsupported'); + throw new BadRequestException('order.refund_not_supported'); } $orderRepo = new OrderRepo(); @@ -167,7 +146,7 @@ class Order extends Validator ]; if ($refund && in_array($refund->status, $scopes)) { - throw new BadRequestException('order.refund_apply_existed'); + throw new BadRequestException('order.refund_request_existed'); } } diff --git a/app/Validators/Trade.php b/app/Validators/Trade.php index d69f94ba..66ad3e4f 100644 --- a/app/Validators/Trade.php +++ b/app/Validators/Trade.php @@ -91,7 +91,7 @@ class Trade extends Validator ]; if ($refund && in_array($refund->status, $scopes)) { - throw new BadRequestException('trade.refund_apply_existed'); + throw new BadRequestException('trade.refund_request_existed'); } } diff --git a/config/errors.php b/config/errors.php index 207c509d..062f81b6 100644 --- a/config/errors.php +++ b/config/errors.php @@ -363,17 +363,15 @@ $error['slide.invalid_publish_status'] = '无效的发布状态'; * 订单相关 */ $error['order.not_found'] = '订单不存在'; +$error['order.invalid_amount'] = '无效的支付金额'; $error['order.invalid_status'] = '无效的状态类型'; -$error['order.item_not_found'] = '商品不存在'; -$error['order.trade_expired'] = '交易已过期'; $error['order.is_delivering'] = '已经下过单了,正在准备发货中'; $error['order.has_bought_course'] = '已经购买过该课程'; $error['order.has_bought_package'] = '已经购买过该套餐'; $error['order.cancel_not_allowed'] = '当前不允许取消订单'; -$error['order.close_not_allowed'] = '当前不允许关闭订单'; $error['order.refund_not_allowed'] = '当前不允许申请退款'; -$error['order.refund_item_unsupported'] = '该品类不支持退款'; -$error['order.refund_apply_existed'] = '退款申请已经存在'; +$error['order.refund_not_supported'] = '该品类不支持退款'; +$error['order.refund_request_existed'] = '退款申请已经存在'; /** * 交易相关 @@ -384,7 +382,7 @@ $error['trade.invalid_channel'] = '无效的平台类型'; $error['trade.invalid_status'] = '无效的状态类型'; $error['trade.close_not_allowed'] = '当前不允许关闭交易'; $error['trade.refund_not_allowed'] = '当前不允许交易退款'; -$error['trade.refund_apply_existed'] = '退款申请已经存在,请等待处理结果'; +$error['trade.refund_request_existed'] = '退款申请已经存在,请等待处理结果'; /** * 退款相关 diff --git a/db/migrations/20210403184518.php b/db/migrations/20210403184518.php index 148bc846..3186f788 100644 --- a/db/migrations/20210403184518.php +++ b/db/migrations/20210403184518.php @@ -294,21 +294,6 @@ final class V20210403184518 extends AbstractMigration protected function initSettingData() { $rows = [ - [ - 'section' => 'captcha', - 'item_key' => 'enabled', - 'item_value' => '0', - ], - [ - 'section' => 'captcha', - 'item_key' => 'app_id', - 'item_value' => '', - ], - [ - 'section' => 'captcha', - 'item_key' => 'secret_key', - 'item_value' => '', - ], [ 'section' => 'live.push', 'item_key' => 'domain', @@ -392,7 +377,7 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'mail', 'item_key' => 'smtp_host', - 'item_value' => 'smtp.163.com', + 'item_value' => '', ], [ 'section' => 'mail', @@ -412,22 +397,22 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'mail', 'item_key' => 'smtp_username', - 'item_value' => 'xxx@163.com', + 'item_value' => '', ], [ 'section' => 'mail', 'item_key' => 'smtp_password', - 'item_value' => 'xxx', + 'item_value' => '', ], [ 'section' => 'mail', 'item_key' => 'smtp_from_email', - 'item_value' => 'xxx@163.com', + 'item_value' => '', ], [ 'section' => 'mail', 'item_key' => 'smtp_from_name', - 'item_value' => 'XXX有限公司', + 'item_value' => '', ], [ 'section' => 'pay.alipay', @@ -512,17 +497,17 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'secret', 'item_key' => 'secret_key', - 'item_value' => 'xxx', + 'item_value' => '', ], [ 'section' => 'secret', 'item_key' => 'secret_id', - 'item_value' => 'xxx', + 'item_value' => '', ], [ 'section' => 'secret', 'item_key' => 'app_id', - 'item_value' => 'xxx', + 'item_value' => '', ], [ 'section' => 'site', @@ -617,29 +602,29 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'sms', 'item_key' => 'signature', - 'item_value' => '酷瓜云课堂', + 'item_value' => '', ], [ 'section' => 'sms', 'item_key' => 'template', 'item_value' => json_encode([ - 'verify' => ['enabled' => 1, 'id' => ''], - 'order_finish' => ['enabled' => 1, 'id' => ''], - 'refund_finish' => ['enabled' => 1, 'id' => ''], - 'live_begin' => ['enabled' => 1, 'id' => ''], - 'consult_reply' => ['enabled' => 1, 'id' => ''], - 'goods_deliver' => ['enabled' => 1, 'id' => ''], + 'verify' => ['enabled' => 1, 'id' => 0], + 'order_finish' => ['enabled' => 0, 'id' => 0], + 'refund_finish' => ['enabled' => 0, 'id' => 0], + 'live_begin' => ['enabled' => 0, 'id' => 0], + 'consult_reply' => ['enabled' => 0, 'id' => 0], + 'goods_deliver' => ['enabled' => 0, 'id' => 0], ]), ], [ 'section' => 'cos', 'item_key' => 'bucket', - 'item_value' => 'course-1255691183', + 'item_value' => '', ], [ 'section' => 'cos', 'item_key' => 'region', - 'item_value' => 'ap-guangzhou', + 'item_value' => '', ], [ 'section' => 'cos', @@ -649,7 +634,7 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'cos', 'item_key' => 'domain', - 'item_value' => 'course-1255691183.file.myqcloud.com', + 'item_value' => '', ], [ 'section' => 'vod', @@ -835,12 +820,12 @@ final class V20210403184518 extends AbstractMigration 'section' => 'wechat.oa', 'item_key' => 'notice_template', 'item_value' => json_encode([ - 'account_login' => ['enabled' => 1, 'id' => ''], - 'order_finish' => ['enabled' => 1, 'id' => ''], - 'refund_finish' => ['enabled' => 1, 'id' => ''], - 'goods_deliver' => ['enabled' => 1, 'id' => ''], - 'consult_reply' => ['enabled' => 1, 'id' => ''], - 'live_begin' => ['enabled' => 1, 'id' => ''], + 'account_login' => ['enabled' => 0, 'id' => 0], + 'order_finish' => ['enabled' => 0, 'id' => 0], + 'refund_finish' => ['enabled' => 0, 'id' => 0], + 'goods_deliver' => ['enabled' => 0, 'id' => 0], + 'consult_reply' => ['enabled' => 0, 'id' => 0], + 'live_begin' => ['enabled' => 0, 'id' => 0], ]), ], [ diff --git a/public/static/admin/js/fixbar.js b/public/static/admin/js/fixbar.js new file mode 100644 index 00000000..ab5bccb6 --- /dev/null +++ b/public/static/admin/js/fixbar.js @@ -0,0 +1,7 @@ +layui.use(['util'], function () { + + var util = layui.util; + + util.fixbar(); + +}); \ No newline at end of file From 59bfe4a765bd7414b7ec486f2c6c99d6834a4ce6 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Wed, 21 May 2025 11:05:18 +0800 Subject: [PATCH 04/13] =?UTF-8?q?gitee=20webhook=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Library/AppInfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 3165fc16..536def8e 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -16,7 +16,7 @@ class AppInfo protected $link = 'https://www.koogua.com'; - protected $version = '1.7.7'; + protected $version = '1.7.8'; public function __get($name) { From 12db90d9c1dce9fc09d67398e1172d0f78fe4426 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 22 May 2025 23:31:12 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E5=87=A0=E4=B8=AA?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=B8=BA=E7=A9=BA=E7=9A=84=E8=85=BE=E8=AE=AF?= =?UTF-8?q?=E4=BA=91=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controllers/UploadController.php | 22 ---------- app/Http/Home/Views/help/show.volt | 17 +++---- app/Http/Home/Views/page/show.volt | 17 +++---- app/Http/Home/Views/user/console/profile.volt | 3 +- db/migrations/20210403184518.php | 12 ++--- public/static/admin/js/avatar.upload.js | 44 ------------------- public/static/home/js/help.show.js | 12 +++++ public/static/home/js/page.show.js | 12 +++++ public/static/home/js/user.avatar.upload.js | 44 ------------------- public/static/home/js/user.console.profile.js | 44 ++++++++++++++++++- 10 files changed, 83 insertions(+), 144 deletions(-) delete mode 100644 public/static/admin/js/avatar.upload.js create mode 100644 public/static/home/js/help.show.js create mode 100644 public/static/home/js/page.show.js delete mode 100644 public/static/home/js/user.avatar.upload.js diff --git a/app/Http/Admin/Controllers/UploadController.php b/app/Http/Admin/Controllers/UploadController.php index 432e5129..ca020f3b 100644 --- a/app/Http/Admin/Controllers/UploadController.php +++ b/app/Http/Admin/Controllers/UploadController.php @@ -71,28 +71,6 @@ class UploadController extends Controller return $this->jsonSuccess(['data' => $data]); } - /** - * @Post("/avatar/img", name="admin.upload.avatar_img") - */ - public function uploadAvatarImageAction() - { - $service = new StorageService(); - - $file = $service->uploadAvatarImage(); - - if (!$file) { - return $this->jsonError(['msg' => '上传文件失败']); - } - - $data = [ - 'id' => $file->id, - 'name' => $file->name, - 'url' => $service->getImageUrl($file->path), - ]; - - return $this->jsonSuccess(['data' => $data]); - } - /** * @Post("/content/img", name="admin.upload.content_img") */ diff --git a/app/Http/Home/Views/help/show.volt b/app/Http/Home/Views/help/show.volt index 6c48660d..d513b031 100644 --- a/app/Http/Home/Views/help/show.volt +++ b/app/Http/Home/Views/help/show.volt @@ -31,17 +31,10 @@ {% endblock %} -{% block inline_js %} +{% block include_js %} - + {{ js_include('lib/clipboard.min.js') }} + {{ js_include('home/js/help.show.js') }} + {{ js_include('home/js/copy.js') }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Home/Views/page/show.volt b/app/Http/Home/Views/page/show.volt index 654c19aa..b824f461 100644 --- a/app/Http/Home/Views/page/show.volt +++ b/app/Http/Home/Views/page/show.volt @@ -30,17 +30,10 @@ {% endblock %} -{% block inline_js %} +{% block include_js %} - + {{ js_include('lib/clipboard.min.js') }} + {{ js_include('home/js/page.show.js') }} + {{ js_include('home/js/copy.js') }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Home/Views/user/console/profile.volt b/app/Http/Home/Views/user/console/profile.volt index 1574d1fd..8a47b597 100644 --- a/app/Http/Home/Views/user/console/profile.volt +++ b/app/Http/Home/Views/user/console/profile.volt @@ -79,7 +79,6 @@ {% block include_js %} - {{ js_include('home/js/user.avatar.upload.js') }} {{ js_include('home/js/user.console.profile.js') }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/db/migrations/20210403184518.php b/db/migrations/20210403184518.php index 3186f788..b06c86bd 100644 --- a/db/migrations/20210403184518.php +++ b/db/migrations/20210403184518.php @@ -497,17 +497,17 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'secret', 'item_key' => 'secret_key', - 'item_value' => '', + 'item_value' => 'xxx', ], [ 'section' => 'secret', 'item_key' => 'secret_id', - 'item_value' => '', + 'item_value' => 'xxx', ], [ 'section' => 'secret', 'item_key' => 'app_id', - 'item_value' => '', + 'item_value' => 'xxx', ], [ 'section' => 'site', @@ -619,12 +619,12 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'cos', 'item_key' => 'bucket', - 'item_value' => '', + 'item_value' => 'course-1255691183', ], [ 'section' => 'cos', 'item_key' => 'region', - 'item_value' => '', + 'item_value' => 'ap-guangzhou', ], [ 'section' => 'cos', @@ -634,7 +634,7 @@ final class V20210403184518 extends AbstractMigration [ 'section' => 'cos', 'item_key' => 'domain', - 'item_value' => '', + 'item_value' => 'course-1255691183.file.myqcloud.com', ], [ 'section' => 'vod', diff --git a/public/static/admin/js/avatar.upload.js b/public/static/admin/js/avatar.upload.js deleted file mode 100644 index 6f235d29..00000000 --- a/public/static/admin/js/avatar.upload.js +++ /dev/null @@ -1,44 +0,0 @@ -layui.use(['jquery', 'layer', 'upload'], function () { - - var $ = layui.jquery; - var layer = layui.layer; - var upload = layui.upload; - - upload.render({ - elem: '#change-avatar', - url: '/admin/upload/avatar/img', - accept: 'images', - acceptMime: 'image/*', - size: 512, - auto: false, - before: function () { - layer.load(); - }, - choose: function (obj) { - var flag = true; - obj.preview(function (index, file, result) { - var img = new Image(); - img.src = result; - img.onload = function () { - if (img.width < 1000 && img.height < 1000) { - obj.upload(index, file); - } else { - flag = false; - layer.msg("图片尺寸必须小于 1000 * 1000"); - return false; - } - }; - return flag; - }); - }, - done: function (res, index, upload) { - $('#img-avatar').attr('src', res.data.url); - $('input[name=avatar]').val(res.data.url); - layer.closeAll('loading'); - }, - error: function (index, upload) { - layer.msg('上传文件失败', {icon: 2}); - } - }); - -}); \ No newline at end of file diff --git a/public/static/home/js/help.show.js b/public/static/home/js/help.show.js new file mode 100644 index 00000000..2e9a7403 --- /dev/null +++ b/public/static/home/js/help.show.js @@ -0,0 +1,12 @@ +layui.use(['jquery', 'helper'], function () { + + var $ = layui.jquery; + var helper = layui.helper; + + var $courseList = $('#course-list'); + + if ($courseList.length > 0) { + helper.ajaxLoadHtml($courseList.data('url'), $courseList.attr('id')); + } + +}); diff --git a/public/static/home/js/page.show.js b/public/static/home/js/page.show.js new file mode 100644 index 00000000..2e9a7403 --- /dev/null +++ b/public/static/home/js/page.show.js @@ -0,0 +1,12 @@ +layui.use(['jquery', 'helper'], function () { + + var $ = layui.jquery; + var helper = layui.helper; + + var $courseList = $('#course-list'); + + if ($courseList.length > 0) { + helper.ajaxLoadHtml($courseList.data('url'), $courseList.attr('id')); + } + +}); diff --git a/public/static/home/js/user.avatar.upload.js b/public/static/home/js/user.avatar.upload.js deleted file mode 100644 index 2e468127..00000000 --- a/public/static/home/js/user.avatar.upload.js +++ /dev/null @@ -1,44 +0,0 @@ -layui.use(['jquery', 'layer', 'upload'], function () { - - var $ = layui.jquery; - var layer = layui.layer; - var upload = layui.upload; - - upload.render({ - elem: '#change-avatar', - url: '/upload/avatar/img', - accept: 'images', - acceptMime: 'image/*', - size: 512, - auto: false, - before: function () { - layer.load(); - }, - choose: function (obj) { - var flag = true; - obj.preview(function (index, file, result) { - var img = new Image(); - img.src = result; - img.onload = function () { - if (img.width < 1000 && img.height < 1000) { - obj.upload(index, file); - } else { - flag = false; - layer.msg("图片尺寸必须小于 1000 * 1000"); - return false; - } - }; - return flag; - }); - }, - done: function (res, index, upload) { - $('#img-avatar').attr('src', res.data.url); - $('input[name=avatar]').val(res.data.url); - layer.closeAll('loading'); - }, - error: function (index, upload) { - layer.msg('上传文件失败', {icon: 2}); - } - }); - -}); \ No newline at end of file diff --git a/public/static/home/js/user.console.profile.js b/public/static/home/js/user.console.profile.js index 6aa2f380..558813e4 100644 --- a/public/static/home/js/user.console.profile.js +++ b/public/static/home/js/user.console.profile.js @@ -1,7 +1,47 @@ -layui.use(['layarea'], function () { +layui.use(['jquery', 'upload', 'layer', 'layarea'], function () { + var $ = layui.jquery; + var layer = layui.layer; + var upload = layui.upload; var layarea = layui.layarea; + upload.render({ + elem: '#change-avatar', + url: '/upload/avatar/img', + accept: 'images', + acceptMime: 'image/*', + size: 512, + auto: false, + before: function () { + layer.load(); + }, + choose: function (obj) { + var flag = true; + obj.preview(function (index, file, result) { + var img = new Image(); + img.src = result; + img.onload = function () { + if (img.width < 1000 && img.height < 1000) { + obj.upload(index, file); + } else { + flag = false; + layer.msg("图片尺寸必须小于 1000 * 1000"); + return false; + } + }; + return flag; + }); + }, + done: function (res) { + $('#img-avatar').attr('src', res.data.url); + $('input[name=avatar]').val(res.data.url); + layer.closeAll('loading'); + }, + error: function () { + layer.msg('上传文件失败', {icon: 2}); + } + }); + layarea.render({ elem: '#area-picker', change: function (res) { @@ -9,4 +49,4 @@ layui.use(['layarea'], function () { } }); -}); \ No newline at end of file +}); From 123e1ec97f3f076d49d9f39c78c11ae944f74250 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 23 May 2025 17:03:58 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E5=A4=B4=E5=83=8F->=E4=B8=8A=E4=BC=A0=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controllers/UploadController.php | 22 ++++++++++++++++ app/Http/Admin/Views/user/edit.volt | 19 +++++++------- public/static/admin/js/avatar.upload.js | 25 +++++++++++++++++++ 3 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 public/static/admin/js/avatar.upload.js diff --git a/app/Http/Admin/Controllers/UploadController.php b/app/Http/Admin/Controllers/UploadController.php index ca020f3b..432e5129 100644 --- a/app/Http/Admin/Controllers/UploadController.php +++ b/app/Http/Admin/Controllers/UploadController.php @@ -71,6 +71,28 @@ class UploadController extends Controller return $this->jsonSuccess(['data' => $data]); } + /** + * @Post("/avatar/img", name="admin.upload.avatar_img") + */ + public function uploadAvatarImageAction() + { + $service = new StorageService(); + + $file = $service->uploadAvatarImage(); + + if (!$file) { + return $this->jsonError(['msg' => '上传文件失败']); + } + + $data = [ + 'id' => $file->id, + 'name' => $file->name, + 'url' => $service->getImageUrl($file->path), + ]; + + return $this->jsonSuccess(['data' => $data]); + } + /** * @Post("/content/img", name="admin.upload.content_img") */ diff --git a/app/Http/Admin/Views/user/edit.volt b/app/Http/Admin/Views/user/edit.volt index 47946487..f6403ff2 100644 --- a/app/Http/Admin/Views/user/edit.volt +++ b/app/Http/Admin/Views/user/edit.volt @@ -21,12 +21,11 @@
- + -
- +
@@ -153,6 +152,12 @@ {% endblock %} +{% block include_js %} + + {{ js_include('admin/js/avatar.upload.js') }} + +{% endblock %} + {% block inline_js %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/public/static/admin/js/avatar.upload.js b/public/static/admin/js/avatar.upload.js new file mode 100644 index 00000000..588f2b17 --- /dev/null +++ b/public/static/admin/js/avatar.upload.js @@ -0,0 +1,25 @@ +layui.use(['jquery', 'layer', 'upload'], function () { + + var $ = layui.jquery; + var layer = layui.layer; + var upload = layui.upload; + + upload.render({ + elem: '#change-avatar', + url: '/admin/upload/avatar/img', + accept: 'images', + acceptMime: 'image/*', + before: function () { + layer.load(); + }, + done: function (res, index, upload) { + $('#img-avatar').attr('src', res.data.url); + $('input[name=avatar]').val(res.data.url); + layer.closeAll('loading'); + }, + error: function (index, upload) { + layer.msg('上传文件失败', {icon: 2}); + } + }); + +}); From 2a1b4b69fde3da9f4ce4a56b35e0886c59f8aa3c Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 26 May 2025 10:41:17 +0800 Subject: [PATCH 07/13] =?UTF-8?q?fixbar=E5=A2=9E=E5=8A=A0=E7=94=B5?= =?UTF-8?q?=E8=AF=9D=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/home/js/fixbar.js | 36 +++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/public/static/home/js/fixbar.js b/public/static/home/js/fixbar.js index 831f471f..df01c3e5 100644 --- a/public/static/home/js/fixbar.js +++ b/public/static/home/js/fixbar.js @@ -1,4 +1,4 @@ -layui.use(['jquery', 'helper', 'util'], function () { +layui.use(['jquery', 'util'], function () { var $ = layui.jquery; var util = layui.util; @@ -47,6 +47,17 @@ layui.use(['jquery', 'helper', 'util'], function () { }); } + var showPhoneCode = function () { + var content = '
' + window.contact.phone + '
'; + layer.open({ + type: 1, + title: false, + closeBtn: 0, + shadeClose: true, + content: content, + }); + } + var bars = []; if (window.contact.wechat) { @@ -63,6 +74,13 @@ layui.use(['jquery', 'helper', 'util'], function () { }); } + if (window.contact.phone) { + bars.push({ + type: 'phone', + content: '', + }); + } + util.fixbar({ bars: bars, click: function (type) { @@ -70,24 +88,30 @@ layui.use(['jquery', 'helper', 'util'], function () { showWechatCode(); } else if (type === 'qq') { showQQCode(); + } else if (type === 'phone') { + showPhoneCode(); } } }); - $('.icon-wechat').on('click', function () { + $('.contact > .wechat').on('click', function () { showWechatCode(); }); - $('.icon-qq').on('click', function () { + $('.contact > .qq').on('click', function () { showQQCode(); }); - $('.icon-toutiao').on('click', function () { + $('.contact > .toutiao').on('click', function () { showTouTiaoCode(); }); - $('.icon-douyin').on('click', function () { + $('.contact > .douyin').on('click', function () { showDouYinCode(); }); -}); \ No newline at end of file + $('.contact > .phone').on('click', function () { + showPhoneCode(); + }); + +}); From f5ed2ce2398b0e38e5e85b699d3cd4734cb88fa9 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 26 May 2025 19:19:12 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E4=BC=98=E5=8C=96fixbar=E7=94=B5?= =?UTF-8?q?=E8=AF=9D=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/home/js/fixbar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/static/home/js/fixbar.js b/public/static/home/js/fixbar.js index df01c3e5..91d26f62 100644 --- a/public/static/home/js/fixbar.js +++ b/public/static/home/js/fixbar.js @@ -48,7 +48,9 @@ layui.use(['jquery', 'util'], function () { } var showPhoneCode = function () { - var content = '
' + window.contact.phone + '
'; + var content = '
'; + content += '' + window.contact.phone; + content += '
'; layer.open({ type: 1, title: false, From 7281029dd0439e382d0983a74f35d56c3df3e0a1 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 5 Jun 2025 17:53:06 +0800 Subject: [PATCH 09/13] =?UTF-8?q?sitemap.xml=E7=9B=B4=E6=8E=A5=E5=86=99?= =?UTF-8?q?=E5=85=A5public=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Tasks/SitemapTask.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Tasks/SitemapTask.php b/app/Console/Tasks/SitemapTask.php index a9e3324e..f617f8be 100644 --- a/app/Console/Tasks/SitemapTask.php +++ b/app/Console/Tasks/SitemapTask.php @@ -37,7 +37,7 @@ class SitemapTask extends Task $this->sitemap = new Sitemap(); - $filename = tmp_path('sitemap.xml'); + $filename = public_path('sitemap.xml'); echo '------ start sitemap task ------' . PHP_EOL; From 303442f446e62303df9fcf281dbf2e5f26591808 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 9 Jun 2025 19:08:33 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E4=B8=AD=E5=9B=BE=E7=89=87alt=E5=B1=9E=E6=80=A7=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0striptags=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Home/Views/search/article.volt | 2 +- app/Http/Home/Views/search/course.volt | 2 +- app/Http/Home/Views/search/question.volt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Home/Views/search/article.volt b/app/Http/Home/Views/search/article.volt index 7c22ca7c..f2762acd 100644 --- a/app/Http/Home/Views/search/article.volt +++ b/app/Http/Home/Views/search/article.volt @@ -19,7 +19,7 @@ {% if item.cover %} {% endif %} diff --git a/app/Http/Home/Views/search/course.volt b/app/Http/Home/Views/search/course.volt index 73fe058d..1bc05420 100644 --- a/app/Http/Home/Views/search/course.volt +++ b/app/Http/Home/Views/search/course.volt @@ -6,7 +6,7 @@
diff --git a/app/Http/Home/Views/search/question.volt b/app/Http/Home/Views/search/question.volt index 4dec9446..02e48e93 100644 --- a/app/Http/Home/Views/search/question.volt +++ b/app/Http/Home/Views/search/question.volt @@ -19,7 +19,7 @@ {% if item.cover %} {% endif %} From 2ab6ae71cdb9acd338428dcb2d50a427b9a81218 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 9 Jun 2025 22:46:28 +0800 Subject: [PATCH 11/13] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA=202.=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=B3=A8=E5=86=8C=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Home/Views/account/register_by_email.volt | 4 ++-- app/Http/Home/Views/account/register_by_phone.volt | 4 ++-- app/Http/Home/Views/course/show_catalog.volt | 4 ++-- public/static/home/css/common.css | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Home/Views/account/register_by_email.volt b/app/Http/Home/Views/account/register_by_email.volt index f6c486d9..9a171a8d 100644 --- a/app/Http/Home/Views/account/register_by_email.volt +++ b/app/Http/Home/Views/account/register_by_email.volt @@ -36,6 +36,6 @@ {% else %}
- 邮箱注册已关闭 + 邮箱注册已关闭
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/app/Http/Home/Views/account/register_by_phone.volt b/app/Http/Home/Views/account/register_by_phone.volt index 6a9322f8..d0a80261 100644 --- a/app/Http/Home/Views/account/register_by_phone.volt +++ b/app/Http/Home/Views/account/register_by_phone.volt @@ -36,6 +36,6 @@ {% else %}
- 手机注册已关闭 + 手机注册已关闭
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/app/Http/Home/Views/course/show_catalog.volt b/app/Http/Home/Views/course/show_catalog.volt index 70594315..22b06e18 100644 --- a/app/Http/Home/Views/course/show_catalog.volt +++ b/app/Http/Home/Views/course/show_catalog.volt @@ -98,7 +98,7 @@ {% if lesson.attrs.stream.status == 'active' %} 直播中 {% elseif lesson.attrs.start_time > time() %} - 倒计时 + 倒计时 {% elseif lesson.attrs.end_time < time() %} 已结束 {% elseif lesson.attrs.stream.status == 'inactive' %} @@ -110,7 +110,7 @@ {% if lesson.attrs.start_time < time() and lesson.attrs.end_time > time() %} 授课中 {% elseif lesson.attrs.start_time > time() %} - 未开始 + 未开始 {% elseif lesson.attrs.end_time < time() %} 已结束 {% endif %} diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index db3d9580..dfa419ed 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -1096,7 +1096,7 @@ color: orange; } -.lesson-item .flag-pending { +.lesson-item .flag-scheduled { border: 1px solid green; color: green; } From 4e1e8340b995d690a9679687a26bb1ed9a011f32 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Wed, 11 Jun 2025 15:01:23 +0800 Subject: [PATCH 12/13] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0closeLiveTask=202.?= =?UTF-8?q?=E4=BC=98=E5=8C=96kg-back=E8=BF=94=E5=9B=9E=203.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Migrations/Migration.php | 9 ++- app/Console/Tasks/CloseLiveTask.php | 72 +++++++++++++++++++++++ app/Http/Admin/Views/category/list.volt | 4 +- app/Http/Admin/Views/chapter/lessons.volt | 4 +- app/Http/Admin/Views/course/chapters.volt | 4 +- app/Http/Admin/Views/nav/list.volt | 4 +- app/Http/Home/Views/templates/main.volt | 12 ++-- app/Services/LiveNotify.php | 6 +- scheduler.php | 3 + 9 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 app/Console/Tasks/CloseLiveTask.php diff --git a/app/Console/Migrations/Migration.php b/app/Console/Migrations/Migration.php index dab29370..061db96c 100644 --- a/app/Console/Migrations/Migration.php +++ b/app/Console/Migrations/Migration.php @@ -18,6 +18,13 @@ abstract class Migration abstract public function run(); + protected function saveSettings(array $settings) + { + foreach ($settings as $setting) { + $this->saveSetting($setting); + } + } + protected function saveSetting(array $setting) { $settingRepo = new SettingRepo(); @@ -32,4 +39,4 @@ abstract class Migration } } -} \ No newline at end of file +} diff --git a/app/Console/Tasks/CloseLiveTask.php b/app/Console/Tasks/CloseLiveTask.php new file mode 100644 index 00000000..8cfd3d86 --- /dev/null +++ b/app/Console/Tasks/CloseLiveTask.php @@ -0,0 +1,72 @@ +findChapterLives(); + + echo sprintf('pending lives: %s', $chapterLives->count()) . PHP_EOL; + + if ($chapterLives->count() == 0) return; + + echo '------ start close live task ------' . PHP_EOL; + + foreach ($chapterLives as $chapterLive) { + + $chapterLive->status = ChapterLiveModel::STATUS_INACTIVE; + + $chapterLive->update(); + + $chapterRepo = new ChapterRepo(); + + $chapter = $chapterRepo->findById($chapterLive->chapter_id); + + $attrs = $chapter->attrs; + $attrs['stream']['status'] = ChapterModel::SS_INACTIVE; + $chapter->attrs = $attrs; + + $chapter->update(); + + $cache = new CourseChapterListCache(); + + $cache->rebuild($chapterLive->course_id); + } + + echo '------ end close live task ------' . PHP_EOL; + } + + /** + * 查找待关闭直播 + * + * @param int $limit + * @return ResultsetInterface|Resultset|ChapterLiveModel[] + */ + protected function findChapterLives(int $limit = 100) + { + $status = ChapterLiveModel::STATUS_ACTIVE; + $endTime = time() - 3600; + + return ChapterLiveModel::query() + ->where('status = :status:', ['status' => $status]) + ->andWhere('end_time < :end_time:', ['end_time' => $endTime]) + ->limit($limit) + ->execute(); + } + +} diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt index 7e2efff7..837e4f26 100644 --- a/app/Http/Admin/Views/category/list.volt +++ b/app/Http/Admin/Views/category/list.volt @@ -9,7 +9,7 @@
{% if parent.id > 0 %} - 返回 + 返回 {{ parent.name }} {% endif %} 分类管理 @@ -87,4 +87,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/chapter/lessons.volt b/app/Http/Admin/Views/chapter/lessons.volt index 3650915a..3e813758 100644 --- a/app/Http/Admin/Views/chapter/lessons.volt +++ b/app/Http/Admin/Views/chapter/lessons.volt @@ -43,7 +43,7 @@
- 返回 + 返回 {{ course.title }} {{ chapter.title }} 课时管理 @@ -126,4 +126,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/course/chapters.volt b/app/Http/Admin/Views/course/chapters.volt index 2622ee59..1a653fff 100644 --- a/app/Http/Admin/Views/course/chapters.volt +++ b/app/Http/Admin/Views/course/chapters.volt @@ -9,7 +9,7 @@
- 返回 + 返回 {{ course.title }} 章节管理 @@ -79,4 +79,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/nav/list.volt b/app/Http/Admin/Views/nav/list.volt index 28a6a367..cb0e2bd6 100644 --- a/app/Http/Admin/Views/nav/list.volt +++ b/app/Http/Admin/Views/nav/list.volt @@ -25,9 +25,7 @@
{% if parent.id > 0 %} - - 返回 - + 返回 {{ parent.name }} {% endif %} 导航管理 diff --git a/app/Http/Home/Views/templates/main.volt b/app/Http/Home/Views/templates/main.volt index 106c9b85..4dbe95c4 100644 --- a/app/Http/Home/Views/templates/main.volt +++ b/app/Http/Home/Views/templates/main.volt @@ -1,6 +1,9 @@ + {% if site_info.analytics_enabled == 1 %} + {{ site_info.analytics_script }} + {% endif %} @@ -38,12 +41,5 @@ {% block include_js %}{% endblock %} {% block inline_js %}{% endblock %} - -{% if site_info.analytics_enabled == 1 %} -
- {{ site_info.analytics_script }} -
-{% endif %} - - \ No newline at end of file + diff --git a/app/Services/LiveNotify.php b/app/Services/LiveNotify.php index 5ae0554c..bee69c8e 100644 --- a/app/Services/LiveNotify.php +++ b/app/Services/LiveNotify.php @@ -7,7 +7,7 @@ namespace App\Services; -use App\Caches\CourseChapterList as CatalogCache; +use App\Caches\CourseChapterList as CourseChapterListCache; use App\Models\Chapter as ChapterModel; use App\Models\ChapterLive as ChapterLiveModel; use App\Repos\Chapter as ChapterRepo; @@ -175,7 +175,7 @@ class LiveNotify extends Service protected function rebuildCatalogCache(ChapterModel $chapter) { - $cache = new CatalogCache(); + $cache = new CourseChapterListCache(); $cache->rebuild($chapter->course_id); } @@ -216,4 +216,4 @@ class LiveNotify extends Service return $sign == $mySign; } -} \ No newline at end of file +} diff --git a/scheduler.php b/scheduler.php index f6556b56..01d4f573 100644 --- a/scheduler.php +++ b/scheduler.php @@ -63,6 +63,9 @@ $scheduler->php($script, $bin, ['--task' => 'sync_article_score', '--action' => $scheduler->php($script, $bin, ['--task' => 'sync_question_score', '--action' => 'main']) ->hourly(29); +$scheduler->php($script, $bin, ['--task' => 'close_live', '--action' => 'main']) + ->hourly(31); + $scheduler->php($script, $bin, ['--task' => 'clean_log', '--action' => 'main']) ->daily(3, 3); From 57409cb6305701b237d2dbb13512f6aa391f17af Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sun, 15 Jun 2025 15:08:42 +0800 Subject: [PATCH 13/13] v1.7.8 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b08b97c..60ec1de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +### [v1.7.8](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.8)(2025-06-20) + +- 移除ThrottleLimit +- 增加CloseLiveTask +- 增加搜索页图片alt属性striptags过滤 +- 后台增加返回顶部快捷方式 +- 前台fixbar增加联系电话 +- 优化安装脚本 +- 优化课时列表直播提示 +- 优化后台返回链接 +- 优化统计分析代码位置 +- 直播回调后更新课时缓存 +- 后台清空头像->上传头像 +- sitemap.xml直接写入网站根目录 + ### [v1.7.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.7)(2025-04-20) - 优化索引管理工具