|
@@ -26,6 +26,8 @@ class DingTalk
|
|
|
|
|
|
|
|
public static function sendNotice($message)
|
|
public static function sendNotice($message)
|
|
|
{
|
|
{
|
|
|
|
|
+ $message['serverAddr'] = $_SERVER['SERVER_ADDR'];
|
|
|
|
|
+ $message['serverName'] = $_SERVER['SERVER_NAME'];
|
|
|
$data = [
|
|
$data = [
|
|
|
'msgtype' => 'text',
|
|
'msgtype' => 'text',
|
|
|
'text' => ['content' => $message],
|
|
'text' => ['content' => $message],
|
|
@@ -38,8 +40,6 @@ class DingTalk
|
|
|
|
|
|
|
|
// 正式环境才发送
|
|
// 正式环境才发送
|
|
|
if (YII_ENV == YII_ENV_PROD) {
|
|
if (YII_ENV == YII_ENV_PROD) {
|
|
|
- $data['serverAddr'] = $_SERVER['SERVER_ADDR'];
|
|
|
|
|
- $data['serverName'] = $_SERVER['SERVER_NAME'];
|
|
|
|
|
$result = self::request_by_curl(json_encode($data));
|
|
$result = self::request_by_curl(json_encode($data));
|
|
|
if ($result['errcode'] > 0) {
|
|
if ($result['errcode'] > 0) {
|
|
|
// 重新推送一次,如果失败,写错误日志
|
|
// 重新推送一次,如果失败,写错误日志
|