|
@@ -6,6 +6,7 @@ use App\Enums\Common\Code; |
|
@@ -6,6 +6,7 @@ use App\Enums\Common\Code; |
|
6
|
use App\Http\Controllers\Controller;
|
6
|
use App\Http\Controllers\Controller;
|
|
7
|
use App\Http\Controllers\type;
|
7
|
use App\Http\Controllers\type;
|
|
8
|
use App\Models\File\Image as ImageModel;
|
8
|
use App\Models\File\Image as ImageModel;
|
|
|
|
9
|
+use App\Services\CosService;
|
|
9
|
use App\Services\TencentCosService;
|
10
|
use App\Services\TencentCosService;
|
|
10
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
11
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
11
|
use Illuminate\Http\JsonResponse;
|
12
|
use Illuminate\Http\JsonResponse;
|
|
@@ -139,7 +140,7 @@ class ImageController extends Controller |
|
@@ -139,7 +140,7 @@ class ImageController extends Controller |
|
139
|
* @method :post
|
140
|
* @method :post
|
|
140
|
* @time :2023/6/17 16:30
|
141
|
* @time :2023/6/17 16:30
|
|
141
|
*/
|
142
|
*/
|
|
142
|
- public function single($files){
|
143
|
+ public function single($files,$url){
|
|
143
|
$hash = hash_file('md5', $files->getPathname());
|
144
|
$hash = hash_file('md5', $files->getPathname());
|
|
144
|
//查看文件是否存在
|
145
|
//查看文件是否存在
|
|
145
|
$imageModel = new ImageModel();
|
146
|
$imageModel = new ImageModel();
|
|
@@ -165,6 +166,8 @@ class ImageController extends Controller |
|
@@ -165,6 +166,8 @@ class ImageController extends Controller |
|
165
|
if ($rs === false) {
|
166
|
if ($rs === false) {
|
|
166
|
return $this->response('添加失败', Code::USER_ERROR);
|
167
|
return $this->response('添加失败', Code::USER_ERROR);
|
|
167
|
}
|
168
|
}
|
|
|
|
169
|
+ $cosService = new CosService();
|
|
|
|
170
|
+ $cosService->uploadFile($files,$this->path,$fileName);
|
|
168
|
return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]);
|
171
|
return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]);
|
|
169
|
}
|
172
|
}
|
|
170
|
|
173
|
|