|
发表于 2014-7-24 00:49:18
|
显示全部楼层
来自 中国北京
break; } } $fup_string = trim(join('_',array_reverse($fup_array)),'_'); return '_'.$fup_string; } //获取黄页顶级导航id function get_hy_fup($fid){ global $Fid_db; while(true){ if($Fid_db['fup'][$fid]!=0){ $fup_array[] = $Fid_db['fup'][$fid]; $fid = $Fid_db['fup'][$fid]; }else{ break; } } return $fid; } function get_user_info_num($type = 'all'){ global $db,$_pre,$lfjuid; $Fid_DB = include(ROOT_PATH."data/all_fid.php"); $sql = 'select count(id) as icount from ('; foreach($Fid_DB['fup'] as $k=>$v){ if($v!=0){ continue; } switch($type){ case 'all': $sql.='select id from `'.$_pre.'db_'.$k.'` where uid = '.$lfjuid.' and yz = 1 union all '; break; case 'unyz': $sql.='select id from `'.$_pre.'db_'.$k.'` where uid = '.$lfjuid.' and yz = 0 union all '; break; } } $sql=trim($sql,'union all').') t '; $icount = $db->get_one($sql); return $icount['icount']; } function get_z_info($fid,$num = 10){ global $db,$_pre,$timestamp,$city_id,$module_DB,$Module_db,$field_db,$webdb; $Cache_FileName = ROOT_PATH . "data/data_cache/$city_id-$fid/z_" . $fid . ".php"; if ($webdb['Info_list_cache'] && (time() - filemtime($Cache_FileName)) < ($webdb['Info_list_cache'] * 60)){ $listdb = unserialize(file_get_contents($Cache_FileName)); }else{ $sql = "SELECT * FROM {$_pre}buyad WHERE sortid = '-2' and fid = '$fid' and cityid = '$city_id' AND endtime>$timestamp and begintime < $timestamp ORDER BY aid DESC,begintime limit $num"; $query = $db->query($sql); while($r = $db->fetch_array($query)){ $_erp = get_erp($r['fid']); $rs = $db->get_one("SELECT A.id,A.title,A.city_id,A.zone_id,A.street_id,A.fname,A.listbold,A.picurl,B.* FROM {$_pre}content{$_erp} A left join {$_pre}content_{$r['mid']} B on A.id = B.id WHERE A.id = {$r['id']} and A.yz=1 AND A.city_id='$city_id' limit 1"); if($rs){ $field_db = $module_DB[$r['mid']]['field']; $Module_db->showfield($field_db,$rs,'list'); $rs['red'] = $r['red']; $rs['money'] = $r['money']; if ($rs['picurl']) { $rs['picurl'] = tempdir($rs['picurl']); } $rs['url'] = get_info_url($rs['id'],$rs['fid']); $listdb[] = $rs; } } if ($webdb['Info_list_cache']){ //开启了列表缓存,将数据写进文件中 if((time() - filemtime($Cache_FileName)) > ($webdb['Info_list_cache'] * 60) ||!file_exists($Cache_FileName)){ if (!is_dir(dirname($Cache_FileName))) { makepath(dirname($Cache_FileName)); } file_put_contents($Cache_FileName,serialize($listdb)); } } } return $listdb; } ?> |
|