Compare commits

..

No commits in common. "2438e9426153de90e75b72248319e428a498b6d6" and "88616dc4ce38f9b104ee2ba71e3600380e329ba5" have entirely different histories.

7 changed files with 37 additions and 55 deletions

View File

@ -178,7 +178,6 @@ class DataBaseConnector
* @return bool
*/
public function checknumberValidity($phone){
return true;
try {
return $this->messenger->checkPhoneExist($phone);
} catch(\Throwable $ex){
@ -392,7 +391,7 @@ na.validation_code as validation_code,ag.id as agentId,na.solde AS balance,na.et
$etat=1;
$si=1;
$category="geolocated";
if($result= mysqli_prepare($this->con,"SELECT id , firstname, lastname, adresse , email , longitude , latitude , phone , transactionNumber , openHours , closeHours , solde , network, country FROM agent_plus WHERE code_dial=? AND etat=? AND category=? AND (longitude!=0 AND latitude!=0)")) {
if($result= mysqli_prepare($this->con,"SELECT * FROM agent_plus WHERE code_dial=? AND etat=? AND category=? AND (longitude!=0 AND latitude!=0)")) {
mysqli_stmt_bind_param($result, 'sis', $country, $etat, $category);
mysqli_stmt_execute($result);
$r = mysqli_stmt_get_result($result);
@ -684,7 +683,7 @@ ag.email AS email,ag.longitude as longitude,ag.latitude AS latitude,ag.active as
na.validation_code as validation_code,ag.id as agentId,na.solde AS balance,na.etat AS etat
,cg.code_parrain AS code_parrain,cg.code_membre AS code_membre,na.phone as phone,na.transactionNumber as phoneTransaction,
ne.id as network_id,ag.date_created as date_created,cg.category as category,
ag.salt as salt,ag.encrypted_password as encrypted_password,ne.name as network,ne.open_wallet_at_mobile_login,ct.name as country
ag.salt as salt,ag.encrypted_password as encrypted_password,ne.name as network,ct.name as country
,ag.number_super as nbre_reseau,ag.number_geoBysuper as nbre_sous_reseau
FROM agents ag INNER JOIN networks_agents na ON ag.id=na.agent_id
INNER JOIN codeGenerer cg ON cg.id=na.codeGenerer_id INNER JOIN networks as ne ON na.network_id=ne.id INNER JOIN countries ct ON ct.id=ne.country_id WHERE na.phone='$phone' or na.transactionNumber='$phone'");
@ -710,13 +709,13 @@ ne.id as network_id,ag.date_created as date_created,cg.category as category,
}
if($row['category']!='geolocated'){
$row['nbre_membre']=$this->getNbMemberOf($row['code_membre']);
}
return $row;
}
return ['error'=>-3,"error_msg"=>"Mot de passe incorrect","last"=>$row];
}
}else
@ -983,11 +982,11 @@ salt,validation_code, active,network_id , date_created , date_modified) VALUES
if ($result) {
// get user details
$uid = mysqli_insert_id($this->con); // last inserted id
$result = mysqli_query($this->con,"SELECT usr.id , ne.name as reseau,ct.name as country,usr.firstname as firstname
$result = mysqli_query($this->con,"SELECT ne.name as reseau,ct.name as country,usr.firstname as firstname
,usr.lastname as lastname,usr.phone as phone,usr.email as email,usr.validation_code as validation_code , usr.user_code FROM users usr INNER JOIN networks ne ON ne.id=usr.network_id INNER JOIN countries ct ON ct.id=ne.country_id WHERE usr.id = '$uid'");
// return user details
if($result){
return mysqli_fetch_array($result,MYSQLI_ASSOC);
return mysqli_fetch_array($result);
}else return ['error'=>'error geting information','sql'=>mysqli_error($this->con)];
} else {
@ -1024,7 +1023,7 @@ salt,validation_code, active,network_id , date_created , date_modified) VALUES
$codevalide=mysqli_num_rows($se)>0;
}while($codevalide);
$agentPhone=$agent['phone'];
$result = mysqli_query($this->con, "INSERT INTO networks_agents(network_id,solde,etat,codeGenerer_id,transactionNumber,phone,validation_code,nh_provider_class_id)VALUES('$networkId','0','0','$codeGenererId','$phone','$agentPhone','$validation_code',$providerClassId)");
$result = mysqli_query($this->con, "INSERT INTO networks_agents(network_id,solde,etat,codeGenerer_id,transactionNumber,phone,validation_code,nh_provider_class_id)VALUES('$networkId','0','0','$codeGenererId','$phone','$agentPhone','$validation_code','$providerClassId')");
if ($result) {
$geoId=mysqli_insert_id($this->con);
if (mysqli_query($this->con, "UPDATE codeGenerer SET etat='1' WHERE code_membre='$code'"))
@ -1335,8 +1334,8 @@ ag.adresse,
while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC)){
$rows[]=$row;
}
return $rows ?? [];
return $rows;
}
return [];
}
}
}

View File

@ -106,7 +106,6 @@ class DataBaseConnector
}
public function checknumberValidity($phone){
return true;
try {
return true;//$this->messenger->checkPhoneExist($phone);
} catch(\Throwable $ex){
@ -273,7 +272,7 @@ na.validation_code as validation_code,ag.id as agentId,na.solde AS balance,na.et
mysqli_stmt_execute($result);
$r = mysqli_stmt_get_result($result);
$rows=[];
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC )) {
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC )) {
$rows[]=$row;
}
@ -500,13 +499,13 @@ ne.id as network_id,ag.date_created as date_created,cg.category as category,
}
if($row['category']!='geolocated'){
$row['nbre_membre']=$this->getNbMemberOf($row['code_membre']);
}
return $row;
}
return ['error'=>-3,"error_msg"=>"Mot de passe incorrect","last"=>$row];
}
}else
@ -918,4 +917,4 @@ ag.adresse,
return $li;
}else return mysqli_error($this->con);
}
}
}

View File

@ -8,6 +8,7 @@
include 'DataBaseConnector.php';
/**
* Cette classe matérialise la resource qui execute une requete
*/
@ -442,7 +443,7 @@ class Requester
//Envoyez le mail de bienvenue
try{
/* API URL */
$url = WALLET_SERVICE_URL.'/notify-new-user';
$url = WALLET_SERVICE_URL.'/notify-new-agent';
/* Init cURL resource */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@ -460,8 +461,7 @@ class Requester
$body->email = $user['email'];
$body->message = $user['category'] == 'super' ? $message2 : $message1;
$body->category = $user['category'];
$body->user_id = $user['agentId'];
$body->user_type = 'agent';
$body->agent_id = $user['agentId'];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
curl_exec($ch);
@ -968,7 +968,7 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
// user is already existed - error response
$response["error"] = 1;
$response["error_msg"] = "numero existe deja";
return json_encode($response);
echo json_encode($response);
} else {
if ($this->db->checknumberValidity($request->phone)) {
$user = $this->db->storeUserSimple($request->address, $request->lastname, $request->email,
@ -985,39 +985,23 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
$validation_code=$user['validation_code'];
$ct=$this->messageText['USER_'];
$message1 =sprintf($this->messageText['MESSAGE_1_USER'],$username,$ct,$phone,$request->password,$validation_code);
// $message2 = sprintf($this->messageText['MESSAGE_2'],$username,$ct,$phone,$request->password,"");
//Envoyez le mail de bienvenue
try{
/* API URL */
$url = WALLET_SERVICE_URL.'/notify-new-user';
/* Init cURL resource */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:'.WALLET_SERVICE_TOKEN,
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
$message2 = sprintf($this->messageText['MESSAGE_2'],$username,$ct,$phone,$request->password,"");
$body = new \stdClass();
$body->subject = $subject;
$body->email = $user['email'];
$body->message = $message1;
$body->user_id = $user['id'];
$body->user_type = 'user';
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
curl_exec($ch);
/* close cURL resource */
curl_close($ch);
}catch (Throwable $e){
$this->write_log("Error Notify New Simple user ".$request->lastname." : ".$e->getMessage()."\n");
$from = "noreply@ilink-app.com";
$headers = "From:" . $from;
$name = "ilink";
$this->messenger->setReceiverMail($user['email']);
$this->messenger->setContact($user['phone']);
$this->messenger->setMessage($message1);
$this->messenger->setSubject($subject);
$this->messenger->setHeader($headers);
try{
$this->messenger->sendMail();
}catch (\Throwable $e){
$this->write_log($e->getMessage().'\n'.$e->getTraceAsString());;
}
$this->messenger->setContact($user['phone']);
$sms = $this->messenger->sendSms();
} else {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -56,7 +56,7 @@ class Messenger
$this->mail->Host = 'mail.ilink-app.com'; // Set the SMTP server to send through
$this->mail->SMTPAuth = true; // Enable SMTP authentication
$this->mail->Username = 'noreply@ilink-app.com'; // SMTP username
$this->mail->Password = 'Reply@iLink2022@@@'; // SMTP password
$this->mail->Password = 'ilink2017GA'; // SMTP password
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$this->mail->Port = 587;
$this->mail->CharSet = 'UTF-8';
@ -196,4 +196,4 @@ class Messenger
}
}
}