Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
6e30de44
Commit
6e30de44
authored
Jul 27, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
0dbb6890
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
bpo-web/app/base/utils/qrClient.js
+3
-3
No files found.
bpo-web/app/base/utils/qrClient.js
View file @
6e30de44
...
@@ -8,14 +8,14 @@ class QrClient{
...
@@ -8,14 +8,14 @@ class QrClient{
/**
/**
* fn:生成二维码
* fn:生成二维码
* @return
buffer
* @return
http连接 上传失败后返回null
* @param key
* @param key
* @returns {Promise<void>}
* @returns {Promise<void>}
*/
*/
async
generateQR
(
text
){
async
generateQR
(
text
){
try
{
try
{
if
(
!
text
){
if
(
!
text
){
return
;
return
null
;
}
}
let
key
=
"_"
+
new
Date
().
getTime
(),
filePath
=
settings
.
localPath
();
let
key
=
"_"
+
new
Date
().
getTime
(),
filePath
=
settings
.
localPath
();
var
qr_png
=
qr
.
image
(
text
,
{
size
:
10
});
var
qr_png
=
qr
.
image
(
text
,
{
size
:
10
});
...
@@ -25,7 +25,6 @@ class QrClient{
...
@@ -25,7 +25,6 @@ class QrClient{
return
null
;
return
null
;
}
}
let
urlRes
=
await
new
ossClient
().
upfile
(
key
,
`
${
filePath
}${
key
}
.png`
);
let
urlRes
=
await
new
ossClient
().
upfile
(
key
,
`
${
filePath
}${
key
}
.png`
);
fs
.
unlink
(
`
${
filePath
}${
key
}
.png`
,
(
err
)
=>
{
fs
.
unlink
(
`
${
filePath
}${
key
}
.png`
,
(
err
)
=>
{
if
(
err
){
if
(
err
){
console
.
log
(
`二维码删除失败`
);
console
.
log
(
`二维码删除失败`
);
...
@@ -35,6 +34,7 @@ class QrClient{
...
@@ -35,6 +34,7 @@ class QrClient{
return
urlRes
.
url
;
return
urlRes
.
url
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
return
null
;
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment