作者 lyh

gx

@@ -334,4 +334,21 @@ class FileController @@ -334,4 +334,21 @@ class FileController
334 ]; 334 ];
335 return $data; 335 return $data;
336 } 336 }
  337 +
  338 + /**
  339 + * @remark :获取下载链接
  340 + * @name :getDownloadUrl
  341 + * @author :lyh
  342 + * @method :post
  343 + * @time :2023/7/26 14:00
  344 + */
  345 + public function getDownloadUrl(){
  346 + $fileModel = new File();
  347 + $info = $fileModel->read(['hash' => $this->param['hash']]);
  348 + if ($info === false) {
  349 + $this->response('指定文件不存在!', Code::USER_ERROR);
  350 + }
  351 + $data = ['file_download'=>url('a/downLoad/files?hash='.$this->param['hash'])];
  352 + $this->response('success',Code::SUCCESS,$data);
  353 + }
337 } 354 }
@@ -61,9 +61,6 @@ class ImageController extends Controller @@ -61,9 +61,6 @@ class ImageController extends Controller
61 } 61 }
62 62
63 /** 63 /**
64 - * @param $hash  
65 - * @param $w  
66 - * @param $h  
67 * @name :index 64 * @name :index
68 * @author :lyh 65 * @author :lyh
69 * @method :post 66 * @method :post
@@ -378,4 +375,21 @@ class ImageController extends Controller @@ -378,4 +375,21 @@ class ImageController extends Controller
378 ]; 375 ];
379 return $data; 376 return $data;
380 } 377 }
  378 +
  379 + /**
  380 + * @remark :获取下载链接
  381 + * @name :getDownloadUrl
  382 + * @author :lyh
  383 + * @method :post
  384 + * @time :2023/7/26 14:00
  385 + */
  386 + public function getDownloadUrl(){
  387 + $imageModel = new ImageModel();
  388 + $info = $imageModel->read(['hash' => $this->param['hash']]);
  389 + if ($info === false) {
  390 + $this->response('指定文件不存在!', Code::USER_ERROR);
  391 + }
  392 + $data = ['image_download'=>url('a/downLoad/images?hash='.$this->param['hash'])];
  393 + $this->response('success',Code::SUCCESS,$data);
  394 + }
381 } 395 }
@@ -188,11 +188,13 @@ Route::middleware(['aloginauth'])->group(function () { @@ -188,11 +188,13 @@ Route::middleware(['aloginauth'])->group(function () {
188 }); 188 });
189 //图片操作 189 //图片操作
190 Route::prefix('images')->group(function () { 190 Route::prefix('images')->group(function () {
191 - Route::post('/upload', [\App\Http\Controllers\File\ImageController::class, 'upload'])->name('image_upload'); 191 + Route::post('/upload', [\App\Http\Controllers\File\ImageController::class, 'upload'])->name('images_upload');
  192 + Route::post('/getDownloadUrl', [\App\Http\Controllers\File\ImageController::class, 'getDownloadUrl'])->name('images_getDownloadUrl');
192 }); 193 });
193 //文件操作 194 //文件操作
194 Route::prefix('files')->group(function () { 195 Route::prefix('files')->group(function () {
195 Route::post('/upload', [\App\Http\Controllers\File\FileController::class, 'upload'])->name('files_upload'); 196 Route::post('/upload', [\App\Http\Controllers\File\FileController::class, 'upload'])->name('files_upload');
  197 + Route::post('/getDownloadUrl', [\App\Http\Controllers\File\FileController::class, 'getDownloadUrl'])->name('files_getDownloadUrl');
196 }); 198 });
197 //谷歌流量系统 199 //谷歌流量系统
198 Route::prefix('projects')->group(function () { 200 Route::prefix('projects')->group(function () {
@@ -208,10 +208,10 @@ Route::middleware(['bloginauth'])->group(function () { @@ -208,10 +208,10 @@ Route::middleware(['bloginauth'])->group(function () {
208 }); 208 });
209 209
210 //文件操作 210 //文件操作
211 - Route::prefix('file')->group(function () {  
212 - Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload');  
213 - Route::get('/lists', [\App\Http\Controllers\Bside\FileController::class, 'lists'])->name('file_lists');  
214 - }); 211 +// Route::prefix('file')->group(function () {
  212 +// Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload');
  213 +// Route::get('/lists', [\App\Http\Controllers\Bside\FileController::class, 'lists'])->name('file_lists');
  214 +// });
215 //图片操作 215 //图片操作
216 Route::prefix('images')->group(function () { 216 Route::prefix('images')->group(function () {
217 Route::post('/upload', [\App\Http\Controllers\File\ImageController::class, 'upload'])->name('image_upload'); 217 Route::post('/upload', [\App\Http\Controllers\File\ImageController::class, 'upload'])->name('image_upload');
@@ -337,5 +337,4 @@ Route::group([], function () { @@ -337,5 +337,4 @@ Route::group([], function () {
337 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); 337 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login');
338 Route::any('/stringTranslation', [\App\Http\Controllers\Bside\ComController::class, 'stringTranslation'])->name('com_stringTranslation'); 338 Route::any('/stringTranslation', [\App\Http\Controllers\Bside\ComController::class, 'stringTranslation'])->name('com_stringTranslation');
339 Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms'); 339 Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms');
340 - Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download');  
341 }); 340 });