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