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) { // //} return $data; } function get_take_info($dining_hall_id, $userid) { global $db; $today = time(); $dates = get_today_dates($dining_hall_id); $take_codes = array(); $uInfo = $db->get_one("select * from tb_user where id=".intval($userid)); $user_type = $uInfo['type_id']; foreach($dates as $date) { $dc_type = $date['dc_type']; $meal_info = $db->get_one("select * from tb_meal_type where status=1 and id=".intval($dc_type)); $start_time = $meal_info['start_time']; $end_time = $meal_info['end_time']; $nowtime = date('H:i'); $meal_info2 = $db->get_one("select * from tb_meal_type_user_time where meal_type_id={$dc_type} and user_type_id=".intval($user_type)); if($meal_info2) { $start_time = $meal_info2['start_time']; $end_time = $meal_info2['end_time']; } if( $nowtime >= $start_time && $nowtime < $end_time) { $order = $db->get_one("select a.* from tb_order a where uid = {$userid} and type=1 and date_id=".$date['id']." and state_id in (6)"); if(!$order) $order = $db->get_one("select a.* from tb_order a where uid = {$userid} and type=1 and date_id=".$date['id']." and state_id in (3)"); if ($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) exit; $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}' and a.enabled not in (0, -99) and b.state=1"); if(!$uInfo) { echoRs(0, 'nouser'); } $take_codes = get_take_info($ftid, $uInfo['id']); $data = array('user' => $uInfo); if($take_codes) $data['take_code'] = implode(",", $take_codes); //echoRs(1, 'ok', $info); //临时录入日志 $db->get_one("insert into tb_icard_record_log(params,record_datetime,result) values('{$icid}',now(),'".$data['take_code']."')"); $info = array( 'status' => 1, 'message' => 'ok' ); $info = array_merge($info, $data); $json = json_encode($info); echo $json; exit; } $ftid = intval($_GET['ftid']); $channelid = intval($_GET['channelid']); if(!$ftid) { die("no ftid!"); } $ftInfo = $db->get_one("select * from tb_dining_hall where id=".$ftid); if(!$ftInfo) { die("no ftid dining_hall!"); } $company_id = intval($ftInfo['company_id']); $companyInfo = $db->get_one("select * from tb_company where id=".$company_id); //传媒集团临时改增加 +号,为免影响其他在用用户,做临时跳转 if($company_id == 34) { $pay_url = "qc_pay_cm.php"; } else { $pay_url = "qc_pay.php"; } $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; } //增加判断是否显示取货码入口 $showqh = false; $rs = $db->get_one("select * from tb_goods_place where code= '".$ftid."_".$channelid."' and enabled = 1"); if($rs) { $showqh = true; } ?> 取餐
请刷取餐二维码