Browse Source

修改发送消息提醒环境限制

kevin_zhangl 3 years ago
parent
commit
5c43006013
1 changed files with 7 additions and 5 deletions
  1. 7 5
      common/helpers/DingTalk.php

+ 7 - 5
common/helpers/DingTalk.php

@@ -38,12 +38,14 @@ class DingTalk
         ];
 
         // 正式环境才发送
-        $result = self::request_by_curl(json_encode($data));
-        if ($result['errcode'] > 0) {
-            // 重新推送一次,如果失败,写错误日志
+        if (in_array($_SERVER['HTTP_HOST'], ['ng-frontend-api.elken.com', 'ng-backend-api.elken.com'])) {
             $result = self::request_by_curl(json_encode($data));
-            if (!$result['errcode']) {
-                LoggerTool::error([$result, $message]);
+            if ($result['errcode'] > 0) {
+                // 重新推送一次,如果失败,写错误日志
+                $result = self::request_by_curl(json_encode($data));
+                if (!$result['errcode']) {
+                    LoggerTool::error([$result, $message]);
+                }
             }
         }
     }