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