processor.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. $reply = table('custom_reply')->where(array('rid IN' => $this->rule))->orderby('RAND()')->get();
  13. $nhour = date('H', TIMESTAMP);
  14. $flag = 0;
  15. if($reply['start1'] == 0 && $reply['end'] == 24) {
  16. $flag = 1;
  17. } elseif($reply['start1'] != '-1' && ($nhour >= $reply['start1']) && ($nhour < $reply['end1'])) {
  18. $flag = 1;
  19. } elseif($reply['start2'] != '-1' && ($nhour >= $reply['start2']) && ($nhour < $reply['end2'])) {
  20. $flag = 1;
  21. }
  22. if($flag == 1) {
  23. return $this->respCustom();
  24. } else {
  25. $content = '多客服接入时间为:' . intval($reply['start1']) .'时~' . $reply['end1'] . '时';
  26. if($reply['start2'] != '-1') {
  27. $content .= ',' . $reply['start2'] . '时~' . $reply['end2'] . '时';
  28. }
  29. $reply['content'] = $content;
  30. return $this->respText($reply['content']);
  31. }
  32. }
  33. }