| import * as authServices from '@12333/services/apiV2/auth'; | 
|   | 
| type CacheData = { | 
|   data: API.OssSTSReponse; | 
|   time: number; | 
| }; | 
|   | 
| export class OssSTS { | 
|   private static refreshSTSTokenInterval = 20 * 60 * 1000; | 
|   private static cacheKey = 'ossSTSCacheKey'; | 
|   private static cache: { [key: string]: CacheData } = {}; | 
|   | 
|   static async getOssSTS() { | 
|     if (this.cache[this.cacheKey]) { | 
|       if (new Date().getTime() - this.cache[this.cacheKey].time < this.refreshSTSTokenInterval) { | 
|         return this.cache[this.cacheKey].data; | 
|       } | 
|     } | 
|   | 
|     let res = await authServices.getAliyunOSSAcs( | 
|       {}, | 
|       { | 
|         showLoading: false, | 
|       } | 
|     ); | 
|     this.cache[this.cacheKey] = { | 
|       data: res, | 
|       time: new Date().getTime(), | 
|     }; | 
|     return res; | 
|   } | 
| } |