public function index() { require_once APP_ROOT_PATH . 'app/Lib/deal.php'; //$catalog_id = intval($GLOBALS['request']['catalog_id']);//商品分类ID $city_id = intval($GLOBALS['request']['city_id']); //城市分类ID $page = intval($GLOBALS['request']['page']); //分页 $keyword = strim($GLOBALS['request']['keyword']); //分页 $page = $page == 0 ? 1 : $page; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $deals = get_deal_list($limit, $catalog_id, $city_id, array(DEAL_ONLINE), "buy_type<>1 and is_lottery = 0 and name like '%" . $keyword . "%'", "sort desc"); $list = $deals['list']; $count = $deals['count']; $page_total = ceil($count / $page_size); $root = array(); $root['return'] = 1; $goodses = array(); foreach ($list as $item) { //$goods = array(); $goods = getGoodsArray($item); $goodses[] = $goods; } $root['item'] = $goodses; $root['page'] = array("page" => $page, "page_total" => $page_total); output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $page = intval($GLOBALS['request']['page']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $root['response_code'] = 1; if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $result = get_deal_list($limit, 0, "user_id=" . $user_id, "id DESC"); $root['item'] = $result['list']; $root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("PAGE_SIZE"))); } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function index() { //require APP_ROOT_PATH.'app/Lib/page.php'; $page = intval($GLOBALS['request']['page']); if ($page == 0) { $page = 1; } $keywords = trim(htmlspecialchars($GLOBALS['request']['keywords'])); $level = intval($GLOBALS['request']['level']); $interest = intval($GLOBALS['request']['interest']); $months = intval($GLOBALS['request']['months']); $lefttime = intval($GLOBALS['request']['lefttime']); $deal_status = intval($GLOBALS['request']['deal_status']); $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $level_list = load_auto_cache("level"); $cate_id = intval($GLOBALS['request']['cid']); $n_cate_id = 0; $condition = " publish_wait = 0 "; $orderby = ""; if ($cate_id > 0) { $n_cate_id = $cate_id; //$condition .= "AND deal_status in(0,1)"; $orderby = "update_time DESC ,sort DESC,id DESC"; } else { $n_cate_id = 0; $orderby = "update_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 > 0) { $condition .= " AND deal_status = " . $deal_status; } $result = get_deal_list($limit, $n_cate_id, $condition, $orderby); $root = array(); $root['response_code'] = 1; $root['item'] = $result['list']; //$root['DEAL_PAGE_SIZE'] = app_conf("DEAL_PAGE_SIZE"); //$root['count'] = $result['count']; $root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("DEAL_PAGE_SIZE"))); output($root); }
public function load($param) { $key = $this->build_key(__CLASS__, $param); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/"); $res = $GLOBALS['fcache']->get($key); if ($res === false) { $res = get_deal_list(app_conf("SIDE_DEAL_COUNT"), 0, 0, array(DEAL_ONLINE, DEAL_HISTORY, DEAL_NOTICE), "", "buy_count desc"); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/"); $GLOBALS['fcache']->set($key, $res); } return $res; }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $page = intval($GLOBALS['request']['page']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $root['response_code'] = 1; if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $status = intval($GLOBALS['request']['status']); $root['status'] = $status; /* * $status 1 进行中,2还款中,3已还清,4满标,5流标,0或其他 默认为全部 */ if (isset($status) && $status == "1") { $result = get_deal_list($limit, 0, "deal_status='1' and user_id=" . $user_id, "id DESC"); //进行中 } elseif (isset($status) && $status == "2") { $result = get_deal_list($limit, 0, "deal_status='4' and user_id=" . $user_id, "id DESC"); //还款中 } elseif (isset($status) && $status == "3") { $result = get_deal_list($limit, 0, "deal_status='5' and user_id=" . $user_id, "id DESC"); //已还清 } elseif (isset($status) && $status == "4") { $result = get_deal_list($limit, 0, "deal_status='2' and user_id=" . $user_id, "id DESC"); //满标 } elseif (isset($status) && $status == "5") { $result = get_deal_list($limit, 0, "deal_status='3' and user_id=" . $user_id, "id DESC"); //流标 } else { $result = get_deal_list($limit, 0, "user_id=" . $user_id, "id DESC"); } $root['item'] = $result['list']; $root['page'] = array("page" => $page, "page_total" => ceil($result['count'] / app_conf("PAGE_SIZE")), "page_size" => app_conf("PAGE_SIZE")); } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "我的借款"; output($root); }
public function gen_deal_mail() { $id = trim(addslashes($_REQUEST['id'])); require_once APP_ROOT_PATH . 'app/Lib/deal.php'; require_once APP_ROOT_PATH . 'app/Lib/common.php'; $rs = get_deal_list(count(explode(",", $id)), 0, " id in (" . $id . ") "); if ($rs) { $content = get_deal_mail_content($rs['list']); $this->ajaxReturn($content, '', 1); } else { $this->ajaxReturn('', '', 0); } }
/** * 动态输出成功案例, 不受缓存限制 */ function insert_success_deal_list() { //输出成功案例 $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 120; //首页缓存10分钟 $cache_id = md5("success_deal_list"); if (!$GLOBALS['tmpl']->is_cached("inc/insert/success_deal_list.html", $cache_id)) { $suc_deal_list = get_deal_list(11, 0, "deal_status in(4,5) ", " success_time DESC,sort DESC,id DESC"); $GLOBALS['tmpl']->assign("succuess_deal_list", $suc_deal_list['list']); } return $GLOBALS['tmpl']->fetch("inc/insert/success_deal_list.html", $cache_id); }
public function index() { $article_cate = get_acate_tree(12); foreach ($article_cate as $k => $v) { $article_cate[$k]['article'] = get_article_list(100, $v['id'], "", "", true); } $GLOBALS['tmpl']->assign("article_cate", $article_cate); //最新借款列表 require APP_ROOT_PATH . 'app/Lib/deal.php'; $deal_list = get_deal_list(9, 0, "deal_status in (1,2)", " sort DESC, id DESC"); $GLOBALS['tmpl']->assign("deal_list", $deal_list['list']); $GLOBALS['tmpl']->assign("page_title", "安全保障"); $GLOBALS['tmpl']->assign("page_keyword", "安全保障,"); $GLOBALS['tmpl']->assign("page_description", "安全保障,"); $GLOBALS['tmpl']->display("page/guarantee_index.html"); }
public function index() { $rss = new UniversalFeedCreator(); $rss->useCached(); // use cached version if age<1 hour $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE"); $rss->description = app_conf("SHOP_SEO_TITLE"); //optional $rss->descriptionTruncSize = 500; $rss->descriptionHtmlSyndicated = true; $rss->link = get_domain() . APP_ROOT; $rss->syndicationURL = get_domain() . APP_ROOT; //optional $image->descriptionTruncSize = 500; $image->descriptionHtmlSyndicated = true; $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . $GLOBALS['IMG_APP_ROOT'] : app_conf("PUBLIC_DOMAIN_ROOT"); $city = get_current_deal_city(); $city_id = $city['id']; $deal_list = get_deal_list(app_conf("DEAL_PAGE_SIZE"), 0, 0, array(DEAL_ONLINE), " buy_type <> 1 or ( is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1)"); $deal_list = $deal_list['list']; foreach ($deal_list as $data) { $item = new FeedItem(); if ($data['uname'] != '') { $gurl = url("shop", "goods", array("id" => $data['uname'])); } else { $gurl = url("shop", "goods", array("id" => $data['id'])); } $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml"); }
public function index() { $rss = new UniversalFeedCreator(); $rss->useCached(); // use cached version if age<1 hour $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE"); $rss->description = app_conf("SHOP_SEO_TITLE"); //optional $rss->descriptionTruncSize = 500; $rss->descriptionHtmlSyndicated = true; $rss->link = get_domain() . APP_ROOT; $rss->syndicationURL = get_domain() . APP_ROOT; //optional $image->descriptionTruncSize = 500; $image->descriptionHtmlSyndicated = true; //对图片路径的修复 if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") { $domain = $GLOBALS['distribution_cfg']['OSS_DOMAIN']; } else { $domain = SITE_DOMAIN . APP_ROOT; } $city = City::locate_city(); $city_id = $city['id']; $tuan_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_shop = 0 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc "); $tuan_list = $tuan_list['list']; foreach ($tuan_list as $data) { $item = new FeedItem(); $gurl = url("index", "deal#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $deal_list = get_deal_list(10, array(DEAL_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1", " create_time desc "); $deal_list = $deal_list['list']; foreach ($deal_list as $data) { $item = new FeedItem(); $gurl = url("index", "deal#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $youhui_list = get_youhui_list(10, array(YOUHUI_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_effect =1 ", " create_time desc "); $youhui_list = $youhui_list['list']; foreach ($youhui_list as $data) { $item = new FeedItem(); $gurl = url("index", "youhui#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $event_list = get_event_list(10, array(EVENT_ONLINE), array("cid" => 0, "city_id" => 0), '', " is_effect =1 ", " sort asc "); $event_list = $event_list['list']; foreach ($event_list as $data) { $item = new FeedItem(); $gurl = url("index", "event#" . $data['id']); $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml"); }
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 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() { global $tmpl; //获取当前页的团购商品列表 //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); //分类 $cate_id = intval($_REQUEST['id']); $sort_field = es_cookie::get("sort_field") ? es_cookie::get("sort_field") : "sort"; $sort_type = es_cookie::get("sort_type") ? es_cookie::get("sort_type") : "desc"; if ($sort_field != "end_time" && $sort_field != "current_price" && $sort_field != "buy_count" && $sort_field != "sort") { $sort_field = "sort"; } if ($sort_type != "desc" && $sort_type != "asc") { $sort_type = "desc"; } $act = trim($_REQUEST['act']); //显示的类型 if ($act == 'history') { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['ORDER_HISTORY_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['ORDER_HISTORY_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['ORDER_HISTORY_LIST']); $type = array(DEAL_HISTORY); } elseif ($act == 'notice') { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['ORDER_NOTICE_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['ORDER_NOTICE_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['ORDER_NOTICE_LIST']); $type = array(DEAL_NOTICE); } else { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['ORDER_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['ORDER_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['ORDER_LIST']); $type = array(DEAL_ONLINE, DEAL_HISTORY); } if (app_conf("SHOW_DEAL_CATE") == 1) { //输出分类 $deal_cates_db = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 order by sort desc"); $deal_cates = array(); if ($act == 'history' || $act == 'notice') { $url = url("tuan", "order#" . $act); } else { $url = url("tuan", "order"); } $deal_cates[] = array('id' => 0, 'name' => $GLOBALS['lang']['ALL'], 'current' => $cate_id == 0 ? 1 : 0, 'url' => $url); foreach ($deal_cates_db as $k => $v) { if ($cate_id == $v['id']) { $v['current'] = 1; } if ($act == 'history' || $act == 'notice') { $v['url'] = url("tuan", "order#" . $act, array("id" => $v['id'])); } else { $v['url'] = url("tuan", "order", array("id" => $v['id'])); } $deal_cates[] = $v; } $GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates); } //获取搜索字段 $no_deal_page = "no_deal.html"; $condition = ' buy_type=2 '; if ($_REQUEST['search']) { $search_code = unserialize(base64_decode($_REQUEST['search'])); if ($search_code['se_name'] != '') { $condition .= " and name like '%" . $search_code['se_name'] . "%' "; $no_deal_page = 'deals.html'; $GLOBALS['tmpl']->assign("se_name", $search_code['se_name']); } if ($search_code['se_begin'] != 0) { $condition .= " and (begin_time > " . intval($search_code['se_begin']) . " or begin_time = 0) "; $no_deal_page = 'deals.html'; $GLOBALS['tmpl']->assign("se_begin", to_date($search_code['se_begin'], 'Y-m-d')); } if ($search_code['se_end'] != 0) { $condition .= " and (end_time < " . intval($search_code['se_end']) . " or end_time = 0) "; $no_deal_page = 'deals.html'; $GLOBALS['tmpl']->assign("se_end", to_date($search_code['se_end'], 'Y-m-d')); } } $deals = get_deal_list($limit, $cate_id, 0, $type, $condition, $sort_field . " " . $sort_type); $GLOBALS['tmpl']->assign("deals", $deals['list']); $page = new Page($deals['count'], app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); require APP_ROOT_PATH . 'app/Lib/side.php'; //读取边栏信息,需放在deal数据的分配之后 $GLOBALS['tmpl']->assign('sort_field', $sort_field); $GLOBALS['tmpl']->assign('sort_type', $sort_type); if (es_cookie::get("list_type") === null) { $list_type = app_conf("LIST_TYPE"); } else { $list_type = intval(es_cookie::get("list_type")); } $GLOBALS['tmpl']->assign("list_type", $list_type); if ($deals['list']) { if ($list_type == 1) { $GLOBALS['tmpl']->display("deals_grid.html"); } else { $GLOBALS['tmpl']->display("deals.html"); } } else { $GLOBALS['tmpl']->display($no_deal_page); } }
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("产品众筹已经关闭"); } //links $g_links = get_link_by_id(14); $GLOBALS['tmpl']->assign("g_links", $g_links); $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); if (intval($_REQUEST['redirect']) == 1) { app_redirect(url("aps", $param)); } $cate_list = load_dynamic_cache("INDEX_CATE_LIST"); if (!$cate_list) { $cate_list = $GLOBALS['db']->getAll("select a.* from " . DB_PREFIX . "deal_cate as a where a.is_delete=0 and ( SELECT count( b.id ) AS num FROM xlc_deal AS b WHERE b.cate_id = a.id and b.is_ap>0) >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("aps", $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("aps", $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 (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where is_ap>0 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("aps", $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 where is_ap>0) or rc.name in (select city from " . DB_PREFIX . "deal where is_ap>0) 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("aps", $temp_param), 'name' => $v['name']); if ($v['is_hot']) { $hot_area[] = array('url' => url("aps", $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("aps", $temp_param); } $GLOBALS['tmpl']->assign("state_list", $state_list); $page_size = 10; $step_size = 10; $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 and d.is_ap>0"; if ($r != "") { if ($r == "new") { $condition .= " and " . NOW_TIME . " - d.begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - d.begin_time > 0 "; //上线不超过一天 $GLOBALS['tmpl']->assign("page_title", "最新上线"); } if ($r == "rec") { $condition .= " and " . NOW_TIME . " <= d.end_time AND " . NOW_TIME . " >= d.begin_time and d.is_recommend = 1 "; $GLOBALS['tmpl']->assign("page_title", "推荐项目"); } if ($r == "yure") { $condition .= " and " . NOW_TIME . " - d.begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - d.begin_time < 0 "; //上线不超过一天 $GLOBALS['tmpl']->assign("page_title", "正在预热"); } if ($r == "nend") { $condition .= " and d.end_time - " . NOW_TIME . " < " . 24 * 3600 . " and d.end_time - " . NOW_TIME . " > 0 "; //当天就要结束 $GLOBALS['tmpl']->assign("page_title", "即将结束"); } if ($r == "classic") { $condition .= " and d.is_classic = 1 "; $GLOBALS['tmpl']->assign("page_title", "经典项目"); $GLOBALS['tmpl']->assign("is_classic", true); } if ($r == "limit_price") { $condition .= " and max(d.limit_price) "; $GLOBALS['tmpl']->assign("page_title", "最高目标金额"); } } switch ($state) { //筹资成功 case 1: $condition .= " and d.is_success=1 "; $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 . " and d.is_success=0 "; $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 city = '" . $loc . "') "; $GLOBALS['tmpl']->assign("page_title", $loc); } if ($type !== "") { $type = intval($type); $condition .= " and 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); } $result = get_deal_list($limit, $condition); foreach ($result['list'] as $key => $val) { $result['list'][$key]['limit_ap'] = $val['limit_price'] * $val['ap_ratio']; $result['list'][$key]['ap_amount'] = $val['support_amount'] * $val['ap_ratio']; } 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->show(); $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("aps_index.html"); }
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 index() { global_run(); init_app_page(); $deal_key = strim($_REQUEST['act']); require_once APP_ROOT_PATH . "system/model/deal.php"; $deal = get_deal($deal_key); if ($deal) { if ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 1) { $GLOBALS['tmpl']->assign("cate_tree_type", 2); } else { set_view_history("shop", $deal['id']); $history_ids = get_view_history("shop"); $GLOBALS['tmpl']->assign("cate_tree_type", 1); } $GLOBALS['tmpl']->assign("search_type", 5); } else { set_view_history("deal", $deal['id']); $history_ids = get_view_history("deal"); } //浏览历史 if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; if ($deal['is_shop'] == 0) { $history_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); } elseif ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 0) { $history_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); } } //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //$GLOBALS['tmpl']->assign("drop_nav","no_drop"); //首页下拉菜单不输出 //$GLOBALS['tmpl']->assign("wrap_type","1"); //首页宽屏展示 $deal['description'] = format_html_content_image($deal['description'], 720); $deal['notes'] = format_html_content_image($deal['notes'], 720); $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->assign("NOW_TIME", NOW_TIME); //输出右侧的其他团购 if ($deal['is_shop'] == 0) { $side_deal_list = get_deal_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 and d.id<>" . $deal['id']); } elseif ($deal['is_shop'] == 1) { if ($deal['buy_type'] == 1) { $side_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type = 1 and d.is_shop = 1 and d.id<>" . $deal['id']); } else { $side_deal_list = get_goods_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 1 and d.id<>" . $deal['id']); } } //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE)); $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']); //关于分类信息与seo $page_title = ""; $page_keyword = ""; $page_description = ""; if ($deal['supplier_info']['name']) { $page_title .= "[" . $deal['supplier_info']['name'] . "]"; $page_keyword .= $deal['supplier_info']['name'] . ","; $page_description .= $deal['supplier_info']['name'] . ","; } $page_title .= $deal['sub_name']; $page_keyword .= $deal['sub_name'] . ","; $page_description .= $deal['sub_name'] . ","; $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index")); if ($deal['cate_id']) { $deal['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id']); $deal['cate_url'] = url("index", "tuan", array("cid" => $deal['cate_id'])); } elseif ($deal['shop_cate_id']) { $deal['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "shop_cate where id = " . $deal['shop_cate_id']); if ($deal['buy_type'] == 1) { $deal['cate_url'] = url("index", "scores", array("cid" => $deal['shop_cate_id'])); } else { $deal['cate_url'] = url("index", "cate", array("cid" => $deal['shop_cate_id'])); } } if ($deal['cate_name']) { $page_title .= " - " . $deal['cate_name']; $page_keyword .= $deal['cate_name'] . ","; $page_description .= $deal['cate_name'] . ","; $site_nav[] = array('name' => $deal['cate_name'], 'url' => $deal['cate_url']); } $site_nav[] = array('name' => $deal['sub_name'], 'url' => $deal['url']); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出促销 if ($deal['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } if ($deal['seo_title']) { $page_title = $deal['seo_title']; } if ($deal['seo_keyword']) { $page_keyword = $deal['seo_keyword']; } if ($deal['seo_description']) { $page_description = $deal['seo_description']; } $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("deal.html"); } else { app_redirect_preview(); } }
public function index() { $root = array(); $root['response_code'] = 1; //print_r($GLOBALS['db_conf']); exit; $root['kf_phone'] = $GLOBALS['m_config']['kf_phone']; //客服电话 $root['kf_email'] = $GLOBALS['m_config']['kf_email']; //客服邮箱 //$pattern = "/<img([^>]*)\/>/i"; //$replacement = "<img width=300 $1 />"; //$goods['goods_desc'] = preg_replace($pattern, $replacement, get_abs_img_root($goods['goods_desc'])); //关于我们(填文章ID) $root['about_info'] = intval($GLOBALS['m_config']['about_info']); $root['version'] = VERSION; //接口版本号int $root['page_size'] = PAGE_SIZE; //默认分页大小 $root['program_title'] = $GLOBALS['m_config']['program_title']; $root['site_domain'] = str_replace("/mapi", "", SITE_DOMAIN . APP_ROOT); //站点域名; $root['site_domain'] = str_replace("http://", "", $root['site_domain']); //站点域名; $root['site_domain'] = str_replace("https://", "", $root['site_domain']); //站点域名; //$root['newslist'] = $GLOBALS['m_config']['newslist']; //累计投资金额 $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); $root['virtual_money_1'] = strip_tags($GLOBALS['db_conf']['VIRTUAL_MONEY_1'] + $stats['total_load']); //虚拟的累计成交额; $root['virtual_money_2'] = strip_tags($GLOBALS['db_conf']['VIRTUAL_MONEY_2'] + $stats['total_rate']); //虚拟的累计创造收益; $root['virtual_money_3'] = strip_tags($GLOBALS['db_conf']['VIRTUAL_MONEY_3'] + $stats['total_bzh']); //虚拟的本息保障金; $index_list = $GLOBALS['cache']->get("MOBILE_INDEX_ADVS"); if (true || $index_list === false) { $advs = $GLOBALS['db']->getAll(" select * from " . DB_PREFIX . "m_adv where status = 1 order by sort desc "); $adv_list = array(); $deal_list = array(); $condition = "-1"; foreach ($advs as $k => $v) { if ($v['page'] == 'top') { /* $adv_list[]['id'] = $v['id']; $adv_list[]['name'] = $v['name']; if ($v['page'] == 'top' && $v['img'] != ''){ $adv_list[]['img'] = get_abs_img_root(get_spec_image($v['img'],640,240,1)); }else{ $adv_list[]['img'] = ''; } $adv_list[]['type'] = $v['type']; $adv_list[]['open_url_type'] = $v['open_url_type']; $adv_list[]['data'] = $v['data']; */ if ($v['img'] != '') { $v['img'] = get_abs_img_root(get_spec_image($v['img'], 640, 240, 1)); } $adv_list[] = $v; } else { /* $deal_list[]['id'] = $v['id']; $deal_list[]['name'] = $v['name']; $deal_list[]['img'] = ''; $deal_list[]['type'] = $v['type']; $deal_list[]['open_url_type'] = $v['open_url_type']; $deal_list[]['data'] = $v['data']; */ //$v['img'] = ''; //$deal_list[] = $v; $condition .= "," . intval($v['data']); } } //$condition = " id in (".$condition.")"; //publish_wait 0:已审核 1:等待审核;deal_status 0待等材料,1进行中,2满标,3流标,4还款中,5已还清 $condition = " publish_wait = 0 AND deal_status in (1,2,4,5)"; require APP_ROOT_PATH . 'app/Lib/deal.php'; $limit = "0,5"; $orderby = "deal_status ASC,sort DESC,id DESC"; //print_r($limit); //print_r($condition); $result = get_deal_list($limit, 0, $condition, $orderby); $index_list['adv_list'] = $adv_list; $index_list['deal_list'] = $result['list']; $GLOBALS['cache']->set("MOBILE_INDEX_ADVS", $index_list); } $root['index_list'] = $index_list; $root['deal_cate_list'] = getDealCateArray(); //分类 if (strim($GLOBALS['m_config']['sina_app_key']) != "" && strim($GLOBALS['m_config']['sina_app_secret']) != "") { $root['api_sina'] = 1; $root['sina_app_key'] = $GLOBALS['m_config']['sina_app_key']; $root['sina_app_secret'] = $GLOBALS['m_config']['sina_app_secret']; $root['sina_bind_url'] = $GLOBALS['m_config']['sina_bind_url']; } if (strim($GLOBALS['m_config']['tencent_app_key']) != "" && strim($GLOBALS['m_config']['tencent_app_secret']) != "") { $root['api_tencent'] = 1; $root['tencent_app_key'] = $GLOBALS['m_config']['tencent_app_key']; $root['tencent_app_secret'] = $GLOBALS['m_config']['tencent_app_secret']; $root['tencent_bind_url'] = $GLOBALS['m_config']['tencent_bind_url']; } output($root); }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("wrap_type", "1"); //宽屏展示 require_once APP_ROOT_PATH . "system/model/deal.php"; //浏览历史 $history_ids = get_view_history("deal"); //浏览历史 if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 $history_list = array(); foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } $GLOBALS['tmpl']->assign("history_deal_list", $history_list); } //参数处理 $deal_cate_id = intval($_REQUEST['cid']); if ($deal_cate_id) { $url_param['cid'] = $deal_cate_id; } $deal_type_id = intval($_REQUEST['tid']); if ($deal_type_id) { $url_param['tid'] = $deal_type_id; } $deal_area_id = intval($_REQUEST['aid']); if ($deal_area_id) { $url_param['aid'] = $deal_area_id; } $deal_quan_id = intval($_REQUEST['qid']); if ($deal_quan_id) { $url_param['qid'] = $deal_quan_id; } $sort_name = strim($_REQUEST["sort"]); if ($sort_name != "current_price" && $sort_name != "buy_count") { $sort_name = ""; } if ($sort_name) { $url_param['sort'] = $sort_name; } $sort_type = strim($_REQUEST['type']) == "asc" ? "asc" : "desc"; if ($_REQUEST['type']) { $url_param['type'] = $sort_type; } $dtag = intval($_REQUEST['dtag']); if ($dtag) { $url_param['dtag'] = $dtag; } $pr = intval($_REQUEST['pr']); //价格阶梯序号 if ($pr) { $url_param['pr'] = $pr; } if ($GLOBALS['kw']) { $url_param['kw'] = $GLOBALS['kw']; } //条件初始化 $condition = " buy_type <> 1 and is_shop = 0 "; //团购且不为积分商品 //输出自定义的filter_row /* array( "nav_list"=>array( array( //导航类型的切换 "current"=>array("name"=>'xxx',"url"=>"当前的地址","cancel"=>"取消的地址"), "list"=>array( array("name"=>"xxx","url"=>"xxx") ) ) ), "filter_list"=>array( //列表类型的切换 array( "name"=>"分类", "list" => array( array("name"=>"xxx","url"=>"xxx") ) ) ) ); */ //seo元素 $page_title = "团购"; $page_keyword = "团购"; $page_description = "团购"; $area_result = load_auto_cache("cache_area", array("city_id" => $GLOBALS['city']['id'])); //商圈缓存 $cate_list = load_auto_cache("cache_deal_cate"); //分类缓存 $cache_param = array("cid" => $deal_cate_id, "tid" => $deal_type_id, "aid" => $deal_area_id, "qid" => $deal_quan_id, "city_id" => intval($GLOBALS['city']['id'])); $filter_nav_data = load_auto_cache("tuan_filter_nav_cache", $cache_param); if ($deal_cate_id > 0 && $cate_list[$deal_cate_id] || $deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row_data['nav_list'][] = array("current" => array("name" => "全部", "url" => url("index", "tuan"))); } //全部 if ($deal_cate_id > 0 && $cate_list[$deal_cate_id]) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['cid']); unset($tmp_url_param['tid']); $filter_row['current'] = array("name" => $cate_list[$deal_cate_id]['name'], "cancel" => url("index", "tuan", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bcate_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小分类 if ($filter_nav_data['scate_list']) { $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['scate_list']); } $page_title = $cate_list[$deal_cate_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $cate_list[$deal_cate_id]['name']; $page_description = $page_description . "," . $cate_list[$deal_cate_id]['name']; $type_list = load_auto_cache("cache_deal_cate_type", array("cate_id" => $deal_cate_id)); if ($deal_type_id > 0 && $type_list[$deal_type_id]) { $page_title = $type_list[$deal_type_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $type_list[$deal_type_id]['name']; $page_description = $page_description . "," . $type_list[$deal_type_id]['name']; } } else { //输出大分类 $filter_row_data['filter_list'][] = array("name" => "分类", "list" => $filter_nav_data['bcate_list']); } if ($deal_area_id > 0 && $area_result[$deal_area_id] && $area_result[$deal_area_id]['pid'] == 0) { $filter_row = array(); $tmp_url_param = $url_param; unset($tmp_url_param['qid']); unset($tmp_url_param['aid']); $filter_row['current'] = array("name" => $area_result[$deal_area_id]['name'], "cancel" => url("index", "tuan", $tmp_url_param)); $filter_row['list'] = $filter_nav_data['bquan_list']; $filter_row_data['nav_list'][] = $filter_row; //输出小商圈 if ($filter_nav_data['squan_list']) { $filter_row_data['filter_list'][] = array("name" => "商圈", "list" => $filter_nav_data['squan_list']); } $page_title = $area_result[$deal_area_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_area_id]['name']; $page_description = $page_description . "," . $area_result[$deal_area_id]['name']; if ($deal_quan_id > 0 && $area_result[$deal_quan_id] && $area_result[$deal_quan_id]['pid'] != 0) { $page_title = $area_result[$deal_quan_id]['name'] . " - " . $page_title; $page_keyword = $page_keyword . "," . $area_result[$deal_quan_id]['name']; $page_description = $page_description . "," . $area_result[$deal_quan_id]['name']; } } else { //输出大商圈 $filter_row_data['filter_list'][] = array("name" => "地区", "list" => $filter_nav_data['bquan_list']); } $GLOBALS['tmpl']->assign("filter_row_data", $filter_row_data); //输出排序 $sort_row_data = array(); /* $sort_row_data = array( "sort" => array( array("name"=>"xxx","key"=>"xxx","type"=>"desc|asc","url"=>"xxx","current"=>"true|false") ), "range" => array( array ( array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), array("name"=>"xxx","url"=>"xxx","selected"=>"true|false"), ) ), "tag" => array( array("name"=>"xxx","url"=>"xxx","checked"=>"true|false") ) ); */ //默认排序 $tmp_url_param = $url_param; unset($tmp_url_param['type']); unset($tmp_url_param['sort']); if (empty($url_param['sort'])) { $current = true; } else { $current = false; } $sort_list[] = array("name" => "默认排序", "current" => $current, "url" => url("index", "tuan", $tmp_url_param)); //价格排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "current_price") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "current_price"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "价格", "key" => "current_price", "type" => $c_sort_type, "current" => $current, "url" => url("index", "tuan", $tmp_url_param)); //销量排序 $tmp_url_param = $url_param; if ($tmp_url_param['sort'] == "buy_count") { if ($tmp_url_param['type'] == "desc") { $tmp_url_param['type'] = "asc"; $c_sort_type = "desc"; } else { $tmp_url_param['type'] = "desc"; $c_sort_type = "asc"; } $current = true; } else { $tmp_url_param['sort'] = "buy_count"; $tmp_url_param['type'] = "desc"; $c_sort_type = "desc"; $current = false; } $sort_list[] = array("name" => "销量", "key" => "buy_count", "type" => $c_sort_type, "current" => $current, "url" => url("index", "tuan", $tmp_url_param)); $sort_row_data['sort'] = $sort_list; //标签筛选 1 - 6 /* 免预约 1 t 多套餐 2 t 可订座 3 t 代金券 4 t 过期退 5 t 随时退 6 t */ $tag_condition = ""; for ($t = 1; $t <= 6; $t++) { $checked = false; if (($dtag & pow(2, $t)) == pow(2, $t)) { $checked = true; } $tmp_url_param = $url_param; $tmp_url_param['dtag'] = $dtag ^ pow(2, $t); $dtags[] = array("name" => lang("DEAL_TAG_" . $t), "checked" => $checked, "url" => url("index", "tuan", $tmp_url_param)); } $ext_condition = " d.deal_tag&" . $dtag . "=" . $dtag . " "; $sort_row_data['tag'] = $dtags; //价格区间 $price_level = array(array("min" => "0", "max" => "100"), array("min" => "100", "max" => "500"), array("min" => "500", "max" => "2000"), array("min" => "2000", "max" => "0")); $tmp_url_param = $url_param; unset($tmp_url_param['pr']); $all_selected = false; if (empty($url_param['pr'])) { $all_selected = true; } $price_range[] = array("name" => "全部价格", "url" => url("index", "tuan", $tmp_url_param), "selected" => $all_selected); foreach ($price_level as $k => $v) { $tmp_url_param = $url_param; $tmp_url_param['pr'] = $k + 1; $current_selected = false; if ($url_param['pr'] == $k + 1) { $current_selected = true; } if ($v['min'] == 0 && $v['max'] > 0) { $range_name = $v['max'] . "元以下"; } else { if ($v['max'] == 0 && $v['min'] > 0) { $range_name = $v['min'] . "元以上"; } else { $range_name = $v['min'] . "-" . $v['max'] . "元"; } } $price_range[] = array("name" => $range_name, "url" => url("index", "tuan", $tmp_url_param), "selected" => $current_selected); } if ($price_level[$pr - 1]) { $price_range_item = $price_level[$pr - 1]; if ($price_range_item['min'] > 0) { $ext_condition .= " and d.current_price >= " . $price_range_item['min'] . " "; } if ($price_range_item['max'] > 0) { $ext_condition .= " and d.current_price <= " . $price_range_item['max'] . " "; } } $ext_condition .= " and d.buy_type <> 1 and d.is_shop = 0 "; $sort_row_data['range'][] = $price_range; $GLOBALS['tmpl']->assign("sort_row_data", $sort_row_data); //开始获取商品 //获取排序条件 if ($url_param['sort']) { $sort_field = "d." . $url_param['sort'] . " " . $url_param['type']; } require_once APP_ROOT_PATH . "app/Lib/page.php"; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); $condition_param = $url_param; $condition_param['city_id'] = $GLOBALS['city']['id']; if ($GLOBALS['kw']) { $ext_condition .= " and d.name like '%" . $GLOBALS['kw'] . "%' "; } //开始身边团购的地理定位 $ypoint = $GLOBALS['geo']['ypoint']; //ypoint $xpoint = $GLOBALS['geo']['xpoint']; //xpoint $address = $GLOBALS['geo']['address']; if ($xpoint > 0) { $pi = PI; //圆周率 $r = EARTH_R; //地球平均半径(米) $field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((d.ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((d.ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (d.xpoint * {$pi}) / 180 ) ) * {$r}) as distance "; if (empty($sort_field)) { $sort_field = " distance asc "; } $GLOBALS['tmpl']->assign("geo", $GLOBALS['geo']); } $deal_result = get_deal_list($limit, array(DEAL_ONLINE, DEAL_NOTICE), $condition_param, "", $ext_condition, $sort_field, $field_append); $deal_list = $deal_result['list']; foreach ($deal_list as $k => $v) { $distance = $v['distance']; $distance_str = ""; if ($distance > 0) { if ($distance > 1500) { $distance_str = "距离" . round($distance / 1000) . "公里"; } else { $distance_str = "距离" . round($distance) . "米"; } } $deal_list[$k]['distance'] = $distance_str; } $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal as d where " . $deal_result['condition'], false); $page = new Page($total, app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('deal_list', $deal_list); $side_deal_result = get_deal_list(app_conf("SIDE_DEAL_COUNT"), array(DEAL_ONLINE, DEAL_NOTICE), array("city_id" => $GLOBALS['city']['id']), "", " d.buy_type <> 1 and d.is_shop = 0 ", " d.buy_count desc "); $side_deal_list = $side_deal_result['list']; $GLOBALS['tmpl']->assign('side_deal_list', $side_deal_list); $GLOBALS['tmpl']->assign("page_title", $page_title); $GLOBALS['tmpl']->assign("page_keyword", $page_keyword); $GLOBALS['tmpl']->assign("page_description", $page_description); $GLOBALS['tmpl']->display("tuan.html"); }
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); }
public function show() { //get_mortgate(); //获取项目的ID $id = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))"); $access = get_level_access($GLOBALS['user_info'], $deal_info); $GLOBALS['tmpl']->assign("access", $access); $deal_info['deal_type'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id=" . $deal_info['cate_id']); $deal_info['login_time'] = $GLOBALS['db']->getOne("select login_time from " . DB_PREFIX . "user where id=" . $deal_info['user_id']); $deal_info['user_icon'] = $GLOBALS['user_level'][$deal_info['user_level']]['icon']; $deal_info['is_investor'] = $GLOBALS['db']->getOne("select is_investor from " . DB_PREFIX . "user where id=" . $deal_info['user_id']); if (!$deal_info) { app_redirect(url("index")); } if ($deal_info['is_effect'] == 1) { log_deal_visit($deal_info['id']); } if ($deal_info['type'] == 1) { //跟投人数 $gen_num = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "investment_list where type=2 and deal_id=" . $id); $GLOBALS['tmpl']->assign('gen_num', intval($gen_num)); //询价人数 $xun_num = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "investment_list where type=0 and deal_id=" . $id); $GLOBALS['tmpl']->assign('xun_num', intval($xun_num)); } $deal_info = cache_deal_extra($deal_info); $comment_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0 and status=1"); $GLOBALS['tmpl']->assign('comment_count', $comment_count); $this->init_deal_page(@$deal_info); if (app_conf("INVEST_STATUS") == 2 && $deal_info['type'] == 0) { showErr("产品众筹已经关闭"); } if ($deal_info['type'] == 1) { $GLOBALS['tmpl']->assign('deal_type', 'gq_type'); } else { $GLOBALS['tmpl']->assign('deal_type', 'product_type'); } if ($deal_info['type'] == 1) { if (app_conf("INVEST_STATUS") == 1) { showErr("股权众筹已经关闭"); } set_deal_status($deal_info); $GLOBALS['tmpl']->assign("id", $id); $user_name = $GLOBALS['user_info']['user_name']; $GLOBALS['tmpl']->assign("user_name", $user_name); $deal_info['business_create_time'] = to_date($deal_info['business_create_time'], 'Y-m-d'); $cate = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id =" . $deal_info['cate_id']); $GLOBALS['tmpl']->assign("cate", $cate); //编辑及管理团队 $stock_list = unserialize($deal_info['stock']); $GLOBALS['tmpl']->assign("stock_list", $stock_list); $unstock_list = unserialize($deal_info['unstock']); $GLOBALS['tmpl']->assign("unstock_list", $unstock_list); //项目历史执行资料 $history_list = unserialize($deal_info['history']); $GLOBALS['tmpl']->assign("history_list", $history_list); $total_history_income = 0; $total_history_out = 0; $total_history = 0; foreach ($history_list as $key => $v) { $total_history_income += floatval($v["info"]["item_income"]); $total_history_out += floatval($v["info"]["item_out"]); $total_history = $total_history_income - $total_history_out; } $GLOBALS['tmpl']->assign("total_history_income", $total_history_income); $GLOBALS['tmpl']->assign("total_history_out", $total_history_out); $GLOBALS['tmpl']->assign("total_history", $total_history); //未来三年内计划 $plan_list = unserialize($deal_info['plan']); $GLOBALS['tmpl']->assign("plan_list", $plan_list); $total_plan_income = 0; $total_plan_out = 0; $total_plan = 0; foreach ($plan_list as $key => $v) { $total_plan_income += floatval($v["info"]["item_income"]); $total_plan_out += floatval($v["info"]["item_out"]); $total_plan = $total_plan_income - $total_plan_out; } $GLOBALS['tmpl']->assign("total_plan_income", $total_plan_income); $GLOBALS['tmpl']->assign("total_plan_out", $total_plan_out); $GLOBALS['tmpl']->assign("total_plan", $total_plan); //项目附件 $attach_list = unserialize($deal_info['attach']); $GLOBALS['tmpl']->assign("attach_list", $attach_list); //资质证明 $audit_data_list = unserialize($deal_info['audit_data']); $GLOBALS['tmpl']->assign("audit_data_list", $audit_data_list); //跟投、领投信息列表 get_investor_info($id); //var_dump($deal_info); $GLOBALS['tmpl']->assign("deal_item", $deal_info); //热门的项目 $deal_hot_result = get_deal_list($limit, 'is_hot=1', 'support_count desc'); $GLOBALS['tmpl']->assign("deal_hot_list", $deal_hot_result['list']); $GLOBALS['tmpl']->display("deal_investor_show.html"); } else { //普通众筹 $GLOBALS['tmpl']->display("deal_show.html"); } }
public function deal() { $GLOBALS['tmpl']->caching = true; $GLOBALS['tmpl']->cache_lifetime = 600; $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . intval($_REQUEST['p'])); if (!$GLOBALS['tmpl']->is_cached('page/space_index.html', $cache_id)) { $this->init(); $title = sprintf($GLOBALS['lang']['WHOS_SPACE'], $this->space_user['user_name']); $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); $site_nav[] = array('name' => $title, 'url' => url("index", "space#deal", array("id" => $this->space_user['id']))); $site_nav[] = array('name' => $GLOBALS['lang']['SPACE_DEAL'], 'url' => url("index", "space#deal", array("id" => $this->space_user['id']))); $GLOBALS['tmpl']->assign("site_nav", $site_nav); $GLOBALS['tmpl']->assign("page_title", $title); $GLOBALS['tmpl']->assign("page_keyword", $title . ","); $GLOBALS['tmpl']->assign("page_description", $title . ","); //输出借款记录 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); require_once APP_ROOT_PATH . "app/Lib/deal.php"; $result = get_deal_list($limit, 0, "user_id=" . $this->space_user['id'], "id DESC"); $GLOBALS['tmpl']->assign("deal_list", $result['list']); $page = new Page($result['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $list_html = $GLOBALS['tmpl']->fetch("inc/uc/uc_center_deals.html"); $GLOBALS['tmpl']->assign("list_html", $list_html); } $GLOBALS['tmpl']->display("page/space_index.html", $cache_id); }
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); // } $image_list = load_auto_cache("index_image"); $GLOBALS['tmpl']->assign("image_list", $image_list[0]); $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 = 8; $limit = "0,8"; $GLOBALS['tmpl']->assign("current_page", 1); $deal_result = get_deal_list($limit, 'type=0'); foreach ($deal_result['list'] as $k => $v) { $cate_id = $v['cate_id']; $deal_result['list'][$k]['cate_name'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id = {$cate_id}"); $deal_result['list'][$k]['limit_prices'] = $v['limit_price'] / 10000; } $GLOBALS['tmpl']->assign("deal_list", $deal_result['list']); $deal_invest_result = get_deal_list($limit, 'type=1'); $GLOBALS['tmpl']->assign("deal_list_invest", $deal_invest_result['list']); $new_condition = ''; $hot_conditon = ''; if (app_conf("INVEST_STATUS") == 1) { $new_condition = 'type=0'; $hot_conditon = 'type=0'; } elseif (app_conf("INVEST_STATUS") == 2) { $new_condition = 'type=1'; $hot_conditon = 'type=1'; } else { $new_condition = 'type=0'; $hot_conditon = 'type=1'; } $hot_conditon .= ' and is_hot=1 '; //最新的项目 $deal_new_result = get_deal_list('0,8', $new_condition, 'id desc'); $GLOBALS['tmpl']->assign("deal_new_list", $deal_new_result['list']); //热门的项目 $deal_hot_result = get_deal_list('0,4', $hot_conditon, 'support_count desc'); $GLOBALS['tmpl']->assign("deal_hot_list", $deal_hot_result['list']); //成功的项目 $deal_success_result = get_deal_list($limit, 'is_success=1'); $GLOBALS['tmpl']->assign("deal_success_list", $deal_success_result['list']); //推荐的项目 $deal_recommend_result = get_deal_list($limit, 'is_recommend=1'); $GLOBALS['tmpl']->assign("deal_recommend_list", $deal_recommend_result['list']); //专题项目 $deal_special_result = get_deal_list($limit, 'is_special=1'); $GLOBALS['tmpl']->assign("deal_special_list", $deal_special_result['list']); //成功项目总数 $success_sum = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_delete=0 and is_effect = 1 and is_success = 1"); $GLOBALS['tmpl']->assign("success_sum", $success_sum); //注册会员总数 $register_sum = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where is_effect = 1 "); $register_sum = intval($register_sum) + intval(app_conf("VIRSUAL_NUM")); $GLOBALS['tmpl']->assign("register_sum", $register_sum); //===============首页项目列表END=================== /*虚拟的累计项目总个数,支持总人数,项目支持总金额*/ 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_product = $GLOBALS['db']->getOne("select sum(support_amount+virtual_price) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 and type=0 {$condition}"); $virtual_money_invest = $GLOBALS['db']->getOne("select sum(invote_money) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0 and type=1 {$condition}"); $virtual_money = $virtual_money_product + $virtual_money_invest; $GLOBALS['tmpl']->assign("virtual_effect", intval($virtual_effect)); //项目总个数 $GLOBALS['tmpl']->assign("virtual_person", intval($virtual_person)); //累计支持人 $GLOBALS['tmpl']->assign("virtual_money", $virtual_money); //筹资总金额 /*虚拟的累计项目总个数,支持总人数,项目支持总金额 结束*/ //首页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 "; } $condition .= " 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, 2); $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'] = ceil(($v['begin_time'] - $now_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, 2); } else { $deal_cate[$k]['virtual_person'] = $deal_cate[$k]['virtual_num']; $deal_cate[$k]['support_count'] = $deal_cate[$k]['virtual_num'] + $deal_cate[$k]['support_count']; $deal_cate[$k]['support_amount'] = $deal_cate[$k]['virtual_price'] + $deal_cate[$k]['support_amount']; $deal_cate[$k]['percent'] = round($deal_cate[$k]['support_amount'] / $v['limit_price'] * 100, 2); } } $GLOBALS['tmpl']->assign("deal_cate", $deal_cate); /*投资人列表*/ $invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where is_effect=1 order by login_time desc limit 0,22"); foreach ($invester_list as $k => $v) { $invester_list[$k]['image'] = get_user_avatar($v["id"], "middle"); //用户头像 $invester_list[$k]['cate_name'] = unserialize($v["cate_name"]); //所在行业领域 //$invester_list[$k]['icon']=get_user_lever_icon($v["user_level"]); } $GLOBALS['tmpl']->assign("invester_list", $invester_list); $GLOBALS['tmpl']->display("index.html"); }
public function deal() { $this->init_user(); $user_info = $this->user_data; $ajax = intval($_REQUEST['ajax']); if ($ajax == 0) { $this->init_main(); } $user_id = intval($user_info['id']); //输出借款记录 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); require_once APP_ROOT_PATH . "app/Lib/deal.php"; $result = get_deal_list($limit, 0, "user_id=" . $user_id, "id DESC"); $GLOBALS['tmpl']->assign("deal_list", $result['list']); $page = new Page($result['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('user_data', $user_info); if ($ajax == 0) { $list_html = $GLOBALS['tmpl']->fetch("inc/uc/uc_center_deals.html"); $GLOBALS['tmpl']->assign("list_html", $list_html); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_CENTER_MYDEAL']); $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['UC_CENTER_MYDEAL']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_center_index.html"); $GLOBALS['tmpl']->display("page/uc.html"); } else { header("Content-Type:text/html; charset=utf-8"); echo $GLOBALS['tmpl']->fetch("inc/uc/uc_center_deals.html"); } }
public function index() { $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); 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 ($state != "") { $param = array_merge($param, array("state" => $state)); } if ($tag != "") { $param = array_merge($param, array("tag" => $tag)); } if ($kw != "") { $param = array_merge($param, array("k" => $kw)); } if ($type != "") { $param = array_merge($param, array("type" => $type)); } app_redirect(url_wap("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_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(); foreach ($cate_list as $k => $v) { if ($v['pid'] == 0) { $temp_param = $param; $cate_result[$v['id']]['id'] = $v['id']; $cate_result[$v['id']]['name'] = $v['name']; $temp_param['id'] = $v['id']; $cate_result[$v['id']]['url'] = url_wap("deals", $temp_param); } else { if ($v['pid'] > 0) { $temp_param['id'] = $v['id']; $cate_result[$v['pid']]['child'][] = array('id' => $v['id'], 'name' => $v['name'], 'url' => url_wap("deals", $temp_param)); } } if ($v['id'] == $id) { $GLOBALS['tmpl']->assign("cate_name", $v['name']); } } $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_wap("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_wap("deals", $temp_param); if ($v['id']) { $child = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid=" . $v['id']); if ($child) { foreach ($child as $k1 => $v1) { $temp_param['loc'] = $v1['name']; $child[$k1]['url'] = url_wap("deals", $temp_param); } $city_list[$k]['child'] = $child; } } } $GLOBALS['tmpl']->assign("city_list", $city_list); //=================region_conf============== $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_wap("deals", $temp_param); } if ($state == 0) { $GLOBALS['tmpl']->assign("state_name", "所有项目"); } else { $GLOBALS['tmpl']->assign("state_name", $state_list[$state]['name']); } $GLOBALS['tmpl']->assign("state_list", $state_list); $page_size = PAGE_SIZE; $step_size = PAGE_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 city = '" . $loc . "') "; $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 ($type !== "") { $type = intval($type); $condition .= " and type={$type} "; } 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); } $result = get_deal_list($limit, $condition); foreach ($result['list'] as $k => $v) { } $GLOBALS['tmpl']->assign("deal_list", $result['list']); $GLOBALS['tmpl']->assign("deal_count", intval($result['rs_count'])); $page = new Page($result['rs_count'], $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("usermessage_url", url_wap("ajax#usermessage", array("id" => intval($GLOBALS['user_info']['id'])))); $GLOBALS['tmpl']->display("deals_index.html"); }
function deal_log_list($limit = "", $condition = "", $orderby = "d.create_time desc") { $log_list = $GLOBALS['db']->getAll("select l.*,d.name as deal_name from " . DB_PREFIX . "deal_log as l left join " . DB_PREFIX . "deal as d on d.id=l.deal_id where {$condition} order by {$orderby} limit " . $limit); $full_list = array(); foreach ($log_list as $k => $v) { if (!empty($v['id'])) { $v['left_time'] = pass_date($v['create_time']); $log_list[$k]['left_time'] = $v['left_time']; if ($k <= 1) { $deal = get_deal_list("0,1", "d.id=" . $v['deal_id']); $v['deal_info'] = $deal['list'][0]; $full_list[] = $v; unset($log_list[$k]); } } } return array("right_list" => $log_list, "left_list" => $full_list); }
function insert_load_head_history() { require_once APP_ROOT_PATH . 'system/model/deal.php'; $history_list = array(); //浏览历史 $history_ids = get_view_history("deal"); if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_deal_list(2, array(DEAL_ONLINE), array("city_id" => $GLOBALS['city']['id']), "", $ids_conditioin); //重新组装排序 foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } } $history_ids = get_view_history("shop"); if ($history_ids) { $ids_conditioin = " d.id in (" . implode(",", $history_ids) . ") "; $history_deal_list = get_goods_list(2, array(DEAL_ONLINE), array("city_id" => 0), "", $ids_conditioin); //重新组装排序 foreach ($history_ids as $k => $v) { foreach ($history_deal_list['list'] as $history_item) { if ($history_item['id'] == $v) { $history_list[] = $history_item; } } } } $GLOBALS['tmpl']->assign("history_list", $history_list); $html = $GLOBALS['tmpl']->fetch("inc/insert/load_head_history.html"); return $html; }
public function deals() { $r = strim($_REQUEST['r']); //推荐类型 $param['r'] = $r ? $r : ''; $id = intval($_REQUEST['id']); //分类id $param['id'] = $id; $loc = strim($_REQUEST['loc']); //地区 $param['loc'] = $loc; $tag = strim($_REQUEST['tag']); //标签 $param['tag'] = $tag; $type = intval($_REQUEST['type']); //类型 $param['type'] = $type; $kw = strim($_REQUEST['k']); //关键词 $param['tag'] = $tag; $state = intval($_REQUEST['state']); //状态 $param['state'] = $state; $step = intval($_REQUEST['step']); $param['step'] = $step; //融资金额 $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); } $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 = " 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 "; //上线不超过一天 } elseif ($r == "rec") { $condition .= " and d.is_recommend = 1 "; } elseif ($r == "yure") { $condition .= " and " . NOW_TIME . " < d.begin_time "; } elseif ($r == "nend") { $condition .= " and d.end_time - " . NOW_TIME . " < " . 7 * 24 * 3600 . " and d.end_time - " . NOW_TIME . " > 0 "; //三天就要结束 } elseif ($r == "classic") { $condition .= " and d.is_classic = 1 "; } elseif ($r == "limit_price") { $condition .= " and max(d.limit_price) "; } } 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; } $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*/ $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("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); } if (count($cate_ids) > 0) { $condition .= " and d.cate_id in (" . implode(",", $cate_ids) . ")"; } if ($loc != "") { $condition .= " and (d.province = '" . $loc . "' or d.city = '" . $loc . "') "; } if ($tag != "") { $unicode_tag = str_to_unicode_string($tag); $condition .= " and match(d.tags_match) against('" . $unicode_tag . "' IN BOOLEAN MODE) "; } 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 name like '%" . $kw . "%') "; } $condition .= " and d.type={$type} "; // if($r=="new") // { // $orderby =" d.begin_time desc "; // } // elseif($r=="rec") // { // $orderby.=" d.begin_time desc "; // } // else // { // $orderby =" sort asc "; // } //======== 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"; } elseif ($focus == 2) { $orderby .= " d.focus_count asc"; } } elseif ($time > 0) { if ($time == 1) { $orderby .= " d.end_time desc"; } elseif ($time == 2) { $orderby .= " d.end_time asc"; } } 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 "; } // var_dump($limit); // var_dump($condition); // var_dump($orderby); $result = get_deal_list($limit, $condition, $orderby); $GLOBALS['tmpl']->assign("deal_list", $result['list']); $data['html'] = $GLOBALS['tmpl']->fetch("inc/deal_list.html"); if ($step * $step_size < $page_size) { if ($result['rs_count'] <= ($page - 1) * $page_size + ($step - 1) * $step_size + $step_size) { $data['step'] = 0; ajax_return($data); } else { $data['step'] = $step + 1; ajax_return($data); } } else { $data['step'] = 0; ajax_return($data); } }
public function borrowed() { $user_id = $GLOBALS['user_info']['id']; //输出借款记录 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $result = get_deal_list($limit, 0, " (is_delete=0 or is_delete = 2 or is_delete =3) and user_id=" . $user_id, "id DESC", '', '', true); $GLOBALS['tmpl']->assign("deal_list", $result['list']); $page = new Page($result['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_DEAL_BORROWED']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_deal_borrowed.html"); $GLOBALS['tmpl']->display("page/uc.html"); }
public function index() { $root = array(); $root['response_code'] = 1; //print_r($GLOBALS['db_conf']); exit; $root['kf_phone'] = $GLOBALS['m_config']['kf_phone']; //客服电话 $root['kf_email'] = $GLOBALS['m_config']['kf_email']; //客服邮箱 //$pattern = "/<img([^>]*)\/>/i"; //$replacement = "<img width=300 $1 />"; //$goods['goods_desc'] = preg_replace($pattern, $replacement, get_abs_img_root($goods['goods_desc'])); //关于我们(填文章ID) $root['about_info'] = intval($GLOBALS['m_config']['about_info']); $root['version'] = VERSION; //接口版本号int $root['page_size'] = PAGE_SIZE; //默认分页大小 $root['program_title'] = $GLOBALS['m_config']['program_title']; $root['site_domain'] = str_replace("/mapi", "", SITE_DOMAIN . APP_ROOT); //站点域名; $root['site_domain'] = str_replace("http://", "", $root['site_domain']); //站点域名; $root['site_domain'] = str_replace("https://", "", $root['site_domain']); //站点域名; //$root['newslist'] = $GLOBALS['m_config']['newslist']; $root['virtual_money_1'] = strip_tags($GLOBALS['db_conf']['VIRTUAL_MONEY_1']); //虚拟的累计成交额; $root['virtual_money_2'] = strip_tags($GLOBALS['db_conf']['VIRTUAL_MONEY_2']); //虚拟的累计创造收益; $root['virtual_money_3'] = strip_tags($GLOBALS['db_conf']['VIRTUAL_MONEY_3']); //虚拟的本息保障金; $index_list = $GLOBALS['cache']->get("MOBILE_INDEX_ADVS"); if (true || $index_list === false) { $advs = $GLOBALS['db']->getAll(" select * from " . DB_PREFIX . "m_adv where status = 1 order by sort desc "); $adv_list = array(); $deal_list = array(); $condition = "-1"; foreach ($advs as $k => $v) { if ($v['page'] == 'top') { /* $adv_list[]['id'] = $v['id']; $adv_list[]['name'] = $v['name']; if ($v['page'] == 'top' && $v['img'] != ''){ $adv_list[]['img'] = get_abs_img_root(get_spec_image($v['img'],640,240,1)); }else{ $adv_list[]['img'] = ''; } $adv_list[]['type'] = $v['type']; $adv_list[]['open_url_type'] = $v['open_url_type']; $adv_list[]['data'] = $v['data']; */ if ($v['img'] != '') { $v['img'] = get_abs_img_root(get_spec_image($v['img'], 640, 240, 1)); } $adv_list[] = $v; } else { /* $deal_list[]['id'] = $v['id']; $deal_list[]['name'] = $v['name']; $deal_list[]['img'] = ''; $deal_list[]['type'] = $v['type']; $deal_list[]['open_url_type'] = $v['open_url_type']; $deal_list[]['data'] = $v['data']; */ //$v['img'] = ''; //$deal_list[] = $v; $condition .= "," . intval($v['data']); } } $condition = " id in (" . $condition . ")"; require APP_ROOT_PATH . 'app/Lib/deal.php'; $limit = "0,20"; $orderby = "deal_status ASC,success_time DESC,sort DESC,id DESC"; //print_r($limit); //print_r($condition); $result = get_deal_list($limit, 0, $condition, $orderby); $index_list['adv_list'] = $adv_list; $index_list['deal_list'] = $result['list']; $GLOBALS['cache']->set("MOBILE_INDEX_ADVS", $index_list); } $root['index_list'] = $index_list; $root['deal_cate_list'] = getDealCateArray(); //分类 if (strim($GLOBALS['m_config']['sina_app_key']) != "" && strim($GLOBALS['m_config']['sina_app_secret']) != "") { $root['api_sina'] = 1; $root['sina_app_key'] = $GLOBALS['m_config']['sina_app_key']; $root['sina_app_secret'] = $GLOBALS['m_config']['sina_app_secret']; $root['sina_bind_url'] = $GLOBALS['m_config']['sina_bind_url']; } if (strim($GLOBALS['m_config']['tencent_app_key']) != "" && strim($GLOBALS['m_config']['tencent_app_secret']) != "") { $root['api_tencent'] = 1; $root['tencent_app_key'] = $GLOBALS['m_config']['tencent_app_key']; $root['tencent_app_secret'] = $GLOBALS['m_config']['tencent_app_secret']; $root['tencent_bind_url'] = $GLOBALS['m_config']['tencent_bind_url']; } output($root); }
/** * 邀约中的担保的标 */ function agencydealing() { //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); require APP_ROOT_PATH . "app/Lib/deal_func.php"; require APP_ROOT_PATH . "app/Lib/page.php"; $manageagency_info = $this->checkLogin(); $condition = " agency_id = " . $manageagency_info['id'] . " and agency_status = 1 "; $result = get_deal_list($limit, 0, $condition, '', '', '', true); $GLOBALS['tmpl']->assign("list", $result['list']); $page = new Page($result['count'], app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("page_title", "邀约中的担保"); $GLOBALS['tmpl']->assign("inc_file", "manageagency/agencydealing.html"); $GLOBALS['tmpl']->display("manageagency/m.html"); }