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
0dbb6890
Commit
0dbb6890
authored
Jul 27, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
4ac220de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
bpo-web/app/base/utils/qrClient.js
+42
-0
bpo-web/app/config/routes/web.js
+3
-0
bpo-web/app/config/settings.js
+12
-0
No files found.
bpo-web/app/base/utils/qrClient.js
0 → 100644
View file @
0dbb6890
const
qr
=
require
(
"qr-image"
);
var
settings
=
require
(
"../../config/settings"
);
var
ossClient
=
require
(
"./ossClient"
);
const
fs
=
require
(
"fs"
);
class
QrClient
{
constructor
(){
}
/**
* fn:生成二维码
* @return buffer
* @param key
* @returns {Promise<void>}
*/
async
generateQR
(
text
){
try
{
if
(
!
text
){
return
;
}
let
key
=
"_"
+
new
Date
().
getTime
(),
filePath
=
settings
.
localPath
();
var
qr_png
=
qr
.
image
(
text
,
{
size
:
10
});
let
_r
=
await
qr_png
.
pipe
(
require
(
'fs'
).
createWriteStream
(
`
${
filePath
}${
key
}
.png`
));
console
.
log
(
_r
);
if
(
!
_r
){
return
null
;
}
let
urlRes
=
await
new
ossClient
().
upfile
(
key
,
`
${
filePath
}${
key
}
.png`
);
fs
.
unlink
(
`
${
filePath
}${
key
}
.png`
,
(
err
)
=>
{
if
(
err
){
console
.
log
(
`二维码删除失败`
);
}
console
.
log
(
'已成功地删除文件'
);
});
return
urlRes
.
url
;
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
}
module
.
exports
=
QrClient
;
\ No newline at end of file
bpo-web/app/config/routes/web.js
View file @
0dbb6890
...
@@ -167,6 +167,9 @@ module.exports = function (app) {
...
@@ -167,6 +167,9 @@ module.exports = function (app) {
req
.
url
.
indexOf
(
"ecompanyCtl/findOne"
)
>
0
||
req
.
url
.
indexOf
(
"ecompanyCtl/findOne"
)
>
0
||
req
.
url
.
indexOf
(
"userCtl/updateSigner"
)
>
0
||
req
.
url
.
indexOf
(
"userCtl/updateSigner"
)
>
0
||
req
.
url
.
indexOf
(
"econtractCtl/genContract"
)
>
0
||
req
.
url
.
indexOf
(
"econtractCtl/genContract"
)
>
0
||
req
.
url
.
indexOf
(
"authCtl/test"
)
>
0
||
req
.
url
.
indexOf
(
"getOssConfig"
)
>
0
)
{
req
.
url
.
indexOf
(
"getOssConfig"
)
>
0
)
{
// 韵达电子签免登陆, 因为它们牛逼闪闪的技术只会用iframe丢cookie
// 韵达电子签免登陆, 因为它们牛逼闪闪的技术只会用iframe丢cookie
return
next
();
return
next
();
...
...
bpo-web/app/config/settings.js
View file @
0dbb6890
...
@@ -29,6 +29,18 @@ var settings = {
...
@@ -29,6 +29,18 @@ var settings = {
return
"http://43.247.184.94:7200/"
;
return
"http://43.247.184.94:7200/"
;
}
}
},
},
localPath
:
function
()
{
var
os
=
require
(
"os"
);
let
platform
=
os
.
platform
()
||
""
;
let
rootPath
=
""
;
// windows
if
(
platform
.
toLocaleLowerCase
().
startsWith
(
'win'
))
{
rootPath
=
"C:
\\
Temp
\
\"
;
} else {
rootPath="
/
tmp
"
}
return rootPath;
},
apiconfig: {
apiconfig: {
AES: {
AES: {
key: "
qUPsMflPfgpPP1Ua
", //密钥
key: "
qUPsMflPfgpPP1Ua
", //密钥
...
...
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