From 1320bb143055b1e82fb02aada06eaf3109baee20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=83=A1?= <3203164629@qq.com> Date: Fri, 28 Jun 2024 06:09:20 +0000 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 小胡 <3203164629@qq.com> --- core/class/table/table_resources_attr.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/class/table/table_resources_attr.php b/core/class/table/table_resources_attr.php index 139a80e..fc83aff 100644 --- a/core/class/table/table_resources_attr.php +++ b/core/class/table/table_resources_attr.php @@ -61,11 +61,16 @@ class table_resources_attr extends dzz_table return $returndata; } $returndata = array(); - foreach(DB::fetch_all("select * from %t where rid = %s and vid = %d",array($this->_table,$rid,$vid)) as $val ){ + foreach(DB::fetch_all("select * from %t where rid = %s and (vid = %d or vid='0') order by vid",array($this->_table,$rid,$vid)) as $val ){ if($val['skey']=='icon'){ - $val['sval']=C::t('attachment')->getThumbByAid($val['sval'],0,0,1); - $val['skey']='img'; + + if($img=C::t('attachment')->getThumbByAid($val['sval'],0,0,1)){ + $val['sval']=$img; + $val['skey']='img'; + } + } + $returndata[$val['skey']] = $val['sval']; } $this->store_cache($cachekey,$returndata); @@ -113,7 +118,7 @@ class table_resources_attr extends dzz_table } public function update_vid_by_rvid($rid,$oldvid,$vid){ $i=0; - foreach(DB::fetch_all("select id from %t where rid=%s and vid = %d",array($this->_table,$rid,$oldvid)) as $value){ + foreach(DB::fetch_all("select * from %t where rid=%s and vid = %d",array($this->_table,$rid,$oldvid)) as $value){ if(self::update($value['id'],array('vid'=>$vid))){ $i++; }