|
|
'use strict';
|
|
|
|
|
|
const _ = require('lodash');
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const api = global.yoho.API;
|
|
|
const crypto = global.yoho.crypto;
|
|
|
const PASSWORD = 'yoho9646yoho9646';
|
|
|
|
|
|
class newQrcode extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
...
|
...
|
@@ -38,20 +35,9 @@ class newQrcode extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
getToken(params) {
|
|
|
let uidNum = parseInt(params.uid, 10);
|
|
|
let token = uidNum ? crypto.encryption(PASSWORD, uidNum + '') : '';
|
|
|
let uid = '';
|
|
|
|
|
|
try {
|
|
|
uid = crypto.decrypt(PASSWORD, decodeURIComponent(token));
|
|
|
uid = parseInt(uid, 10);
|
|
|
} catch (e) {
|
|
|
uid = token;
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.twoDimen.getCode',
|
|
|
uid: uid,
|
|
|
uid: params.uid,
|
|
|
}).then(result => {
|
|
|
return (result && result.data && result.data.code) || '';
|
|
|
});
|
...
|
...
|
@@ -66,7 +52,7 @@ class newQrcode extends global.yoho.BaseModel { |
|
|
let resu = {};
|
|
|
|
|
|
if (_.get(result, '[0]data')) {
|
|
|
resu = camelCase(result[0].data);
|
|
|
resu = result[0].data;
|
|
|
}
|
|
|
if (_.get(result, '[1]data')) {
|
|
|
resu.trendWord = result[1].data.trendWord;
|
...
|
...
|
|