|
@ -62,7 +62,7 @@ async function edit (ctx) { |
|
|
title: data.title, |
|
|
title: data.title, |
|
|
showHeader: Boolean(data.showHeader), |
|
|
showHeader: Boolean(data.showHeader), |
|
|
publish: false, |
|
|
publish: false, |
|
|
mid: timeNow.format(`ssmmHHDDMMYYYY`) |
|
|
mid: timeNow.format(`ssmmHHDDMMYY${Math.floor(Math.random() * 89 + 10)}`) |
|
|
} |
|
|
} |
|
|
if (data.publish) { |
|
|
if (data.publish) { |
|
|
createData.publish = true |
|
|
createData.publish = true |
|
@ -161,6 +161,31 @@ async function edit (ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function refreshId (ctx) { |
|
|
|
|
|
try { |
|
|
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
const { mirrorId } = ctx.params |
|
|
|
|
|
|
|
|
|
|
|
if (!mirrorId) throw '更新镜像服务ID失败'; |
|
|
|
|
|
|
|
|
|
|
|
await models.MirrorTree.update({ |
|
|
|
|
|
mid: timeNow.format(`ssmmHHDDMMYY${Math.floor(Math.random() * 89 + 10)}`) |
|
|
|
|
|
}, { |
|
|
|
|
|
where: { |
|
|
|
|
|
id: mirrorId |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 204; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
|
|
ctx.status = 400; |
|
|
|
|
|
ctx.body = { |
|
|
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async function list (ctx) { |
|
|
async function list (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
@ -447,7 +472,7 @@ async function copy (ctx) { |
|
|
title: mirrorRes.title + '-副本', |
|
|
title: mirrorRes.title + '-副本', |
|
|
showHeader: mirrorRes.showHeader, |
|
|
showHeader: mirrorRes.showHeader, |
|
|
publish: mirrorRes.publish, |
|
|
publish: mirrorRes.publish, |
|
|
mid: timeNow.format(`ssmmHHDDMMYYYY`) |
|
|
mid: timeNow.format(`ssmmHHDDMMYY${Math.floor(Math.random() * 89 + 10)}`) |
|
|
}, { |
|
|
}, { |
|
|
transaction |
|
|
transaction |
|
|
}) |
|
|
}) |
|
@ -543,6 +568,7 @@ async function copy (ctx) { |
|
|
|
|
|
|
|
|
module.exports = { |
|
|
module.exports = { |
|
|
edit, |
|
|
edit, |
|
|
|
|
|
refreshId, |
|
|
list, |
|
|
list, |
|
|
get, |
|
|
get, |
|
|
del, |
|
|
del, |
|
|