From 8fc62e0e9716f3c2f4cc737a9590309b48633098 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Thu, 7 Nov 2024 21:43:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20calValue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/libs/utils.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/public/libs/utils.js b/public/libs/utils.js index 4c4adea..491e864 100644 --- a/public/libs/utils.js +++ b/public/libs/utils.js @@ -161,6 +161,11 @@ utils.prototype.replaceValue = function (value) { /temp:([a-zA-Z0-9_]+)/g, "core.getFlag('@temp@$1', 0)" ); + if (value.indexOf('switch:') >= 0) + value = value.replace( + /switch:([a-zA-Z0-9_]+)/g, + "core.getFlag('" + (prefix || ':f@x@y') + "@$1', 0)" + ); } return value; }; @@ -169,18 +174,7 @@ utils.prototype.replaceValue = function (value) { utils.prototype.calValue = function (value, prefix) { if (!core.isset(value)) return null; if (typeof value === 'string') { - if ( - value.indexOf(':') >= 0 || - value.indexOf('flag:') >= 0 || - value.indexOf('global:') >= 0 - ) { - if (value.indexOf('switch:') >= 0) - value = value.replace( - /switch:([a-zA-Z0-9_]+)/g, - "core.getFlag('" + (prefix || ':f@x@y') + "@$1', 0)" - ); - value = this.replaceValue(value); - } + value = this.replaceValue(value); return eval(value); } if (value instanceof Function) {