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;
}
private function prepareEndPointData($endpoint, $in, &$call_backend=true){
private function prepareEndPointData($endpoint, $in, &$call_backend=true,&$local_out=[]){
switch ($endpoint) {
case 'disableaccount':
$in['action'] = WRENCHBOARD_USER_DELETEACC;
@@ -249,6 +249,7 @@ class WrenchApi extends BaseController
case 'getwallets': $in["action"] = WRENCHBOARD_ACCOUNT_WALLETS;
break;
}
$in["pid"] = 100;
return $in;
}
public function apigate(){
@@ -298,16 +299,33 @@ class WrenchApi extends BaseController
$get_param = $_GET['reqData'] ?? null;
$raw_array = ($get_param!=null) ? json_decode($get_param, true):[];
}
$in = $raw_array;
//$in = $raw_array;
//-- move to another module start
$call_backend = true;
$local_out =[];
$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 =[];
$res1 = $this->dummyData($in);
return $this->response->setJson($res1);
$out = $this->dummyData($in);
//return $this->response->setJson($res1);
return json_encode( ( new \App\Models\ResultFormatter() )->processOutJson($in, $out));
}
public function apigateDELAY(){