<?php require_once dirname(__FILE__) . '/app.php'; $request_uri = 'index'; $group_id = abs(intval($_GET['gid'])); if (option_yes('indexmulti') && option_yes('indexpage')) { $city_id = abs(intval($city['id'])); $now = time(); $size = abs(intval($INI['system']['indexteam'])); if ($size <= 1) { return current_team($city_id); } $condition = array('team_type' => 'normal', "begin_time < '{$now}'", "end_time > '{$now}'"); if ($group_id) { $condition['group_id'] = $group_id; } $condition[] = "(city_ids like '%@{$city_id}@%' or city_ids like '%@0@%') or (city_ids = '' and city_id in(0,{$city_id}))"; $count = Table::Count('team', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, $size); $teams = DB::LimitQuery('team', array('condition' => $condition, 'order' => 'ORDER BY `sort_order` DESC, `id` DESC', 'size' => $pagesize, 'offset' => $offset)); $disable_multi = true; /***********************加入的代码:开始*********************************/ $cates = DB::LimitQuery('category', array('condition' => array('zone' => 'group', 'fid' => '0', 'display' => 'Y'), 'order' => 'ORDER BY `sort_order` DESC, `id` DESC')); $alls = array(); $anow = time(); foreach ($cates as $key => $value) { $alls[$key]['name'] = $value[name]; $alls[$key]['ename'] = $value[ename]; $alls[$key]['gid'] = $value[id]; $alls[$key]['number'] = Table::Count('team', array('team_type' => 'normal', 'group_id' => $value[id], "(city_ids like '%@{$city_id}@%' or city_ids like '%@0@%') or (city_ids = '' and city_id in(0,{$city_id}))", "begin_time < '{$anow}'", "end_time > '{$anow}'")); $alls[$key]['teams'] = DB::LimitQuery('team', array('condition' => array('team_type' => 'normal', 'group_id' => $value[id], "(city_ids like '%@{$city_id}@%' or city_ids like '%@0@%') or (city_ids = '' and city_id in(0,{$city_id}))", "begin_time < '{$anow}'", "end_time > '{$anow}'"), 'order' => 'ORDER BY `sort_order` DESC, `id` DESC', 'size' => $value[show_number]));
<?php require_once dirname(__FILE__) . '/app.php'; $request_uri = 'index'; $team = current_team($city['id']); $daytime = strtotime(date('Y-m-d')); $condition = array('city_id' => array(0, abs(intval($city['id']))), 'team_type' => 'normal', "begin_time <= '{$daytime}'", "end_time > '{$daytime}'", "audit" => 1); $count = Table::Count('team', $condition); if ($count > 1) { Utility::Redirect(WEB_ROOT . '/team/list.php'); } if ($team) { $_GET['id'] = abs(intval($team['id'])); die(require_once dirname(__FILE__) . '/team.php'); } include template('subscribe');
function index_get_team($city_id, $group_id = 0) { global $INI; $multi = option_yes('indexmulti'); $city_id = abs(intval($city_id)); /* 是否首页多团,不是则返回当前城市 */ if (!$multi) { return current_team($city_id); } $now = time(); $size = abs(intval($INI['system']['indexteam'])); /* 侧栏团购数小于1,则返回当前城市数据 */ if ($size <= 1) { return current_team($city_id); } $oc = array('team_type' => 'normal', "begin_time < '{$now}'", "end_time > '{$now}'"); if ($group_id) { $oc['group_id'] = $group_id; } /* 数据库匹配多个城市订单,前者按照多城市搜索,后者兼容旧字段city_id搜索 */ $oc[] = "(city_ids like '%@{$city_id}@%' or city_ids like '%@0@%') or (city_ids = '' and city_id in(0,{$city_id}))"; $teams = DB::LimitQuery('team', array('condition' => $oc, 'order' => 'ORDER BY `sort_order` DESC, `id` DESC')); if (count($teams) == 1) { return array_pop($teams); } return $teams; }
'size'=>8 )); /* 二次开发 读取二级分类名称 Powered by 7snn.com */ $sub_id = abs(intval($_GET['sid'])); $group_id = abs(intval($_GET['gid'])); if (option_yes('indexmulti')&& option_yes('indexpage')) { $city_id = abs(intval($city['id'])); $now = time(); $size = abs(intval($INI['system']['indexteam'])); if ($size<=1) return current_team($city_id); $condition = array( 'team_type' => 'normal', "begin_time < '{$now}'", "end_time > '{$now}'", ); /* 二次开发 读取二级分类名称 Powered by 7snn.com */ if($sub_id) $condition['sub_id']=$sub_id; if($group_id) $condition['group_id']=$group_id; $condition[] = "(city_ids like '%@{$city_id}@%' or city_ids like '%@0@%') or (city_ids = '' and city_id in(0,{$city_id}))"; $count = Table::Count('team', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, $size);
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; $action = strval($_GET['action']); $email = strval($_GET['email']); $city_id = abs(intval($_GET['city_id'])); if ($action == 'notice') { $curdaytime = strtotime(date('Y-m-d')); $team = current_team($city_id); $team['state'] = team_state($team); if ($team['state'] != 'none' || $team['begin_time'] != $curdaytime) { die('-ERR'); } $partner = Table::Fetch('partner', $team['partner_id']); $city = Table::Fetch('category', $team['city_id']); if ($team && $city && $partner) { $subscribe = Table::Fetch('subscribe', $email, 'email'); $subscribe = array('email' => $email, 'secret' => md5(microtime(true))); if ($subscribe) { mail_subscribe($city, $team, $partner, $subscribe); } } die('+OK'); }