正在显示
2 个修改的文件
包含
28 行增加
和
35 行删除
| @@ -2,41 +2,31 @@ | @@ -2,41 +2,31 @@ | ||
| 2 | namespace Jiaoyin; | 2 | namespace Jiaoyin; |
| 3 | 3 | ||
| 4 | class Feishu{ | 4 | class Feishu{ |
| 5 | - private static $users = [ | ||
| 6 | - 'liquid' => 'gd1d6b34', | ||
| 7 | - 'jiaoyin' => 'efdgdecb', | ||
| 8 | - 'linghu' => '6ac9fb35', | ||
| 9 | - 'tanli' => 'f16c2bd7', | ||
| 10 | - 'small' => 'db9d9g4d', | ||
| 11 | - '007' => '9de6cgf3', | ||
| 12 | - ]; | ||
| 13 | - //发送预警通知 | ||
| 14 | - static public function send($content,$users=[]) | 5 | + const user_liquid = 'gd1d6b34'; |
| 6 | + const user_jiaoyin = 'efdgdecb'; | ||
| 7 | + const user_small = 'db9d9g4d'; | ||
| 8 | + const user_linghu = '6ac9fb35'; | ||
| 9 | + const user_tanli = 'f16c2bd7'; | ||
| 10 | + const user_007 = '9de6cgf3'; | ||
| 11 | + //风控处置群 | ||
| 12 | + const url_risk ='https://open.feishu.cn/open-apis/bot/v2/hook/7509c731-a1ab-4e2f-b781-9082a26fd11d'; | ||
| 13 | + //零容忍 | ||
| 14 | + const url_error = 'https://open.feishu.cn/open-apis/bot/v2/hook/a344e313-4d5d-4aa4-912b-dda37b2e3ee8'; | ||
| 15 | + //零忽略 | ||
| 16 | + const url_warning = 'https://open.feishu.cn/open-apis/bot/v2/hook/01c53b94-378a-45a3-abed-415f84f57f4a'; | ||
| 17 | + //软件异常报警 | ||
| 18 | + const url_warning_soft ='https://open.feishu.cn/open-apis/bot/v2/hook/d48c2e4a-0ef9-4684-88d4-e62d878fdaca'; | ||
| 19 | + //测试频道 | ||
| 20 | + const url_test = 'https://open.feishu.cn/open-apis/bot/v2/hook/34a9f127-3838-43fc-bc35-6f5e4e96bf6d'; | ||
| 21 | + //交易与跟单业务沟通 | ||
| 22 | + const url_follow = 'https://open.feishu.cn/open-apis/bot/v2/hook/f30bbb72-091c-499d-a577-43c45dceb158'; | ||
| 23 | + //A01-交易策略研发沟通 | ||
| 24 | + const url_strategy = 'https://open.feishu.cn/open-apis/bot/v2/hook/53444f37-cfec-420c-a4e6-2f415b908dee'; | ||
| 25 | + static public function notice($content,$channel_url,$users=[]) | ||
| 15 | { | 26 | { |
| 16 | - return self::notice($content,'follow',$users); | ||
| 17 | - | ||
| 18 | - } | ||
| 19 | - static public function sendNoError($content,$users=[]) | ||
| 20 | - { | ||
| 21 | - return self::notice($content,'error',$users); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - static public function notice($content,$channel="warning",$users=[]) | ||
| 25 | - { | ||
| 26 | - $urls = [ | ||
| 27 | - 'follow' => 'https://open.feishu.cn/open-apis/bot/v2/hook/f30bbb72-091c-499d-a577-43c45dceb158',//跟单 | ||
| 28 | - 'warning' => 'https://open.feishu.cn/open-apis/bot/v2/hook/d48c2e4a-0ef9-4684-88d4-e62d878fdaca',//盈迪苟异常报警 | ||
| 29 | - 'error' => 'https://open.feishu.cn/open-apis/bot/v2/hook/a344e313-4d5d-4aa4-912b-dda37b2e3ee8',//零容忍 | ||
| 30 | - 'strategy'=>'https://open.feishu.cn/open-apis/bot/v2/hook/53444f37-cfec-420c-a4e6-2f415b908dee',//A01-交易策略研发沟通 | ||
| 31 | - ]; | ||
| 32 | - $url = $urls[$channel] ?? $urls['warning']; | ||
| 33 | $userXml = ''; | 27 | $userXml = ''; |
| 34 | foreach ($users as $user) { | 28 | foreach ($users as $user) { |
| 35 | - if(!empty(self::$users[$user])){ | ||
| 36 | - $userXml .= "<at user_id='" . self::$users[$user] . "'></at>"; | ||
| 37 | - }else{ | ||
| 38 | - $userXml .= "<at user_id='" . $user. "'></at>";//直接用传入的。 | ||
| 39 | - } | 29 | + $userXml .= "<at user_id='" . $user . "'></at>"; |
| 40 | } | 30 | } |
| 41 | $content = [ | 31 | $content = [ |
| 42 | 'msg_type'=>"text", | 32 | 'msg_type'=>"text", |
| @@ -45,10 +35,8 @@ class Feishu{ | @@ -45,10 +35,8 @@ class Feishu{ | ||
| 45 | ] | 35 | ] |
| 46 | ]; | 36 | ]; |
| 47 | $con = json_encode($content); | 37 | $con = json_encode($content); |
| 48 | - return self::send_post_json($url,$con); | 38 | + return self::send_post_json($channel_url,$con); |
| 49 | } | 39 | } |
| 50 | - | ||
| 51 | - | ||
| 52 | static public function send_post_json($url, $jsonStr) | 40 | static public function send_post_json($url, $jsonStr) |
| 53 | { | 41 | { |
| 54 | $ch = curl_init(); | 42 | $ch = curl_init(); |
-
请 注册 或 登录 后发表评论