文章搬运工具,最近很多站长或者做自媒体的朋友问我没有办法可以批量自动关键词全网文章搬运到自己的网站或者自媒体上,不要问有没有,问就是有。但是我们如何利用好文章搬运工具做文章采集,今天说说文章搬运方法(全网关键词泛采集搬运、伪原创、发布、一键批量推送)。
文章搬运工具不会一味的为了创造内容而创造内容。但又有多少人想过你所创造的内容是真的有人在搜索引擎上搜索呢?若没有搜索即使你获得了很好的排名,那么能带来流量吗?所以产出有效内容变的非常重要。衡量有效与否的标准我们可以借助挖词工具、数据分析工具、站内搜索等这些可以明确捕获用户需求的关键词,以此为依据的创造内容。
文章搬运工具实现自动采集伪原创发布以及主动推送给搜索引擎,操作简单不需要写采集规则,只需简单几步就可以轻松采集内容数据,用户只需简单的设置,文章搬运工具根据用户设置的关键词精准的采集文章,这样就能确保跟行业文章一致。采集来的文章可选择本地化保存,亦可选择自动伪原创后发布,提供了方便快捷内容收集以及快速打造内容伪原创。
然后文章搬运的文章题文相符,你标题的主旨和你内容的所述如果不一致,那么即使在短时间内获得一定的搜索来源流量,那也无法长久。标题说的是什么,内容就应该写什么。并尽最大程度的满足用户的需求。
<?php
/**
* 147采集
* ============================================================================
* http://www.www.147seo.com
* ----------------------------------------------------------------------------
*/
// 关闭所有PHP错误报告
use think\Db;
error_reporting(0);
include_once EXTEND_PATH."function.php";
// 应用公共文件
if (!function_exists('switch_exception'))
{
// 模板错误提示
function switch_exception() {
$web_exception = tpCache('web.web_exception');
if (!empty($web_exception)) {
config('ey_config.web_exception', $web_exception);
error_reporting(-1);
}
}
}
if (!function_exists('adminLog'))
{
/**
* 管理员操作记录
* @param $log_url 操作URL
* @param $log_info 记录信息
*/
function adminLog($log_info = ''){
// 只保留最近一个月的操作日志
try {
$ajaxLogic = new \app\admin\logic\AjaxLogic;
$ajaxLogic->del_adminlog();
$admin_id = session('admin_id');
$admin_id = !empty($admin_id) ? $admin_id : -1;
$add['log_time'] = getTime();
$add['admin_id'] = $admin_id;
$add['log_info'] = htmlspecialchars($log_info);
$add['log_ip'] = clientIP();
$add['log_url'] = request()->baseUrl() ;
M('admin_log')->add($add);
} catch (\Exception $e) {
}
}
}
if (!function_exists('tpCache'))
{
/**
* 获取缓存或者更新缓存,只适用于config表
* @param string $config_key 缓存文件名称
* @param array $data 缓存数据 array('k1'=>'v1','k2'=>'v3')
* @param array $options 缓存配置
* @param string $lang 语言标识
* @return array or string or bool
*/
function tpCache($config_key,$data = array(), $lang = '', $options = null){
$tableName = 'config';
$table_db = \think\Db::name($tableName);
$param = explode('.', $config_key);
$cache_inc_type = $tableName.$param[0];
// $cache_inc_type = $param[0];
$lang = !empty($lang) ? $lang : get_current_lang();
if (empty($options)) {
$options['path'] = CACHE_PATH.$lang.DS;
}
if(empty($data)){
//如$config_key=shop_info则获取网站信息数组
//如$config_key=shop_info.logo则获取网站logo字符串
$config = cache($cache_inc_type,'',$options);//直接获取缓存文件
if(empty($config)){
//缓存文件不存在就读取数据库
if ($param[0] == 'global') {
$param[0] = 'global';
$res = $table_db->where([
'lang' => $lang,
'is_del' => 0,
])->select();
} else {
$res = $table_db->where([
'inc_type' => $param[0],
'lang' => $lang,
'is_del' => 0,
])->select();
}
if($res){
foreach($res as $k=>$val){
$config[$val['name']] = $val['value'];
}
cache($cache_inc_type,$config,$options);
}
// write_global_params($lang, $options);
}
if(!empty($param) && count($param)>1){
$newKey = strtolower($param[1]);
return isset($config[$newKey]) ? $config[$newKey] : '';
}else{
return $config;
}
}else{
//更新缓存
$result = $table_db->where([
'inc_type' => $param[0],
'lang' => $lang,
'is_del' => 0,
])->select();
if($result){
foreach($result as $val){
$temp[$val['name']] = $val['value'];
}
$add_data = array();
foreach ($data as $k=>$v){
$newK = strtolower($k);
$newArr = array(
'name'=>$newK,
'value'=>trim($v),
'inc_type'=>$param[0],
'lang' => $lang,
'update_time' => getTime(),
);
if(!isset($temp[$newK])){
array_push($add_data, $newArr); //新key数据插入数据库
}else{
if ($v != $temp[$newK]) {
$table_db->where([
'name' => $newK,
'lang' => $lang,
])->save($newArr);//缓存key存在且值有变更新此项
}
}
}
if (!empty($add_data)) {
$table_db->insertAll($add_data);
}
//更新后的数据库记录
$newRes = $table_db->where([
'inc_type' => $param[0],
'lang' => $lang,
'is_del' => 0,
])->select();
foreach ($newRes as $rs){
$newData[$rs['name']] = $rs['value'];
}
}else{
if ($param[0] != 'global') {
foreach($data as $k=>$v){
$newK = strtolower($k);
$newArr[] = array(
'name'=>$newK,
'value'=>trim($v),
'inc_type'=>$param[0],
'lang' => $lang,
'update_time' => getTime(),
);
}
!empty($newArr) && $table_db->insertAll($newArr);
}
$newData = $data;
}
$result = false;
$res = $table_db->where([
'lang' => $lang,
'is_del' => 0,
])->select();
if($res){
$global = array();
foreach($res as $k=>$val){
$global[$val['name']] = $val['value'];
}
$result = cache($tableName.'global',$global,$options);
}
if ($param[0] != 'global') {
$result = cache($cache_inc_type,$newData,$options);
}
return $result;
}
}
}
if (!function_exists('tpSetting'))
{
/**
* 获取缓存或者更新缓存,只适用于setting表
* @param string $config_key 缓存文件名称
* @param array $data 缓存数据 array('k1'=>'v1','k2'=>'v3')
* @param array $options 缓存配置
* @param string $lang 语言标识
* @return array or string or bool
*/
function tpSetting($config_key,$data = array(), $lang = '', $options = null){
$tableName = 'setting';
$table_db = \think\Db::name($tableName);
$param = explode('.', $config_key);
$cache_inc_type = $tableName.$param[0];
// $cache_inc_type = $param[0];
$lang = !empty($lang) ? $lang : get_current_lang();
if (empty($options)) {
$options['path'] = CACHE_PATH.$lang.DS;
}
if(empty($data)){
//如$config_key=shop_info则获取网站信息数组
//如$config_key=shop_info.logo则获取网站logo字符串
$config = cache($cache_inc_type,'',$options);//直接获取缓存文件
if(empty($config)){
//缓存文件不存在就读取数据库
if ($param[0] == 'global') {
$param[0] = 'global';
$res = $table_db->where([
'lang' => $lang,
])->select();
} else {
$res = $table_db->where([
'inc_type' => $param[0],
'lang' => $lang,
])->select();
}
if($res){
foreach($res as $k=>$val){
$config[$val['name']] = $val['value'];
}
cache($cache_inc_type,$config,$options);
}
// write_global_params($lang, $options);
}
if(!empty($param) && count($param)>1){
$newKey = strtolower($param[1]);
return isset($config[$newKey]) ? $config[$newKey] : '';
}else{
return $config;
}
}else{
//更新缓存
$result = $table_db->where([
'inc_type' => $param[0],
'lang' => $lang,
])->select();
if($result){
foreach($result as $val){
$temp[$val['name']] = $val['value'];
}
$add_data = array();
foreach ($data as $k=>$v){
$newK = strtolower($k);
$newArr = array(
'name'=>$newK,
'value'=>trim($v),
'inc_type'=>$param[0],
'lang' => $lang,
'update_time' => getTime(),
);
if(!isset($temp[$newK])){
array_push($add_data, $newArr); //新key数据插入数据库
}else{
if ($v != $temp[$newK]) {
$table_db->where([
'name' => $newK,
'lang' => $lang,
])->save($newArr);//缓存key存在且值有变更新此项
}
}
}
if (!empty($add_data)) {
$table_db->insertAll($add_data);
}
//更新后的数据库记录
$newRes = $table_db->where([
'inc_type' => $param[0],
'lang' => $lang,
])->select();
foreach ($newRes as $rs){
$newData[$rs['name']] = $rs['value'];
}
}else{
if ($param[0] != 'global') {
foreach($data as $k=>$v){
$newK = strtolower($k);
$newArr[] = array(
'name'=>$newK,
'value'=>trim($v),
'inc_type'=>$param[0],
'lang' => $lang,
'update_time' => time(),
);
}
$table_db->insertAll($newArr);
}
$newData = $data;
}
$result = false;
$res = $table_db->where([
'lang' => $lang,
])->select();
if($res){
$global = array();
foreach($res as $k=>$val){
$global[$val['name']] = $val['value'];
}
$result = cache($tableName.'global',$global,$options);
}
if ($param[0] != 'global') {
$result = cache($cache_inc_type,$newData,$options);
}
return $result;
}
}
}
if (!function_exists('write_global_params'))
{
/**
* 写入全局内置参数
* @return array
*/
function write_global_params($lang = '', $options = null)
{
empty($lang) && $lang = get_admin_lang();
$webConfigParams = \think\Db::name('config')->where([
'inc_type' => 'web',
'lang' => $lang,
'is_del' => 0,
])->getAllWithIndex('name');
$web_basehost = !empty($webConfigParams['web_basehost']) ? $webConfigParams['web_basehost']['value'] : ''; // 网站根网址
$web_cmspath = !empty($webConfigParams['web_cmspath']) ? $webConfigParams['web_cmspath']['value'] : ''; // EyouCMS安装目录
/*启用绝对网址,开启此项后附件、栏目连接、arclist内容等都使用http路径*/
$web_multi_site = !empty($webConfigParams['web_multi_site']) ? $webConfigParams['web_multi_site']['value'] : '';
if($web_multi_site == 1)
{
$web_mainsite = $web_basehost.$web_cmspath;
}
else
{
$web_mainsite = '';
}
/*--end*/
/*CMS安装目录的网址*/
$param['web_cmsurl'] = $web_mainsite;
/*--end*/
$web_tpl_theme = !empty($webConfigParams['web_tpl_theme']) ? $webConfigParams['web_tpl_theme']['value'] : ''; // 网站根网址
!empty($web_tpl_theme) && $web_tpl_theme = '/'.trim($web_tpl_theme, '/');
$param['web_templets_dir'] = '/template'.$web_tpl_theme; // 前台模板根目录
$param['web_templeturl'] = $web_mainsite.$param['web_templets_dir']; // 前台模板根目录的网址
$param['web_templets_pc'] = $web_mainsite.$param['web_templets_dir'].'/pc'; // 前台PC模板主题
$param['web_templets_m'] = $web_mainsite.$param['web_templets_dir'].'/mobile'; // 前台手机模板主题
$param['web_eyoucms'] = str_replace('#', '', '#h#t#t#p#:#/#/#w#w#w#.#e#y#o#u#c#m#s#.#c#o#m#'); // eyou网址
/*将内置的全局变量(页面上没有入口更改的全局变量)存储到web版块里*/
$inc_type = 'web';
foreach ($param as $key => $val) {
if (preg_match("/^".$inc_type."_(.)+/i", $key) !== 1) {
$nowKey = strtolower($inc_type.'_'.$key);
$param[$nowKey] = $val;
}
}
tpCache($inc_type, $param, $lang, $options);
/*--end*/
}
}
if (!function_exists('write_html_cache'))
{
/**
* 写入静态页面缓存
*/
function write_html_cache($html = '', $result = []){
$html_cache_status = config('HTML_CACHE_STATUS');
$html_cache_arr = config('HTML_CACHE_ARR');
if ($html_cache_status && !empty($html_cache_arr) && !empty($html)) {
// 多站点/多语言
$home_lang = 'cn';
$home_site = '';
$city_switch_on = config('city_switch_on');
if (!empty($city_switch_on)) {
$home_site = get_home_site();
} else {
$home_lang = get_home_lang();
}
$request = \think\Request::instance();
$param = input('param.');
/*URL模式是否启动页面缓存(排除admin后台、前台可视化装修、前台筛选)*/
$uiset = input('param.uiset/s', 'off');
$uiset = trim($uiset, '/');
$url_screen_var = config('global.url_screen_var');
$arcrank = !empty($result['arcrank']) ? intval($result['arcrank']) : 0;
$admin_id = input('param.admin_id/d');
if (isset($param[$url_screen_var]) || 'on' == $uiset || 'admin' == $request->module() || -1 == $arcrank || !empty($admin_id)) {
return false;
}
$seo_pseudo = config('ey_config.seo_pseudo');
if (!in_array($seo_pseudo, array(1,3)) && (2 == $seo_pseudo && !isMobile())) { // 排除普通动态模式
return false;
}
/*--end*/
if (1 == $seo_pseudo) {
isset($param['tid']) && $param['tid'] = input('param.tid/d');
} else {
isset($param['tid']) && $param['tid'] = input('param.tid/s');
}
isset($param['page']) && $param['page'] = input('param.page/d');
// aid唯一性的处理
if (isset($param['aid'])) {
if (strval(intval($param['aid'])) !== strval($param['aid'])) {
abort(404,'页面不存在');
}
$param['aid'] = intval($param['aid']);
}
$m_c_a_str = $request->module().'_'.$request->controller().'_'.$request->action(); // 模块_控制器_方法
$m_c_a_str = strtolower($m_c_a_str);
//exit('write_html_cache写入缓存<br/>');
foreach($html_cache_arr as $mca=>$val)
{
$mca = strtolower($mca);
if($mca != $m_c_a_str) //不是当前 模块 控制器 方法 直接跳过
continue;
if (empty($val['filename'])) {
continue;
}
$cache_tag = ''; // 缓存标签
$filename = '';
// 组合参数
if(isset($val['p']))
{
$tid = '';
if (in_array('tid', $val['p'])) {
$tid = $param['tid'];
if (strval(intval($tid)) != strval($tid)) {
$where = [
'dirname' => $tid,
];
if (empty($city_switch_on)) {
$where['lang'] =$home_lang;
}
$tid = \think\Db::name('arctype')->where($where)->getField('id');
$param['tid'] = $tid;
}
}
foreach ($val['p'] as $k=>$v) {
if (isset($param[$v])) {
if (preg_match('/\/$/i', $filename)) {
$filename .= $param[$v];
} else {
if (!empty($filename)) {
$filename .= '_';
}
$filename .= $param[$v];
}
}
}
/*针对列表缓存的标签*/
!empty($tid) && $cache_tag = $tid;
/*--end*/
/*针对内容缓存的标签*/
$aid = input("param.aid/d");
!empty($aid) && $cache_tag = $aid;
/*--end*/
}
empty($filename) && $filename = 'index';
/*子域名(移动端域名)*/
$is_mobile_domain = false;
$web_mobile_domain = config('tpcache.web_mobile_domain');
$goto = $request->param('goto');
$goto = trim($goto, '/');
$subDomain = $request->subDomain();
if ('m' == $goto || (!empty($subDomain) && $subDomain == $web_mobile_domain)) {
$is_mobile_domain = true;
} else {
if (3 == $seo_pseudo) {
$pathinfo = $request->pathinfo();
if (!empty($pathinfo)) {
$s_arr = explode('/', $pathinfo);
if ('m' == $s_arr[0]) {
$is_mobile_domain = true;
}
}
}
}
/*end*/
// 多站点
!empty($home_site) && $home_site = DS.$home_site;
// 缓存时间
$web_cmsmode = 1;//tpCache('web.web_cmsmode');
if (1 == intval($web_cmsmode)) { // 永久
$path = HTML_PATH.$val['filename'].DS.$home_lang.$home_site;
if (isMobile() || $is_mobile_domain) {
$path .= "_mobile";
} else {
$path .= "_pc";
}
$filename = $path.'_html'.DS."{$filename}.html";
tp_mkdir(dirname($filename));
!empty($html) && file_put_contents($filename, $html);
} else {
$path = HTML_PATH.$val['filename'].DS.$home_lang.$home_site;
if (isMobile()) {
$path .= "_mobile";
} else {
$path .= "_pc";
}
$path .= '_cache'.DS;
$web_htmlcache_expires_in = config('tpcache.web_htmlcache_expires_in');
$options = array(
'path' => $path,
'expire'=> intval($web_htmlcache_expires_in),
'prefix' => $cache_tag,
);
!empty($html) && html_cache($filename,$html,$options);
}
}
}
}
}
if (!function_exists('read_html_cache'))
{
/**
* 读取静态页面缓存
*/
function read_html_cache(){
$html_cache_status = config('HTML_CACHE_STATUS');
$html_cache_arr = config('HTML_CACHE_ARR');
if ($html_cache_status && !empty($html_cache_arr)) {
// 多站点/多语言
$home_lang = 'cn';
$home_site = '';
$city_switch_on = config('city_switch_on');
if (!empty($city_switch_on)) {
$home_site = get_home_site();
} else {
$home_lang = get_home_lang();
}
$request = \think\Request::instance();
$seo_pseudo = config('ey_config.seo_pseudo');
$param = input('param.');
/*前台筛选不进行页面缓存*/
$url_screen_var = config('global.url_screen_var');
if (isset($param[$url_screen_var])) {
return false;
}
/*end*/
if (1 == $seo_pseudo) {
isset($param['tid']) && $param['tid'] = input('param.tid/d');
} else {
isset($param['tid']) && $param['tid'] = input('param.tid/s');
}
isset($param['page']) && $param['page'] = input('param.page/d');
// aid唯一性的处理
if (isset($param['aid'])) {
if (strval(intval($param['aid'])) !== strval($param['aid'])) {
abort(404,'页面不存在');
}
$param['aid'] = intval($param['aid']);
}
$m_c_a_str = $request->module().'_'.$request->controller().'_'.$request->action(); // 模块_控制器_方法
$m_c_a_str = strtolower($m_c_a_str);
//exit('read_html_cache读取缓存<br/>');
foreach($html_cache_arr as $mca=>$val)
{
$mca = strtolower($mca);
if($mca != $m_c_a_str) //不是当前 模块 控制器 方法 直接跳过
continue;
if (empty($val['filename'])) {
continue;
}
$cache_tag = ''; // 缓存标签
$filename = '';
// 组合参数
if(isset($val['p']))
{
$tid = '';
if (in_array('tid', $val['p'])) {
$tid = $param['tid'];
if (strval(intval($tid)) != strval($tid)) {
$where = [
'dirname' => $tid,
];
if (empty($city_switch_on)) {
$where['lang'] =$home_lang;
}
$tid = \think\Db::name('arctype')->where($where)->getField('id');
$param['tid'] = $tid;
}
}
foreach ($val['p'] as $k=>$v) {
if (isset($param[$v])) {
if (preg_match('/\/$/i', $filename)) {
$filename .= $param[$v];
} else {
if (!empty($filename)) {
$filename .= '_';
}
$filename .= $param[$v];
}
}
}
/*针对列表缓存的标签*/
!empty($tid) && $cache_tag = $tid;
/*--end*/
/*针对内容缓存的标签*/
$aid = input("param.aid/d");
!empty($aid) && $cache_tag = $aid;
/*--end*/
}
empty($filename) && $filename = 'index';
/*子域名(移动端域名)*/
$is_mobile_domain = false;
$web_mobile_domain = config('tpcache.web_mobile_domain');
$goto = $request->param('goto');
$goto = trim($goto, '/');
$subDomain = $request->subDomain();
if ('m' == $goto || (!empty($subDomain) && $subDomain == $web_mobile_domain)) {
$is_mobile_domain = true;
} else {
if (3 == $seo_pseudo) {
$pathinfo = $request->pathinfo();
if (!empty($pathinfo)) {
$s_arr = explode('/', $pathinfo);
if ('m' == $s_arr[0]) {
$is_mobile_domain = true;
}
}
}
}
/*end*/
// 多站点
!empty($home_site) && $home_site = DS.$home_site;
// 缓存时间
$web_cmsmode = 1;//tpCache('web.web_cmsmode');
if (1 == intval($web_cmsmode)) { // 永久
$path = HTML_PATH.$val['filename'].DS.$home_lang.$home_site;
if (isMobile() || $is_mobile_domain) {
$path .= "_mobile";
} else {
$path .= "_pc";
}
$filename = $path.'_html'.DS."{$filename}.html";
if(is_file($filename) && file_exists($filename))
{
echo file_get_contents($filename);
exit();
}
} else {
$path = HTML_PATH.$val['filename'].DS.$home_lang.$home_site;
if (isMobile()) {
$path .= "_mobile";
} else {
$path .= "_pc";
}
$path .= '_cache'.DS;
$web_htmlcache_expires_in = config('tpcache.web_htmlcache_expires_in');
$options = array(
'path' => $path,
'expire'=> intval($web_htmlcache_expires_in),
'prefix' => $cache_tag,
);
$html = html_cache($filename, '', $options);
// $html = $html_cache->get($filename);
if($html)
{
echo $html;
exit();
}
}
}
}
}
}
if (!function_exists('is_local_images'))
{
/**
* 判断远程链接是否属于本地图片,并返回本地图片路径
*
* @param string $pic_url 图片地址
* @param boolean $returnbool 返回类型,false 返回图片路径,true 返回布尔值
*/
function is_local_images($pic_url = '', $returnbool = false)
{
if (stristr($pic_url, '//'.request()->host().'/')) {
$picPath = parse_url($pic_url, PHP_URL_PATH);
$picPath = preg_replace('#^(/[/\w]+)?(/public/upload/|/public/static/|/uploads/|/weapp/)#i', '$2', $picPath);
if (!empty($picPath) && file_exists('.'.$picPath)) {
$pic_url = ROOT_DIR.$picPath;
if (true == $returnbool) {
return $pic_url;
}
}
}
if (true == $returnbool) {
return false;
} else {
return $pic_url;
}
}
}
if (!function_exists('get_head_pic'))
{
/**
* 默认头像
*/
function get_head_pic($pic_url = '', $is_admin = false, $sex = '保密')
{
if ($is_admin) {
$default_pic = ROOT_DIR . '/public/static/admin/images/admint.png';
} else {
if ($sex == '女') {
$default_pic = ROOT_DIR . '/public/static/common/images/dfgirl.png';
} else {
$default_pic = ROOT_DIR . '/public/static/common/images/dfboy.png';
}
}
if (empty($pic_url)) {
$pic_url = $default_pic;
} else if (!is_http_url($pic_url)) {
$pic_url = handle_subdir_pic($pic_url);
} else if (is_http_url($pic_url)) {
$pic_url = str_ireplace(['http://thirdqq.qlogo.cn','http://qzapp.qlogo.cn'], ['https://thirdqq.qlogo.cn','https://qzapp.qlogo.cn'], $pic_url);
}
return $pic_url;
}
}
if (!function_exists('get_default_pic'))
{
/**
* 图片不存在,显示默认无图封面
* @param string $pic_url 图片路径
* @param string|boolean $domain 完整路径的域名
*/
function get_default_pic($pic_url = '', $domain = false)
{
if (is_http_url($pic_url)) {
$pic_url = handle_subdir_pic($pic_url, 'img', $domain);
}
if (!is_http_url($pic_url)) {
if (true === $domain) {
$domain = request()->domain();
} else if (false === $domain) {
$domain = '';
}
$pic_url = preg_replace('#^(/[/\w]+)?(/public/upload/|/public/static/|/uploads/|/weapp/)#i', '$2', $pic_url); // 支持子目录
$realpath = realpath(ROOT_PATH.trim($pic_url, '/'));
if ( is_file($realpath) && file_exists($realpath) ) {
$pic_url = $domain . ROOT_DIR . $pic_url;
} else {
$pic_url = $domain . ROOT_DIR . '/public/static/common/images/not_adv.jpg';
}
}
return $pic_url;
}
}
if (!function_exists('handle_subdir_pic'))
{
/**
* 处理子目录与根目录的图片平缓切换
* @param string $str 图片路径或html代码
*/
function handle_subdir_pic($str = '', $type = 'img', $domain = false, $clear_root_dir = false)
{
static $request = null;
if (null === $request) {
$request = \think\Request::instance();
}
$root_dir = $add_root_dir = ROOT_DIR;
if ($clear_root_dir == true && $domain == false) {
$add_root_dir = '';
}
switch ($type) {
case 'img':
if (!is_http_url($str) && !empty($str)) {
$str = preg_replace('#^(/[/\w]+)?(/public/upload/|/public/static/|/uploads/|/weapp/)#i', $add_root_dir.'$2', $str);
}else if (is_http_url($str) && !empty($str)) {
$StrData = parse_url($str);
$strlen = strlen($root_dir);
if (empty($StrData['scheme']) && $request->host(true) != $StrData['host']) {
$StrData['path'] = preg_replace('#^(/[/\w]+)?(/public/upload/|/uploads/|/public/static/)#i', '$2', $StrData['path']);
if (preg_match('#^(/public/upload/|/public/static/|/uploads/|/weapp/)#i', $StrData['path'])) {
// 插件列表
static $weappList = null;
if (null == $weappList) {
$weappList = \think\Db::name('weapp')->where([
'status' => 1,
])->cache(true, EYOUCMS_CACHE_TIME, 'weapp')
->getAllWithIndex('code');
}
if (!empty($weappList['Qiniuyun']) && 1 == $weappList['Qiniuyun']['status']) {
$qnyData = json_decode($weappList['Qiniuyun']['data'], true);
$weappConfig = json_decode($weappList['Qiniuyun']['config'], true);
if (!empty($weappConfig['version']) && 'v1.0.6' <= $weappConfig['version']) {
$qiniuyunModel = new \weapp\Qiniuyun\model\QiniuyunModel;
$str = $qiniuyunModel->handle_subdir_pic($qnyData, $StrData, $str);
} else {
if ($qnyData['domain'] == $StrData['host']) {
$tcp = !empty($qnyData['tcp']) ? $qnyData['tcp'] : '';
switch ($tcp) {
case '2':
$tcp = 'https://';
break;
case '3':
$tcp = '//';
break;
case '1':
default:
$tcp = 'http://';
break;
}
$str = $tcp.$qnyData['domain&#