2024-06-27 20:53:36 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import worker, { MessageEvents } from '@ohos.worker';
|
|
|
|
|
import zlib from '@ohos.zlib';
|
|
|
|
|
import request from '@ohos.request';
|
|
|
|
|
import type common from '@ohos.app.ability.common';
|
|
|
|
|
import ConvertXML from '@ohos.convertxml';
|
|
|
|
|
import xml from '@ohos.xml';
|
|
|
|
|
import hilog from '@ohos.hilog';
|
|
|
|
|
import { getDoubleCeneterTable, getSingleCenterTable } from '../common/service/indexService';
|
|
|
|
|
import { initTableParam } from '../pages/interfaces';
|
|
|
|
|
|
|
|
|
|
let workerPort = worker.workerPort;
|
|
|
|
|
|
|
|
|
|
workerPort.onmessage = (e: MessageEvents): void => {
|
|
|
|
|
let param:initTableParam = e.data;
|
|
|
|
|
console.log('baoyihu,onmessage',JSON.stringify(param))
|
|
|
|
|
if(param.mode=='1'){
|
|
|
|
|
//单中心
|
|
|
|
|
getSingleCenterTable(param).then((ret) => {
|
2024-08-14 17:26:27 +08:00
|
|
|
console.log('teststetfinsh1')
|
2024-06-27 20:53:36 +08:00
|
|
|
if (ret) {
|
|
|
|
|
workerPort.postMessage({ isComplete: true });
|
|
|
|
|
}else{
|
|
|
|
|
workerPort.postMessage({ isComplete: false });
|
2024-07-09 11:11:31 +08:00
|
|
|
|
2024-06-27 20:53:36 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else if(param.mode=='3'){
|
|
|
|
|
//双中心
|
|
|
|
|
getDoubleCeneterTable(param).then((ret)=>{
|
|
|
|
|
if (ret) {
|
|
|
|
|
workerPort.postMessage({ isComplete: true });
|
2024-07-09 11:11:31 +08:00
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
workerPort.postMessage({ isComplete: false });
|
|
|
|
|
|
2024-06-27 20:53:36 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// worker线程向主线程发送信息
|
|
|
|
|
//let context: common.UIAbilityContext = e.data.context;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// workerPort.postMessage({ isComplete: true, jsonStr: result });
|
|
|
|
|
|
|
|
|
|
};
|