Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7f6dcaee
authored
Jul 22, 2026
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'hotfix_v5.8.3.2' into 'master'
上线合并 See merge request
!98
2 parents
cbb6d660
c3b20e54
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
293 additions
and
277 deletions
App.vue
env.js
init.js
manifest.json
pages/common/dailyNewspaper/index.vue
utils/recordManager/PathUtils.js
utils/recordManager/RecordSaveService.js
utils/recordManager/RecordService.js
App.vue
View file @
7f6dcae
<
script
>
const
PATH
=
[
'/pages/common/caseDetail'
]
const
keepAlive
=
uni
.
requireNativePlugin
(
'Ba-KeepAliveSuit'
)
import
{
mapState
}
from
'vuex'
import
{
Ws
}
from
'@/ws/Ws.js'
import
{
RecordSaveService
,
UploadService
}
from
'@/utils/recordManager/index.js'
import
appCacheApi
from
'@/utils/clearAppCache.js'
import
FloatLogConfig
from
'@/utils/logger/FloatLogConfig.js'
// #ifdef APP-PLUS
import
StoragePathMerge
from
'@/utils/storageMerge/StoragePathMerge.js'
import
{
logStep
as
mergeLogStep
,
logStepFail
as
mergeLogStepFail
}
from
'@/utils/storageMerge/log.js'
// #endif
export
default
{
computed
:
{
...
mapState
(
'audio'
,
[
'isEnd'
,
'isStart'
])
},
globalData
:
{
userInfo
:
uni
.
getStorageSync
(
'release_userInfo'
)
const
PATH
=
[
'/pages/common/caseDetail'
]
const
keepAlive
=
uni
.
requireNativePlugin
(
'Ba-KeepAliveSuit'
)
import
{
mapState
}
from
'vuex'
import
{
Ws
}
from
'@/ws/Ws.js'
import
{
RecordSaveService
,
UploadService
}
from
'@/utils/recordManager/index.js'
export
default
{
computed
:
{
...
mapState
(
'audio'
,
[
'isEnd'
,
'isStart'
])
},
globalData
:
{
userInfo
:
uni
.
getStorageSync
(
'release_userInfo'
)
},
onLaunch
:
async
function
()
{
this
.
onKeep
()
this
.
setAPPVersion
()
setTimeout
(()
=>
{
plus
.
screen
.
unlockOrientation
()
//解除锁定屏幕方向
plus
.
screen
.
lockOrientation
(
'landscape-primary'
)
},
300
)
uni
.
setKeepScreenOn
({
keepScreenOn
:
true
})
new
Ws
().
connect
()
},
methods
:
{
onKeep
()
{
keepAlive
&&
keepAlive
.
onKeep
(
{
title
:
'接待'
,
content
:
'接待通知'
},
res
=>
{
console
.
log
(
res
)
}
)
},
onLaunch
:
async
function
()
{
// 先拉取/应用悬浮窗配置并 install,再合并,避免启动日志丢失
try
{
await
FloatLogConfig
.
refreshFromServer
(
true
)
}
catch
(
_
)
{
/* ignore */
setAPPVersion
()
{
let
version
=
plus
.
runtime
.
version
let
storageVersion
=
uni
.
$storage
.
get
(
'storageVersion'
)
uni
.
$logger
.
local
.
info
(
`storageVersion ->
${
storageVersion
}
, version ->
${
version
}
`
)
if
(
storageVersion
!=
version
)
{
uni
.
$storage
.
rm
(
'userInfo'
)
uni
.
$storage
.
rm
(
'noSignInUuid'
)
}
// #ifdef APP-PLUS
try
{
await
uni
.
$dbRecord
.
init
()
mergeLogStep
(
'归并·启动'
,
'App onLaunch:主库 init 完成,调用 StoragePathMerge.run()'
)
await
StoragePathMerge
.
run
()
}
catch
(
e
)
{
mergeLogStepFail
(
'归并·启动'
,
'启动数据库/合并异常'
,
{
错误
:
e
?.
message
||
String
(
e
)
})
}
finally
{
uni
.
$resolveStorageMerge
?.()
mergeLogStep
(
'归并·启动'
,
'App onLaunch:归并流程结束(uni.$resolveStorageMerge 已触发)'
)
}
// #endif
// #ifndef APP-PLUS
uni
.
$resolveStorageMerge
?.()
// #endif
this
.
onKeep
()
// this.setAPPVersion()
setTimeout
(()
=>
{
plus
.
screen
.
unlockOrientation
()
//解除锁定屏幕方向
plus
.
screen
.
lockOrientation
(
'landscape-primary'
)
},
300
)
uni
.
setKeepScreenOn
({
keepScreenOn
:
true
uni
.
$storage
.
set
(
'storageVersion'
,
version
)
}
},
onShow
:
async
function
()
{
this
.
$store
.
dispatch
(
'setBackgroundState'
,
false
)
this
.
$store
.
dispatch
(
'setActivityWindowPopCount'
,
1
)
//冷启动重置活动弹框次数
// 触发轮询开始事件,通知上传管理重新开始轮询
// UploadService.startPolling()
RecordSaveService
.
startPolling
()
uni
.
onMemoryWarning
(
function
()
{
console
.
log
(
'onMemoryWarningReceive'
)
})
// const systemInfo = await uni.$api.systemApi.getMockData();
// if (systemInfo.isCheckedUpdate) {
// checkUpdate();
// }
// let version = plus.runtime.version;
// uni.$api.commonApi.getAPPVersion().then((res) => {
// if (res != version && !systemInfo.isCheckedUpdate)
// this.$store.dispatch("openUpdateModal");
// });
},
onHide
:
function
()
{
this
.
$store
.
dispatch
(
'setBackgroundState'
,
true
)
},
onError
:
function
(
e
)
{
try
{
const
msg
=
typeof
e
===
'string'
?
e
:
e
.
message
||
'捕获全局异常'
const
stack
=
typeof
e
===
'object'
?
e
.
stack
||
JSON
.
stringify
(
e
)
:
''
uni
.
$logger
?.
error
({
msg
:
`[全局异常]
${
msg
}
`
,
extra
:
{
stack
,
raw
:
e
,
url
:
this
.
$route
?.
path
||
'unknown'
}
})
new
Ws
().
connect
()
},
methods
:
{
onKeep
()
{
keepAlive
&&
keepAlive
.
onKeep
(
{
title
:
'接待'
,
content
:
'接待通知'
},
res
=>
{
console
.
log
(
res
)
}
)
},
setAPPVersion
()
{
let
version
=
plus
.
runtime
.
version
let
storageVersion
=
uni
.
$storage
.
get
(
'storageVersion'
)
uni
.
$logger
.
local
.
info
(
`storageVersion ->
${
storageVersion
}
, version ->
${
version
}
`
)
if
(
storageVersion
!=
version
)
{
uni
.
$storage
.
rm
(
'userInfo'
)
uni
.
$storage
.
rm
(
'noSignInUuid'
)
}
catch
(
error
)
{
console
.
error
(
'日志上报失败:'
,
error
)
}
},
onUnhandledRejection
:
function
(
res
)
{
try
{
const
reason
=
res
.
reason
const
msg
=
reason
instanceof
Error
?
reason
.
message
:
typeof
reason
===
'string'
?
reason
:
'未处理的 Promise 拒绝'
const
stack
=
reason
instanceof
Error
?
reason
.
stack
:
JSON
.
stringify
(
reason
)
uni
.
$logger
?.
error
({
msg
:
`[UnhandledRejection]
${
msg
}
`
,
extra
:
{
stack
,
reason
:
reason
,
url
:
this
.
$route
?.
path
||
'unknown'
}
uni
.
$storage
.
set
(
'storageVersion'
,
version
)
}
},
onShow
:
async
function
()
{
appCacheApi
.
clearAppCache
()
this
.
$store
.
dispatch
(
'setBackgroundState'
,
false
)
this
.
$store
.
dispatch
(
'setActivityWindowPopCount'
,
1
)
//冷启动重置活动弹框次数
RecordSaveService
.
startPolling
()
uni
.
onMemoryWarning
(
function
()
{
console
.
log
(
'onMemoryWarningReceive'
)
})
},
onHide
:
function
()
{
this
.
$store
.
dispatch
(
'setBackgroundState'
,
true
)
},
onError
:
function
(
e
)
{
try
{
const
msg
=
typeof
e
===
'string'
?
e
:
e
.
message
||
'捕获全局异常'
const
stack
=
typeof
e
===
'object'
?
e
.
stack
||
JSON
.
stringify
(
e
)
:
''
uni
.
$logger
?.
error
({
msg
:
`[全局异常]
${
msg
}
`
,
extra
:
{
stack
,
raw
:
e
,
url
:
this
.
$route
?.
path
||
'unknown'
}
})
}
catch
(
error
)
{
console
.
error
(
'日志上报失败:'
,
error
)
}
},
onUnhandledRejection
:
function
(
res
)
{
try
{
const
reason
=
res
.
reason
const
msg
=
reason
instanceof
Error
?
reason
.
message
:
typeof
reason
===
'string'
?
reason
:
'未处理的 Promise 拒绝'
const
stack
=
reason
instanceof
Error
?
reason
.
stack
:
JSON
.
stringify
(
reason
)
uni
.
$logger
?.
error
({
msg
:
`[UnhandledRejection]
${
msg
}
`
,
extra
:
{
stack
,
reason
:
reason
,
url
:
this
.
$route
?.
path
||
'unknown'
}
})
}
catch
(
error
)
{
console
.
error
(
'Promise 异常上报失败:'
,
error
)
}
}
catch
(
error
)
{
console
.
error
(
'Promise 异常上报失败:'
,
error
)
}
}
</
script
>
<
style
lang=
"scss"
>
page
{
font-size
:
28
rpx
;
height
:
100%
;
min-height
:
100%
;
}
view
,
navigator
,
image
,
text
,
scroll-view
,
swiper
,
swiper-item
,
input
,
textarea
,
button
{
box-sizing
:
border-box
;
}
/* 文字避头尾法则 */
.btw
{
table-layout
:
fixed
;
word-wrap
:
break-word
;
word-break
:
normal
;
text-align
:
justify
;
text-justify
:
inter-ideograph
;
}
.bg-white
{
background
:
#fff
;
}
.font-weight
{
font-weight
:
bold
;
}
.u-flex-center
{
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
center
;
}
button
{
margin
:
0
;
padding
:
0
;
line-height
:
1.5
;
font-size
:
28
rpx
;
background-color
:
transparent
;
border-radius
:
0
;
position
:
relative
;
}
button
::after
{
border
:
none
;
}
//
指定按钮按下去的样式类
.button-hover
{
transform
:
translate
(
1
rpx
,
1
rpx
);
}
.webview-container
{
position
:
absolute
;
width
:
100
rpx
;
height
:
100
rpx
;
top
:
0
rpx
;
left
:
0
rpx
;
}
</
style
>
}
</
script
>
<
style
lang=
"scss"
>
page
{
font-size
:
28
rpx
;
height
:
100%
;
min-height
:
100%
;
}
view
,
navigator
,
image
,
text
,
scroll-view
,
swiper
,
swiper-item
,
input
,
textarea
,
button
{
box-sizing
:
border-box
;
}
/* 文字避头尾法则 */
.btw
{
table-layout
:
fixed
;
word-wrap
:
break-word
;
word-break
:
normal
;
text-align
:
justify
;
text-justify
:
inter-ideograph
;
}
.bg-white
{
background
:
#fff
;
}
.font-weight
{
font-weight
:
bold
;
}
.u-flex-center
{
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
center
;
}
button
{
margin
:
0
;
padding
:
0
;
line-height
:
1.5
;
font-size
:
28
rpx
;
background-color
:
transparent
;
border-radius
:
0
;
position
:
relative
;
}
button
::after
{
border
:
none
;
}
//
指定按钮按下去的样式类
.button-hover
{
transform
:
translate
(
1
rpx
,
1
rpx
);
}
.webview-container
{
position
:
absolute
;
width
:
100
rpx
;
height
:
100
rpx
;
top
:
0
rpx
;
left
:
0
rpx
;
}
</
style
>
env.js
View file @
7f6dcae
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'beta'
]
const
index
=
2
const
index
=
3
/**
*
0本地
...
...
init.js
View file @
7f6dcae
...
...
@@ -75,12 +75,12 @@ uni.signHttpConfig = {
if
(
error
&&
error
.
errMsg
==
'request:fail'
)
{
return
uni
.
showToast
({
title
:
'网络异常'
,
icon
:
'none'
,
icon
:
'none'
})
}
uni
.
showToast
({
title
:
error
.
msg
||
'业务异常'
,
icon
:
'none'
,
icon
:
'none'
})
},
logout
:
config
=>
{
...
...
@@ -103,15 +103,15 @@ uni.signHttpConfig = {
if
(
!
uni
.
$dbRecord
)
{
uni
.
$dbRecord
=
new
DBRecord
()
}
uni
.
$storageMergeDone
=
new
Promise
(
resolve
=>
{
uni
.
$resolveStorageMerge
=
resolve
})
//
uni.$storageMergeDone = new Promise(resolve => {
//
uni.$resolveStorageMerge = resolve
//
})
// 导出数据库初始化 Promise,供其他模块等待
if
(
!
uni
.
$dbReady
)
{
uni
.
$dbReady
=
(
async
_
=>
{
try
{
await
uni
.
$dbRecord
.
init
()
await
uni
.
$storageMergeDone
//
await uni.$storageMergeDone
uni
.
$logger
.
local
.
info
(
'数据库初始化与路径合并已完成'
)
return
true
}
catch
(
e
)
{
...
...
manifest.json
View file @
7f6dcae
...
...
@@ -2,8 +2,8 @@
"name"
:
"展业助手"
,
"appid"
:
"__UNI__D3BD3DF"
,
"description"
:
""
,
"versionName"
:
"2.26.
0
"
,
"versionCode"
:
226
0
,
"versionName"
:
"2.26.
2
"
,
"versionCode"
:
226
2
,
"transformPx"
:
false
,
"sassImplementationName"
:
"node-sass"
,
/*
5
+App特有相关
*/
...
...
pages/common/dailyNewspaper/index.vue
View file @
7f6dcae
...
...
@@ -412,12 +412,12 @@ export default {
if
(
this
.
templateType
==
2
&&
!
skip
)
{
uni
.
hideLoading
()
this
.
noticeObj
=
{
title
:
'
重要提示
'
,
text
:
'
确认提交后将不可再编辑,确认继续?
'
,
title
:
'
确定提交门店日报?
'
,
text
:
'
请确认驻店人员在当前场景下已完成所有个人的驻店日报及洽谈明细。门店日报提交后,将立即发送相关门店经营统计数据到指定消息群。
'
,
type
:
'warning'
,
buttons
:
[
{
text
:
'
取消
'
,
text
:
'
我再想想
'
,
type
:
'default'
,
callback
:
_
=>
{
this
.
$refs
.
notice
.
close
()
...
...
utils/recordManager/PathUtils.js
View file @
7f6dcae
/*
* @Descripttion:
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2026-01-16 14:48:27
...
...
@@ -28,17 +28,19 @@ class PathUtils {
*/
static
join
(...
args
)
{
if
(
args
.
length
===
0
)
return
''
const
parts
=
args
.
map
((
part
,
index
)
=>
{
if
(
!
part
)
return
''
let
str
=
String
(
part
)
if
(
index
!==
0
)
{
str
=
str
.
replace
(
/^
\/
+/
,
''
)
// 去除开头的斜杠
}
if
(
index
!==
args
.
length
-
1
)
{
str
=
str
.
replace
(
/
\/
+$/
,
''
)
// 去除结尾的斜杠
}
return
str
}).
filter
(
p
=>
p
.
length
>
0
)
const
parts
=
args
.
map
((
part
,
index
)
=>
{
if
(
!
part
)
return
''
let
str
=
String
(
part
)
if
(
index
!==
0
)
{
str
=
str
.
replace
(
/^
\/
+/
,
''
)
// 去除开头的斜杠
}
if
(
index
!==
args
.
length
-
1
)
{
str
=
str
.
replace
(
/
\/
+$/
,
''
)
// 去除结尾的斜杠
}
return
str
})
.
filter
(
p
=>
p
.
length
>
0
)
return
parts
.
join
(
'/'
)
}
...
...
@@ -58,8 +60,8 @@ class PathUtils {
static
getFilePath
()
{
// 1. 优先使用内存缓存,性能最高
if
(
this
.
CACHED_ROOT_PATH
)
{
uni
.
$logger
?.
local
?.
info
(
`[PathUtils] 命中内存缓存,根路径:
${
this
.
CACHED_ROOT_PATH
}
`
)
;
return
Promise
.
resolve
(
this
.
CACHED_ROOT_PATH
)
;
uni
.
$logger
?.
local
?.
info
(
`[PathUtils] 命中内存缓存,根路径:
${
this
.
CACHED_ROOT_PATH
}
`
)
return
Promise
.
resolve
(
this
.
CACHED_ROOT_PATH
)
}
// 2. 尝试读取持久化缓存
...
...
@@ -68,30 +70,44 @@ class PathUtils {
// uni.$logger?.local?.info(`[PathUtils] 命中本地缓存,根路径: ${storageCache}`);
// // 同步到内存缓存
// this.CACHED_ROOT_PATH = storageCache;
// return Promise.resolve(this.CACHED_ROOT_PATH);
// return Promise.resolve(this.CACHED_ROOT_PATH);
// }
// 3. 无缓存,请求原生文件系统API
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
plus
)
{
reject
(
new
Error
(
'plus runtime 未初始化'
))
;
return
;
reject
(
new
Error
(
'plus runtime 未初始化'
))
return
}
plus
.
io
.
requestFileSystem
(
plus
.
io
.
PRIVATE_DOC
,
(
fs
)
=>
{
const
fullPath
=
fs
.
root
.
fullPath
;
uni
.
$logger
?.
local
?.
info
(
`[PathUtils] 请求原生API获取根路径:
${
fullPath
}
`
)
;
fs
=>
{
const
fullPath
=
fs
.
root
.
fullPath
uni
.
$logger
?.
local
?.
info
(
`[PathUtils] 请求原生API获取根路径:
${
fullPath
}
`
)
// 写入两级缓存
this
.
CACHED_ROOT_PATH
=
fullPath
;
uni
.
setStorageSync
(
this
.
ROOT_PATH_CACHE_KEY
,
fullPath
)
;
resolve
(
fullPath
)
;
this
.
CACHED_ROOT_PATH
=
fullPath
uni
.
setStorageSync
(
this
.
ROOT_PATH_CACHE_KEY
,
fullPath
)
resolve
(
fullPath
)
},
(
error
)
=>
{
reject
(
new
Error
(
`[PathUtils] 获取文件系统失败:
${
JSON
.
stringify
(
error
)}
`
))
;
error
=>
{
reject
(
new
Error
(
`[PathUtils] 获取文件系统失败:
${
JSON
.
stringify
(
error
)}
`
))
}
);
});
)
})
}
/**
* 规范化本地文件路径
* - 去掉前后空白
* - 绝对路径优先转成 file:// 形式
* - 已经是 file:// / http(s):// 的路径保持不变
* @param {string} filePath
* @returns {string}
*/
static
normalizeLocalFilePath
(
filePath
)
{
const
rawPath
=
String
(
filePath
||
''
).
trim
()
if
(
!
rawPath
)
return
''
return
rawPath
.
startsWith
(
'/'
)
?
`file://
${
rawPath
}
`
:
rawPath
}
/**
...
...
@@ -124,10 +140,10 @@ class PathUtils {
const
base
=
await
this
.
getBasePath
()
// 避免重复斜杠
if
(
base
.
endsWith
(
'/'
)
&&
relativePath
.
startsWith
(
'/'
))
{
return
base
+
relativePath
.
substring
(
1
)
return
base
+
relativePath
.
substring
(
1
)
}
if
(
!
base
.
endsWith
(
'/'
)
&&
!
relativePath
.
startsWith
(
'/'
))
{
return
base
+
'/'
+
relativePath
return
base
+
'/'
+
relativePath
}
return
base
+
relativePath
}
...
...
@@ -139,31 +155,47 @@ class PathUtils {
static
ensureDir
(
dirPath
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// #ifdef APP-PLUS
plus
.
io
.
resolveLocalFileSystemURL
(
dirPath
,
entry
=>
{
resolve
(
entry
.
fullPath
)
},
()
=>
{
// 目录不存在,尝试创建
// NativeRecorder 传的是 "_doc/uniapp_save/"
plus
.
io
.
requestFileSystem
(
plus
.
io
.
PRIVATE_DOC
,
fs
=>
{
const
root
=
fs
.
root
let
path
=
dirPath
if
(
path
.
startsWith
(
'_doc/'
))
path
=
path
.
substring
(
5
)
const
createDir
=
(
entry
,
folders
)
=>
{
plus
.
io
.
resolveLocalFileSystemURL
(
dirPath
,
entry
=>
{
resolve
(
entry
.
fullPath
)
},
()
=>
{
// 目录不存在,尝试创建
// NativeRecorder 传的是 "_doc/uniapp_save/"
plus
.
io
.
requestFileSystem
(
plus
.
io
.
PRIVATE_DOC
,
fs
=>
{
const
root
=
fs
.
root
let
path
=
dirPath
if
(
path
.
startsWith
(
'_doc/'
))
path
=
path
.
substring
(
5
)
const
createDir
=
(
entry
,
folders
)
=>
{
if
(
folders
.
length
===
0
)
{
resolve
(
entry
.
fullPath
)
return
resolve
(
entry
.
fullPath
)
return
}
entry
.
getDirectory
(
folders
[
0
],
{
create
:
true
},
dirEntry
=>
{
entry
.
getDirectory
(
folders
[
0
],
{
create
:
true
},
dirEntry
=>
{
createDir
(
dirEntry
,
folders
.
slice
(
1
))
},
err
=>
{
},
err
=>
{
reject
(
new
Error
(
'创建目录失败: '
+
err
.
message
))
})
}
createDir
(
root
,
path
.
split
(
'/'
).
filter
(
p
=>
p
))
},
err
=>
reject
(
err
))
})
}
)
}
createDir
(
root
,
path
.
split
(
'/'
).
filter
(
p
=>
p
)
)
},
err
=>
reject
(
err
)
)
}
)
// #endif
// #ifndef APP-PLUS
resolve
(
dirPath
)
...
...
utils/recordManager/RecordSaveService.js
View file @
7f6dcae
/*
* @Descripttion:
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2026-01-28 20:57:12
...
...
@@ -14,17 +14,18 @@ import dayjs from 'dayjs'
import
store
from
'@/store'
import
FileUploadManager
from
'./FileUploadManager.js'
import
{
Command
}
from
'../../ws/constants'
import
PathUtils
from
'./PathUtils.js'
const
UPLOAD_INTERVAL
=
0.5
*
60
*
1000
/**
* 接待记录保存服务
*
*
* 职责:
* 1. 管理接待记录的上传队列
* 2. 处理文件上传结果
* 3. 保存接待记录到服务器
* 4. 清理本地文件和记录
*
*
* 特点:
* - 使用 FileUploadManager 处理文件上传
* - 自动轮询上传队列
...
...
@@ -49,7 +50,7 @@ class RecordSaveService {
this
.
stopPolling
=
this
.
stopPolling
.
bind
(
this
)
this
.
startPolling
=
this
.
startPolling
.
bind
(
this
)
this
.
setInterval
=
this
.
setInterval
.
bind
(
this
)
this
.
_onStartPolling
=
(
isForce
)
=>
this
.
startPolling
(
!!
isForce
)
this
.
_onStartPolling
=
isForce
=>
this
.
startPolling
(
!!
isForce
)
uni
.
$on
(
Command
.
StartPolling
,
this
.
_onStartPolling
)
}
...
...
@@ -70,7 +71,7 @@ class RecordSaveService {
}
}
uni
.
onNetworkStatusChange
(
this
.
_networkHandler
)
uni
.
$logger
.
local
.
info
(
'【接待记录保存服务】初始化成功'
)
}
catch
(
error
)
{
this
.
reportError
(
`【接待记录保存服务】初始化失败 error:
${
error
.
message
}
`
,
error
.
message
)
...
...
@@ -166,12 +167,7 @@ class RecordSaveService {
const
{
data
:
d
,
...
o
}
=
payload
const
input
=
serializeIfObject
(
o
)
uni
.
$logger
.
local
.
warn
(
`【接待记录保存服务】 == 开始文件信息解析->
${
input
}
`
)
if
(
payload
.
code
===
0
&&
(
payload
.
message
===
'no file'
||
payload
.
status
===
FileStatus
.
NoFile
||
payload
.
status
===
FileStatus
.
NotExist
)
)
{
if
(
payload
.
code
===
0
&&
(
payload
.
message
===
'no file'
||
payload
.
status
===
FileStatus
.
NoFile
||
payload
.
status
===
FileStatus
.
NotExist
))
{
return
this
.
_parseNoFileStatus
({
recordId
:
payload
.
recordId
,
fileName
:
payload
.
fileName
,
...
...
@@ -320,29 +316,31 @@ class RecordSaveService {
*/
async
uploadRecord
(
record
)
{
uni
.
$logger
.
local
.
info
(
`【接待记录保存服务】 == 开始上传文件!! record:
${
JSON
.
stringify
(
record
)}
`
)
try
{
// 使用 FileUploadManager 上传文件
await
FileUploadManager
.
uploadRecord
(
record
,
(
result
)
=>
{
await
FileUploadManager
.
uploadRecord
(
record
,
result
=>
{
// 处理上传结果
this
.
handleUploadResult
(
result
)
})
}
catch
(
error
)
{
uni
.
$logger
.
local
.
error
(
`【接待记录保存服务】 == 上传失败:
${
error
.
message
}
`
)
// 构造错误结果
const
errorResult
=
{
detail
:
{
data
:
[{
code
:
-
1
,
message
:
error
.
message
,
recordId
:
record
.
recordId
,
fileName
:
record
.
fileName
,
filePath
:
record
.
filePath
}]
data
:
[
{
code
:
-
1
,
message
:
error
.
message
,
recordId
:
record
.
recordId
,
fileName
:
record
.
fileName
,
filePath
:
record
.
filePath
}
]
}
}
this
.
handleUploadResult
(
errorResult
)
}
}
...
...
@@ -469,7 +467,7 @@ class RecordSaveService {
try
{
for
(
const
cur
of
records
)
{
const
recordUrlList
=
this
.
urlListFilter
(
cur
.
recordUrlList
)
// 1. 记录级别的黑名单检查 (针对空文件等整条记录的问题)
// 1. 记录级别的黑名单检查 (针对空文件等整条记录的问题)
if
(
this
.
_isInBlackList
(
cur
.
id
))
{
continue
}
...
...
@@ -480,6 +478,7 @@ class RecordSaveService {
}
for
(
const
file
of
recordUrlList
)
{
try
{
file
.
file
=
PathUtils
.
normalizeLocalFilePath
(
file
.
file
)
if
(
file
.
status
===
FileStatus
.
Uploaded
||
file
.
status
===
FileStatus
.
Completed
)
continue
const
aFullPath
=
file
.
file
.
split
(
'/'
)
const
fileName
=
aFullPath
.
pop
()
...
...
@@ -510,12 +509,14 @@ class RecordSaveService {
urlList
=
[]
}
// const __list = urlList.filter(item => item?.file)
const
__list
=
urlList
.
filter
(
item
=>
item
?.
file
).
map
(
item
=>
{
if
(
/^https
?
:
\/\/
/i
.
test
(
item
.
file
))
{
item
.
status
=
FileStatus
.
Uploaded
}
return
item
})
const
__list
=
urlList
.
filter
(
item
=>
item
?.
file
)
.
map
(
item
=>
{
if
(
/^https
?
:
\/\/
/i
.
test
(
item
.
file
))
{
item
.
status
=
FileStatus
.
Uploaded
}
return
item
})
return
__list
}
...
...
@@ -664,7 +665,7 @@ class RecordSaveService {
// 从队列取出任务
record
=
this
.
snapshot
.
dequeue
()
// 执行任务
await
this
.
beginTask
(
record
)
...
...
utils/recordManager/RecordService.js
View file @
7f6dcae
/*
* @Descripttion:
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2026-01-14 16:22:23
...
...
@@ -43,7 +43,9 @@ class RecordService {
async
init
()
{
try
{
uni
.
$logger
.
local
.
info
(
'【录音服务RecordService】 == 初始化'
)
const
saveDir
=
await
PathUtils
.
getFilePath
()
// const saveDir = ''
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
()
...
...
@@ -216,10 +218,10 @@ class RecordService {
* @param {number} [seconds=30] - 截取最近多少秒,默认 30 秒
* @returns {ArrayBuffer|null} PCM / WAV 格式的 ArrayBuffer,失败返回 null
*/
captureRecentAudio(seconds = 30,format = 'pcm') {
captureRecentAudio(seconds = 30,
format = 'pcm') {
const status = this.framePool.getStatus()
uni.$logger.local.info(`
【录音服务
RecordService
】
==
截取音频
:
缓冲池状态
$
{
JSON
.
stringify
(
status
)}
`)
return this.framePool.capture(seconds,
format)
return this.framePool.capture(seconds,
format)
}
/**
...
...
@@ -311,9 +313,7 @@ class RecordService {
// HTTP 服务端固定为 /health(可在 AiAssistantBall 内按需覆盖)
const httpBaseUrl = 'https://lightmodification.glsx.com.cn'
const client = new NativeChannelClient(
useWs ? { transport } : { transport, baseUrl: httpBaseUrl }
)
const client = new NativeChannelClient(useWs ? { transport } : { transport, baseUrl: httpBaseUrl })
this._aiClient = client
if (useWs) {
...
...
@@ -342,7 +342,7 @@ class RecordService {
handler
(
params
,
fn
,
delay
=
0
)
{
if
(
this
.
isReceptioning
())
{
fn
.
call
(
this
,
params
)
fn
.
call
(
this
,
params
)
}
}
...
...
@@ -356,7 +356,7 @@ class RecordService {
this
.
record
=
null
this
.
tempRecord
=
null
this
.
framePool
.
reset
()
}
}
initDto
()
{
const
{
shopMerchantId
,
phone
,
sceneType
,
uuid
,
name
,
merchantId
,
channelType
,
merchantName
}
=
storageApi
.
getUserInfo
()
||
{}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment