Browse Source

增加定时任务

1.x
xiaoz 6 years ago
parent
commit
4cd016a041
  1. 9
      functions/class/class.user.php
  2. 35
      functions/unknown.php

9
functions/class/class.user.php

@ -173,6 +173,15 @@ @@ -173,6 +173,15 @@
curl_close($curl);
//var_dump($html);
}
//查询未识别图片
function unknown(){
$thedate = date('Y-m-d',time());
$sql = "SELECT * FROM `imginfo` WHERE (level IS NULL OR level = 0) AND date = '$thedate'";
$database = $this->database;
//$datas = $database->select("imginfo","*");
$datas = $database->query($sql)->fetchAll();
return $datas;
}
}
//自动初始化完成一些基础操作

35
functions/unknown.php

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
<?php
//此页面需要配置定时任务(crontab)完成
include_once("./class/class.user.php");
//获取密码
@$pass = $_GET['pass'];
if($pass != $config['password']){
echo '密码错误!';
exit;
}
$datas = $basis->unknown();
//遍历数据
foreach( $datas as $key => $value )
{
$url = $config['domain'].'dispose.php?id=' + $value['id'];
//请求鉴黄接口
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36");
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
#设置超时时间,最小为1s(可选)
curl_setopt($curl , CURLOPT_TIMEOUT, 3);
$html = curl_exec($curl);
curl_close($curl);
}
echo '处理完成!';
?>
Loading…
Cancel
Save