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({
username: yapi.WEBCONFIG.adminAccount.substr(0, yapi.WEBCONFIG.adminAccount.indexOf('@')),
email: yapi.WEBCONFIG.adminAccount,
password: yapi.commons.generatePassword('qunar.com', passsalt),
password: yapi.commons.generatePassword('ymfe.org', passsalt),
passsalt: passsalt,
role: 'admin',
add_time: yapi.commons.time(),
@ -126,16 +126,16 @@ function setupSql() {
result.then(function () {
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);
}, function (err) {
console.log(`初始化管理员账号 "${yapi.WEBCONFIG.adminAccount}" 失败, ${err.message}`); // eslint-disable-line
process.exit(0);
throw new Error(`初始化管理员账号 "${yapi.WEBCONFIG.adminAccount}" 失败, ${err.message}`); // eslint-disable-line
});
}).catch(function(err){
console.log('Error:', err.message)
}).catch(function(err){
throw new Error(err.message);
})
}