From b8a0be1458a92adf72ccacab1781c7df14545c1f Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Sun, 18 Dec 2022 13:06:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E7=94=A8=E6=88=B7=E8=AE=BE=E7=BD=AE=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=EF=BC=8C=E6=A8=A1=E6=9D=BF=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/note.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/model/note.js b/model/note.js index c3eb961..a858c66 100644 --- a/model/note.js +++ b/model/note.js @@ -235,8 +235,10 @@ export default class note { } let urlType = this.note_file("xiaoyao"); let objFile = Object.keys(urlType) + let defFile; if (objFile.length > 0) { objFile = objFile[lodash.random(0, objFile.length - 1)] + defFile=objFile; } let img_path = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/${path_img[mb]}`; if (this.tempData[this.e.user_id] && this.tempData[this.e.user_id].type > -1&&this.tempData[this.e.user_id]?.temp?.length!==0) { @@ -261,10 +263,13 @@ export default class note { mb2_icon: "" }) } + // console.log(urlType,objFile,path_img) img_path = `${urlType[objFile]}${path_img[mb]}`; + if (!fs.existsSync(img_path)) { + img_path=`${urlType[defFile]}${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 = []; for (let val of image) { list_img.push(val)