From 325f40253024d3e6e91b56e5602768aaefccd201 Mon Sep 17 00:00:00 2001 From: Zhanpeng Yang Date: Sat, 12 Oct 2024 14:07:09 +0800 Subject: [PATCH] =?UTF-8?q?[Changed]=E4=B8=8A=E4=BC=A0=E7=9A=84=E5=85=89?= =?UTF-8?q?=E8=B0=B1=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=B5=8B?= =?UTF-8?q?=E9=87=8F=E5=BC=80=E5=A7=8B=E5=89=8D10=E7=A7=92=E5=88=B0?= =?UTF-8?q?=E6=B5=8B=E9=87=8F=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/upload/route.js | 2 +- src/app/upload/page.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/api/upload/route.js b/src/app/api/upload/route.js index ee45567..e9eb77d 100644 --- a/src/app/api/upload/route.js +++ b/src/app/api/upload/route.js @@ -203,7 +203,7 @@ export async function POST(request) { ); const spectralData = await readIntervalSpectralData( - new Date(requestData.measureStartDatetime).getTime(), + new Date(requestData.measureStartDatetime).getTime() - 10 * 1000, //前10秒的数据 new Date(requestData.measureEndDatetime).getTime() ); diff --git a/src/app/upload/page.js b/src/app/upload/page.js index 4118b90..9b2d139 100644 --- a/src/app/upload/page.js +++ b/src/app/upload/page.js @@ -46,17 +46,17 @@ export default function Upload() { // }; // }, []); - const [furnaceNumber, setFurnaceNumber] = useState(98213234); + const [furnaceNumber, setFurnaceNumber] = useState(24609); const handleFurnaceNumberChange = (event) => { setFurnaceNumber(event.target.value); }; - const getCurrentDateTime = () => { + const getDeayledCurrentDateTime = (interval = 0) => { let now = new Date(); // 将时间转换为 UTC+8 时区 - // const offset = 8 * 60 * 60 * 1000; // 8 小时的毫秒数 - // now = new Date(now.getTime() + offset); + const offset = interval * 1000; // 8 小时的毫秒数 + now = new Date(now.getTime() + offset); const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, "0"); const day = String(now.getDate()).padStart(2, "0"); @@ -68,12 +68,12 @@ export default function Upload() { const [measureStartDatetime, setMeasureStartDatetime] = useState( // "2024-09-26T14:40:00" - getCurrentDateTime() + getDeayledCurrentDateTime(0) ); const [measureEndDatetime, setMeasureEndDatetime] = useState( // "2024-09-26T14:29:00" - getCurrentDateTime() + getDeayledCurrentDateTime(20) ); const handleMeasureEndDatetimeChange = (event) => { @@ -126,13 +126,13 @@ export default function Upload() { setUploadType(event.target.value); }; - const [stellType, setStellType] = useState(""); + const [stellType, setStellType] = useState("HRB400"); const handleStellTypeChange = (event) => { setStellType(event.target.value); }; - const [remark, setRemark] = useState(""); + const [remark, setRemark] = useState("正常炼钢"); const handleRemarkChange = (event) => { setRemark(event.target.value);