Jelajahi Sumber

增加预警测试api

kevin_zhangl 2 tahun lalu
induk
melakukan
0624c3f018

+ 1 - 0
frontendApi/config/urlManagerRules.php

@@ -20,6 +20,7 @@ return [
             'GET page-data' => 'page-data',
             'GET captcha' => 'captcha',
             'GET send-notice' => 'send-notice',
+            'GET send-notify' => 'send-notify',
         ],
     ],
     [

+ 17 - 0
frontendApi/modules/v1/controllers/SiteController.php

@@ -7,6 +7,7 @@
  */
 namespace frontendApi\modules\v1\controllers;
 
+use common\helpers\Alarm;
 use common\helpers\Cache;
 use common\helpers\snowflake\PageSnowFake;
 use common\models\Ad;
@@ -18,6 +19,7 @@ use Yii;
 use frontendApi\modules\v1\models\User;
 
 use common\helpers\parsedown\Parsedown;
+use yii\web\HttpException;
 
 class SiteController extends BaseController
 {
@@ -286,4 +288,19 @@ class SiteController extends BaseController
 
         return static::notice(['data' => $data['bug监控正常运行,没有发现异常,奥利给!']]);
     }
+
+    /**
+     * @throws HttpException
+     * @throws \Exception
+     */
+    public function actionSendNotify()
+    {
+        Alarm::reportAlarm([
+            'stance' => 1,
+            'brand' => 'OTA',
+            'message' => '预警信息测试',
+        ]);
+
+        return static::notice('成功', 0);
+    }
 }