作者 lyh

变更数据

... ... @@ -232,7 +232,7 @@ class IndexController extends BaseController
public function prInfoDownload()
{
$url = 'http://crawl.scraper.waimaoq.com/export/issuewire?token=MT0CM7y4tdFTFTm';
$response = Http::get($url,['page'=>$this->param['page'],'pagesize'=>$this->param['row']]);
$response = Http::get($url,['page'=>$this->page,'pagesize'=>$this->row]);
if ($response->successful()) {
$result = $response->json();
}
... ...
... ... @@ -207,7 +207,10 @@ class ImageController extends Controller
if($this->upload_location == 0){
$watermarkOptions = $this->getProjectConfig($this->cache['project_id'] ?? 0);
$cosService = new CosService();
$cosService->uploadFile($files,$this->path,$fileName,false,$watermarkOptions);
$res = $cosService->uploadFile($files,$this->path,$fileName,false,$watermarkOptions);
if($res === false){
$this->response('上传失败,请重新上传',Code::SYSTEM_ERROR);
}
}else{
//TODO::上传亚马逊
$amazonS3Service = new AmazonS3Service();
... ...
... ... @@ -48,24 +48,30 @@ class CosService
// 如果不是 Base64 流文件,处理为普通文件上传
$Body = $binary ? $files : fopen($files->getRealPath(), 'r');
}
$options = [
'Bucket' => $cos['bucket'],
'Key' => $key,
'Body' => $Body,
];
//水印
if ($watermarkOptions) {
$options['PicOperations'] = json_encode([
'is_pic_info' => 1,
'rules' => [
[
'fileid' => $key, // 使用相同的文件名保存
'rule' => $watermarkOptions,
try {
$options = [
'Bucket' => $cos['bucket'],
'Key' => $key,
'Body' => $Body,
];
//水印
if ($watermarkOptions) {
$options['PicOperations'] = json_encode([
'is_pic_info' => 1,
'rules' => [
[
'fileid' => $key, // 使用相同的文件名保存
'rule' => $watermarkOptions,
]
]
]
], true);
], true);
}
$res = $cosClient->putObject($options);
@file_put_contents(storage_path('logs/upload_images'), var_export($res, true) . PHP_EOL, FILE_APPEND);
}catch (\Exception $e){
@file_put_contents(storage_path('logs/upload_images'), var_export($e->getMessage(), true) . PHP_EOL, FILE_APPEND);
return false;
}
$res = $cosClient->putObject($options);
return $key;
}
... ...