From 06dd6d7a3aaedd549ce2b225afd57b5f56bdfaff Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 11 Aug 2023 15:55:23 +0530 Subject: [PATCH] CET satellite fixes : ps --- .../controllers/SMC_Credit_PD_Controller.php | 12 ++++++------ api/application/helpers/satellite_image_helper.php | 13 +++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 5c5fbc56..c1f85109 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1584,7 +1584,7 @@ public function filterSalesPDList_post() { $input_data = $this->post(); log_message('ERROR','####Satellite IMG CALLED smc credit pd ='.$input_data['smc_credit_pd']); $id = $this->SMC_Credit_PD_Model->updateRecords($input_data,SMC_CREDIT_PD,array('smc_credit_pd' => $input_data['smc_credit_pd'])); - satellite_image::getSatelliteImage($input_data['smc_credit_pd'],2); + satellite_image::getSatelliteImage($input_data['smc_credit_pd'],3); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -2698,11 +2698,11 @@ public function filterSalesPDList_post() { function auditGCPFile_get(){ $this->load->library('Googlecloud'); - $bk_name1= 'sales-pd'; - $bk_name2= 'sales-pd-demo'; - $prefix = $this->get('prefix'); - //$prefix = 'credit-pd-demo/pd17092/'; - $prefix = 'credit-pd/pd18010/images/stock_image_ELawVP.png'; + // $bk_name1= 'sales-pd'; + // $bk_name2= 'sales-pd-demo'; + // $prefix = $this->get('prefix'); + $prefix = 'credit-pd-demo/pd17092/'; + $prefix = 'credit-pd/pd18910/images/satellite.png'; $data['prefix'] = $prefix; // $data['listAllBuckets'] = $this->googlecloud->listAllBuckets(); diff --git a/api/application/helpers/satellite_image_helper.php b/api/application/helpers/satellite_image_helper.php index a8be423a..6fc7bfda 100644 --- a/api/application/helpers/satellite_image_helper.php +++ b/api/application/helpers/satellite_image_helper.php @@ -144,6 +144,19 @@ class satellite_image { //echo 'updae'; $satellite_base64 = base64_encode(file_get_contents($satellite_image_png_path)); + + // Google Library - GCP + $CI->load->library('Googlecloud'); + $gcpBucketName = GCP_BUCKET_NAME; + $prefixToObject = ENVIRONMENT == 'production' ? "credit-pd":"credit-pd-demo"; + $gcpObjectName = $prefixToObject."/pd".$pdid."/images/satellite.png"; + $result = $CI->googlecloud->uploadFileToGCPBucket($gcpBucketName,$gcpObjectName,$satellite_image_png_path); + if($result == true){ + log_message('ERROR', '### smc-credit-PD ('.$pdid.') Satellite Image Stored In GCP '); + }else{ + log_message('ERROR', '### smc-credit-PD ('.$pdid.') Satellite Image Not Stored In GCP'); + } + $CI->PD_Model->updateRecords(array('isactive' => 0),SMC_CREDIT_PD_DOCS,array('img_name' => 'satellite','fk_smc_credit_pd_id' => $pd_id)); $CI->PD_Model->saveRecords(array('img' => $satellite_base64,'img_name' => 'satellite','fk_smc_credit_pd_id' => $pd_id),SMC_CREDIT_PD_DOCS); }