Compare commits
10 Commits
b494903dfd
...
d588a7d108
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d588a7d108 | ||
![]() |
c02656e435 | ||
![]() |
4133ce2995 | ||
![]() |
eb92fe8e8b | ||
![]() |
3d7d02f353 | ||
![]() |
f6ed2277fa | ||
![]() |
1534831332 | ||
![]() |
029c02969b | ||
![]() |
74f2959272 | ||
![]() |
80655ac74d |
|
@ -32,7 +32,6 @@ function chat_text_alert ($chat, $text)
|
|||
$text,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
app("log")->error("chat_notify_error", ['message' => $ex->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -61,7 +60,6 @@ function user_text_alert ($username, $text)
|
|||
$text,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
app("log")->error("chat_notify_error", ['message' => $ex->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -97,7 +95,6 @@ function chat_card_alert ($chat, $title, $desc, $button, $url)
|
|||
$url,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
app("log")->error("chat_notify_error", ['message' => $ex->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -134,7 +131,6 @@ function user_card_alert ($username, $title, $desc, $button, $url)
|
|||
$url,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
app("log")->error("chat_notify_error", ['message' => $ex->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -175,7 +171,6 @@ function user_mp_alert ($username, $appid, $title, $page = null, $desc = null, $
|
|||
$emphasisFirstItem
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
app("log")->error("chat_notify_error", ['message' => $ex->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -215,7 +210,6 @@ function tag_mp_alert ($tag, $appid, $title, $page = null, $desc = null, $items
|
|||
$emphasisFirstItem
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
app("log")->error("chat_notify_error", ['message' => $ex->getMessage()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -258,4 +252,90 @@ function bot_notify($name, $content)
|
|||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对单个或多个用户发送报警或通知图片,多个用户id使用 | 隔开
|
||||
*
|
||||
* @param $media_id
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
function user_image_alert ($username, $media_id)
|
||||
{
|
||||
if (env('APP_ENV') == 'local') {
|
||||
return true;
|
||||
}
|
||||
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||
$client = $base_client->endpoint('auth');
|
||||
|
||||
$username = explode('|', $username);
|
||||
try {
|
||||
$res = $client->call('notify.image', [
|
||||
['user' => $username],
|
||||
$media_id,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对企业微信群发送报警图片(需先创建
|
||||
*
|
||||
* @param $chat
|
||||
* @param $media_id
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
|
||||
function chat_image_alert ($chat, $media_id)
|
||||
{
|
||||
if (env('APP_ENV') == 'local') {
|
||||
return true;
|
||||
}
|
||||
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||
$client = $base_client->endpoint('auth');
|
||||
|
||||
try {
|
||||
$resp = $client->call('notify.image', [
|
||||
['chat' => $chat],
|
||||
$media_id,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对企业微信群发送报警文件(需先创建
|
||||
*
|
||||
* @param $chat
|
||||
* @param $media_id
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
|
||||
function chat_file_alert ($chat, $media_id)
|
||||
{
|
||||
if (env('APP_ENV') == 'local') {
|
||||
return true;
|
||||
}
|
||||
$base_client = new \JsonRpc\Client(RPC_CONFIG);
|
||||
$client = $base_client->endpoint('auth');
|
||||
|
||||
try {
|
||||
$resp = $client->call('notify.file', [
|
||||
['chat' => $chat],
|
||||
$media_id,
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $resp;
|
||||
}
|
Loading…
Reference in New Issue
Block a user