撸键盘Debug
/*
*倒计时
*author: Motea
*mail: i@motea.org
*description:可修改倒计时时间,详情看下方注释。
*/
defined('IN_IA') or exit('Access Denied');
class djsModuleProcessor extends WeModuleProcessor {
public $name = 'djsModuleProcessor';
public function isNeedInitContext() {
return 0;
}
public function respond() {
global $_W;
$rid = $this->rule;
$sql = "SELECT * FROM ".tablename('djs')." WHERE `rid`=:rid and enabled=1 LIMIT 1";
$row = pdo_fetch($sql, array(':rid' => $rid));
$time = time();
$kaoyantime = '2014-01-04';//(设置倒计时日期,可再添加一行新命名一个函数加一个倒计时)
$kaoyantime = strtotime($kaoyantime);
$interval = $kaoyantime - $time;
$days = $interval/(24*60*60);//精确到天数
$days = intval($days);
$hours = $interval /(60*60) - $days*24;//精确到小时
$hours = intval($hours);
$minutes = $interval /60 - $days*24*60 - $hours*60;//精确到分钟
$minutes = intval($minutes);
$seconds = $interval - $days*24*60*60 - $hours*60*60 - $minutes*60;//精确到秒
$seconds = intval($seconds);
$response = array();
$response['FromUserName'] = $this->message['to'];
$response['ToUserName'] = $this->message['from'];
$response['MsgType'] = 'text';
$response['Content'] = "距考研还有:".$days."天".$hours."小时".$minutes."分!加油![每天早晨叫醒你的不应是闹钟,应是梦想!]";//此处可修改回复词
return $response;
}
public function isNeedSaveContext() {
return false;
}
}