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
294ec89a
Commit
294ec89a
authored
Jul 27, 2020
by
王昆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo-web' of gitlab.gongsibao.com:jiangyong/zhichan into bpo-web
parents
85d10e42
6e30de44
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 @
294ec89a
const
qr
=
require
(
"qr-image"
);
var
settings
=
require
(
"../../config/settings"
);
var
ossClient
=
require
(
"./ossClient"
);
const
fs
=
require
(
"fs"
);
class
QrClient
{
constructor
(){
}
/**
* fn:生成二维码
* @return http连接 上传失败后返回null
* @param key
* @returns {Promise<void>}
*/
async
generateQR
(
text
){
try
{
if
(
!
text
){
return
null
;
}
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
);
return
null
;
}
}
}
module
.
exports
=
QrClient
;
\ No newline at end of file
bpo-web/app/config/routes/web.js
View file @
294ec89a
...
...
@@ -167,6 +167,9 @@ module.exports = function (app) {
req
.
url
.
indexOf
(
"ecompanyCtl/findOne"
)
>
0
||
req
.
url
.
indexOf
(
"userCtl/updateSigner"
)
>
0
||
req
.
url
.
indexOf
(
"econtractCtl/genContract"
)
>
0
||
req
.
url
.
indexOf
(
"authCtl/test"
)
>
0
||
req
.
url
.
indexOf
(
"getOssConfig"
)
>
0
)
{
// 韵达电子签免登陆, 因为它们牛逼闪闪的技术只会用iframe丢cookie
return
next
();
...
...
bpo-web/app/config/settings.js
View file @
294ec89a
...
...
@@ -29,6 +29,18 @@ var settings = {
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: {
AES: {
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