public function run() { $success = false; if (need_level() == false) { redirect(base_url() . "games/chose_level"); } $params["notice"] = get_notice(); $game_sessions = need_game(); if ($game_sessions != false) { $params['is_resume'] = 'true'; $this->htmllib->add_js('pages/game.js'); $this->load->view('plain/default_header'); $this->load->view("games/home", $params); $this->load->view('plain/default_footer'); // $this->load->view("games/run",$params); } else { if ($this->input->post("game_id") != "0") { $game_id = $this->input->post("game_id"); $game = $this->game->get_by_id($game_id); $success = true; } else { $data["user_id"] = $this->session->userdata("user_id"); $data["level_id"] = $this->session->userdata("level_id"); $success = true; $game_id = $this->game->insert($data); $game = $this->game->get_by_id($game_id); } $this->session->set_userdata("game_id", $game_id); $this->session->set_userdata("game", $game); // $this->load->view("games/run",$params); echo json_encode($success); } }
public function index() { global_run(); $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['city']['id']); if (!$GLOBALS['tmpl']->is_cached('mall.html', $cache_id)) { init_app_page(); //获取商城公告 $notice_list = get_notice(0, array(0, 2)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //输出首页推荐的分类 $index_cates = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_delete = 0 and is_effect = 1 and recommend = 1 and pid = 0 order by sort"); foreach ($index_cates as $k => $v) { $index_cates[$k]['deal_cate_type_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where pid = " . $v['id'] . " order by sort limit 8"); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_result = get_goods_list(8, array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id'], "cid" => $v['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.is_recommend = 1 "); $index_cates[$k]['deal_list'] = $deal_result['list']; } $GLOBALS['tmpl']->assign("index_cates", $index_cates); $GLOBALS['tmpl']->assign("drop_nav", "no_drop"); //首页下拉菜单不输出 $GLOBALS['tmpl']->assign("wrap_type", "1"); //首页宽屏展示 } $GLOBALS['tmpl']->display("mall.html", $cache_id); }
public function index() { $level_sessions = need_level(); $params["notice"] = get_notice(); $params["tebak_regresi"] = $this->tebak_regresi->get_or_create_by_game($this->game_sessions["game_id"]); $this->load->model('katalog_engine'); $params["engines"] = $this->katalog_engine->get_engines(); $params["margin_percentage"] = get_margin($level_sessions["level_id"]); $this->load->view('plain/default_header'); $this->load->view("quiz_regresi/index", $params); $this->load->view('plain/default_footer'); }
public function endgame($value = '') { // if (($level_session = need_level())){ // redirect(base_url()."games/start"); // } $params["notice"] = get_notice(); $params["levels"] = $this->level->where(); $params['user_name'] = $this->session->userdata("user_name"); $this->htmllib->add_js('pages/endgame.js'); $this->load->view('plain/default_header'); $this->load->view('endgame', $params); $this->load->view('plain/default_footer'); # code... }
public function index() { $level_sessions = need_level(); $params["notice"] = get_notice(); // var_dump($this->session->userdata("game_id")); // exit(); $params["question"] = $this->question->get_or_create_by_game($this->game_sessions["game_id"]); $params["answers"] = $this->answer->get_or_create_by_question($params["question"]->id); $params["margin_percentage"] = get_margin($level_sessions["level_id"]); $game = $this->question->where("game_id = '" . $this->game_sessions["game_id"] . "'"); $params["playing"] = count($game); $this->load->view('plain/default_header'); $this->load->view("quiz_cost/index", $params); $this->load->view('plain/default_footer'); }
public function index() { $data['title'] = 'Naval Game'; $params["notice"] = get_notice(); $params["tebak_regresi"] = $this->tebak_regresi->get_or_create_by_game($this->game_sessions["game_id"]); // if ($params["tebak_regresi"]->score != null) // { // $this->session->set_flashdata("notice", "permainan telah berakhir"); // redirect(base_url()."games/run"); // } $this->htmllib->add_js('pages/material_regresi.js'); $this->load->view('plain/default_header'); $this->load->view('material_regresi/home', $data); $this->load->view('plain/default_footer'); }
$oederbysql = ""; } !empty($_GET['type_id']) ? $wheresqlarr['n.type_id'] = intval($_GET['type_id']) : ''; if (is_array($wheresqlarr)) { $wheresql = wheresql($wheresqlarr); } if (!empty($_GET['settr'])) { $settr = strtotime("-" . intval($_GET['settr']) . " day"); $wheresql = empty($wheresql) ? " WHERE n.addtime> " . $settr : $wheresql . " AND n.addtime> " . $settr; } $joinsql = " LEFT JOIN " . table('notice_category') . " AS c ON n.type_id=c.id "; $total_sql = "SELECT COUNT(*) AS num FROM " . table('notice') . " AS n" . $joinsql . $wheresql; $page = new page(array('total' => $db->get_total($total_sql), 'perpage' => $perpage)); $currenpage = $page->nowindex; $offset = ($currenpage - 1) * $perpage; $notice = get_notice($offset, $perpage, $joinsql . $wheresql . $oederbysql); $smarty->assign('category', get_notice_category()); $smarty->assign('notice', $notice); $smarty->assign('page', $page->show(3)); $smarty->assign('navlabel', "list"); $smarty->display('notice/admin_notice.htm'); } elseif ($act == 'edit') { get_token(); check_permissions($_SESSION['admin_purview'], "notice_edit"); $smarty->assign('notice', get_notice_one($_GET['id'])); //读取指定ID的说明页 $smarty->assign('category', get_notice_category()); //获取分类 $smarty->display('notice/admin_notice_edit.htm'); } elseif ($act == 'editsave') { check_token();
public function index() { $field = es_cookie::get("shop_sort_field"); $field_sort = es_cookie::get("shop_sort_type"); require APP_ROOT_PATH . 'app/Lib/page.php'; $level_list = load_auto_cache("level"); $GLOBALS['tmpl']->assign("level_list", $level_list['list']); if (check_ipop_limit(get_client_ip(), "transfer_status", 10)) { syn_transfer_status(); } if (trim($_REQUEST['cid']) == "last") { $cate_id = "-1"; $page_title = $GLOBALS['lang']['LAST_SUCCESS_DEALS'] . " - "; } else { $cate_id = intval($_REQUEST['cid']); } if ($cate_id == 0) { $page_title = $GLOBALS['lang']['ALL_TRANSFER'] . " - "; } $keywords = trim(htmlspecialchars($_REQUEST['keywords'])); $GLOBALS['tmpl']->assign("keywords", $keywords); $level = intval($_REQUEST['level']); $GLOBALS['tmpl']->assign("level", $level); $interest = intval($_REQUEST['interest']); $GLOBALS['tmpl']->assign("interest", $interest); $months = intval($_REQUEST['months']); $GLOBALS['tmpl']->assign("months", $months); $months_type = intval($_REQUEST['months_type']); $GLOBALS['tmpl']->assign("months_type", $months_type); $lefttime = intval($_REQUEST['lefttime']); $GLOBALS['tmpl']->assign("lefttime", $lefttime); $city = intval($_REQUEST['city']); $GLOBALS['tmpl']->assign("city_id", $city); $scity = intval($_REQUEST['scity']); $GLOBALS['tmpl']->assign("scity_id", $scity); //输出分类 $deal_cates_db = load_auto_cache("cache_deal_cate"); $deal_cates = array(); foreach ($deal_cates_db as $k => $v) { if ($cate_id == $v['id']) { $v['current'] = 1; $page_title = $v['name'] . " - "; } $v['url'] = url("index", "transfer", array("cid" => $v['id'])); $deal_cates[] = $v; } unset($deal_cates_db); //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $page_args = array(); $sfield = ""; switch ($field) { case "borrow_amount": $sfield = "dlt.transfer_amount"; break; case "rate": $sfield = "d.rate"; break; case "repay_time": $sfield = "dlt.last_repay_time"; break; case "remain_time": $sfield = "dlt.near_repay_time"; break; default: $sfield = ""; } $condition = " AND dlt.status=1 "; if ($cate_id > 0) { $condition .= "AND d.deal_status >=4 and cate_id=" . $cate_id; if ($sfield && $field_sort) { $orderby = "{$sfield} {$field_sort} ,d.deal_status desc , d.sort DESC,d.id DESC"; } else { $orderby = "d.update_time DESC ,d.sort DESC,d.id DESC"; } } elseif ($cate_id == 0) { if ($sfield && $field_sort) { $orderby = "{$sfield} {$field_sort}, dlt.create_time DESC , dlt.id DESC "; } else { $orderby = " d.create_time DESC , dlt.id DESC"; } } elseif ($cate_id == "-1") { $condition .= "AND d.deal_status >=4 AND dlt.t_user_id > 0 "; $orderby = "dlt.transfer_time DESC,d.create_time DESC , dlt.id DESC"; } if ($keywords) { $kw_unicode = str_to_unicode_string($keywords); $condition .= " and (match(d.name_match,d.deal_cate_match,d.tag_match,d.type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))"; } if ($level > 0) { $point = $level_list['point'][$level]; $condition .= " AND d.user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})"; } if ($interest > 0) { $condition .= " AND d.rate >= " . $interest; } if ($months > 0) { if ($months == 12) { $condition .= " AND d.repay_time <= " . $months; } elseif ($months == 18) { $condition .= " AND d.repay_time >= " . $months; } } if ($months_type > 0) { if ($months_type == 1) { $condition .= " AND ((d.repay_time < 3 and d.repay_time_type = 1) or d.repay_time_type = 0) "; } else { if ($months_type == 2) { $condition .= " AND d.repay_time in (3,4,5) and d.repay_time_type = 1 "; } else { if ($months_type == 3) { $condition .= " AND d.repay_time in (6,7,8) and d.repay_time_type = 1 "; } else { if ($months_type == 4) { $condition .= " AND d.repay_time in (9,10,11) and d.repay_time_type = 1 "; } else { $condition .= " AND d.repay_time >= 12 and d.repay_time_type = 1 "; } } } } } if ($city > 0) { if ($scity > 0) { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $scity); } else { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $city); } $flatmap = array_map("array_pop", $dealid_list); $s2 = implode(',', $flatmap); $condition .= " AND id in (" . $s2 . ") "; } if ($lefttime > 0) { $condition .= " AND (d.next_repay_time + 24*3600 - 1 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600 . " AND dlt.t_user_id = 0 "; } if (es_cookie::get("shop_sort_field") == "ulevel") { $union_sql = ' LEFT join ' . DB_PREFIX . 'user u ON d.user_id = u.id '; $extfield = ",u.level_id "; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $result = get_transfer_list($limit, $condition, $extfield, $union_sql, $orderby); if ($result['rs_count'] > 0) { $page_args['cid'] = $cate_id; $page_args['keywords'] = $keywords; $page_args['level'] = $level; $page_args['interest'] = $interest; $page_args['months'] = $months; $page_args['lefttime'] = $lefttime; $page_args['months_type'] = $months_type; $page_args['city'] = $city; $page_pram = ""; foreach ($page_args as $k => $v) { $page_pram .= "&" . $k . "=" . $v; } $page = new Page($result['rs_count'], app_conf("DEAL_PAGE_SIZE"), $page_pram); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('transfer_list', $result['list']); } //分类 $cate_list_url = array(); $tmp_args = $page_args; $tmp_args['cid'] = 0; $cate_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $cate_list_url[0]['name'] = "不限"; $cate_list_url[0]['id'] = 0; foreach ($deal_cates as $k => $v) { $cate_list_url[$k + 1] = $v; $tmp_args = $page_args; $tmp_args['cid'] = $v['id']; $cate_list_url[$k + 1]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('cate_list_url', $cate_list_url); //利率 $interest_url = array(array("interest" => 0, "name" => "不限"), array("interest" => 10, "name" => "10%"), array("interest" => 12, "name" => "12%"), array("interest" => 15, "name" => "15%"), array("interest" => 18, "name" => "18")); foreach ($interest_url as $k => $v) { $tmp_args = $page_args; $tmp_args['interest'] = $v['interest']; $interest_url[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('interest_url', $interest_url); //几天内 $lefttime_url = array(array("lefttime" => 0, "name" => "不限"), array("lefttime" => 1, "name" => "1天"), array("lefttime" => 3, "name" => "3天"), array("lefttime" => 6, "name" => "6天"), array("lefttime" => 9, "name" => "9天"), array("lefttime" => 12, "name" => "12天")); foreach ($lefttime_url as $k => $v) { $tmp_args = $page_args; $tmp_args['lefttime'] = $v['lefttime']; $lefttime_url[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('lefttime_url', $lefttime_url); //借款期限 $months_type_url = array(array("name" => "不限"), array("name" => "3 个月以下"), array("name" => "3-6 个月"), array("name" => "6-9 个月"), array("name" => "9-12 个月"), array("name" => "12 个月以上")); foreach ($months_type_url as $k => $v) { $tmp_args = $page_args; $tmp_args['months_type'] = $k; $months_type_url[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('months_type_url', $months_type_url); //城市 $temp_city_urls = load_auto_cache("deal_city"); $city_urls[0]['id'] = 0; $city_urls[0]['name'] = "全部"; if (count($temp_city_urls) == 1) { $temp_city_urls = $temp_city_urls[key($temp_city_urls)]['child']; } $temp_city_urls = array_merge($city_urls, $temp_city_urls); $city_urls = array(); foreach ($temp_city_urls as $k => $v) { $city_urls[$v['id']] = $v; $tmp_args = $page_args; $tmp_args['city'] = $v['id']; $city_urls[$v['id']]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('city_urls', $city_urls); $sub_citys = $city_urls[$city]['child']; foreach ($sub_citys as $k => $v) { $tmp_args = $page_args; $tmp_args['city'] = $v['pid']; $tmp_args['scity'] = $v['id']; $sub_citys[$k]['url'] = url("index", "transfer#index", $tmp_args); } $GLOBALS['tmpl']->assign('sub_citys', $sub_citys); //使用技巧 $use_tech_list = get_article_list(4, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); //输出公告 $notice_list = get_notice(3); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //会员等级 $level_list_url = array(); $tmp_args = $page_args; $tmp_args['level'] = 0; $level_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $level_list_url[0]['name'] = "不限"; foreach ($level_list['list'] as $k => $v) { $tmp_args = $page_args; $tmp_args['level'] = $v['id']; $level_list_url[$k + 1] = $v; $level_list_url[$k + 1]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('level_list_url', $level_list_url); $GLOBALS['tmpl']->assign("page_title", $page_title . $GLOBALS['lang']['FINANCIAL_MANAGEMENT']); $GLOBALS['tmpl']->assign("cate_id", $cate_id); $GLOBALS['tmpl']->assign("cid", strim($_REQUEST['cid'])); $GLOBALS['tmpl']->assign("keywords", $keywords); $GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates); $GLOBALS['tmpl']->assign("field", $field); $GLOBALS['tmpl']->assign("field_sort", $field_sort); $GLOBALS['tmpl']->display("page/transfers.html"); }
public function index() { $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('mall.html', $cache_id)) { //输出商城分类 $cate_tree = get_cate_tree(0, 1); $top_count = 0; foreach ($cate_tree as $k => $v) { if ($v['level'] == 0) { $top_count++; } // if($top_count>6) // { // $cate_tree[$k]['is_hide'] = 1; // } } $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); //获取推荐 $hot_list = get_goods_list(intval(app_conf("REC_HOT_LIMIT")), 0, " is_hot = 1 and buy_type <> 1", "", false); $best_list = get_goods_list(intval(app_conf("REC_BEST_LIMIT")), 0, " is_best = 1 and buy_type <> 1 ", "", false); $new_list = get_goods_list(intval(app_conf("REC_NEW_LIMIT")), 0, " is_new = 1 and buy_type <> 1 ", "", false); $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['HOT_LIST'], 'list' => $hot_list['list'], 'url' => url("shop", "rec#rhot"))); $hot_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html"); $GLOBALS['tmpl']->assign("hot_span_goods_html", $hot_span_goods_html); $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['BEST_LIST'], 'list' => $best_list['list'], 'url' => url("shop", "rec#rbest"))); $best_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html"); $GLOBALS['tmpl']->assign("best_span_goods_html", $best_span_goods_html); $GLOBALS['tmpl']->assign("inc_var", array('title' => $GLOBALS['lang']['NEW_LIST'], 'list' => $new_list['list'], 'url' => url("shop", "rec#rnew"))); $new_span_goods_html = $GLOBALS['tmpl']->fetch("inc/span_goods.html"); $GLOBALS['tmpl']->assign("new_span_goods_html", $new_span_goods_html); $recommend_cate = $GLOBALS['db']->getAll("select id,name,uname from " . DB_PREFIX . "shop_cate where grade = 0 order by sort desc"); //输出分类商品 $recommend_cate_html = ""; foreach ($recommend_cate as $cate => $catev) { require_once APP_ROOT_PATH . "system/utils/child.php"; $ids_util = new child("shop_cate"); $ids = $ids_util->getChildIds($catev['id']); $ids[] = $catev['id']; $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand where shop_cate_id in (" . implode(",", $ids) . ") limit 8"); foreach ($brand_list as $kk => $brand_item) { $brand_list[$kk]['url'] = url("shop", "brand#index", array("id" => $brand_item['id'])); } //商城推荐分类列表 $time = get_gmtime(); $count_sql = "select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0 and p_shop_cate_id=" . $catev['id']; $sql = "select * from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0 and p_shop_cate_id=" . $catev['id']; $city = get_current_deal_city(); $city_id = $city['id']; if ($city_id > 0) { $ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id)); if ($ids) { $sql .= " and city_id in (" . implode(",", $ids) . ")"; $count_sql .= " and city_id in (" . implode(",", $ids) . ")"; } } $sql .= " and buy_type <> 1 "; $count_sql .= " and buy_type <> 1 "; $sql .= " order by sort desc limit 10 "; $deals = $GLOBALS['db']->getAll($sql); $deals_count = $GLOBALS['db']->getOne($count_sql); if ($deals) { foreach ($deals as $k => $deal) { if ($deal['buy_type'] == 1) { $module = "exchange"; } else { $module = "goods"; } if ($deal['uname'] != '') { $durl = url("shop", $module, array("id" => $deal['uname'])); } else { $durl = url("shop", $module, array("id" => $deal['id'])); } $deal['url'] = $durl; $deals[$k] = $deal; } } $cate_list = array('list' => $deals, 'count' => $deals_count); //$cate_list=$catev['id']; //$cate_list['sd'] = get_goods_list(intval(app_conf("REC_CATE_GOODS_LIMIT")),$catev['id']," buy_type <> 1 ","",false); $cate_title = $catev['name']; if ($catev['uname'] != "") { $curl = url("shop", "cate#index", array("id" => $catev['uname'])); } else { $curl = url("shop", "cate#index", array("id" => $catev['id'])); } $GLOBALS['tmpl']->assign("inc_var", array('id' => $catev['id'], 'brand_list' => $brand_list, 'title' => $cate_title, 'list' => $cate_list['list'], 'url' => $curl)); $recommend_cate_html .= $GLOBALS['tmpl']->fetch("inc/recommend_cate_goods.html"); } $GLOBALS['tmpl']->assign("recommend_cate_html", $recommend_cate_html); $GLOBALS['tmpl']->assign("page_title", app_conf("MALL_SHOP_TITLE")); $GLOBALS['tmpl']->assign("page_keyword", app_conf("MALL_SHOP_TITLE")); $GLOBALS['tmpl']->assign("page_description", app_conf("MALL_SHOP_TITLE")); //输出商城公告 $notice_list = get_notice(0, array(0, 2)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); } $GLOBALS['tmpl']->display("mall.html", $cache_id); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['deal_city']['id']); if (!$GLOBALS['tmpl']->is_cached('index.html', $cache_id)) { //输出商城分类 $cate_tree = get_cate_tree(0, 1); $GLOBALS['tmpl']->assign("cate_tree", $cate_tree); make_deal_cate_js(); make_deal_region_js(); $result = load_auto_cache("store_filter_nav_cache", array('city_id' => $GLOBALS['deal_city']['id'])); $GLOBALS['tmpl']->assign("cate_list", $result['cate_list']); $GLOBALS['tmpl']->assign("area_list", $result['area_list']); //获取推荐品牌 $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "brand order by sort limit 24"); $GLOBALS['tmpl']->assign("brand_list", $brand_list); //输出公告 $notice_list = get_notice(0, array(0, 1)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); /** //获取推荐的大分类 $bcate_list = load_dynamic_cache("INDEX_RECOMMEND_BCATE"); if($bcate_list===false) { $bcate_list = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."deal_cate where is_effect = 1 and is_delete = 0 and recommend = 1 order by sort desc limit 8"); set_dynamic_cache("INDEX_RECOMMEND_BCATE",$bcate_list); } * **/ $city_id = $GLOBALS['deal_city']['id']; $shop_cates = $GLOBALS['db']->getAll("select * from tb_shop_cate where grade = 0 and recommend=1 and is_delete=0 order by sort desc"); if (!empty($shop_cates)) { foreach ($shop_cates as $index => $shop_cate) { $shop_cates[$index]['goods'] = $GLOBALS['db']->getAll("select * from tb_deal where city_id = {$city_id} and is_effect = 1 and is_delete = 0 and p_shop_cate_id = " . $shop_cate['id'] . " order by sort limit 10"); $shop_cates[$index]['sub_cates'] = $GLOBALS['db']->getAll("select * from tb_shop_cate where is_effect = 1 and is_delete = 0 and pid= " . $shop_cate['id'] . " order by sort desc limit 8"); $shop_cates[$index]['index'] = $index + 1; } $GLOBALS['tmpl']->assign("shop_cates", $shop_cates); } //输出精品商圈广告位 $sql = "select adv_id from " . DB_PREFIX . "adv where adv_id like '精品商圈广告位%'"; $adv_list = $GLOBALS['db']->getAll($sql); $GLOBALS['tmpl']->assign("adv_list", $adv_list); $city_ids = load_auto_cache("deal_city_belone_ids", array("city_id" => intval($GLOBALS['deal_city']['id']))); if ($city_ids) { $store_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "supplier_location use index (search_idx1, is_verify) WHERE is_recommend=1 AND city_id in(" . implode(",", $city_ids) . ") and is_effect = 1 order by is_verify desc,sort desc limit 0," . app_conf("INDEX_SUPPLIER_COUNT")); } else { $store_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "supplier_location use index (search_idx1, is_verify) WHERE is_recommend=1 AND is_effect = 1 order by is_verify desc,sort desc limit 0," . app_conf("INDEX_SUPPLIER_COUNT")); } $bcate_list = load_dynamic_cache("INDEX_RECOMMEND_BCATE"); $GLOBALS['tmpl']->assign("bcate_list", $bcate_list); $GLOBALS['tmpl']->assign("store_list", $store_list); $f_link_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link_group where is_effect = 1 order by sort desc"); foreach ($f_link_group as $k => $v) { $g_links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 and group_id = " . $v['id'] . " order by sort desc"); if ($g_links) { foreach ($g_links as $kk => $vv) { if (substr($vv['url'], 0, 7) == 'http://') { $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']); } } $f_link_group[$k]['links'] = $g_links; } else { unset($f_link_group[$k]); } } $now = get_gmtime(); $vote = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote where is_effect = 1 and begin_time < " . $now . " and (end_time = 0 or end_time > " . $now . ") order by sort desc limit 1"); $GLOBALS['tmpl']->assign("vote", $vote); $GLOBALS['tmpl']->assign("f_link_data", $f_link_group); } $GLOBALS['tmpl']->display("index.html", $cache_id); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME); if (!$GLOBALS['tmpl']->is_cached("page/index.html", $cache_id)) { make_deal_cate_js(); make_delivery_region_js(); change_deal_status(); //借款预告列表 $advance_deal_list = get_deal_list(5, 0, "publish_wait =0 AND deal_status =1 AND is_advance=1 AND start_time >" . TIME_UTC, " deal_status ASC, is_recommend DESC,sort DESC,id DESC"); $GLOBALS['tmpl']->assign("advance_deal_list", $advance_deal_list['list']); //最新借款列表 $deal_list = get_deal_list(11, 0, "publish_wait =0 AND deal_status in(1,2,4) AND start_time <=" . TIME_UTC, " deal_status ASC, is_recommend DESC,sort DESC,id DESC"); $GLOBALS['tmpl']->assign("deal_list", $deal_list['list']); //输出最新转让 $transfer_list = get_transfer_list(11, " and d.deal_status >= 4 ", '', '', " d.create_time DESC , dlt.id DESC "); $GLOBALS['tmpl']->assign('transfer_list', $transfer_list['list']); //输出公告 $notice_list = get_notice(0); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //输出公司动态 $art_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "article_cate where title='公司动态'"); if ($art_id > 0) { $compnay_active_list = get_article_list(5, $art_id); $GLOBALS['tmpl']->assign("art_id", $art_id); $GLOBALS['tmpl']->assign("compnay_active_list", $compnay_active_list['list']); } //输出媒体报道 $mtbd_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "article_cate where title='媒体报道'"); if ($mtbd_id > 0) { $mtbd_list = get_article_list(5, $mtbd_id); foreach ($mtbd_list['list'] as $k => $v) { $mtbd_list['list'][$k]['contents'] = msubstr($mtbd_list['list'][$k]['content'], 0, 25); } $GLOBALS['tmpl']->assign("mtbd_id", $mtbd_id); $GLOBALS['tmpl']->assign("mtbd_list", $mtbd_list['list']); } //投资排行 //天 $now_time = to_timespan(to_date(TIME_UTC, "Y-m-d"), "Y-m-d"); $day_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $now_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 10"); //周 $week_time = to_timespan(to_date(TIME_UTC - to_date(TIME_UTC, "w") * 24 * 3600, "Y-m-d"), "Y-m-d"); $week_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $week_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 10 "); //月 $month_time = to_timespan(to_date(TIME_UTC, "Y-m") . "-01", "Y-m-d"); $month_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $month_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 10"); $GLOBALS['tmpl']->assign("day_load_top_list", $day_load_top_list); $GLOBALS['tmpl']->assign("week_load_top_list", $week_load_top_list); $GLOBALS['tmpl']->assign("month_load_top_list", $month_load_top_list); //收益排名 $load_repay_list = $GLOBALS['db']->getAll("SELECT us.*,u.user_name FROM " . DB_PREFIX . "user_sta us LEFT JOIN " . DB_PREFIX . "user u ON us.user_id=u.id WHERE u.is_effect =1 and u.is_delete=0 and us.load_earnings > 0 ORDER BY us.load_earnings DESC LIMIT 5"); $GLOBALS['tmpl']->assign("load_repay_list", $load_repay_list); //使用技巧 $use_tech_list = get_article_list(12, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); $now = TIME_UTC; $vote = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote where is_effect = 1 and begin_time < " . $now . " and (end_time = 0 or end_time > " . $now . ") order by sort desc limit 1"); $GLOBALS['tmpl']->assign("vote", $vote); //累计投资金额 $stats['total_load'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load where is_repay= 0 "); $stats['total_load_format'] = format_conf_count(number_format($stats['total_load'], 2)); //成交笔数 $stats['deal_total_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal where deal_status >=4 "); //累计创造收益 $stats['total_rate'] = $GLOBALS['db']->getOne("SELECT sum(true_interest_money + impose_money + true_reward_money - true_manage_money - true_manage_interest_money) FROM " . DB_PREFIX . "deal_load_repay where has_repay = 1 "); $stats['total_rate'] += $GLOBALS['db']->getOne("SELECT sum(rebate_money) FROM " . DB_PREFIX . "deal_load where is_has_loans = 1 "); //加上返利 $stats['total_rate'] -= $GLOBALS['db']->getOne("SELECT sum(fee_amount) FROM " . DB_PREFIX . "payment_notice WHERE is_paid =1 "); //减去充值手续费 $stats['total_rate'] -= $GLOBALS['db']->getOne("SELECT sum(fee) FROM " . DB_PREFIX . "user_carry WHERE status =1 "); //减去提现手续费 $stats['total_rate'] += $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "referrals WHERE pay_time >0 "); //加上邀请返利 $stats['total_rate_format'] = format_conf_count(number_format($stats['total_rate'], 2)); //本息保证金(元) $stats['total_bzh'] = $GLOBALS['db']->getOne("SELECT sum(guarantor_real_freezen_amt+real_freezen_amt) FROM " . DB_PREFIX . "deal where deal_status= 4 "); $stats['total_bzh_format'] = format_conf_count(number_format($stats['total_bzh'], 2)); //待收资金(元) $stats['total_repay'] = $GLOBALS['db']->getOne("SELECT sum(repay_money) FROM " . DB_PREFIX . "deal_load_repay where has_repay = 1 "); $stats['total_repay_format'] = format_conf_count(number_format($stats['total_repay'], 2)); //待投资金(元) $statsU = $GLOBALS['db']->getRow("SELECT sum(money) as total_usermoney ,count(*) total_user FROM " . DB_PREFIX . "user where is_effect = 1 and is_delete=0 "); $stats['total_usermoney'] = $statsU['total_usermoney']; $stats['total_usermoney_format'] = format_conf_count(number_format($stats['total_usermoney'], 2)); $stats['total_user'] = $statsU['total_user']; $GLOBALS['tmpl']->assign("stats", $stats); //格式化统计代码 $VIRTUAL_MONEY_1_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_1"))) + $stats['total_load']); $VIRTUAL_MONEY_2_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_2"))) + $stats['total_rate']); $VIRTUAL_MONEY_3_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_3"))) + $stats['total_bzh']); $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_1_FORMAT", $VIRTUAL_MONEY_1_FORMAT); $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_2_FORMAT", $VIRTUAL_MONEY_2_FORMAT); $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_3_FORMAT", $VIRTUAL_MONEY_3_FORMAT); $GLOBALS['tmpl']->assign("show_site_titile", 1); } $GLOBALS['tmpl']->display("page/index.html", $cache_id); }
$table->tablealign = 'left'; $table->summary = get_string('filters:tablesummary', 'block_facetoface'); echo html_writer::start_tag('form', array('method' => 'get', 'action' => 'calendar.php')); echo $OUTPUT->box_start('generalbox calendarfilters'); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'tab', 'value' => $currenttab)); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cal_d', 'value' => $day)); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cal_m', 'value' => $month)); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cal_y', 'value' => $year)); echo html_writer::table($table); echo $OUTPUT->box_end(); echo html_writer::end_tag('form'); } // Important notices. if ($notice = get_notice($activefilters['customfields'])) { echo $OUTPUT->box_start(); echo format_text($notice, FORMAT_HTML); echo $OUTPUT->box_end(); } // Display settings $courses = true; // display all courses $groups = false; // don't show group events $users = $USER->id; // show current user events $courseid = SITEID; $displayinfo = get_display_info($day, $month, $year); get_sessions($displayinfo, $groups, $users, $courses, $activefilters, $events, $sessionids); $waitlistedsessions = get_matching_waitlisted_sessions($activefilters);
<?php include 'front.php'; $doing = empty($_GET['doing']) ? '' : trim($_GET['doing']); if ($doing == '') { $smarty = new smarty(); smarty_front(); get_nav(); get_news(); get_notice(); get_new_message(); $smarty->display('message.html'); } if ($doing == 'message_active') { $message_name = empty($_POST['user_name']) ? '' : trim(addslashes($_POST['user_name'])); $message_mail = empty($_POST['user_mail']) ? '' : trim(addslashes($_POST['user_mail'])); $message_content = empty($_POST['message_content']) ? '' : trim(addslashes($_POST['message_content'])); $message_yzm = empty($_POST['image_yzm']) ? '' : trim($_POST['image_yzm']); if (empty($message_name)) { message(array('text' => $language['message_name_null'], 'link' => '')); } if (empty($message_mail)) { message(array('text' => $language['message_mail_null'], 'link' => '')); } if (empty($message_content)) { message(array('text' => $language['message_content_null'], 'link' => '')); } if (empty($message_yzm)) { message(array('text' => $language['message_yzm_null'], 'link' => '')); } if ($message_yzm != @$_SESSION['vcode']) {
public function index() { global_run(); $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME . $GLOBALS['city']['id']); if (!$GLOBALS['tmpl']->is_cached('index.html', $cache_id)) { init_app_page(); $GLOBALS['tmpl']->assign("drop_nav", "no_drop"); //首页下拉菜单不输出 $GLOBALS['tmpl']->assign("wrap_type", "1"); //首页宽屏展示 //获取首页公告 $notice_list = get_notice(0, array(0, 1)); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //获取热门团购分类 $tuan_cate = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 order by sort asc"); foreach ($tuan_cate as $k => $v) { $tuan_cate[$k]['url'] = url("index", "tuan", array("cid" => $v['id'])); } $GLOBALS['tmpl']->assign("tuan_cate", $tuan_cate); //输出热门团购标签 $tuan_tag = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate_type as dct left join " . DB_PREFIX . "deal_cate_type_link as dctl on dct.id = dctl.deal_cate_type_id order by dct.sort limit 15"); foreach ($tuan_tag as $k => $v) { $tuan_tag[$k]['url'] = url("index", "tuan", array("cid" => $v['cate_id'], "tid" => $v['id'])); } $GLOBALS['tmpl']->assign("tuan_tag", $tuan_tag); //输出团购地区 $tuan_area = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id = " . intval($GLOBALS['city']['id']) . " and pid > 0 order by sort limit 50"); foreach ($tuan_area as $k => $v) { $tuan_area[$k]['url'] = url("index", "tuan", array("aid" => $v['pid'], "qid" => $v['id'])); } $GLOBALS['tmpl']->assign("tuan_area", $tuan_area); //输出首页推荐的分类 $index_cates = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 and rec_youhui = 1 order by sort"); foreach ($index_cates as $k => $v) { $index_cates[$k]['deal_cate_type_list'] = $GLOBALS['db']->getAll("select dct.* from " . DB_PREFIX . "deal_cate_type as dct left join " . DB_PREFIX . "deal_cate_type_link as dctl on dct.id = dctl.deal_cate_type_id where dctl.cate_id = " . $v['id'] . " and dct.is_recommend = 1 order by dct.sort"); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_result = get_deal_list(8, array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id'], "cid" => $v['id']), "", " d.buy_type <> 1 and d.is_shop = 0 and d.is_recommend = 1 "); $index_cates[$k]['deal_list'] = $deal_result['list']; } $GLOBALS['tmpl']->assign("index_cates", $index_cates); //输出首页商城推荐分类 $index_mall_cates = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_delete = 0 and is_effect = 1 and recommend = 1 and pid = 0 order by sort"); foreach ($index_mall_cates as $k => $v) { $index_mall_cates[$k]['deal_cate_type_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where pid = " . $v['id'] . " order by sort limit 8"); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_result = get_goods_list(8, array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id'], "cid" => $v['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.is_recommend = 1 "); $index_mall_cates[$k]['deal_list'] = $deal_result['list']; } $GLOBALS['tmpl']->assign("index_mall_cates", $index_mall_cates); //输出推荐门店 require_once APP_ROOT_PATH . "system/model/supplier.php"; $store_result = get_location_list(app_conf("INDEX_SUPPLIER_COUNT"), array("city_id" => intval($GLOBALS['city']['id'])), "", " is_recommend=1 AND is_effect = 1 ", " is_verify desc,sort desc "); $GLOBALS['tmpl']->assign("store_list", $store_result['list']); //输出首页推荐的优惠券 require_once APP_ROOT_PATH . "system/model/youhui.php"; $youhui_result = get_youhui_list(20, array(YOUHUI_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", "y.is_recommend = 1"); $GLOBALS['tmpl']->assign("youhui_list", $youhui_result['list']); //输出友情链接 $links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 order by sort desc"); foreach ($links as $kk => $vv) { if (substr($vv['url'], 0, 7) == 'http://') { $links[$kk]['url'] = str_replace("http://", "", $vv['url']); } } $GLOBALS['tmpl']->assign("links", $links); } $GLOBALS['tmpl']->display("index.html", $cache_id); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 60; //首页缓存10分钟 $field = es_cookie::get("shop_sort_field"); $field_sort = es_cookie::get("shop_sort_type"); $cache_id = md5(MODULE_NAME . ACTION_NAME . implode(",", $_REQUEST) . $field . $field_sort); if (!$GLOBALS['tmpl']->is_cached("page/deals.html", $cache_id)) { require APP_ROOT_PATH . 'app/Lib/page.php'; $level_list = load_auto_cache("level"); $GLOBALS['tmpl']->assign("level_list", $level_list['list']); if (trim($_REQUEST['cid']) == "last") { $cate_id = "-1"; $page_title = $GLOBALS['lang']['LAST_SUCCESS_DEALS'] . " - "; } else { $cate_id = intval($_REQUEST['cid']); } if ($cate_id == 0) { $page_title = $GLOBALS['lang']['ALL_DEALS'] . " - "; } $keywords = trim(htmlspecialchars($_REQUEST['keywords'])); $GLOBALS['tmpl']->assign("keywords", $keywords); $level = intval($_REQUEST['level']); $GLOBALS['tmpl']->assign("level", $level); $interest = intval($_REQUEST['interest']); $GLOBALS['tmpl']->assign("interest", $interest); $months = intval($_REQUEST['months']); $GLOBALS['tmpl']->assign("months", $months); $lefttime = intval($_REQUEST['lefttime']); $GLOBALS['tmpl']->assign("lefttime", $lefttime); $months_type = intval($_REQUEST['months_type']); $GLOBALS['tmpl']->assign("months_type", $months_type); $deal_status = intval($_REQUEST['deal_status']); $GLOBALS['tmpl']->assign("deal_status", $deal_status); $cates = intval($_REQUEST['cates']); $GLOBALS['tmpl']->assign("cates", $cates); $city = intval($_REQUEST['city']); $GLOBALS['tmpl']->assign("city_id", $city); $scity = intval($_REQUEST['scity']); $GLOBALS['tmpl']->assign("scity_id", $scity); //输出分类 $deal_cates_db = load_auto_cache("cache_deal_cate"); $deal_cates = array(); foreach ($deal_cates_db as $k => $v) { if ($cate_id == $v['id']) { $v['current'] = 1; $page_title = $v['name'] . " - "; } $v['url'] = url("index", "deals", array("cid" => $v['id'])); $deal_cates[] = $v; } unset($deal_cates_db); //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $n_cate_id = 0; $condition = " publish_wait = 0 and is_hidden = 0 "; $orderby = ""; if ($cate_id > 0) { $n_cate_id = $cate_id; if ($field && $field_sort) { $orderby = "{$field} {$field_sort} ,deal_status desc , sort DESC,id DESC"; } else { $orderby = "sort DESC,id DESC"; } $total_money = $GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE cate_id={$cate_id} AND deal_status in(4,5) AND is_effect = 1 and is_delete = 0 "); } elseif ($cate_id == 0) { $n_cate_id = 0; if ($field && $field_sort) { $orderby = "{$field} {$field_sort} ,sort DESC,id DESC"; } else { $orderby = "sort DESC , id DESC"; } $total_money = $GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal WHERE deal_status in(4,5) AND is_effect = 1 and is_delete = 0"); } elseif ($cate_id == "-1") { $n_cate_id = 0; $condition .= "AND deal_status in(2,4,5) "; $orderby = "deal_status ASC,success_time DESC,sort DESC,id DESC"; } if ($keywords) { $kw_unicode = str_to_unicode_string($keywords); $condition .= " and (match(name_match,deal_cate_match,tag_match,type_match) against('" . $kw_unicode . "' IN BOOLEAN MODE))"; } if ($level > 0) { $point = $level_list['point'][$level]; $condition .= " AND user_id in(SELECT u.id FROM " . DB_PREFIX . "user u LEFT JOIN " . DB_PREFIX . "user_level ul ON ul.id=u.level_id WHERE ul.point >= {$point})"; } if ($interest > 0) { $condition .= " AND rate >= " . $interest; } if ($months > 0) { if ($months == 12) { $condition .= " AND repay_time <= " . $months; } elseif ($months == 18) { $condition .= " AND repay_time >= " . $months; } } if ($lefttime > 0) { $condition .= " AND (start_time + enddate*24*3600 - " . TIME_UTC . ") <= " . $lefttime * 24 * 3600; } if ($deal_status == 19) { $condition .= " AND deal_status = 1 AND start_time > " . TIME_UTC . " "; } elseif ($deal_status > 0) { $condition .= " AND deal_status = " . $deal_status . " AND start_time <= " . TIME_UTC . " "; } if ($months_type > 0) { if ($months_type == 1) { $condition .= " AND ((repay_time < 3 and repay_time_type = 1) or repay_time_type = 0) "; } else { if ($months_type == 2) { $condition .= " AND repay_time in (3,4,5) and repay_time_type = 1 "; } else { if ($months_type == 3) { $condition .= " AND repay_time in (6,7,8) and repay_time_type = 1 "; } else { if ($months_type == 4) { $condition .= " AND repay_time in (9,10,11) and repay_time_type = 1 "; } else { $condition .= " AND repay_time >= 12 and repay_time_type = 1 "; } } } } } if ($city > 0) { if ($scity > 0) { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $scity); } else { $dealid_list = $GLOBALS['db']->getAll("SELECT deal_id FROM " . DB_PREFIX . "deal_city_link where city_id = " . $city); } $flatmap = array_map("array_pop", $dealid_list); $s2 = implode(',', $flatmap); $condition .= " AND id in (" . $s2 . ") "; } //使用技巧 $use_tech_list = get_article_list(4, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); $result = get_deal_list($limit, $n_cate_id, $condition, $orderby); $GLOBALS['tmpl']->assign("deal_list", $result['list']); $GLOBALS['tmpl']->assign("total_money", $total_money); //输出公告 $notice_list = get_notice(3); $GLOBALS['tmpl']->assign("notice_list", $notice_list); $page_args['cid'] = $cate_id; $page_args['keywords'] = $keywords; $page_args['level'] = $level; $page_args['interest'] = $interest; $page_args['months'] = $months; $page_args['lefttime'] = $lefttime; $page_args['months_type'] = $months_type; $page_args['deal_status'] = $deal_status; $page_args['city'] = $city; //分类 $cate_list_url = array(); $tmp_args = $page_args; $tmp_args['cid'] = 0; $cate_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $cate_list_url[0]['name'] = "不限"; $cate_list_url[0]['id'] = 0; foreach ($deal_cates as $k => $v) { $cate_list_url[$k + 1] = $v; $tmp_args = $page_args; $tmp_args['cid'] = $v['id']; $cate_list_url[$k + 1]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('cate_list_url', $cate_list_url); //利率 $interest_url = array(array("interest" => 0, "name" => "不限"), array("interest" => 10, "name" => "10%"), array("interest" => 12, "name" => "12%"), array("interest" => 15, "name" => "15%"), array("interest" => 18, "name" => "18")); foreach ($interest_url as $k => $v) { $tmp_args = $page_args; $tmp_args['interest'] = $v['interest']; $interest_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('interest_url', $interest_url); //几天内 $lefttime_url = array(array("lefttime" => 0, "name" => "不限"), array("lefttime" => 1, "name" => "1天"), array("lefttime" => 3, "name" => "3天"), array("lefttime" => 6, "name" => "6天"), array("lefttime" => 9, "name" => "9天"), array("lefttime" => 12, "name" => "12天")); foreach ($lefttime_url as $k => $v) { $tmp_args = $page_args; $tmp_args['lefttime'] = $v['lefttime']; $lefttime_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('lefttime_url', $lefttime_url); //借款期限 $months_type_url = array(array("name" => "不限"), array("name" => "3 个月以下"), array("name" => "3-6 个月"), array("name" => "6-9 个月"), array("name" => "9-12 个月"), array("name" => "12 个月以上")); foreach ($months_type_url as $k => $v) { $tmp_args = $page_args; $tmp_args['months_type'] = $k; $months_type_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('months_type_url', $months_type_url); //标状态 $deal_status_url = array(array("key" => 0, "name" => "不限"), array("key" => 19, "name" => "未开始"), array("key" => 1, "name" => "进行中"), array("key" => 2, "name" => "满标"), array("key" => 3, "name" => "流标"), array("key" => 4, "name" => "还款中"), array("key" => 5, "name" => "已还清")); foreach ($deal_status_url as $k => $v) { $tmp_args = $page_args; $tmp_args['deal_status'] = $v['key']; $deal_status_url[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('deal_status_url', $deal_status_url); //会员等级 $level_list_url = array(); $tmp_args = $page_args; $tmp_args['level'] = 0; $level_list_url[0]['url'] = url("index", "deals#index", $tmp_args); $level_list_url[0]['name'] = "不限"; foreach ($level_list['list'] as $k => $v) { $tmp_args = $page_args; $tmp_args['level'] = $v['id']; $level_list_url[$k + 1] = $v; $level_list_url[$k + 1]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('level_list_url', $level_list_url); //城市 $temp_city_urls = load_auto_cache("deal_city"); $city_urls[0]['id'] = 0; $city_urls[0]['name'] = "全部"; if (count($temp_city_urls) == 1) { $temp_city_urls = $temp_city_urls[key($temp_city_urls)]['child']; } $temp_city_urls = array_merge($city_urls, $temp_city_urls); $city_urls = array(); foreach ($temp_city_urls as $k => $v) { $city_urls[$v['id']] = $v; $tmp_args = $page_args; $tmp_args['city'] = $v['id']; $city_urls[$v['id']]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('city_urls', $city_urls); $sub_citys = $city_urls[$city]['child']; foreach ($sub_citys as $k => $v) { $tmp_args = $page_args; $tmp_args['city'] = $v['pid']; $tmp_args['scity'] = $v['id']; $sub_citys[$k]['url'] = url("index", "deals#index", $tmp_args); } $GLOBALS['tmpl']->assign('sub_citys', $sub_citys); $page_pram = ""; foreach ($page_args as $k => $v) { $page_pram .= "&" . $k . "=" . $v; } $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE"), $page_pram); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("page_title", $page_title . $GLOBALS['lang']['FINANCIAL_MANAGEMENT']); $GLOBALS['tmpl']->assign("cate_id", $cate_id); $GLOBALS['tmpl']->assign("cid", strim($_REQUEST['cid'])); $GLOBALS['tmpl']->assign("keywords", $keywords); $GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates); $GLOBALS['tmpl']->assign("page_args", $page_args); $GLOBALS['tmpl']->assign("field", $field); $GLOBALS['tmpl']->assign("field_sort", $field_sort); } $GLOBALS['tmpl']->display("page/deals.html", $cache_id); }
public function index() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; //首页缓存10分钟 $cache_id = md5(MODULE_NAME . ACTION_NAME); if (!$GLOBALS['tmpl']->is_cached("page/index.html", $cache_id)) { make_deal_cate_js(); make_delivery_region_js(); change_deal_status(); //开始输出友情链接 $f_link_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link_group where is_effect = 1 order by sort desc"); foreach ($f_link_group as $k => $v) { $g_links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 and group_id = " . $v['id'] . " order by sort desc"); if ($g_links) { foreach ($g_links as $kk => $vv) { if (substr($vv['url'], 0, 7) == 'http://') { $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']); } } $f_link_group[$k]['links'] = $g_links; } else { unset($f_link_group[$k]); } } //最新借款列表 $deal_list = get_deal_list(11, 0, "publish_wait =0 AND deal_status in(1,2,4) ", " deal_status ASC,is_recommend DESC,sort DESC,id DESC"); $GLOBALS['tmpl']->assign("deal_list", $deal_list['list']); //输出最新转让 $transfer_list = get_transfer_list(11, " and d.deal_status >= 4 ", '', '', " d.create_time DESC , dlt.id DESC "); $GLOBALS['tmpl']->assign('transfer_list', $transfer_list['list']); //输出公告 $notice_list = get_notice(7); $GLOBALS['tmpl']->assign("notice_list", $notice_list); //输出公司动态 $art_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "article_cate where title='公司动态'"); if ($art_id > 0) { $compnay_active_list = get_article_list(5, $art_id); $GLOBALS['tmpl']->assign("art_id", $art_id); $GLOBALS['tmpl']->assign("compnay_active_list", $compnay_active_list['list']); } //投资排行 //天 $now_time = to_timespan(to_date(TIME_UTC, "Y-m-d"), "Y-m-d"); $day_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $now_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 5"); //周 $week_time = to_timespan(to_date(TIME_UTC - to_date(TIME_UTC, "w") * 24 * 3600, "Y-m-d"), "Y-m-d"); $week_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $week_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 5 "); //月 $month_time = to_timespan(to_date(TIME_UTC, "Y-m") . "-01", "Y-m-d"); $month_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $month_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 5"); $GLOBALS['tmpl']->assign("day_load_top_list", $day_load_top_list); $GLOBALS['tmpl']->assign("week_load_top_list", $week_load_top_list); $GLOBALS['tmpl']->assign("month_load_top_list", $month_load_top_list); //收益排名 $load_repay_list = $GLOBALS['db']->getAll("SELECT us.*,u.user_name FROM " . DB_PREFIX . "user_sta us LEFT JOIN " . DB_PREFIX . "user u ON us.user_id=u.id WHERE u.is_effect =1 and u.is_delete=0 and us.load_earnings > 0 ORDER BY us.load_earnings DESC LIMIT 5"); $GLOBALS['tmpl']->assign("load_repay_list", $load_repay_list); //使用技巧 $use_tech_list = get_article_list(12, 6); $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list); $now = TIME_UTC; $vote = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote where is_effect = 1 and begin_time < " . $now . " and (end_time = 0 or end_time > " . $now . ") order by sort desc limit 1"); $GLOBALS['tmpl']->assign("vote", $vote); $GLOBALS['tmpl']->assign("f_link_data", $f_link_group); //累计投资金额 $stats['total_load'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load where is_repay= 0 "); $stats['total_load_format'] = format_conf_count(number_format($stats['total_load'], 2)); //成交笔数 $stats['deal_total_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal where deal_status >=4 "); //累计创造收益 $stats['total_rate'] = $GLOBALS['db']->getOne("SELECT sum(repay_money-self_money) FROM " . DB_PREFIX . "deal_load_repay where has_repay = 1 "); $stats['total_rate_format'] = format_conf_count(number_format($stats['total_rate'], 2)); //本息保证金(元) $stats['total_bzh'] = $GLOBALS['db']->getOne("SELECT sum(guarantor_real_freezen_amt+real_freezen_amt) FROM " . DB_PREFIX . "deal where deal_status= 4 "); $stats['total_bzh_format'] = format_conf_count(number_format($stats['total_bzh'], 2)); //待收资金(元) $stats['total_repay'] = $GLOBALS['db']->getOne("SELECT sum(repay_money) FROM " . DB_PREFIX . "deal_load_repay where has_repay = 1 "); $stats['total_repay_format'] = format_conf_count(number_format($stats['total_repay'], 2)); //待投资金(元) $statsU = $GLOBALS['db']->getRow("SELECT sum(money) as total_usermoney ,count(*) total_user FROM " . DB_PREFIX . "user where is_effect = 1 and is_delete=0 "); $stats['total_usermoney'] = $statsU['total_usermoney']; $stats['total_usermoney_format'] = format_conf_count(number_format($stats['total_usermoney'], 2)); $stats['total_user'] = $statsU['total_user']; $GLOBALS['tmpl']->assign("stats", $stats); //格式化统计代码 $VIRTUAL_MONEY_1_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_1"))) + $stats['total_load']); $VIRTUAL_MONEY_2_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_2"))) + $stats['total_rate']); $VIRTUAL_MONEY_3_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_3"))) + $stats['total_bzh']); $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_1_FORMAT", $VIRTUAL_MONEY_1_FORMAT); $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_2_FORMAT", $VIRTUAL_MONEY_2_FORMAT); $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_3_FORMAT", $VIRTUAL_MONEY_3_FORMAT); $GLOBALS['tmpl']->assign("show_site_titile", 1); } $GLOBALS['tmpl']->display("page/index.html", $cache_id); }
public function edit($id) { $params["notice"] = get_notice(); $params["data"] = (array) $this->level->get_by_id($id); $this->load->view('levels/edit', $params); }