예제 #1
0
 public function indexAction()
 {
     $type = $this->_getParam('type');
     //看病、体检与疗养等
     $ltype = $this->_getParam('ltype');
     //1国内,2国外
     $sort = $this->_getParam('sort');
     //1价格从高到低,2价格从低到高,3销量从高到底,4销量从低到高
     $page = $this->_getParam('page', 1);
     $res = Application_Model_M_Travel::fetchByType($type, $ltype, $sort, $page);
     $travels = $res['travels'];
     $pages = $res['pages'];
     if (count($travels) > 0) {
         $out['errno'] = '0';
         if ($page < $pages) {
             $out['page'] = $page;
         } else {
             $out['page'] = $pages;
         }
         $out['pages'] = $pages;
         $results = array();
         foreach ($travels as $travel) {
             $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($results, $result);
         }
         $out['travels'] = $results;
     } else {
         $out['errno'] = '1';
     }
     $out['msg'] = Yy_ErrMsg_Travel::getMsg('index', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
예제 #2
0
 public function detailAction()
 {
     $page = $this->_getParam('page', 1);
     //1体检与疗养,2看病,3美容与抗衰老
     $type = $this->_getParam('type', 1);
     $data = Application_Model_M_Travel::fetchByType($type, $page, 30);
     $this->view->data = $data;
     $this->view->type = $type;
     $this->view->page = $page;
 }