+ Timezone of dates is now providing by user

This commit is contained in:
Djery-Tom 2020-11-16 09:11:30 +01:00
parent 2049753c4a
commit c7a44d6f65
2 changed files with 4 additions and 3 deletions

View File

@ -761,7 +761,7 @@ na.id as networkAgentId,
$q = mysqli_query($this->con, "INSERT INTO demandeCredits(network_agent_id,montant,status,date_creation) VALUES('$idag','$montant','0','$datetime')");
$id = mysqli_insert_id($this->con);
if ($q) {
return ['success' => 1, "agent" => $agent, "id" => $id,
return ['success' => 1, "agent" => $agent, "id" => $id, "datetime" => $datetime,
"currency_code" => $agent['currency_code'], "agent_name" => $agent['lastname'].' '.$agent['firstname']];
}
}

View File

@ -596,7 +596,7 @@ class Requester
* @param $message
* @param null $data
*/
public function sendPushNotificationToAgent($agent_code, $message, $data = null)
public function sendPushNotificationToAgent($agent_code, $message, $data = null , $date = null)
{
$client = new \GuzzleHttp\Client([
'base_uri' => NOTIFICATION_SERVICE_URL,
@ -608,6 +608,7 @@ class Requester
$body->agent_code = $agent_code;
$body->message = $message;
$body->data = $data;
$body->date = $date;
$promise = $client->requestAsync('POST', '/onesignal/pushToAgent', ['json' => $body, 'headers' => $headers])->then();
$promise->wait();
}
@ -659,7 +660,7 @@ class Requester
$data->data->firstname = $usr['firstname'] ;
$data->data->lastname = $usr['lastname'];
$this->sendPushNotificationToAgent($codeParrain,
sprintf($this->messageText['NOTIFICATION_CREDIT_DEMAND_TEXT_SUCCESS'],$result['agent_name'],$montant,$result['currency_code']),$data);
sprintf($this->messageText['NOTIFICATION_CREDIT_DEMAND_TEXT_SUCCESS'],$result['agent_name'],$montant,$result['currency_code']),$data,$result['datetime']);
}catch (Exception $e){
return json_encode(error_get_last());
}