get_all("select * from tb_date where dining_hall_id={$dining_hall_id} and dc_date = '".date("Y-m-d")."'"); $nowtime = date('H:i'); $all = array(); foreach($data as $item) { $dc_type = $item['dc_type']; $meal_info = $db->get_one("select * from tb_meal_type where status=1 and id=".intval($dc_type)); if( $nowtime >= $meal_info['start_time'] && $nowtime < $meal_info['end_time']) { $all[] = $item; } } return $all; } function get_take_info($dining_hall_id, $userid) { global $db; $today = time(); $dates = get_today_dates($dining_hall_id); $take_codes = array(); foreach($dates as $date) { $orders = $db->get_all("select a.* from tb_order a where uid = {$userid} and type=1 and date_id=".$date['id']." and state_id in (6)"); if(!$orders) { $orders = $db->get_all("select a.* from tb_order a where uid = {$userid} and type=1 and date_id=".$date['id']." and state_id in (3, 6)"); } foreach($orders as $order) { $take_code = $order['take_food_code']; $take_codes[] = $take_code; } } return $take_codes; } if($act == 'get_takecode') { $icid = trim($_POST['icid']); $ftid = trim($_POST['ftid']); if(!$icid || !$ftid || !is_numeric($icid)) exit; $icid2 = idcard_tofan($icid); $uInfo = $db->get_one("select a.id,a.username,a.cellphone,a.deptname,a.area_id from tb_user a,tb_user_idcard b where b.user_id=a.id and (cardno='{$icid}' or cardno='{$icid2}') and a.enabled not in (0, -99) and b.state=1"); if(!$uInfo) { echoRs(0, 'nouser'); } $take_codes = get_take_info($ftid, $uInfo['id']); $info = array('user' => $uInfo); if($take_codes) $info['take_code'] = implode(",", $take_codes); echoRs(1, 'ok', $info); exit; } if($act == 'get_takecode_face') { $facecard = trim($_POST['facecard']); $ftid = trim($_POST['ftid']); if(!$facecard || !$ftid) exit; $uInfo = $db->get_one("select b.* from tb_user_face a, tb_user b where a.user_id=b.id and b.enabled = '1' and a.card='{$facecard}'"); if(!$uInfo) { echoRs(0, 'nouser'); } $take_codes = get_take_info($ftid, $uInfo['id']); $info = array('user' => $uInfo); if($take_codes) $info['take_code'] = implode(",", $take_codes); echoRs(1, 'ok', $info); exit; } $ftid = intval($_GET['ftid']); $channelid = intval($_GET['channelid']); if(!$ftid) { die("no ftid!"); } if($channelid) { $cInfo = $db->get_one("select * from tb_pos_channel where id=".$channelid); } $qs = $_SERVER['QUERY_STRING']; $qs = preg_replace('/&ftid=[^&]+/', '', $qs); $qs = preg_replace('/ftid=[^&]+(&|$)/', '', $qs); $qs = preg_replace('/&channelid=[^&]+/', '', $qs); $qs = preg_replace('/channelid=[^&]+(&|$)/', '', $qs); $iscomplete = $_GET['iscomplete']; if(!$iscomplete && !$_GET['code']) { /*if($ftid >= 1000) { require_once(dirname(__FILE__)."/common.php"); $row = $db->get_one("select * from tb_goods_place where code = '{$ftid}'"); if(!$row) { die("ftid err!"); } if($row['type'] == 1) { //付款码 header("Location: qc_pay.php?".$_SERVER['QUERY_STRING']."&iscomplete=1¬showbt=1"); exit; } else if($row['type'] == 2) { //取货 header("Location: qc_mall.php?".$_SERVER['QUERY_STRING']."&iscomplete=1"); exit; } } $time = date("Hi"); if($time >= '0600' && $time <= '0830') { //早餐 header("Location: qc_pay.php?".$_SERVER['QUERY_STRING']."&iscomplete=1"); exit; }*/ header("Location: ?".$_SERVER['QUERY_STRING']."&iscomplete=1"); exit; } ?> 取餐
请刷取餐二维码