-
- {notempty name="focus_images"}
-
-
- {volist name="focus_images" id="focus"}
-
-

-
- {/volist}
-
-
-
-
-
-
-
- {/notempty}
-
- {notempty name="product_categorys"}
-
- {volist name="product_categorys" id="cate"}
-
-
- {$cate.title}
-
- {/volist}
-
- {/notempty}
-
- {notempty name="featured_topics"}
-
- {/notempty}
-
- {notempty name="featured_products"}
-
-
{:lang_i18n('明星产品/热点产品')}
-
-
- {volist name="featured_products" id="product"}
-
- {/volist}
-
-
-
-
-
-
-

-

-
-
-
-
- {/notempty}
-
- {notempty name="video"}
-
-
-
+
+
+ {notempty name="focus_images"}
+
+
+ {volist name="focus_images" id="focus"}
+
+

+
+ {/volist}
+
+
+
+
+
+
+
+ {/notempty}
+
+ {notempty name="product_categorys"}
+
+ {volist name="product_categorys" id="cate"}
+
+
+ {$cate.title}
+
+ {/volist}
+
+ {/notempty}
+
+ {notempty name="featured_topics"}
+
+ {/notempty}
+
+ {notempty name="featured_products"}
+
+
{:lang_i18n('明星产品/热点产品')}
+
+
+ {volist name="featured_products" id="product"}
+
+ {/volist}
+
+
+
+
+
+
+

+

+
+
+
+
+ {/notempty}
+
+ {notempty name="video"}
+
+
+
- {/notempty}
-
- {notempty name="scenes"}
-
- {volist name="scenes" id="scene"}
-
- {/volist}
-
- {/notempty}
-
-
-
{:lang_i18n('ORICO 技术')}
-
{:lang_i18n('强大功能、简单使用')}
-
-
-

-
-
-

-
-
-
-
-
-
- {notempty name="brand_story"}
-
-
-
- {volist name="brand_story" id="story"}
-
-
-

-
-
-
- {/volist}
-
-
-
-
-
- {volist name="brand_story" id="story" key="k"}
- {$story.year}
- {/volist}
-
-
-

-

-
-
-
-
- {/notempty}
-
- {notempty name="data_statistics"}
-
-
- {volist name="data_statistics" id="ods"}
-
-
{$ods.desc|raw}
- {$ods.title}
-
- {/volist}
-
-
- {/notempty}
-
- {notempty name="recommend_articles"}
-
-
-
- {volist name="recommend_articles" id="article"}
-
- {/volist}
-
-
-
-

-

-
-
-
-
- {/notempty}
-
- {notempty name="recommend_faq"}
-
-
-
{:lang_i18n('常见问题')}
-
{:lang_i18n('回答您最关心的问题')}
-
{:lang_i18n('客服团队的工作时间:周一到周五,早9点到晚6点 平均应答时间:24小时内')}
-
-
-
- {volist name="recommend_faq" id="faq"}
- -
-
-
{$faq.question}
- +
-
-
-
- {/volist}
-
-
-
- {/notempty}
-
- {eq name="Request.cookie.think_lang" value="en-us"}
-
-
We use cookies to ensure you get the best experience on our website. By
- continuing to browse, you agree to our use of cookies.
-
-
×
-
- {/eq}
-
+ {/notempty}
+
+ {notempty name="scenes"}
+
+ {volist name="scenes" id="scene"}
+
+ {/volist}
+
+ {/notempty}
+
+
+
{:lang_i18n('ORICO 技术')}
+
{:lang_i18n('强大功能、简单使用')}
+
+
+

+
+
+

+
+
+
+
+
+
+ {notempty name="brand_story"}
+
+
+
+ {volist name="brand_story" id="story"}
+
+
+

+
+
+
+ {/volist}
+
+
+
+
+
+ {volist name="brand_story" id="story" key="k"}
+ {$story.year}
+ {/volist}
+
+
+

+

+
+
+
+
+ {/notempty}
+
+ {notempty name="data_statistics"}
+
+
+ {volist name="data_statistics" id="ods"}
+
+
{$ods.desc|raw}
+ {$ods.title}
+
+ {/volist}
+
+
+ {/notempty}
+
+ {notempty name="recommend_articles"}
+
+
+
+ {volist name="recommend_articles" id="article"}
+
+ {/volist}
+
+
+
+

+

+
+
+
+
+ {/notempty}
+
+ {notempty name="recommend_faq"}
+
+
+
{:lang_i18n('常见问题')}
+
{:lang_i18n('回答您最关心的问题')}
+
{:lang_i18n('客服团队的工作时间:周一到周五,早9点到晚6点 平均应答时间:24小时内')}
+
+
+
+ {volist name="recommend_faq" id="faq"}
+ -
+
+
{$faq.question}
+ +
+
+
+
+ {/volist}
+
+
+
+ {/notempty}
+
+ {eq name="Request.cookie.think_lang" value="en-us"}
+
+
We use cookies to ensure you get the best experience on our website. By
+ continuing to browse, you agree to our use of cookies.
+
+
×
+
+ {/eq}
+
{/block}
{block name="script"}
{/block}
\ No newline at end of file
From a8f7758f466d8c956c6e930f16b0d81ab58fd41a Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 10 Jun 2025 10:08:08 +0800
Subject: [PATCH 03/17] =?UTF-8?q?fix:=20=E9=A1=B6=E9=83=A8=E2=80=9C?=
=?UTF-8?q?=E5=BA=97=E9=93=BA=E2=80=9D=E6=8C=89=E9=92=AE=E4=B8=8D=E8=83=BD?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=9C=A8=E4=B8=AD=E6=96=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/view/pc/public/header.html | 392 ++++++++++++++-------------
1 file changed, 197 insertions(+), 195 deletions(-)
diff --git a/app/index/view/pc/public/header.html b/app/index/view/pc/public/header.html
index 92979be6..35110ba2 100644
--- a/app/index/view/pc/public/header.html
+++ b/app/index/view/pc/public/header.html
@@ -1,203 +1,205 @@
\ No newline at end of file
From e9274689653c5ad71337459d4ab119b9080824b9 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 10 Jun 2025 14:09:01 +0800
Subject: [PATCH 04/17] =?UTF-8?q?refactor:=20=E6=B7=BB=E5=8A=A0=E5=85=B6?=
=?UTF-8?q?=E4=BB=96=E5=86=85=E9=A1=B5=E7=B3=BB=E7=BB=9Furls?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/System.php | 118 +++++++++++++++++-
.../validate/v1/NavigationItemValidate.php | 4 +-
.../validate/v1/SysBannerItemValidate.php | 4 +-
3 files changed, 121 insertions(+), 5 deletions(-)
diff --git a/app/admin/controller/v1/System.php b/app/admin/controller/v1/System.php
index d53350ce..85e461ec 100644
--- a/app/admin/controller/v1/System.php
+++ b/app/admin/controller/v1/System.php
@@ -8,7 +8,6 @@ use app\admin\model\v1\ArticleModel;
use app\admin\model\v1\ProductCategoryModel;
use app\admin\model\v1\ProductModel;
use think\facade\Db;
-use think\facade\Route;
class System
{
@@ -155,6 +154,123 @@ class System
'name' => '产品',
'link_to' => 'product',
'data' => array_to_tree($product_category, 0, 'pid', false, false)
+ ],
+ [
+ 'name' => '其他内页',
+ 'link_to' => 'system_page',
+ 'data' => [
+ [
+ 'id' => 1,
+ 'name' => '首页',
+ 'url' => (string)url('/index/index/index')
+ ],
+ [
+ 'id' => 2,
+ 'name' => '新品上市',
+ 'url' => (string)url('/index/product/newpro')
+ ],
+ [
+ 'id' => 3,
+ 'name' => '附件下载',
+ 'url' => (string)url('/index/attachment/index')
+ ],
+ [
+ 'id' => 4,
+ 'name' => '问答中心',
+ 'url' => (string)url('/index/faq/index')
+ ],
+ [
+ 'id' => 5,
+ 'name' => '关于我们',
+ 'url' => '',
+ 'children' => [
+ [
+ 'id' => 51,
+ 'name' => '品牌介绍',
+ 'url' => (string)url('/index/aboutus/introduction')
+ ],
+ [
+ 'id' => 52,
+ 'name' => '品牌故事',
+ 'url' => (string)url('/index/aboutus/story')
+ ],
+ [
+ 'id' => 53,
+ 'name' => '品牌历程',
+ 'url' => (string)url('/index/aboutus/mileage')
+ ],
+ [
+ 'id' => 54,
+ 'name' => '文化介绍',
+ 'url' => (string)url('/index/aboutus/culture')
+ ],
+ [
+ 'id' => 55,
+ 'name' => '售后政策',
+ 'url' => (string)url('/index/aboutus/policy')
+ ]
+ ]
+ ],
+ [
+ 'id' => 6,
+ 'name' => '联系我们',
+ 'url' => '',
+ 'children' => [
+ [
+ 'id' => 61,
+ 'name' => '联系我们',
+ 'url' => (string)url('/index/contactus/index')
+ ],
+ [
+ 'id' => 62,
+ 'name' => '留言联系我们',
+ 'url' => (string)url('/index/contactus/message')
+ ],
+ [
+ 'id' => 63,
+ 'name' => '留言成为分销商',
+ 'url' => (string)url('/index/contactus/distributor')
+ ],
+ [
+ 'id' => 64,
+ 'name' => '留言批量购买',
+ 'url' => (string)url('/index/contactus/bulkbuy')
+ ]
+ ]
+ ],
+ [
+ 'id' => 7,
+ 'name' => 'NAS专题',
+ 'url' => '',
+ 'children' => [
+ [
+ 'id' => 71,
+ 'name' => '首页',
+ 'url' => (string)url('/index/topic/nas/index')
+ ],
+ [
+ 'id' => 72,
+ 'name' => '产品体验',
+ 'url' => (string)url('/index/topic/nas/product')
+ ],
+ [
+ 'id' => 73,
+ 'name' => '客户合作',
+ 'url' => (string)url('/index/topic/nas/cooperation')
+ ],
+ [
+ 'id' => 74,
+ 'name' => '帮助中心',
+ 'url' => (string)url('/index/topic/nas/help')
+ ],
+ [
+ 'id' => 75,
+ 'name' => '软件下载',
+ 'url' => (string)url('/index/topic/nas/download')
+ ]
+ ]
+ ]
+ ],
]
];
diff --git a/app/admin/validate/v1/NavigationItemValidate.php b/app/admin/validate/v1/NavigationItemValidate.php
index 94deb29b..70bdae9c 100644
--- a/app/admin/validate/v1/NavigationItemValidate.php
+++ b/app/admin/validate/v1/NavigationItemValidate.php
@@ -21,7 +21,7 @@ class NavigationItemValidate extends Validate
'pid' => 'integer|different:id|checkPidNotBeChildren',
'name' => 'require|max:64',
'icon' => 'max:64',
- 'link_to' => 'require|max:64|in:article,article_category,product,product_category,custom',
+ 'link_to' => 'require|max:64|in:article,article_category,product,product_category,system_page,custom',
'link' => 'max:255',
'sort' => 'integer',
'blank' => 'in:0,1',
@@ -47,7 +47,7 @@ class NavigationItemValidate extends Validate
'icon.max' => '图标最多不能超过64个字符',
'link_to.require' => '链接类型不能为空',
'link_to.max' => '链接类型最多不能超过64个字符',
- 'link_to.in' => '链接类型必须是article,goods_category,goods,custom中之一',
+ 'link_to.in' => '链接类型必须是article,article_category,product_category,product,system_page,custom中之一',
'link.max' => '链接最多不能超过255个字符',
'sort.integer' => '排序必须为整数',
'blank.in' => '是否新窗口打开只能是0或1',
diff --git a/app/admin/validate/v1/SysBannerItemValidate.php b/app/admin/validate/v1/SysBannerItemValidate.php
index d02b30e7..39b8d285 100644
--- a/app/admin/validate/v1/SysBannerItemValidate.php
+++ b/app/admin/validate/v1/SysBannerItemValidate.php
@@ -23,7 +23,7 @@ class SysBannerItemValidate extends Validate
'type' => 'in:image,video',
'image' => 'max:255',
'video' => 'max:255',
- 'link_to' => 'requireIf:type,image|max:64|in:article,article_category,product,product_category,custom',
+ 'link_to' => 'requireIf:type,image|max:64|in:article,article_category,product,product_category,system_page,custom',
'link' => 'max:255',
'sort' => 'integer',
'status' => 'in:-1,1'
@@ -50,7 +50,7 @@ class SysBannerItemValidate extends Validate
'video.max' => '视频地址最多不能超过255个字符',
'link_to.requireIf' => '链接类型不能为空',
'link_to.max' => '链接类型最多不能超过64个字符',
- 'link_to.in' => '链接类型必须是article,article_category,product,product_category,custom中之一',
+ 'link_to.in' => '链接类型必须是article,article_category,product,product_category,system_page,custom中之一',
'link.max' => '链接最多不能超过255个字符',
'sort.integer' => '排序值必须是整数',
'status.in' => '状态必须是-1或1'
From 648fde842cedae04e05cbba479413cc134f39e20 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 10 Jun 2025 14:33:37 +0800
Subject: [PATCH 05/17] =?UTF-8?q?refactor:=20=E5=90=8E=E5=8F=B0=E8=A7=86?=
=?UTF-8?q?=E9=A2=91=E5=88=97=E8=A1=A8/=E5=9B=9E=E6=94=B6=E7=AB=99?=
=?UTF-8?q?=E8=BE=93=E5=87=BA=E7=BC=A9=E7=95=A5=E5=9B=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Video.php | 3 ++-
app/admin/controller/v1/VideoTrash.php | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/admin/controller/v1/Video.php b/app/admin/controller/v1/Video.php
index 70296b40..6ec0586b 100644
--- a/app/admin/controller/v1/Video.php
+++ b/app/admin/controller/v1/Video.php
@@ -50,7 +50,8 @@ class Video
'page' => $params['page'],
])
->bindAttr('category', ['category_name'])
- ->hidden(['category', 'category_id']);
+ ->hidden(['category', 'category_id'])
+ ?->each(fn($item) => $item->image = thumb($item->image));
return success('获取成功', $videos);
}
diff --git a/app/admin/controller/v1/VideoTrash.php b/app/admin/controller/v1/VideoTrash.php
index 48b6c833..3d811dec 100644
--- a/app/admin/controller/v1/VideoTrash.php
+++ b/app/admin/controller/v1/VideoTrash.php
@@ -47,7 +47,8 @@ class VideoTrash
'page' => $params['page'],
])
->bindAttr('category', ['category_name'])
- ->hidden(['category_id', 'category']);
+ ->hidden(['category_id', 'category'])
+ ?->each(fn($item) => $item->image = thumb($item->image));
return success('获取成功', $videos);
}
From 5c84e7e390c69f817c6f185cfb9a2a35b6cc88db Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 10 Jun 2025 14:46:11 +0800
Subject: [PATCH 06/17] =?UTF-8?q?refactor:=20=E7=B3=BB=E7=BB=9F=E5=85=B6?=
=?UTF-8?q?=E4=BB=96urls=E5=9B=9E=E6=98=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/System.php | 262 ++++++++++++++++-------------
1 file changed, 147 insertions(+), 115 deletions(-)
diff --git a/app/admin/controller/v1/System.php b/app/admin/controller/v1/System.php
index 85e461ec..69c0e4ad 100644
--- a/app/admin/controller/v1/System.php
+++ b/app/admin/controller/v1/System.php
@@ -158,119 +158,7 @@ class System
[
'name' => '其他内页',
'link_to' => 'system_page',
- 'data' => [
- [
- 'id' => 1,
- 'name' => '首页',
- 'url' => (string)url('/index/index/index')
- ],
- [
- 'id' => 2,
- 'name' => '新品上市',
- 'url' => (string)url('/index/product/newpro')
- ],
- [
- 'id' => 3,
- 'name' => '附件下载',
- 'url' => (string)url('/index/attachment/index')
- ],
- [
- 'id' => 4,
- 'name' => '问答中心',
- 'url' => (string)url('/index/faq/index')
- ],
- [
- 'id' => 5,
- 'name' => '关于我们',
- 'url' => '',
- 'children' => [
- [
- 'id' => 51,
- 'name' => '品牌介绍',
- 'url' => (string)url('/index/aboutus/introduction')
- ],
- [
- 'id' => 52,
- 'name' => '品牌故事',
- 'url' => (string)url('/index/aboutus/story')
- ],
- [
- 'id' => 53,
- 'name' => '品牌历程',
- 'url' => (string)url('/index/aboutus/mileage')
- ],
- [
- 'id' => 54,
- 'name' => '文化介绍',
- 'url' => (string)url('/index/aboutus/culture')
- ],
- [
- 'id' => 55,
- 'name' => '售后政策',
- 'url' => (string)url('/index/aboutus/policy')
- ]
- ]
- ],
- [
- 'id' => 6,
- 'name' => '联系我们',
- 'url' => '',
- 'children' => [
- [
- 'id' => 61,
- 'name' => '联系我们',
- 'url' => (string)url('/index/contactus/index')
- ],
- [
- 'id' => 62,
- 'name' => '留言联系我们',
- 'url' => (string)url('/index/contactus/message')
- ],
- [
- 'id' => 63,
- 'name' => '留言成为分销商',
- 'url' => (string)url('/index/contactus/distributor')
- ],
- [
- 'id' => 64,
- 'name' => '留言批量购买',
- 'url' => (string)url('/index/contactus/bulkbuy')
- ]
- ]
- ],
- [
- 'id' => 7,
- 'name' => 'NAS专题',
- 'url' => '',
- 'children' => [
- [
- 'id' => 71,
- 'name' => '首页',
- 'url' => (string)url('/index/topic/nas/index')
- ],
- [
- 'id' => 72,
- 'name' => '产品体验',
- 'url' => (string)url('/index/topic/nas/product')
- ],
- [
- 'id' => 73,
- 'name' => '客户合作',
- 'url' => (string)url('/index/topic/nas/cooperation')
- ],
- [
- 'id' => 74,
- 'name' => '帮助中心',
- 'url' => (string)url('/index/topic/nas/help')
- ],
- [
- 'id' => 75,
- 'name' => '软件下载',
- 'url' => (string)url('/index/topic/nas/download')
- ]
- ]
- ]
- ],
+ 'data' => self::getSystemOtherPages()
]
];
@@ -336,6 +224,124 @@ class System
return $data->toArray();
}
+ // 获取系统其他内页
+ static private function getSystemOtherPages()
+ {
+ return [
+ [
+ 'id' => 1,
+ 'name' => '首页',
+ 'url' => (string)url('/index/index/index')
+ ],
+ [
+ 'id' => 2,
+ 'name' => '新品上市',
+ 'url' => (string)url('/index/product/newpro')
+ ],
+ [
+ 'id' => 3,
+ 'name' => '附件下载',
+ 'url' => (string)url('/index/attachment/index')
+ ],
+ [
+ 'id' => 4,
+ 'name' => '问答中心',
+ 'url' => (string)url('/index/faq/index')
+ ],
+ [
+ 'id' => 5,
+ 'name' => '关于我们',
+ 'url' => '',
+ 'children' => [
+ [
+ 'id' => 51,
+ 'name' => '品牌介绍',
+ 'url' => (string)url('/index/aboutus/introduction')
+ ],
+ [
+ 'id' => 52,
+ 'name' => '品牌故事',
+ 'url' => (string)url('/index/aboutus/story')
+ ],
+ [
+ 'id' => 53,
+ 'name' => '品牌历程',
+ 'url' => (string)url('/index/aboutus/mileage')
+ ],
+ [
+ 'id' => 54,
+ 'name' => '文化介绍',
+ 'url' => (string)url('/index/aboutus/culture')
+ ],
+ [
+ 'id' => 55,
+ 'name' => '售后政策',
+ 'url' => (string)url('/index/aboutus/policy')
+ ]
+ ]
+ ],
+ [
+ 'id' => 6,
+ 'name' => '联系我们',
+ 'url' => '',
+ 'children' => [
+ [
+ 'id' => 61,
+ 'name' => '联系我们',
+ 'url' => (string)url('/index/contactus/index')
+ ],
+ [
+ 'id' => 62,
+ 'name' => '留言联系我们',
+ 'url' => (string)url('/index/contactus/message')
+ ],
+ [
+ 'id' => 63,
+ 'name' => '留言成为分销商',
+ 'url' => (string)url('/index/contactus/distributor')
+ ],
+ [
+ 'id' => 64,
+ 'name' => '留言批量购买',
+ 'url' => (string)url('/index/contactus/bulkbuy')
+ ]
+ ]
+ ],
+ [
+ 'id' => 7,
+ 'name' => 'NAS专题',
+ 'url' => '',
+ 'children' => [
+ [
+ 'id' => 71,
+ 'name' => '首页',
+ 'url' => (string)url('/index/topic/nas/index')
+ ],
+ [
+ 'id' => 72,
+ 'name' => '产品体验',
+ 'url' => (string)url('/index/topic/nas/product')
+ ],
+ [
+ 'id' => 73,
+ 'name' => '客户合作',
+ 'url' => (string)url('/index/topic/nas/cooperation')
+ ],
+ [
+ 'id' => 74,
+ 'name' => '帮助中心',
+ 'url' => (string)url('/index/topic/nas/help')
+ ],
+ [
+ 'id' => 75,
+ 'name' => '软件下载',
+ 'url' => (string)url('/index/topic/nas/download')
+ ]
+ ]
+ ]
+ ];
+ }
+
// 根据系统页面url获取回显数据项
static public function getEchoDataBySystemPageUrl($link_to, $link)
{
@@ -351,21 +357,29 @@ class System
parse_str($url, $params);
}
- if (empty($params['id'])) return [];
-
switch ($link_to) {
case 'article_category':
+ if (empty($params['id'])) return [];
$data = ArticleCategoryModel::field(['id', 'name'])->bypk($params['id'])->find();
break;
case 'article':
+ if (empty($params['id'])) return [];
$data = ArticleModel::field(['id', 'title' => 'name'])->bypk($params['id'])->find();
break;
case 'product_category':
+ if (empty($params['id'])) return [];
$data = ProductCategoryModel::field(['id', 'name'])->bypk($params['id'])->find();
break;
case 'product':
+ if (empty($params['id'])) return [];
$data = ProductModel::field(['id', 'name'])->bypk($params['id'])->find();
break;
+ case 'system_page':
+ $data = self::filterSystemOtherPage(self::getSystemOtherPages(), function($item) use ($params, $link) {
+ if (empty($params['id'])) return $item['url'] == $link;
+ return $item['id'] == $params['id'];
+ });
+ break;
default:
return [];
break;
@@ -378,4 +392,22 @@ class System
'link' => $link
];
}
+
+ // 根据条件过滤结果
+ static private function filterSystemOtherPage(array $data, callable $callback): array
+ {
+ foreach ($data as $it) {
+ if ($callback($it)) {
+ return $it;
+ }
+ if (isset($it['children'])) {
+ $child = self::filterSystemOtherPage($it['children'], $callback);
+ if (!empty($child)) {
+ return $child;
+ }
+ }
+ }
+
+ return [];
+ }
}
\ No newline at end of file
From b2699a952e2edd862fb3318a7fe283ffa7de23c4 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 10:55:55 +0800
Subject: [PATCH 07/17] =?UTF-8?q?fix:=20pc=E9=99=84=E4=BB=B6=E6=90=9C?=
=?UTF-8?q?=E7=B4=A2placeholder?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/lang/en-us/pc.php | 2 +-
app/index/view/pc/attachment/index.html | 2 +-
app/index/view/pc/attachment/video.html | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/index/lang/en-us/pc.php b/app/index/lang/en-us/pc.php
index 80e2ee36..a81d3d8f 100644
--- a/app/index/lang/en-us/pc.php
+++ b/app/index/lang/en-us/pc.php
@@ -51,7 +51,7 @@ return [
'视频' => 'Videos',
'支持型号' => 'Supported Models',
'支持系统' => 'Supported Systems',
- '搜索型号' => 'Search model',
+ '搜索名称' => 'Search model',
'查询无结果!' => 'No Result!',
],
diff --git a/app/index/view/pc/attachment/index.html b/app/index/view/pc/attachment/index.html
index 4c97b647..e42efec5 100644
--- a/app/index/view/pc/attachment/index.html
+++ b/app/index/view/pc/attachment/index.html
@@ -15,7 +15,7 @@
diff --git a/app/index/view/pc/attachment/video.html b/app/index/view/pc/attachment/video.html
index 36b62a2a..f380faca 100644
--- a/app/index/view/pc/attachment/video.html
+++ b/app/index/view/pc/attachment/video.html
@@ -14,7 +14,7 @@
From 51d31a1a6d9b1b3c9873cd8e72ddd394004613eb Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 11:03:00 +0800
Subject: [PATCH 08/17] =?UTF-8?q?fix:=20=E5=90=8E=E5=8F=B0=E4=BA=A7?=
=?UTF-8?q?=E5=93=81=E5=88=86=E7=B1=BB=E7=B3=BB=E7=BB=9Furls?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/System.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/admin/controller/v1/System.php b/app/admin/controller/v1/System.php
index 69c0e4ad..bd8c2ef2 100644
--- a/app/admin/controller/v1/System.php
+++ b/app/admin/controller/v1/System.php
@@ -146,7 +146,11 @@ class System
'name' => '产品分类',
'link_to' => 'product_category',
'data' => array_to_tree(array_map(function($item) {
- $item['url'] = (string)url('/index/product/category/' . $item['id']);
+ if ($item['pid'] == 0) {
+ $item['url'] = (string)url('/index/product/category/'. $item['id']);
+ } else {
+ $item['url'] = (string)url('/index/product/subcategory/' . $item['id']);
+ }
return $item;
}, $product_category), 0, 'pid', false, false)
],
From a823cfaf915a7696a25083d085d1c6dafff2d792 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 11:38:25 +0800
Subject: [PATCH 09/17] =?UTF-8?q?fix:=20nas=E5=B8=AE=E5=8A=A9=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/controller/TopicNas.php | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/app/index/controller/TopicNas.php b/app/index/controller/TopicNas.php
index 0ba369eb..70e15097 100644
--- a/app/index/controller/TopicNas.php
+++ b/app/index/controller/TopicNas.php
@@ -269,6 +269,25 @@ class TopicNas extends Common
{
$keywords = request()->post('keywords');
// 根据关键词查询文章
+ $parent = ArticleCategoryModel::uniqueLabel('CATEGORY_681182e0a4529')
+ ->language($this->lang_id)
+ ->value('id');
+
+ // 获取帮且中心分类子分类
+ $table_name = (new ArticleCategoryModel)->getTable();
+ $categorys = \think\facade\Db::query(preg_replace(
+ '/\s+/u',
+ ' ',
+ "WITH RECURSIVE article_tree_by AS (
+ SELECT a.id, a.pid FROM $table_name a WHERE a.id = {$parent}
+ UNION ALL
+ SELECT k.id, k.pid FROM $table_name k INNER JOIN article_tree_by t ON t.id = k.pid
+ )
+ SELECT id FROM article_tree_by WHERE id <> {$parent}"
+ ));
+ if (empty($categorys)) return success('success', []);
+
+ // 获取文章数据
$articles = ArticleModel::field([
'id',
'title'
@@ -277,6 +296,7 @@ class TopicNas extends Common
'title' => $keywords??null
])
->language($this->lang_id)
+ ->where('category_id', 'IN', array_column($categorys, 'id'))
->select();
return success('success', $articles->toArray());
From 00f3cda6acd5023990472ab9445c7d081939dd62 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 14:46:40 +0800
Subject: [PATCH 10/17] =?UTF-8?q?feat:=20=E5=9B=BE=E7=89=87=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=E6=B0=B4=E5=8D=B0=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/SiteConfig.php | 38 +++++++
app/admin/controller/v1/Upload.php | 143 ++++++++++++++++++++++++-
2 files changed, 179 insertions(+), 2 deletions(-)
diff --git a/app/admin/controller/v1/SiteConfig.php b/app/admin/controller/v1/SiteConfig.php
index c1ca70e2..165bc36f 100644
--- a/app/admin/controller/v1/SiteConfig.php
+++ b/app/admin/controller/v1/SiteConfig.php
@@ -141,6 +141,44 @@ class SiteConfig
return $ret;
}
+ // 根据分组获取配置
+ public function getByGroupUniqueLabel($unique_label)
+ {
+ $configs = SysConfigModel::alias('c')
+ ->field([
+ 'c.id',
+ 'c.title',
+ 'c.name',
+ 'c.value',
+ ])
+ ->join(SysConfigGroupModel::getTable(). ' g', 'g.id = c.group_id')
+ ->where('g.language_id', '=', request()->lang_id)
+ ->where('g.unique_label', '=', $unique_label)
+ ->where('g.status', '=', 1)
+ ->order(['c.sort' => 'asc', 'c.id' => 'desc'])
+ ->select()
+ ->each(function ($item) {
+ // 修改字段为null的输出为空字符串
+ $keys = array_keys($item->toArray());
+ foreach ($keys as $key) {
+ if (is_null($item[$key])) {
+ $item[$key] = '';
+ }
+ }
+ return $item;
+ })
+ ->toArray();
+ if (!empty($configs)) {
+ $configs_map = [];
+ foreach ($configs as $cfg) {
+ $configs_map[$cfg['name']] = $cfg;
+ }
+ return $configs_map;
+ }
+
+ return [];
+ }
+
// 更新配置
public function update()
{
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index e9d58ec8..24a077e2 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -7,6 +7,7 @@ use app\admin\model\v1\SysImageUploadRecordModel;
use app\admin\model\v1\SysVideoUploadRecordModel;
use app\admin\model\v1\SysAttachmentUploadRecordModel;
use Intervention\Image\ImageManager;
+use Intervention\Image\Typography\FontFactory;
use think\facade\Filesystem;
/**
@@ -44,9 +45,68 @@ class Upload
$image_model = SysImageUploadRecordModel::md5($filemd5)->find();
if (is_null($image_model)) {
$filename = Filesystem::disk('image')->putFile($param['module'], $file);
- // 生成缩略图
- $image_manager = new ImageManager(new \Intervention\Image\Drivers\Imagick\Driver());
+ // 处理图片
+ $image_manager = ImageManager::imagick();
$image = $image_manager->read('.' . $storage . '/' . $filename);
+
+ // 水印
+ list($enabled, $type, $text_options, $image_options) = $this->getWatermarkOptions();
+ if ($enabled) {
+ // 图片水印
+ if ($type == 'IMAGE' && $image_options['image'] != '') {
+ // 读取水印图片
+ $watermark_image = $image_manager->read($image_options['image']);
+ // 缩放水印图片
+ $watermark_image->scale($image_options['width'], $image_options['height']);
+ // 绘制水印图片
+ $image->place(
+ $watermark_image,
+ $image_options['position'],
+ $image_options['offset_x'],
+ $image_options['offset_y'],
+ $image_options['opacity']
+ );
+ }
+ // 文字水印
+ else if ($type == 'TEXT' && $text_options['txt'] != '') {
+ // 原图宽度
+ $origin_width = $image->width();
+ // 原图高度
+ $origin_height = $image->height();
+
+ $font_factory = new FontFactory(function(FontFactory $font) use($text_options) {
+ // 设置字体
+ $font->filename($text_options['font']);
+ // 设置字体大小
+ $font->size($text_options['size']);
+ // 设置字体颜色及透明度
+ $opacity = dechex((int)ceil(255 * ($text_options['opacity'] / 100)));
+ $font->color($text_options['color'] . $opacity);
+ });
+ // 文字尺寸
+ $font_rect = $image->driver()->fontProcessor()->boxSize($text_options['txt'], $font_factory());
+ // 计算偏移量
+ list($offset_x, $offset_y) = $this->scaleTxtOffsetXYByPosition(
+ $text_options['position'],
+ $text_options['offset_x'],
+ $text_options['offset_y'],
+ $origin_width,
+ $origin_height,
+ $font_rect->width(),
+ $font_rect->height()
+ );
+ // 绘制文字
+ $image->text(
+ $text_options['txt'],
+ $offset_x,
+ $offset_y,
+ $font_factory()
+ );
+ }
+ $image->save('.'. $storage. '/'. $filename);
+ }
+
+ // 缩略图
$image->scale(200, 200);
$idx = strrpos($filename, '.');
$thumb_filename = mb_substr($filename, 0, $idx) . '_thumb.' . mb_substr($filename, $idx + 1);
@@ -79,6 +139,85 @@ class Upload
return error('上传失败');
}
+ /**
+ * 获取水印配置
+ *
+ * @return array
+ */
+ private function getWatermarkOptions(): array
+ {
+ $config_model = new \app\admin\controller\v1\SiteConfig;
+ $watermark_config = $config_model->getByGroupUniqueLabel('watermark');
+ return [
+ 'enalbed' => data_get($watermark_config, 'watermark_enabled.value', 0) == 1,
+ 'type' => data_get($watermark_config, 'watermark_type.value', ''),
+ 'text_options' => [
+ 'txt' => data_get($watermark_config, 'watermark_text_value.value', ''),
+ 'font' => data_get($watermark_config, 'watermark_font_family.value', ''),
+ 'size' => (float)data_get($watermark_config, 'watermark_text_size.value', 12),
+ 'color' => data_get($watermark_config, 'watermark_text_color.value', '#000000'),
+ 'position' => data_get($watermark_config, 'watermark_position.value', 'top-left'),
+ 'offset_x' => (int)data_get($watermark_config, 'watermark_offset_x.value', 0),
+ 'offset_y' => (int)data_get($watermark_config, 'watermark_offset_y.value', 0),
+ 'opacity' => (int)data_get($watermark_config, 'watermark_opacity.value', 100),
+ ],
+ 'image_options' => [
+ 'image' => data_get($watermark_config, 'watermark_image_value.value', ''),
+ 'width' => data_get($watermark_config, 'watermark_image_width.value', null),
+ 'height' => data_get($watermark_config, 'watermark_image_height.value', null),
+ 'position' => data_get($watermark_config, 'watermark_position.value', 'top-left'),
+ 'offset_x' => (int)data_get($watermark_config, 'watermark_offset_x.value', 0),
+ 'offset_y' => (int)data_get($watermark_config, 'watermark_offset_y.value', 0),
+ 'opacity' => (int)data_get($watermark_config, 'watermark_opacity.value', 100),
+ ],
+ ];
+ }
+ /**
+ * 计算文体水印偏移量
+ *
+ * @param string $position
+ * @param integer $offset_x
+ * @param integer $offset_y
+ * @param integer $image_width
+ * @param integer $image_height
+ * @param integer $txt_width
+ * @param integer $txt_height
+ * @return array
+ */
+ private function scaleTxtOffsetXYByPosition(string $position, int $offset_x, int $offset_y, int $image_width, int $image_height, int $txt_width, int $txt_height)
+ {
+ switch ($position) {
+ case 'top-left':
+ // top-left:左上角
+ return [$offset_x, $offset_y];
+ case 'top-right':
+ // top-right:右上角
+ return [(int)($image_width-$txt_width-$offset_x), $offset_y];
+ case 'top':
+ // top:上 - 水平居中
+ return [(int)(($image_width-$txt_width+$offset_x)/2), $offset_y];
+ case 'left':
+ // left:左 - 垂直居中
+ return [$offset_x, (int)(($image_height-$txt_height)/2+$offset_y)];
+ case 'center':
+ // center:水平垂直居中
+ return [(int)(($image_width-$txt_width)/2+$offset_x), (int)(($image_height-$txt_height)/2+$offset_y)];
+ case 'right':
+ // right:右 - 垂直居中
+ return [(int)($image_width-$txt_width-$offset_x), (int)(($image_height-$txt_height)/2+$offset_y)];
+ case'bottom':
+ // bottom:下 - 水平居中
+ return [(int)(($image_width-$txt_width+$offset_x)/2), (int)($image_height-$txt_height-$offset_y)];
+ case'bottom-left':
+ // bottom-left:左下角
+ return [$offset_x, (int)($image_height-$txt_height-$offset_y)];
+ case'bottom-right':
+ // bottom-right:右下角
+ return [(int)($image_width-$txt_width-$offset_x), (int)($image_height-$txt_height-$offset_y)];
+ default:
+ throw new \InvalidArgumentException('Invalid position');
+ }
+ }
/**
* 上传视频
From e746952c11aad508742d627ea5cb60899cbe9948 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 14:47:21 +0800
Subject: [PATCH 11/17] =?UTF-8?q?refactor:=20=E9=99=84=E4=BB=B6=E4=B8=8A?=
=?UTF-8?q?=E4=BC=A0=E5=85=81=E8=AE=B8=E4=B8=8A=E4=BC=A0ttf=E5=AD=97?=
=?UTF-8?q?=E4=BD=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Upload.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index 24a077e2..78c8aece 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -291,7 +291,7 @@ class Upload
try {
$max_size = strtobytes(env('ADMIN_API.MAX_ATTACHMENT_SIZE', '100mb'));
$validate = validate([
- 'attachment' => "fileSize:$max_size|fileExt:biz,bz,bz2,gz,tgz,zip,rar,7z,doc,docx,xls,xlsx,csv,ppt,pptx,pdf,txt,jpg,jpeg,png"
+ 'attachment' => "fileSize:$max_size|fileExt:biz,bz,bz2,gz,tgz,zip,rar,7z,doc,docx,xls,xlsx,csv,ppt,pptx,pdf,txt,jpg,jpeg,png,ttf"
]);
if (!$validate->check(['attachment' => $file])) {
return error($validate->getError());
From abef3a775053ba3db7264c06d613903752d32461 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 15:17:14 +0800
Subject: [PATCH 12/17] =?UTF-8?q?fix:=20pc=E6=88=90=E5=8A=9F=E7=BB=8F?=
=?UTF-8?q?=E9=94=80=E5=95=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/view/pc/contact_us/distributor.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/index/view/pc/contact_us/distributor.html b/app/index/view/pc/contact_us/distributor.html
index c6893a16..d735dab0 100644
--- a/app/index/view/pc/contact_us/distributor.html
+++ b/app/index/view/pc/contact_us/distributor.html
@@ -61,7 +61,7 @@
From 0c4c40ce7f123401027c2c2c5ae0a4598d3d1644 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 15:36:44 +0800
Subject: [PATCH 13/17] =?UTF-8?q?fix:=20=E6=B0=B4=E5=8D=B0=E5=A4=84?=
=?UTF-8?q?=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Upload.php | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index 78c8aece..dee2d3e4 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -42,7 +42,7 @@ class Upload
$filemd5 = $file->md5();
$filesha1 = $file->sha1();
- $image_model = SysImageUploadRecordModel::md5($filemd5)->find();
+ $image_model = null; // SysImageUploadRecordModel::md5($filemd5)->find();
if (is_null($image_model)) {
$filename = Filesystem::disk('image')->putFile($param['module'], $file);
// 处理图片
@@ -50,14 +50,19 @@ class Upload
$image = $image_manager->read('.' . $storage . '/' . $filename);
// 水印
- list($enabled, $type, $text_options, $image_options) = $this->getWatermarkOptions();
+ list(
+ 'enabled' => $enabled,
+ 'type' => $type,
+ 'text_options' => $text_options,
+ 'image_options' => $image_options
+ ) = $this->getWatermarkOptions();
if ($enabled) {
// 图片水印
if ($type == 'IMAGE' && $image_options['image'] != '') {
// 读取水印图片
- $watermark_image = $image_manager->read($image_options['image']);
+ $watermark_image = $image_manager->read(public_path() . $image_options['image']);
// 缩放水印图片
- $watermark_image->scale($image_options['width'], $image_options['height']);
+ $watermark_image->scale((int)$image_options['width'], (int)$image_options['height']);
// 绘制水印图片
$image->place(
$watermark_image,
@@ -76,12 +81,14 @@ class Upload
$font_factory = new FontFactory(function(FontFactory $font) use($text_options) {
// 设置字体
- $font->filename($text_options['font']);
+ $font->filename(public_path() . $text_options['font']);
// 设置字体大小
$font->size($text_options['size']);
// 设置字体颜色及透明度
$opacity = dechex((int)ceil(255 * ($text_options['opacity'] / 100)));
$font->color($text_options['color'] . $opacity);
+ $font->align('left');
+ $font->valign('top');
});
// 文字尺寸
$font_rect = $image->driver()->fontProcessor()->boxSize($text_options['txt'], $font_factory());
@@ -149,11 +156,11 @@ class Upload
$config_model = new \app\admin\controller\v1\SiteConfig;
$watermark_config = $config_model->getByGroupUniqueLabel('watermark');
return [
- 'enalbed' => data_get($watermark_config, 'watermark_enabled.value', 0) == 1,
+ 'enabled' => data_get($watermark_config, 'watermark_enabled.value', 0) == 1,
'type' => data_get($watermark_config, 'watermark_type.value', ''),
'text_options' => [
'txt' => data_get($watermark_config, 'watermark_text_value.value', ''),
- 'font' => data_get($watermark_config, 'watermark_font_family.value', ''),
+ 'font' => data_get($watermark_config, 'watermark_text_font.value', ''),
'size' => (float)data_get($watermark_config, 'watermark_text_size.value', 12),
'color' => data_get($watermark_config, 'watermark_text_color.value', '#000000'),
'position' => data_get($watermark_config, 'watermark_position.value', 'top-left'),
@@ -169,7 +176,7 @@ class Upload
'offset_x' => (int)data_get($watermark_config, 'watermark_offset_x.value', 0),
'offset_y' => (int)data_get($watermark_config, 'watermark_offset_y.value', 0),
'opacity' => (int)data_get($watermark_config, 'watermark_opacity.value', 100),
- ],
+ ]
];
}
/**
From aa4d5b5f3152cc2b7bd66fc834e045236ab72497 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 15:40:37 +0800
Subject: [PATCH 14/17] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Upload.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index dee2d3e4..8a8eeddb 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -42,7 +42,7 @@ class Upload
$filemd5 = $file->md5();
$filesha1 = $file->sha1();
- $image_model = null; // SysImageUploadRecordModel::md5($filemd5)->find();
+ $image_model = SysImageUploadRecordModel::md5($filemd5)->find();
if (is_null($image_model)) {
$filename = Filesystem::disk('image')->putFile($param['module'], $file);
// 处理图片
From adbfc34f9dd3c5e6c928c809822cc00093e12791 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 16:51:13 +0800
Subject: [PATCH 15/17] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E5=9B=BE?=
=?UTF-8?q?=E7=89=87=E6=B0=B4=E5=8D=B0=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Upload.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index 8a8eeddb..5d944a09 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -42,7 +42,7 @@ class Upload
$filemd5 = $file->md5();
$filesha1 = $file->sha1();
- $image_model = SysImageUploadRecordModel::md5($filemd5)->find();
+ $image_model = null; // SysImageUploadRecordModel::md5($filemd5)->find();
if (is_null($image_model)) {
$filename = Filesystem::disk('image')->putFile($param['module'], $file);
// 处理图片
@@ -62,7 +62,7 @@ class Upload
// 读取水印图片
$watermark_image = $image_manager->read(public_path() . $image_options['image']);
// 缩放水印图片
- $watermark_image->scale((int)$image_options['width'], (int)$image_options['height']);
+ $watermark_image->scale($image_options['width'], $image_options['height']);
// 绘制水印图片
$image->place(
$watermark_image,
@@ -170,8 +170,8 @@ class Upload
],
'image_options' => [
'image' => data_get($watermark_config, 'watermark_image_value.value', ''),
- 'width' => data_get($watermark_config, 'watermark_image_width.value', null),
- 'height' => data_get($watermark_config, 'watermark_image_height.value', null),
+ 'width' => (int)data_get($watermark_config, 'watermark_image_width.value')?:null,
+ 'height' => (int)data_get($watermark_config, 'watermark_image_height.value')?:null,
'position' => data_get($watermark_config, 'watermark_position.value', 'top-left'),
'offset_x' => (int)data_get($watermark_config, 'watermark_offset_x.value', 0),
'offset_y' => (int)data_get($watermark_config, 'watermark_offset_y.value', 0),
From 50f4e5db55ef6c14838e2f026de6bf305df0ce76 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 16:59:02 +0800
Subject: [PATCH 16/17] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E5=9B=BE?=
=?UTF-8?q?=E7=89=87=E6=B0=B4=E5=8D=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Upload.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index 5d944a09..dfc7cb92 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -42,7 +42,7 @@ class Upload
$filemd5 = $file->md5();
$filesha1 = $file->sha1();
- $image_model = null; // SysImageUploadRecordModel::md5($filemd5)->find();
+ $image_model = SysImageUploadRecordModel::md5($filemd5)->find();
if (is_null($image_model)) {
$filename = Filesystem::disk('image')->putFile($param['module'], $file);
// 处理图片
@@ -85,7 +85,7 @@ class Upload
// 设置字体大小
$font->size($text_options['size']);
// 设置字体颜色及透明度
- $opacity = dechex((int)ceil(255 * ($text_options['opacity'] / 100)));
+ $opacity = $text_options['opacity'] > 0 ? dechex((int)ceil(255 * ($text_options['opacity'] / 100))) : '00';
$font->color($text_options['color'] . $opacity);
$font->align('left');
$font->valign('top');
From f48f2265d8202dcf4c60f99f945322c2da0111c2 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 11 Jun 2025 17:09:41 +0800
Subject: [PATCH 17/17] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E5=9B=BE?=
=?UTF-8?q?=E7=89=87=E6=B0=B4=E5=8D=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/v1/Upload.php | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php
index dfc7cb92..c8ba0a66 100644
--- a/app/admin/controller/v1/Upload.php
+++ b/app/admin/controller/v1/Upload.php
@@ -155,27 +155,32 @@ class Upload
{
$config_model = new \app\admin\controller\v1\SiteConfig;
$watermark_config = $config_model->getByGroupUniqueLabel('watermark');
+
+ $opacity = data_get($watermark_config, 'watermark_opacity.value', 100);
+ if ($opacity == '') {
+ $opacity = 100;
+ }
return [
'enabled' => data_get($watermark_config, 'watermark_enabled.value', 0) == 1,
'type' => data_get($watermark_config, 'watermark_type.value', ''),
'text_options' => [
'txt' => data_get($watermark_config, 'watermark_text_value.value', ''),
'font' => data_get($watermark_config, 'watermark_text_font.value', ''),
- 'size' => (float)data_get($watermark_config, 'watermark_text_size.value', 12),
- 'color' => data_get($watermark_config, 'watermark_text_color.value', '#000000'),
- 'position' => data_get($watermark_config, 'watermark_position.value', 'top-left'),
+ 'size' => (float)data_get($watermark_config, 'watermark_text_size.value', 12)?:12,
+ 'color' => data_get($watermark_config, 'watermark_text_color.value', '#000000')?:'#000000',
+ 'position' => data_get($watermark_config, 'watermark_position.value', 'top-left')?:'top-left',
'offset_x' => (int)data_get($watermark_config, 'watermark_offset_x.value', 0),
'offset_y' => (int)data_get($watermark_config, 'watermark_offset_y.value', 0),
- 'opacity' => (int)data_get($watermark_config, 'watermark_opacity.value', 100),
+ 'opacity' => (int)$opacity,
],
'image_options' => [
'image' => data_get($watermark_config, 'watermark_image_value.value', ''),
'width' => (int)data_get($watermark_config, 'watermark_image_width.value')?:null,
'height' => (int)data_get($watermark_config, 'watermark_image_height.value')?:null,
- 'position' => data_get($watermark_config, 'watermark_position.value', 'top-left'),
+ 'position' => data_get($watermark_config, 'watermark_position.value', 'top-left')?:'top-left',
'offset_x' => (int)data_get($watermark_config, 'watermark_offset_x.value', 0),
'offset_y' => (int)data_get($watermark_config, 'watermark_offset_y.value', 0),
- 'opacity' => (int)data_get($watermark_config, 'watermark_opacity.value', 100),
+ 'opacity' => (int)$opacity,
]
];
}