Commit 6f9f6034 by yixinjj

获取日志添加消息回馈

1 parent cc99bb22
import { serializeIfObject } from '@/utils/utils.js'
export default class GetLogListWorker {
constructor() {}
work(deviceId, data, ws) {
......
import config from '@/config.js'
import { serializeIfObject } from '@/utils/utils.js'
import { serializeIfObject,deepClone } from '@/utils/utils.js'
export default class LogsWorker {
logFile = null
constructor() {
this.logFile = uni.$logger.local.logger
this.isUploading = false
this.files = []
}
getLogFileList() {
return this.logFile.getLogFileList()
......@@ -13,11 +14,12 @@ export default class LogsWorker {
if (this.isUploading) {
const msg = `日志上传中,请稍后再试!`
uni.$logger.local.info(msg)
// this.ws.send(msg)
this.ws.send(msg)
return
}
this.isUploading = true
const files = this.getLogFileList()
const files = this.getLogFileList()
this.files = JSON.stringify(files)
if (files?.length) {
files.sort((a, b) => a.name.localeCompare(b.name))
this.process(files, deviceId)
......@@ -29,7 +31,9 @@ export default class LogsWorker {
await this.post(file, deviceId)
setTimeout(() => this.process(files, deviceId), 500)
} else {
this.ws.send({ code: 200, msg: `日志上传完成 logs -> ${this.files}`})
this.isUploading = false
this.files=[]
}
}
post({ name, path }, deviceId) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!