成功最有效的方法就是向有经验的人学习!

OA利用API向助讯通发送消息

<?php 
/*if ( $USER_ID == "" || $PASSWORD == "" ) 
{ 
                echo _( "201#|#用户名或密码为空" ); 
                exit( ); 
} 
if ( $USER_ID != "OfficeTask" ) 
{ 
                echo _( "205#|#用户名错误" ); 
                exit( ); 
}*/
include_once( "../inc/conn.php" ); 
include_once( "../inc/utility.php" ); 
$query = "SELECT M1.MR_NAME AS MEETNAME,RIGHT(T.M_START,8) AS MEETIME,M.MR_NAME,U.USER_NAME, TIME_FORMAT(TIMEDIFF(T.M_END,NOW()),'%H%i') AS DIFF,T.* FROM meeting T,USER U,MEETING_ROOM M,MEETING_ROOM M1 WHERE T.M_DESC=M1.MR_ID AND M.MR_ID=T.M_ROOM AND T.M_ROOM=8 AND T.M_PROPOSER=U.USER_ID AND T.M_STATUS='1' AND T.M_NOTE IS NULL AND UNIX_TIMESTAMP(T.M_END) >= UNIX_TIMESTAMP(NOW()) ORDER BY DIFF DESC"; 
$cursor = exequery( $connection, $query ); 
if ( $ROW = mysql_fetch_array( $cursor ) ) 
{ 
    do
    { 
        $GL_DIFF=$ROW['DIFF']; 
        $GL_ID=$ROW['M_ID']; 
        //echo $GL_DIFF."<br />"; 
        $GL_TIME=substr($GL_DIFF,0,strlen($GL_DIFF)-2); 
        $GL_TIME = intval($GL_TIME); 
        //echo $GL_TIME."<br />"; 
        if ($GL_TIME == 1) 
        { 
            //通知发出并标记 
            //$file_contents =  
            //$file_get_content("http://plugin.XXXX.com/IMAPI.PHP?SEND=陈桂林&RECEIVE=胡欣&MSG=SDFSDFSDFSD","r"); 
            //$content= file_get_content("http://plugin.XXXX.com/IMAPI.PHP?SEND=陈桂林&RECEIVE=胡欣&MSG=SDFSDFSDFSD","r"); 
            $MSGSTR="您好!".$ROW['USER_NAME']."【".$ROW['MEETIME']."】申请使用投影仪,请安排安装在:".$ROW['MEETNAME']."!"; 
            //echo $MSGSTR; 
            vita_get_url_content("http://plugin.XXXX.com/IMAPI.PHP?SEND=陈桂林&RECEIVE=胡欣&MSG=胡欣,".$MSGSTR); 
            vita_get_url_content("http://plugin.XXXX.com/IMAPI.PHP?SEND=陈桂林&RECEIVE=林启明&MSG=林启明,".$MSGSTR); 
            vita_get_url_content("http://plugin.XXXX.com/IMAPI.PHP?SEND=陈桂林&RECEIVE=陈桂林&MSG=陈桂林,".$MSGSTR); 
            //echo $file_contents."-----"; 
            exequery($connection, "UPDATE MEETING T SET T.M_NOTE=1 WHERE T.M_ID=".$GL_ID); 
            //echo "UPDATE MEETING T SET T.NOTE=1 WHERE T.M_ID=".$GL_ID."<br />"; 
        } 
    } 
    while($ROW = mysql_fetch_array( $cursor )); 
       
       
} 
else
{ 
                echo "202#|#".$USER_ID; 
                exit( ); 
} 
//echo intval('000'); 
   
echo "+OK"; 
   
   
function vita_get_url_content($url) { 
if(function_exists('file_get_contents')) { 
$file_contents = file_get_contents($url); 
} else { 
$ch = curl_init(); 
$timeout = 5;  
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
$file_contents = curl_exec($ch); 
curl_close($ch); 
} 
return $file_contents; 
} 
   
?>

 

赞(0) 打赏
未经允许不得转载:陈桂林博客 » OA利用API向助讯通发送消息
分享到

大佬们的评论 抢沙发

全新“一站式”建站,高质量、高售后的一条龙服务

微信 抖音 支付宝 百度 头条 快手全平台打通信息流

橙子建站.极速智能建站8折购买虚拟主机

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册