您好,登录后才能下订单哦!
// exec('mongoexport -h 192.168.6.97 --port 40000 -d fenjianlidb -c fenjianli -f "meta_info.file_path" -q "{\'create_time\':{\'$gte\': \'1487088000\',\'$lte\': \'1487644200\'}}" -o ' . $save_path .'middle.txt', $ret); //window平台
//php 执行
exec('mongoexport -h 192.168.6.97 --port 40000 -d zhengliangdb -c newzengliang -f "meta_info.file_path" -q \'{create_time:{$gte: 1487645408,$lte: 1487646251}}\' -o /data/work_time/work0221/testMid/middle.txt', $ret); //Linux 成功 (切记转移) mongoexport --help 查看
--------------------------------------测试代码-----------------------------------------
<?php
/**
* @Author: lixiaozhu
* @Date: 2016-09-21 12:51:55
* @Last Modified by: lixiaozhu
* @Last Modified time: 2017-01-20 18:50:24
*/
set_time_limit(0);
// $save_path = 'D:/phpStudy/WWW/test01/mongo/test0221/';
$save_path = '/data/work_time/work0221/testMid/';
//中间件
// exec('mongoexport -h 192.168.6.97 --port 40000 -d fenjianlidb -c fenjianli -f "meta_info.file_path" -q "{\'create_time\':{\'$gte\': \'1487088000\',\'$lte\': \'1487644200\'}}" -o ' . $save_path .'middle.txt', $ret); //window平台
//php 执行
exec('mongoexport -h 192.168.6.97 --port 40000 -d zhengliangdb -c newzengliang -f "meta_info.file_path" -q \'{create_time:{$gte: 1487645408,$lte: 1487646251}}\' -o /data/work_time/work0221/testMid/middle.txt', $ret); //Linux 成功
$groups = array(
'group1' => 'http://192.168.6.49/',
'group2' => 'http://192.168.6.50/',
);
$content = file_get_contents($save_path . 'middle.txt');
$list = preg_split('/\s+/', $content);
$prefix = date('YmdH');
foreach ($list as $key => $item) {
echo $key++, PHP_EOL;
$item = json_decode($item, true);
$file_path = trim($item['meta_info']['file_path']);
$group = substr($file_path, 0, 6);
if (isset($groups[$group])) {
$url = $groups[$group] . $file_path;
$content = file_get_contents($url);
if(false !== strpos($content,'zhaopin.com')){ //可能会有 zhaopin.cn localhost/qiaoda/zhilian/z1.html
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_zhilian.txt');
} elseif (false !== strpos($content,'51job.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_51job.txt');
} elseif (false !== strpos($content,'liepin.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_liepin.txt');
} elseif (false !== strpos($content,'ganji.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_ganji.txt');
} elseif (false !== strpos($content, '58.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_58tongchen.txt');
} elseif (false !== strpos($content, 'chinahr.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_YCjianli.txt');
} else {
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_other.txt');
}
} else {
echo 'mubanFileError';
error_log($file_path . PHP_EOL, 3, $save_path . $prefix . '_mubanFileError.txt');
}
unset($content);
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。