function getBestFlashs($fid) { global $_FANWE; $args = array(); $cache_file = getTplCache('inc/club/flash_topic', array($fid), 1); if (getCacheIsUpdate($cache_file, 300)) { $args['best_list'] = FS('Topic')->getImgTopic('best', 6, 1, $fid); } return tplFetch('inc/club/flash_topic', $args, '', $cache_file); }
/** * 热心排行榜 */ function getHotUser() { $cache_file = getTplCache('inc/ask/hot_user', array(), 1); if (getCacheIsUpdate($cache_file, 300)) { //热心排行榜 $sql = "SELECT uc.uid,u.user_name,uc.ask,ask_posts,uc.ask_best_posts \r\n\t\t\tFROM " . FDB::table("user_count") . " AS uc \r\n\t\t\tINNER JOIN " . FDB::table("user") . " AS u ON u.uid = uc.uid \r\n\t\t\tORDER BY uc.ask_best_posts DESC ,uc.ask_posts DESC limit 10"; $hot_users = FDB::fetchAll($sql); $args['hot_users'] =& $hot_users; } return tplFetch('inc/ask/hot_user', $args, '', $cache_file); }
private function getList() { global $_FANWE; $_FANWE['user_click_share_id'] = (int) $_FANWE['request']['sid']; unset($_FANWE['request']['sid']); $cache_file = getTplCache('page/book/book_index', $_FANWE['request'], 2); if (getCacheIsUpdate($cache_file, BOOK_CACHE_PAGE_TIME)) { $category = urldecode($_FANWE['request']['cate']); $is_root = false; $page_args = array(); if (isset($_FANWE['cache']['goods_category']['cate_code'][$category])) { $page_args['cate'] = $_FANWE['request']['cate']; $cate_id = $_FANWE['cache']['goods_category']['cate_code'][$category]; $goods_cate_code = $category; } else { $is_root = true; $cate_id = $_FANWE['cache']['goods_category']['root']; } $sort = $_FANWE['request']['sort']; $sort = !empty($sort) ? $sort : "pop"; $category_data = $_FANWE['cache']['goods_category']['all'][$cate_id]; $category_tags = array(); $_FANWE['nav_title'] = $category_data['cate_name']; if (!empty($category_data['seo_keywords'])) { $_FANWE['seo_keywords'] = $category_data['seo_keywords']; $_FANWE['setting']['site_keywords'] = ''; } if (!empty($category_data['seo_desc'])) { $_FANWE['seo_description'] = $category_data['seo_desc']; $_FANWE['setting']['site_description'] = ''; } $child_ids = array(); if (isset($category_data['child'])) { $child_ids = $category_data['child']; if (!$is_root) { $tagurlpara['cate'] = urlencode($category_data['cate_code']); } foreach ($category_data['child'] as $child_id) { $child_cate = $_FANWE['cache']['goods_category']['all'][$child_id]; $tag_key = 'goods_category_tags_' . $child_id; FanweService::instance()->cache->loadCache($tag_key); foreach ($_FANWE['cache'][$tag_key] as $k => $tag) { $tagurlpara['tag'] = urlencode($tag['tag_name']); $tag['url'] = FU("book/" . ACTION_NAME, $tagurlpara); $child_cate['tags'][] = $tag; if ($k > 16) { break; } } $category_tags[] = $child_cate; } } $hot_tags = array(); if (!$is_root) { $child_ids[] = $cate_id; require fimport("function/share"); $hot_tags = getHotTags($child_ids, $category, 10); } $condition = " WHERE s.share_data IN ('goods','photo','goods_photo')"; if (!$is_root) { $cids = array(); FS('Share')->getChildCids($cate_id, $cids); $condition .= " AND sc.cate_id IN (" . implode(',', $cids) . ")"; } $title = $category_data['short_name']; $is_match = false; $tag = urldecode($_FANWE['request']['kw']); if (!empty($tag)) { $_FANWE['nav_title'] = $tag . ' - ' . $_FANWE['nav_title']; $title = htmlspecialchars($tag); $is_match = true; //$match_key = FS('Words')->segment($tag,10); //$match_key = tagToUnicode($match_key,'+'); $match_key = segmentToUnicode($tag, '+'); $condition .= " AND match(sm.content_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $page_args['tag'] = urlencode($tag); } //输出排序URL $sort_page_args = $page_args; $sort_page_args['sort'] = 'hot7'; $hot7_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'hot7') { $hot7_url['act'] = 1; } $sort_page_args['sort'] = 'hot30'; $hot30_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'hot30') { $hot30_url['act'] = 1; } $sort_page_args['sort'] = 'new'; $new_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'new') { $new_url['act'] = 1; } $sort_page_args['sort'] = 'pop'; $pop_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'pop') { $pop_url['act'] = 1; } if (!empty($_FANWE['request']['sort'])) { $page_args['sort'] = $sort; } else { $page_args['sort'] = 'pop'; } $today_time = getTodayTime(); switch ($sort) { //7天最热 点击次数 case 'hot7': $day7_time = $today_time - 604800; $field = ",(s.create_time > {$day7_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,s.click_count DESC"; break; //30天最热 点击次数 //30天最热 点击次数 case 'hot30': $day30_time = $today_time - 2592000; $field = ",(s.create_time > {$day30_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,s.click_count DESC"; break; //最新 //最新 case 'new': $field = ''; $sort = " ORDER BY s.share_id DESC"; break; //潮流 喜欢人数 //潮流 喜欢人数 case 'pop': default: $day7_time = $today_time - 604800; $field = ",(s.create_time > {$day7_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,s.collect_count DESC"; break; } $sql = 'SELECT DISTINCT(s.share_id),s.uid,s.content,s.collect_count,s.comment_count,s.create_time,s.cache_data ' . $field . ' FROM ' . FDB::table('share') . ' AS s '; if (!$is_root) { $sql .= 'INNER JOIN ' . FDB::table('share_category') . ' AS sc ON s.share_id = sc.share_id '; } if ($is_match) { $sql .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id '; } $sql .= $condition . $sort; $sql_count = 'SELECT COUNT(DISTINCT s.share_id) FROM ' . FDB::table('share') . ' AS s '; if (!$is_root) { $sql_count .= 'INNER JOIN ' . FDB::table('share_category') . ' AS sc ON s.share_id = sc.share_id '; } if ($is_match) { $sql_count .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id '; } $sql_count .= $condition; $page_size = 50; $max_page = 100; $count = FDB::resultFirst($sql_count); if ($count > $max_page * $page_size) { $count = $max_page * $page_size; } if ($_FANWE['page'] > $max_page) { $_FANWE['page'] = $max_page; } $pager = buildPage('book/' . $action, $page_args, $count, $_FANWE['page'], $page_size, '', 3); $share_datas = array(); $sql = $sql . ' LIMIT ' . $pager['limit']; $share_list = FDB::fetchAll($sql); $share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2); $col = 4; $index = 0; $share_display = array(); foreach ($share_list as $share) { $mod = $index % $col; $share_display['col' . $mod][] = $share; $index++; } include template('page/book/book_index'); display($cache_file); exit; } else { include $cache_file; display(); } }
/** * 首页分类推荐分享 */ function getIndexCateShare() { $args = array(); $cache_file = getTplCache('inc/index/index_cate_share', array(), 1); if (getCacheIsUpdate($cache_file, 600)) { global $_FANWE; FanweService::instance()->cache->loadCache('goods_category'); $cate_indexs = $_FANWE['cache']['goods_category']['all']; foreach ($cate_indexs as $k => $v) { if ($v['parent_id'] == 0 && $v['is_index'] == 1) { $cids = array(); FS('Share')->getChildCids($v['cate_id'], $cids); /*$tags = FDB::fetchAll("select gt.tag_name,gt.tag_code from ".FDB::table("goods_category_tags")." as gct INNER JOIN ".FDB::table("goods_tags")." as gt on gt.tag_id = gct.tag_id where gct.cate_id in (".implode(",",$cids).") order by gct.weight desc,gt.count desc,gt.tag_id desc limit 12"); foreach($tags as $tk=>$tv){ $tags[$tk]["encode"] = urlencode($tv['tag_code']); } $v['hot_tags'] = $tags ; */ $v['share_count'] = FDB::resultFirst("select count(DISTINCT s.uid) from " . FDB::table("share") . " as s INNER JOIN " . FDB::table("share_category") . " as sc ON sc.share_id = s.share_id where sc.cate_id in (" . implode(",", $cids) . ")"); $v['user'] = array(); $users = FDB::fetchAll("select DISTINCT(s.uid) as uid from " . FDB::table("share") . " as s INNER JOIN " . FDB::table("share_category") . " as sc ON sc.share_id = s.share_id where sc.cate_id in (" . implode(",", $cids) . ") order by s.share_id desc limit 10"); foreach ($users as $kk => $vv) { $user = FS("User")->getUserShowName($vv['uid']); $v['user'][$vv['uid']] = $user['name']; } $sql = "SELECT s.*,st.tag_name FROM " . FDB::table("share") . " as s \r\n\t\t\t\t\t\tINNER JOIN " . FDB::table("share_category") . " as sc ON sc.share_id = s.share_id \r\n\t\t\t\t\t\tINNER JOIN " . FDB::table("share_tags") . " as st ON st.share_id = s.share_id\r\n\t\t\t\t\t\tINNER JOIN " . FDB::table("goods_category_tags") . " as gct ON gct.cate_id = sc.cate_id\r\n\t\t\t\t\t\tWHERE gct.cate_id in (" . implode(",", $cids) . ") AND s.is_index=1 GROUP BY s.share_id ORDER BY s.sort desc,s.share_id desc limit 30"; $v['share_list'] = FDB::fetchAll($sql); foreach ($v['share_list'] as $kk => $vv) { $tag['tag_name'] = $vv['tag_name']; $tag['tag_code'] = $vv['tag_name']; $tag['encode'] = urlencode($vv['tag_name']); $v['hot_tags'][$vv['tag_name']] = $tag; } $v['share_list'] = FS("Share")->getShareDetailList($v['share_list']); $args['cate_list'][] = $v; } } unset($cate_indexs); } return tplFetch('inc/index/index_cate_share', $args, '', $cache_file); }
/** * 最新活动,热门主题 */ function getPinkHotTopic() { $cache_file = getTplCache('inc/index/hot_topic', array(), 1); if (getCacheIsUpdate($cache_file, 600)) { $args['new_events'] = FS('Event')->getHotNewEvent(4); $args['hot_topics'] = FS('Topic')->getHotTopicList(0, 0, 2); } return tplFetch('inc/index/hot_topic', $args, '', $cache_file); }
/** * 首页 最新的主题 */ function getUUIndexTopic() { global $_FANWE; $args = array(); $cache_file = getTplCache('inc/index/new_topic', array(), 1); if (getCacheIsUpdate($cache_file, 600)) { $res = FDB::query('SELECT fid,thread_count FROM ' . FDB::table('forum') . ' WHERE parent_id = 0'); while ($data = FDB::fetch($res)) { $_FANWE['cache']['forums']['all'][$data['fid']]['thread_count'] = $data['thread_count']; } $args['new_list'] = FS('Topic')->getImgTopic('new', 5, 1); $args['ask_list'] = FS('Ask')->getImgAsk('new', 5, 1); } return tplFetch('inc/index/topics', $args, '', $cache_file); }
/** * 晒货列表 */ function getLookLists() { $args = array(); $cache_file = getTplCache('inc/index/look_list', array(), 1); if (getCacheIsUpdate($cache_file, 600)) { $args['look_list'] = FS('Share')->getPhotoListByType("look"); } return tplFetch('inc/index/look_list', $args, '', $cache_file); }
<?php $uid = (int) $_FANWE['request']['uid']; if ($uid == 0) { exit; } require_once fimport('dynamic/user'); $cache_file = getTplCache('services/user/tip', $_FANWE['request'], 2); if (getCacheIsUpdate($cache_file, 600)) { $user = FS("User")->getUserById($uid); if ($user) { $user['url'] = FU('u/index', array('uid' => $uid)); $user['city'] = ''; Cache::getInstance()->loadCache('citys'); $reside_province = $_FANWE['cache']['citys']['all'][$user['reside_province']]['name']; $reside_city = $_FANWE['cache']['citys']['all'][$user['reside_city']]['name']; if (!empty($reside_province)) { $user['city'] .= $reside_province; } if (!empty($reside_city)) { $user['city'] .= ' ' . $reside_city; } $medals = array(); if (!empty($user['medals'])) { $medals = explode(',', $user['medals']); } $user['medals'] = array(); if ($user['is_buyer'] == 1) { $user['medals'][] = array('name' => lang('user', 'buyer_alt'), 'url' => FU('settings/buyerverifier'), 'small_img' => './tpl/images/medal_buyer.png'); } if ($user['is_daren'] == 1) {