added json format

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-16 15:50:00 -04:00
parent fa64dec989
commit ce48f5080f
+23 -5
View File
@@ -71,7 +71,7 @@ class WrenchApi extends BaseController
return $endpoints; return $endpoints;
} }
private function prepareEndPointData($endpoint, $in, &$call_backend=true){ private function prepareEndPointData($endpoint, $in, &$call_backend=true,&$local_out=[]){
switch ($endpoint) { switch ($endpoint) {
case 'disableaccount': case 'disableaccount':
$in['action'] = WRENCHBOARD_USER_DELETEACC; $in['action'] = WRENCHBOARD_USER_DELETEACC;
@@ -249,6 +249,7 @@ class WrenchApi extends BaseController
case 'getwallets': $in["action"] = WRENCHBOARD_ACCOUNT_WALLETS; case 'getwallets': $in["action"] = WRENCHBOARD_ACCOUNT_WALLETS;
break; break;
} }
$in["pid"] = 100;
return $in; return $in;
} }
public function apigate(){ public function apigate(){
@@ -298,16 +299,33 @@ class WrenchApi extends BaseController
$get_param = $_GET['reqData'] ?? null; $get_param = $_GET['reqData'] ?? null;
$raw_array = ($get_param!=null) ? json_decode($get_param, true):[]; $raw_array = ($get_param!=null) ? json_decode($get_param, true):[];
} }
$in = $raw_array; //$in = $raw_array;
//-- move to another module start //-- move to another module start
$call_backend = true; $call_backend = true;
$local_out =[];
$in["loc"] = $_SERVER["REMOTE_ADDR"]; $in["loc"] = $_SERVER["REMOTE_ADDR"];
$in = $this->prepareEndPointData($endpoint, $in,$call_backend); $in = $this->prepareEndPointData($endpoint, $raw_array,$call_backend,$local_out);
$out = array();
if ( $call_backend == true){
/* $this->load->model('BackendModel');
$out = array();
//$ret = $this->BackendModel->wrenchboard_api($in, $out);
// $wrenchboard = new \App\Models\BackendModel();
// $ret = $wrenchboard->wrenchboard_api($in, $out);
$out['internal_return'] = 0; // $ret; // this is reserved array parameter - to be captured and received before you use the out array()
*/ }
else
{
$out = $local_out;
}
// $raw_array =[]; // $raw_array =[];
$res1 = $this->dummyData($in); $out = $this->dummyData($in);
return $this->response->setJson($res1); //return $this->response->setJson($res1);
return json_encode( ( new \App\Models\ResultFormatter() )->processOutJson($in, $out));
} }
public function apigateDELAY(){ public function apigateDELAY(){