dms
This commit is contained in:
@@ -6,7 +6,7 @@ error_reporting(E_ERROR);
|
||||
|
||||
require_once(APPPATH . "controllers/dms/CurlAutoLogin.php");
|
||||
|
||||
class Test extends HD_Controller
|
||||
class Spider extends HD_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -15,7 +15,7 @@ class Test extends HD_Controller
|
||||
$this->log_dir = 'dms';
|
||||
}
|
||||
|
||||
public function index()
|
||||
public function get_clues()
|
||||
{
|
||||
//登录态缓存文件
|
||||
$loginResultFile = APPPATH . "cache/loginRes.txt";
|
||||
@@ -25,7 +25,6 @@ class Test extends HD_Controller
|
||||
if (!file_exists($loginResultFile)) {
|
||||
$resArr = $this->doLogin($autoLogin, $loginResultFile);
|
||||
} else {
|
||||
echo "有登录态,自动登录...\n";
|
||||
debug_log("有登录态,自动登录...\n", 'dms.txt', $this->log_dir);
|
||||
$resArr = json_decode(file_get_contents($loginResultFile), true);
|
||||
}
|
||||
@@ -71,9 +70,8 @@ CURL;
|
||||
if(!$resArr['data']['clueServerQueryFromDlr']['rows']){
|
||||
debug_log("无新增数据\n", 'dms.txt', $this->log_dir);
|
||||
exit;
|
||||
}
|
||||
else{
|
||||
debug_log("共 ".$resArr['data']['clueServerQueryFromDlr']['records']." 新增数据\n", 'dms.txt', $this->log_dir);
|
||||
}else{
|
||||
debug_log("共 ".$resArr['data']['clueServerQueryFromDlr']['records']." 条新增数据\n", 'dms.txt', $this->log_dir);
|
||||
}
|
||||
|
||||
foreach ($resArr['data']['clueServerQueryFromDlr']['rows'] as $k => $v) {
|
||||
@@ -91,7 +89,7 @@ CURL;
|
||||
}
|
||||
}
|
||||
|
||||
public function doLogin($autoLogin, $loginResultFile)
|
||||
private function doLogin($autoLogin, $loginResultFile)
|
||||
{
|
||||
echo "无登录态,模拟登录...\n";
|
||||
debug_log("无登录态,模拟登录...\n", 'dms.txt', $this->log_dir);
|
||||
@@ -116,61 +114,4 @@ CURL;
|
||||
|
||||
return $resArr;
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$url = 'http://dms.dna-nev.com.cn/mp/login/validlogin.do';
|
||||
$header = array (
|
||||
0 => 'Accept: application/json, text/plain, */*',
|
||||
1 => 'Accept-Language: zh-CN,zh;q=0.9',
|
||||
2 => 'Connection: keep-alive',
|
||||
3 => 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
|
||||
4 => 'Origin: http://dms.dna-nev.com.cn',
|
||||
5 => 'Referer: http://dms.dna-nev.com.cn/',
|
||||
6 => 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
|
||||
);
|
||||
$postData = 'reuestParas=vrdCxWqmC6nNDXrxEyNCX5sThLElae5I%2FznYqpsieYmu3oIOQecGrZpH%2Bhpntm%2Bnb10K23tP9k9i2sqCxHESj1Leu%2BkGr2FYklTI%2BwwdCn2KZNQ7zrgAZ%2FzR9jd5XQEQzwyUCcwxllqqZWKDNMoWSJCLAYbMf0p%2FuqiVE105v%2Fi7yStvG5q7pE6lk%2B9g7oDsAHBbSqn21c6TpJyXHprF766eukiB4b5urdLilNsNQikR6rU2pY5dfymx5S2ytZzlnIE4pE2GHVV9VW6jzLot1w%3D%3D';
|
||||
// $postData = array(
|
||||
// 'reuestParas' => 'vrdCxWqmC6nNDXrxEyNCX5sThLElae5I/znYqpsieYnyP9dYSVqrnNbryed0peXaee4199dAmuV61oHp3hUaIveISmjsLLKviH0eoWO1+5WKZNQ7zrgAZ/zR9jd5XQEQVyCBtq6canDPslkbJJaqBBqDnXrTNfDkp/nCJWdfJaoYGaQma/2+6KOacVm3jq6DAHBbSqn21c6TpJyXHprF766eukiB4b5urdLilNsNQimy2E6KL8vBaa+L4mnRHsEAU3RYz8uFJO2ZRHl9aPfJCA=='
|
||||
// );
|
||||
$cookie = 'Cookie: pwRKey=1'; //需要cookie的话去掉这行的注释
|
||||
$timeout = 10;
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //返回数据不直接输出
|
||||
curl_setopt($ch, CURLOPT_ENCODING, "gzip"); //指定gzip压缩
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //302/301
|
||||
//SSL
|
||||
if(substr($url, 0, 8) === 'https://') {
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
//error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)解决
|
||||
//值有0-6,请参考手册,值1不行试试其他值
|
||||
//curl_setopt($ch, CURLOPT_SSLVERSION, 1);
|
||||
}
|
||||
//post数据
|
||||
if(!empty($postData)) {
|
||||
curl_setopt($ch, CURLOPT_POST, 1); //发送POST类型数据
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); //POST数据,$post可以是数组(multipart/form-data),也可以是拼接参数串(application/x-www-form-urlencoded)
|
||||
}
|
||||
if(!empty($cookie)) {
|
||||
$header[] = $cookie;
|
||||
}
|
||||
if(!empty($header)) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //使用header头信息
|
||||
}
|
||||
//超时时间
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
|
||||
//执行
|
||||
$content = curl_exec($ch);
|
||||
if($error = curl_error($ch)) {
|
||||
//log error
|
||||
error_log($error);
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
print_r($content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class Plan extends CI_Controller
|
||||
|
||||
$plan[] = array('url' => base_url(array('plan', 'biz', 'settle')), 'interval' => 1);
|
||||
$plan[] = array('url' => base_url(array('plan', 'biz', 'merge')), 'interval' => 20); //合并结算
|
||||
$plan[] = array('url' => base_url(array('plan', 'order', 'up_old_status')), 'interval' => 30); //更新旧订单状态
|
||||
// $plan[] = array('url' => base_url(array('plan', 'order', 'up_old_status')), 'interval' => 30); //更新旧订单状态
|
||||
$plan[] = array('url' => base_url(array('plan', 'order', 'out_time')), 'interval' => 10); //未支付订单过期
|
||||
$plan[] = array('url' => base_url(array('plan', 'order', 'send_aggs_biz_ding_piao_rpt')), 'interval' => 1); //向飞书发送小狸播报
|
||||
$plan[] = array('url' => base_url(array('plan', 'order', 'cost')), 'interval' => 1); //添加成本表数据
|
||||
|
||||
Reference in New Issue
Block a user