From ffd380ec5251592b780985d2283a71fbbc64a8a3 Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Mon, 31 Oct 2022 15:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A8=A1=E6=9D=BF=E4=B8=80?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Note.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/apps/Note.js b/apps/Note.js index 5d31423..09cc005 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -226,13 +226,12 @@ export async function Note(e, { if (mb < 0) { mb = lodash.random(0, path_url.length - 1); } - let urlType = note_file("xiaoyao"); let objFile = Object.keys(urlType) if (objFile.length > 0) { objFile = objFile[lodash.random(0, objFile.length - 1)] } - let img_path = `${urlType[objFile]}`; + let img_path = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/${path_img[mb]}`; if (tempData[e.user_id] && tempData[e.user_id].type > -1) { mb = tempData[e.user_id].type; objFile = tempData[e.user_id].temp; @@ -248,7 +247,6 @@ export async function Note(e, { } img_path = `${urlType[objFile]}${path_img[mb]}`; } - var image = fs.readdirSync(img_path); // console.log(fs.readdirSync(`./plugins/xiaoyao-cvs-plugin/resources/dailyNote/BJT-Templet/Template2`)) var list_img = []; @@ -506,21 +504,21 @@ const note_file = function(xiaoyao) { let url3 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image/` var urlFile = fs.readdirSync(url1); var urlType = {}; - for (let val of urlFile) { - if (val.includes(".")) continue; - urlType[val] = url1 + val - } - if (fs.existsSync(url2)) { - var bJTurlFile = fs.readdirSync(url2); - for (let val of bJTurlFile) { - if (!val.includes("Template")) continue; - let file = fs.readdirSync(`${url2}${val}`); - for (let va of file) { - if (va.includes(".")) continue; - urlType[va] = url2 + val + "/" + va + for (let val of urlFile) { + if (val.includes(".")) continue; + urlType[val] = url1 + val + } + if (fs.existsSync(url2)) { + var bJTurlFile = fs.readdirSync(url2); + for (let val of bJTurlFile) { + if (!val.includes("Template")) continue; + let file = fs.readdirSync(`${url2}${val}`); + for (let va of file) { + if (va.includes(".")) continue; + urlType[va] = url2 + val + "/" + va + } } } - } if (!xiaoyao) { var urlFileOne = fs.readdirSync(url3); for (let val of urlFileOne) {