common resources
This commit is contained in:
@@ -120,6 +120,7 @@ $routes->post('/en/wrench/api/v1/familylist', 'WrenchApi::apigate');
|
|||||||
|
|
||||||
$routes->post('/en/wrench/api/v1/getwallets', 'WrenchApi::apigate'); // to be retired
|
$routes->post('/en/wrench/api/v1/getwallets', 'WrenchApi::apigate'); // to be retired
|
||||||
|
|
||||||
|
|
||||||
$routes->post('/en/wrench/api/v1/wallets', 'WrenchWallet::getWallet');
|
$routes->post('/en/wrench/api/v1/wallets', 'WrenchWallet::getWallet');
|
||||||
$routes->post('/en/wrench/api/v1/kidwallets', 'WrenchWallet::getKidWallet');
|
$routes->post('/en/wrench/api/v1/kidwallets', 'WrenchWallet::getKidWallet');
|
||||||
|
|
||||||
@@ -133,6 +134,8 @@ $routes->post('/en/wrench/api/v1/familywallet', 'WrenchWal
|
|||||||
|
|
||||||
|
|
||||||
$routes->post('/en/wrench/api/v1/familyresources', 'WrenchResources::familyresources');
|
$routes->post('/en/wrench/api/v1/familyresources', 'WrenchResources::familyresources');
|
||||||
|
$routes->post('/en/wrench/api/v1/commonmedia', 'WrenchResources::commonmedia');
|
||||||
|
|
||||||
$routes->post('/en/wrench/api/v1/familybanners', 'WrenchBanners::apigate'); // class WrenchBanners WrenchApi
|
$routes->post('/en/wrench/api/v1/familybanners', 'WrenchBanners::apigate'); // class WrenchBanners WrenchApi
|
||||||
|
|
||||||
$routes->post('/en/wrench/api/v1/familyrewardhx', 'WrenchApi::apigate');
|
$routes->post('/en/wrench/api/v1/familyrewardhx', 'WrenchApi::apigate');
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
//use CodeIgniter\API\ResponseTrait;
|
//use CodeIgniter\API\ResponseTrait;
|
||||||
|
use Exception;
|
||||||
use Orhanerday\OpenAi\OpenAi;
|
use Orhanerday\OpenAi\OpenAi;
|
||||||
|
|
||||||
class WrenchResources extends BaseController
|
class WrenchResources extends BaseController
|
||||||
@@ -274,6 +275,79 @@ class WrenchResources extends BaseController
|
|||||||
|
|
||||||
return $this->response->setJson($res1);
|
return $this->response->setJson($res1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function commonmedia(){
|
||||||
|
|
||||||
|
log_message('critical', "WrenchResources-> " );
|
||||||
|
|
||||||
|
log_message('critical', "0001");
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
log_message('critical', "WrenchResources Path GATE 001");
|
||||||
|
$call_backend = true;
|
||||||
|
|
||||||
|
header("Access-Control-Allow-Headers: Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token");
|
||||||
|
log_message('critical', "0003");
|
||||||
|
header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS");
|
||||||
|
header("Access-Control-Allow-Credentials: true");
|
||||||
|
header("Access-Control-Max-Age: 3600");
|
||||||
|
header('content-type: application/json; charset=utf-8');
|
||||||
|
$method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
|
||||||
|
$ip_loc = $this->getIpData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($method == "OPTIONS") {
|
||||||
|
header("HTTP/1.1 200 OK CORS");
|
||||||
|
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****" );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
//$request = service('request');
|
||||||
|
// what is the endpoint
|
||||||
|
$uri = urldecode(current_url(true));
|
||||||
|
$findme = '?';
|
||||||
|
$pos = strpos($uri, $findme);
|
||||||
|
if ($pos > 5) {
|
||||||
|
$uri = substr($uri, 0, $pos);
|
||||||
|
}
|
||||||
|
log_message('critical', "API-GATE URI -> ".$uri );
|
||||||
|
$pieces = explode('/', $uri);
|
||||||
|
$psc = count($pieces);
|
||||||
|
|
||||||
|
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||||
|
log_message('critical', "Enpoint-> ".$endpoint );
|
||||||
|
|
||||||
|
$endpoints = $this->endPointList();
|
||||||
|
$out = array();
|
||||||
|
$res1 = [];
|
||||||
|
|
||||||
|
|
||||||
|
$current_env = $this->getSiteConfigurations("system.live");
|
||||||
|
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
||||||
|
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
||||||
|
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||||
|
|
||||||
|
// echo "EXYTACT INPUT DATA HERE";
|
||||||
|
$raw_json = file_get_contents('php://input');
|
||||||
|
$raw_array = json_decode($raw_json, true);
|
||||||
|
$local_out =[];
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||||
|
log_message('critical', "Enpoint LOC2 HERE -> ".$endpoint );
|
||||||
|
$get_param = $_GET['reqData'] ?? null;
|
||||||
|
$raw_array = ($get_param!=null) ? json_decode($get_param, true):[];
|
||||||
|
}
|
||||||
|
|
||||||
|
$in = $raw_array;
|
||||||
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||||
|
log_message('critical', "WrenchResources Path GATE 005");
|
||||||
|
$res1 = $this->getCommonMediaList($in);
|
||||||
|
log_message('critical', "WrenchResources Path GATE 010 " . serialize($in));
|
||||||
|
log_message('critical', "WrenchResources Path GATE 010 " . serialize($res1['tab_categories']));
|
||||||
|
log_message('critical', "WrenchResources Path GATE 11");
|
||||||
|
|
||||||
|
return $this->response->setJson($res1);
|
||||||
|
}
|
||||||
private function getFamilyResourceCategory($in){
|
private function getFamilyResourceCategory($in){
|
||||||
log_message('critical', "WrenchResources Path GATE 006");
|
log_message('critical', "WrenchResources Path GATE 006");
|
||||||
try {
|
try {
|
||||||
@@ -286,6 +360,20 @@ class WrenchResources extends BaseController
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getCommonMediaList($in){
|
||||||
|
log_message('critical', "WrenchResources Path GATE 006");
|
||||||
|
try {
|
||||||
|
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||||
|
$local_url = "http://".$micro_service_net1.":3034/commonmedia";
|
||||||
|
log_message('critical', "WrenchResources Path GATE 00-commonmedia-> ".$local_url);
|
||||||
|
return $this->APIcall('GET', $local_url, $in);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
log_message('critical', "WrenchResources Path GATE 007 commonmedia - ".$e->getMessage());
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function CollectionData(){
|
private function CollectionData(){
|
||||||
|
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
|
|||||||
Reference in New Issue
Block a user