diff --git a/src/app/babylon/controller/serve-manager.ts b/src/app/babylon/controller/serve-manager.ts index 0ad6725..020deca 100644 --- a/src/app/babylon/controller/serve-manager.ts +++ b/src/app/babylon/controller/serve-manager.ts @@ -1,6 +1,5 @@ import { HttpErrorResponse } from "@angular/common/http"; import { classToPlain } from "class-transformer"; -import { PlanComponent } from "src/app/pages/plan/plan.component"; import { BuildingBasicInfosService } from "src/app/service/babylon/building-basic-infos.service"; import { ObjectsService } from "src/app/service/objects.service"; import { InsitutionDataSimple } from "../model/data/institution/institution-data-simple"; @@ -34,6 +33,7 @@ export class ServeManager { ) => void, onError?: (key: string, error: any) => void) { this.buildingBISrv.getBuildingBasicInfos(key) .subscribe(data => { + console.log("得到单位信息" + key, data); if (onSuccess) { onSuccess(key, JSON.parse((data as any).result)); } diff --git a/src/app/service/objects.service.ts b/src/app/service/objects.service.ts index af4280a..c983d62 100644 --- a/src/app/service/objects.service.ts +++ b/src/app/service/objects.service.ts @@ -27,7 +27,7 @@ enum EnvironmentType { export class ObjectsService { static readonly c_apiRoot = "/api/Objects/";//普通上传的API根路径 - static apiRoot_Multipart = "/api/";//分块上传的API根路径 + static readonly c_apiRoot_Multipart = "/api/";//分块上传的API根路径 /** * 当前所处环境(打包前根据需要设置) @@ -88,7 +88,7 @@ export class ObjectsService { // return this.http.post(ObjectsService.baseUrl + extensionPath, formData); let data = { keepOriginalName: 'true', filename: file.name } return new Promise((resolve, reject) => { - this.http.post(ObjectsService.apiRoot_Multipart + "NewMultipartUpload/" + this.getBucketName() + extensionPath, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传 + this.http.post(ObjectsService.c_apiRoot_Multipart + "NewMultipartUpload/" + this.getBucketName() + extensionPath, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传 let instance = this; let objectName = data.objectName let uploadId = data.uploadId @@ -107,7 +107,7 @@ export class ObjectsService { //同步写法实现异步调用 let result = await new Promise((resolve, reject) => { // await 需要后面返回一个 promise 对象 - this.http.post(ObjectsService.apiRoot_Multipart + `MultipartUpload/${instance.getBucketName()}${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { + this.http.post(ObjectsService.c_apiRoot_Multipart + `MultipartUpload/${instance.getBucketName()}${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { let msg = { "partNumber": data.partNumber || null, "eTag": data.eTag || null } resolve(msg) // 调用 promise 内置方法处理成功 }) @@ -117,7 +117,7 @@ export class ObjectsService { if (PartNumberETag.length === allSlice) { //分块上传完成 let data = PartNumberETag let paramsData = { uploadId: uploadId }; - let path = ObjectsService.apiRoot_Multipart + `CompleteMultipartUpload/${instance.getBucketName()}` + objectName; + let path = ObjectsService.c_apiRoot_Multipart + `CompleteMultipartUpload/${instance.getBucketName()}` + objectName; this.http.post(path, data, { params: paramsData }).subscribe(data => { let objData: any = new Object(); objData.fileName = file.name;