Procházet zdrojové kódy

configSample补充messageSendRule.js配置

o2sword před 5 roky
rodič
revize
80ecd548ff
1 změnil soubory, kde provedl 18 přidání a 0 odebrání
  1. 18 0
      o2server/configSample/messageSendRule.js

+ 18 - 0
o2server/configSample/messageSendRule.js

@@ -0,0 +1,18 @@
+/**
+ * 统一消息推送执行脚本,使用在messages.json配置文件
+ * 方法返回boolean类型,true表示满足发送条件且接受对body体的修改,false表示不发送
+ * 变量body表示消息体,每个消息类型的消息体可能不同,是一个Gson的JsonObject对象
+ * 以下excute方法表示拟稿状态的待办不发送消息;excute1方法表示变更或者添加body对象中的modifyFlag参数
+ */
+function excute() {
+    if(body.has("first") && body.has("workCreateType")){
+        if (body.get("first").getAsBoolean() && "surface".equals(body.get("workCreateType").getAsString())){
+            return false;
+        }
+    }
+    return true;
+}
+function excute1() {
+    body.addProperty("modifyFlag","1");
+    return true;
+}