|
@@ -2,45 +2,46 @@ |
|
@@ -2,45 +2,46 @@ |
|
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
|
+ ];
|
|
5
|
//发送预警通知
|
13
|
//发送预警通知
|
|
6
|
- static public function send($content)
|
14
|
+ static public function send($content,$users=[])
|
|
7
|
{
|
15
|
{
|
|
8
|
- $url = 'https://open.feishu.cn/open-apis/bot/v2/hook/f30bbb72-091c-499d-a577-43c45dceb158';
|
|
|
|
9
|
- $content = [
|
|
|
|
10
|
- 'msg_type'=>"text",
|
|
|
|
11
|
- 'content'=>[
|
|
|
|
12
|
- 'text'=>$content
|
|
|
|
13
|
- ]
|
|
|
|
14
|
- ];
|
|
|
|
15
|
- $con = json_encode($content);
|
|
|
|
16
|
- return self::send_post_json($url,$con);
|
|
|
|
17
|
- }
|
16
|
+ return self::notice($content,'follow',$users);
|
|
18
|
|
17
|
|
|
19
|
- static public function sendNoError($content)
|
18
|
+ }
|
|
|
|
19
|
+ static public function sendNoError($content,$users=[])
|
|
20
|
{
|
20
|
{
|
|
21
|
- $url = 'https://open.feishu.cn/open-apis/bot/v2/hook/a344e313-4d5d-4aa4-912b-dda37b2e3ee8';
|
|
|
|
22
|
- $content = [
|
|
|
|
23
|
- 'msg_type'=>"text",
|
|
|
|
24
|
- 'content'=>[
|
|
|
|
25
|
- 'text'=>$content
|
|
|
|
26
|
- ]
|
|
|
|
27
|
- ];
|
|
|
|
28
|
- $con = json_encode($content);
|
|
|
|
29
|
- return self::send_post_json($url,$con);
|
21
|
+ return self::notice($content,'error',$users);
|
|
30
|
}
|
22
|
}
|
|
31
|
|
23
|
|
|
32
|
- static public function notice($content,$channel="warning")
|
24
|
+ static public function notice($content,$channel="warning",$users=[])
|
|
33
|
{
|
25
|
{
|
|
34
|
$urls = [
|
26
|
$urls = [
|
|
35
|
- 'follow' => 'https://open.feishu.cn/open-apis/bot/v2/hook/f30bbb72-091c-499d-a577-43c45dceb158',
|
|
|
|
36
|
- 'warning' => 'https://open.feishu.cn/open-apis/bot/v2/hook/d48c2e4a-0ef9-4684-88d4-e62d878fdaca',
|
|
|
|
37
|
- 'error' => 'https://open.feishu.cn/open-apis/bot/v2/hook/a344e313-4d5d-4aa4-912b-dda37b2e3ee8',
|
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-交易策略研发沟通
|
|
38
|
];
|
31
|
];
|
|
39
|
$url = $urls[$channel] ?? $urls['warning'];
|
32
|
$url = $urls[$channel] ?? $urls['warning'];
|
|
|
|
33
|
+ $userXml = '';
|
|
|
|
34
|
+ 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
|
+ }
|
|
|
|
40
|
+ }
|
|
40
|
$content = [
|
41
|
$content = [
|
|
41
|
'msg_type'=>"text",
|
42
|
'msg_type'=>"text",
|
|
42
|
'content'=>[
|
43
|
'content'=>[
|
|
43
|
- 'text'=>$content
|
44
|
+ 'text'=>$content.$userXml
|
|
44
|
]
|
45
|
]
|
|
45
|
];
|
46
|
];
|
|
46
|
$con = json_encode($content);
|
47
|
$con = json_encode($content);
|
|
@@ -67,4 +68,4 @@ class Feishu{ |
|
@@ -67,4 +68,4 @@ class Feishu{ |
|
67
|
curl_close($ch);
|
68
|
curl_close($ch);
|
|
68
|
return array($httpCode, $response);
|
69
|
return array($httpCode, $response);
|
|
69
|
}
|
70
|
}
|
|
70
|
-} |
71
|
+} |