ROUTES MERGE

This commit is contained in:
velz 2018-10-22 18:41:42 +05:30
commit 324d1f8f6d
3 changed files with 70 additions and 2 deletions

View File

@ -138,4 +138,6 @@ $route['loadFullTemplate'] = 'PD_Controller/loadFullTemplate';
$route['allbase'] = 'PD_Controller/base';
$route['savePDQuestions'] = 'PD_Controller/saveActualPDQuestions';
$route['getAnswersForPD'] = 'PD_Controller/getAnswersForPD';
$route['checkOTP'] = 'PD_Controller/checkOTP';

View File

@ -450,7 +450,21 @@ class PD_Controller extends REST_Controller {
public function updatePDMaster_post()
{
$pd_details = $this->post('records');
// print_r($pd_details);die;
//print_r($pd_details);
// OTP Generate Condition
if($pd_details['pd_status'] == STARTED)
{
$string2 = str_shuffle('1234567890');
$OTP = substr($string2,0,6);
$msg = "Code for starting your personal discussions with the verification officer is ".$OTP .". Pls share this only when the officer has reached your place in person";
$no = (string)$pd_details['mobile_no'];
unset($pd_details['mobile_no']);
$pd_details['OTP'] = $OTP;
$this->aws_sns->sendSMS($msg,$no);
}
$where_condition_array = array('pd_id' => $pd_details['pd_id']);
$pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array);
@ -459,6 +473,7 @@ class PD_Controller extends REST_Controller {
// Create entries on `t_pd_category_weightage` table from Template Category weightage
}
if($pd_id_modified != null || $pd_id_modified != '' && $count != 0)
{
PDALERTS::pdnotification($pd_details['pd_id']);
@ -476,6 +491,31 @@ class PD_Controller extends REST_Controller {
}
/**
* Pd Discussion OTP Checking function
* sriram
*/
public function checkOTP_post()
{
$pdotp = $this->post('records');
$pdotpStatus = $this->PD_Model->checkotp($pdotp);
if($pdotpStatus != 0 || $pdotpStatus != '' && count($pdotpStatus) != 0)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = true;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$this->response($data,REST_Controller::HTTP_OK);
}
}
/*
*

View File

@ -70,7 +70,7 @@ class PD_Model extends SPARQ_Model {
$this->db->ORDER_BY('PDTRIGGER.pd_id',$sort);
$this->db->LIMIT($limit,$page);
$result_array = $this->db->GET()->result_array();
//print_r($this->db->last_query());
if(count($result_array) != 0)
{
foreach($result_array as $key => $result)
@ -354,4 +354,30 @@ class PD_Model extends SPARQ_Model {
// print_r($answers);
}
/**
* Check OTP PDTRIGGER TABLE
* param OTP AND pd_id
*sriram
*/
public function checkotp($pddata)
{
$this->db->select('OTP');
$this->db->where('pd_id',$pddata['pd_id']);
$result = $this->db->get(PDTRIGGER.' as PDTRIGGER')->first_row();
if(count($result) !='0')
{
if($result->OTP == $pddata['OTP'])
{
$result = true;
}else
{
$result = false;
}
}
return $result;
}
}