processor.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class CustomModuleProcessor extends WeModuleProcessor {
  8. public function respond() {
  9. if($this->rule == -1) {
  10. return $this->respCustom();
  11. }
  12. $sql = "SELECT * FROM " . tablename('custom_reply') . " WHERE `rid` IN ({$this->rule}) ORDER BY RAND() LIMIT 1";
  13. $reply = pdo_fetch($sql);
  14. $nhour = date('H', TIMESTAMP);
  15. $flag = 0;
  16. if($reply['start1'] == 0 && $reply['end'] == 24) {
  17. $flag = 1;
  18. } elseif($reply['start1'] != '-1' && ($nhour >= $reply['start1']) && ($nhour < $reply['end1'])) {
  19. $flag = 1;
  20. } elseif($reply['start2'] != '-1' && ($nhour >= $reply['start2']) && ($nhour < $reply['end2'])) {
  21. $flag = 1;
  22. }
  23. if($flag == 1) {
  24. return $this->respCustom();
  25. } else {
  26. $content = '多客服接入时间为:' . intval($reply['start1']) .'时~' . $reply['end1'] . '时';
  27. if($reply['start2'] != '-1') {
  28. $content .= ',' . $reply['start2'] . '时~' . $reply['end2'] . '时';
  29. }
  30. $reply['content'] = $content;
  31. return $this->respText($reply['content']);
  32. }
  33. }
  34. }