diff --git a/pmcalendar.php b/pmcalendar.php index 628df70..4ab5022 100644 --- a/pmcalendar.php +++ b/pmcalendar.php @@ -16,6 +16,41 @@ function request_by_curl($remote_server, $post_string) { return $data; } +function dopost($remote_server, $post_string) { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $remote_server); + 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, $post_string); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + // 线下环境不用开启curl证书验证, 未调通情况可尝试添加该代码 + curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); + $data = curl_exec($ch); + curl_close($ch); + return $data; +} + +function push($title,$text,$to){ + //今天设置过菜单 + $webhook = "http://v3.legu.cc/senddmsg/push.php?act=push"; + $contArr = array( + 'msgtype'=>'action_card', + 'action_card'=>array( + 'title'=>$title, + "markdown"=> $text, + 'single_title'=>'查看详情', + 'single_url'=>'http://10.0.0.5/leguevent/', + ), + ); + $data_string = array( + 'name'=>$to, + 'cont'=>json_encode($contArr) + ); + $result = dopost($webhook, $data_string); +} + function sendNotice($title,$text,$token){ //今天设置过菜单 @@ -97,6 +132,8 @@ if ($act == 'newevent') { sendNotice('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'0be37dacbaa5c76893fb85d4dab5bc23e6b981b5fa3c33908132af8e29eacf8c'); sendNotice('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'66766a72c2e5e6950ffbdc26cf8fa3fb5503d25162d80f6dd441057849ef0d4d'); + + push('Event新增了上线节点',"**Event新增了上线节点**\n\n【{$dict['game']}】{$dict['title']}\n\n时间:{$dict['start']}",'邓定坤,邓定斌'); } we('1'); @@ -119,6 +156,8 @@ if ($act == 'newevent') { sendNotice('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'0be37dacbaa5c76893fb85d4dab5bc23e6b981b5fa3c33908132af8e29eacf8c'); sendNotice('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'66766a72c2e5e6950ffbdc26cf8fa3fb5503d25162d80f6dd441057849ef0d4d'); + + push('Event上线节点',"**Event上线节点信息补充**\n\n【{$info['game']}】{$info['title']}\n\n时间:{$info['start']}\n\n{$data_array['msg']}",'邓定坤,邓定斌'); } we('1'); @@ -737,6 +776,13 @@ if ($act == 'newevent') { +
+ + +