コード例 #1
0
ファイル: FrameController.php プロジェクト: bjtenao/tudu-web
 /**
  * 天气预报
  */
 public function weatherAction()
 {
     $loc = $this->_request->getQuery('loc');
     $lang = $this->_request->getQuery('lang');
     if (!$lang) {
         $lang = empty($this->_user->option['language']) ? 'zh_CN' : $this->_user->option['language'];
     }
     /**
      * @see Tudu_Api
      */
     require_once 'Tudu/Api.php';
     $option = $this->bootstrap->getOption('api');
     $api = new Tudu_Api($option['tudu']);
     if (!$loc) {
         $loc = $api->getLocation(Oray_Function::getTrueIp());
     }
     $weather = $api->getWeather($lang, $loc);
     $this->json(true, null, $weather);
 }