Browse Source

s3 add bucket

visuddhinanda 2 years ago
parent
commit
3bc5c4a35b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/Http/Controllers/OfflineIndexController.php

+ 4 - 2
app/Http/Controllers/OfflineIndexController.php

@@ -24,6 +24,8 @@ class OfflineIndexController extends Controller
             $fileInfo = RedisClusters::get('/offline/index');
             foreach ($fileInfo as $key => $file) {
                 $zipFile = $file['filename'];
+                $bucket = 'attachments-'.config('app.env');
+                $tmpFile =  "{$bucket}\{$zipFile}";
                 $url = array();
                 foreach (config('mint.server.cdn_urls') as $key => $cdn) {
                     $url[] = [
@@ -32,10 +34,10 @@ class OfflineIndexController extends Controller
                         ];
                 }
                 if (App::environment('local')) {
-                    $s3Link = Storage::url($zipFile);
+                    $s3Link = Storage::url($tmpFile);
                 }else{
                     try{
-                        $s3Link = Storage::temporaryUrl($zipFile, now()->addDays(1));
+                        $s3Link = Storage::temporaryUrl($tmpFile, now()->addDays(2));
                     }catch(\Exception $e){
                         Log::error('offline-index {Exception}',['exception'=>$e]);
                         continue;