找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 100|回复: 0

[cms教程] dedecms织梦采集相同标题文章跳过采集方法

[复制链接]

该用户从未签到

发表于 2018-8-3 10:20:34 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
采集到相同文章时,织梦会重复添加文章,我们要让相同的文章跳过采集
       
                 
       
                 
       
                 
       
                打开 /dede/article_add.php 找到
       
                 
       
                if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50] 200) : $cfg_arc_click);
       
                 
       
                 
       
                 
       
                在它的下面加入
       
                 
       
                if(!empty($title) && $cfg_check_title=='Y')
       
                {
       
                         $row = $dsql->GetOne("SELECT id FROM `dede_archives` WHERE title LIKE '$title' ");
       
                         if(is_array($row))
       
                         {
       
                                   if(empty($typeid))
       
                                   {
       
                                            ShowMsg("请指定文档的栏目!","-1");
       
                                            exit();
       
                                   }
       
                                   if(empty($channelid))
       
                                   {
       
                                            ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1");
       
                                            exit();
       
                                   }
       
                                   if(!CheckChannel($typeid,$channelid))
       
                                   {
       
                                            ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1");
       
                                            exit();
       
                                   }
       
                                   if(!TestPurview('a_New'))
       
                                   {
       
                                            CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!");
       
                                   }
       
                                   
       
                                   
       
                                   //对保存的内容进行处理
       
                                   $id = $row['id',;
       
                                   $pubdate = GetMkTime($pubdate);
       
                                   $sortrank = AddDay($pubdate,$sortup);
       
                                   $ismake = $ishtml==0 ? -1 : 0;
       
                                   $autokey = 1;
       
                                   $title = dede_htmlspecialchars(cn_substrR($title,$cfg_title_maxlen));
       
                                   $shorttitle = $shorttitle;
       
                                   $color =  cn_substrR($color]7);
       
                                   $writer =  $writer;
       
                                   $source = $source;
       
                                   $description = cn_substrR($description,250);
       
                                   $keywords = trim(cn_substrR($keywords,60));
       
                                   $filename = trim(cn_substrR($filename,40));
       
                                   $isremote  = (empty($isremote)? 0  : $isremote);
       
                                   $serviterm=empty($serviterm)? "" : $serviterm;
       
                                   if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
       
                                   {
       
                                            $arcrank = -1;
       
                                   }
       
                                   $adminid = $cuserLogin->getUserID();
       
                  
       
                                   //处理上传的缩略图
       
                                   if(empty($ddisremote))
       
                                   {
       
                                            $ddisremote = 0;
       
                                   }
       
                                   $litpic = GetDDImage('none',$picname,$ddisremote);
       
                  
       
                                   //分析body里的内容
       
                                   $body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext');
       
                  
       
                                   //分析处理附加表数据
       
                                   $inadd_f = '';
       
                                   $inadd_v = '';
       
                                   if(!empty($dede_addonfields))
       
                                   {
       
                                            $addonfields = explode(';',$dede_addonfields);
       
                                            $inadd_f = '';
       
                                            $inadd_v = '';
       
                                            if(is_array($addonfields))
       
                                            {
       
                                                     foreach($addonfields as $v)
       
                                                     {
       
                                                               if($v=='')
       
                                                               {
       
                                                                        continue;
       
                                                               }
       
                                                               $vs = explode(',',$v);
       
                                                               if($vs[1,=='htmltext'||$vs[1,=='textdata') //HTML文本特殊处理
       
                                                               {
       
                                                                        ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1,);
       
                                                               }else
       
                                                               {
       
                                                                        if(!isset(${$vs[0]}))
       
                                                                        {
       
                                                                                 ${$vs[0]} = '';
       
                                                                        }
       
                                                                        ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1,,$id);
       
                                                               }
       
                                                               $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'";
       
                                                     }
       
                                            }
       
                                   }
       
                  
       
                                   //处理图片文档的自定义属性
       
                                   if($litpic!='' && !preg_match("
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-9-29 17:34

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表