public function indexAction()
 {
     $this->_helper->layout()->disableLayout();
     //config contentType
     // 		$contentType = array(
     // 				"apk" => "application/vnd.android.package-archive"
     // 		);
     $gameId = $this->_request->getParam("productId");
     if (!$gameId) {
         echo "error";
         return;
     }
     $game_model = new Model_Game();
     $game = $game_model->getGameById($gameId);
     $file = $game[0]['install_file'];
     $game_model->addDownload($gameId);
     if ($file !== false) {
         //$ext = pathinfo($file, PATHINFO_EXTENSION);
         if (file_exists($this->_FILE_APK_PATH . $file)) {
             // 				header("Content-Type: ".isset($contentType[$ext]) ? $contentType[$ext] : "");
             // 				header('Content-Disposition: attachment; filename="'.$file.'"');
             // 				header('Content-Transfer-Encoding: binary');
             // 				header('Accept-Ranges: bytes');
             // 				readfile($this->_FILE_APK_PATH.$file);
             $this->_redirect($this->_FILE_APK_PATH . $file);
         } else {
             echo "error";
         }
     }
 }
Esempio n. 2
0
 public function adddownloadAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     if ($this->_request->isPost()) {
         $gameId = $this->_request->getPost('gameId');
         if ($gameId) {
             $mode_game = new Model_Game();
             $returnVal = $mode_game->addDownload($gameId);
         }
     }
 }