From 9b7fba94342932a752927c1b0dea4b6b4f914b1d Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 1 Jul 2025 17:13:24 +0800
Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E4=BA=A7=E5=93=81=E6=90=9C=E7=B4=A2?=
=?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E9=AB=98=E4=BA=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/common.php | 19 +++++++++++++++++++
app/index/controller/Product.php | 6 +++---
app/index/model/ProductModel.php | 2 +-
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/app/index/common.php b/app/index/common.php
index de61e023..81d3df13 100644
--- a/app/index/common.php
+++ b/app/index/common.php
@@ -222,3 +222,22 @@ if (!function_exists('get_platform')) {
return $platform;
}
}
+
+if (!function_exists('highlight_keywords')) {
+ /**
+ * 高亮关键词
+ * @param string $item
+ * @param string $keywords
+ * @param array $class
+ * @return string
+ */
+ function highlight_keywords(string $text, string $keywords, array $class=[]): string
+ {
+ return preg_replace_callback('/' . preg_quote($keywords, '/') . '+/i', function($match) use($text, $class) {
+ if (empty($match)) {
+ return $text;
+ }
+ return '' . $match[0] . '';
+ }, $text);
+ }
+}
diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php
index 74510312..b16ded89 100644
--- a/app/index/controller/Product.php
+++ b/app/index/controller/Product.php
@@ -299,9 +299,9 @@ class Product extends Common
'query' => request()->param()
])
->each(function ($item) use($keywords) {
- $item['spu'] = str_replace($keywords, ''.$keywords.'', $item['spu']);
- $item['name'] = str_replace($keywords, ''.$keywords.'', $item['name']);
- $item['short_name'] = str_replace($keywords, ''.$keywords.'', $item['short_name']);
+ $item['spu'] = highlight_keywords($item['spu'], $keywords, ['redpoint']);
+ $item['name'] = highlight_keywords($item['name'], $keywords, ['redpoint']);
+ $item['short_name'] = highlight_keywords($item['short_name'], $keywords, ['redpoint']);
return $item;
});
View::assign('products', $products);
diff --git a/app/index/model/ProductModel.php b/app/index/model/ProductModel.php
index 5b8a74f3..a4be17ef 100644
--- a/app/index/model/ProductModel.php
+++ b/app/index/model/ProductModel.php
@@ -79,6 +79,6 @@ class ProductModel extends ProductBaseModel
// 关键词搜索
public function searchKeywordsAttr($query, string $keywords)
{
- $query->whereRaw('BINARY spu LIKE "%' . $keywords . '%" OR BINARY name LIKE "%' . $keywords . '%" OR BINARY short_name LIKE "%' . $keywords . '%"');
+ $query->whereRaw('spu LIKE "%' . $keywords . '%" OR name LIKE "%' . $keywords . '%" OR short_name LIKE "%' . $keywords . '%"');
}
}
From fdcca43c6431ef3a0f50194dbf5e5c83afd618d7 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 1 Jul 2025 17:15:40 +0800
Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=8E=A5=E6=94=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/ReceiveSync.php | 71 +++++++++++++++++++
.../model/v1/ProductTcoCategoryModel.php | 6 ++
2 files changed, 77 insertions(+)
create mode 100644 app/admin/controller/ReceiveSync.php
diff --git a/app/admin/controller/ReceiveSync.php b/app/admin/controller/ReceiveSync.php
new file mode 100644
index 00000000..368e6694
--- /dev/null
+++ b/app/admin/controller/ReceiveSync.php
@@ -0,0 +1,71 @@
+post();
+ if (empty($data)) return error('请确认同步数据');
+
+ $lang_id = LanguageModel::where('code', $data['lang'])->value('id');
+ $record = [
+ 'language_id' => $lang_id,
+ 'name' => $data['name'],
+ 'tco_id' => $data['tco_id'],
+ 'tco_pid' => $data['tco_pid'],
+ 'tco_path' => $data['tco_path'],
+ 'erp_id' => $data['erp_id'],
+ 'erp_pid' => $data['erp_pid'],
+ 'erp_code' => $data['erp_code'],
+ 'erp_path' => $data['erp_path'],
+ 'disabled' => 0,
+ 'sync_time' => strtotime($data['created_at'])
+ ];
+
+ if (Operate_Of_ReceiveSync::Disable == $data['operate']) {
+ $record['disabled'] = 1;
+ }
+
+ $validate = validate([
+ 'name|分类名称' => 'require',
+ 'erp_code|分类ERP编码' => 'require',
+ ]);
+ if (!$validate->check($record)) {
+ throw new \Exception((string)$validate->getError());
+ }
+
+ $category = ProductTcoCategoryModel::language($lang_id)->erpCode($record['erp_code'])->find();
+ Db::startTrans();
+ try {
+ if (empty($category)) {
+ ProductTcoCategoryModel::create($record);
+ ProductCategoryModel::where
+ } else {
+ $category->save($record);
+ }
+ } catch (\Throwable $th) {
+ Db::rollback();
+ throw $th;
+ }
+
+ }
+}
diff --git a/app/admin/model/v1/ProductTcoCategoryModel.php b/app/admin/model/v1/ProductTcoCategoryModel.php
index 596fcb37..d68be9b2 100644
--- a/app/admin/model/v1/ProductTcoCategoryModel.php
+++ b/app/admin/model/v1/ProductTcoCategoryModel.php
@@ -23,6 +23,12 @@ class ProductTcoCategoryModel extends ProductTcoCategoryBaseModel
$query->where('language_id', '=', $value);
}
+ // 根据ERP Code查询
+ public function scopeErpCode($query, $value)
+ {
+ $query->where('erp_code', '=', $value);
+ }
+
// 按分类名称搜索
public function searchNameAttr($query, $value, $data)
{
From 4b7dd6e16599a79ab078d2762a43dd77912a3750 Mon Sep 17 00:00:00 2001
From: liangjiami <2249412933@qq.com>
Date: Tue, 1 Jul 2025 16:42:57 +0800
Subject: [PATCH 3/6] =?UTF-8?q?style:=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=E4=BF=AE=E6=94=B97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/static/index/pc/css/aboutus_introduction.css | 1 +
public/static/index/pc/css/orico_header.css | 1 +
2 files changed, 2 insertions(+)
diff --git a/public/static/index/pc/css/aboutus_introduction.css b/public/static/index/pc/css/aboutus_introduction.css
index d480acdd..d3433e92 100755
--- a/public/static/index/pc/css/aboutus_introduction.css
+++ b/public/static/index/pc/css/aboutus_introduction.css
@@ -103,6 +103,7 @@
overflow: hidden;
position: relative;
text-align: center;
+ z-index: 10;
}
/* .orico_Page_introduction .introductionMain .iotb_part2 .fdimgs.fdimgs1 .fdimgs-div {
height: 405px;
diff --git a/public/static/index/pc/css/orico_header.css b/public/static/index/pc/css/orico_header.css
index 42177830..50b565ff 100755
--- a/public/static/index/pc/css/orico_header.css
+++ b/public/static/index/pc/css/orico_header.css
@@ -174,6 +174,7 @@
.header-PC #header .nav2 .navItem .navItemConten1 li a {
cursor: pointer;
padding-left: 0;
+ white-space: nowrap;
}
.header-PC #header .nav2 .navItem .navItemConten1 li a:hover {
color: #004bfa;
From 6d8042932bc8b192cebaa86be2135347aa954468 Mon Sep 17 00:00:00 2001
From: liangjiami <2249412933@qq.com>
Date: Tue, 1 Jul 2025 17:03:46 +0800
Subject: [PATCH 4/6] =?UTF-8?q?style:=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=E4=BF=AE=E6=94=B98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/static/index/pc/css/product_detail.css | 2 ++
1 file changed, 2 insertions(+)
diff --git a/public/static/index/pc/css/product_detail.css b/public/static/index/pc/css/product_detail.css
index 0da9d4e7..e53cc1ce 100755
--- a/public/static/index/pc/css/product_detail.css
+++ b/public/static/index/pc/css/product_detail.css
@@ -596,6 +596,7 @@
background: url(/static/index/pc/images/fl.png);
left: 90px;
margin-top: -24.5px;
+ z-index: 1;
}
.scrollbutton.smallImgDown,
@@ -603,6 +604,7 @@
background: url(/static/index/pc/images/rh.png);
right: 0px;
margin-top: -24.5px;
+ z-index: 1;
}
.orico_Page_prdetail .glcpmain {
width: 100%;
From b63703d56fc4b7662bcf99ef8a70446586b91199 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Tue, 1 Jul 2025 17:23:14 +0800
Subject: [PATCH 5/6] =?UTF-8?q?fix:=20pc=20nas=E4=B8=93=E9=A2=98=E9=A1=B5?=
=?UTF-8?q?=20=E8=81=94=E7=B3=BB=E6=88=91=E4=BB=AC=E7=AC=AC=E4=B8=80?=
=?UTF-8?q?=E9=A1=B9=E6=97=A0js=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/view/pc/topic_nas/help.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/index/view/pc/topic_nas/help.html b/app/index/view/pc/topic_nas/help.html
index e0752832..12c373e3 100644
--- a/app/index/view/pc/topic_nas/help.html
+++ b/app/index/view/pc/topic_nas/help.html
@@ -136,7 +136,7 @@
$('#dropdown').hide();
}
});
- $('.nhlplxwmit:not(:first)').hover(function () {
+ $('.nhlplxwmit').hover(function () {
// 当鼠标移入时,显示.lxewmimg 并隐藏.lximg
var lxe = $(this).find('.lxewmimg');
var lxi = $(this).find('.lximg');
From 74cbc926a222233a96131110e1b02e0e51316a7a Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Wed, 2 Jul 2025 10:42:48 +0800
Subject: [PATCH 6/6] =?UTF-8?q?feat:=20=E4=BB=8E=E4=BA=A7=E5=93=81?=
=?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8C=E6=AD=A5=E4=BA=A7=E5=93=81=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/controller/ReceiveProductSync.php | 217 ++++++++++++++++++
app/admin/controller/ReceiveSync.php | 71 ------
app/admin/model/v1/ProductCategoryModel.php | 6 +
app/admin/model/v1/ProductModel.php | 6 +
.../model/v1/ProductTcoCategoryModel.php | 6 +
5 files changed, 235 insertions(+), 71 deletions(-)
create mode 100644 app/admin/controller/ReceiveProductSync.php
delete mode 100644 app/admin/controller/ReceiveSync.php
diff --git a/app/admin/controller/ReceiveProductSync.php b/app/admin/controller/ReceiveProductSync.php
new file mode 100644
index 00000000..8b3c8c02
--- /dev/null
+++ b/app/admin/controller/ReceiveProductSync.php
@@ -0,0 +1,217 @@
+post();
+ if (empty($data)) return error('请确认同步数据');
+
+ $validate = validate([
+ 'name|分类名称' => 'require',
+ 'erp_code|分类ERP编码' => 'require',
+ ]);
+ if (!$validate->check($data)) {
+ return error((string)$validate->getError());
+ }
+
+ // 获取对应语言ID
+ $lang_id = LanguageModel::where('code', $data['lang'])->value('id');
+ if (empty($lang_id)) {
+ return error('语言不存在');
+ }
+
+ Db::startTrans();
+ try {
+ $tco_category_data = [
+ 'language_id' => $lang_id,
+ 'name' => $data['name'],
+ 'tco_id' => $data['tco_id'],
+ 'tco_pid' => $data['tco_pid'],
+ 'tco_path' => $data['tco_path'],
+ 'erp_id' => $data['erp_id'],
+ 'erp_pid' => $data['erp_pid'],
+ 'erp_code' => $data['erp_code'],
+ 'erp_path' => $data['erp_path'],
+ 'disabled' => Operate_Of_ReceiveSync::Disable == $data['operate'] ? 1 : 0,
+ 'sync_time' => strtotime($data['created_at'])
+ ];
+ $tco_category = ProductTcoCategoryModel::language($lang_id)->erpCode($tco_category_data['erp_code'])->find();
+ if (empty($tco_category)) {
+ $tco_category = ProductTcoCategoryModel::create($tco_category_data);
+ if ($tco_category->isEmpty()) {
+ throw new \Exception('产品目录分类创建失败');
+ }
+
+ $category_data = [
+ 'language_id' => $lang_id,
+ 'unique_id' => uniqid('PRO_CATE_'),
+ 'pid' => 0,
+ 'path' => '',
+ 'name' => $tco_category_data['name'],
+ 'icon' => '',
+ 'desc' => '',
+ 'related_tco_category' => $tco_category['id'],
+ 'sort' => 0,
+ 'level' => 1,
+ 'is_show' => 1,
+ ];
+ $tco_parent = ProductTcoCategoryModel::language($lang_id)->tcoId($tco_category['tco_pid'])->find();
+ if (!empty($tco_parent)) {
+ $parent = ProductCategoryModel::language($lang_id)->tcoId($tco_parent['id'])->find();
+ if ($parent->isEmpty()) {
+ throw new \Exception('产品分类父级不存在');
+ }
+ $category_data['pid'] = $parent['id'];
+ $category_data['path'] = $parent['path'] . $parent['pid'];
+ $category_data['level'] = $parent['level'] + 1;
+ }
+ $category = ProductCategoryModel::create($category_data);
+ if ($category->isEmpty()) {
+ throw new \Exception('产品分类创建失败');
+ }
+ }
+ else if ($tco_category['sync_time'] < $tco_category_data['sync_time']) {
+ $success = $tco_category->save($tco_category_data);
+ if (!$success) {
+ throw new \Exception('产品目录分类更新失败');
+ }
+
+ $category = ProductCategoryModel::language($lang_id)->tcoId($tco_category['id'])->find();
+ $tco_parent = ProductTcoCategoryModel::language($lang_id)->tcoId($tco_category['tco_pid'])->find();
+ if (!empty($tco_parent)) {
+ $parent = ProductCategoryModel::language($lang_id)->tcoId($tco_parent['id'])->find();
+ if ($parent->isEmpty()) {
+ throw new \Exception('产品分类父级不存在');
+ }
+ $category['pid'] = $parent['id'];
+ $category['path'] = $parent['path'] . $parent['pid'];
+ $category['level'] = $parent['level'] + 1;
+ }
+ if (!$category->save($category)) {
+ throw new \Exception('产品分类更新失败');
+ }
+ }
+
+ Db::commit();
+ } catch (\Throwable $th) {
+ Db::rollback();
+ return error(sprintf('%s %s:%d', $th->getMessage(), $th->getFile(), $th->getLine()));
+ }
+
+ return success('同步成功');
+ }
+
+ // 接收产品同步数据
+ public function product()
+ {
+ $data = request()->post();
+ if (empty($data)) {
+ return error('请确认同步数据');
+ }
+
+ $validate = validate([
+ 'spu' => 'require',
+ 'name' => 'require',
+ 'category_erp_code' => 'require',
+ 'lang' => 'require',
+ 'created_at' => 'require',
+ ]);
+ if (!$validate->check($data)) {
+ return error((string)$validate->getError());
+ }
+
+ // 获取对应语言ID
+ $lang_id = LanguageModel::where('code', $data['lang'])->value('id');
+ if (empty($lang_id)) {
+ return error('语言不存在');
+ }
+
+ // 如果 spu_before_modification 存在则根据 spu_before_modification 更新型号
+ $product = null;
+ if (!empty($data['spu_before_modification'])) {
+ $product = ProductModel::language($lang_id)->spu($data['spu_before_modification'])->find();
+ }
+ if (
+ (empty($data['spu_before_modification']) && !empty($data['spu']))
+ // 避免 spu_before_modification 更新型号时,人为删除了旧型号导致的新增,从而出现重复型号问题,而进行再次验证
+ || (!empty($data['spu_before_modification']) && empty($product))
+ ) {
+ $product = ProductModel::language($lang_id)->spu($data['spu'])->find();
+ }
+
+ try {
+ $product_tco_category = ProductTcoCategoryModel::language($lang_id)->erpCade($data['category_erp_code'])->find();
+ if (empty($product_tco_category)) {
+ throw new \Exception('官网未找到产品目录同步分类');
+ }
+
+ $product_category = ProductCategoryModel::language($lang_id)->tcoId($product_tco_category['id'])->find();
+ if (empty($product_category)) {
+ throw new \Exception('官网未找到产品目录同步分类关联的分类');
+ }
+
+ if (empty($product)) {
+ $product = ProductModel::create([
+ 'language_id' => $lang_id,
+ 'category_id' => $product_category['id'],
+ 'spu' => $data['spu'],
+ 'name' => $data['name'],
+ 'short_name' => '',
+ 'cover_image' => '',
+ 'desc' => '',
+ 'video_img' => '',
+ 'video_url' => '',
+ 'is_sale' => 0,
+ 'is_new' => 0,
+ 'is_hot' => 0,
+ 'is_show' => Operate_Of_ReceiveSync::Disable == $data['operate'] ? 0 : 1,
+ 'sort' => 0,
+ 'detail' => '',
+ 'status' => 1,
+ 'seo_title' => '',
+ 'seo_keywords' => '',
+ 'seo_desc' => '',
+ 'updated_at' => $data['created_at'],
+ ]);
+ if ($product->isEmpty()) {
+ throw new \Exception('产品创建失败');
+ }
+ }
+ else if (strtotime($product['updated_at']) < strtotime($data['created_at'])) {
+ $product->spu = $data['spu'];
+ $product->name = $data['name'];
+ $product->category_id = $product_category['id'];
+ $product->is_show = Operate_Of_ReceiveSync::Disable == $data['operate'] ? 0 : 1;
+ if (!$product->save()) {
+ throw new \Exception('产品更新失败');
+ }
+ }
+ } catch (\Throwable $th) {
+ return error(sprintf('%s %s:%d', $th->getMessage(), $th->getFile(), $th->getLine()));
+ }
+
+ return success('同步成功');
+ }
+}
diff --git a/app/admin/controller/ReceiveSync.php b/app/admin/controller/ReceiveSync.php
deleted file mode 100644
index 368e6694..00000000
--- a/app/admin/controller/ReceiveSync.php
+++ /dev/null
@@ -1,71 +0,0 @@
-post();
- if (empty($data)) return error('请确认同步数据');
-
- $lang_id = LanguageModel::where('code', $data['lang'])->value('id');
- $record = [
- 'language_id' => $lang_id,
- 'name' => $data['name'],
- 'tco_id' => $data['tco_id'],
- 'tco_pid' => $data['tco_pid'],
- 'tco_path' => $data['tco_path'],
- 'erp_id' => $data['erp_id'],
- 'erp_pid' => $data['erp_pid'],
- 'erp_code' => $data['erp_code'],
- 'erp_path' => $data['erp_path'],
- 'disabled' => 0,
- 'sync_time' => strtotime($data['created_at'])
- ];
-
- if (Operate_Of_ReceiveSync::Disable == $data['operate']) {
- $record['disabled'] = 1;
- }
-
- $validate = validate([
- 'name|分类名称' => 'require',
- 'erp_code|分类ERP编码' => 'require',
- ]);
- if (!$validate->check($record)) {
- throw new \Exception((string)$validate->getError());
- }
-
- $category = ProductTcoCategoryModel::language($lang_id)->erpCode($record['erp_code'])->find();
- Db::startTrans();
- try {
- if (empty($category)) {
- ProductTcoCategoryModel::create($record);
- ProductCategoryModel::where
- } else {
- $category->save($record);
- }
- } catch (\Throwable $th) {
- Db::rollback();
- throw $th;
- }
-
- }
-}
diff --git a/app/admin/model/v1/ProductCategoryModel.php b/app/admin/model/v1/ProductCategoryModel.php
index f993f1c0..eb4dabaf 100644
--- a/app/admin/model/v1/ProductCategoryModel.php
+++ b/app/admin/model/v1/ProductCategoryModel.php
@@ -29,6 +29,12 @@ class ProductCategoryModel extends ProductCategoryBaseModel
$query->where('language_id', '=', $value);
}
+ // 所属产品目录分类id查询
+ public function scopeTcoId($query, $value)
+ {
+ $query->where('related_tco_category', '=', $value);
+ }
+
/**
* 根据是否显示查询
* @param $query
diff --git a/app/admin/model/v1/ProductModel.php b/app/admin/model/v1/ProductModel.php
index 8f970687..2b3456ad 100644
--- a/app/admin/model/v1/ProductModel.php
+++ b/app/admin/model/v1/ProductModel.php
@@ -80,6 +80,12 @@ class ProductModel extends ProductBaseModel
$query->where('category_id', '=', $value);
}
+ // 规格型号查询
+ public function scopeSpu($query, $spu)
+ {
+ $query->where('spu', '=', $spu);
+ }
+
// 启用状态查询
public function scopeEnabled($query)
{
diff --git a/app/admin/model/v1/ProductTcoCategoryModel.php b/app/admin/model/v1/ProductTcoCategoryModel.php
index d68be9b2..ea6cb328 100644
--- a/app/admin/model/v1/ProductTcoCategoryModel.php
+++ b/app/admin/model/v1/ProductTcoCategoryModel.php
@@ -23,6 +23,12 @@ class ProductTcoCategoryModel extends ProductTcoCategoryBaseModel
$query->where('language_id', '=', $value);
}
+ // 根据 tco_id 查询
+ public function scopeTcoId($query, $value)
+ {
+ $query->where('tco_id', '=', $value);
+ }
+
// 根据ERP Code查询
public function scopeErpCode($query, $value)
{