From 486568e33b3a27b2b5bedf42232cccbe13aefe72 Mon Sep 17 00:00:00 2001 From: vguanyiwgd Date: Mon, 22 Apr 2024 11:02:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E4=B9=90=E7=A6=8F?= =?UTF-8?q?=E7=B1=B3=E4=B8=9A=20=E8=87=AA=E5=8A=A8=E8=AE=A2=E9=A4=90?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E9=99=90=E5=88=B6127.0.0.1=E6=89=8D?= =?UTF-8?q?=E8=83=BD=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6a765f5a4d265b109e061687395e1ff390ba8d9b --- .../application/api/controllers/api/User.php | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/backstage/application/api/controllers/api/User.php b/backstage/application/api/controllers/api/User.php index b3c5201..99ddf5e 100644 --- a/backstage/application/api/controllers/api/User.php +++ b/backstage/application/api/controllers/api/User.php @@ -26,7 +26,7 @@ class User extends REST_Controller $this->load->model('User_model', '', TRUE); $this->load->model('Session_model', '', TRUE); - if (in_array($this->uri->segment(3), ['login', 'get_token_by_openid'])) { + if (in_array($this->uri->segment(3), ['login', 'get_token_by_openid', 'lfmy_advance_dc'])) { } else { @@ -2174,12 +2174,30 @@ class User extends REST_Controller ), REST_Controller::HTTP_OK); } + // 乐福米业 刷卡自动明天的订餐 $company_id=4152 + public function lfmy_advance_dc_post(){ + // 限制ip=127.0.0.1 + $ip = $this->input->ip_address(); + if($ip != '127.0.0.1'){ + echo json_encode(array( + 'status' => 0, + 'message' => '非法请求' + )); + exit; + } + $user_id = $this->input->post("user_id",true); + $user_id = intval($user_id); + $company_id = "4152"; + $res = $this->tomorrow_dc($user_id, $company_id); + echo json_encode($res); + } + /** * 预定明天的菜谱 */ - private function tomorrow_dc($user_id){ + private function tomorrow_dc($user_id, $company_id = '4146'){ // 敏卓 - $company_id = '4146'; +// $company_id = '4146'; // 当前时间 $now_time = date("Y-m-d H:i:s"); @@ -2195,7 +2213,7 @@ class User extends REST_Controller if(empty($userInfo)){ return array( 'status' => 0, - 'message' => '未能找到敏卓的用户,用户不存在', + 'message' => '未能找到用户,用户不存在', ); } $cutUsername = cutName($userInfo['username']); @@ -2236,21 +2254,24 @@ class User extends REST_Controller // 读取tb_order_rule,看哪些菜谱(早午晚)还可以订 $dateInfo = $this->db->query("select a.*, b.name as dc_type_name from tb_date a, tb_meal_type b where a.dc_type=b.id and a.id='{$date_id}'")->row_array(); - /** - * 硬写订餐时间,当天 - * 午餐 6.00-8:30 - * 晚餐 11.00-13.30 - */ - $current_time = date("H:i:s"); - if($dateInfo['dc_type'] == '506'){ - if($current_time < "06:00:00" || $current_time > "08:30:00"){ - $message .= "

预定信息: ".$tomorrow_format."的{$dateInfo['dc_type_name']}不在菜谱预定时间内

"; - continue; - } - }elseif($dateInfo['dc_type'] == '507'){ - if($current_time < "11:00:00" || $current_time > "13:30:00"){ - $message .= "

预定信息: ".$tomorrow_format."的{$dateInfo['dc_type_name']}不在菜谱预定时间内

"; - continue; + if($company_id == '4146'){ + // 敏桌 + /** + * 硬写订餐时间,当天 + * 午餐 6.00-8:30 + * 晚餐 11.00-13.30 + */ + $current_time = date("H:i:s"); + if($dateInfo['dc_type'] == '506'){ + if($current_time < "06:00:00" || $current_time > "08:30:00"){ + $message .= "

预定信息: ".$tomorrow_format."的{$dateInfo['dc_type_name']}不在菜谱预定时间内

"; + continue; + } + }elseif($dateInfo['dc_type'] == '507'){ + if($current_time < "11:00:00" || $current_time > "13:30:00"){ + $message .= "

预定信息: ".$tomorrow_format."的{$dateInfo['dc_type_name']}不在菜谱预定时间内

"; + continue; + } } }