1
|
'use strict';
|
1
|
'use strict';
|
2
|
|
2
|
|
3
|
-const crypto = global.yoho.crypto;
|
3
|
+const model = require('../models/myqrcode');
|
4
|
|
4
|
|
5
|
exports.index = (req, res, next) => {
|
5
|
exports.index = (req, res, next) => {
|
6
|
let params = req.query;
|
6
|
let params = req.query;
|
7
|
- params.token = crypto.encryption('yoho9646yoho9646', JSON.stringify({
|
|
|
8
|
- tk: params.token,
|
|
|
9
|
- ct: Math.floor(Date.now()/1000),
|
|
|
10
|
- }));
|
|
|
11
|
- console.log(params.token);
|
|
|
12
|
- console.log(crypto.decrypt('yoho9646yoho9646', params.token));
|
|
|
13
|
|
7
|
|
14
|
- res.render('myqrcode', {
|
|
|
15
|
- title: '查看二维码',
|
|
|
16
|
- module: 'home',
|
|
|
17
|
- page: 'myqrcode',
|
|
|
18
|
- isPassportPage: true,
|
|
|
19
|
- data: params,
|
|
|
20
|
- });
|
8
|
+ model.getQr({
|
|
|
9
|
+ token: params.token,
|
|
|
10
|
+ }).then(result => {
|
|
|
11
|
+ params.token = result;
|
|
|
12
|
+ res.render('myqrcode', {
|
|
|
13
|
+ title: '查看二维码',
|
|
|
14
|
+ module: 'home',
|
|
|
15
|
+ page: 'myqrcode',
|
|
|
16
|
+ isPassportPage: true,
|
|
|
17
|
+ data: params,
|
|
|
18
|
+ });
|
|
|
19
|
+ }).catch(next);
|
21
|
}; |
20
|
}; |