From 6a0a158fbaa333716d74f8c8690d7dd4e7e63ec6 Mon Sep 17 00:00:00 2001 From: dy Date: Thu, 28 Dec 2023 17:33:08 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...{patch_hdinfo.ts => patch_hdinfo_20231228.ts} | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) rename src/fix_patch/{patch_hdinfo.ts => patch_hdinfo_20231228.ts} (85%) diff --git a/src/fix_patch/patch_hdinfo.ts b/src/fix_patch/patch_hdinfo_20231228.ts similarity index 85% rename from src/fix_patch/patch_hdinfo.ts rename to src/fix_patch/patch_hdinfo_20231228.ts index fad15cc..bc009f6 100644 --- a/src/fix_patch/patch_hdinfo.ts +++ b/src/fix_patch/patch_hdinfo_20231228.ts @@ -17,7 +17,7 @@ class Path { console.log('这是第1个脚本执行完成') - return 12 + return _hd } @patchFun @@ -36,26 +36,28 @@ class Path { console.log('这是第2个脚本执行完成') - return 12 + return _hd } @patchFun async fun3(a: any) { //这里执行脚本的内容,加了patchFun的函数,不允许重复执行 console.log("这是第3个脚本里内容"); + let _hd = G.gc.huodong.filter(i => i.htype == 5) - let _hd = G.gc.huodong.find(i => i.htype == 5) - - if (!_hd) { + if (!_hd.length) { console.log('htype5没查到活动') return } - await G.mongodb.collection('hdinfo').updateMany({htype: 5}, {$set: {data: _hd.data}}) + _hd.map(i => { + // @ts-ignore + G.mongodb.collection('hdinfo').updateOne({hdid: i.hdid}, {$set: {...i}}, {upsert: true}) + }) console.log('这是第3个脚本执行完成') - return 12 + return _hd }