Exemplo n.º 1
0
 function act_getPlatformListNum()
 {
     //调用model层获取数据
     $platformModel = new platformModel();
     $num = $platformModel->getPlatformListNum();
     if ($num) {
         return $num;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 public function getAppLogs($id_application)
 {
     $result = array();
     //$log_data  = logModel::getAppLog( $id_application, $id_platform );
     $platforms = platformModel::getPlatforms();
     foreach ($platforms as $k => $v) {
         $log_data = array();
         $log_data = logModel::getAppLog($id_application, $v['id_platform'], 10);
         if (count($log_data)) {
             $result[$v['id_platform']] = $log_data + array('name_platform' => $v['name_platform']);
         }
     }
     return $this->render('app_log', array('app_log' => $result));
 }
Exemplo n.º 3
0
 public function getHttpCodeAction()
 {
     $resources = array();
     $id_application = $_GET['id_application'];
     $id_platform = $_GET['id_platform'];
     if (check_RequestMethod('GET')) {
         set_Json_header();
         $app_data = appsModel::getApplicationData($id_application);
         $platform_data = platformModel::getPlatformData($id_platform);
         /*  bool   CURLOPT_FRESH_CONNECT - TRUE to force the use of a new connection instead of a cached one.
          *  string CURLOPT_USERAGENT     - The contents of the "User-Agent: " header to be used in a HTTP request.
          *  array  CURLOPT_HTTPHEADER     - An array of HTTP header fields to set, in the format array('Content-type: text/plain', 'Content-length: 100')
          *  bool   CURLOPT_RETURNTRANSFER - TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
          * */
         $response_data = apiModel::getRequestInfo($app_data['url_application'], array(CURLOPT_FRESH_CONNECT => true, CURLOPT_USERAGENT => $platform_data['UA_string'], CURLOPT_RETURNTRANSFER => true, CURLINFO_HEADER_OUT => true));
         print_r($response_data);
         $resources = $this->getResources($app_data['url_application'], $response_data['html']);
         if (is_array($resources)) {
             foreach ($resources as $v) {
                 $r = apiModel::getRequestInfo($v, array(CURLOPT_FRESH_CONNECT => true, CURLOPT_USERAGENT => $platform_data['UA_string'], CURLOPT_RETURNTRANSFER => true, CURLINFO_HEADER_OUT => true));
                 $response_data['size_download'] += $r['size_download'];
             }
         }
         $last_log_data = logModel::getLastLogs($id_application, $id_platform);
         $log_data = array('id_application' => $id_application, 'id_platform' => $id_platform, 'HTTP_code' => !count(apiModel::$errors) ? $response_data['http_code'] : apiModel::$errors[0], 'date_check' => date('Y-m-d H:i:s', time()), 'id_user' => authModel::getCurrentUserId(), 'size_download' => $response_data['size_download'], 'download_content_length' => $response_data['download_content_length'], 'redirect_url' => $response_data['redirect_url'], 'request_header' => $response_data['request_header'], 'weight_diff' => $response_data['size_download'] - $last_log_data[$id_application][$id_platform]['size_download'], 'app_resources' => implode(', ', $resources));
         if (($id_check_log = logModel::checkInBase($log_data, array('date_check', 'app_resources'))) !== false) {
             logModel::updateData($log_data + array('id_check_log' => $id_check_log));
         } else {
             $id_check_log = logModel::insertData($log_data);
         }
         $log_data = logModel::getLog($id_check_log);
         print json_encode($log_data + array('curl_response' => $response_data, 'last_log' => $last_log_data));
         die;
     } else {
         _404();
     }
 }
Exemplo n.º 4
0
 private function getForm($data)
 {
     // data from last page reload. Save it and unset
     list($errors, $messages, $user_data) = platformModel::getSession(array('errors', 'messages', 'user_data'));
     platformModel::unsetSession(array('errors', 'messages', 'user_data'));
     return $this->render('platforms_form', $data + array('errors' => $errors, 'messages' => $messages, 'user_data' => $user_data));
 }
Exemplo n.º 5
0
 private function getForm($data)
 {
     // data from last page reload. Save it and unset
     list($errors, $messages, $user_data) = appsModel::getSession(array('errors', 'messages', 'user_data'));
     appsModel::unsetSession(array('errors', 'messages', 'user_data'));
     // get platforms
     $platforms = platformModel::getPlatforms();
     // app to platforms link
     $app2platform = appsModel::getApp2PlatformData($data['user_data']['id_application']);
     return $this->render('apps_form', $data + array('errors' => $errors, 'messages' => $messages, 'user_data' => $user_data, 'platforms' => $platforms, 'app2platform' => $app2platform, 'back_url' => $this->makeURI(array('action' => 'list'))));
 }
Exemplo n.º 6
0
 function act_platformShow()
 {
     $where = "";
     $paltform = platformModel::platformShow($where);
     return $platform;
 }
Exemplo n.º 7
0
 public function act_checkPlatformExist()
 {
     $name = trim($_GET['name']);
     //调用model层获取数据
     $platformModel = new platformModel();
     $is = $platformModel->checkPlatformExist($name);
     if ($is) {
         //存在
         self::$errCode = 0;
         self::$errMsg = '已存在!';
         return false;
     } else {
         //不存在
         self::$errCode = 1;
         self::$errMsg = 'OK';
         return true;
     }
 }
Exemplo n.º 8
0
 public function platformDel($where)
 {
     $sql = "DELETE FROM trans_platform {$where}";
     $query = $this->dbconn->query($sql);
     if ($query) {
         return $query;
         //成功, 返回列表数据
     } else {
         self::$errCode = "003";
         self::$errMsg = "444444444";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
 }