chenqp 8 months ago
parent
commit
95213a4eaf
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app/Service/OssService.php

+ 5 - 4
app/Service/OssService.php

@@ -90,21 +90,22 @@ class OssService extends Service
         }
 
         $url = "";
+        $timestamp = $timeStamp + $expired;
         if(! file_exists($localFilePath)){
-            $url = $this->createUrl($objectKey);
+            $url = $this->createUrl($objectKey,$expired);
             $set = [
                 'url' => $url,
-                'timestamp' => $timeStamp + $expired,
+                'timestamp' => $timestamp,
             ];
             file_put_contents($localFilePath, json_encode($set));
         }else{
             $content = file_get_contents($localFilePath);
             $content = json_decode($content,true);
             if($content['timestamp'] < $timeStamp){
-                $url = $this->createUrl($objectKey);
+                $url = $this->createUrl($objectKey,$expired);
                 $set = [
                     'url' => $url,
-                    'timestamp' => $timeStamp + $expired,
+                    'timestamp' => $timestamp,
                 ];
                 file_put_contents($localFilePath, json_encode($set));
             }else{