将织梦DEDECMS文章的发布时间改为审核时间

admin
admin
admin
374
文章
102
评论
2021年7月11日09:03:12
评论
184

将织梦DEDECMS文章的发布时间改为审核时间

用织梦DEDECMS发布文章的时候,有时候我们可能采集了很多,但并不是一次性全部发布,这个时候就需要每天进行审核,但文章审核以后,发布时间依旧是以前的发布时间,文章列表排序也没有排到最前面,这样很不利于优化,这里品自行博客来解决这个问题。

主要是更改织梦后台目录下的的文件/dede/archives_do.php。

将以下代码:

//审核文档
function checkArchives() {   }
---------------------------*/
else if($dopost=="checkArchives")
{
    CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
    require_once(DEDEADMIN."/inc/inc_archives_functions.php");
    if( !empty($aid) && empty($qstr) ) $qstr = $aid;
    if($qstr=='')
    {
        ShowMsg("参数无效!",$ENV_GOBACK_URL);
        exit();
    }
    $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
    $query = "SELECT arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable FROM `#@__arctiny` arc
               LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
            LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype
            WHERE arc.id in($arcids) ";
    $dsql->SetQuery($query);
    $dsql->Execute('ckall');
					
    while($row = $dsql->GetArray('ckall'))
    {
        $aid = $row['id'];
        $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
        $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='0' WHERE id='$aid' ");
        if($row['issystem']==-1)
        {
            $dsql->ExecuteNoneQuery("UPDATE `".trim($row['addtable'])."` SET arcrank='0' WHERE aid='$aid' ");
        }
        else
        {
            $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET arcrank='0', dutyadmin='".$cuserLogin->getUserID()."' WHERE id='$aid' ");
        }
        $dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='0' WHERE aid='$aid' "); 
        $pageurl = MakeArt($aid,false);
    }
    ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
    exit();
}
/*--------------------------
//删除文档

 

替换成下面的代码:

//审核文档
function checkArchives() {   }
---------------------------*/
else if($dopost=="checkArchives")
{
    CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
    require_once(DEDEADMIN."/inc/inc_archives_functions.php");
    if( !empty($aid) && empty($qstr) ) $qstr = $aid;
    if($qstr=='')
    {
        ShowMsg("参数无效!",$ENV_GOBACK_URL);
        exit();
    }
    $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
    $query = "SELECT arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable FROM `#@__arctiny` arc
               LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
            LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype
            WHERE arc.id in($arcids) ";
    $dsql->SetQuery($query);
    $dsql->Execute('ckall');
    $uptimes=time();
    while($row = $dsql->GetArray('ckall'))
    {
        $aid = $row['id'];
        $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
        $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='0' WHERE id='$aid' ");
        if($row['issystem']==-1)
        {
            $dsql->ExecuteNoneQuery("UPDATE `".trim($row['addtable'])."` SET pubdate='$uptimes',senddate='$uptimes',sortrank='$uptimes',arcrank='0' WHERE aid='$aid' ");
        }
        else
        {
            $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET pubdate='$uptimes',senddate='$uptimes',sortrank='$uptimes',arcrank='0', dutyadmin='".$cuserLogin->getUserID()."' WHERE id='$aid' ");
        }
        $dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET pubdate='$uptimes',senddate='$uptimes',sortrank='$uptimes',arcrank='0' WHERE aid='$aid' "); 
        $pageurl = MakeArt($aid,false);
    }
    ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL);
    exit();
}
/*--------------------------
//删除文档

 

主要涉及到以下代码的修改:

加了一句$uptimes=time()和pubdate='$uptimes',senddate='$uptimes',sortrank='$uptimes'

将织梦DEDECMS文章的发布时间改为审核时间

admin
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: