469 lines
19 KiB
PHP
469 lines
19 KiB
PHP
|
<?
|
|||
|
header("Access-Control-Allow-Origin: *");
|
|||
|
header("Content-type:text/html;charset=utf-8");
|
|||
|
/*if($act == 'lfyy_get_parks') {
|
|||
|
$data = $db->get_all("select * from tb_lfyy_park order by id");
|
|||
|
|
|||
|
$list = array();
|
|||
|
$places = array();
|
|||
|
foreach($data as $item) {
|
|||
|
$place = $item['place'];
|
|||
|
$places[$place] = 1;
|
|||
|
unset($item['place']);
|
|||
|
$list[$place][] = $item;
|
|||
|
}
|
|||
|
$list2 = array();
|
|||
|
foreach($places as $place => $v) {
|
|||
|
$list2[] = array(
|
|||
|
'place' => $place,
|
|||
|
'park_list' => $list[$place],
|
|||
|
);
|
|||
|
}
|
|||
|
echoRs(1, 'ok', array('parks' => $list2));
|
|||
|
exit;
|
|||
|
}*/
|
|||
|
$xqInfo = array('0' => '日', '1' => '一', '2' => '二', '3' => '三', '4' => '四', '5' => '五', '6' => '六',);
|
|||
|
$order_statusInfo = array(
|
|||
|
0 => '已下单',
|
|||
|
1 => '已理发',
|
|||
|
2 => '已取消',
|
|||
|
);
|
|||
|
if($act == 'lfyy_get_parks') {
|
|||
|
$user = check_token();
|
|||
|
$uid = $user['id'];
|
|||
|
$company_id = $user['company_id'];
|
|||
|
$dining_hall_id = $user['dining_hall_id'];
|
|||
|
|
|||
|
//$park_id = intval($_GET["park_id"]);
|
|||
|
//if($park_id <= 0) exit;
|
|||
|
|
|||
|
//$parkInfo = $db->get_one("select * from tb_lfyy_park where id=". $park_id);
|
|||
|
//if(!$parkInfo) exit;
|
|||
|
$bookList = array();
|
|||
|
$bookList = array(
|
|||
|
array(
|
|||
|
'id' => '5',
|
|||
|
'name' => '洗吹(20美发币)',
|
|||
|
), array(
|
|||
|
'id' => '3',
|
|||
|
'name' => '洗剪吹(30美发币)',
|
|||
|
));
|
|||
|
$lfaccountList = $db->get_one("select a.* from tb_account a WHERE supplier_id =119 and user_id = ".$uid);
|
|||
|
$partList = $db->get_all("select * from tb_lfyy_park where company_id='{$company_id}' and dining_hall_id like'%{$dining_hall_id}%' and enabled = 1 order by id");
|
|||
|
$tList = $db->get_all("select * from tb_lfyy_times where company_id='{$company_id}' order by start_time ");
|
|||
|
$holidayList = $db->get_all("select * from tb_lfyy_holiday where status=1 order by id ");
|
|||
|
|
|||
|
$list = array();
|
|||
|
$places = array();
|
|||
|
foreach($partList as $item) {
|
|||
|
$place = $item['place'];
|
|||
|
$places[$place] = 1;
|
|||
|
unset($item['place']);
|
|||
|
$list[$place][] = $item;
|
|||
|
}
|
|||
|
$all = array();
|
|||
|
foreach($places as $place => $v) {
|
|||
|
$partList = $list[$place];
|
|||
|
$days = array();
|
|||
|
for($i = 0; $i < 3; $i++) {
|
|||
|
$dateInfo = array();
|
|||
|
$time = strtotime("+{$i} day");
|
|||
|
// $time =strtotime("+{$i} day",strtotime("2023-04-03"));
|
|||
|
$date = date('Y-m-d', $time);
|
|||
|
$xq = date('w', $time);
|
|||
|
$dateInfo['xq'] = "周".$xqInfo[$xq];
|
|||
|
//判断是不是假期
|
|||
|
$isho = $db->get_one("select * from tb_holidays where year = '".date('Y',$time)."' and day = '".date('m-d',$time)."'");
|
|||
|
if ($isho){
|
|||
|
if ($isho['type'] == 1)$xq = 0;
|
|||
|
if ($isho['type'] == 2)$xq = 1;
|
|||
|
}
|
|||
|
if (empty($isho)) $isho['type'] == 1;
|
|||
|
|
|||
|
$dateInfo['date'] = $date;
|
|||
|
|
|||
|
$times = array();
|
|||
|
foreach($tList as $item2) {
|
|||
|
if($xq == 0 || $xq == 6){if ($item2['end_time'] > '17:40') continue;}
|
|||
|
else if ($item2['start_time'] < '12:00') continue;
|
|||
|
$start_time = $item2['start_time'];
|
|||
|
$end_time = $item2['end_time'];
|
|||
|
$start_time_date = $date." ".$start_time;
|
|||
|
$time_id = $item2['id'];
|
|||
|
if(strtotime($start_time_date) - time() < 300) continue;
|
|||
|
|
|||
|
$timeInfo = array('time_id' => $time_id, 'start_time' => $start_time, 'end_time' => $end_time);
|
|||
|
$parks = array();
|
|||
|
foreach($partList as $item1) {
|
|||
|
$park_id = $item1['id'];
|
|||
|
$status = 1;
|
|||
|
$status_name = '可预订';
|
|||
|
|
|||
|
if(strtotime($start_time_date) - time() < 300) {
|
|||
|
$status = 4;
|
|||
|
$status_name = '已过期';
|
|||
|
continue;
|
|||
|
} else {
|
|||
|
foreach ($holidayList as $h_k =>$h_v){
|
|||
|
if($date == $h_v['day'] && $time_id == $h_v['time_id'] && $park_id == $h_v['park_id']){
|
|||
|
$status = 5;
|
|||
|
$status_name = '休假中';
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
if($status != 5){
|
|||
|
$rows = $db->get_all("select * from tb_lfyy_order where company_id='{$company_id}' and park_id = {$park_id} and time_id = {$time_id} and `date` = '{$date}' and status != 2");
|
|||
|
// 判断是否含有自己的预约
|
|||
|
$orderUserId = array_column($rows, 'uid');
|
|||
|
if(in_array($uid, $orderUserId)){
|
|||
|
// 含有自己
|
|||
|
$status = 2;
|
|||
|
$status_name = '已预订';
|
|||
|
}elseif(count($rows) >= 1){
|
|||
|
$status = 3;
|
|||
|
$status_name = '预订已满';
|
|||
|
continue;
|
|||
|
}else{
|
|||
|
$status = 1;
|
|||
|
$status_name = '可预订';
|
|||
|
}
|
|||
|
|
|||
|
// $row = $db->get_one("select * from tb_lfyy_order where company_id='{$company_id}' and park_id = {$park_id} and time_id = {$time_id} and `date` = '{$date}' and status != 2");
|
|||
|
// if($row) {
|
|||
|
// if($row['uid'] == $uid) $status = 2;
|
|||
|
// else $status = 3;
|
|||
|
// $status_name = '已预订';
|
|||
|
// }
|
|||
|
}
|
|||
|
}
|
|||
|
$parks[] = array('park_id' => $park_id, 'park_name' => $item1['name'], 'status' => $status, 'status_name' => $status_name, 'fee' => $item1['fee'],'lf_phone' => $item1['cellphone']);
|
|||
|
}
|
|||
|
$timeInfo['parts'] = $parks;
|
|||
|
$times[] = $timeInfo;
|
|||
|
}
|
|||
|
if(empty($times)){
|
|||
|
continue;
|
|||
|
}
|
|||
|
$dateInfo['times'] = $times;
|
|||
|
|
|||
|
$days[] = $dateInfo;
|
|||
|
}
|
|||
|
$info1 = array('place' => $place, 'days' => $days);
|
|||
|
|
|||
|
|
|||
|
$all[] = $info1;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
$partList = $list[$place];
|
|||
|
|
|||
|
$timesList = array();
|
|||
|
for($i = 0; $i < 7; $i++) {
|
|||
|
$date = date('Y-m-d', strtotime("+{$i} day"));
|
|||
|
|
|||
|
foreach($partList as $item1) {
|
|||
|
|
|||
|
$times = array();
|
|||
|
foreach($tList as $item2) {
|
|||
|
$start_time = $item2['start_time'];
|
|||
|
$end_time = $item2['end_time'];
|
|||
|
|
|||
|
$status = 1;
|
|||
|
$status_name = '可预订';
|
|||
|
$start_time_date = $date." ".$start_time;
|
|||
|
if(strtotime($start_time_date) - time() < 300) {
|
|||
|
$status = 3;
|
|||
|
$status_name = '已过期';
|
|||
|
} else {
|
|||
|
|
|||
|
}
|
|||
|
$times[] = array('start_time' => $start_time, 'end_time' => $end_time, 'status' => $status, 'status_name' => $status_name, 'status_name' => $status_name);
|
|||
|
}
|
|||
|
}
|
|||
|
$timesList[] = array('date' => $date, 'times' => $times);
|
|||
|
}
|
|||
|
*/
|
|||
|
//echo json_encode($all);exit;
|
|||
|
if (!isset($lfaccountList['account'])) $lfaccount = 0;
|
|||
|
else $lfaccount = $lfaccountList['account'];
|
|||
|
$userInfo = $db->get_one("select * from tb_user where id='{$uid}'");
|
|||
|
echoRs(1, 'ok', array('data' => array('list' => $all, 'user' => array('username' => $userInfo['username'], 'cellphone' => $userInfo['cellphone'] , 'account' => $lfaccount ) ,'bookList' => $bookList)));
|
|||
|
exit;
|
|||
|
}
|
|||
|
|
|||
|
if($act == 'lfyy_add_order') {
|
|||
|
$user = check_token();
|
|||
|
$uid = $user['id'];
|
|||
|
$area_id = $user['area_id'];
|
|||
|
$company_id = $user['company_id'];
|
|||
|
|
|||
|
$date = trim($_POST["date"]);
|
|||
|
$park_id = intval($_POST["park_id"]);
|
|||
|
$time_id = intval($_POST["time_id"]);
|
|||
|
|
|||
|
$username = trim($_POST["username"]);
|
|||
|
$cellphone = trim($_POST["cellphone"]);
|
|||
|
$yy_type = trim($_POST["yy_type"]);
|
|||
|
/*$date = '2020-09-04';
|
|||
|
$park_id = '1';
|
|||
|
$time_id = '3';
|
|||
|
$cph = '粤ESG180';*/
|
|||
|
|
|||
|
$dateList = $db->get_all("select * from tb_lfyy_order where status != 2 and uid = '{$uid}' and date like '".date('Y-m')."%'");
|
|||
|
// if (count($dateList)>= 2){
|
|||
|
// echoRs(0, '本月预约次数已满!');
|
|||
|
// }
|
|||
|
if($date == '' || $park_id <= 0 || $time_id <= 0 || $username == '' || $cellphone == '' || $yy_type == '') {
|
|||
|
echoRs(0, '参数不完整!');
|
|||
|
}
|
|||
|
if(strlen($cellphone) != 11){
|
|||
|
echoRs(0, '请输入正确的手机号!');
|
|||
|
}
|
|||
|
if(date('Y-m-d', strtotime($date)) != $date) {
|
|||
|
echoRs(0, '日期格式错误!');
|
|||
|
}
|
|||
|
$parkInfo = $db->get_one("select * from tb_lfyy_park where company_id='{$company_id}' and id=". $park_id);
|
|||
|
if(!$parkInfo) {
|
|||
|
echoRs(0, 'park_id不存在!');
|
|||
|
}
|
|||
|
$timeInfo = $db->get_one("select * from tb_lfyy_times where company_id='{$company_id}' and id = ". $time_id);
|
|||
|
if(!$timeInfo) {
|
|||
|
echoRs(0, 'time_id不存在!');
|
|||
|
}
|
|||
|
// 判断该理发师是否休假
|
|||
|
$checkHoliday = $db->get_one("select * from tb_lfyy_holiday where park_id='{$park_id}' and time_id='{$time_id}' and day='{$date}' and status=1");
|
|||
|
if($checkHoliday){
|
|||
|
echoRs(0, '该理发师正在休假中,不能预约!');
|
|||
|
}
|
|||
|
|
|||
|
$start_time = $timeInfo['start_time'];
|
|||
|
$end_time = $timeInfo['end_time'];
|
|||
|
$fee = $parkInfo['fee'];
|
|||
|
|
|||
|
$datetime = $date." ".$start_time;
|
|||
|
if(strtotime($datetime) - time() < 300) {
|
|||
|
echoRs(0, '该时间段已过期!');
|
|||
|
}
|
|||
|
|
|||
|
$rows = $db->get_all("select * from tb_lfyy_order where company_id='{$company_id}' and park_id = {$park_id} and time_id = {$time_id} and `date` = '{$date}' and status != 2");
|
|||
|
// 判断是否含有自己的预约
|
|||
|
$orderUserId = array_column($rows, 'uid');
|
|||
|
if(in_array($uid, $orderUserId)){
|
|||
|
// 含有自己
|
|||
|
echoRs(0, "你已预约过,无需重复预约");
|
|||
|
}elseif(count($rows) >= 1){
|
|||
|
echoRs(0, "该理发师{$start_time} - {$end_time}时间段已被人预定!请换个时间段!");
|
|||
|
}
|
|||
|
|
|||
|
// 判断当前地点,当前时间段是否已经预约过,不能同一时间段预约多次
|
|||
|
$park_place_list = $db->get_all("select * from tb_lfyy_park where place='{$parkInfo['place']}' and company_id='{$company_id}'");
|
|||
|
$park_ids = array_column($park_place_list, 'id');
|
|||
|
$park_ids = join(',', $park_ids);
|
|||
|
|
|||
|
$checkRepeat = $db->get_one("select * from tb_lfyy_order where company_id='{$company_id}' and park_id in ({$park_ids}) and time_id = {$time_id} and `date` = '{$date}' and uid = '{$uid}' and status != 2");
|
|||
|
|
|||
|
if($checkRepeat >= 1){
|
|||
|
echoRs(0, "{$start_time} - {$end_time}时间段,已被预定!");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// require_once("include/pay.inc.php");
|
|||
|
/*$recharge = array("order_id" => $oid, "type" => 6, "result" => 1, "user_area_id" => $user['area_id'], 'ftid' => '1005');
|
|||
|
$r = gpay_update_user_account_one($uid, '-', $fee, 0, $recharge, 'all');*/
|
|||
|
$payInfo = array(
|
|||
|
'kkfrom' => 'fl',
|
|||
|
'rtype' => '7',
|
|||
|
'supplier_id' => 119,
|
|||
|
);
|
|||
|
if ($yy_type == 5) $count = 20;
|
|||
|
if ($yy_type == 3) $count = 30;
|
|||
|
// $r = gpay_pay_user_account_one($uid, $fee, $payInfo);
|
|||
|
|
|||
|
// if($r != 'suc') {
|
|||
|
// $db->query("delete from tb_lfyy_order where id=".$oid);
|
|||
|
// echoRs(0, '扣款失败!');
|
|||
|
// }
|
|||
|
// if ($uid == 18151 || $uid == 15789 || $uid == 20542 ){
|
|||
|
//小岛理发扣费功能
|
|||
|
$r = gpay_pay_user_account_one($uid, floatval($count), $payInfo);
|
|||
|
if ($r == 'suc') {
|
|||
|
$db->query("insert into tb_lfyy_order set uid = '-{$uid}', park_id = '{$park_id}', time_id = '{$time_id}', `date` = '{$date}', username = '{$username}', cellphone = '{$cellphone}', fee = {$fee}, status = '0', addtime = now(), company_id='{$company_id}', yy_type='{$yy_type}'");
|
|||
|
$oid = $db->insert_id();
|
|||
|
$db->query("update tb_lfyy_order set uid = '{$uid}' where id=".$oid);
|
|||
|
$admin = $db->get_one("select * from tb_admin where id = 4413");
|
|||
|
$user = $db->get_one("select * from tb_user where id = ".$uid);
|
|||
|
$cellphone = $admin['cellphone'];
|
|||
|
$text = "用户:".$user['username']." 已成功预约了。 ".$parkInfo['place']."理发店的".$parkInfo['name']."预约日期是 {$date},预约时间为 {$start_time} - {$end_time}。";
|
|||
|
send_sms($cellphone,$text);
|
|||
|
echoRs(1, "预订理发师 ".$parkInfo['place'].$parkInfo['name']." {$start_time} - {$end_time}时间段,使用了{$count}发币!");
|
|||
|
}else{
|
|||
|
echoRs(1, "预订理发师 ".$parkInfo['place'].$parkInfo['name']." {$start_time} - {$end_time}时间段,预约失败!");
|
|||
|
}
|
|||
|
// }else{
|
|||
|
// $db->query("insert into tb_lfyy_order set uid = '-{$uid}', park_id = '{$park_id}', time_id = '{$time_id}', `date` = '{$date}', username = '{$username}', cellphone = '{$cellphone}', fee = {$fee}, status = '0', addtime = now(), company_id='{$company_id}', yy_type='{$yy_type}'");
|
|||
|
// $oid = $db->insert_id();
|
|||
|
// $db->query("update tb_lfyy_order set uid = '{$uid}' where id=".$oid);
|
|||
|
// $admin = $db->get_one("select * from tb_admin where id = 4413");
|
|||
|
// $user = $db->get_one("select * from tb_user where id = ".$uid);
|
|||
|
// $cellphone = $admin['cellphone'];
|
|||
|
// $text = "用户:".$user['username']." 已成功预约了。 ".$parkInfo['place']."理发店的".$parkInfo['name']."预约日期是 {$date},预约时间为 {$start_time} - {$end_time}。";
|
|||
|
// send_sms($cellphone,$text);
|
|||
|
// echoRs(1, "预订理发师 ".$parkInfo['place'].$parkInfo['name']." {$start_time} - {$end_time}时间段,预约成功!");
|
|||
|
// }
|
|||
|
//小岛理发扣费功能
|
|||
|
// $r = gpay_pay_user_account_one($uid, floatval($count), $payInfo);
|
|||
|
// if ($r == 'suc') {
|
|||
|
// $db->query("update tb_lfyy_order set uid = '{$uid}' where id=".$oid);
|
|||
|
// $admin = $db->get_one("select * from tb_admin where id = 4413");
|
|||
|
// $user = $db->get_one("select * from tb_user where id = ".$uid);
|
|||
|
// $cellphone = $admin['cellphone'];
|
|||
|
// $text = "用户:".$user['username']." 已成功预约了。 ".$parkInfo['place']."理发店的".$parkInfo['name']."预约日期是 {$date},预约时间为 {$start_time} - {$end_time}。";
|
|||
|
// send_sms($cellphone,$text);
|
|||
|
// echoRs(1, "预订理发师 ".$parkInfo['place'].$parkInfo['name']." {$start_time} - {$end_time}时间段,使用了{$count}发币!");
|
|||
|
// }else{
|
|||
|
// echoRs(1, "预订理发师 ".$parkInfo['place'].$parkInfo['name']." {$start_time} - {$end_time}时间段,预约失败!");
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if($act == 'lfyy_cancel_order') {
|
|||
|
$user = check_token();
|
|||
|
$uid = $user['id'];
|
|||
|
$company_id = $user['company_id'];
|
|||
|
|
|||
|
$order_id = intval($_POST["order_id"]);
|
|||
|
$orderInfo = $db->get_one("select a.*, b.place, b.name, c.start_time, c.end_time from tb_lfyy_order a, tb_lfyy_park b, tb_lfyy_times c where a.park_id=b.id and a.time_id=c.id and a.company_id='{$company_id}' and a.id = '{$order_id}'");
|
|||
|
if(!$orderInfo) {
|
|||
|
echoRs(0, '订单不存在!');
|
|||
|
}
|
|||
|
if($orderInfo['status'] == 1) {
|
|||
|
echoRs(0, '该订单已完成,不能取消!');
|
|||
|
}
|
|||
|
if($orderInfo['status'] == 2) {
|
|||
|
echoRs(0, '该订单已取消过,不能重复取消!');
|
|||
|
}
|
|||
|
if($orderInfo['status'] != 0) {
|
|||
|
echoRs(0, '取消失败!');
|
|||
|
}
|
|||
|
|
|||
|
//判断退回金额 3洗剪吹,5洗吹发
|
|||
|
// if ($uid == 18151 || $uid == 15789 || $uid == 20542 ) {
|
|||
|
if ($orderInfo['yy_type'] == 5) $count = 20;
|
|||
|
if ($orderInfo['yy_type'] == 3) $count = 30;
|
|||
|
// }else $count = 0;
|
|||
|
$orderDate = $orderInfo['date'];
|
|||
|
$datetime = $orderInfo['date']." ". $orderInfo['start_time'];
|
|||
|
// if(strtotime($datetime) - time() < 30) {
|
|||
|
// echo "<pre>";
|
|||
|
// var_dump(time() - strtotime($datetime) < 600 && $orderDate == date("Y-m-d"));
|
|||
|
// echo "</pre>";
|
|||
|
// exit();
|
|||
|
$payInfo = array(
|
|||
|
'rtype' => 8,
|
|||
|
'ac_type' => 1,
|
|||
|
'supplier_id' => 119,
|
|||
|
);
|
|||
|
if(strtotime($datetime) + 600 < time() && $orderDate == date("Y-m-d")) {
|
|||
|
// echo "<pre>";
|
|||
|
// print_r($order_id);
|
|||
|
// echo "</pre>";
|
|||
|
$db->query("update tb_lfyy_order set status= 1 where id=".$order_id);
|
|||
|
echoRs(0, '已过到理发时间,不能取消!');
|
|||
|
}
|
|||
|
$r = gpay_add_user_account_uid($uid, floatval($count), $payInfo);
|
|||
|
if ($r == 'suc') {
|
|||
|
$db->query("update tb_lfyy_order set status=2 where id=".$order_id);
|
|||
|
echoRs(1, '取消订单成功!');
|
|||
|
}else echoRs(1, '取消订单失败!');
|
|||
|
// require_once("include/pay.inc.php");
|
|||
|
/*$recharge = array("order_id" => $order_id, "type" => 8, "result" => 1, "user_area_id" => $user['area_id'], 'ftid' => '1005');
|
|||
|
$r = gpay_update_user_account_one($uid, '+', $orderInfo['fee'], 0, $recharge, 'all');*/
|
|||
|
// $r = gpay_refund_user_account(6, $order_id, 8, 0, 0, $uid);
|
|||
|
//
|
|||
|
// if($r != 'suc') {
|
|||
|
// echoRs(0, '取消失败!');
|
|||
|
// }
|
|||
|
// $db->query("update tb_lfyy_order set status=2 where id=".$order_id);
|
|||
|
// echoRs(1, '取消订单成功!');
|
|||
|
}
|
|||
|
|
|||
|
if($act == 'lfyy_order_list') {
|
|||
|
$user = check_token();
|
|||
|
$uid = $user['id'];
|
|||
|
$company_id = $user['company_id'];
|
|||
|
|
|||
|
$page = intval($_REQUEST['page']);
|
|||
|
$pagesize = intval($_REQUEST['pagesize']);
|
|||
|
$page = max($page, 1);
|
|||
|
if($pagesize <= 0) $pagesize = 10;
|
|||
|
$start = ($page-1)*$pagesize;
|
|||
|
|
|||
|
$count = intval($db->get_colume("select count(*) as c from tb_lfyy_order where company_id='{$company_id}' and uid = {$uid} "));
|
|||
|
$pagecount = ceil($count/$pagesize);
|
|||
|
$list = $db->get_all("select a.*, b.place, b.name, c.start_time, c.end_time from tb_lfyy_order a, tb_lfyy_park b, tb_lfyy_times c where a.company_id='{$company_id}' and a.uid='{$uid}' and a.park_id=b.id and a.time_id=c.id order by a.id desc limit {$start},{$pagesize}");
|
|||
|
foreach($list as $key => $item) {
|
|||
|
$status = $item['status'];
|
|||
|
$list[$key]['status_name'] = $order_statusInfo[$status];
|
|||
|
$xq = date('w', strtotime($item['date']));
|
|||
|
$list[$key]['xq'] = "周".$xqInfo[$xq];
|
|||
|
$can_cancel = 0;
|
|||
|
$datetime = $item['date']." ". $item['start_time'];
|
|||
|
if($status == 0) {
|
|||
|
if(strtotime($datetime) + 600 >= time()) {
|
|||
|
$can_cancel = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
$list[$key]['can_cancel'] = $can_cancel;
|
|||
|
|
|||
|
// 脱敏
|
|||
|
$list[$key]['username'] = cutName($item['username']);
|
|||
|
$list[$key]['cellphone'] = cutName($item['cellphone'], 'cellphone');
|
|||
|
}
|
|||
|
|
|||
|
echoRs(1, "ok ", array('data' => array('list' => $list, 'count' => $count, 'pagecount' => $pagecount)));
|
|||
|
}
|
|||
|
|
|||
|
if($act == 'lfyy_get_parks_screen') {
|
|||
|
$user = check_token();
|
|||
|
$uid = $user['id'];
|
|||
|
$company_id = $user['company_id'];
|
|||
|
|
|||
|
$partList = $db->get_all("select * from tb_lfyy_park where company_id='{$company_id}' order by id");
|
|||
|
|
|||
|
$list = array();
|
|||
|
$places = array();
|
|||
|
foreach($partList as $item) {
|
|||
|
$place = $item['place'];
|
|||
|
$places[$place] = 1;
|
|||
|
unset($item['place']);
|
|||
|
$list[$place][] = $item;
|
|||
|
}
|
|||
|
$list2 = array();
|
|||
|
foreach($list as $key => $item) {
|
|||
|
$list2[] = array(
|
|||
|
'place' => $key,
|
|||
|
'parts' => $item,
|
|||
|
);
|
|||
|
}
|
|||
|
echoRs(1, "ok ", array('data' => array('part_list' => $list2)));
|
|||
|
}
|
|||
|
|
|||
|
if($act == 'lfyy_get_parks_order_screen') {
|
|||
|
$user = check_token();
|
|||
|
$uid = $user['id'];
|
|||
|
$company_id = $user['company_id'];
|
|||
|
$park_id = intval($_REQUEST["park_id"]);
|
|||
|
|
|||
|
if($park_id <= 0) {
|
|||
|
echoRs(0, '参数不完整!');
|
|||
|
}
|
|||
|
$parkInfo = $db->get_one("select * from tb_lfyy_park where company_id='{$company_id}' and id=". $park_id);
|
|||
|
if(!$parkInfo) {
|
|||
|
echoRs(0, 'park_id不存在!');
|
|||
|
}
|
|||
|
|
|||
|
$order_list = $db->get_all("select a.*, b.start_time, b.end_time, b.fee from tb_lfyy_order a, tb_lfyy_times b where a.company_id='{$company_id}' and a.time_id=b.id and a.status = '0' and a.park_id = '{$park_id}' and a.`date` = '".date("Y-m-d")."' and end_time >= '".date("H:i")."' order by start_time");
|
|||
|
|
|||
|
echoRs(1, "ok ", array('data' => array('order_list' => $order_list)));
|
|||
|
}
|