getOrderArr($arr); if (!$orderArr) { return Util::returnArrEr('没有行程'); } $aroundOrderId = ''; $normalOrderId = ''; foreach ($orderArr as $key => $val) { if ($val['type'] == 369) { $aroundOrderId .= $val['order_id'] . ','; } else { $normalOrderId .= $val['order_id'] . ','; } } //普通订单数据查询 if ($normalOrderId != '') { $normalOrderId = rtrim($normalOrderId, ','); $normalDate = $getResult->normalDate($normalOrderId); if ($normalDate) { foreach ($normalDate as $key => $val) { $normalDate[$key]['minutes'] = $minToStr->minstr($val['minutes']); } } } else { $normalDate = array(); } //周边游订单数据查询 if ($aroundOrderId != '') { $aroundOrderId = rtrim($aroundOrderId, ','); $aroundDate = $getResult->aroundDate($aroundOrderId); } else { $aroundDate = array(); } $result = array_merge($normalDate, $aroundDate); if ($result) { //按出行时间重新排序 $newResult = array(); foreach ($result as $key => $val) { $run_date = $val['run_date'] . ' ' . $val['run_time']; $k = strtotime("$run_date") . $val['order_id']; $newResult[$k] = $result[$key]; } if ($arr['type'] == 147) { krsort($newResult); } else { ksort($newResult); } $newResult = array_values($newResult); $result1 = array( 'list' => $newResult ); $result1['page'] = array( 'page_size' => $arr['limit'], 'current_page' => $arr['page'] ); return Util::returnArrSu('', $result1); } return Util::returnArrEr('数据错误'); } /** * Function Description:电子票 * Function Name: getEticket * @param $arr * * @return array * * @author 娄梦宁 */ public function getEticket($arr) { $checkParam = Util::checkPattern('intVal', $arr['order_id']); if ($checkParam == false) { return Util::returnArrEr('参数错误'); } $getResult = new MyTrip(); $result = $getResult->getEticket($arr); if ($result) { $today = date('Y-m-d', time()); if ($today == $result['date']) { $result['week'] = '今天'; } else { $result['week'] = Tool::getWeek($result['date']); }; //是否检票 $isCheck = $getResult->isCheck($result['order_id']); if (count($isCheck)) { $result['status'] = 1; } else { $result['status'] = 0; } //生成电子票图片 $ser = new OrderService(); $result['eurl'] = $ser->getETicket($arr['order_id']); $config = Util::getSiteConfig(); $result['eurl'] = $config['host_name'] . $result['eurl']; $go_back = new OrdersModel(); $go_back1 = $go_back->getBack($arr['order_id']); if ($go_back1) { $result['trip_type'] = '往返程'; } else { $result['trip_type'] = '单程'; } return Util::returnArrSu("", $result); } return Util::returnArrEr("没有数据"); } /** * Function Description:行程列表参数校验 * Function Name: checkParamList * @param $arr * * @return bool * * @author 娄梦宁 */ public function checkParamList($arr) { if (Util::checkPattern('intVal', $arr['page']) == false) { return false; } elseif (Util::checkPattern('intVal', $arr['userId']) == false) { return false; } elseif (Util::checkPattern('intVal', $arr['limit']) == false) { return false; } elseif (Util::checkPattern('', $arr['type'], '/146|147/') == false) { return false; } return true; } /** * Function Description:绑定订单 * Function Name: tripBind * @param $arr * * @return array * * @author 娄梦宁 */ public function tripBind($arr) { if (Util::checkPattern('mobile', $arr['tel']) == false) { return Util::returnArrEr('参数错误'); } //获取该手机号下所有订单 $getResult = new MyTrip(); $getAllOrder = $getResult->getAllOrder($arr['tel']); if (!$getAllOrder) { return Util::returnArrEr("该手机号没有可绑定行程"); } //绑定 $tripBind = $getResult->tripBind($arr); if ($tripBind == 0) { return Util::returnArrEr("没有可绑定的行程"); } //将member_id为空的置换为当前用户id // $orderStr = ""; // foreach ($getAllOrder as $val) { // $orderStr .= ',' . $val['order_id']; // } // $orderStr = ltrim($orderStr, ','); // $uptOrder = $getResult->uptOrder($orderStr, $arr['userId']); // if ($uptOrder['flag'] == false) { // return Util::returnArrEr('绑定失败'); // } return Util::returnArrSu("绑定成功"); } }