From d373cde1d2cf3459f24a8cfa9bb9e186566965e7 Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 22 Oct 2018 14:13:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=88=E6=9D=83=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E7=BC=96=E5=86=99=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin-function/build.xml | 6 +++++- plugin-function/src/main/java/com/fr/plugin/MyAbs.java | 6 ++++++ .../src/main/java/com/fr/plugin/MyFunctionConstants.java | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java diff --git a/plugin-function/build.xml b/plugin-function/build.xml index 59ae0c1..e807443 100644 --- a/plugin-function/build.xml +++ b/plugin-function/build.xml @@ -5,7 +5,7 @@ - + @@ -68,6 +68,10 @@ + + + + diff --git a/plugin-function/src/main/java/com/fr/plugin/MyAbs.java b/plugin-function/src/main/java/com/fr/plugin/MyAbs.java index 0e09770..c5ed012 100644 --- a/plugin-function/src/main/java/com/fr/plugin/MyAbs.java +++ b/plugin-function/src/main/java/com/fr/plugin/MyAbs.java @@ -4,16 +4,22 @@ import com.fr.general.FArray; import com.fr.general.GeneralUtils; import com.fr.intelli.record.Focus; import com.fr.intelli.record.Original; +import com.fr.plugin.context.PluginContexts; import com.fr.record.analyzer.EnableMetrics; import com.fr.script.AbstractFunction; import com.fr.stable.ArrayUtils; import com.fr.stable.Primitive; +import com.fr.stable.fun.Authorize; @EnableMetrics +@Authorize(callSignKey = MyFunctionConstants.PLUGIN_ID) public class MyAbs extends AbstractFunction { @Focus(id = "com.fr.plugin.function.test", text = "Plugin-Test_Function_Abs", source = Original.PLUGIN) public Object run(Object[] args) { + if (!PluginContexts.currentContext().isAvailable()) { + return "Error:authorization is expired."; + } int len = ArrayUtils.getLength(args); if (len == 0) { return Primitive.ERROR_VALUE; diff --git a/plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java b/plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java new file mode 100644 index 0000000..2d7d4a6 --- /dev/null +++ b/plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java @@ -0,0 +1,6 @@ +package com.fr.plugin; + +public class MyFunctionConstants { + + public static final String PLUGIN_ID = "com.fr.plugin.function.test"; +}