phpcms V9 全站文章点击排行榜标签

phpcms教程 强烈建议 2024-03-02 10:43 223 0

  /** 2013年4月23日

  * sitehits站点点击排行

  * @param $data

  */

  function sitehits($data){

  if(emptyempty($data['siteid'])) return false;

  $siteid = intval($data['siteid']);

  $this->hits_db = pc_base::load_model('hits_model');

  $category_content = getcache('category_content','commons');

  $catid = '';

  //获取站点下所有栏目ID

  foreach($category_contentas$key=>$val){

  if($val==$siteid){

  $catid .= $comma.$key;

  $comma=',';

  }

  }

  //获取点击排行

  $r = $this->hits_db->select('catid in('.$catid.')','hitsid',$data['limit'],$data['order']);

  $return = array();

  $sitemodel_model_db = pc_base::load_model('sitemodel_model');

  $this->db_config = pc_base::load_config('database');

  $tablepre = $this->db_config['default']['tablepre'];

  foreach($ras$key){

  preg_match_all('/-(d+)-/',$key['hitsid'],$modelid);

  $id = substr($key['hitsid'],(strpos($key['hitsid'],'-',2)+1));

  $tablename = $sitemodel_model_db->get_one(array('modelid'=>$modelid[1][0]),'tablename');

  $this->db->table_name = $tablepre.$tablename['tablename'];

  $return[] = array_merge($return,$this->db->get_one(array('id'=>$id)));

  }

  return$return;

  }

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