商品图片管理1
This commit is contained in:
parent
c19ef6080a
commit
c19efa176a
@ -170,7 +170,7 @@ class StoreProductController extends BaseAdminController
|
|||||||
// 'ProductId' => '1024',
|
// 'ProductId' => '1024',
|
||||||
// 'GroupId' => 'default',
|
// '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');
|
$product_num = ProductImage::where('product_id', $params['ProductId'])->count('id');
|
||||||
$cred = new Credential(getenv('TENCENT_SECRET_ID'), getenv('TENCENT_SECRET_KEY'));
|
$cred = new Credential(getenv('TENCENT_SECRET_ID'), getenv('TENCENT_SECRET_KEY'));
|
||||||
$httpProfile = new HttpProfile();
|
$httpProfile = new HttpProfile();
|
||||||
@ -180,13 +180,14 @@ class StoreProductController extends BaseAdminController
|
|||||||
$client = new TiiaClient($cred, "ap-guangzhou", $clientProfile);
|
$client = new TiiaClient($cred, "ap-guangzhou", $clientProfile);
|
||||||
$req = new CreateImageRequest();
|
$req = new CreateImageRequest();
|
||||||
$file = $this->request->file('file');
|
$file = $this->request->file('file');
|
||||||
$file_path = $file->getRealPath();
|
$filePath = $file->getRealPath();
|
||||||
$file = file_get_contents($file_path);
|
$fileName = $file->getuploadName();
|
||||||
|
$file = file_get_contents($filePath);
|
||||||
// $fileName ="矿泉水7";
|
// $fileName ="矿泉水7";
|
||||||
// $file = file_get_contents(public_path() . '/' . $fileName. '.jpg');
|
// $file = file_get_contents(public_path() . '/' . $fileName. '.jpg');
|
||||||
$ImageParams = [
|
$ImageParams = [
|
||||||
'GroupId' => $params['GroupId'],
|
'GroupId' => $params['GroupId'],
|
||||||
'EntityId' => $params['ProductId'].'_'.$fileName.'_'.intval($product_num+1),
|
'EntityId' => $params['ProductId'].'_'.$storeName.'_'.intval($product_num+1),
|
||||||
'PicName' => $params['ProductId'].'_'.$fileName,
|
'PicName' => $params['ProductId'].'_'.$fileName,
|
||||||
'ImageBase64' => base64_encode($file)
|
'ImageBase64' => base64_encode($file)
|
||||||
];
|
];
|
||||||
@ -217,8 +218,8 @@ class StoreProductController extends BaseAdminController
|
|||||||
$client = new TiiaClient($cred, "ap-guangzhou", $clientProfile);
|
$client = new TiiaClient($cred, "ap-guangzhou", $clientProfile);
|
||||||
$req = new SearchImageRequest();
|
$req = new SearchImageRequest();
|
||||||
$file = $this->request->file('file');
|
$file = $this->request->file('file');
|
||||||
$file_path = $file->getRealPath();
|
$filePath = $file->getRealPath();
|
||||||
$file = file_get_contents($file_path);
|
$file = file_get_contents($filePath);
|
||||||
// $fileName ="鱿鱼";
|
// $fileName ="鱿鱼";
|
||||||
// $file = file_get_contents(public_path() . '/' . $fileName. '.jpg');
|
// $file = file_get_contents(public_path() . '/' . $fileName. '.jpg');
|
||||||
$ImageParams = [
|
$ImageParams = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user