76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<?php
|
||
/**数据延迟入mysql
|
||
* Created by PhpStorm.
|
||
* User: ddcai
|
||
* Date: 2018/7/13
|
||
* Time: 14:53
|
||
*/
|
||
|
||
ini_set('max_execution_time','120');//超时时间设置为2分钟
|
||
include("../include/config.inc.php");
|
||
|
||
$ip = return_user_ip();
|
||
if(!in_array($ip,SYS_SERVER_IP)){
|
||
echo("非法IP,已经记录:".$ip);
|
||
exit;
|
||
}
|
||
|
||
|
||
//自动加载类
|
||
function __autoload($class){
|
||
//判断两个要执行的内容是否正常
|
||
if (!preg_match("/^[a-zA-Z0-9_]+$/", $class)) {
|
||
echo("要执行的方法里只能包含字母、数字、下画线\r\n");
|
||
exit;
|
||
}
|
||
if(file_exists(WEBPATH_DIR.'crontab'.DS.$class.'.class.php')){
|
||
require_once(WEBPATH_DIR.'crontab'.DS.$class.'.class.php');
|
||
if (!class_exists($class, false)) {
|
||
echo("找不到对应的类: $class ".__LINE__);
|
||
exit;
|
||
}
|
||
}else{
|
||
echo("找不到对应的文件: $class ".__LINE__);
|
||
exit;
|
||
}
|
||
}
|
||
|
||
$mydata= array(
|
||
'a'=>'save_user_lottery_task',
|
||
'm'=>'crontab_game_log',
|
||
'd'=>array(
|
||
'ip'=>return_user_ip()
|
||
)
|
||
);
|
||
|
||
if(!isset($mydata['a']) || !isset($mydata['m']) || !isset($mydata['d']) ){
|
||
sys_log_write_content( "格式不正确".json_encode($mydata),"error_log","crontab_sql_error");
|
||
exit;
|
||
}
|
||
$act_a = $mydata['a'];//要执行的动作
|
||
$act_m = $mydata['m'];//要执行的模块
|
||
//判断两个要执行的内容是否正常
|
||
if (!preg_match("/^[a-zA-Z0-9_]+$/", $act_a) || !preg_match("/^[a-zA-Z0-9_]+$/", $act_m)) {
|
||
sys_log_write_content( "要执行的方法里只能包含字母、数字、下画线".json_encode($mydata),"error_log","crontab_sql_error");
|
||
exit;
|
||
}
|
||
$act_tmp = $act_m;
|
||
$act = new $act_tmp();
|
||
//是否有这个方法在
|
||
if (!method_exists($act, $act_a)) {
|
||
sys_log_write_content( __FILE__ . "|" . $act_tmp . "找不到对应的方法: " . $act_a . ":" . __LINE__ ,"error_log","crontab_sql_error");
|
||
exit;
|
||
}else{
|
||
//设置值
|
||
$act->get_data($mydata['d'],$GLOBALS['conn'],$GLOBALS['myredis']);
|
||
//执行内容
|
||
$act->$act_a();
|
||
sys_log_write_content( "执行完成","error_log","crontab_sql_ok");
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|