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 a254ef67
authored
Jun 26, 2026
by
岑成威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix:更新轮询
1 parent
7ff40264
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
utils/recordManager/RecordSaveService.js
utils/recordManager/RecordSaveService.js
View file @
a254ef6
...
...
@@ -3,9 +3,9 @@
* @version: 1.0.0
* @Author: limin
* @Date: 2026-01-28 20:57:12
* @LastEditors:
cenchengwei@foreverht.com
* @LastEditTime: 2026-0
4-08 15:24:00
* @FilePath:
/gl_tape/utils/recordManager/
RecordSaveService.js
* @LastEditors:
limin
* @LastEditTime: 2026-0
6-26 11:46:03
* @FilePath:
\gl_tape\utils\recordManager\
RecordSaveService.js
*/
import
Queue
from
'@/utils/Queue.js'
import
{
deepClone
,
serializeIfObject
}
from
'@/utils/utils.js'
...
...
@@ -13,7 +13,7 @@ import { FileStatus } from '@/utils/common'
import
dayjs
from
'dayjs'
import
store
from
'@/store'
import
FileUploadManager
from
'./FileUploadManager.js'
import
{
Command
}
from
'../../ws/constants'
const
UPLOAD_INTERVAL
=
0.5
*
60
*
1000
/**
...
...
@@ -49,6 +49,8 @@ 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
)
uni
.
$on
(
Command
.
StartPolling
,
this
.
_onStartPolling
)
}
static
getInstance
()
{
...
...
@@ -367,7 +369,6 @@ 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
{
...
...
@@ -473,7 +474,6 @@ 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
...
...
@@ -487,7 +487,6 @@ 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
}
...
...
@@ -510,7 +509,13 @@ class RecordSaveService {
if
(
!
Array
.
isArray
(
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
=>
{
if
(
/^https
?
:
\/\/
/i
.
test
(
item
.
file
))
{
item
.
status
=
FileStatus
.
Uploaded
}
return
item
})
return
__list
}
...
...
@@ -554,7 +559,6 @@ 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
}
`
)
...
...
@@ -644,6 +648,7 @@ class RecordSaveService {
canclePromises
()
{
this
.
endTask
()
this
.
_pumpRunning
=
false
}
async
_schedulerPump
()
{
...
...
@@ -659,7 +664,6 @@ class RecordSaveService {
// 从队列取出任务
record
=
this
.
snapshot
.
dequeue
()
uni
.
$logger
.
local
.
info
(
`【接待录音】出队:
${
record
?
`recordId=
${
record
.
recordId
}
, file=
${
record
.
filePath
||
''
}${
record
.
fileName
||
''
}
`
:
'空'
}
`
)
// 执行任务
await
this
.
beginTask
(
record
)
...
...
@@ -730,6 +734,8 @@ class RecordSaveService {
uni
.
offNetworkStatusChange
(
this
.
_networkHandler
)
this
.
_networkHandler
=
null
}
uni
.
$off
(
Command
.
StartPolling
,
this
.
_onStartPolling
)
this
.
_onStartPolling
=
null
}
}
...
...
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