Commit 801d8a32 by 前端

日志格式

1 parent 2cc44142
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-11-18 11:21:51
* @LastEditTime: 2024-11-19 09:38:34
* @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -148,12 +148,36 @@ export default {
* @param {string} newFileName 新的文件名
*/
RenameFile(oldFilePath, newFileName) {
plus.io.resolveLocalFileSystemURL(oldFilePath, entry => {
entry.getParent(_oldFile => {
entry.moveTo(_oldFile, '/' + newFileName, newFilePath => {
console.log('newFilePath', newFilePath.fullPath)
})
})
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
oldFilePath,
entry => {
console.log(111)
entry.getParent(
_oldFile => {
console.log(222)
entry.moveTo(
_oldFile,
'/' + newFileName,
newFilePath => {
resolve()
uni.$logger.local.info(`文件重命名成功!${newFilePath.fullPath}`)
// console.log('newFilePath', newFilePath.fullPath)
},
() => {
reject()
}
)
},
() => {
reject()
}
)
},
() => {
reject()
}
)
})
},
......@@ -228,11 +252,16 @@ export default {
oldFilePath = getPreAudioList[i]
uni.$logger.local.info(`临时文件不存在,找到之前保存的文件${oldFilePath}`)
}
const newFileName = String(phone).slice(-4) + '_' + oldFilePath.replace(/.+\/(\d+\.mp3)/, '$1')
let newFileName = String(phone).slice(-4) + '_' + oldFilePath.replace(/.+\/(\d+\.mp3)/, '$1')
try {
await this.RenameFile(oldFilePath, newFileName)
} catch {
uni.$logger.local.error(`${newFileName}文件重命名失败`)
newFileName = oldFilePath.replace(/.+\/(\d+\.mp3)/, '$1')
}
const newFilePath = oldFilePath.replace(/(.+\/)(\d+\.mp3)/, '') + newFileName
const path = await utils.getFileSaveFolderOnClient()
recordUrlList.push({ status: UPLOAD_STATUS.fail, file: path + newFilePath })
this.RenameFile(oldFilePath, newFileName)
}
} catch (error) {
recordUrlList = []
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-11-01 15:06:40
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-11-19 09:25:11
* @FilePath: \gl-tape\utils\logger\LogCat.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { getTime } from './util'
import { serializeIfObject } from '@/utils/utils.js'
class LogCat {
main = plus.android.runtimeMainActivity()
File = plus.android.importClass('java.io.File')
......@@ -26,6 +33,9 @@ class LogCat {
//文件名
let fileName = this.LogPath + '/' + date + '.txt'
//写入的内容
if (typeof msg == 'object') {
msg = JSON.stringify(msg)
}
let content = `${datetime} [${tag}] : ${msg}\n`
console.log(content.replace(/\n/g, ''))
let path = new this.File(this.LogPath)
......@@ -33,7 +43,7 @@ class LogCat {
path.mkdirs() //创建父路径
}
let fos = null
let bw = null
let bw = null
try {
fos = new this.FileOutputStream(fileName, true)
bw = new this.BufferedWriter(new this.OutputStreamWriter(fos))
......
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-10-14 17:38:35
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-11-18 11:31:35
* @LastEditTime: 2024-11-19 09:35:24
* @FilePath: \gl-tape\utils\recordManager\interruptRecord.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -52,6 +52,7 @@ class InterruptRecord extends RecordManager {
uni.$logger.local.info(`删除待提交的记录${id}`)
this.removeRecord(id)
storageApi.setRecords('', 'preRecordId')
clearInterval(Interval)
}
/**
* 初始化保存记录
......@@ -66,7 +67,6 @@ class InterruptRecord extends RecordManager {
return
}
const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
this.audioPath = audioPath
const id = utils.uuid()
......@@ -128,6 +128,7 @@ class InterruptRecord extends RecordManager {
this.updateAudio()
const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
this.audioPath = audioPath
this.records.audioPath.push(audioPath)
const records = this.getPreRecord()
const params = { ...records, ...this.records }
......@@ -143,6 +144,7 @@ class InterruptRecord extends RecordManager {
if (isRemoveId) {
uni.$logger.local.info(`清除正在接待记录的id`)
storageApi.setRecords('', 'preRecordId')
clearInterval(Interval)
}
const updateParams = { ...this.records, ...params }
console.log(updateParams, 'updateParams')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!