增加 乐福米业 自动订餐接口,限制127.0.0.1才能调用

Change-Id: I6a765f5a4d265b109e061687395e1ff390ba8d9b
This commit is contained in:
vguanyiwgd 2024-04-22 11:02:49 +08:00
parent 7cf6f3a24d
commit 486568e33b
1 changed files with 40 additions and 19 deletions

View File

@ -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,6 +2254,8 @@ 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();
if($company_id == '4146'){
// 敏桌
/**
* 硬写订餐时间,当天
* 午餐 6.00-8:30
@ -2253,6 +2273,7 @@ class User extends REST_Controller
continue;
}
}
}
// 根据tb_order_rule规则订餐
/*