phpcms v9未审核推荐信息出现在推荐列表中【BUG修复】

修改文件:phpcms/modules/content/class/content_tag.class.php

调整过的方法:

php 复制代码
public function __construct() {
		$this->db = pc_base::load_model('content_model');
		$this->position = pc_base::load_model('position_model');
		$this->position_data = pc_base::load_model('position_data_model');
	}


/**
	 * 推荐位
	 * WY EDIT AT 2024-01-09 已修复未审核信息出现在推荐列表中的问题
	 * @param $data
	 */
	public function position($data) {
		$sql = '';
		$array = array();
		$posid = intval($data['posid']);
$position = $this->position->get_one(array('posid'=>$posid));
$this->db->set_model($position['modelid']);
$this->tablename = $this->db->table_name;
$result = $this->db->select("status=99 AND posids=1", '*', '', '', '');
foreach ($result as $r) {
	$ids_array[] = $r['id'];
}
$ids = implode(',', $ids_array);
if($ids) {
	$sql = "id IN ($ids) AND ";
} else {
	$sql = '1<>1 AND';
}
		$order = $data['order'];
		$thumb = (empty($data['thumb']) || intval($data['thumb']) == 0) ? 0 : 1;
		$siteid = $GLOBALS['siteid'] ? intval($GLOBALS['siteid']) : 1;
		$catid = (empty($data['catid']) || $data['catid'] == 0) ? '' : intval($data['catid']);
		if($catid) {
			$siteids = getcache('category_content','commons');
			if(!$siteids[$catid]) return false;
			$siteid = $siteids[$catid];
			$this->category = getcache('category_content_'.$siteid,'commons');
		}
		if($catid && $this->category[$catid]['child']) {
			$catids_str = $this->category[$catid]['arrchildid'];
			$pos = strpos($catids_str,',')+1;
			$catids_str = substr($catids_str, $pos);
			$sql .= "`catid` IN ($catids_str) AND ";
		}  elseif($catid && !$this->category[$catid]['child']) {
			$sql .= "`catid` = '$catid' AND ";
		}
		if($thumb) $sql .= "`thumb` = '1' AND ";
		if(isset($data['where'])) $sql .= $data['where'].' AND ';
		if(isset($data['expiration']) && $data['expiration']==1) $sql .= '(`expiration` >= \''.SYS_TIME.'\' OR `expiration` = \'0\' ) AND ';
		$sql .= "`posid` = '$posid' AND `siteid` = '".$siteid."'";
		$pos_arr = $this->position_data->select($sql, '*', $data['limit'],$order);
		if(!empty($pos_arr)) {
			foreach ($pos_arr as $info) {
				$key = $info['catid'].'-'.$info['id'];
				$array[$key] = string2array($info['data']);
				$array[$key]['url'] = go($info['catid'],$info['id']);
				$array[$key]['id'] = $info['id'];
				$array[$key]['catid'] = $info['catid'];
				$array[$key]['listorder'] = $info['listorder'];
			}
		}
		return $array;
	}
相关推荐
Q_Q19632884753 小时前
python的电影院座位管理可视化数据分析系统
开发语言·spring boot·python·django·flask·node.js·php
Ashlee_code5 小时前
香港券商智能櫃台系統技術解決方案——融合跨境清算與AI風控,助力券商把握滬港雙市爆發機遇**
java·科技·金融·重构·架构·系统架构·php
nightunderblackcat6 小时前
进阶向:人物关系三元组,解锁人物关系网络的钥匙
开发语言·python·开源·php
向日葵.1 天前
fastdds.ignore_local_endpoints 属性
服务器·网络·php
dog2501 天前
难以超越的 TCP AIMD
网络协议·tcp/ip·php
檀越剑指大厂1 天前
【Linux系列】如何在 Linux 服务器上快速获取公网
linux·服务器·php
Q_Q5110082851 天前
python的软件工程与项目管理课程组学习系统
spring boot·python·django·flask·node.js·php·软件工程
BingoGo1 天前
重新学习 PHP 目前短运算符 简化你得代码
后端·php
Fine姐1 天前
The Network Link Layer: 无线传感器中Delay Tolerant Networks – DTNs 延迟容忍网络
开发语言·网络·php·硬件架构
hotlinhao2 天前
php版的FormCreate使用注意事项
php·crmeb