chore: 完善log提示

This commit is contained in:
suxiaoxin 2017-09-27 10:33:06 +08:00
parent 96b5e36a5d
commit f660c20788

View File

@ -25,7 +25,7 @@ function setupSql() {
let result = userInst.save({ let result = userInst.save({
username: yapi.WEBCONFIG.adminAccount.substr(0, yapi.WEBCONFIG.adminAccount.indexOf('@')), username: yapi.WEBCONFIG.adminAccount.substr(0, yapi.WEBCONFIG.adminAccount.indexOf('@')),
email: yapi.WEBCONFIG.adminAccount, email: yapi.WEBCONFIG.adminAccount,
password: yapi.commons.generatePassword('qunar.com', passsalt), password: yapi.commons.generatePassword('ymfe.org', passsalt),
passsalt: passsalt, passsalt: passsalt,
role: 'admin', role: 'admin',
add_time: yapi.commons.time(), add_time: yapi.commons.time(),
@ -126,16 +126,16 @@ function setupSql() {
result.then(function () { result.then(function () {
fs.ensureFileSync(yapi.path.join(yapi.WEBROOT_RUNTIME, 'init.lock')); fs.ensureFileSync(yapi.path.join(yapi.WEBROOT_RUNTIME, 'init.lock'));
console.log(`初始化管理员账号 "${yapi.WEBCONFIG.adminAccount}" 成功`); // eslint-disable-line console.log(`初始化管理员账号成功,账号名:"${yapi.WEBCONFIG.adminAccount}",密码:"ymfe.org"`); // eslint-disable-line
process.exit(0); process.exit(0);
}, function (err) { }, function (err) {
console.log(`初始化管理员账号 "${yapi.WEBCONFIG.adminAccount}" 失败, ${err.message}`); // eslint-disable-line throw new Error(`初始化管理员账号 "${yapi.WEBCONFIG.adminAccount}" 失败, ${err.message}`); // eslint-disable-line
process.exit(0);
}); });
}).catch(function(err){ }).catch(function(err){
console.log('Error:', err.message) throw new Error(err.message);
}) })
} }