在e/extend/develop目录下新建run.php文件,引入文件,写入以下代码: <?php $dosort=$_POST[dosort]; $newstime=$_POST[newstime]; echo "更新时间为:".$newstime." "; $donewstime=$newstime?to_time($newstime):time(); switch($dosort){ case "updatefew": UpdateFewInfoTime("phome_ecms_photo","photo",$donewstime); break; case "updatephone": UpdateMoreInfoTime("phome_ecms_photo","photo",$donewstime); break; case "updatenews": UpdateMoreInfoTime("phome_ecms_news","news",$donewstime); break; } function UpdateFewInfoTime($infotb,$tbname,$donewstime){ global $empire; for($i=2;$i<=7;$i++){ $osql=$empire->query("select id,title from ".$infotb." where classid=".$i." order by RAND() limit 3"); while($o=$empire->fetch($osql)){ $doinfoid=(int)$o[id]; $empire->query("update phome_ecms_".$tbname."_index set newstime='$donewstime' where id='$doinfoid'"); $empire->query("update ".$infotb." set newstime='$donewstime' where id='$doinfoid'"); echo $o[title]." "; } } echo "随机更新完成~"; } function UpdateMoreInfoTime($infotb,$tbname,$donewstime){ global $empire; $i=0; $osql=$empire->query("select id from ".$infotb.""); while($o=$empire->fetch($osql)){ $doinfoid=(int)$o[id]; $donewstime=$newstime[$i]?to_time($newstime[$i]):time(); $empire->query("update phome_ecms_".$tbname."_index set newstime='$donewstime' where id='$doinfoid'"); $empire->query("update ".$infotb." set newstime='$donewstime' where id='$doinfoid'"); $i++; } echo $i."条信息更新完成~"; } ?>
在“系统 -> 扩展菜单 -> 管理菜单”中添加插件地址“/e/extend/develop/” 插件安装完毕,后台既可执行批量更新信息发布时间。 下载地址: 帝国CMS使用tagid实现tag伪静态的方法 淘宝商品分类明细 |