Commit 801d8a32 by 前端

日志格式

1 parent 2cc44142
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48 * @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn * @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 * @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -148,12 +148,36 @@ export default { ...@@ -148,12 +148,36 @@ export default {
* @param {string} newFileName 新的文件名 * @param {string} newFileName 新的文件名
*/ */
RenameFile(oldFilePath, newFileName) { RenameFile(oldFilePath, newFileName) {
plus.io.resolveLocalFileSystemURL(oldFilePath, entry => { return new Promise((resolve, reject) => {
entry.getParent(_oldFile => { plus.io.resolveLocalFileSystemURL(
entry.moveTo(_oldFile, '/' + newFileName, newFilePath => { oldFilePath,
console.log('newFilePath', newFilePath.fullPath) 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 { ...@@ -228,11 +252,16 @@ export default {
oldFilePath = getPreAudioList[i] oldFilePath = getPreAudioList[i]
uni.$logger.local.info(`临时文件不存在,找到之前保存的文件${oldFilePath}`) 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 newFilePath = oldFilePath.replace(/(.+\/)(\d+\.mp3)/, '') + newFileName
const path = await utils.getFileSaveFolderOnClient() const path = await utils.getFileSaveFolderOnClient()
recordUrlList.push({ status: UPLOAD_STATUS.fail, file: path + newFilePath }) recordUrlList.push({ status: UPLOAD_STATUS.fail, file: path + newFilePath })
this.RenameFile(oldFilePath, newFileName)
} }
} catch (error) { } catch (error) {
recordUrlList = [] 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 { getTime } from './util'
import { serializeIfObject } from '@/utils/utils.js'
class LogCat { class LogCat {
main = plus.android.runtimeMainActivity() main = plus.android.runtimeMainActivity()
File = plus.android.importClass('java.io.File') File = plus.android.importClass('java.io.File')
...@@ -26,6 +33,9 @@ class LogCat { ...@@ -26,6 +33,9 @@ class LogCat {
//文件名 //文件名
let fileName = this.LogPath + '/' + date + '.txt' let fileName = this.LogPath + '/' + date + '.txt'
//写入的内容 //写入的内容
if (typeof msg == 'object') {
msg = JSON.stringify(msg)
}
let content = `${datetime} [${tag}] : ${msg}\n` let content = `${datetime} [${tag}] : ${msg}\n`
console.log(content.replace(/\n/g, '')) console.log(content.replace(/\n/g, ''))
let path = new this.File(this.LogPath) let path = new this.File(this.LogPath)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-10-14 17:38:35 * @Date: 2024-10-14 17:38:35
* @LastEditors: 前端 qianduan01@didihu.com.cn * @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 * @FilePath: \gl-tape\utils\recordManager\interruptRecord.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -52,6 +52,7 @@ class InterruptRecord extends RecordManager { ...@@ -52,6 +52,7 @@ class InterruptRecord extends RecordManager {
uni.$logger.local.info(`删除待提交的记录${id}`) uni.$logger.local.info(`删除待提交的记录${id}`)
this.removeRecord(id) this.removeRecord(id)
storageApi.setRecords('', 'preRecordId') storageApi.setRecords('', 'preRecordId')
clearInterval(Interval)
} }
/** /**
* 初始化保存记录 * 初始化保存记录
...@@ -66,7 +67,6 @@ class InterruptRecord extends RecordManager { ...@@ -66,7 +67,6 @@ class InterruptRecord extends RecordManager {
return return
} }
const pathName = await this.getAudioPathName() const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName) const audioPath = await this.getAudioPath(pathName)
this.audioPath = audioPath this.audioPath = audioPath
const id = utils.uuid() const id = utils.uuid()
...@@ -128,6 +128,7 @@ class InterruptRecord extends RecordManager { ...@@ -128,6 +128,7 @@ class InterruptRecord extends RecordManager {
this.updateAudio() this.updateAudio()
const pathName = await this.getAudioPathName() const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName) const audioPath = await this.getAudioPath(pathName)
this.audioPath = audioPath
this.records.audioPath.push(audioPath) this.records.audioPath.push(audioPath)
const records = this.getPreRecord() const records = this.getPreRecord()
const params = { ...records, ...this.records } const params = { ...records, ...this.records }
...@@ -143,6 +144,7 @@ class InterruptRecord extends RecordManager { ...@@ -143,6 +144,7 @@ class InterruptRecord extends RecordManager {
if (isRemoveId) { if (isRemoveId) {
uni.$logger.local.info(`清除正在接待记录的id`) uni.$logger.local.info(`清除正在接待记录的id`)
storageApi.setRecords('', 'preRecordId') storageApi.setRecords('', 'preRecordId')
clearInterval(Interval)
} }
const updateParams = { ...this.records, ...params } const updateParams = { ...this.records, ...params }
console.log(updateParams, 'updateParams') 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!