static function GetValidVoucher($team_id) { $ccon = array('team_id' => $team_id, 'order_id' => 0); return DB::LimitQuery('voucher', array( 'condition' => $ccon, 'one' => true, )); }
public function get($start, $end, $type = null) { $condition = array("create_time >= {$start}", "create_time <= {$end}"); if ($type !== null) { $condition['type'] = $type; } $result = DB::LimitQuery($this->table, $condition, null, $this->dbType); return $result; }
public static function TipSuccess($order) { $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay'))); foreach ($orders as $order) { $team = Table::Fetch('team', $order['team_id']); $user = Table::Fetch('user', $order['user_id']); mail_tipped($team, $order, $user); } }
public static function SetOrderState($team) { if ($team->close_time == 0) { return; } $c = array('team_id' => $team['id'], 'state' => 'unpay'); $os = DB::LimitQuery('order', array('condition' => $condition)); $ids = Utility::GetColumn($os, 'id'); foreach ($ids as $id) { Table::UpdateCache('order', $id, array('state' => 'expire')); } }
function get_express_id($val) { /* 快递公司id为数字,依此判断直接返回或查询 */ if (is_numeric($val)) { return $val; } $condition = array(); $condition['name'] = $val; $condition['zone'] = 'express'; //DB::Debug(); $order = DB::LimitQuery('category', array('condition' => $condition, 'select' => 'id', 'one' => true)); //dbx($order); //TODO:debug return $order['id']; }
function current_teamcategory($gid = '0') { global $city; $a = array('/team/seconds.php' => '所有'); $categorys = DB::LimitQuery('category', array('condition' => array('zone' => 'group', 'fid' => '0', 'display' => 'Y'), 'order' => 'ORDER BY sort_order DESC, id DESC')); $categorys = Utility::OptionArray($categorys, 'id', 'name'); foreach ($categorys as $id => $name) { $a["/team/seconds.php?gid={$id}"] = $name; } $l = "/team/seconds.php?gid={$gid}"; if (!$gid) { $l = "/team/seconds.php"; } return current_link($l, $a, true); }
public static function CheckOrder($order) { $coupon_array = array('coupon', 'pickup'); $team = Table::FetchForce('team', $order['team_id']); if (!in_array($team['delivery'], $coupon_array)) { return; } if ($team['now_number'] >= $team['min_number']) { //init coupon create; if ($team['now_number'] - $team['min_number'] < 5) { $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay'))); foreach ($orders as $order) { self::Create($order); } } else { self::Create($order); } } }
public static function CheckOrder($order) { $coupon_array = array('express'); $team = Table::FetchForce('team', $order['team_id']); if (!in_array($team['delivery'], $coupon_array) || !option_yes('expressbuysms')) { return; } if ($team['now_number'] >= $team['min_number']) { //init express sms; $last = $team['conduser'] == 'Y' ? 1 : $order['quantity']; if ($team['now_number'] - $team['min_number'] < $last) { $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay'))); foreach ($orders as $order) { sms_express_buy($order); } } else { sms_express_buy($order); } } }
public static function CheckOrder($order) { $coupon_array = array('thirdpart'); $team = Table::FetchForce('team', $order['team_id']); if (!in_array($team['delivery'], $coupon_array)) { return; } if ($team['now_number'] >= $team['min_number']) { //init coupon create; $last = $team['conduser'] == 'Y' ? 1 : $order['quantity']; $offset = max(5, $last); if ($team['now_number'] - $team['min_number'] < $last) { $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay'))); foreach ($orders as $order) { self::Create($order); } } else { self::Create($order); } } }
function get_city($ip = null) { global $INI; $hotcity_keys = array_keys($INI['hotcity']); $cities = DB::LimitQuery('category', array('condition' => array('zone' => 'city'), 'cache' => 2592000)); $ip = $ip ? $ip : Utility::GetRemoteIP(); $url = "http://open.baidu.com/ipsearch/s?wd={$ip}&tn=baiduip"; $res = mb_convert_encoding(Utility::HttpRequest($url), 'UTF-8', 'GBK'); $city = array(); if (preg_match('#来自:<b>(.+)</b>#Ui', $res, $m)) { foreach ($cities as $one) { if (FALSE !== strpos($m[1], $one['name'])) { $city = $one; break; } } } if (!in_array($city['ename'], $hotcity_keys)) { return DB::LimitQuery('category', array('condition' => array('zone' => 'city', 'ename' => $hotcity_keys[0]), 'one' => true)); } return $city; }
$team = Table::Fetch('team', $coupon['team_id']); Session::Set('notice-ok', '<div class=yzcg style= margin-bottom:8px><b>验证成功!</b></div>' . '<div class=ts><span>优券密码:</span>' . $coupon['id'] . '</div>' . '<div class=ts><span>验证时间:</span>' . date('Y-m-d H:i:s', time()) . '</div>' . '<div class=ts><span>项目名称:</span>' . '<a target=_blank href=http://www.milituan.net/team/' . $coupon['team_id'] . '.html>' . $team['product'] . '</a>' . '</div>'); $status = "OK"; } } } } $data = date('Y-m-d H:i:s') . " - " . $login_partner['username'] . " - " . $ruian . " - " . $status; file_put_contents(DIR_CONFIGURE . '/consume.log', $data . "\n", FILE_APPEND); } /** * Recent record / num 5 * @author abei <*****@*****.**> * @version 20131026 */ $now = time(); $list_condition['consume'] = 'Y'; $list_condition[] = "`consume_time` < " . $now . " AND `consume_time` > " . ($now - 86400); if ($login_partner['fid'] == 0) { // i am father $list_condition['partner_id'] = $login_partner['id']; } else { // i am stroe $list_condition['store_id'] = $login_partner['store_id']; } $count = Table::Count('coupon', $list_condition); list($pagesize, $offset, $pagestring) = pagestring($count, 10); $couponList = DB::LimitQuery('coupon', array('condition' => $list_condition, 'order' => 'ORDER BY consume_time DESC', 'size' => $pagesize, 'offset' => $offset)); $partner_ids = Utility::GetColumn($couponList, 'doer_id'); $partners = Table::Fetch('partner', $partner_ids); include template('biz_consume');
$join_number += $one['now_number']; } //今日新品判断 if($ncon == 'new'){ $condition[] = "begin_time >= '{$daytime}'"; } if($sid) $condition['sub_id'] = $sid; if($cid) $condition[] = "((city_ids like '%@{$cid}@%' or city_ids like '%@0@%') or city_id in(0,{$cid}))"; if ($group_id) $condition['group_id'] = $group_id; $count = Table::Count('team', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 100); $teams = DB::LimitQuery('team', array( 'condition' => $condition, 'order' => 'ORDER BY ' . $order . ' now_number DESC', 'size' => $pagesize, 'offset' => $offset, )); //判断是否卖光了 foreach($teams AS $id=>$one){ team_state($one); if (!$one['close_time']) $one['picclass'] = 'isopen'; if ($one['state']=='soldout') $one['picclass'] = 'soldout'; $teams[$id] = $one; } $pagetitle = '七夕情人节:鲜花专场(爱就大声告诉她)'; include template('zt_qx_xh2013_08_09');
'order' => 'ORDER BY id DESC', )); $partners = Utility::OptionArray($partners, 'id', 'title'); $selector = $team['id'] ? 'edit' : 'create'; /* 快递公司信息 */ $express = db::LimitQuery('category',array( 'condition' => array( 'zone' => 'express', 'display'=>'Y'), )); $relate = unserialize($team['express_relate']); /* 合并订单快递和快递表快递数据 */ foreach ($relate as $k=>$v) { $ids[] = $v['id']; $data[$v['id']] = $v['price']; } foreach ($express as $k=>$v) { if (in_array($v['id'] , $ids)) { $express[$k]['relate_data'] = $data[$v['id']]; $express[$k]['checked'] = 'checked'; } } $tplList = DB::LimitQuery('dptpl'); /* 反序列化城市信息 */ $city_ids = array_filter(explode('@', $team['city_ids'])); include template('manage_team_edit');
} $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])); $alls[$key]['recom'] = DB::GetQueryResult("SELECT *,t.id AS tid,p.title AS ptitle, t.title AS ttitle, p.image AS pimage FROM `team` AS t LEFT JOIN `partner` as p ON t.partner_id=p.id WHERE t.group_id={$value['id']} AND t.team_type='normal' AND t.begin_time<'" . $anow . "' AND t.end_time>'" . $anow . "' AND t.is_recom='Y' AND p.display='Y'", false); } /***********************加入的代码:结束*********************************/ die(require_once dirname(__FILE__) . '/multi.php'); } else { $team = $teams = index_get_team($city['id'], $group_id); if ($team && $team['id']) { $_GET['id'] = abs(intval($team['id'])); die(require_once dirname(__FILE__) . '/team.php'); } elseif ($teams) { $disable_multi = true; die(require_once dirname(__FILE__) . '/multi.php'); } } include template('subscribe');
redirect($currefer); } else if ( $_SERVER['HTTP_REFERER'] ) { if (!preg_match('#'.$_SERVER['HTTP_HOST'].'#', $_SERVER['HTTP_REFERER'])) { redirect( 'index.php'); } if (preg_match('#/city#', $_SERVER['HTTP_REFERER'])) { redirect( 'index.php'); } redirect($_SERVER['HTTP_REFERER']); } redirect('index.php'); } } $cities = DB::LimitQuery('category', array( 'condition' => array( 'zone' => 'city') , )); foreach($cities as &$c){ $daytime = time(); $condition = array( 'city_id' => array(0, abs(intval($c['id']))), "begin_time < {$daytime}", "end_time > {$daytime}", ); $c['team_num'] = Table::Count('team',$condition); } $cities = Utility::AssColumn($cities, 'letter', 'ename'); ksort($cities);
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('market'); $condition = array(); list($pagesize, $offset, $pagestring) = pagestring($count, 50); $goods = DB::LimitQuery('goods', array('condition' => $condition, 'order' => 'ORDER BY sort_order DESC, id DESC', 'offset' => $offset, 'pagesize' => $pagesize)); include template('manage_credit_goods');
}); </script> <?php $others_city_id = abs(intval($city['id'])); $daytime = strtotime(date('Y-m-d')); $oc = array('city_id' => array($others_city_id, 0), 'team_type' => 'normal', "begin_time <= '{$daytime}'", "end_time > '{$daytime}'", "audit" => 1); $sterms = DB::LimitQuery('team', array('condition' => $oc, 'order' => 'ORDER BY `sort_order` DESC, `lastbuy_time` DESC, `begin_time` DESC, `now_number` DESC, `id` DESC')); $condition = array('parent_id is null'); $condition['zone'] = 'group'; $condition['display'] = 'Y'; $p_categories = DB::LimitQuery('category', array('condition' => $condition, 'order' => 'ORDER BY czone , sort_order DESC ')); $condition = array('parent_id is not null'); $condition['zone'] = 'group'; $condition['display'] = 'Y'; $c_categories = DB::LimitQuery('category', array('condition' => $condition, 'order' => 'ORDER BY sort_order DESC ')); foreach ($p_categories as $id => $one) { $in = 1; foreach ($c_categories as $cid => $cone) { if ($one['id'] == $cone['parent_id']) { $p_c_c[$one['id']][$in++] = $cone; } } } ?> <div id="ads_content_box" class="coupons-box clear mainwide"> <div class="box clear"> <script type="text/javascript">function cls(){var getId = document.getElementById("ads_content_box");getId.style.display="none";}</script> <s onclick="javascript:cls();"><img src="/static/css/i/close.gif"></s>
<?php require_once (dirname(dirname(dirname(__FILE__))) . '/app.php'); $partnerList = DB::LimitQuery('partner',array( 'condition'=>array('fid'=>0), )); //商户名称,电话,地址,负责人手机号码,最近多少时间内做个团购 $kn = array( 'id' => '商家ID', 'title' => '商家名称', 'mobile' => '商家电话', 'address' => '地址', 'phone' => '负责人电话', 'team_create' => '最近团购时间', ); foreach($partnerList as $k=>$partner){ $sql = "SELECT * FROM `team` WHERE `partner_id`=".$partner['id'].' ORDER BY id DESC'; $team = DB::GetQueryResult($sql,true); $partner['team_create'] = date('Y-m-d',$team['begin_time']); $partnerList[$k] = $partner; } $name = "milituan_partner_".date('Ymd'); down_xls($partnerList, $kn, $name); ?>
'role_id'=>$role_id, 'item_id'=>$v ); DB::Insert('rbac_role_resource',$arr); } Session::Set('notice', '配置角色权限成功'); redirect( WEB_ROOT . "/manage/user/auth.php?action=resource&id=".$role_id); } $items = DB::LimitQuery('rbac_auth_items'); $relation = DB::LimitQuery('rbac_role_resource',array( 'condition'=>array('role_id'=>$role_id) )); foreach($relation as $r){ $format_relation[] = $r['item_id']; } include template('manage_user_auth_resource'); } // 角色列表 else { $roles = DB::LimitQuery('rbac_auth_role'); include template('manage_user_auth'); }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); $condition = array(); ($zone = strval($_GET['zone'])) || ($zone = 'city'); if ($zone) { $condition['zone'] = $zone; } $cates = get_zones(); $count = Table::Count('category', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 20); $categories = DB::LimitQuery('category', array('condition' => $condition, 'order' => 'ORDER BY display ASC, sort_order DESC, id DESC', 'size' => $pagesize, 'offset' => $offset)); include template('manage_category_index');
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; header('Content-Type: application/xml; charset=UTF-8'); $daytime = strtotime(date('Y-m-d')); $condition = array('team_type' => 'normal', "begin_time <= {$daytime}", "end_time > {$daytime}", "audit" => 1); $teams = DB::LimitQuery('team', array('condition' => $condition, 'order' => 'ORDER BY sort_order DESC, id DESC')); $groups = option_category('group', false, false); $oa = array(); $si = array('sitename' => $INI['system']['sitename'], 'wwwprefix' => $INI['system']['wwwprefix'], 'imgprefix' => $INI['system']['imgprefix']); foreach ($teams as $one) { $city = Table::Fetch('category', $one['city_id']); $group = Table::Fetch('category', $one['group_id']); $item = array(); $item['loc'] = $si['wwwprefix'] . "/team.php?id={$one['id']}"; $item['data'] = array(); $item['data']['display'] = array(); $o = array(); $o['website'] = $INI['system']['sitename']; $o['siteurl'] = $INI['system']['wwwprefix']; ($o['city'] = $city['name']) || ($o['city'] = '全国'); $o['title'] = $one['title']; $o['class'] = $groups[$one['group_id']]; $o['image'] = $si['imgprefix'] . '/static/' . $one['image']; $o['startTime'] = $one['begin_time']; $o['endTime'] = $one['end_time']; $o['value'] = $one['market_price']; $o['price'] = $one['team_price']; if ($one['market_price'] > 0) { $o['rebate'] = moneyit(10 * $one['team_price'] / $one['market_price']); } else {
$count_ask = Table::Count('apply', array('type' => 'askrefund','status' => 'ask')); $count_do = Table::Count('apply', array('type' => 'askrefund','status' => 'do')); $count_be = Table::Count('apply', array('type' => 'askrefund','status' => 'be')); $count_no = Table::Count('apply', array('type' => 'askrefund','status' => 'no')); $count_cancel = Table::Count('apply', array('type' => 'askrefund','status' => 'cancel')); $summary = Table::Count('apply', $condition, 'remoney'); $count = Table::Count('apply', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 20); $applys = DB::LimitQuery('apply', array( 'condition' => $condition, 'order' => 'ORDER BY create_time DESC', 'size' => $pagesize, 'offset' => $offset, )); $option_reasons = array( '商家说可以直接以团购价到店消费' => '商家说可以直接以团购价到店消费', '预约不上' => '预约不上', '去过了,不太满意' => '去过了,不太满意', '朋友/网上评价不好' => '朋友/网上评价不好', '买多了/买错了' => '买多了/买错了', '计划有变,没时间消费' => '计划有变,没时间消费', '后悔了,不想要了' => '后悔了,不想要了', ); $orders = Table::Fetch('order', Utility::GetColumn($applys, 'order_id'));
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; //今日接受调查人次 $daytime = strtotime(date('Y-m-d')); $ip = Utility::GetRemoteIp(); $action = $_GET['action'] ? $_GET['action'] : ''; if ($action == 'addSuccess') { Session::Set('notice', '提交数据成功,感谢您的参与。'); redirect(WEB_ROOT . '/vote/index.php'); } $question_list = DB::LimitQuery('vote_question', array('condition' => array("`is_show` = '1'"), 'order' => 'ORDER BY `order` , id', 'size' => 100, 'offset' => $offset)); foreach ($question_list as $key => $question) { $options_list = DB::LimitQuery('vote_options', array('condition' => array("`question_id` = '{$question['id']}'", "`is_show` = '1'"), 'order' => 'ORDER BY `order` , id', 'size' => 100, 'offset' => $offset)); $question_list[$key]['options_list'] = $options_list; } $pagetitle = '用户调查'; include template('vote_index');
need_auth('market'); $id = abs(intval($_GET['id'])); $team = Table::Fetch('team', $id); if ($team['delivery'] == 'express') { $oc = array('state' => 'pay', 'team_id' => $id); $orders = DB::LimitQuery('order', array('condition' => $oc, 'order' => 'ORDER BY pay_time DESC, id DESC')); $kn = array('buy_id' => '支付序号', 'username' => '用户名', 'email' => '用户邮箱', 'realname' => '姓名', 'mobile' => '手机号码', 'address' => '地址', 'quantity' => '数量', 'condbuy' => '选项', 'remark' => '备注', 'date' => '支付时间'); foreach ($orders as $k => $o) { $o['date'] = date('Y-m-d H:i', $o['pay_time']); $orders[$k] = $o; } $name = "team_{$id}_" . date('Ymd'); down_xls($orders, $kn, $name); } else { $cc = array('team_id' => $id); $coupons = DB::LimitQuery('coupon', array('condition' => $cc, 'order' => 'ORDER BY create_time ASC')); $users = Table::Fetch('user', Utility::GetColumn($coupons, 'user_id')); $orders = Table::Fetch('order', Utility::GetColumn($coupons, 'order_id')); $kn = array('buy_id' => '支付序号', 'username' => '用户名', 'email' => '用户邮箱', 'realname' => '姓名', 'mobile' => '手机号码', 'condbuy' => '选项', 'id' => "{$INI['system']['couponname']}编号", 'secret' => "{$INI['system']['couponname']}密码", 'cmobile' => '消费手机', 'date' => '生成时间', 'remark' => '备注'); foreach ($coupons as $k => $o) { $u = $users[$o['user_id']]; $r = $orders[$o['order_id']]; $o['buy_id'] = $r['buy_id']; $o['username'] = $u['username']; $o['realname'] = $u['realname']; $o['condbuy'] = $r['condbuy']; $o['mobile'] = $u['mobile']; $o['email'] = $u['email']; $o['cmobile'] = $r['mobile'] ? $r['mobile'] : $u['mobile']; $o['date'] = date('Y-m-d H:i', $o['create_time']); $o['remark'] = $r['remark'];
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('market'); $like = strval($_GET['like']); $cs = strval($_GET['cs']); /* build condition */ $condition = array(); if ($like) { $condition[] = "email like '%" . mysql_escape_string($like) . "%'"; } if ($cs) { $cscity = DB::LimitQuery('category', array('condition' => array('zone' => 'city', 'name' => $cs), 'one' => true)); if ($cscity) { $condition['city_id'] = $cscity['id']; } else { $cs = null; } } /* end */ $count = Table::Count('subscribe', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 50); $subscribes = DB::LimitQuery('subscribe', array('condition' => $condition, 'order' => 'ORDER BY id DESC', 'size' => $pagesize, 'offset' => $offset)); $city_ids = Utility::GetColumn($subscribes, 'city_id'); $cities = Table::Fetch('category', $city_ids); include template('manage_misc_subscribe');
} $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; die(require_once dirname(__FILE__) . '/multi.php'); } else { $team = $teams = index_get_team($city['id'], $group_id); if ($team && $team['id']) { $_GET['id'] = abs(intval($team['id'])); die(require_once dirname(__FILE__) . '/team.php'); } elseif ($teams) { $disable_multi = true; die(require_once dirname(__FILE__) . '/multi.php'); } } include template('subscribe');
if ($pbday) { $pbtime = strtotime($pbday); $condition[] = "pay_time >= '{$pbtime}'"; } if ($peday) { $petime = strtotime($peday); $condition[] = "pay_time <= '{$petime}'"; } /* end fiter */ $count = Table::Count('order', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 20); $orders = DB::LimitQuery('order', array( 'condition' => $condition, 'order' => 'ORDER BY id DESC', 'size' => $pagesize, 'offset' => $offset, )); $pay_ids = Utility::GetColumn($orders, 'pay_id'); $pays = Table::Fetch('pay', $pay_ids); $user_ids = Utility::GetColumn($orders, 'user_id'); $users = Table::Fetch('user', $user_ids); $team_ids = Utility::GetColumn($orders, 'team_id'); $teams = Table::Fetch('team', $team_ids); include template('manage_order_index');
$table->image = upload_image('upload_image', $team['image'], 'team', true); $table->image1 = upload_image('upload_image1', $team['image1'], 'team'); $table->image2 = upload_image('upload_image2', $team['image2'], 'team'); //team_type == goods if ($table->team_type == 'goods') { $table->min_number = 1; } $error_tip = array(); if (!$error_tip) { if ($table->update($insert)) { print $table->title; $field = strtoupper($table->conduser) == 'Y' ? null : 'quantity'; $now_number = Table::Count('order', array('team_id' => $table->id, 'state' => 'pay'), $field); $need_update = array('now_number' => $now_number); /* 增加了总数,未卖完状态 */ if ($table->max_number > $table->now_number) { $need_update['close_time'] = 0; } Table::UpdateCache('team', $table->id, $need_update); Session::Set('notice', '团购修改成功'); Utility::Redirect(WEB_ROOT . "/biz/index.php"); } else { Session::Set('error', '修改团信息失败,请检查系统环境?'); } } } $groups = DB::LimitQuery('category', array('condition' => array('zone' => 'group'))); $groups = Utility::OptionArray($groups, 'id', 'name'); $partners = DB::LimitQuery('partner', array('order' => 'ORDER BY id DESC')); $partners = Utility::OptionArray($partners, 'id', 'title'); include template('biz_coupon_edit');
if(!empty($rtr['images'])){ $imgs = explode('@', $rtr['images']); $rtr['imgList'] = $imgs; }else{ $rtr['imgList'] = null; } if(!empty($rtr['username'])){ $username2=mb_substr($rtr['username'],0,1,'utf-8')."**".mb_substr($rtr['username'],mb_strlen($rtr['username'],'utf-8')-1,1,'utf-8'); $rtr['username2']=$username2; } if(!empty($rtr['create_time'])){ $dptime=date("m-d",$ri['create_time']); $rtr['dptime']=$dptime; } $itemList = DB::LimitQuery('order_dp_item',array( 'condition'=>array('order_id'=>$rtr['order_id']) )); $rtr['itemlist']=$itemList; $dp_item_ids = Utility::GetColumn($itemList, 'tpl_item_id'); $dpitems = Table::Fetch('dptpl_item', $dp_item_ids); } include template('team_view'); function getRecentGoods($id){ $TempNum = 5;//cookie里面存储多少个浏览记录 if(isset($_COOKIE['RecentlyGoods'])){ //判断是否设置了COOKIE $RecentlyGoods=$_COOKIE['RecentlyGoods']; $RecentlyGoodsArray=explode(",", $RecentlyGoods);
if ( $order['state']=='unpay') { redirect( WEB_ROOT . "/team.php?id={$order['team_id']}"); } $team = Table::FetchForce('team', $order['team_id']); $partner = Table::Fetch('partner', $team['partner_id']); $express = ($team['delivery']=='express'); if ( $express ) { $option_express = Utility::OptionArray(Table::Fetch('category', array('express'), 'zone'), 'id', 'name'); } if ( $team['delivery'] == 'coupon' ) { $cc = array( 'user_id' => $login_user['id'], 'team_id' => $order['team_id'], 'order_id' => $order['id'], ); $coupons = DB::LimitQuery('coupon', array( 'condition' => $cc, )); } else if ( $team['delivery'] == 'voucher' ) { $cc = array( 'user_id' => $login_user['id'], 'team_id' => $order['team_id'], 'order_id' => $order['id'], ); $vouchers = DB::LimitQuery('voucher', array( 'condition' => $cc, )); } include template('order_view');