此功能已有插件,插件更好用:https://www.moyublog.com/notes/1142.html
当一个站大量采集信息,一次发布不利于长期SEO,所以从网上找了这个脚本稍作修改。分享给大家,其实也很简单,但比帝国自带的计划任务功能好的是,不用开启后台才运行,脚本放到服务器上后加入服务器的计划任务便可以每天定时审核发布信息。
query ( "SELECT classid,islast from {$dbtbpre}enewsclass where $where" );
$class = array ();
$pclass = array ();
while ( $r = $empire->fetch ( $class_list ) ) {
if ($r ['islast'] == '0') {
array_push ( $pclass, $r ['classid'] );
// 非终极栏目不可以发不信息,所以不参与信息审核
} else {
array_push ( $class, $r ['classid'] );
}
}
foreach ( $class as $key => $val ) {
ecmscheck ( $val, $news_table, $news_num );
// 审核} // 刷新非终极栏目
foreach ( $pclass as $key => $value ) {
echo '上级栏目'.$value.'已经更新
';
ReListHtml ( $value, 1 );
}
ReIndex();
//刷新首页
/*** * @param $classid* @param $table* @param $num*/
function ecmscheck($classid, $table, $num) {
global $empire, $class_r, $dbtbpre;
$time = time ();
// 每周一审核的设置为推荐
$isgood = '0';
$day = strftime ( "%A" );
if ($day == 'Monday') {
$isgood = '1';
}
$res = $empire->query ( "select id from {$dbtbpre}ecms_" . $table . "_check where classid =" . $classid . " ORDER BY `truetime` ASC LIMIT {$num}" );
while ( $r = $empire->fetch ( $res ) ) {
$data [] = $r ['id'];
}
CheckNews_auto ( $classid, $data );
}
/*** 审核信息* @param $classid* @param $id*/
function CheckNews_auto($classid, $id) {
global $empire, $class_r, $dbtbpre, $emod_r, $adddatar;
$classid = ( int ) $classid;
$count = count ( $id );
$time = time();
//每周一审核的设置为推荐
$isgood = strftime('%A') == 'Monday'?1:0;
for ($i = 0; $i < $count; $i ++) {
$infoid = ( int ) $id [$i];
$infor = $empire->fetch1 ( "select * from {$dbtbpre}ecms_" . $class_r [$classid] [tbname] . "_check where id='$infoid' limit 1" );
//$picurl = empty($infor['titlepic'])?'/images/smallpic/'.rand(1,300).'.jpg':$infor['titlepic'];
//为了网站能好看点设置一个1-300的随机图片
$res = $empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]."_check set truetime='$time',newstime='$time',lastdotime='$time',isgood='$isgood' where id='$infoid' limit 1");
$sql = $empire->query ( "update {$dbtbpre}ecms_" . $class_r [$classid] [tbname] . "_index set checked=1,truetime='$time',newstime='$time',lastdotime='$time' where id='$infoid'" );
// 未审核表转换
MoveCheckInfoData ( $class_r [$classid] [tbname], 0, $infor ['stb'], "id='$infoid'" );
// 更新栏目信息数
AddClassInfos ( $infor ['classid'], '', '+1' );
// 刷新信息
GetHtml ( $infor ['classid'], $infor ['id'], $infor, 0 );
echo '信息 '.$infor ['id'].' 内容页已经更新
';
// 刷新列表
ReListHtml ( $infor ['classid'], 1 );
echo '终极栏目 '.$infor ['classid'].' 已经更新
';
}
}
//刷新首页function ReIndex(){
$indextemp=GetIndextemp();
//取得模板
NewsBq($classid,$indextemp,1,0);
echo '首页已经刷新';
}
?>
自己放到e/extend/sc/.index.php 文件夹里面
然后在服务器上搞个计划任务 定时打开这个地址 hide后面加 ?pwd=密码 即可!
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: 帝国CMS自动审核发布信息脚本