From 6b082f2de957d96f865fcb1b360cf548ab050dad Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 14 Jul 2025 11:00:43 +0800 Subject: [PATCH 1/8] =?UTF-8?q?perf:=20=E6=95=B0=E6=8D=AE=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/DataMigration.php | 110 ++++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 30 deletions(-) diff --git a/app/command/DataMigration.php b/app/command/DataMigration.php index 8705efc4..b77cd52c 100644 --- a/app/command/DataMigration.php +++ b/app/command/DataMigration.php @@ -60,24 +60,27 @@ class DataMigration extends Command // $this->migrateProductPurchaseLinks(); // 迁移文章 - // $this->migrateArticle([ - // 68 => 10, - // 69 => 11, - // 70 => 12, - // 71 => 13, - // 72 => 14, - // 73 => 15, - // 74 => 16, - // 75 => 17, - // 78 => 19, - // 79 => 20, - // 80 => 21, - // 81 => 22, - // 82 => 23, - // 83 => 24, - // 84 => 25, - // 85 => 26 - // ]); + $this->migrateArticle([ + 16 => 7, + 31 => 9, + 32 => 8, + // 68 => 10, + // 69 => 11, + // 70 => 12, + // 71 => 13, + // 72 => 14, + // 73 => 15, + // 74 => 16, + // 75 => 17, + // 78 => 19, + // 79 => 20, + // 80 => 21, + // 81 => 22, + // 82 => 23, + // 83 => 24, + // 84 => 25, + // 85 => 26 + ]); // 迁移faq // $this->migrateFaq(); @@ -290,14 +293,15 @@ class DataMigration extends Command $old_db = Db::connect('old'); $success_map = []; - $success_arr = include_once(runtime_path() . 'product_success.php'); + $success_arr = []; // include_once(runtime_path() . 'product_success.php'); foreach ($success_arr as $so) { $success_map['p_' . $so['cod_product_id']] = $so; } + $arr = include_once(runtime_path() . 'product_ids.php'); $products = $old_db->name('product') ->where('country_code', 'in', ['ZH', 'US']) - ->where('id', '>', 15789) + ->where('id', 'in', array_unique(array_column($arr, 'cod_product_id'))) ->order(['id' => 'asc']) ->cursor(); @@ -374,7 +378,16 @@ class DataMigration extends Command 'deleted_at' => $v['stat'] == -1 ? date('Y-m-d H:i:s') : null, ]; // 保存产品数据 - $id = Db::name('product')->insertGetId($item); + $prod = Db::name('product') + ->where('language_id', '=', $item['language_id']) + ->where('spu', '=', $item['spu']) + ->find(); + if (!empty($prod)) { + $id = $prod['id']; + Db::name('product')->where('id', '=', $prod['id'])->update($item); + } else { + $id = Db::name('product')->insertGetId($item); + } // 保存产品参数数据 if (!empty($v['product_view'])) { @@ -387,7 +400,21 @@ class DataMigration extends Command 'value' => $p['desc_desc'] ]; } - Db::name('product_params')->insertAll($prarms); + $old_params = Db::name('product_params') + ->where('product_id', '=', $id) + ->select(); + if ($old_params->isEmpty()) { + Db::name('product_params')->insertAll($prarms); + } else { + foreach ($old_params as $op) { + Db::name('product_params') + ->where('product_id', '=', $id) + ->where('name', '=', $op['name']) + ->update([ + 'value' => $op['value'] + ]); + } + } } // 保存sku数据 @@ -444,7 +471,7 @@ class DataMigration extends Command if ($k != 'sort') { $attr_value = $at; if (in_array($k, ['颜色', 'Color'])) { - if ($k == 'Color') $k = '颜色'; + // if ($k == 'Color') $k = '颜色'; $attr_value = '/static/common/images/colors/' . $at . '.png'; } $images[$pkey]['color'] = $at; @@ -468,7 +495,7 @@ class DataMigration extends Command } } $attr_arr = [ - 'attr_id' => $attrs_map[$v['country_code']]['颜色'], + 'attr_id' => $attrs_map[$v['country_code']][$v['country_code'] == 'ZH' ? '颜色' : 'Color'], 'attr_value' => $attr_value, ]; if ( @@ -514,7 +541,7 @@ class DataMigration extends Command $skus[] = [ 'main_image' => $ti['image_url'], 'attrs' => [[ - 'attr_id' => $attrs_map[$v['country_code']]['颜色'], + 'attr_id' => $attrs_map[$v['country_code']][$v['country_code'] == 'ZH' ? '颜色' : 'Color'], 'attr_value' => $ti['image_color'], ]], 'pkey' => $tpkey @@ -575,6 +602,7 @@ class DataMigration extends Command } foreach ($skus as $sku) { + Db::name('product_sku')->where('product_id', '=', $sku['product_id'])->delete(); $sku_id = Db::name('product_sku')->insertGetId([ 'product_id' => $sku['product_id'], 'sku' => $sku['sku']??'', @@ -584,6 +612,7 @@ class DataMigration extends Command if (!empty($sku['attrs'])) { foreach ($sku['attrs'] as $attr) { if (!empty($sku_id)) { + Db::name('product_sku_attr')->where('sku_id', '=', $sku_id)->delete(); Db::name('product_sku_attr')->insert([ 'sku_id' => $sku_id, 'attr_id' => $attr['attr_id'], @@ -601,7 +630,7 @@ class DataMigration extends Command sprintf('["ow_product_id" => %d, "cod_product_id" => %d]'.PHP_EOL, $id, $v['id']), FILE_APPEND ); - $this->println(sprintf('迁移产品ID:%s => %s 【耗时:%s】', $v['id'], 0, round(microtime(true) - $start, 2) . 's')); + $this->println(sprintf('迁移产品ID:%s => %s 【耗时:%s】', $v['id'], $id, round(microtime(true) - $start, 2) . 's')); } catch (\Throwable $th) { Db::rollback(); file_put_contents( @@ -694,9 +723,12 @@ class DataMigration extends Command throw new \Exception('请确认分类ID'); } + // 1634 $article = Db::connect('old') ->name('article') + ->where('country_code', 'in', ['ZH', 'US']) ->where('cid', 'in', array_keys($category_map)) + ->where('id', '=', 351) ->order(['id' => 'asc']) ->cursor(); @@ -745,7 +777,16 @@ class DataMigration extends Command 'release_time' => date('Y-m-d H:i:s', $v['createtime']), 'deleted_at' => $v['stat'] == -1 ? date('Y-m-d H:i:s') : null ]; - $id = Db::name('article')->insertGetId($item); + $ret = Db::name('article') + ->where('language_id', '=', $item['language_id']) + ->where('title', '=', $item['title']) + ->find(); + if (empty($ret)) { + $id = Db::name('article')->insertGetId($item); + } else { + $id = $ret['id']; + Db::name('article')->where('id', '=', $ret['id'])->update($item); + } $this->println(sprintf('迁移文章ID:%s => %s', $v['id'], $id)); } @@ -779,7 +820,15 @@ class DataMigration extends Command 'recommend' => $val['is_home'], 'sort' => $val['sort'] == 9999 ? 0 : $val['sort'] ]; - Db::name('faq')->insert($item); + $ret = Db::name('faq') + ->where('language_id', '=', $item['language_id']) + ->where('question', '=', $item['question']) + ->find(); + if (empty($ret)) { + Db::name('faq')->insert($item); + } else { + Db::name('faq')->where('id', '=', $ret['id'])->update($item); + } } } @@ -929,7 +978,7 @@ class DataMigration extends Command class UploadMannager { - const UPLOAD_BASE_API = 'http://dev.ow.f2b211.com'; + const UPLOAD_BASE_API = 'http://ow.f2b211.com'; const DOWNLOAD_BASE_API = 'http://www.orico.com.cn'; const DOWNLOAD_TEMP_PATH = '/var/www/html/orico-official-website/public/migrate_temp_images'; private $username = 'admin'; @@ -942,7 +991,7 @@ class UploadMannager { // 登录获取token $this->token = $this->getAuthorization(); - $this->maps = include_once(runtime_path() . 'fiber_product_image_mapping.php'); + $this->maps = []; // include_once(runtime_path() . 'fiber_product_image_mapping.php'); } // 下载图片 @@ -1062,6 +1111,7 @@ class UploadMannager print($http_code . PHP_EOL); } + file_put_contents(runtime_path() . 'upload.txt', $response . PHP_EOL, FILE_APPEND); $ret = json_decode($response, true); if (empty($ret)) { throw new \Exception($response); From 796231a50ec8f9c0b4683fa631f3f35bf1058789 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 14 Jul 2025 11:01:14 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20pc=20=E5=BA=95=E9=83=A8=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=96=B0=E6=A0=87=E7=AD=BE=E9=A1=B5=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/view/pc/public/footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/index/view/pc/public/footer.html b/app/index/view/pc/public/footer.html index 0d4fa2e1..86821864 100644 --- a/app/index/view/pc/public/footer.html +++ b/app/index/view/pc/public/footer.html @@ -40,7 +40,7 @@ {if condition="!empty($vo.children)"}
{:lang_i18n('店铺')}
{/notempty}
From aed2ce4655270dfa6606b0a91ca0103fd9cd95be Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Mon, 14 Jul 2025 11:25:02 +0800
Subject: [PATCH 4/8] =?UTF-8?q?fix:=20pc=20=E9=A1=B6=E9=83=A8=E2=80=9C?=
=?UTF-8?q?=E5=BA=97=E9=93=BA=E2=80=9D=E6=96=B0=E6=A0=87=E7=AD=BE=E6=89=93?=
=?UTF-8?q?=E5=BC=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/view/pc/public/header.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/index/view/pc/public/header.html b/app/index/view/pc/public/header.html
index 169ddc38..47ae1e8a 100644
--- a/app/index/view/pc/public/header.html
+++ b/app/index/view/pc/public/header.html
@@ -92,7 +92,7 @@
{eq name=":cookie('think_lang')" value="en-us"}
{notempty name="basic_config['navigation_store_url']['value']"}
-
+
{:lang_i18n('店铺')}
{/notempty}
From 2a503cbf6870bab50decf8c4117556fae83b6dd7 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Mon, 14 Jul 2025 11:47:41 +0800
Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=E4=BA=A7=E5=93=81=E8=AF=A6=E6=83=85?=
=?UTF-8?q?=E8=B4=AD=E4=B9=B0=E9=93=BE=E6=8E=A5=E6=8E=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/controller/Product.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/index/controller/Product.php b/app/index/controller/Product.php
index 1dcd0921..abc84bcb 100644
--- a/app/index/controller/Product.php
+++ b/app/index/controller/Product.php
@@ -396,8 +396,11 @@ class Product extends Common
->order(['sort' => 'asc', 'id' => 'desc'])
->select()
->hidden(['platform'])
- ->bindAttr('platform', ['platform_name' => 'platform'])
+ ->bindAttr('platform', ['platform_name' => 'platform', 'platform_sort' => 'sort'])
->toArray();
+ // 根据购买链接平台排序
+ $sort_by_arr = array_column($product_purchase_links, 'platform_sort');
+ array_multisort($sort_by_arr, SORT_ASC, $product_purchase_links);
// 获取相关产品信息
$related = ProductRelatedModel::with(['product' => function($query) {
From 4b8963161f5c7d88ff5071c112271ee448150d30 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Mon, 14 Jul 2025 13:42:50 +0800
Subject: [PATCH 6/8] =?UTF-8?q?perf:=20=E6=95=B0=E6=8D=AE=E5=90=8C?=
=?UTF-8?q?=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/command/DataMigration.php | 42 +++++++++++++++++------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/app/command/DataMigration.php b/app/command/DataMigration.php
index b77cd52c..e506ef9a 100644
--- a/app/command/DataMigration.php
+++ b/app/command/DataMigration.php
@@ -60,27 +60,27 @@ class DataMigration extends Command
// $this->migrateProductPurchaseLinks();
// 迁移文章
- $this->migrateArticle([
- 16 => 7,
- 31 => 9,
- 32 => 8,
- // 68 => 10,
- // 69 => 11,
- // 70 => 12,
- // 71 => 13,
- // 72 => 14,
- // 73 => 15,
- // 74 => 16,
- // 75 => 17,
- // 78 => 19,
- // 79 => 20,
- // 80 => 21,
- // 81 => 22,
- // 82 => 23,
- // 83 => 24,
- // 84 => 25,
- // 85 => 26
- ]);
+ // $this->migrateArticle([
+ // 16 => 7,
+ // 31 => 9,
+ // 32 => 8,
+ // 68 => 10,
+ // 69 => 11,
+ // 70 => 12,
+ // 71 => 13,
+ // 72 => 14,
+ // 73 => 15,
+ // 74 => 16,
+ // 75 => 17,
+ // 78 => 19,
+ // 79 => 20,
+ // 80 => 21,
+ // 81 => 22,
+ // 82 => 23,
+ // 83 => 24,
+ // 84 => 25,
+ // 85 => 26
+ // ]);
// 迁移faq
// $this->migrateFaq();
From 7cbb6adb5d5b96ecc9b86e9aa0ed5d686bba4f4c Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Mon, 14 Jul 2025 13:43:52 +0800
Subject: [PATCH 7/8] =?UTF-8?q?fix:=20=E8=A7=86=E9=A2=91=E6=8F=8F=E8=BF=B0?=
=?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=95=BF=E5=BA=A6=E6=A0=A1=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/validate/v1/VideoValidate.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/admin/validate/v1/VideoValidate.php b/app/admin/validate/v1/VideoValidate.php
index 1c7fa691..f374ce34 100644
--- a/app/admin/validate/v1/VideoValidate.php
+++ b/app/admin/validate/v1/VideoValidate.php
@@ -18,7 +18,7 @@ class VideoValidate extends Validate
'language_id' => 'require|integer',
'category_id' => 'require|integer',
'name' => 'require|max:64',
- 'desc' => 'max:255',
+ 'desc' => 'max:512',
'image' => 'max:125',
'video' => 'max:125',
'link' => 'url|max:125',
@@ -44,7 +44,7 @@ class VideoValidate extends Validate
'category_id.integer' => '分类参数类型错误',
'name.require' => '名称不能为空',
'name.max' => '名称不能超过64个字符',
- 'desc.max' => '描述不能超过255个字符',
+ 'desc.max' => '描述不能超过512个字符',
'image.max' => '图片不能超过125个字符',
'video.max' => '视频不能超过125个字符',
'link.url' => '链接格式错误',
From 8186a424dedfc30bd7cc808284fd4ee952d561f0 Mon Sep 17 00:00:00 2001
From: jsasg <735273025@qq.com>
Date: Mon, 14 Jul 2025 14:06:04 +0800
Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=E9=A1=B6=E9=83=A8=E6=90=9C=E7=B4=A2?=
=?UTF-8?q?=E4=BA=A7=E5=93=81=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA=E7=BC=A9?=
=?UTF-8?q?=E7=95=A5=E5=9B=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/index/view/pc/public/header.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/index/view/pc/public/header.html b/app/index/view/pc/public/header.html
index 47ae1e8a..8608cd51 100644
--- a/app/index/view/pc/public/header.html
+++ b/app/index/view/pc/public/header.html
@@ -115,7 +115,7 @@