public function insertDownloadInfo($request) { $json = json_encode($request->parameters); $contentDownloadHistory = new ContentDownloadHistory(); $jsonObj = json_decode($json); $jsonMessage = $contentDownloadHistory->validateJsonForUpdateDownloadInfo($jsonObj); if ($jsonMessage != Message::SUCCESS) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => $jsonMessage); $this->outputError($response); return; } if (!$contentDownloadHistory->setValuesFromJsonObj($jsonObj)) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_INVAID_REQUEST_BODY); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_msisdn) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_MSISDN); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_user_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_USER_ID); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_app_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_APP_ID); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_cd_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CD_ID); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_cmd_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CMD_ID); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_download_count) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CD_DOWNLOAD_COUNT); $this->outputError($response); return; } if (trim($contentDownloadHistory->cd_download_date) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CD_DOWNLOAD_DATE); $this->outputError($response); return; } $downloadHistoryArray = $contentDownloadHistory->insertDownloadInfo($contentDownloadHistory); /*echo "<pre>"; print_r($downloadHistoryArray); exit;*/ if (!empty($downloadHistoryArray)) { //$contentHistoryDetails = $contentDownloadHistory->getContentDetailsByCatelogDetailIdsAndContentMetadataIds( $cdIds, $cmdIds ); $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'contentHistoryDetails' => $downloadHistoryArray); $this->outputSuccess($response); return; } else { $response = array("status" => "ERROR-BUSINESS", "status_code" => '404', 'msgs' => 'No download history available !.'); $this->outputError($response); return; } }