Commit 3a1520bf by 朱继来

Merge branch 'zjl_adjust_20181026'

parents be661ee6 5770e80b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
return [ return [
// 是否开启报错写入 // 是否开启报错写入
'enabled' => true, 'enabled' => env('DING_ALERT', false),
// curl证书验证, 线下环境不用开启 // curl证书验证, 线下环境不用开启
'curl_verify' => true, 'curl_verify' => true,
......
...@@ -92,24 +92,26 @@ class MonitorDingClient { ...@@ -92,24 +92,26 @@ class MonitorDingClient {
if (! config('monitorDing.enabled')) { if (! config('monitorDing.enabled')) {
\Log::info('~~ Monitor Ding ~~'); \Log::info('~~ Monitor Ding ~~');
\Log::info($params); \Log::info($params);
} } else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->webhook);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json;charset=utf-8'));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->curl_verify) {
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
$ch = curl_init(); if ($data['errcode']) {
curl_setopt($ch, CURLOPT_URL, $this->webhook); throw new SendErrorException($data['errmsg']);
curl_setopt($ch, CURLOPT_POST, 1); }
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json;charset=utf-8'));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->curl_verify) {
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
} }
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($data['errcode']) {
throw new SendErrorException($data['errmsg']);
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment