public function orderAction()
 {
     $id = $this->_getParam('id');
     $atnumber = $this->_getParam('atnumber');
     $ctnumber = $this->_getParam('ctnumber');
     if ($this->_auth->userid && $this->_auth->role) {
         $travel = Application_Model_M_Travel::find($id);
         if ($travel) {
             $orderid = Application_Model_M_TravelOrder::getOrderID($this->_auth->userid, $this->_auth->role);
             $total_price = $travel->getAdult_dprice() * $atnumber + $travel->getChild_dprice() * $ctnumber;
             $payment_status = 0;
             $travelOrder = new Application_Model_O_TravelOrder();
             $travelOrder->setOrder_id($orderid)->setUid($this->_auth->userid)->setUrole($this->_auth->role)->setTravel_id($id)->setAdult_ticket_number($atnumber)->setChild_ticket_number($ctnumber)->setTotal_price($total_price)->setPayment_status($payment_status)->setCtime(date('Y-m-d H:i:s'));
             try {
                 $out['errno'] = '0';
                 $mer_front_end_url = "";
                 $deadtime = 0;
                 $notify_url = "http://" . $_SERVER['HTTP_HOST'] . "/travel/notify";
                 $tn = Yy_Upmp_Upmp::getUpmpTn($orderid, $id, $total_price, $mer_front_end_url, $deadtime, $notify_url);
                 $travelOrder->setRemark($tn);
                 $travelOrder->save();
                 $out['tn'] = $tn;
             } catch (Zend_Db_Exception $e) {
                 $out['errno'] = '255';
             }
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '200';
     }
     $out['msg'] = Yy_ErrMsg_Travel::getMsg('order', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
 public function updateAction()
 {
     $id = $this->_getParam('id');
     $travel = Application_Model_M_Travel::find($id);
     if ($travel) {
         $this->view->travel = $travel;
     } else {
         $this->redirect('error');
     }
 }
 public function travelAction()
 {
     $id = $this->_getParam('id');
     //destination_id
     $travelMaps = Application_Model_M_DestinationTravelMap::fetchByDestinationID($id);
     if (count($travelMaps) > 0) {
         $travels = array();
         foreach ($travelMaps as $travelMap) {
             $travelID = $travelMap->getTravel_id();
             $travel = Application_Model_M_Travel::find($travelID);
             if ($travel && $travel->getStatus() == 1) {
                 $result = array('id' => $travel->getId(), 'title' => $travel->getTitle(), 'subtitle' => $travel->getSubtitle(), 'img' => Application_Model_M_Travel::getImageUrl($travel->getId()), 'adult_oprice' => $travel->getAdult_oprice(), 'adult_dprice' => $travel->getAdult_dprice(), 'child_oprice' => $travel->getChild_oprice(), 'child_dprice' => $travel->getChild_dprice(), 'area' => $travel->getArea(), 'sales' => $travel->getSales());
                 array_push($travels, $result);
             }
         }
         if (count($travels) > 0) {
             $out['errno'] = '0';
             $out['travels'] = $travels;
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '1';
     }
     $out['msg'] = Yy_ErrMsg_Destination::getMsg('travel', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
 public function traveldetailAction()
 {
     $did = $this->_getParam('id');
     $maps = Application_Model_M_DepartmentsTravelMap::fetchByDepartID($did);
     $travels = array();
     if (count($maps) > 0) {
         foreach ($maps as $map) {
             $tid = $map->getTravel_id();
             $travel = Application_Model_M_Travel::find($tid);
             if ($travel) {
                 array_push($travels, $travel);
             }
         }
     }
     $this->view->travels = $travels;
     $this->view->did = $did;
 }
Beispiel #5
0
 public static function getTravelTypeByTravelID($id)
 {
     $travel = Application_Model_M_Travel::find($id);
     $type = $travel->getType();
     return $type;
 }