Authored by zhangwenxue

chore(eslint): auto fix

@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 ], 16 ],
17 "rules": { 17 "rules": {
18 "camelcase": "off", 18 "camelcase": "off",
19 - "max-len": "off" 19 + "max-len": "off",
  20 + "no-multiple-empty-lines": ["error", {"max": 1}]
20 } 21 }
21 } 22 }
@@ -43,7 +43,7 @@ export function createApp(context) { @@ -43,7 +43,7 @@ export function createApp(context) {
43 resolve(); 43 resolve();
44 }); 44 });
45 45
46 - setTimeout(function () { 46 + setTimeout(function() {
47 resolve(); 47 resolve();
48 }, 500); 48 }, 500);
49 }); 49 });
@@ -72,6 +72,6 @@ export default class reportApp { @@ -72,6 +72,6 @@ export default class reportApp {
72 }, this.events) 72 }, this.events)
73 ] 73 ]
74 } 74 }
75 - }) 75 + });
76 } 76 }
77 } 77 }
@@ -8,25 +8,32 @@ @@ -8,25 +8,32 @@
8 */ 8 */
9 function getTarget(node) { 9 function getTarget(node) {
10 if (node === void 0) { 10 if (node === void 0) {
11 - node = document.body 11 + node = document.body;
12 } 12 }
13 - if (node === true) { return document.body }  
14 - return node instanceof window.Node ? node : document.querySelector(node) 13 + if (node === true) {
  14 + return document.body;
  15 + }
  16 + return node instanceof window.Node ? node : document.querySelector(node);
15 } 17 }
16 18
17 const directive = { 19 const directive = {
18 inserted(el, { value }, vnode) { 20 inserted(el, { value }, vnode) {
19 - if (el.dataset && el.dataset.transfer !== 'true') return false; 21 + if (el.dataset && el.dataset.transfer !== 'true') {
  22 + return false;
  23 + }
20 el.className = el.className ? el.className + ' v-transfer-dom' : 'v-transfer-dom'; 24 el.className = el.className ? el.className + ' v-transfer-dom' : 'v-transfer-dom';
21 const parentNode = el.parentNode; 25 const parentNode = el.parentNode;
22 - if (!parentNode) return; 26 +
  27 + if (!parentNode) {
  28 + return;
  29 + }
23 const home = document.createComment(''); 30 const home = document.createComment('');
24 let hasMovedOut = false; 31 let hasMovedOut = false;
25 32
26 if (value !== false) { 33 if (value !== false) {
27 parentNode.replaceChild(home, el); // moving out, el is no longer in the document 34 parentNode.replaceChild(home, el); // moving out, el is no longer in the document
28 getTarget(value).appendChild(el); // moving into new place 35 getTarget(value).appendChild(el); // moving into new place
29 - hasMovedOut = true 36 + hasMovedOut = true;
30 } 37 }
31 if (!el.__transferDomData) { 38 if (!el.__transferDomData) {
32 el.__transferDomData = { 39 el.__transferDomData = {
@@ -34,14 +41,21 @@ const directive = { @@ -34,14 +41,21 @@ const directive = {
34 home: home, 41 home: home,
35 target: getTarget(value), 42 target: getTarget(value),
36 hasMovedOut: hasMovedOut 43 hasMovedOut: hasMovedOut
37 - } 44 + };
38 } 45 }
39 }, 46 },
40 componentUpdated(el, { value }) { 47 componentUpdated(el, { value }) {
41 - if (el.dataset && el.dataset.transfer !== 'true') return false; 48 + if (el.dataset && el.dataset.transfer !== 'true') {
  49 + return false;
  50 + }
  51 +
42 // need to make sure children are done updating (vs. `update`) 52 // need to make sure children are done updating (vs. `update`)
43 const ref$1 = el.__transferDomData; 53 const ref$1 = el.__transferDomData;
44 - if (!ref$1) return; 54 +
  55 + if (!ref$1) {
  56 + return;
  57 + }
  58 +
45 // homes.get(el) 59 // homes.get(el)
46 const parentNode = ref$1.parentNode; 60 const parentNode = ref$1.parentNode;
47 const home = ref$1.home; 61 const home = ref$1.home;
@@ -50,6 +64,7 @@ const directive = { @@ -50,6 +64,7 @@ const directive = {
50 if (!hasMovedOut && value) { 64 if (!hasMovedOut && value) {
51 // remove from document and leave placeholder 65 // remove from document and leave placeholder
52 parentNode.replaceChild(home, el); 66 parentNode.replaceChild(home, el);
  67 +
53 // append to target 68 // append to target
54 getTarget(value).appendChild(el); 69 getTarget(value).appendChild(el);
55 el.__transferDomData = Object.assign({}, el.__transferDomData, { hasMovedOut: true, target: getTarget(value) }); 70 el.__transferDomData = Object.assign({}, el.__transferDomData, { hasMovedOut: true, target: getTarget(value) });
@@ -63,15 +78,20 @@ const directive = { @@ -63,15 +78,20 @@ const directive = {
63 } 78 }
64 }, 79 },
65 unbind(el) { 80 unbind(el) {
66 - if (el.dataset && el.dataset.transfer !== 'true') return false; 81 + if (el.dataset && el.dataset.transfer !== 'true') {
  82 + return false;
  83 + }
67 el.className = el.className.replace('v-transfer-dom', ''); 84 el.className = el.className.replace('v-transfer-dom', '');
68 const ref$1 = el.__transferDomData; 85 const ref$1 = el.__transferDomData;
69 - if (!ref$1) return; 86 +
  87 + if (!ref$1) {
  88 + return;
  89 + }
70 if (el.__transferDomData.hasMovedOut === true) { 90 if (el.__transferDomData.hasMovedOut === true) {
71 - el.__transferDomData.parentNode && el.__transferDomData.parentNode.appendChild(el) 91 + el.__transferDomData.parentNode && el.__transferDomData.parentNode.appendChild(el);
72 } 92 }
73 - el.__transferDomData = null 93 + el.__transferDomData = null;
74 } 94 }
75 }; 95 };
76 96
77 -export default directive;  
  97 +export default directive;
@@ -2,7 +2,7 @@ export default [{ @@ -2,7 +2,7 @@ export default [{
2 path: '/mapp/mine/ufo/bankcard.html', 2 path: '/mapp/mine/ufo/bankcard.html',
3 name: 'bankcard', 3 name: 'bankcard',
4 component: () => import(/* webpackChunkName: "invite" */ './card-list') 4 component: () => import(/* webpackChunkName: "invite" */ './card-list')
5 -},{ 5 +}, {
6 path: '/mapp/mine/ufo/bankcard/add', 6 path: '/mapp/mine/ufo/bankcard/add',
7 name: 'bankcard.add', 7 name: 'bankcard.add',
8 component: () => import(/* webpackChunkName: "invite" */ './card-add') 8 component: () => import(/* webpackChunkName: "invite" */ './card-add')
@@ -53,7 +53,7 @@ export default { @@ -53,7 +53,7 @@ export default {
53 }); 53 });
54 54
55 if (result.code === 200) { 55 if (result.code === 200) {
56 - const list = get(result, 'data.list', []); 56 + const list = get(result, 'data.list', []);
57 57
58 if (state.pager.page === 0) { 58 if (state.pager.page === 0) {
59 commit(Types.FETCH_INVITE_ORDER_DETAIL_LIST, { list }); 59 commit(Types.FETCH_INVITE_ORDER_DETAIL_LIST, { list });
@@ -76,7 +76,7 @@ export default { @@ -76,7 +76,7 @@ export default {
76 return result.data.page < result.data.pageTotal; 76 return result.data.page < result.data.pageTotal;
77 77
78 } else { 78 } else {
79 - commit(Types.FETCH_INVITE_ORDER_DETAIL_LIST_REQUEST, false) 79 + commit(Types.FETCH_INVITE_ORDER_DETAIL_LIST_REQUEST, false);
80 } 80 }
81 81
82 return false; 82 return false;
1 export default err => { 1 export default err => {
2 -  
3 -}  
  2 +
  3 +};
1 const mysql = require('./mysql-client'); 1 const mysql = require('./mysql-client');
2 const TABEL = 'user_alipay'; 2 const TABEL = 'user_alipay';
3 3
4 -  
5 async function insert(data) { 4 async function insert(data) {
6 return mysql(TABEL).insert({ 5 return mysql(TABEL).insert({
7 ...data, 6 ...data,
8 - createdAt: new Date().valueOf() 7 + createdAt: Date.now()
9 }); 8 });
10 } 9 }
11 10
@@ -2,6 +2,9 @@ const alipayRepository = require('./alipay.repository'); @@ -2,6 +2,9 @@ const alipayRepository = require('./alipay.repository');
2 const { logger } = global.yoho; 2 const { logger } = global.yoho;
3 const AlertAgent = require('../../utils/alert-manager'); 3 const AlertAgent = require('../../utils/alert-manager');
4 4
  5 +/**
  6 + * dingtalk 告警
  7 + */
5 const AlertType = { 8 const AlertType = {
6 MySQL: 0, 9 MySQL: 0,
7 Knex: 1, 10 Knex: 1,
@@ -2,116 +2,116 @@ @@ -2,116 +2,116 @@
2 const md5 = require('md5'); 2 const md5 = require('md5');
3 3
4 const microtime = function() { 4 const microtime = function() {
5 - let unixtimeMs = new Date().getTime();  
6 - let sec = parseInt(unixtimeMs / 1000, 10); 5 + let unixtimeMs = new Date().getTime();
  6 + let sec = parseInt(unixtimeMs / 1000, 10);
7 7
8 - return (unixtimeMs - (sec * 1000)) / 1000 + ' ' + sec; 8 + return (unixtimeMs - (sec * 1000)) / 1000 + ' ' + sec;
9 }; 9 };
10 10
11 const getTimestamp = function() { 11 const getTimestamp = function() {
12 - let unixtimeMs = new Date().getTime(); 12 + let unixtimeMs = new Date().getTime();
13 13
14 - return parseInt(unixtimeMs / 1000, 10); 14 + return parseInt(unixtimeMs / 1000, 10);
15 }; 15 };
16 16
17 module.exports = function(str, key, expiry, operation) { 17 module.exports = function(str, key, expiry, operation) {
18 - operation = operation ? operation : 'decode';  
19 - key = key ? key : '';  
20 - expiry = expiry ? expiry : 0;  
21 - let tmpstr, tmp; 18 + operation = operation ? operation : 'decode';
  19 + key = key ? key : '';
  20 + expiry = expiry ? expiry : 0;
  21 + let tmpstr, tmp;
22 22
23 - let ckeyLength = 4; 23 + let ckeyLength = 4;
24 24
25 - key = md5(key); 25 + key = md5(key);
26 26
27 - // 密匙a会参与加解密  
28 - let keya = md5(key.substr(0, 16)); 27 + // 密匙a会参与加解密
  28 + let keya = md5(key.substr(0, 16));
29 29
30 - // 密匙b会用来做数据完整性验证  
31 - let keyb = md5(key.substr(16, 16)); 30 + // 密匙b会用来做数据完整性验证
  31 + let keyb = md5(key.substr(16, 16));
32 32
33 - // 密匙c用于变化生成的密文  
34 - let keyc = operation === 'decode' ?  
35 - str.substr(0, ckeyLength) : md5(microtime()).substr(-ckeyLength); 33 + // 密匙c用于变化生成的密文
  34 + let keyc = operation === 'decode' ?
  35 + str.substr(0, ckeyLength) : md5(microtime()).substr(-ckeyLength);
36 36
37 - // 参与运算的密匙  
38 - let cryptkey = keya + md5(keya + keyc); 37 + // 参与运算的密匙
  38 + let cryptkey = keya + md5(keya + keyc);
39 39
40 - let strbuf; 40 + let strbuf;
41 41
42 - if (operation === 'decode') {  
43 - str = str.substr(ckeyLength);  
44 - strbuf = new Buffer(str, 'base64'); 42 + if (operation === 'decode') {
  43 + str = str.substr(ckeyLength);
  44 + strbuf = new Buffer(str, 'base64');
45 45
46 - // string = b.toString(); 46 + // string = b.toString();
  47 + } else {
  48 + expiry = expiry ? expiry + getTimestamp() : 0;
  49 + tmpstr = expiry.toString();
  50 + if (tmpstr.length >= 10) {
  51 + str = tmpstr.substr(0, 10) + md5(str + keyb).substr(0, 16) + str;
47 } else { 52 } else {
48 - expiry = expiry ? expiry + getTimestamp() : 0;  
49 - tmpstr = expiry.toString();  
50 - if (tmpstr.length >= 10) {  
51 - str = tmpstr.substr(0, 10) + md5(str + keyb).substr(0, 16) + str;  
52 - } else {  
53 - let count = 10 - tmpstr.length;  
54 -  
55 - for (let i = 0; i < count; i++) {  
56 - tmpstr = '0' + tmpstr;  
57 - }  
58 - str = tmpstr + md5(str + keyb).substr(0, 16) + str;  
59 - }  
60 - strbuf = new Buffer(str); 53 + let count = 10 - tmpstr.length;
  54 +
  55 + for (let i = 0; i < count; i++) {
  56 + tmpstr = '0' + tmpstr;
  57 + }
  58 + str = tmpstr + md5(str + keyb).substr(0, 16) + str;
61 } 59 }
  60 + strbuf = new Buffer(str);
  61 + }
62 62
63 63
64 - let box = new Array(256);  
65 - let rndkey = []; 64 + let box = new Array(256);
  65 + let rndkey = [];
66 66
67 - for (let i = 0; i < 256; i++) {  
68 - box[i] = i; 67 + for (let i = 0; i < 256; i++) {
  68 + box[i] = i;
69 69
70 - // 产生密匙簿  
71 - rndkey[i] = cryptkey.charCodeAt(i % cryptkey.length);  
72 - } 70 + // 产生密匙簿
  71 + rndkey[i] = cryptkey.charCodeAt(i % cryptkey.length);
  72 + }
73 73
74 - // 用固定的算法,打乱密匙簿,增加随机性,好像很复杂,实际上对并不会增加密文的强度  
75 - for (let j = 0, i = 0; i < 256; i++) {  
76 - j = (j + box[i] + rndkey[i]) % 256;  
77 - tmp = box[i];  
78 - box[i] = box[j];  
79 - box[j] = tmp;  
80 - } 74 + // 用固定的算法,打乱密匙簿,增加随机性,好像很复杂,实际上对并不会增加密文的强度
  75 + for (let j = 0, i = 0; i < 256; i++) {
  76 + j = (j + box[i] + rndkey[i]) % 256;
  77 + tmp = box[i];
  78 + box[i] = box[j];
  79 + box[j] = tmp;
  80 + }
81 81
82 82
83 - // 核心加解密部分  
84 - let s = ''; 83 + // 核心加解密部分
  84 + let s = '';
85 85
86 - for (let a = 0, j = 0, i = 0; i < strbuf.length; i++) {  
87 - a = (a + 1) % 256;  
88 - j = (j + box[a]) % 256;  
89 - tmp = box[a];  
90 - box[a] = box[j];  
91 - box[j] = tmp; 86 + for (let a = 0, j = 0, i = 0; i < strbuf.length; i++) {
  87 + a = (a + 1) % 256;
  88 + j = (j + box[a]) % 256;
  89 + tmp = box[a];
  90 + box[a] = box[j];
  91 + box[j] = tmp;
92 92
93 - // 从密匙簿得出密匙进行异或,再转成字符  
94 - // s += String.fromCharCode(string[i] ^ (box[(box[a] + box[j]) % 256]));  
95 - /* jshint -W016*/  
96 - strbuf[i] = strbuf[i] ^ (box[(box[a] + box[j]) % 256]);  
97 - } 93 + // 从密匙簿得出密匙进行异或,再转成字符
  94 + // s += String.fromCharCode(string[i] ^ (box[(box[a] + box[j]) % 256]));
  95 + /* jshint -W016*/
  96 + strbuf[i] = strbuf[i] ^ (box[(box[a] + box[j]) % 256]);
  97 + }
98 98
99 - if (operation === 'decode') {  
100 - s = strbuf.toString();  
101 - if ((s.substr(0, 10) === '0'.repeat(10) || 99 + if (operation === 'decode') {
  100 + s = strbuf.toString();
  101 + if ((s.substr(0, 10) === '0'.repeat(10) ||
102 s.substr(0, 10) - getTimestamp() > 0) && 102 s.substr(0, 10) - getTimestamp() > 0) &&
103 s.substr(10, 16) === md5(s.substr(26) + keyb).substr(0, 16)) { 103 s.substr(10, 16) === md5(s.substr(26) + keyb).substr(0, 16)) {
104 - s = s.substr(26);  
105 - } else {  
106 - s = '';  
107 - } 104 + s = s.substr(26);
108 } else { 105 } else {
109 - s = strbuf.toString('base64');  
110 - let regex = new RegExp('=', 'g');  
111 -  
112 - s = s.replace(regex, '');  
113 - s = keyc + s; 106 + s = '';
114 } 107 }
  108 + } else {
  109 + s = strbuf.toString('base64');
  110 + let regex = new RegExp('=', 'g');
  111 +
  112 + s = s.replace(regex, '');
  113 + s = keyc + s;
  114 + }
115 115
116 - return s; 116 + return s;
117 }; 117 };