+ Add Provider Class id in payload to register agent
This commit is contained in:
parent
ecdd34b1de
commit
322d35b324
|
@ -825,8 +825,8 @@ na.id as networkAgentId,
|
|||
$townid = $town->id;
|
||||
$datetime = $this->getCurrentTimeByNetworkID($network->id);
|
||||
$agentCreateResult = mysqli_prepare($this->con, "INSERT INTO agents(uid,adresse,
|
||||
lastname,email,longitude,latitude,balance,encrypted_password,salt,active,date_created,town_id,nh_provider_class_id) VALUES (?,?,?,?,?,?,?,?,?,?,'$datetime',?,?)");
|
||||
mysqli_stmt_bind_param($agentCreateResult,'ssssddissiii' ,$uuid , $fname,$lname,$email,$longitude,$latitude,$balance,$encrypted_password,$salt,$etat, $townid ,$providerClassId);
|
||||
lastname,email,longitude,latitude,balance,encrypted_password,salt,active,date_created,town_id) VALUES (?,?,?,?,?,?,?,?,?,?,'$datetime',?)");
|
||||
mysqli_stmt_bind_param($agentCreateResult,'ssssddissii' ,$uuid , $fname,$lname,$email,$longitude,$latitude,$balance,$encrypted_password,$salt,$etat, $townid);
|
||||
$agentCreateResult = mysqli_stmt_execute($agentCreateResult);
|
||||
// mysqli_stmt_get_result($agentCreateResult);
|
||||
|
||||
|
@ -835,8 +835,8 @@ lastname,email,longitude,latitude,balance,encrypted_password,salt,active,date_cr
|
|||
if ($agent_id) {
|
||||
|
||||
$result = mysqli_query($this->con, "INSERT INTO networks_agents(network_id,agent_id,
|
||||
solde,etat,codeGenerer_id,phone,validation_code,transactionNumber)
|
||||
VALUES('$network->id','$agent_id','$balance','$etat','$code_id','$phone','$validation_code','$phoneTransaction')");
|
||||
solde,etat,codeGenerer_id,phone,validation_code,transactionNumber,nh_provider_class_id)
|
||||
VALUES('$network->id','$agent_id','$balance','$etat','$code_id','$phone','$validation_code','$phoneTransaction','$providerClassId')");
|
||||
if ($result) {
|
||||
// get user details
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ salt,validation_code, active,network_id , date_created , date_modified) VALUES
|
|||
* @param $agent
|
||||
* @return array
|
||||
*/
|
||||
public function generateNetworkAgent($phone, $code_parrain, $agent)
|
||||
public function generateNetworkAgent($phone, $code_parrain, $agent,$providerClassId = null)
|
||||
{
|
||||
$code=$this->generateValideCode($code_parrain,"geolocated");
|
||||
$resParrain=mysqli_query($this->con,"SELECT * 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 towns tw ON ag.town_id=tw.id INNER JOIN countries ct ON tw.country_id=ct.id WHERE cg.code_membre='$code_parrain'");
|
||||
|
@ -1023,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)VALUES('$networkId','0','0','$codeGenererId','$phone','$agentPhone','$validation_code')");
|
||||
$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'"))
|
||||
|
|
|
@ -1043,7 +1043,7 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
|
|||
* @param string $phone
|
||||
* @return false|string
|
||||
*/
|
||||
public function assignNetworkToAgent($agentId, $code_parrain, $phone)
|
||||
public function assignNetworkToAgent($agentId, $code_parrain, $phone , $provider_class_id = null)
|
||||
{
|
||||
$agent = $this->db->getAgentById($agentId);
|
||||
if (isset($agent)) {
|
||||
|
@ -1055,7 +1055,7 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
|
|||
} else {
|
||||
$parrain=$this->getChildCode($code_parrain);
|
||||
if(isset($parrain) and $parrain['child']==='geolocated'){
|
||||
$user = $this->db->generateNetworkAgent($phone, $code_parrain,$agent);
|
||||
$user = $this->db->generateNetworkAgent($phone, $code_parrain,$agent,$provider_class_id);
|
||||
if (isset($user['success'])) {
|
||||
$result = $this->db->assignNetworkAgent($agentId, $user['id']);
|
||||
if (isset($result['success'])) {
|
||||
|
|
|
@ -112,7 +112,7 @@ function assignNetworkAgentToGeo($request){
|
|||
if(isset($request->agentId)){
|
||||
if(isset($request->code_parrain)){
|
||||
$requester=new Requester(null,$request->lang);
|
||||
echo $requester->assignNetworkToAgent($request->agentId,$request->code_parrain,$request->phone);
|
||||
echo $requester->assignNetworkToAgent($request->agentId,$request->code_parrain,$request->phone,$request->provider_class_id ?? null);
|
||||
|
||||
}else{
|
||||
echo json_encode(['error'=>-2,'error_message'=>'validation code manquant']);
|
||||
|
|
Loading…
Reference in New Issue