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 b3809c29
authored
Sep 30, 2024
by
yixinjj
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
调整日志输出
1 parent
a0557323
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
mixin/uploader.js
ws/Ws.js
ws/workers/LogsWorker.js
mixin/uploader.js
View file @
b3809c2
...
@@ -163,7 +163,7 @@ export default {
...
@@ -163,7 +163,7 @@ export default {
async
uploadSuccess
(
recordId
,
filePathOnServer
,
filePathOnClient
,
fileName
)
{
async
uploadSuccess
(
recordId
,
filePathOnServer
,
filePathOnClient
,
fileName
)
{
const
unlock
=
await
uni
.
$recordManager
.
lock
()
const
unlock
=
await
uni
.
$recordManager
.
lock
()
try
{
try
{
uni
.
$logger
.
local
.
info
(
`文件上传
成功
!!', filePathOnServer->
${
filePathOnServer
}
, filePathOnClient->
${
filePathOnClient
}
, fileName->
${
fileName
}
`
)
uni
.
$logger
.
local
.
info
(
`文件上传
完成回调(uploadSuccess)
!!', filePathOnServer->
${
filePathOnServer
}
, filePathOnClient->
${
filePathOnClient
}
, fileName->
${
fileName
}
`
)
const
record
=
uni
.
$recordManager
.
getRecordById
(
recordId
)
const
record
=
uni
.
$recordManager
.
getRecordById
(
recordId
)
if
(
!
record
)
return
uni
.
$logger
.
local
.
info
(
`未找到接待记录!!`
)
if
(
!
record
)
return
uni
.
$logger
.
local
.
info
(
`未找到接待记录!!`
)
this
.
_changeFilePathToServer
(
record
,
filePathOnClient
,
filePathOnServer
,
fileName
)
this
.
_changeFilePathToServer
(
record
,
filePathOnClient
,
filePathOnServer
,
fileName
)
...
@@ -212,7 +212,7 @@ export default {
...
@@ -212,7 +212,7 @@ export default {
filePath
:
filePathOnClient
,
filePath
:
filePathOnClient
,
complete
:
function
(
res
)
{
complete
:
function
(
res
)
{
// console.log(res)
// console.log(res)
uni
.
$logger
.
local
.
info
(
`删除成功!!`
)
uni
.
$logger
.
local
.
info
(
`
${
filePathOnClient
}
->
删除成功!!`
)
}
}
})
})
},
},
...
...
ws/Ws.js
View file @
b3809c2
...
@@ -18,10 +18,10 @@ export class Ws {
...
@@ -18,10 +18,10 @@ export class Ws {
}
}
async
connect
()
{
async
connect
()
{
const
{
code
,
data
,
...
o
}
=
await
this
.
login
()
const
{
code
,
data
,
...
o
}
=
await
this
.
login
()
if
(
code
==
200
)
{
if
(
code
==
200
)
{
this
.
deviceId
=
data
.
device_id
this
.
deviceId
=
data
.
device_id
this
.
token
=
data
.
token
this
.
token
=
data
.
token
this
.
ws
=
io
(
this
.
wsAddress
,
{
this
.
ws
=
io
(
this
.
wsAddress
,
{
auth
:
{
token
:
this
.
token
,
deviceId
:
this
.
deviceId
},
auth
:
{
token
:
this
.
token
,
deviceId
:
this
.
deviceId
},
transports
:
[
'websocket'
],
transports
:
[
'websocket'
],
timeout
:
5000
timeout
:
5000
...
@@ -40,10 +40,10 @@ export class Ws {
...
@@ -40,10 +40,10 @@ export class Ws {
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
uni
.
request
({
url
:
this
.
loginAddress
,
url
:
this
.
loginAddress
,
data
:
{
user
,
mobile
},
data
:
{
user
,
mobile
},
method
:
'POST'
,
method
:
'POST'
,
dataType
:
'json'
,
dataType
:
'json'
,
success
(
response
)
{
success
(
response
)
{
resolve
(
response
.
data
)
resolve
(
response
.
data
)
},
},
fail
(
err
)
{
fail
(
err
)
{
...
...
ws/workers/LogsWorker.js
View file @
b3809c2
...
@@ -27,7 +27,7 @@ export default class LogsWorker {
...
@@ -27,7 +27,7 @@ export default class LogsWorker {
if
(
files
.
length
>
0
)
{
if
(
files
.
length
>
0
)
{
const
file
=
files
.
shift
()
const
file
=
files
.
shift
()
await
this
.
post
(
file
,
deviceId
)
await
this
.
post
(
file
,
deviceId
)
this
.
process
(
files
,
deviceId
)
setTimeout
(()
=>
this
.
process
(
files
,
deviceId
),
500
)
}
else
{
}
else
{
this
.
isUploading
=
false
this
.
isUploading
=
false
}
}
...
@@ -50,7 +50,7 @@ export default class LogsWorker {
...
@@ -50,7 +50,7 @@ export default class LogsWorker {
resolve
()
resolve
()
},
},
fail
:
res
=>
{
fail
:
res
=>
{
uni
.
$logger
.
local
.
error
(
`文件上传失败! res->
${
serializeIfObject
(
res
)}
filePath->
${
path
}
.
请检查服务端是否有文件被打开
`
)
uni
.
$logger
.
local
.
error
(
`文件上传失败! res->
${
serializeIfObject
(
res
)}
filePath->
${
path
}
.`
)
resolve
()
resolve
()
}
}
})
})
...
...
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