From 73d01d62dc2b6957870df3ab05ab0e2c9974f39b Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Fri, 7 Feb 2025 18:35:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=9F=E8=AE=A1=E6=97=A5=E6=9C=9F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=202.=E4=BC=98=E5=8C=96=E5=86=85=E5=AE=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Stat.php | 29 +++++++++++++++---------- app/Http/Admin/Views/audit/list.volt | 6 ++--- app/Http/Admin/Views/audit/search.volt | 8 +++---- app/Listeners/Trade.php | 7 +----- app/Services/Logic/Point/GiftRedeem.php | 10 --------- app/Validators/Chapter.php | 2 +- public/static/home/css/common.css | 28 ++++++++++++++++++++++-- public/static/home/css/content.css | 3 +-- public/static/home/js/common.js | 25 +++++++++------------ 9 files changed, 64 insertions(+), 54 deletions(-) diff --git a/app/Http/Admin/Services/Stat.php b/app/Http/Admin/Services/Stat.php index afb3cd0b..51868a37 100644 --- a/app/Http/Admin/Services/Stat.php +++ b/app/Http/Admin/Services/Stat.php @@ -23,11 +23,11 @@ class Stat extends Service return [ [ - 'title' => "{$year}-{$month}", + 'title' => sprintf('%02d-%02d', $year, $month), 'sales' => $this->handleHotSales($type, $year, $month), ], [ - 'title' => "{$prev['year']}-{$prev['month']}", + 'title' => sprintf('%02d-%02d', $prev['year'], $prev['month']), 'sales' => $this->handleHotSales($type, $prev['year'], $prev['month']), ], ]; @@ -42,12 +42,13 @@ class Stat extends Service $currSales = $this->handleSales($year, $month); $prevSales = $this->handleSales($prev['year'], $prev['month']); + $currMonth = sprintf('%02d-%02d', $year, $month); + $prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']); + $items = []; foreach (range(1, 31) as $day) { $date = sprintf('%02d', $day); - $prevMonth = "{$prev['year']}-{$prev['month']}"; - $currMonth = "{$year}-{$month}"; $items[] = [ 'date' => $date, $currMonth => $currSales[$date] ?? 0, @@ -67,12 +68,13 @@ class Stat extends Service $currRefunds = $this->handleRefunds($year, $month); $prevRefunds = $this->handleRefunds($prev['year'], $prev['month']); + $currMonth = sprintf('%02d-%02d', $year, $month); + $prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']); + $items = []; foreach (range(1, 31) as $day) { $date = sprintf('%02d', $day); - $prevMonth = "{$prev['year']}-{$prev['month']}"; - $currMonth = "{$year}-{$month}"; $items[] = [ 'date' => $date, $currMonth => $currRefunds[$date] ?? 0, @@ -92,12 +94,13 @@ class Stat extends Service $currUsers = $this->handleRegisteredUsers($year, $month); $prevUsers = $this->handleRegisteredUsers($prev['year'], $prev['month']); + $currMonth = sprintf('%02d-%02d', $year, $month); + $prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']); + $items = []; foreach (range(1, 31) as $day) { $date = sprintf('%02d', $day); - $prevMonth = "{$prev['year']}-{$prev['month']}"; - $currMonth = "{$year}-{$month}"; $items[] = [ 'date' => $date, $currMonth => $currUsers[$date] ?? 0, @@ -117,12 +120,13 @@ class Stat extends Service $currUsers = $this->handleOnlineUsers($year, $month); $prevUsers = $this->handleOnlineUsers($prev['year'], $prev['month']); + $currMonth = sprintf('%02d-%02d', $year, $month); + $prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']); + $items = []; foreach (range(1, 31) as $day) { $date = sprintf('%02d', $day); - $prevMonth = "{$prev['year']}-{$prev['month']}"; - $currMonth = "{$year}-{$month}"; $items[] = [ 'date' => $date, $currMonth => $currUsers[$date] ?? 0, @@ -154,7 +158,10 @@ class Stat extends Service protected function isCurrMonth($year, $month) { - return date('Y-m') == "{$year}-{$month}"; + $yearOk = date('Y') == $year; + $monthOk = date('m') == $month; + + return $yearOk && $monthOk; } protected function getLifetime() diff --git a/app/Http/Admin/Views/audit/list.volt b/app/Http/Admin/Views/audit/list.volt index b40d81be..1e4029f4 100644 --- a/app/Http/Admin/Views/audit/list.volt +++ b/app/Http/Admin/Views/audit/list.volt @@ -34,8 +34,8 @@ 用户IP 请求路由 请求路径 - 请求时间 - 请求内容 + 创建时间 + 操作 @@ -91,4 +91,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Http/Admin/Views/audit/search.volt b/app/Http/Admin/Views/audit/search.volt index 7a8ce8c4..10289cdf 100644 --- a/app/Http/Admin/Views/audit/search.volt +++ b/app/Http/Admin/Views/audit/search.volt @@ -13,9 +13,9 @@
- +
- +
@@ -31,7 +31,7 @@
- +
@@ -70,4 +70,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Listeners/Trade.php b/app/Listeners/Trade.php index f49f8ae0..aeae2cdb 100644 --- a/app/Listeners/Trade.php +++ b/app/Listeners/Trade.php @@ -44,12 +44,7 @@ class Trade extends Listener $task = new TaskModel(); - $itemInfo = [ - 'order' => ['id' => $order->id] - ]; - $task->item_id = $order->id; - $task->item_info = $itemInfo; $task->item_type = TaskModel::TYPE_DELIVER; $task->create(); @@ -69,4 +64,4 @@ class Trade extends Listener } } -} \ No newline at end of file +} diff --git a/app/Services/Logic/Point/GiftRedeem.php b/app/Services/Logic/Point/GiftRedeem.php index ff3e257c..79372aff 100644 --- a/app/Services/Logic/Point/GiftRedeem.php +++ b/app/Services/Logic/Point/GiftRedeem.php @@ -84,18 +84,8 @@ class GiftRedeem extends LogicService $task = new TaskModel(); - $itemInfo = [ - 'point_gift_redeem' => [ - 'id' => $redeem->id, - 'user_id' => $redeem->user_id, - 'gift_id' => $redeem->gift_id, - ] - ]; - $task->item_id = $redeem->id; $task->item_type = TaskModel::TYPE_POINT_GIFT_DELIVER; - $task->item_info = $itemInfo; - $result = $task->create(); if ($result === false) { diff --git a/app/Validators/Chapter.php b/app/Validators/Chapter.php index 03510a42..80dbad80 100644 --- a/app/Validators/Chapter.php +++ b/app/Validators/Chapter.php @@ -183,7 +183,7 @@ class Chapter extends Validator public function checkPublishStatus($status) { if (!in_array($status, [0, 1])) { - throw new BadRequestException('course.invalid_publish_status'); + throw new BadRequestException('chapter.invalid_publish_status'); } return $status; diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index 15a0a743..1d13844f 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -78,9 +78,33 @@ height: 100px; } +.img-viewer { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); + z-index: 1000; +} + +.img-viewer img { + position: absolute; + top: 50%; + left: 50%; + max-width: 90%; + max-height: 90%; + background-color: white; + transform: translate(-50%, -50%); + transition: transform 0.3s ease-in-out; + padding: 5px; + cursor: zoom-out; +} + .kg-zoom img { max-width: 100%; - cursor: pointer; + cursor: zoom-in; } .breadcrumb { @@ -2245,4 +2269,4 @@ .gift-details { min-height: 450px; -} \ No newline at end of file +} diff --git a/public/static/home/css/content.css b/public/static/home/css/content.css index 481996b0..ea344416 100644 --- a/public/static/home/css/content.css +++ b/public/static/home/css/content.css @@ -12,7 +12,6 @@ .ke-content img { max-width: 100%; - cursor: pointer; } .ke-content a:hover { @@ -244,4 +243,4 @@ .ke-content pre:hover > span.kg-copy { display: block; -} \ No newline at end of file +} diff --git a/public/static/home/js/common.js b/public/static/home/js/common.js index 6083f45c..6c3452c5 100644 --- a/public/static/home/js/common.js +++ b/public/static/home/js/common.js @@ -129,20 +129,15 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { * 内容图片放大 */ $('body').on('click', '.kg-zoom img', function () { - var width = $(window).width() * 0.8 + 'px'; - var height = $(window).height() * 0.8 + 'px'; - var src = $(this).attr('src'); - var style = 'max-width:' + width + ';max-height:' + height; - var content = 'preview'; - layer.open({ - type: 1, - title: false, - closeBtn: 0, - area: ['auto'], - skin: 'layui-layer-nobg', - shadeClose: true, - content: content, - }); + var src = $(this).attr('src').replace('!content_800', ''); + if ($('#img-viewer').length === 0) { + $('body').append('
'); + } + $('#img-viewer').append('preview').fadeIn(); + }); + + $('body').on('click', '#img-viewer', function () { + $(this).empty().fadeOut(); }); /** @@ -195,4 +190,4 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { }); }); -}); \ No newline at end of file +});