商品图片管理1
This commit is contained in:
parent
c19ef6080a
commit
c19efa176a
@ -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 = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user