gaoshuaixing 5 years ago
parent
commit
200088abf6
6 changed files with 617 additions and 92 deletions
  1. 18 0
      app.js
  2. 12 0
      app/utils/regRule.js
  3. 501 0
      app/utils/utils.js
  4. 42 0
      app/utils/validataRules.js
  5. 43 91
      package-lock.json
  6. 1 1
      package.json

+ 18 - 0
app.js

@@ -4,6 +4,11 @@
  */
 'use strict';
 global.CODE = require('./app/const/statusCode');
+const fs = require('fs');
+const path = require('path');
+const lowdb = require('lowdb');
+const FileSync = require('lowdb/adapters/FileSync');
+const utils = require('./app/utils/utils');
 
 class AppBootHook {
   constructor(app) {
@@ -33,6 +38,19 @@ class AppBootHook {
   async didReady() {
     // Worker is ready, can do some things
     // don't need to block the app boot.
+    // 数据库
+    const storageDir = path.normalize('./storage/');
+    if (!fs.existsSync(storageDir)) {
+      utils.mkdir(storageDir);
+      utils.chmodPath(storageDir, '777');
+    }
+    const file = storageDir + 'db.json';
+    // utils.chmodPath(file);
+    const adapter = new FileSync(file);
+    const db = lowdb(adapter);
+    if (!db.has('kv').value()) {
+      db.set('kv', {}).write();
+    }
   }
 
   async serverDidReady() {

+ 12 - 0
app/utils/regRule.js

@@ -0,0 +1,12 @@
+// // 密码校验规则(32位字符串,既Md5加密后的)
+// const passwordReg1 = /^.{32}$/
+// // 手机号码校验规则
+// const phoneReg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/
+'use strict';
+
+const regRule = {
+  paswwordReg1: /^.{32}$/,
+  phoneReg: /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/,
+  emailReg: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/,
+};
+module.exports = regRule;

+ 501 - 0
app/utils/utils.js

@@ -0,0 +1,501 @@
+'use strict';
+const util = require('util');
+const crypto = require('crypto');
+const fs = require('fs');
+const path = require('path');
+const _ = require('lodash');
+const readline = require('readline');
+const net = require('net');
+
+exports = module.exports;
+
+// control variable of func "myPrint"
+const isPrintFlag = true;
+
+/**
+ * Check and invoke callback function
+ */
+exports.invokeCallback = function(cb) {
+  if (!!cb && typeof cb === 'function') {
+    cb.apply(null, Array.prototype.slice.call(arguments, 1));
+  }
+};
+
+exports.size = function(obj) {
+  if (!obj) {
+    return 0;
+  }
+
+  let size = 0;
+  for (const f in obj) {
+    if (obj.hasOwnProperty(f)) {
+      size++;
+    }
+  }
+
+  return size;
+};
+
+// print the file name and the line number ~ begin
+function getStack() {
+  const orig = Error.prepareStackTrace;
+  Error.prepareStackTrace = function(_, stack) {
+    return stack;
+  };
+  const err = new Error();
+  Error.captureStackTrace(err, arguments.callee);
+  const stack = err.stack;
+  Error.prepareStackTrace = orig;
+  return stack;
+}
+
+function getFileName(stack) {
+  return stack[1].getFileName();
+}
+
+function getLineNumber(stack) {
+  return stack[1].getLineNumber();
+}
+
+exports.myPrint = function() {
+  if (isPrintFlag) {
+    const len = arguments.length;
+    if (len <= 0) {
+      return;
+    }
+    const stack = getStack();
+    let aimStr =
+      "'" + getFileName(stack) + "' @" + getLineNumber(stack) + ' :\n';
+    for (let i = 0; i < len; ++i) {
+      aimStr +=
+        (typeof arguments[i] === 'object'
+          ? JSON.stringify(arguments[i])
+          : arguments[i]) + ' ';
+    }
+    console.log('\n' + aimStr);
+  }
+};
+
+exports.md5 = function(str) {
+  const hash = crypto.createHash('md5');
+  hash.update(str);
+  return hash.digest('hex');
+};
+
+/*
+ * 加密
+ */
+exports.cipher = function(algorithm, key, iv, data) {
+  key = new Buffer(key);
+  iv = new Buffer(iv ? iv : 0);
+  const cipher = crypto.createCipheriv(algorithm, key, iv);
+  cipher.setAutoPadding(true); // default true
+  let ciph = cipher.update(data, 'utf8', 'base64');
+  ciph += cipher.final('base64');
+
+  return ciph;
+};
+
+/*
+ * 解密
+ */
+exports.decipher = function(algorithm, key, iv, crypted) {
+  key = new Buffer(key);
+  iv = new Buffer(iv ? iv : '');
+  const decipher = crypto.createDecipheriv(algorithm, key, iv);
+  decipher.setAutoPadding(true);
+  let decoded = decipher.update(crypted, 'base64', 'utf8');
+  decoded += decipher.final('utf8');
+
+  return decoded;
+};
+
+exports.getDate = function(flag) {
+  if (!flag) {
+    flag = '';
+  }
+  const date = new Date();
+  const year = date.getFullYear();
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
+  const mytimes = year + flag + month + flag + day;
+  return mytimes;
+};
+
+exports.dynamicSign = function(len) {
+  len = len || 5;
+  const chars = 'abcdefghijklmnopqrstuvwxyz';
+  const maxPos = chars.length;
+  let sign = '';
+  for (let i = 0; i < len; i++) {
+    sign += chars.charAt(Math.floor(Math.random() * maxPos));
+  }
+  return sign;
+};
+
+exports.toHump = function(str) {
+  let result = '';
+  const split = str.split('_');
+  result += split[0];
+  for (let i = 1; i < split.length; ++i) {
+    result += split[i][0].toUpperCase() + split[i].substr(1);
+  }
+  return result;
+};
+
+exports.tryJsonParse = function(jsonStr, cb) {
+  try {
+    cb(null, JSON.parse(jsonStr));
+  } catch (e) {
+    cb(e, null);
+  }
+};
+
+exports.mkdir = function(dirpath, dirname) {
+  // 判断是否是第一次调用
+  if (typeof dirname === 'undefined') {
+    if (fs.existsSync(dirpath)) {
+      return;
+    }
+    this.mkdir(dirpath, path.dirname(dirpath));
+  } else {
+    // 判断第二个参数是否正常,避免调用时传入错误参数
+    if (dirname !== path.dirname(dirpath)) {
+      this.mkdir(dirpath);
+      return;
+    }
+    if (fs.existsSync(dirname)) {
+      fs.mkdirSync(dirpath);
+    } else {
+      this.mkdir(dirname, path.dirname(dirname));
+      fs.mkdirSync(dirpath);
+    }
+  }
+
+  console.log('==> dir end', dirpath);
+};
+
+/*
+ * 获取目录下指定后缀的所有文件
+ * @param dir
+ * @param ext
+ * @return {Array}
+ */
+exports.getAllFiles = function(dir, ext) {
+  if (!dir) {
+    return [];
+  }
+
+  const self = this;
+  let extFiles = [];
+
+  const files = fs.readdirSync(dir);
+  files.forEach(function(file) {
+    const pathname = path.join(dir, file);
+    const stat = fs.lstatSync(pathname);
+
+    if (stat.isDirectory()) {
+      extFiles = extFiles.concat(self.getAllFiles(pathname, ext));
+    } else if (path.extname(pathname) === ext) {
+      extFiles.push(pathname.replace(cwd, '.'));
+    }
+  });
+
+  return extFiles;
+};
+
+/*
+ * 获取目录下所有文件夹
+ */
+exports.getDirs = function(dir) {
+  if (!dir) {
+    return [];
+  }
+
+  const components = [];
+  const files = fs.readdirSync(dir);
+  files.forEach(function(item, index) {
+    const stat = fs.lstatSync(dir + '/' + item);
+    if (stat.isDirectory() === true) {
+      components.push(item);
+    }
+  });
+
+  return components;
+};
+
+exports.fileExist = function(filePath) {
+  try {
+    return fs.statSync(filePath).isFile();
+  } catch (err) {
+    return false;
+  }
+};
+
+exports.delDir = function(path) {
+  let files = [];
+  if (fs.existsSync(path)) {
+    files = fs.readdirSync(path);
+    files.forEach((file, index) => {
+      const curPath = path + '/' + file;
+      if (fs.statSync(curPath).isDirectory()) {
+        this.delDir(curPath); // 递归删除文件夹
+      } else {
+        fs.unlinkSync(curPath); // 删除文件
+      }
+    });
+    fs.rmdirSync(path);
+  }
+};
+
+exports.chmodPath = function(path, mode) {
+  let files = [];
+  if (fs.existsSync(path)) {
+    files = fs.readdirSync(path);
+    files.forEach((file, index) => {
+      const curPath = path + '/' + file;
+      if (fs.statSync(curPath).isDirectory()) {
+        this.chmodPath(curPath, mode); // 递归删除文件夹
+      } else {
+        fs.chmodSync(curPath, mode);
+      }
+    });
+    fs.chmodSync(path, mode);
+  }
+};
+
+/**
+ * 判断是否是同一天
+ * @param d1
+ * @param d2
+ * @return {boolean}
+ */
+exports.isSameDay = function(d1, d2) {
+  return (
+    d1.getFullYear() === d2.getFullYear() &&
+    d1.getMonth() === d2.getMonth() &&
+    d1.getDate() === d2.getDate()
+  );
+};
+
+/*
+ * 判断是否在有效期
+ */
+exports.isInDate = function(createDate, days) {
+  const diffDays = this.diffDays(createDate) + 1;
+  return diffDays <= days;
+};
+
+/*
+ * differ days
+ * 返回两个日期相隔的天数
+ * 按0点算
+ * 1日0点与2日0点相隔为1天
+ */
+exports.diffDays = function(createDate) {
+  const tmp = new Date();
+  tmp.setHours(0, 0, 0, 0);
+  createDate.setHours(0, 0, 0, 0);
+  return (tmp - createDate) / 24 / 3600000;
+};
+
+/*
+ * differ weeks
+ * 判断两个日期是否在同一周
+ * add by mumu
+ */
+exports.isSameWeek = function(old, now) {
+  const oneDayTime = 1000 * 60 * 60 * 24;
+  const old_count = parseInt(old.getTime() / oneDayTime);
+  const now_other = parseInt(now.getTime() / oneDayTime);
+  return parseInt((old_count + 4) / 7) == parseInt((now_other + 4) / 7);
+};
+
+/**
+ * 读取json文件并解析
+ * @param path
+ * @return {any}
+ */
+exports.loadJson = function(path) {
+  return JSON.parse(fs.readFileSync(path).toString());
+};
+
+exports.getRandomArrayElements = function(arr, count) {
+  let shuffled = arr.slice(0),
+    i = arr.length,
+    min = i - count,
+    temp,
+    index;
+  while (i-- > min) {
+    index = Math.floor((i + 1) * Math.random());
+    temp = shuffled[index];
+    shuffled[index] = shuffled[i];
+    shuffled[i] = temp;
+  }
+  return shuffled.slice(min);
+};
+
+exports.getTodayExpireTime = function() {
+  const endTime = new Date(new Date().setHours(23, 59, 59, 0)) / 1000;
+  const expiresTime = endTime - Math.floor(new Date().getTime() / 1000);
+  return expiresTime;
+};
+
+exports.objKeySort = function(obj) {
+  const newkey = Object.keys(obj).sort();
+  const newObj = {};
+  for (let i = 0; i < newkey.length; i++) {
+    newObj[newkey[i]] = obj[newkey[i]];
+  }
+  return newObj;
+};
+
+exports.serialize = function(obj) {
+  const str = [];
+  for (const p in obj) {
+    if (obj.hasOwnProperty(p)) {
+      str.push(p + '=' + obj[p]);
+    }
+  }
+  return str.join('&');
+};
+
+exports.keepTwoDecimalFull = function(num) {
+  let result = parseFloat(num);
+  if (isNaN(result)) {
+    return false;
+  }
+  result = Math.round(num * 100) / 100;
+  let s_x = result.toString();
+  let pos_decimal = s_x.indexOf('.');
+  if (pos_decimal < 0) {
+    pos_decimal = s_x.length;
+    s_x += '.';
+  }
+  while (s_x.length <= pos_decimal + 2) {
+    s_x += '0';
+  }
+  return s_x;
+};
+
+exports.sleep = function(time = 0) {
+  return new Promise((resolve, reject) => {
+    setTimeout(() => {
+      resolve();
+    }, time);
+  });
+};
+
+/*
+ * 按行读取文件内容
+ * 返回:字符串数组
+ * 参数:fReadName:文件名路径
+ */
+exports.readFileToArr = async function(fReadName) {
+  const fRead = fs.createReadStream(fReadName);
+  const objReadline = readline.createInterface({
+    input: fRead,
+  });
+
+  return new Promise((resolve, reject) => {
+    const arr = [];
+    objReadline.on('line', function(line) {
+      arr.push(line);
+    });
+    objReadline.on('close', function() {
+      resolve(arr);
+    });
+  });
+};
+
+exports.compareVersion = function(version, bigVersion) {
+  version = version.split('.');
+  bigVersion = bigVersion.split('.');
+  for (let i = 0; i < version.length; i++) {
+    version[i] = +version[i];
+    bigVersion[i] = +bigVersion[i];
+    if (version[i] > bigVersion[i]) {
+      return false;
+    } else if (version[i] < bigVersion[i]) {
+      return true;
+    }
+  }
+  return false;
+};
+
+exports.handleVersion = function(version) {
+  if (!version) return version;
+  version = version + '';
+  if (version[0] === 'v') {
+    return version.substr(1);
+  }
+  return version;
+};
+
+/*
+ * 获取本机IP地址
+ */
+exports.getIPAddress = function() {
+  const interfaces = require('os').networkInterfaces();
+  for (const devName in interfaces) {
+    const iface = interfaces[devName];
+    for (let i = 0; i < iface.length; i++) {
+      const alias = iface[i];
+      if (
+        alias.family === 'IPv4' &&
+        alias.address !== '127.0.0.1' &&
+        !alias.internal
+      ) {
+        return alias.address;
+      }
+    }
+  }
+};
+
+/*
+ * 判断IP是否在同一网段
+ */
+exports.isEqualIPAddress = function (addr1, addr2, mask = '255.255.255.0'){
+  if(!addr1 || !addr2 || !mask){
+    console.log("各参数不能为空");
+    return false;
+  }
+  var 
+  res1 = [],
+  res2 = [];
+  addr1 = addr1.split(".");
+  addr2 = addr2.split(".");
+  mask  = mask.split(".");
+  for(var i = 0,ilen = addr1.length; i < ilen ; i += 1){
+    res1.push(parseInt(addr1[i]) & parseInt(mask[i]));
+    res2.push(parseInt(addr2[i]) & parseInt(mask[i]));
+  }
+  if(res1.join(".") == res2.join(".")){
+    return true;
+  }else{
+    return false;
+  }
+}
+
+/*
+ * 端口是否被占用
+ */
+exports.portIsOccupied = function portIsOccupied(port) {
+  const server = net.createServer().listen(port, '0.0.0.0');
+  return new Promise((resolve, reject) => {
+    server.on('listening', () => {
+      console.log(`the server is runnint on port ${port}`);
+      server.close();
+      resolve(false);
+    });
+
+    server.on('error', err => {
+      if (err.code === 'EADDRINUSE') {
+        resolve(true);
+        console.log(`this port ${port} is occupied.try another.`);
+      } else {
+        resolve(true);
+      }
+    });
+  });
+};

+ 42 - 0
app/utils/validataRules.js

@@ -0,0 +1,42 @@
+'use strict';
+// 正则校验规则集合
+const regRule = require('./regRule');
+// 校验规则
+const validateRules = {
+  // 账号校验1:手机号&&密码
+  accountType1: () => {
+    return {
+      email: {
+        type: 'string',
+        required: true,
+        allowEmpty: false,
+        format: regRule.emailReg,
+      },
+      password: {
+        type: 'string',
+        require: true,
+        allowEmpty: false,
+        format: regRule.passwordReg1,
+      },
+    };
+  },
+
+  // 账号校验2:手机号&&验证码登录
+  accountType2: () => {
+    return {
+      // phone: {
+      //   type: 'string',
+      //   required: true,
+      //   allowEmpty: false,
+      //   format: regRule.phoneReg,
+      // },
+      code: {
+        type: 'string',
+        required: true,
+        allowEmpty: false,
+      },
+    };
+  },
+};
+
+module.exports = validateRules;

+ 43 - 91
package-lock.json

@@ -771,6 +771,7 @@
       "version": "6.12.6",
       "resolved": "https://registry.npm.taobao.org/ajv/download/ajv-6.12.6.tgz?cache=0&sync_timestamp=1603561541446&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-6.12.6.tgz",
       "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=",
+      "dev": true,
       "requires": {
         "fast-deep-equal": "^3.1.1",
         "fast-json-stable-stringify": "^2.0.0",
@@ -1133,11 +1134,6 @@
       "resolved": "https://registry.npm.taobao.org/atob/download/atob-2.1.2.tgz",
       "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k="
     },
-    "atomically": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npm.taobao.org/atomically/download/atomically-1.6.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fatomically%2Fdownload%2Fatomically-1.6.0.tgz",
-      "integrity": "sha1-2NR/mYNNu4i9YmbMaaFEfi82dew="
-    },
     "autod": {
       "version": "3.1.0",
       "resolved": "https://registry.npm.taobao.org/autod/download/autod-3.1.0.tgz",
@@ -3275,30 +3271,6 @@
         }
       }
     },
-    "conf": {
-      "version": "7.1.2",
-      "resolved": "https://registry.npm.taobao.org/conf/download/conf-7.1.2.tgz?cache=0&sync_timestamp=1597341581534&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fconf%2Fdownload%2Fconf-7.1.2.tgz",
-      "integrity": "sha1-2WeKnY8E3ov1zUdRBdqP2uScLsQ=",
-      "requires": {
-        "ajv": "^6.12.2",
-        "atomically": "^1.3.1",
-        "debounce-fn": "^4.0.0",
-        "dot-prop": "^5.2.0",
-        "env-paths": "^2.2.0",
-        "json-schema-typed": "^7.0.3",
-        "make-dir": "^3.1.0",
-        "onetime": "^5.1.0",
-        "pkg-up": "^3.1.0",
-        "semver": "^7.3.2"
-      },
-      "dependencies": {
-        "semver": {
-          "version": "7.3.2",
-          "resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.2.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.2.tgz",
-          "integrity": "sha1-YElisFK4HtB4aq6EOJ/7pw/9OTg="
-        }
-      }
-    },
     "config-chain": {
       "version": "1.1.12",
       "resolved": "https://registry.npm.taobao.org/config-chain/download/config-chain-1.1.12.tgz",
@@ -3507,14 +3479,6 @@
       "resolved": "https://registry.npm.taobao.org/debounce/download/debounce-1.2.0.tgz",
       "integrity": "sha1-RKVAq8DqmUMBjcDqqVzOh/Zc0TE="
     },
-    "debounce-fn": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npm.taobao.org/debounce-fn/download/debounce-fn-4.0.0.tgz?cache=0&sync_timestamp=1582125347285&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebounce-fn%2Fdownload%2Fdebounce-fn-4.0.0.tgz",
-      "integrity": "sha1-7XbSBtilDmDeDdZtSU2Cg1/+Ycc=",
-      "requires": {
-        "mimic-fn": "^3.0.0"
-      }
-    },
     "debug": {
       "version": "4.2.0",
       "resolved": "https://registry.npm.taobao.org/debug/download/debug-4.2.0.tgz?cache=0&sync_timestamp=1600502855763&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebug%2Fdownload%2Fdebug-4.2.0.tgz",
@@ -3793,6 +3757,7 @@
       "version": "5.3.0",
       "resolved": "https://registry.npm.taobao.org/dot-prop/download/dot-prop-5.3.0.tgz",
       "integrity": "sha1-kMzOcIzZzYLMTcjD3dmr3VWyDog=",
+      "dev": true,
       "requires": {
         "is-obj": "^2.0.0"
       }
@@ -4990,15 +4955,6 @@
         }
       }
     },
-    "electron-store": {
-      "version": "6.0.1",
-      "resolved": "https://registry.npm.taobao.org/electron-store/download/electron-store-6.0.1.tgz",
-      "integrity": "sha1-IXi53Deut0nZnPnR0bwJCJC5Itw=",
-      "requires": {
-        "conf": "^7.1.2",
-        "type-fest": "^0.16.0"
-      }
-    },
     "electron-to-chromium": {
       "version": "1.3.585",
       "resolved": "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.585.tgz",
@@ -5086,7 +5042,8 @@
     "env-paths": {
       "version": "2.2.0",
       "resolved": "https://registry.npm.taobao.org/env-paths/download/env-paths-2.2.0.tgz",
-      "integrity": "sha1-zcpVfcAJFSkX1hZuL+vh8DloXkM="
+      "integrity": "sha1-zcpVfcAJFSkX1hZuL+vh8DloXkM=",
+      "dev": true
     },
     "error-ex": {
       "version": "1.3.2",
@@ -6098,7 +6055,8 @@
     "fast-deep-equal": {
       "version": "3.1.3",
       "resolved": "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1591599651635&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz",
-      "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU="
+      "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU=",
+      "dev": true
     },
     "fast-diff": {
       "version": "1.2.0",
@@ -6122,7 +6080,8 @@
     "fast-json-stable-stringify": {
       "version": "2.1.0",
       "resolved": "https://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz",
-      "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM="
+      "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=",
+      "dev": true
     },
     "fast-levenshtein": {
       "version": "2.0.6",
@@ -7214,7 +7173,8 @@
     "is-obj": {
       "version": "2.0.0",
       "resolved": "https://registry.npm.taobao.org/is-obj/download/is-obj-2.0.0.tgz",
-      "integrity": "sha1-Rz+wXZc3BeP9liBUUBjKjiLvSYI="
+      "integrity": "sha1-Rz+wXZc3BeP9liBUUBjKjiLvSYI=",
+      "dev": true
     },
     "is-path-inside": {
       "version": "3.0.2",
@@ -7230,6 +7190,11 @@
         "isobject": "^3.0.1"
       }
     },
+    "is-promise": {
+      "version": "2.2.2",
+      "resolved": "https://registry.npm.taobao.org/is-promise/download/is-promise-2.2.2.tgz",
+      "integrity": "sha1-OauVnMv5p3TPB597QMeib3YxNfE="
+    },
     "is-regex": {
       "version": "1.1.1",
       "resolved": "https://registry.npm.taobao.org/is-regex/download/is-regex-1.1.1.tgz?cache=0&sync_timestamp=1596555640141&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-regex%2Fdownload%2Fis-regex-1.1.1.tgz",
@@ -7441,12 +7406,8 @@
     "json-schema-traverse": {
       "version": "0.4.1",
       "resolved": "https://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz?cache=0&sync_timestamp=1599333999343&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson-schema-traverse%2Fdownload%2Fjson-schema-traverse-0.4.1.tgz",
-      "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA="
-    },
-    "json-schema-typed": {
-      "version": "7.0.3",
-      "resolved": "https://registry.npm.taobao.org/json-schema-typed/download/json-schema-typed-7.0.3.tgz",
-      "integrity": "sha1-I/9IG4tO680soSO0+gQJ5mRpotk="
+      "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=",
+      "dev": true
     },
     "json-stable-stringify-without-jsonify": {
       "version": "1.0.1",
@@ -7913,6 +7874,18 @@
         "js-tokens": "^3.0.0 || ^4.0.0"
       }
     },
+    "lowdb": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npm.taobao.org/lowdb/download/lowdb-1.0.0.tgz",
+      "integrity": "sha1-UkO+ayJ4bMzjDlDJoz6sNrIMgGQ=",
+      "requires": {
+        "graceful-fs": "^4.1.3",
+        "is-promise": "^2.1.0",
+        "lodash": "4",
+        "pify": "^3.0.0",
+        "steno": "^0.4.1"
+      }
+    },
     "lower-case": {
       "version": "1.1.4",
       "resolved": "https://registry.npm.taobao.org/lower-case/download/lower-case-1.1.4.tgz",
@@ -7944,6 +7917,7 @@
       "version": "3.1.0",
       "resolved": "https://registry.npm.taobao.org/make-dir/download/make-dir-3.1.0.tgz?cache=0&sync_timestamp=1587567576732&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmake-dir%2Fdownload%2Fmake-dir-3.1.0.tgz",
       "integrity": "sha1-QV6WcEazp/HRhSd9hKpYIDcmoT8=",
+      "dev": true,
       "requires": {
         "semver": "^6.0.0"
       },
@@ -7951,7 +7925,8 @@
         "semver": {
           "version": "6.3.0",
           "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
-          "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0="
+          "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
+          "dev": true
         }
       }
     },
@@ -8099,11 +8074,6 @@
         "mime-db": "1.44.0"
       }
     },
-    "mimic-fn": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-3.1.0.tgz?cache=0&sync_timestamp=1596095644798&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-fn%2Fdownload%2Fmimic-fn-3.1.0.tgz",
-      "integrity": "sha1-ZXVRRbvz42lUuUnBZFBCdFHVynQ="
-    },
     "mimic-response": {
       "version": "1.0.1",
       "resolved": "https://registry.npm.taobao.org/mimic-response/download/mimic-response-1.0.1.tgz?cache=0&sync_timestamp=1589481326973&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-response%2Fdownload%2Fmimic-response-1.0.1.tgz",
@@ -9835,21 +9805,6 @@
         "wrappy": "1"
       }
     },
-    "onetime": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npm.taobao.org/onetime/download/onetime-5.1.2.tgz?cache=0&sync_timestamp=1597003911641&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fonetime%2Fdownload%2Fonetime-5.1.2.tgz",
-      "integrity": "sha1-0Oluu1awdHbfHdnEgG5SN5hcpF4=",
-      "requires": {
-        "mimic-fn": "^2.1.0"
-      },
-      "dependencies": {
-        "mimic-fn": {
-          "version": "2.1.0",
-          "resolved": "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-2.1.0.tgz?cache=0&sync_timestamp=1596095644798&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-fn%2Fdownload%2Fmimic-fn-2.1.0.tgz",
-          "integrity": "sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs="
-        }
-      }
-    },
     "only": {
       "version": "0.0.2",
       "resolved": "https://registry.npm.taobao.org/only/download/only-0.0.2.tgz",
@@ -10193,14 +10148,6 @@
         }
       }
     },
-    "pkg-up": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npm.taobao.org/pkg-up/download/pkg-up-3.1.0.tgz",
-      "integrity": "sha1-EA7CNcwVDk/UJRlBJZaihRKg3vU=",
-      "requires": {
-        "find-up": "^3.0.0"
-      }
-    },
     "platform": {
       "version": "1.3.6",
       "resolved": "https://registry.npm.taobao.org/platform/download/platform-1.3.6.tgz?cache=0&sync_timestamp=1593860999570&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fplatform%2Fdownload%2Fplatform-1.3.6.tgz",
@@ -10459,7 +10406,8 @@
     "punycode": {
       "version": "2.1.1",
       "resolved": "https://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz",
-      "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew="
+      "integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew=",
+      "dev": true
     },
     "pupa": {
       "version": "2.1.1",
@@ -11513,6 +11461,14 @@
       "resolved": "https://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz",
       "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
     },
+    "steno": {
+      "version": "0.4.4",
+      "resolved": "https://registry.npm.taobao.org/steno/download/steno-0.4.4.tgz",
+      "integrity": "sha1-BxEFvfwobmYVwEA8J+nXtdy4Vcs=",
+      "requires": {
+        "graceful-fs": "^4.1.3"
+      }
+    },
     "stream-combiner": {
       "version": "0.0.4",
       "resolved": "https://registry.npm.taobao.org/stream-combiner/download/stream-combiner-0.0.4.tgz",
@@ -12237,11 +12193,6 @@
         "prelude-ls": "~1.1.2"
       }
     },
-    "type-fest": {
-      "version": "0.16.0",
-      "resolved": "https://registry.npm.taobao.org/type-fest/download/type-fest-0.16.0.tgz",
-      "integrity": "sha1-MkC4kaeLDerpENvrhlU+VSoUiGA="
-    },
     "type-is": {
       "version": "1.6.18",
       "resolved": "https://registry.npm.taobao.org/type-is/download/type-is-1.6.18.tgz",
@@ -12471,6 +12422,7 @@
       "version": "4.4.0",
       "resolved": "https://registry.npm.taobao.org/uri-js/download/uri-js-4.4.0.tgz?cache=0&sync_timestamp=1598814377097&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Furi-js%2Fdownload%2Furi-js-4.4.0.tgz",
       "integrity": "sha1-qnFCYd55PoqCNHp7zJznTobyhgI=",
+      "dev": true,
       "requires": {
         "punycode": "^2.1.0"
       }

+ 1 - 1
package.json

@@ -108,11 +108,11 @@
     "egg-scripts": "^2.13.0",
     "egg-view-ejs": "^2.0.0",
     "electron-log": "^4.2.2",
-    "electron-store": "^6.0.1",
     "electron-updater": "^4.3.5",
     "get-port": "^5.1.1",
     "glob": "^7.1.6",
     "lodash": "^4.17.11",
+    "lowdb": "^1.0.0",
     "semver": "^5.4.1"
   }
 }