xugenyuan

ref |> 新增OSSUploadManager

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -3,4 +3,6 @@ export { add } from "./src/main/ets/utils/Calc" @@ -3,4 +3,6 @@ export { add } from "./src/main/ets/utils/Calc"
3 export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils' 3 export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils'
4 4
5 // export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager" 5 // export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager"
6 -export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush"  
  6 +export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush"
  7 +
  8 +export { OSSUploadManager,OSSConfigSceneType,OSSFileType,OSSUploadResult } from "./src/main/ets/aliOSS/OSSUploadManager"
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 "wdBean": "file:../../features/wdBean", 14 "wdBean": "file:../../features/wdBean",
15 "wdRouter": "file:../../commons/wdRouter", 15 "wdRouter": "file:../../commons/wdRouter",
16 "wdTracking": "file:../../features/wdTracking", 16 "wdTracking": "file:../../features/wdTracking",
17 - "wdNetwork": "file:../../commons/wdNetwork" 17 + "wdNetwork": "file:../../commons/wdNetwork",
  18 + "wdossclient": "file:../../WdOssClientSdk/wdossclient"
18 } 19 }
19 } 20 }
  1 +import { WDOssClient } from 'wdossclient'
  2 +
  3 +export enum OSSConfigSceneType {
  4 + feedback = 1,
  5 +
  6 +}
  7 +
  8 +export enum OSSFileType {
  9 + image = 0,
  10 + video = 1,
  11 +}
  12 +
  13 +export class OSSUploadResult {
  14 + ossFile?: string
  15 +}
  16 +
  17 +export class OSSUploadManager {
  18 +
  19 + private accessKeyId?:string
  20 + private accessKeySecret?:string
  21 + private sessionToken?:string
  22 +
  23 + static uploadFile(fileUri: string, scene: OSSConfigSceneType, fileType: OSSFileType) : Promise<OSSUploadResult> {
  24 + return new Promise((success, fail) => {
  25 +
  26 + success({})
  27 + })
  28 + }
  29 +
  30 + upload(fileUri: string, endpoint:string, bucketName:string, objectName:string) : boolean {
  31 + if (!this.accessKeyId || !this.accessKeySecret || !this.sessionToken) {
  32 + return false
  33 + }
  34 + return WDOssClient.UploadFile(endpoint, this.accessKeyId, this.accessKeySecret, this.sessionToken, bucketName, objectName, fileUri)
  35 + }
  36 +
  37 +}