| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- include_once "../../include/DB.php";
- $RiderID="";
- $SwapReferCount="";
- if (isset($_POST["RiderID"]) && !empty($_POST["RiderID"])) {
- $RiderID=$_POST["RiderID"];
- }
- if (isset($_POST["SwapReferCount"]) && !empty($_POST["SwapReferCount"])) {
- $SwapReferCount=$_POST["SwapReferCount"];
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- $RiderPostData = array(
- 'RiderID' => $RiderID
- );
- $CheckRidertURL = "http://localhost/cygnusa/batterySwap/api/User/";
- $CheckRidertCURL = curl_init($CheckRidertURL);
- curl_setopt($CheckRidertCURL, CURLOPT_HEADER, false);
- curl_setopt($CheckRidertCURL, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($CheckRidertCURL, CURLOPT_POST, true);
- curl_setopt($CheckRidertCURL, CURLOPT_POSTFIELDS, $RiderPostData);
- $CheckRidertJsonResponse = curl_exec($CheckRidertCURL);
- $RiderResult = json_decode($CheckRidertJsonResponse, true);
- $TotalReferdSwapCount=$RiderResult["SwapData"]["ReferData"]["Total"];
- $UsedReferdSwapCount=$RiderResult["SwapData"]["ReferData"]["Used"];
- $AvailableReferdSwapCount=$RiderResult["SwapData"]["ReferData"]["Available"];
- $SwapReferID=$RiderResult["SwapData"]["ReferData"]["SwapReferID"];
- //////////////////////////////////////////////////////////////////////////////////////////////////
- $ReferPostData = array(
- 'SwapReferID' => $SwapReferID,
- 'TotalReferdSwapCount' => ($TotalReferdSwapCount+$SwapReferCount),
- 'UsedReferdSwapCount' => $UsedReferdSwapCount,
- 'AvailableReferdSwapCount' => ($AvailableReferdSwapCount+$SwapReferCount),
- );
- $ReferURL = "http://localhost/cygnusa/batterySwap/api/Admin/Refer/";
- $ReferCURL = curl_init($ReferURL);
- curl_setopt($ReferCURL, CURLOPT_HEADER, false);
- curl_setopt($ReferCURL, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ReferCURL, CURLOPT_POST, true);
- curl_setopt($ReferCURL, CURLOPT_POSTFIELDS, $ReferPostData);
- $ReferJsonResponse = curl_exec($ReferCURL);
- $ReferResult = json_decode($ReferJsonResponse, true);
- $value = array(
- "RiderID"=>$RiderID,
- "Refer"=>$ReferResult,
- "Message"=>"Swap Data saved successfully",
- );
- // Use json_encode() function
- $json = json_encode($value);
- // Display the output
- echo ($json);
- $conn->close();
|