Commit 02f63dd1 by Lin

Merge branch 'saas+v5.8.3' of http://192.168.3.233:8090/glsx/gl_tape into saas+v5.8.3

2 parents 261278ae f649d80d
......@@ -1423,7 +1423,7 @@ export default {
}
.result-head.question-content-head {
height: 53px;
padding: 16px 24px;
padding: 28px 24px 16px 24px;
align-items: center;
flex-shrink: 0;
}
......
......@@ -222,8 +222,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
},
{
label: '到店日期',
valueKey: 'inviteDate',
key: 'inviteDate',
valueKey: 'arrivalDate',
key: 'arrivalDate',
type: 'date'
},
{
......@@ -264,9 +264,7 @@ export default {
customerInfo: {},
startDate: '',
endDate: '',
validateState: true,
employeeSelectKey: '',
inviteDateTouched: false
validateState: true
}
},
onLoad (options) {
......@@ -297,15 +295,10 @@ export default {
arrivalDate: '',
receptionSceneName: '',
standNo: '',
employeeName: '',
userId: '',
merchantName: '',
sellerName: '',
sellerUserId: '',
inviteDate: '',
residentSaleName: '',
residentSaleId: '',
filingDate: ''
}
this.inviteDateTouched = false
if (this.customerId) this.findVisitsInfo()
},
async findVisitsInfo () {
......@@ -313,10 +306,8 @@ export default {
id: this.customerId
})
if (res.arrivalDate) res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD")
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD")
this.customerInfo = res
this.inviteDateTouched = !!res.inviteDate
},
backPage () {
uni.navigateBack({
......@@ -349,14 +340,7 @@ export default {
}
},
bindDateChange (e, valueKey) {
const value = e.detail.value
this.customerInfo[valueKey] = value
if (valueKey === 'arrivalDate' && !this.inviteDateTouched) {
this.customerInfo.inviteDate = value
}
if (valueKey === 'inviteDate') {
this.inviteDateTouched = true
}
this.customerInfo[valueKey] = e.detail.value
},
inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo
......@@ -432,8 +416,6 @@ export default {
merchantId:params.merchantId,
employeeName:params.employeeName,
sellerMerchantId:params.sellerMerchantId,
sellerUserId: params.sellerUserId,
sellerName: customerInfo.sellerName,
preliminaryOrders: [
{
sceneType:1,
......@@ -447,10 +429,8 @@ export default {
carSeriesId:params.carTypeId,
carSeriesName:params.carTypeName,
deliveryDate: params.arrivalDate ? params.arrivalDate + ' 00:00:00' : params.arrivalDate, //交付日期
inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期
createdDate: params.filingDate, //建档日期
sellerUserld: params.sellerUserId,
sellerName: customerInfo.sellerName,
inviteDate: params.filingDate ? params.filingDate + ' 00:00:00' : params.filingDate, //到店日期
createdDate: params.filingDate ? params.filingDate + ' 00:00:00' : params.filingDate, //建档日期
}
]
}
......
......@@ -50,7 +50,6 @@
placeholder="请选择"
placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done"
@blur="inputBlur($event, i)"
/>
</template>
<template v-else-if="i.type == 'date'">
......@@ -95,7 +94,6 @@
placeholder="请选择"
placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done"
@blur="inputBlur($event, i)"
/>
</template>
<template v-else-if="i.type == 'date'">
......@@ -215,7 +213,6 @@
import dayjs from 'dayjs'
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue'
import Employee from '@/components/Employee.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{
......@@ -366,8 +363,7 @@
customerInfo: {},
groupMemberList: [],
startDate: '',
endDate: '',
validateState: true
endDate: ''
}
},
onLoad (options) {
......@@ -410,73 +406,16 @@
}
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm)
},
async submitCustomerProfileAPI(options = {}) {
const { fromReception = false } = options
try {
this.customerForm.forEach(e => {
e.error = false
})
const { customerInfo, customerForm } = this
customerForm.forEach(e => {
if (e.required && !customerInfo[e.key]) throw e.key
})
if (!phoneRex.test(customerInfo.customerPhone)) throw 'customerPhone'
} catch (error) {
const index = this.customerForm.findIndex(e => e.key == error)
if (index !== -1) {
this.customerForm[index].error = true
}
return false
}
const carVin = this.customerInfo.standNo
if (carVin) {
this.customerInfo.standNo = formatVinInput(carVin)
if (this.customerInfo.standNo.length !== 17) {
uni.showToast({
title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',
icon: 'none'
})
return false
}
if (!this.validateState) {
uni.showToast({
title: '车架号校验不匹配,请核对后重新输入',
icon: 'none'
})
return false
}
}
const requestParams = {
id: this.customerInfo.id,
customerName: this.customerInfo.customerName,
carBrand: this.customerInfo.carBrand,
carBrandId: this.customerInfo.carBrandId,
carChildsBrandName: this.customerInfo.carChildsBrandName,
carChildsBrandId: this.customerInfo.carChildsBrandId,
carSeriesName: this.customerInfo.carSeriesName,
carSeriesId: this.customerInfo.carSeriesId,
deliveryDate: this.formatDateTime(this.customerInfo.deliveryDate),
createdDate: this.formatDateTime(this.customerInfo.createdDate),
inviteDate: this.formatDateTime(this.customerInfo.inviteDate),
merchantId: this.customerInfo.merchantId,
merchantName: this.customerInfo.merchantName,
userId: this.customerInfo.userId,
employeeName: this.customerInfo.employeeName,
remark: this.customerInfo.remark,
advanceUserId: this.customerInfo.advanceUserId,
advanceUserName: this.customerInfo.advanceUserName,
qwGroupId: this.customerInfo.qwGroupId,
qwGroupName: this.customerInfo.qwGroupName,
wxId: this.customerInfo.contact_id,
wxName: this.customerInfo.contact_name,
standNo:this.customerInfo.standNo,
}
console.log('submitCustomerProfileAPI***',requestParams)
uni.showLoading({
mask: true
})
const res = await uni.$api.customerApi.submitCustomerProfileAPI(requestParams),
_this = this
async submitCustomerProfileAPI() {
// carModel:问界M7,
// carModelId: 1149147,
// carBrand:AITO 问界,
// carBrandId:3454,
// oneCarBrand:鸿蒙智行,
// oneCarBrandId:2978
let requestParams = this.customerInfo
console.log('submitCustomerProfileAPI***', requestParams)
const res = await uni.$api.customerApi.submitCustomerProfileAPI(requestParams)
console.log('submitCustomerProfileAPI***', res)
},
async getCustomerGroupInfo() {
......@@ -529,7 +468,6 @@
deliveryDate: '',
receptionSceneName: '',
standNo: '',
inviteDate: '',
createdDate: '',
employeeName: '',
userId: '',
......@@ -599,26 +537,6 @@
bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value
},
inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo
if (val.key === 'standNo' && standNoVal) {
this.customerInfo.standNo = formatVinInput(standNoVal)
validateVin(this.customerInfo.standNo)
.then(result => {
const { valid } = result.data
this.validateState = valid
})
.catch(() => {
this.validateState = false
})
} else if (val.key === 'standNo') {
this.validateState = true
}
},
formatDateTime (value) {
if (!value) return value
return dayjs(value).format('YYYY-MM-DD HH:mm:ss')
},
async submit () {
this.submitCustomerProfileAPI()
try {
......
......@@ -71,7 +71,7 @@ export default {
staffUuid: uni.$storage.get('userInfo').uuid,
staffName: uni.$storage.get('userInfo').name,
merchantId: String(uni.$storage.get('userInfo').merchantId ?? ''),
entrySource: '',
entrySource: 'home_popup',
skipCount: 0,
},
pendingAppBackTimer: null,
......@@ -736,36 +736,6 @@ export default {
// #endif
},
async back() {
if (this.prelearnContext.entrySource === 'package_detail') {
await this.backFromPackageDetail()
return
}
await this.backFromHomePopup()
},
async backFromPackageDetail() {
try {
const res = await uni.$api.activityApi.getPrelearnScriptBoardAPI({
activityId: this.prelearnContext.activityId || this.goodsInfo.activityId,
activityProductId: this.prelearnContext.activityProductId || this.goodsInfo.productId,
})
console.log('[prelearnBridge] getPrelearnScriptBoardAPI res:', res)
if (Number(res?.staffLearnStatus) === 1) {
this.navigateBack()
return
}
if (res?.activityId != null) {
this.prelearnContext.activityId = String(res.activityId)
}
this.prelearnContext.skipCount = res?.remainingSkipCount ?? 0
this.showBackPopup = true
} catch (error) {
console.error('[prelearnBridge] 预学习返回剧本状态查询失败:', error)
this.showBackPopup = true
}
},
async backFromHomePopup() {
try {
const res = await uni.$api.commonApi.getPrelernHomePopupAPI()
console.log('[prelearnBridge] getPrelernHomePopupAPI res:', res)
......
......@@ -49,6 +49,7 @@ class AudioRecorder() {
// 定义错误码常量
companion object {
private const val TAG = "uni-recorder-x"
const val ERROR_RECORDING_IN_PROGRESS = 1001
const val ERROR_NO_SUPPORTED_SAMPLE_RATE = 1107602
const val ERROR_BUFFER_SIZE_CALCULATION_FAILED = 1107603
......@@ -151,7 +152,7 @@ class AudioRecorder() {
} else {
this.filePath = null
}
Log.d("AudioRecorder", "File path set to: $filePath")
Log.i(TAG, "startRecording: format=$format, saveToFile=$saveToFile, path=$filePath")
// 检测并调整采样率
......@@ -286,6 +287,7 @@ class AudioRecorder() {
}
}
} catch (e: IOException) {
Log.e(TAG, "write failed: path=$filePath, ${e.message}")
notifyError(ERROR_FILE_WRITE_FAILED, "录音过程中写入文件出错: ${e.message}")
} finally {
// 清理资源
......@@ -554,6 +556,10 @@ class AudioRecorder() {
}
audioRecord = null
val savedPath = filePath
val fileSize = savedPath?.let { File(it).takeIf { f -> f.exists() }?.length() } ?: -1L
Log.i(TAG, "stopRecording: path=$savedPath, size=$fileSize bytes")
mainHandler.post {
recordingListener?.onRecordingStopped()
}
......
......@@ -8,6 +8,8 @@ import Base64 from "android.util.Base64";
export { RecorderManagerFailImpl }
const LOG_TAG = '[uni-recorder-x]'
// NOTE 避免被 vue Proxy 污染
const DEFAULT_DURATION = 1000 * 60
const MAX_DURATION = DEFAULT_DURATION * 10
......@@ -75,7 +77,9 @@ class RecorderManagerImpl implements RecorderManager, RecordingListener, AudioDa
this.manager.setRecordingListener(this)
this.manager.setAudioDataListener(this)
this.manager.setMaxRecordingDuration(options.duration!.toLong())
this.manager.startRecording(format, createFile(options.format! as string, options.saveDir))
const filePath = createFile(options.format! as string, options.saveDir)
console.log(`${LOG_TAG} start: format=${options.format}, sampleRate=${options.sampleRate}, channels=${options.numberOfChannels}, filePath=${filePath}`)
this.manager.startRecording(format, filePath)
}
// override pause() : void {
// this.manager.pauseRecording()
......@@ -84,6 +88,7 @@ class RecorderManagerImpl implements RecorderManager, RecordingListener, AudioDa
// this.manager.resumeRecording()
// }
override stop() {
console.log(`${LOG_TAG} stop: filePath=${this.manager.getFilePath()}`)
this.manager.stopRecording()
}
......@@ -151,11 +156,15 @@ class RecorderManagerImpl implements RecorderManager, RecordingListener, AudioDa
// }
override onRecordingStarted() {
let res = new RecorderManagerOnStartResultCallback(this.manager.getFilePath()!)
const filePath = this.manager.getFilePath()!
console.log(`${LOG_TAG} onStart: filePath=${filePath}`)
let res = new RecorderManagerOnStartResultCallback(filePath)
this.startCallback?.(res)
}
override onRecordingStopped() {
this.stopCallback?.(new RecorderManagerOnStopResultCallback(this.manager.getFilePath()!))
const filePath = this.manager.getFilePath()!
console.log(`${LOG_TAG} onStop: filePath=${filePath}`)
this.stopCallback?.(new RecorderManagerOnStopResultCallback(filePath))
}
override onRecordingPaused() {
// this.pauseCallback?.("")
......@@ -164,6 +173,7 @@ class RecorderManagerImpl implements RecorderManager, RecordingListener, AudioDa
// this.resumeCallback?.("")
}
override onRecordingError(errorCode : Int, errorMessage : String) {
console.log(`${LOG_TAG} onError: code=${errorCode}, msg=${errorMessage}`)
var error : IRecorderManagerFail
if ([1107601, 1107602, 1107603, 1107604, 1107605, 1107606, 1107607, 1107608].indexOf(errorCode) >= 0) {
error = new RecorderManagerFailImpl(errorCode, RecorderManagerUniErrors[errorCode]!)
......
......@@ -11,10 +11,13 @@ export interface StateChangeRes extends RecorderManagerOnStopResult {
export function onRecorderStateChange(state : RecorderState, res ?: StateChangeRes) : void {
}
const LOG_TAG = '[uni-recorder-x]'
export function createFile( format : string, saveDir ?: string | null) : string {
var dirPath : string
if (saveDir != null && saveDir!.length > 0) {
dirPath = saveDir!
console.log(`${LOG_TAG} createFile: 使用自定义目录 saveDir=${saveDir}`)
} else {
let context = UTSAndroid.getAppContext()
var parentPath = UTSAndroid.getAppCachePath()
......@@ -33,6 +36,8 @@ export function createFile( format : string, saveDir ?: string | null) : string
}
const random = UUID.randomUUID().toString().replace(/-/g, '').substring(0, 8)
const fileName = `${Date.now()}_${random}.${format.toLocaleLowerCase()}`
return `${dir.path}/${fileName}`
const filePath = `${dir.path}/${fileName}`
console.log(`${LOG_TAG} createFile: 生成录音文件 path=${filePath}`)
return filePath
}
export const supportFormats = ['aac']
......@@ -67,6 +67,7 @@ typealias UniAudioRecorderErrorEventCallback = (_ result: IRecorderManagerFail)
public class UniAudioRecorderManager: NSObject, RecorderManager {
public static var shared = UniAudioRecorderManager()
private let logTag = "[uni-recorder-x]"
private var audioRecorder: AVAudioRecorder?
......@@ -150,6 +151,7 @@ public class UniAudioRecorderManager: NSObject, RecorderManager {
public func stop() {
if let isRecording = audioRecorder?.isRecording, (isRecording || isPaused) {
let savedPath = audioRecorder?.url.path ?? ""
audioRecorder?.stop()
stopDisplayLink()
......@@ -157,7 +159,8 @@ public class UniAudioRecorderManager: NSObject, RecorderManager {
result.tempFilePath = audioRecorder?.url.absoluteString ?? ""
dispatchStopEvent(event:.stop , result: result)
print("录音已完成,文件保存在: \(audioRecorder?.url.absoluteString ?? "未知路径")")
let fileSize = (try? FileManager.default.attributesOfItem(atPath: savedPath)[.size] as? Int64) ?? -1
print("\(logTag) stop: path=\(savedPath), size=\(fileSize) bytes")
audioRecorder = nil
}
}
......@@ -292,6 +295,7 @@ extension UniAudioRecorderManager {
]
let fileURL = getAudioRecorderFileURL()
print("\(logTag) start: format=\(audioFormat.rawValue), sampleRate=\(sampleRate), channels=\(channels), path=\(fileURL.path)")
audioRecorder = try AVAudioRecorder(url: fileURL, settings: settings)
audioRecorder?.delegate = self
audioRecorder?.isMeteringEnabled = true
......@@ -328,7 +332,7 @@ extension UniAudioRecorderManager {
} catch {
failedAction(1107604, errMsg: error.localizedDescription)
print("录音启动失败: \(error.localizedDescription)")
print("\(logTag) start failed: \(error.localizedDescription)")
}
}
......@@ -363,7 +367,9 @@ extension UniAudioRecorderManager {
}
let random = UUID().uuidString.replacingOccurrences(of: "-", with: "").prefix(8)
let fileName = Date().timeIntervalSince1970.toString() + "_" + random + "." + suffixName
return recordPath.appendingPathComponent(fileName)
let fileURL = recordPath.appendingPathComponent(fileName)
print("\(logTag) createFile: path=\(fileURL.path)")
return fileURL
}
private func ensureDirExist(_ path: String) {
......
......@@ -39,6 +39,7 @@ class AudioManager {
onFrameRecordedEnd,
}
this.startOptions.saveDir = saveDir
uni.$logger.local.info(`【接待录音】AudioManager初始化: saveDir=${saveDir}`)
}
on() {
// 使用策略工厂获取录音管理器实例
......@@ -57,6 +58,7 @@ class AudioManager {
* 此方法用于初始化录音过程,它将配置参数应用到录音管理器,并开始录音
*/
start() {
uni.$logger.local.info(`【接待录音】开启录音: saveDir=${this.startOptions.saveDir}, format=${this.startOptions.format}`)
uni.$logger.local.info('〖录音管理Audio〗 == 开启录音 ')
this.recorderManager.start(this.startOptions)
}
......@@ -100,6 +102,8 @@ class AudioManager {
* 然后调用events对象上的onStop方法处理具体的停止录音逻辑
*/
async onStop(res) {
const filePath = res?.tempFilePath || res?.filePath || ''
uni.$logger.local.info(`【接待录音】停止录音回调: filePath=${filePath}`)
uni.$logger.local.info('〖录音管理Audio〗 == 停止录音回调 ')
await this.events.onStop(res)
}
......
......@@ -187,6 +187,8 @@ class FileUploadManager {
*/
async uploadRecord(record, callback) {
try {
const fullPath = (record.filePath || '') + (record.fileName || '')
uni.$logger.local.info(`【接待录音】上传前: recordId=${record.recordId}, fullPath=${fullPath}, status=${record.status}`)
uni.$logger.local.info(`[FileUploadManager] 开始上传文件: ${record.fileName}`)
// 处理无文件或文件不存在的情况
if (record.status === FileStatus.NoFile || record.status === FileStatus.NotExist) {
......
......@@ -20,11 +20,14 @@ class NativeSave extends TempRecord {
* @returns {Promise<void>}
*/
async add(audio) {
const filePath = audio?.filePath || audio?.tempFilePath || ''
uni.$logger.local.info(`【接待录音】NativeSave.add: filePath=${filePath}`)
uni.$logger.local.info('〖NativeSave〗 == add called with: ' + audio?.filePath)
// 创建一个新的记录对象
const recordUrlList = audio && audio.filePath ? [{ file: audio.filePath }] : []
// 调用基类通用流程
await super.add(recordUrlList)
uni.$logger.local.info(`【接待录音】NativeSave.add完成: recordId=${this.record?.id}, fileCount=${this.record?.recordUrlList?.length || 0}`)
}
}
......
......@@ -42,6 +42,7 @@ class PollingSave extends TempRecord {
// 0. 记录旧路径到实例属性,供底层查找时排除
this._excludePath = this.record?.tempFilePath || ''
uni.$logger.local.info(`【接待录音】addAudio开始: recordId=${this.record?.id || ''}, excludePath=${this._excludePath}`)
// 1. 处理旧录音,并获取清理任务 (只更新内存,不更新数据库)
let cleanupTask
......@@ -256,11 +257,11 @@ class PollingSave extends TempRecord {
saveResultPath = saveResult?.savedFilePath
}
if (!saveResultPath) {
uni.$logger.local.error(`【接待录音】持久化失败,路径为空: src=${tempFilePath}`)
uni.$logger.local.error('〖接待记录Record〗 == 保存文件失败,路径为空')
return
}
// 减少日志输出,仅在调试需要时开启
// uni.$logger.local.info('〖接待记录Record〗 == 保存后的文件路径 saveResultPath ->' + saveResultPath)
uni.$logger.local.info(`【接待录音】持久化临时文件: ${tempFilePath} -> ${saveResultPath}`)
return saveResultPath
} catch (e) {
uni.$logger.local.error('〖接待记录Record〗 == 保存文件异常: ' + e.message)
......
......@@ -367,6 +367,7 @@ class RecordSaveService {
const { status, tempFilePath, recordStatus, ...record } = data
const fileList = Array.isArray(record.recordUrlList) ? record.recordUrlList : []
const isAllCompleted = status === FileStatus.NoFile || fileList.every(i => [FileStatus.Uploaded, FileStatus.Completed].includes(i.status))
uni.$logger.local.info(`【接待录音】更新记录状态: recordId=${record.id}, isAllCompleted=${isAllCompleted}, fileCount=${fileList.length}`)
if (isAllCompleted) {
await this._handleCompletedRecord(record, fileList)
} else {
......@@ -472,6 +473,7 @@ class RecordSaveService {
continue
}
if (recordUrlList.length == 0) {
uni.$logger.local.warn(`【接待录音】记录无语音文件: recordId=${cur.id}`)
this._addToBlackList(cur.id, '无语音文件')
result.push({ status: FileStatus.NoFile, recordId: cur.id })
continue
......@@ -485,6 +487,7 @@ class RecordSaveService {
const file2Up = { ...file, recordId: cur.id, fileName, filePath }
const fileExists = await this.checkFileExists(file.file)
if (!fileExists) {
uni.$logger.local.warn(`【接待录音】文件不存在: recordId=${cur.id}, file=${file.file}`)
this.reportError('【接待记录保存服务】 == 记录中有语音文件地址,但是文件不存在', { record: cur, file }, cur.id, file.file)
file2Up.status = FileStatus.NotExist
}
......@@ -551,6 +554,7 @@ class RecordSaveService {
}
this._taskStartTime = Date.now()
this._currentKey = this._getTaskKey(record.recordId, record.fileName)
uni.$logger.local.info(`【接待录音】开始上传任务: recordId=${record.recordId}, file=${record.filePath}${record.fileName}, status=${record.status}`)
try {
if (this._isInBlackList(record.recordId)) {
uni.$logger.local.warn(`【接待记录保存服务】 == 任务在黑名单中,跳过: ${this._currentKey}`)
......@@ -655,6 +659,7 @@ class RecordSaveService {
// 从队列取出任务
record = this.snapshot.dequeue()
uni.$logger.local.info(`【接待录音】出队: ${record ? `recordId=${record.recordId}, file=${record.filePath || ''}${record.fileName || ''}` : '空'}`)
// 执行任务
await this.beginTask(record)
......
......@@ -44,6 +44,7 @@ class RecordService {
try {
uni.$logger.local.info('【录音服务RecordService】 == 初始化')
const saveDir = await PathUtils.getFilePath()
uni.$logger.local.info(`【接待录音】初始化: saveDir=${saveDir}`)
this.audioManager = new AudioManager(this.onAudioStart.bind(this), this.onAudioStop.bind(this), this.onAudioError.bind(this), this.onFrameRecorded.bind(this), this.onFrameRecordedEnd.bind(this), saveDir)
this.initDto()
this.record = StrategyFactory.getSaveStrategy(this.tempRecord, this.triggerTempNumber.bind(this), this.attributesProvider.bind(this))
......@@ -154,6 +155,9 @@ class RecordService {
async onAudioStart(res) {
try {
const filePath = res?.filePath || res?.tempFilePath || ''
const recordId = this.record?.currentRecord?.id || ''
uni.$logger.local.info(`【接待录音】onAudioStart: counter=${this.audioManager.counter}, recordId=${recordId || '待创建'}, filePath=${filePath}`)
// 重置帧缓冲池,开始新的录音周期
this.framePool.reset()
......@@ -162,6 +166,7 @@ class RecordService {
await this.record.add(res)
uni.$logger.local.info('〖RecordService〗 == Record added successfully.')
} else {
uni.$logger.local.info(`【接待录音】续录分段: counter=${this.audioManager.counter}, filePath=${filePath}`)
this.record.addAudio(res)
}
// setTimeout(() => {
......@@ -175,9 +180,11 @@ class RecordService {
async onAudioStop() {
if (!this.audioManager) return
if (this.audioManager.isRecording) {
uni.$logger.local.info(`【接待录音】录音分段结束,自动续录 counter=${this.audioManager.counter}, recordId=${this.record?.currentRecord?.id || ''}`)
uni.$logger.local.info('【录音服务RecordService】 == 接待中,再次开启录音! ')
this.audioManager.start()
} else {
uni.$logger.local.info(`【接待录音】录音停止,不再续录 recordId=${this.record?.currentRecord?.id || ''}`)
uni.$logger.local.info('【录音服务RecordService】 == 断开录音! ')
}
}
......@@ -248,6 +255,9 @@ class RecordService {
uni.$logger.local.warn('【录音服务RecordService】 == 未开始接待,不能结束接待! ')
return
}
const record = this.record?.currentRecord
const fileCount = record?.recordUrlList?.length || 0
uni.$logger.local.info(`【接待录音】结束接待: recordId=${record?.id || ''}, fileCount=${fileCount}, isNotSave=${isNotSave}`)
uni.$logger.local.info('【录音服务RecordService】 == 结束接待! ')
this.stop()
await this._teardownAiClientForReception().catch(() => {})
......@@ -260,6 +270,9 @@ class RecordService {
}
async saveAndClearRecord(isNotSave = false) {
const record = this.record?.currentRecord
const files = (record?.recordUrlList || []).map(i => i.file).join(', ')
uni.$logger.local.info(`【接待录音】保存记录: recordId=${record?.id || ''}, files=[${files}], isNotSave=${isNotSave}`)
if (isNotSave) {
//如果不需要保存记录
uni.$logger.local.info('【录音服务RecordService】 == 不保存记录! ')
......@@ -276,6 +289,7 @@ class RecordService {
this.stopAudioRecord()
}
onTimeOut() {
uni.$logger.local.warn(`【接待录音】闲置超时自动停止: recordId=${this.record?.currentRecord?.id || ''}`)
store.commit('audio/setReceptionStatus', 0)
this.record.withError()
this.stopAudioRecord()
......
......@@ -76,6 +76,7 @@ class TempRecord {
try {
if (!record) throw new Error('记录对象为空')
uni.$logger.local.info('〖接待记录Record〗 == 开始持久化记录 ==' + JSON.stringify(record))
uni.$logger.local.info(`【接待录音】转正入库: recordId=${record.id}, fileCount=${record.recordUrlList?.length || 0}`)
uni.$logger.local.info('〖接待记录Record〗 == 更新文件,保存记录!')
// 直接更新原记录,不再插入新记录
await this.dbRecord.updateRecord(toUpdateData, { id: record.id })
......@@ -83,6 +84,7 @@ class TempRecord {
await this.clearLocalRecord(record, false) // 传入 false 表示不删除数据库记录
this.triggerRecordNumChanged()
// 触发轮询开始事件,通知上传管理重新开始轮询
uni.$logger.local.info(`【接待录音】触发上传轮询: recordId=${record.id}`)
RecordSaveService.startPolling()
} catch (error) {
uni.$logger.local.info('〖接待记录Record〗 == 保存记录异常' + error.message)
......@@ -96,6 +98,9 @@ class TempRecord {
}
async save(record = this.record) {
const fileCount = record?.recordUrlList?.length || 0
const files = (record?.recordUrlList || []).map(i => i.file).join(', ')
uni.$logger.local.info(`【接待录音】TempRecord.save: recordId=${record?.id}, fileCount=${fileCount}, files=[${files}]`)
await this.beforeSave(record)
return this.__save(record, {})
}
......
......@@ -24,8 +24,13 @@ async function getLatestAudioFilePath(excludePath = '') {
}
const pathName = await __getAudioPathName(excludeName)
if (!pathName) return ''
return await __getAudioPath(pathName)
if (!pathName) {
uni.$logger.local.warn(`【接待录音】未找到录音文件, excludeName=${excludeName}`)
return ''
}
const fullPath = await __getAudioPath(pathName)
uni.$logger.local.info(`【接待录音】找到最新录音: ${fullPath}`)
return fullPath
} catch (error) {
uni.$logger.local.warn('〖接待记录Record〗 == 获取最新录音路径异常: ' + error.message)
return ''
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!