本文整理汇总了PHP中set_dynamic_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP set_dynamic_cache函数的具体用法?PHP set_dynamic_cache怎么用?PHP set_dynamic_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_dynamic_cache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fav
public function fav()
{
if (!$GLOBALS['user_info']) {
app_redirect(url("user#login"));
}
$GLOBALS['tmpl']->assign("page_title", "我关注的项目动态");
$cate_result = load_dynamic_cache("INDEX_CATE_LIST");
if ($cate_result === false) {
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
$cate_result = array();
foreach ($cate_list as $k => $v) {
$cate_result[$v['id']] = $v;
}
set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
}
$GLOBALS['tmpl']->assign("cate_list", $cate_result);
$rand_deals = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and begin_time < " . NOW_TIME . " and (end_time >" . NOW_TIME . " or end_time = 0) order by rand() limit 3");
$GLOBALS['tmpl']->assign("rand_deals", $rand_deals);
$page_size = DEALUPDATE_PAGE_SIZE;
$step_size = DEALUPDATE_STEP_SIZE;
$step = intval($_REQUEST['step']);
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
$GLOBALS['tmpl']->assign("current_page", $page);
$sql = "select dl.* from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dl.create_time desc limit " . $limit;
$sql_count = "select count(*) from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']);
$log_list = $GLOBALS['db']->getAll($sql);
$log_count = $GLOBALS['db']->getOne($sql_count);
foreach ($log_list as $k => $v) {
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$online_time = online_date($v['create_time'], $deal_info['begin_time']);
$log_list[$k]['online_time'] = $online_time['info'];
$log_list[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id']);
$log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " order by create_time desc limit 3");
if ($log_list[$k]['comment_count'] <= count($log_list[$k]['comment_list'])) {
$log_list[$k]['more_comment'] = false;
} else {
$log_list[$k]['more_comment'] = true;
}
$log_list[$k]['deal_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $v['deal_id']);
if ($log_list[$k]['deal_info']) {
$log_list[$k]['deal_info']['remain_days'] = floor(($log_list[$k]['deal_info']['end_time'] - NOW_TIME) / (24 * 3600));
$log_list[$k]['deal_info']['percent'] = round($log_list[$k]['deal_info']['support_amount'] / $log_list[$k]['deal_info']['limit_price'] * 100);
}
}
$GLOBALS['tmpl']->assign('log_list', $log_list);
$pager = new Page($log_count, $page_size);
//初始化分页对象
$p = $pager->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("ajaxurl", url("ajax#newsfav", array("p" => $page)));
$GLOBALS['tmpl']->display("news.html");
}
开发者ID:noikiy,项目名称:yisheji,代码行数:59,代码来源:newsModule.class.php
示例2: index
public function index()
{
$image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
if ($image_list === false) {
$image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
}
$GLOBALS['tmpl']->assign("image_list", $image_list);
$cate_result = load_dynamic_cache("INDEX_CATE_LIST");
if ($cate_result === false) {
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
$cate_result = array();
foreach ($cate_list as $k => $v) {
$cate_result[$v['id']] = $v;
}
set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
}
$GLOBALS['tmpl']->assign("cate_list", $cate_result);
$page_size = DEAL_PAGE_SIZE;
$step_size = DEAL_STEP_SIZE;
$step = intval($_REQUEST['step']);
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
$GLOBALS['tmpl']->assign("current_page", $page);
$deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_effect = 1 and is_recommend = 1 and is_delete = 0 order by sort asc limit " . $limit);
//$deal_count = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."deal where is_effect = 1 and is_recommend = 1 and is_delete = 0");
foreach ($deal_list as $k => $v) {
$deal_list[$k]['remain_days'] = floor(($v['end_time'] - NOW_TIME) / (24 * 3600));
$deal_list[$k]['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
}
$GLOBALS['tmpl']->assign("deal_list", $deal_list);
//add by fjl begin
//热门项目
//add by fjl end
//$page = new Page($deal_count,$page_size); //初始化分页对象
//$p = $page->show();
//$GLOBALS['tmpl']->assign('pages',$p);
$GLOBALS['tmpl']->display("index.html");
}
开发者ID:bharatthakkar,项目名称:stock-crowd-funding-system,代码行数:45,代码来源:indexModule.class.php
示例3: index
public function index()
{
$root = array();
$page = intval($GLOBALS['request']['page']);
// 分页
$page = $page == 0 ? 1 : $page;
$root['response_code'] = 1;
$param = array();
// 参数集合
// 数据来源参数
$r = strim($_REQUEST['r']);
// 推荐类型
$param['r'] = $r ? $r : '';
$id = intval($_REQUEST['id']);
// 分类id3
$param['id'] = $id;
// ios标志
if ($id == 0) {
$isAll = 1;
} else {
$isAll = 0;
}
$loc = strim($_REQUEST['loc']);
// 地区
$param['loc'] = $loc;
$GLOBALS['tmpl']->assign("p_loc", $loc);
$state = intval($_REQUEST['state']);
// 状态1
$param['state'] = $state;
$tag = strim($_REQUEST['tag']);
// 标签
$param['tag'] = $tag;
$GLOBALS['tmpl']->assign("p_tag", $tag);
$kw = strim($_REQUEST['key']);
// 关键词
$param['kw'] = $kw;
$cate_list = load_dynamic_cache("INDEX_CATE_LIST");
if (!$cate_list) {
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
}
$cate_result = array();
$cate_result[0]['id'] = '0';
$cate_result[0]['name'] = "全部";
foreach ($cate_list as $k => $v) {
$temp_param = $param;
$cate_result[$k + 1]['id'] = $v['id'];
$cate_result[$k + 1]['name'] = $v['name'];
$temp_param['id'] = $v['id'];
}
$root['cate_list'] = $cate_result;
$pid = 0;
// 获取父类id
if ($cate_list) {
foreach ($cate_list as $k => $v) {
if ($v['id'] == $id) {
if ($v['pid'] > 0) {
$pid = $v['pid'];
} else {
$pid = $id;
}
}
}
}
/* 子分类 start */
$cate_ids = array();
$is_has_child = false;
$temp_cate_ids = array();
if ($cate_list) {
$child_cate_result = array();
foreach ($cate_list as $k => $v) {
if ($v['pid'] == $pid) {
if ($v['pid'] > 0) {
$temp_param = $param;
$child_cate_result[$v['id']]['id'] = $v['id'];
$child_cate_result[$v['id']]['name'] = $v['name'];
$temp_param['id'] = $v['id'];
$child_cate_result[$v['id']]['url'] = url_mapi("deals", $temp_param);
if ($v['id'] == $id) {
$is_has_child = true;
}
}
}
if ($v['pid'] == $pid || $pid == 0) {
$temp_cate_ids[] = $v['id'];
}
}
}
// 假如选择了子类 那么使用子类ID 否则使用 父类和其子类
if ($is_has_child) {
$cate_ids[] = $id;
} else {
$cate_ids[] = $pid;
$cate_ids = array_merge($cate_ids, $temp_cate_ids);
}
$root['child_cate_list'] = $child_cate_result;
$root['pid'] = $pid;
/* 子分类 end */
$city_list = load_dynamic_cache("INDEX_CITY_LIST");
if (!$city_list) {
//.........这里部分代码省略.........
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:101,代码来源:deals.action.php
示例4: savesetting
public function savesetting()
{
if ($GLOBALS['user_info']['id'] > 0) {
$data['user_id'] = intval($GLOBALS['user_info']['id']);
$data['mail_asked'] = intval($_REQUEST['mail_asked']);
$data['sms_asked'] = intval($_REQUEST['sms_asked']);
$data['mail_bid'] = intval($_REQUEST['mail_bid']);
$data['sms_bid'] = intval($_REQUEST['sms_bid']);
$data['mail_myfail'] = intval($_REQUEST['mail_myfail']);
$data['sms_myfail'] = intval($_REQUEST['sms_myfail']);
$data['mail_half'] = intval($_REQUEST['mail_half']);
$data['sms_half'] = intval($_REQUEST['sms_half']);
$data['mail_bidsuccess'] = intval($_REQUEST['mail_bidsuccess']);
$data['sms_bidsuccess'] = intval($_REQUEST['sms_bidsuccess']);
$data['mail_fail'] = intval($_REQUEST['mail_fail']);
$data['sms_fail'] = intval($_REQUEST['sms_fail']);
$data['mail_bidrepaid'] = intval($_REQUEST['mail_bidrepaid']);
$data['sms_bidrepaid'] = intval($_REQUEST['sms_bidrepaid']);
$data['mail_answer'] = intval($_REQUEST['mail_answer']);
$data['sms_answer'] = intval($_REQUEST['sms_answer']);
$data['mail_transferfail'] = intval($_REQUEST['mail_transferfail']);
$data['sms_transferfail'] = intval($_REQUEST['sms_transferfail']);
$data['mail_transfer'] = intval($_REQUEST['mail_transfer']);
$data['sms_transfer'] = intval($_REQUEST['sms_transfer']);
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_conf where user_id = " . $data['user_id']) == 0) {
//添加
$GLOBALS['db']->autoExecute(DB_PREFIX . "msg_conf", $data, "INSERT");
} else {
//编辑
$GLOBALS['db']->autoExecute(DB_PREFIX . "msg_conf", $data, "UPDATE", "user_id=" . $data['user_id']);
}
$key = md5("USER_MSG_CONF_" . $data['user_id']);
//更新配置缓存
set_dynamic_cache($key, $data);
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS']);
} else {
app_redirect(url("index", "user#login"));
}
}
开发者ID:norain2050,项目名称:fanwei_xindai_3.2,代码行数:39,代码来源:uc_msgModule.class.php
示例5: url
function url($app_index, $route = "index", $param = array())
{
$key = md5("URL_KEY_" . $app_index . $route . serialize($param));
if ($GLOBALS['request']['from'] != "wap") {
if (isset($GLOBALS[$key])) {
$url = $GLOBALS[$key];
return $url;
}
$url = load_dynamic_cache($key);
if ($url !== false) {
$GLOBALS[$key] = $url;
return $url;
}
}
$route_array = explode("#", $route);
if (isset($param) && $param != '' && !is_array($param)) {
$param['id'] = $param;
}
$module = strtolower(trim($route_array[0]));
$action = strtolower(trim($route_array[1]));
if (!$module || $module == 'index') {
$module = "";
}
if (!$action || $action == 'index') {
$action = "";
}
if (app_conf("URL_MODEL") == 0 || $GLOBALS['request']['from'] == "wap") {
//过滤主要的应用url
if ($app_index == app_conf("MAIN_APP")) {
$app_index = "index";
}
//原始模式
$url = APP_ROOT . "/" . $app_index . ".php";
if ($module != '' || $action != '' || count($param) > 0) {
$url .= "?";
}
if ($module && $module != '') {
$url .= "ctl=" . $module . "&";
}
if ($action && $action != '') {
$url .= "act=" . $action . "&";
}
if (count($param) > 0) {
foreach ($param as $k => $v) {
if ($k && $v) {
$url = $url . $k . "=" . urlencode($v) . "&";
}
}
}
if (substr($url, -1, 1) == '&' || substr($url, -1, 1) == '?') {
$url = substr($url, 0, -1);
}
if ($GLOBALS['request']['from'] != "wap") {
$GLOBALS[$key] = $url;
set_dynamic_cache($key, $url);
}
return $url;
} else {
//重写的默认
$url = APP_ROOT;
if ($app_index != 'index') {
$url .= "/" . $app_index;
}
if ($module && $module != '') {
$url .= "/" . $module;
}
if ($action && $action != '') {
$url .= "-" . $action;
}
if (count($param) > 0) {
$url .= "/";
foreach ($param as $k => $v) {
$url = $url . $k . "-" . urlencode($v) . "-";
}
}
//过滤主要的应用url
if ($app_index == app_conf("MAIN_APP")) {
$url = str_replace("/" . app_conf("MAIN_APP"), "", $url);
}
$route = $module . "#" . $action;
switch ($route) {
case "xxx":
break;
default:
break;
}
if (substr($url, -1, 1) == '/' || substr($url, -1, 1) == '-') {
$url = substr($url, 0, -1);
}
if ($url == '') {
$url = "/";
}
$GLOBALS[$key] = $url;
set_dynamic_cache($key, $url);
return $url;
}
}
开发者ID:neteasy-work,项目名称:fanwei_xindai_3.2,代码行数:97,代码来源:common.php
示例6: index
public function index()
{
get_mortgate();
$GLOBALS['tmpl']->caching = true;
$cache_id = md5(MODULE_NAME . ACTION_NAME);
$image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
if ($image_list === false) {
$image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
}
$GLOBALS['tmpl']->assign("image_list", $image_list);
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete=0 order by sort asc");
$cate_result = array();
foreach ($cate_list as $k => $v) {
$cate_result[$v['id']] = $v;
}
$GLOBALS['tmpl']->assign("cate_list", $cate_result);
send_deal_success_1();
send_deal_fail_1();
//===============首页项目列表START===================
$page_size = 5;
$limit = "0,5";
$GLOBALS['tmpl']->assign("current_page", 1);
$deal_result = get_deal_list($limit, 'is_recommend=1');
$GLOBALS['tmpl']->assign("deal_list", $deal_result['list']);
$deal_invest_result = get_deal_list($limit, '');
$GLOBALS['tmpl']->assign("deal_list_invest", $deal_invest_result['list']);
$shu = $GLOBALS['db']->getAll("select count(*) from " . DB_PREFIX . "deal where is_recommend=1 and type=0");
$shu = $shu[0]['count(*)'];
$GLOBALS['tmpl']->assign("shu", $shu);
$all_shu = $GLOBALS['db']->getAll("select count(*) from " . DB_PREFIX . "deal where type=0");
$all_shu = $all_shu[0]['count(*)'];
$GLOBALS['tmpl']->assign("all_shu", $all_shu);
//===============首页项目列表END===================
//links
$g_links = get_link_by_id();
/*虚拟的累计项目总个数,支持总人数,项目支持总金额*/
if (app_conf("INVEST_STATUS") == 0) {
$condition = " and 1=1 ";
} elseif (app_conf("INVEST_STATUS") == 1) {
$condition = " and type=0 ";
} elseif (app_conf("INVEST_STATUS") == 2) {
$condition = " and type=1 ";
}
$virtual_effect = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
$virtual_person = $GLOBALS['db']->getOne("select sum((support_count+virtual_num)) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
$virtual_money = $GLOBALS['db']->getOne("select sum(support_amount+virtual_price) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 {$condition}");
$zhuce_num = $GLOBALS['db']->getOne("select count(*) as num from " . DB_PREFIX . "user where is_effect = 1");
$GLOBALS['tmpl']->assign("zhuce_num", $zhuce_num);
$virtual_effect = floor($virtual_effect * 2.3);
$GLOBALS['tmpl']->assign("virtual_effect", $virtual_effect);
//项目总个数
$virtual_person = floor($virtual_person * 2.7);
$GLOBALS['tmpl']->assign("virtual_person", $virtual_person);
//累计支持人
//$virtual_money = floor($virtual_money*2.1);
$GLOBALS['tmpl']->assign("virtual_money", number_format($virtual_money, 2));
//筹资总金额
/*虚拟的累计项目总个数,支持总人数,项目支持总金额 结束*/
//首页TAB选项卡
if (app_conf("INVEST_STATUS") == 0) {
$condition = " d.is_delete = 0 and d.is_effect = 1 ";
} elseif (app_conf("INVEST_STATUS") == 1) {
$condition = " d.is_delete = 0 and d.is_effect = 1 and d.type=0 ";
} elseif (app_conf("INVEST_STATUS") == 2) {
$condition = " d.is_delete = 0 and d.is_effect = 1 and d.type=1 ";
}
if ($GLOBALS['user_info']['user_level'] != 0) {
$level = $GLOBALS['db']->getOne("SELECT level from " . DB_PREFIX . "user_level where id=" . $GLOBALS['user_info']['user_level']);
$condition .= " AND (d.user_level ='' or d.user_level=0 or d.user_level <={$level}) ";
} else {
$condition .= " AND (d.user_level =0 or d.user_level =1 or d.user_level ='') AND d.is_recommend='1'";
}
//最后发起的项目,如果被设置为推荐,被选项卡显示
$deal_cate_array = $GLOBALS['db']->getAll("select d.* from (select * from " . DB_PREFIX . "deal order by sort asc) as d left join " . DB_PREFIX . "deal_cate as dc on dc.id=d.cate_id where {$condition} group by d.cate_id order by dc.sort asc ");
$deal_cate = array();
$now_time = NOW_TIME;
foreach ($deal_cate_array as $k => $v) {
if ($v['id'] > 0) {
$v['cate_name'] = $cate_result[$v['cate_id']]['name'];
$v['percent'] = round($v['support_amount'] / $v['limit_price'] * 100);
$v['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600));
$v['remain_days'] = ceil(($v['end_time'] - $now_time) / (24 * 3600));
if ($v['begin_time'] > $now_time) {
$v['left_days'] = intval(($now_time - $v['create_time']) / 24 / 3600);
}
$v['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600));
$deal_ids[] = $v['id'];
$deal_cate[$v['id']] = $v;
}
}
//将获取到的虚拟人数和虚拟价格拿到项目列表里面进行统计
foreach ($deal_cate as $k => $v) {
if ($v['type'] == 1) {
$deal_cate[$k]['virtual_person'] = $deal_cate[$k]['invote_num'];
$deal_cate[$k]['support_count'] = $deal_cate[$k]['invote_num'];
$deal_cate[$k]['support_amount'] = $deal_cate[$k]['invote_money'];
$deal_cate[$k]['percent'] = round($deal_cate[$k]['support_amount'] / $v['limit_price'] * 100);
} else {
$deal_cate[$k]['virtual_person'] = $deal_cate[$k]['virtual_num'];
//.........这里部分代码省略.........
开发者ID:xinlechou,项目名称:app,代码行数:101,代码来源:indexModule.class.php
示例7: parse_url_tag
function parse_url_tag($str)
{
$key = md5("URL_TAG_" . $str);
if (isset($GLOBALS[$key])) {
return $GLOBALS[$key];
}
$url = load_dynamic_cache($key);
if ($url !== false) {
$GLOBALS[$key] = $url;
return $url;
}
$str = substr($str, 2);
$str_array = explode("|", $str);
$app_index = $str_array[0];
$route = $str_array[1];
$param_tmp = explode("&", $str_array[2]);
$param = array();
foreach ($param_tmp as $item) {
if ($item != '') {
$item_arr = explode("=", $item);
}
if ($item_arr[0] && $item_arr[1]) {
$param[$item_arr[0]] = $item_arr[1];
}
}
$GLOBALS[$key] = url($app_index, $route, $param);
set_dynamic_cache($key, $GLOBALS[$key]);
return $GLOBALS[$key];
}
开发者ID:eliu03,项目名称:fanweP2P,代码行数:29,代码来源:common.php
示例8: region
public function region()
{
$city_list = load_dynamic_cache("INDEX_CITY_LIST");
if (!$city_list) {
$city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal group by province order by sort asc");
set_dynamic_cache("INDEX_CITY_LIST", $city_list);
}
foreach ($city_list as $k => $v) {
$temp_param = $param;
$temp_param['loc'] = $v['province'];
$city_list[$k]['url'] = url("deals", $temp_param);
}
$GLOBALS['tmpl']->assign("city_list", $city_list);
//============region_conf============
$area_list = $GLOBALS['db']->getAll("select rc.* from " . DB_PREFIX . "region_conf as rc where rc.name in (select province from " . DB_PREFIX . "deal) or rc.name in (select city from " . DB_PREFIX . "deal) or rc.is_hot=1 ");
$area = array();
$hot_area = array();
foreach ($area_list as $k => $v) {
$temp_param['loc'] = $v['name'];
$area[strtoupper($v['py'][0])][$v['name']] = array('url' => url("deals", $temp_param), 'name' => $v['name']);
if ($v['is_hot']) {
$hot_area[] = array('url' => url("deals", $temp_param), 'name' => $v['name']);
}
}
ksort($area);
$area_array = array();
$area_array = array_chunk(array_filter($area), 4, true);
$area_array_num = array();
foreach ($area_array as $k => $v) {
foreach ($v as $k1 => $v1) {
$area_array_str[$k] .= $k1;
}
}
$GLOBALS['tmpl']->assign("area_array", $area_array);
$GLOBALS['tmpl']->assign("area_array_str", $area_array_str);
$GLOBALS['tmpl']->assign("hot_area", array_filter($hot_area));
$GLOBALS['tmpl']->display("inc/region.html");
}
开发者ID:BruceJi,项目名称:fanwe,代码行数:38,代码来源:ajaxModule.class.php
示例9: deals
public function deals()
{
$r = strim($_REQUEST['r']);
//推荐类型
$id = intval($_REQUEST['id']);
//分类id
$loc = strim($_REQUEST['loc']);
//地区
$tag = strim($_REQUEST['tag']);
//标签
$kw = strim($_REQUEST['k']);
//关键词
$state = intval($_REQUEST['state']);
//状态
$step = intval($_REQUEST['step']);
$page_size = DEAL_PAGE_SIZE;
$step_size = DEAL_STEP_SIZE;
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
$condition = " is_delete = 0 and is_effect = 1 ";
if ($r != "") {
if ($r == "new") {
$condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 ";
//上线不超过一天
}
if ($r == "rec") {
$condition .= " and " . NOW_TIME . " <= end_time AND " . NOW_TIME . " >= begin_time and is_recommend = 1 ";
}
if ($r == "yure") {
$condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time < 0 ";
//上线不超过一天
}
if ($r == "nend") {
$condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 ";
//当天就要结束
}
if ($r == "classic") {
$condition .= " and is_classic = 1 ";
}
if ($r == "limit_price") {
$condition .= " and max(limit_price) ";
}
}
switch ($state) {
//筹资成功
case 1:
$condition .= " and end_time < " . NOW_TIME . " and support_amount >= limit_price";
$GLOBALS['tmpl']->assign("page_title", "筹资成功");
break;
//筹资失败
//筹资失败
case 2:
$condition .= " and end_time < " . NOW_TIME . " and support_amount < limit_price ";
$GLOBALS['tmpl']->assign("page_title", "筹资失败");
break;
//筹资中
//筹资中
case 3:
$condition .= " and end_time > " . NOW_TIME . " and begin_time < " . NOW_TIME . " ";
$GLOBALS['tmpl']->assign("page_title", "筹资中");
break;
}
$cate_list = load_dynamic_cache("INDEX_CATE_LIST");
if (!$cate_list) {
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
set_dynamic_cache("INDEX_CATE_LIST", $cate_list);
}
$cate_result = array();
$kk = 0;
foreach ($cate_list as $k => $v) {
if ($v['pid'] == 0) {
$temp_param = $param;
$cate_result[$k + 1]['id'] = $v['id'];
$cate_result[$k + 1]['name'] = $v['name'];
$temp_param['id'] = $v['id'];
$cate_result[$k + 1]['url'] = url("deals", $temp_param);
$kk++;
}
}
$GLOBALS['tmpl']->assign("cate_list", $cate_result);
$pid = 0;
//获取父类id
if ($cate_list) {
foreach ($cate_list as $k => $v) {
if ($v['id'] == $id) {
if ($v['pid'] > 0) {
$pid = $v['pid'];
} else {
$pid = $id;
}
}
}
}
/*子分类 start*/
//.........这里部分代码省略.........
开发者ID:xinlechou,项目名称:wap,代码行数:101,代码来源:ajax.action.php
示例10: index
public function index()
{
$r = strim($_REQUEST['r']);
//推荐类型
$GLOBALS['tmpl']->assign("p_r", $r);
$id = intval($_REQUEST['id']);
//分类id
$GLOBALS['tmpl']->assign("p_id", $id);
$loc = strim($_REQUEST['loc']);
//地区
$GLOBALS['tmpl']->assign("p_loc", $loc);
$tag = strim($_REQUEST['tag']);
//标签
$GLOBALS['tmpl']->assign("p_tag", $tag);
$kw = strim($_REQUEST['k']);
//关键词
$GLOBALS['tmpl']->assign("p_k", $kw);
if (intval($_REQUEST['redirect']) == 1) {
$param = array();
if ($r != "") {
$param = array_merge($param, array("r" => $r));
}
if ($id > 0) {
$param = array_merge($param, array("id" => $id));
}
if ($loc != "") {
$param = array_merge($param, array("loc" => $loc));
}
if ($tag != "") {
$param = array_merge($param, array("tag" => $tag));
}
if ($kw != "") {
$param = array_merge($param, array("k" => $kw));
}
app_redirect(url("deals", $param));
}
$image_list = load_dynamic_cache("INDEX_IMAGE_LIST");
if ($image_list === false) {
$image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc");
set_dynamic_cache("INDEX_IMAGE_LIST", $image_list);
}
$GLOBALS['tmpl']->assign("image_list", $image_list);
$cate_result = load_dynamic_cache("INDEX_CATE_LIST");
if ($cate_result === false) {
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
$cate_result = array();
foreach ($cate_list as $k => $v) {
$cate_result[$v['id']] = $v;
}
set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
}
$GLOBALS['tmpl']->assign("cate_list", $cate_result);
$page_size = DEAL_PAGE_SIZE;
$step_size = DEAL_STEP_SIZE;
$step = intval($_REQUEST['step']);
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
$GLOBALS['tmpl']->assign("current_page", $page);
$condition = " is_delete = 0 and is_effect = 1 ";
if ($r != "") {
if ($r == "new") {
$condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 ";
//上线不超过一天
$GLOBALS['tmpl']->assign("page_title", "最新上线");
}
if ($r == "nend") {
$condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 ";
//当天就要结束
$GLOBALS['tmpl']->assign("page_title", "即将结束");
}
if ($r == "classic") {
$condition .= " and is_classic = 1 ";
$GLOBALS['tmpl']->assign("page_title", "经典项目");
}
}
if ($id > 0) {
$condition .= " and cate_id = " . $id;
$GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']);
}
if ($loc != "") {
$condition .= " and (province = '" . $loc . "' or city = '" . $loc . "') ";
$GLOBALS['tmpl']->assign("page_title", $loc);
}
if ($tag != "") {
$unicode_tag = str_to_unicode_string($tag);
$condition .= " and match(tags_match) against('" . $unicode_tag . "' IN BOOLEAN MODE) ";
$GLOBALS['tmpl']->assign("page_title", $tag);
}
if ($kw != "") {
$kws_div = div_str($kw);
foreach ($kws_div as $k => $item) {
$kws[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kws);
//.........这里部分代码省略.........
开发者ID:xcdxcd,项目名称:zhongchou,代码行数:101,代码来源:dealsModule.class.php
示例11: search
//.........这里部分代码省略.........
}
$condition = " 1=1 ";
if ($type == 0) {
//所有分享
$condition .= "";
$search_title = $GLOBALS['lang']['TOPIC_TYPE_ALL'];
} elseif ($type == 1) {
$condition .= " and (t.type='tuancomment' or t.type='shopcomment' or t.type='youhuicomment' ) ";
$search_title = $GLOBALS['lang']['TOPIC_TYPE_DEAL'];
} elseif ($type == 2) {
$condition .= " and t.type='slocationcomment' ";
$search_title = $GLOBALS['lang']['TOPIC_TYPE_STORE'];
} elseif ($type == 3) {
$condition .= " and t.title like '" . $keyword . "' ";
$search_title = $GLOBALS['lang']['TOPIC_TYPE_RECOMMEND'];
}
if ($filter == 0) {
//全部
//$search_title.= " - ".$GLOBALS['lang']['TOPIC_FILTER_ALL'];
} elseif ($filter == 1) {
$search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MYFOCUS'];
$condition .= " and uf.focus_user_id = " . intval($GLOBALS['user_info']['id']);
} elseif ($filter == 2) {
$search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_DAREN'];
$condition .= " and u.is_daren = 1 ";
} elseif ($filter == 3) {
$search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MERCHANT'];
$condition .= " and u.is_merchant = 1 ";
}
if ($keyword) {
$search_title .= " - " . $keyword;
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kw);
$condition .= " and match(t.keyword_match) against('" . $ukeyword . "' IN BOOLEAN MODE) ";
}
$GLOBALS['tmpl']->assign("kws_div", $kws_div);
$GLOBALS['tmpl']->assign("page_title", $search_title);
$GLOBALS['tmpl']->assign("page_keyword", $search_title . ",");
$GLOBALS['tmpl']->assign("page_description", $search_title . ",");
//分页
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
// $result = get_topic_list($limit,$condition,"",$kws_div);
$orderby = 't.create_time desc';
$condition = " and " . $condition;
$list = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0 " . $condition . " group by t.id order by " . $orderby . " limit " . $limit);
$total = $GLOBALS['db']->getOne("select count(distinct(t.id)) from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0 " . $condition);
foreach ($list as $k => $v) {
$list[$k] = get_topic_item($v, $kws_div);
if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['content'])) {
$list[$k]['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50);
} else {
$list[$k]['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['content']);
}
if ($list[$k]['origin']) {
if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content'])) {
$list[$k]['origin']['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50);
} else {
$list[$k]['origin']['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['origin']['content']);
}
}
}
$result = array('list' => $list, 'total' => $total);
if ($result['total'] > 0) {
if (check_ipop_limit(get_client_ip(), "topic_search", 10, $keyword)) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic_tag set count = count + 1 where name = '" . $keyword . "'");
}
}
//$result['list'] = div_to_col($result['list']);
$GLOBALS['tmpl']->assign("topic_list", $result['list']);
$page = new Page($result['total'], app_conf("PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign('user_auth', get_user_auth());
$list_html = load_topic_list();
//$list_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/topic_col_list.html"));
$GLOBALS['tmpl']->assign("list_html", $list_html);
$GLOBALS['tmpl']->assign("type_navs", $type_navs);
$GLOBALS['tmpl']->assign("filter_navs", $filter_navs);
$res = load_dynamic_cache("topic_search_hot");
if ($res === false) {
$res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
$res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
set_dynamic_cache("topic_search_hot", $res);
}
//输出搜索热词
$GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
$GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
//输出推荐分享
$recommend_topic = load_auto_cache("recommend_uc_topic");
$GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
$GLOBALS['tmpl']->display("topic_search.html");
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:topicModule.class.php
示例12: set_uc_right
function set_uc_right()
{
//获取可以相关的用户
$user_id = intval($GLOBALS['user_info']['id']);
$user_list = get_rand_user(5, 0, $user_id);
$GLOBALS['tmpl']->assign("user_list", $user_list);
//输出粉丝
$fans_list = $GLOBALS['db']->getAll("select focus_user_id as id,focus_user_name as user_name from " . DB_PREFIX . "user_focus where focused_user_id = " . $user_id . " limit 5");
$ids = array(0);
foreach ($fans_list as $k => $v) {
$ids[] = $v['id'];
}
$focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
foreach ($fans_list as $k => $v) {
foreach ($focus_data as $kk => $vv) {
if ($vv['focused_user_id'] == $v['id']) {
$fans_list[$k]['focused'] = 1;
break;
}
}
}
$GLOBALS['tmpl']->assign("fans_list", $fans_list);
//输出我的关注
$focus_list = $GLOBALS['db']->getAll("select focused_user_id as id,focused_user_name as user_name from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " limit 5");
$ids = array(0);
foreach ($focus_list as $k => $v) {
$ids[] = $v['id'];
}
$focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
foreach ($focus_list as $k => $v) {
foreach ($focus_data as $kk => $vv) {
if ($vv['focused_user_id'] == $v['id']) {
$focus_list[$k]['focused'] = 1;
break;
}
}
}
$GLOBALS['tmpl']->assign("focus_list", $focus_list);
$res = load_dynamic_cache("topic_search_hot");
if ($res === false) {
$res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
$res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
set_dynamic_cache("topic_search_hot", $res);
}
//输出搜索热词
$GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
$GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
//输出推荐分享
$recommend_topic = load_auto_cache("recommend_uc_topic");
$GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
$GLOBALS['tmpl']->assign("has_right", 1);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:52,代码来源:uc.php
示例13: get_user_name
function get_user_name($id, $show_tag = true)
{
$key = md5("USER_NAME_LINK_" . $id);
if (isset($GLOBALS[$key])) {
return $GLOBALS[$key];
} else {
$uname = load_dynamic_cache($key);
if ($uname === false) {
$u = $GLOBALS['db']->getRow("select id,user_name,is_merchant,is_daren,daren_title from " . DB_PREFIX . "user where id = " . intval($id));
$uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' class='user_name' onmouseover='userCard.load(this,\"" . $u['id'] . "\");' >" . $u['user_name'] . "</a>";
if ($show_tag) {
$uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' onmouseover='userCard.load(this,\"" . $u['id'] . "\");'>" . msubstr($u['user_name'], 0, 5) . "</a>";
if ($u['is_merchant']) {
$uname = $uname . "<font class='is_merchant' title='认证商家'></font>";
}
if ($u['is_daren']) {
$uname = $uname . "<font class='is_daren' title='" . $u['daren_title'] . "'></font>";
}
} else {
$uname = "<a href='" . url("index", "uc_home", array("id" => $id)) . "' onmouseover='userCard.load(this,\"" . $u['id'] . "\");'>" . $u['user_name'] . "</a>";
}
set_dynamic_cache($key, $uname);
}
$GLOBALS[$key] = $uname;
return $GLOBALS[$key];
}
}
开发者ID:macall,项目名称:jsd,代码行数:27,代码来源:main_lib.php
示例14: invester_list
public function invester_list($from = 'wap')
{
$g_links = get_link_by_id(14);
$GLOBALS['tmpl']->assign("g_links", $g_links);
$GLOBALS['tmpl']->assign("page_title", "天使投资人列表");
$param = array();
//参数集合
//数据来
|
请发表评论