PHPCMS V9 定时发布文章的实现方法

phpcms教程 强烈建议 2024-03-02 10:44 169 0

  //add 定时发布审核功能

  $urlobj = pc_base::load_app_class('url', 'content');

  $html = pc_base::load_app_class('html', 'content');

  $modelid = $modelid ? $modelid : intval($_GET['modelid']);

  $content_db = $content_db ? $content_db : pc_base::load_model('content_model');

  $content_db->set_model($modelid);

  $where = ' status = 1 and inputtime <= '.SYS_TIME;

  $r = $content_db->count($where);

  if( !empty($r) ){ //执行update操作

  $ids = $content_db->select($where, 'id,catid', $r, '', '', 'id');

  foreach($ids AS $kid=>$v){

  $catid = $v['catid'];

  $id = $kid;

  $r = $content_db->get_content($catid,$id);

  $urls = $urlobj->show($id, 0, $catid, $r['inputtime'], $r['prefix'],$r,'add');

  if($urls['content_ishtml']) $html->show($urls[1],$urls['data'],0);

  $html->index();

  $html->create_relation_html($catid);

  }

  $content_db->update( array('status'=>99),$where );

  }

本站资源均来自互联网或会员发布,如果不小心侵犯了您的权益请与我们联系。我们将立即删除!谢谢!