From c19efa176a93f50f94e63b54a1ebe6a3821d5924 Mon Sep 17 00:00:00 2001 From: sjeam <359824901@qq.com> Date: Mon, 14 Apr 2025 16:02:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=9B=BE=E7=89=87=E7=AE=A1?= =?UTF-8?q?=E7=90=861?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store_product/StoreProductController.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/admin/controller/store_product/StoreProductController.php b/app/admin/controller/store_product/StoreProductController.php index 21ef23437..e0b846fa1 100644 --- a/app/admin/controller/store_product/StoreProductController.php +++ b/app/admin/controller/store_product/StoreProductController.php @@ -170,7 +170,7 @@ class StoreProductController extends BaseAdminController // 'ProductId' => '1024', // 'GroupId' => 'default', // ]; - $fileName = StoreProduct::where('id', $params['ProductId'])->value('store_name'); + $storeName = StoreProduct::where('id', $params['ProductId'])->value('store_name'); $product_num = ProductImage::where('product_id', $params['ProductId'])->count('id'); $cred = new Credential(getenv('TENCENT_SECRET_ID'), getenv('TENCENT_SECRET_KEY')); $httpProfile = new HttpProfile(); @@ -180,13 +180,14 @@ class StoreProductController extends BaseAdminController $client = new TiiaClient($cred, "ap-guangzhou", $clientProfile); $req = new CreateImageRequest(); $file = $this->request->file('file'); - $file_path = $file->getRealPath(); - $file = file_get_contents($file_path); + $filePath = $file->getRealPath(); + $fileName = $file->getuploadName(); + $file = file_get_contents($filePath); // $fileName ="矿泉水7"; // $file = file_get_contents(public_path() . '/' . $fileName. '.jpg'); $ImageParams = [ 'GroupId' => $params['GroupId'], - 'EntityId' => $params['ProductId'].'_'.$fileName.'_'.intval($product_num+1), + 'EntityId' => $params['ProductId'].'_'.$storeName.'_'.intval($product_num+1), 'PicName' => $params['ProductId'].'_'.$fileName, 'ImageBase64' => base64_encode($file) ]; @@ -217,8 +218,8 @@ class StoreProductController extends BaseAdminController $client = new TiiaClient($cred, "ap-guangzhou", $clientProfile); $req = new SearchImageRequest(); $file = $this->request->file('file'); - $file_path = $file->getRealPath(); - $file = file_get_contents($file_path); + $filePath = $file->getRealPath(); + $file = file_get_contents($filePath); // $fileName ="鱿鱼"; // $file = file_get_contents(public_path() . '/' . $fileName. '.jpg'); $ImageParams = [