diff --git a/env.example.js b/env.example.js index 9feef3c..e3c4427 100644 --- a/env.example.js +++ b/env.example.js @@ -12,7 +12,7 @@ module.exports = Object.freeze({ * - `ENABLE_MULTIPLE_ACCOUNT` 是否启用多账号 * - `MULTIPLE_ACCOUNT_PARM` 多账号参数(JSON格式) <不推荐使用 * ## 调试相关 - * - `LOTTERY_LOG_LEVEL` 输出日志等级 Error OK'); } if (desp) { - log.info('可能中奖了', desp); + log.notice('可能中奖了', desp); await sendNotify(`帐号${num}可能中奖了`, desp); } else { - log.info('中奖检测', '暂未中奖'); + log.notice('中奖检测', '暂未中奖'); } return; } diff --git a/lib/update.js b/lib/update.js index 4932844..4aa0e33 100644 --- a/lib/update.js +++ b/lib/update.js @@ -83,7 +83,7 @@ async function update(isDdownload) { log.info('自动下载', '成功下载到当前目录'); log.info('检查更新', '请手动解压替换可执行文件'); } - log.info('更新说明', '\n' + text + '\n'); + log.notice('更新说明', '\n' + text + '\n'); } else { throw `未找到能在此平台(${process.platform})-(${process.arch})上运行的版本,建议以源码运行`; } diff --git a/lib/utils.js b/lib/utils.js index 6656674..89d0a0e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -191,7 +191,7 @@ const utils = { _level: 3, _colors: [ chalk.hex('#64B3FF'), chalk.grey, chalk.hex('#FFA500'), - chalk.hex('#0070BB'), chalk.hex('#48BB31'), chalk.hex('#BBBB23'), chalk.hex('#FF0006') + chalk.hex('#0070BB'), chalk.hex('#48BB31'), chalk.hex('#BFFF00'), chalk.hex('#BBBB23'), chalk.hex('#FF0006') ], _iso_time: () => new Date(Date.now() + 288e5).toISOString().slice(0, -1) + '+08', _cache: [], @@ -231,7 +231,7 @@ const utils = { process.stdout.write(status_bar); }, debug(context, msg) { - if (this._level > 3) { + if (this._level >= 4) { if (msg instanceof Object) msg = JSON.stringify(msg, null, 4); let color_text_pair = [ [this._colors[0], `[${this._iso_time()}]`], @@ -243,7 +243,7 @@ const utils = { } }, info(context, msg) { - if (this._level > 2) { + if (this._level >= 3) { let color_text_pair = [ [this._colors[0], `[${this._iso_time()}]`], [this._colors[1], '[Info]'], @@ -254,25 +254,37 @@ const utils = { this.proPrint(color_text_pair.map(([color, text]) => color(text))); } }, + notice(context, msg) { + if (this._level >= 2) { + let color_text_pair = [ + [this._colors[0], `[${this._iso_time()}]`], + [this._colors[1], '[Notice]'], + [this._colors[2], `[帐号${process.env['NUMBER']} ${context}]`], + [this._colors[5], `[${msg}]`], + ]; + this._cache.push(color_text_pair.map(it => it[1]).join(' ')); + this.proPrint(color_text_pair.map(([color, text]) => color(text))); + } + }, warn(context, msg) { - if (this._level > 1) { + if (this._level >= 1) { let color_text_pair = [ [this._colors[0], `[${this._iso_time()}]`], [this._colors[1], '[Warn]'], [this._colors[2], `[帐号${process.env['NUMBER']} ${context}]`], - [this._colors[5], `[\n${msg}\n]`], + [this._colors[6], `[\n${msg}\n]`], ]; this._cache.push(color_text_pair.map(it => it[1]).join(' ')); this.proPrint(color_text_pair.map(([color, text]) => color(text))); } }, error(context, msg) { - if (this._level > 0) { + if (this._level >= 0) { let color_text_pair = [ [this._colors[0], `[${this._iso_time()}]`], [this._colors[1], '[Error]'], [this._colors[2], `[帐号${process.env['NUMBER']} ${context}]`], - [this._colors[6], `[\n${msg}\n]`], + [this._colors[7], `[\n${msg}\n]`], ]; this._cache.push(color_text_pair.map(it => it[1]).join(' ')); this.proPrint(color_text_pair.map(([color, text]) => color(text))); @@ -475,7 +487,7 @@ const utils = { }); }); }, - getIpInfo() { + getIpInfo() { return new Promise((resolve) => { send({ url: 'https://myip.qq.com/',