优惠券订单及其他脚本

monitor_order.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. require_once 'DB_PDO.class.php';
  3. require_once 'conf.class.php';
  4. require_once 'SendMsg.class.php';
  5. /**
  6. * 监控订单同步
  7. */
  8. #设置时区
  9. date_default_timezone_set('PRC');
  10. $_PDO=DB_PDO::getInstance( conf::$DB_CONF );
  11. $nowtime = time();
  12. $sql = " select update_time from ftxia_taoke_detail2 order by id desc limit 1";
  13. $stmt = $_PDO->prepare($sql);
  14. $stmt->execute();
  15. $result = $stmt->fetch(PDO::FETCH_ASSOC);
  16. $stime = $result['update_time'];
  17. $stime = strtotime($stime);
  18. if($stime+1200 < $nowtime){
  19. $n = ($nowtime - $stime)/60;
  20. $n = intval($n);
  21. //发报警短信
  22. $res = sendMsg('18501257479');
  23. $res = sendMsg('15120071946');
  24. $res = sendMsg('18346660331');
  25. $res = sendMsg('15921609780');
  26. exit('订单同步异常,超过'.$n.'分钟未同步');
  27. }
  28. echo '未发现异常';
  29. exit;
  30. function sendMsg ($mobile){
  31. $params = array();
  32. $params['mobile'] = $mobile;
  33. $n = mt_rand(0,1);
  34. echo '<pre>';
  35. if($n == 1){
  36. //阿里测试
  37. $params['SignName'] = '猎豆优选';
  38. $params['tpl_id'] = 'SMS_151997083';
  39. //$params['extra']['code'] = '1112';
  40. //$params['extra']['product'] = '猎豆';
  41. $result = SendMsg::AliSendMsg($params);
  42. print_r($result);
  43. return $result;
  44. }
  45. //天瑞测试
  46. /*
  47. $params['SignName'] = '猎豆优选';
  48. $params['tpl_id'] = '30290';
  49. //$params['extra']['code'] = '111256';
  50. //$params['extra']['minutes'] = 2;
  51. $result = SendMsg::TruiSendMsg($params);
  52. var_dump($result);exit;
  53. */
  54. //云片测试
  55. $params['tpl_id'] = '2619986';
  56. //$params['extra']['code'] = '9000';
  57. //$params['extra']['minutes'] = 2;
  58. $params['extra'] = array();
  59. $result = SendMsg::YpianSendMsg($params);
  60. print_r($result);
  61. return $result;
  62. }