01//获得附加表的相关信息02$addField = "";03$addJoin = "";04if(is_object($refObj->ChannelUnit))05{06 $addtable = $refObj->ChannelUnit->ChannelInfos['addtable'];07 if($addtable!="")08 {09 $addJoin = " LEFT JOIN $addtable ON arc.id = ".$addtable.".aid ";10 $addField = "";11 $fields = explode(",",$refObj->ChannelUnit->ChannelInfos['listfields']);12 foreach($fields as $k=>$v)13 {14 $nfields[$v] = $k;15 }16 foreach($refObj->ChannelUnit->ChannelFields as $k=>$arr)17 {18 if(isset($nfields[$k]))19 {20 if(!empty($arr['rename']))21 {22 $addField .= ",".$addtable.".".$k." as ".$arr['rename'];23 }24 else25 {26 $addField .= ",".$addtable.".".$k;27 }28 }29 }30 }31} |