prepare($sql); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); $stime = $result['update_time']; $stime = strtotime($stime); if($stime+1200 < $nowtime){ $n = ($nowtime - $stime)/60; $n = intval($n); //发报警短信 $res = sendMsg('18501257479'); $res = sendMsg('15120071946'); $res = sendMsg('18346660331'); $res = sendMsg('15921609780'); exit('订单同步异常,超过'.$n.'分钟未同步'); } echo '未发现异常'; exit; function sendMsg ($mobile){ $params = array(); $params['mobile'] = $mobile; $n = mt_rand(0,1); echo '
'; if($n == 1){ //阿里测试 $params['SignName'] = '猎豆优选'; $params['tpl_id'] = 'SMS_151997083'; //$params['extra']['code'] = '1112'; //$params['extra']['product'] = '猎豆'; $result = SendMsg::AliSendMsg($params); print_r($result); return $result; } //天瑞测试 /* $params['SignName'] = '猎豆优选'; $params['tpl_id'] = '30290'; //$params['extra']['code'] = '111256'; //$params['extra']['minutes'] = 2; $result = SendMsg::TruiSendMsg($params); var_dump($result);exit; */ //云片测试 $params['tpl_id'] = '2619986'; //$params['extra']['code'] = '9000'; //$params['extra']['minutes'] = 2; $params['extra'] = array(); $result = SendMsg::YpianSendMsg($params); print_r($result); return $result; }