|
|
@ -58,9 +58,10 @@ function addBackups(opts) { |
|
|
|
// const url = '10.8.30.160:8085/dumpDB?dbHost=10.8.30.75&dbPort=5432&user=postgres&password=1234&dbName=Anxinyun0916'//测试使用
|
|
|
|
const url = backupsUrl + `/dumpDB?dbHost=${host}&dbPort=${port}&user=${user}&password=${password}&dbName=${database}`; |
|
|
|
request.post(url).then(res => { |
|
|
|
const { fileInfo: { name, size }, code } = res.body |
|
|
|
const { fileInfo: { name, size }, code, message } = res.body |
|
|
|
models.Backups.update({ |
|
|
|
size, source: name, state: code == 200 ? '备份成功' : '备份失败', completeTime: moment() |
|
|
|
size, source: name, state: code == 200 ? '备份成功' : '备份失败', completeTime: moment(), |
|
|
|
log: code == 200 ? '' : message |
|
|
|
}, { where: { id: backup.id } }) |
|
|
|
if (code != 200) ctx.fs.logger.error(`path: ${ctx.path}, error: ${message}`); |
|
|
|
}) |
|
|
@ -140,6 +141,7 @@ function restore(opts) { |
|
|
|
const { code, message } = res.body |
|
|
|
models.Backups.update({ |
|
|
|
state: code == 200 ? '恢复成功' : '恢复失败', |
|
|
|
log: code == 200 ? '' : message |
|
|
|
}, { where: { id: id } }) |
|
|
|
if (code != 200) ctx.fs.logger.error(`path: ${ctx.path}, error: ${message}`); |
|
|
|
}) |
|
|
|