public function index() { if (strim($_REQUEST['type']) == 1 && app_conf("INVEST_STATUS") == 1) { showErr("股权众筹已经关闭"); } if (app_conf("INVEST_STATUS") == 2 && strim($_REQUEST['type']) == null) { showErr("产品众筹已经关闭"); } $GLOBALS['tmpl']->assign("page_title", "最新动态"); $param = array(); //参数集合 //数据来源参数 $r = strim($_REQUEST['r']); //推荐类型 $param['r'] = $r ? $r : ''; $GLOBALS['tmpl']->assign("p_r", $r); $id = intval($_REQUEST['id']); //分类id $param['id'] = $id; $GLOBALS['tmpl']->assign("p_id", $id); $loc = strim($_REQUEST['loc']); //地区 $param['loc'] = $loc; $GLOBALS['tmpl']->assign("p_loc", $loc); $state = intval($_REQUEST['state']); //状态 $param['state'] = $state; $GLOBALS['tmpl']->assign("p_state", $state); $tag = strim($_REQUEST['tag']); //标签 $param['tag'] = $tag; $GLOBALS['tmpl']->assign("p_tag", $tag); $kw = strim($_REQUEST['k']); //关键词 $param['k'] = $kw; $GLOBALS['tmpl']->assign("p_k", $kw); $type = intval($_REQUEST['type']); //推荐类型 $param['type'] = $type; $GLOBALS['tmpl']->assign("p_type", $type); $param_new = $param; //融资金额 $price = intval($_REQUEST['price']); if ($price > 0) { $param['price'] = $price; $GLOBALS['tmpl']->assign("price", $price); } //关注数 $focus = intval($_REQUEST['focus']); if ($focus > 0) { $param['focus'] = $focus; $GLOBALS['tmpl']->assign("focus", $focus); } //剩余时间 $time = intval($_REQUEST['time']); if ($time > 0) { $param['time'] = $time; $GLOBALS['tmpl']->assign("time", $time); } //完成比例 $cp = intval($_REQUEST['cp']); if ($cp > 0) { $param['cp'] = $cp; $GLOBALS['tmpl']->assign("cp", $cp); } if (intval($_REQUEST['redirect']) == 1) { app_redirect(url("deals", $param)); } $cate_list = load_dynamic_cache("INDEX_CATE_LIST"); if (!$cate_list) { $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete=0 order by sort asc"); set_dynamic_cache("INDEX_CATE_LIST", $cate_list); } $cate_result = array(); 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); } } $GLOBALS['tmpl']->assign("cate_list", $cate_result); $pid = $id; //获取父类id if ($cate_list) { $pid = $this->get_child($cate_list, $pid); } /*子分类 start*/ $cate_ids = array(); $is_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['id'] > 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("deals", $temp_param); if ($id == $v['id']) { $is_child = true; } } } if ($v['pid'] == $pid || $pid == 0) { $temp_cate_ids[] = $v['id']; } } } //假如选择了子类 那么使用子类ID 否则使用 父类和其子类 if ($is_child) { $cate_ids[] = $id; } else { $cate_ids[] = $pid; $cate_ids = array_merge($cate_ids, $temp_cate_ids); } $cate_ids = array_filter($cate_ids); $GLOBALS['tmpl']->assign("child_cate_list", $child_cate_result); $GLOBALS['tmpl']->assign("pid", $pid); /*子分类 end*/ $city_list = load_dynamic_cache("INDEX_CITY_LIST"); if ($type == 1) { if (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where type=1 and is_effect =1 group by province order by sort asc"); // set_dynamic_cache("INDEX_CITY_LIST",$city_list); } } if ($type == 0) { if (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where type=0 and is_effect =1 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)); //=================region_conf============== if ($type == 1) { $state_list = array(1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "融资中")); } else { $state_list = array(1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "筹资中")); } foreach ($state_list as $k => $v) { $temp_param = $param; $temp_param['state'] = $k; $state_list[$k]['url'] = url("deals", $temp_param); } $GLOBALS['tmpl']->assign("state_list", $state_list); $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 = " d.is_delete = 0 and d.is_effect = 1 "; if ($r != "") { if ($r == "new") { $condition .= " and " . NOW_TIME . " - d.begin_time < " . 7 * 24 * 3600 . " and " . NOW_TIME . " - d.begin_time > 0 "; //上线不超过一天 $GLOBALS['tmpl']->assign("page_title", "最新上线"); } elseif ($r == "rec") { $condition .= " and d.is_recommend = 1 "; $GLOBALS['tmpl']->assign("page_title", "推荐项目"); } elseif ($r == "yure") { $condition .= " and " . NOW_TIME . " < d.begin_time "; $GLOBALS['tmpl']->assign("page_title", "正在预热"); } elseif ($r == "nend") { $condition .= " and d.end_time - " . NOW_TIME . " < " . 7 * 24 * 3600 . " and d.end_time - " . NOW_TIME . " > 0 "; //三天就要结束 $GLOBALS['tmpl']->assign("page_title", "即将结束"); } elseif ($r == "classic") { $condition .= " and d.is_classic = 1 "; $GLOBALS['tmpl']->assign("page_title", "经典项目"); $GLOBALS['tmpl']->assign("is_classic", true); } elseif ($r == "limit_price") { $condition .= " and max(d.limit_price) "; $GLOBALS['tmpl']->assign("page_title", "最高目标金额"); } } switch ($state) { //筹资成功 case 1: $condition .= " and d.is_success=1 and d.end_time < " . NOW_TIME; $GLOBALS['tmpl']->assign("page_title", "筹资成功"); break; //筹资失败 //筹资失败 case 2: $condition .= " and d.end_time < " . NOW_TIME . " and d.end_time!=0 and d.is_success=0 "; $GLOBALS['tmpl']->assign("page_title", "筹资失败"); break; //筹资中 //筹资中 case 3: $condition .= " and (d.end_time > " . NOW_TIME . " or d.end_time=0 ) and d.begin_time < " . NOW_TIME . " "; $GLOBALS['tmpl']->assign("page_title", "筹资中"); break; } if (count($cate_ids) > 0) { $condition .= " and d.cate_id in (" . implode(",", $cate_ids) . ")"; $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']); } if ($loc != "") { $condition .= " and (d.province = '" . $loc . "' or d.city = '" . $loc . "') "; $GLOBALS['tmpl']->assign("page_title", $loc); } if ($type !== "") { $type = intval($type); $condition .= " and d.type={$type} "; $GLOBALS['tmpl']->assign("page_title", $loc); } if ($tag != "") { $unicode_tag = str_to_unicode_string($tag); $condition .= " and match(d.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); $condition .= " and (match(d.name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or match(d.tags_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or d.name like '%" . $kw . "%') "; $GLOBALS['tmpl']->assign("page_title", $kw); } // if($r=="new") // { // $orderby =" d.begin_time desc "; // } // elseif($r=="rec") // { // $orderby.=" d.begin_time desc "; // } // else // { // $orderby =" sort asc "; // } $temp_param_price = array_merge($param_new, array('price' => 1)); $temp_param_focus = array_merge($param_new, array('focus' => 1)); $temp_param_time = array_merge($param_new, array('time' => 1)); $temp_param_cp = array_merge($param_new, array('cp' => 1)); $url_list = array('price_url' => url("deals", $temp_param_price), 'focus_url' => url("deals", $temp_param_focus), 'time_url' => url("deals", $temp_param_time), 'cp_url' => url("deals", $temp_param_cp)); //======== if ($price > 0) { if ($price == 1) { if ($type == 1) { $orderby .= " d.invote_money desc"; } else { $orderby .= " (d.support_amount+d.virtual_price) desc"; } $param_new['price'] = 2; } elseif ($price == 2) { if ($type == 1) { $orderby .= " d.invote_money asc"; } else { $orderby .= " (d.support_amount+d.virtual_price) asc"; } $param_new['price'] = 1; } $url_list['price_url'] = url("deals", $param_new); } elseif ($focus > 0) { if ($focus == 1) { $orderby .= " d.focus_count desc"; $param_new['focus'] = 2; } elseif ($focus == 2) { $orderby .= " d.focus_count asc"; $param_new['focus'] = 1; } $url_list['focus_url'] = url("deals", $param_new); } elseif ($time > 0) { if ($time == 1) { $orderby .= " d.end_time desc"; $param_new['time'] = 2; } elseif ($time == 2) { $orderby .= " d.end_time asc"; $param_new['time'] = 1; } $url_list['time_url'] = url("deals", $param_new); } elseif ($cp > 0) { if ($cp == 1) { if ($type == 1) { $orderby .= " d.invote_money/d.limit_price desc"; } else { $orderby .= " (d.support_amount+d.virtual_price)/d.limit_price desc"; } $param_new['cp'] = 2; } else { if ($type == 1) { $orderby .= " d.invote_money/d.limit_price asc"; } else { $orderby .= " (d.support_amount+d.virtual_price)/d.limit_price asc"; } $param_new['cp'] = 1; } $url_list['cp_url'] = url("deals", $param_new); } else { $orderby = " d.begin_time desc "; } $GLOBALS['tmpl']->assign("url_list", $url_list); // if($r=="new") // { // $orderby =" d.begin_time desc "; // } // elseif($r=="rec") // { // $orderby.=" d.begin_time desc "; // } // else // { // $orderby =" sort asc "; // } // var_dump($limit); // var_dump($condition); // var_dump($orderby); $result = get_deal_list($limit, $condition, $orderby); if ($type == 1) { $GLOBALS['tmpl']->assign("deal_list_invest", $result['list']); } else { $GLOBALS['tmpl']->assign("deal_list", $result['list']); } $GLOBALS['tmpl']->assign("deal_count", $result['rs_count']); $page = new Page($result['rs_count'], $page_size); //初始化分页对象 $p = $page->para_show("deals#index", $param); $GLOBALS['tmpl']->assign('pages', $p); if ($type == 1) { $GLOBALS['tmpl']->assign('deal_type', 'gq_type'); } else { $GLOBALS['tmpl']->assign('deal_type', 'product_type'); } if ($GLOBALS['tmpl']->_var['page_title'] == '') { $page_title = ''; if ($type == 1) { foreach ($GLOBALS['nav_list'] as $k => $v) { if ($v['u_module'] == 'deals' && $v['u_action'] == 'index' && $v['u_param'] == 'type=1') { $page_title = $v['name']; } } $page_title = $page_title ? $page_title : '股权项目'; } else { foreach ($GLOBALS['nav_list'] as $k => $v) { if ($v['u_module'] == 'deals' && $v['u_action'] == 'index' && $v['u_param'] == '') { $page_title = $v['name']; } } $page_title = $page_title ? $page_title : '产品项目'; } $GLOBALS['tmpl']->assign("page_title", $page_title); } $GLOBALS['tmpl']->display("deals_index.html"); }
public function invester_list($from = 'web') { $GLOBALS['tmpl']->assign("page_title", "天使投资人列表"); $param = array(); //参数集合 get_user_lever_icon(8); //数据来源参数 $r = strim($_REQUEST['r']); //投资人类型 $r = $r ? $r : 'all'; $param['r'] = $r; $GLOBALS['tmpl']->assign("p_r", $r); $loc = strim($_REQUEST['loc']); //地区 $param['loc'] = $loc; $GLOBALS['tmpl']->assign("p_loc", $loc); $city = strim($_REQUEST['city']); //地区 $param['city'] = $city; $GLOBALS['tmpl']->assign("p_city", $city); if (intval($_REQUEST['redirect']) == 1) { $param = array(); if ($r != "") { $param = array_merge($param, array("r" => $r)); } if ($loc != "") { $param = array_merge($param, array("loc" => $loc)); } if ($city != "") { $param = array_merge($param, array("city" => $city)); } } $city_list = load_dynamic_cache("INDEX_CITY_LIST"); if (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "user group by province order by create_time desc"); set_dynamic_cache("INDEX_CITY_LIST", $city_list); } foreach ($city_list as $k => $v) { $temp_param = $param; unset($temp_param['city']); $temp_param['loc'] = $v['province']; if ($from == 'web') { $city_list[$k]['url'] = url("investor#invester_list", $temp_param); } elseif ($from == 'wap') { $city_list[$k]['url'] = url_wap("investor#invester_list", $temp_param); } } $GLOBALS['tmpl']->assign("city_list", $city_list); $next_pid = 0; $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 foreach ($region_lv2 as $k => $v) { $temp_param = $param; unset($temp_param['city']); $temp_param['loc'] = $v['name']; if ($from == 'web') { $region_lv2[$k]['url'] = url("investor#invester_list", $temp_param); } elseif ($from == 'wap') { $region_lv2[$k]['url'] = url_wap("investor#invester_list", $temp_param); } if ($loc == $v['name']) { $next_pid = $v['id']; } } $GLOBALS['tmpl']->assign("region_lv2", $region_lv2); if ($next_pid > 0) { $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 3 and `pid`='" . $next_pid . "' order by py asc"); //二级地址 foreach ($region_lv3 as $k => $v) { $temp_param = $param; $temp_param['city'] = $v['name']; if ($from == 'web') { $region_lv3[$k]['url'] = url("investor#invester_list", $temp_param); } elseif ($from == 'wap') { $region_lv3[$k]['url'] = url_wap("investor#invester_list", $temp_param); } } $GLOBALS['tmpl']->assign("region_lv3", $region_lv3); } // print_r($region_lv2);exit; $page_size = 8; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $GLOBALS['tmpl']->assign("current_page", $page); $condition = "is_effect = 1 "; if ($r != "") { if ($r == "all") { if (app_conf("AVERAGE_USER_STATUS") == 0 && INVEST_TYPE != 1) { if ($r == "all") { $condition .= " and (is_investor = 1 or is_investor = 2)"; } } $GLOBALS['tmpl']->assign("page_title", "全部"); } if ($r == "ordinary_user") { $condition .= " and is_investor = 0 "; $GLOBALS['tmpl']->assign("page_title", "普通用户"); } if ($r == "invester") { $condition .= " and is_investor = 1 "; $GLOBALS['tmpl']->assign("page_title", "投资人"); } if ($r == "institutions_invester") { $condition .= " and is_investor = 2 "; $GLOBALS['tmpl']->assign("page_title", "机构投资人"); } } if ($loc != "") { $condition .= " and (province = '" . $loc . "') "; $GLOBALS['tmpl']->assign("page_title", $loc); } if ($city != "") { $condition .= " and (province = '" . $loc . "' and city = '" . $city . "') "; $GLOBALS['tmpl']->assign("page_title", $city); } /*投资人列表*/ $invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where " . $condition . " order by create_time desc limit " . $limit); foreach ($invester_list as $k => $v) { $invester_list[$k]['image'] = get_user_avatar($v["id"], "middle"); //用户头像 $invester_list[$k]['user_icon'] = $GLOBALS['user_level'][$v['user_level']]['icon']; //用户等级图标 $invester_list[$k]['cate_name'] = unserialize($v["cate_name"]); //所在行业领域 } $invester_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where " . $condition); $GLOBALS['tmpl']->assign("invester_count", $invester_count); require APP_ROOT_PATH . 'app/Lib/page.php'; $page = new Page($invester_count, $page_size); //初始化分页对象 $p = $page->para_show("investor#invester_list", $param); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("invester_list", $invester_list); /*融资成功的项目*/ $deal_success_result = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_success = 1 and is_effect = 1 order by support_count desc "); $GLOBALS['tmpl']->assign("deal_success_list", $deal_success_result); /*星级投资人*/ $stars_invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by point desc "); foreach ($stars_invester_list as $k => $v) { $stars_invester_list[$k]['image'] = get_user_avatar($v["id"], "middle"); //用户头像 $stars_invester_list[$k]['user_icon'] = $GLOBALS['user_level'][$v['user_level']]['icon']; //用户等级图标 $stars_invester_list[$k]['cate_name'] = unserialize($v["cate_name"]); //所在行业领域 } $GLOBALS['tmpl']->assign("stars_invester_list", $stars_invester_list); /*最新投资人*/ $new_invester = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by update_time desc "); foreach ($new_invester as $kk => $vv) { $new_invester[$kk]['image'] = get_user_avatar($vv["id"], "middle"); //用户头像 $new_invester[$kk]['user_icon'] = $GLOBALS['user_level'][$vv['user_level']]['icon']; //用户等级图标 $new_invester[$kk]['cate_name'] = unserialize($vv["cate_name"]); //所在行业领域 } $GLOBALS['tmpl']->assign("new_invester", $new_invester); $GLOBALS['tmpl']->display("invester_list.html"); }
public function deals() { $filter_parms = array(); $filter_parms['type'] = $type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : 0; //起购金额 $filter_parms['money'] = $money = isset($_REQUEST['money']) ? intval($_REQUEST['money']) : 0; //年化收益 $filter_parms['rate'] = $rate = isset($_REQUEST['rate']) ? intval($_REQUEST['rate']) : 0; $filter_parms['sortby'] = $sortby = isset($_REQUEST['sortby']) ? strim($_REQUEST['sortby']) : ""; $filter_parms['descby'] = $descby = isset($_REQUEST['descby']) ? strtoupper(strim($_REQUEST['descby'])) : "DESC"; $page_size = 7; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $condition = " status = 1 "; if ($type != "") { $condition .= " AND `type` = {$type} "; } if ($money != 0) { switch ($money) { case 1: $condition .= " AND min_money <= 1000 "; break; case 2: $condition .= " AND min_money >= 1000 AND min_money <=10000 "; break; case 3: $condition .= " AND min_money >= 10000 AND min_money <=30000 "; break; case 4: $condition .= " AND min_money >= 30000 AND min_money <=50000 "; break; case 5: $condition .= " AND min_money >= 50000 AND min_money <=100000 "; break; case 6: $condition .= " AND min_money >= 100000 AND min_money <=150000 "; break; case 7: $condition .= " AND min_money >= 150000 AND min_money <=200000 "; break; case 8: $condition .= " AND min_money >= 200000 "; break; } } if ($rate != 0) { switch ($rate) { case 1: $condition .= " AND average_income_rate <= 4.5 "; break; case 2: $condition .= " AND average_income_rate between 4.5 AND 5.6 "; break; case 3: $condition .= " AND average_income_rate between 5.6 AND 6 "; break; case 4: $condition .= " AND average_income_rate between 6 AND 7 "; break; case 5: $condition .= " AND average_income_rate between 7 AND 8 "; break; case 6: $condition .= " AND average_income_rate between 8 AND 9 "; break; case 7: $condition .= " AND average_income_rate >= 9 "; break; } } $orderBy = "`sort` DESC,id DESC"; if ($sortby != "") { $orderBy = $sortby . " " . $descby . ", `sort` DESC,id DESC "; } $result = get_licai_list($condition, $orderBy, $limit); $GLOBALS['tmpl']->assign("list", $result['list']); $page = new Page($result['rs_count'], $page_size); //初始化分页对象 $p = $page->para_show("licai#deals", $filter_parms); $GLOBALS['tmpl']->assign('pages', $p); $money_arr = array("0" => "全部", "1" => "1000≤", "2" => "1000-1万元", "3" => "1-3万元", "4" => "3-5万元", "5" => "5-10万元", "6" => "10-15万元", "7" => "15-20万元", "8" => "≥20万元"); $money_url = array(); foreach ($money_arr as $k => $v) { $tmp_filter = $filter_parms; $tmp_filter['money'] = $k; $money_url[$k]['name'] = $v; $money_url[$k]['selected'] = $k == $money ? 1 : 0; $money_url[$k]['url'] = url("licai#deals", $tmp_filter); } $GLOBALS['tmpl']->assign('money_url', $money_url); $rate_arr = array("0" => "全部", "1" => "4.50%以下", "2" => "4.50%-5.60%", "3" => "5.60%-6.00%", "4" => "6.00%-7.00%", "5" => "7.00%-8.00%", "6" => "8.00%-9.00%", "7" => "9.00%以上"); $rate_url = array(); foreach ($rate_arr as $k => $v) { $tmp_filter = $filter_parms; $tmp_filter['rate'] = $k; $rate_url[$k]['name'] = $v; $rate_url[$k]['selected'] = $k == $rate ? 1 : 0; $rate_url[$k]['url'] = url("licai#deals", $tmp_filter); } $GLOBALS['tmpl']->assign('rate_url', $rate_url); $orderby_arr = array("0" => array("name" => "全部产品", "key" => ""), "1" => array("name" => "起购金额", "key" => "min_money"), "2" => array("name" => "年化利率", "key" => "average_income_rate"), "3" => array("name" => "成交总额", "key" => "subscribing_amount")); $orderby_url = array(); foreach ($orderby_arr as $k => $v) { $tmp_filter = $filter_parms; $tmp_filter['sortby'] = $v['key']; $orderby_url[$k]['key'] = $v['key']; $orderby_url[$k]['name'] = $v['name']; $orderby_url[$k]['selected'] = $v['key'] == $sortby ? 1 : 0; if ($orderby_url[$k]['selected'] == 1) { $tmp_filter['descby'] = $descby == "DESC" ? "ASC" : "DESC"; $orderby_url[$k]['descby'] = $descby; } else { $tmp_filter['descby'] = "DESC"; $orderby_url[$k]['descby'] = "DESC"; } $orderby_url[$k]['url'] = url("licai#deals", $tmp_filter); } $GLOBALS['tmpl']->assign('orderby_url', $orderby_url); $GLOBALS['tmpl']->assign('descby', $descby); $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); // 猜你喜欢 $hot_list = get_licai_list($condition, "sort DESC,subscribing_amount DESC", $limit); $GLOBALS['tmpl']->assign("hot_list", $hot_list['list']); $rectype_list = get_licai_list("re_type > 0 and status=1 and is_recommend = 1", "sort DESC,id DESC", 3); $GLOBALS['tmpl']->assign("rectype_list", $rectype_list['list']); //为客户创造收益 //$user_income = floatval($GLOBALS['db']->getOneCached("select sum(earn_money) from ".DB_PREFIX."user_log WHERE `type`=9 ")); $user_income = floatval($GLOBALS['db']->getOneCached("select sum(earn_money) from " . DB_PREFIX . "licai_redempte")); $GLOBALS['tmpl']->assign("user_income", $user_income); $GLOBALS['tmpl']->display("licai/licai_deals.html"); }