Resource function
This commit is contained in:
@@ -10,43 +10,46 @@ use Orhanerday\OpenAi\OpenAi;
|
|||||||
class WrenchResources extends BaseController
|
class WrenchResources extends BaseController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
public function generatives(){
|
|
||||||
$raw_json = file_get_contents('php://input');
|
|
||||||
$in = json_decode($raw_json, true);
|
|
||||||
|
|
||||||
$a = rand(1,20);
|
public function generatives()
|
||||||
$b = rand(1,30);
|
{
|
||||||
$c= $a+$b;
|
$raw_json = file_get_contents('php://input');
|
||||||
|
$in = json_decode($raw_json, true);
|
||||||
|
|
||||||
$ansPos = rand(1,4);
|
$a = rand(1, 20);
|
||||||
$option_mix=[];
|
$b = rand(1, 30);
|
||||||
for ($ii=1; $ii<=4; $ii++){
|
$c = $a + $b;
|
||||||
if ($ii== $ansPos){
|
|
||||||
$option_mix[]= $c;
|
$ansPos = rand(1, 4);
|
||||||
}else
|
$option_mix = [];
|
||||||
{
|
for ($ii = 1; $ii <= 4; $ii++) {
|
||||||
$ansRand = rand(1000,9999);
|
if ($ii == $ansPos) {
|
||||||
$option_mix[]= ($ansRand == $c)? $ansRand+rand(1,5) : $ansRand;
|
$option_mix[] = $c;
|
||||||
}
|
} else {
|
||||||
|
$ansRand = rand(1000, 9999);
|
||||||
|
$option_mix[] = ($ansRand == $c) ? $ansRand + rand(1, 5) : $ansRand;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//[ rand(1000,9999), $c , rand(1000,9999)]
|
//[ rand(1000,9999), $c , rand(1000,9999)]
|
||||||
|
|
||||||
$next_question = [
|
$next_question = [
|
||||||
"question" => "What is C ? <br> C = $a + $b .",
|
"question" => "What is C ? <br> C = $a + $b .",
|
||||||
"option" => $option_mix,
|
"option" => $option_mix,
|
||||||
"answer" => $c,
|
"answer" => $c,
|
||||||
'option_mix' => $option_mix,
|
'option_mix' => $option_mix,
|
||||||
"last" => false,
|
"last" => false,
|
||||||
"points" => 10
|
"points" => 10
|
||||||
];
|
];
|
||||||
$out = [
|
$out = [
|
||||||
"next_question" => $next_question
|
"next_question" => $next_question
|
||||||
];
|
];
|
||||||
log_message('critical', "***** ***** WrenchResources::generatives Ret ");
|
log_message('critical', "***** ***** WrenchResources::generatives Ret ");
|
||||||
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
return $this->respond($this->summaryReturnData($in, $out), 200);
|
||||||
}
|
}
|
||||||
public function blogTopics(){
|
|
||||||
|
public function blogTopics()
|
||||||
|
{
|
||||||
|
|
||||||
$open_ai_key = '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';
|
$open_ai_key = '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';
|
||||||
|
|
||||||
@@ -56,7 +59,7 @@ class WrenchResources extends BaseController
|
|||||||
// text-davinci-003 davinci-instruct-beta-v3
|
// text-davinci-003 davinci-instruct-beta-v3
|
||||||
$complete = $open_ai->completion([
|
$complete = $open_ai->completion([
|
||||||
'model' => 'gpt-3.5-turbo-instruct',
|
'model' => 'gpt-3.5-turbo-instruct',
|
||||||
'prompt' => 'Generate blog topics on: '. $prompt,
|
'prompt' => 'Generate blog topics on: ' . $prompt,
|
||||||
'temperature' => 0.9,
|
'temperature' => 0.9,
|
||||||
'max_tokens' => 150,
|
'max_tokens' => 150,
|
||||||
'frequency_penalty' => 0,
|
'frequency_penalty' => 0,
|
||||||
@@ -65,22 +68,23 @@ class WrenchResources extends BaseController
|
|||||||
|
|
||||||
$response = json_decode($complete, true);
|
$response = json_decode($complete, true);
|
||||||
//$response = $response["choices"][0]["text"];
|
//$response = $response["choices"][0]["text"];
|
||||||
// return $this->response->setJson($response);
|
// return $this->response->setJson($response);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function aigate(){
|
public function aigate()
|
||||||
|
{
|
||||||
|
|
||||||
$open_ai_key = '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';
|
$open_ai_key = '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';
|
||||||
|
|
||||||
$open_ai = new OpenAi($open_ai_key);
|
$open_ai = new OpenAi($open_ai_key);
|
||||||
|
|
||||||
$prompt = " autonomous cars";
|
$prompt = " autonomous cars";
|
||||||
// 'model' => 'text-davinci-003',
|
// 'model' => 'text-davinci-003',
|
||||||
$complete = $open_ai->completion([
|
$complete = $open_ai->completion([
|
||||||
|
|
||||||
'model' => 'gpt-3.5-turbo-instruct',
|
'model' => 'gpt-3.5-turbo-instruct',
|
||||||
'prompt' => 'Writing 3 marketing Facebook caption for '. $prompt,
|
'prompt' => 'Writing 3 marketing Facebook caption for ' . $prompt,
|
||||||
'temperature' => 0.9,
|
'temperature' => 0.9,
|
||||||
'max_tokens' => 150,
|
'max_tokens' => 150,
|
||||||
'frequency_penalty' => 0,
|
'frequency_penalty' => 0,
|
||||||
@@ -92,8 +96,10 @@ class WrenchResources extends BaseController
|
|||||||
$response["other_topic"] = $this->blogTopics();
|
$response["other_topic"] = $this->blogTopics();
|
||||||
return $this->response->setJson($response);
|
return $this->response->setJson($response);
|
||||||
}
|
}
|
||||||
public function website(){
|
|
||||||
log_message('critical', "WrenchResources-> " );
|
public function website()
|
||||||
|
{
|
||||||
|
log_message('critical', "WrenchResources-> ");
|
||||||
$res1['tab_categories'] = $this->CategoryData();
|
$res1['tab_categories'] = $this->CategoryData();
|
||||||
$res1['ask_categories'] = $this->AskCategoryData();
|
$res1['ask_categories'] = $this->AskCategoryData();
|
||||||
$res1['upload_types'] = $this->uploadTypes();
|
$res1['upload_types'] = $this->uploadTypes();
|
||||||
@@ -104,9 +110,11 @@ class WrenchResources extends BaseController
|
|||||||
return $this->response->setJson($res1);
|
return $this->response->setJson($res1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBlogData(){
|
private function getBlogData()
|
||||||
return ( new \App\Models\BlogDataModel() )->blogData(100);
|
{
|
||||||
|
return (new \App\Models\BlogDataModel())->blogData(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
//************************
|
//************************
|
||||||
private function AskCategoryData(): array
|
private function AskCategoryData(): array
|
||||||
{
|
{
|
||||||
@@ -126,7 +134,7 @@ class WrenchResources extends BaseController
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function uploadTypes(): array
|
private function uploadTypes(): array
|
||||||
@@ -172,6 +180,7 @@ class WrenchResources extends BaseController
|
|||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CategoryData(): array
|
private function CategoryData(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -222,8 +231,9 @@ class WrenchResources extends BaseController
|
|||||||
"content" => "Activity",
|
"content" => "Activity",
|
||||||
],
|
],
|
||||||
*/
|
*/
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
//************************************
|
//************************************
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
@@ -231,14 +241,15 @@ class WrenchResources extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function familyresources(){
|
public function familyresources()
|
||||||
|
{
|
||||||
|
|
||||||
log_message('critical', "WrenchResources-> " );
|
log_message('critical', "WrenchResources-> ");
|
||||||
|
|
||||||
log_message('critical', "0001");
|
log_message('critical', "0001");
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
log_message('critical', "WrenchResources Path GATE 001");
|
log_message('critical', "WrenchResources Path GATE 001");
|
||||||
$call_backend = true;
|
$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");
|
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");
|
log_message('critical', "0003");
|
||||||
@@ -248,13 +259,12 @@ class WrenchResources extends BaseController
|
|||||||
header('content-type: application/json; charset=utf-8');
|
header('content-type: application/json; charset=utf-8');
|
||||||
$method = $_SERVER['REQUEST_METHOD'];
|
$method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
|
||||||
$ip_loc = $this->getIpData();
|
$ip_loc = $this->getIpData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($method == "OPTIONS") {
|
if ($method == "OPTIONS") {
|
||||||
header("HTTP/1.1 200 OK CORS");
|
header("HTTP/1.1 200 OK CORS");
|
||||||
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****" );
|
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,14 +276,14 @@ class WrenchResources extends BaseController
|
|||||||
if ($pos > 5) {
|
if ($pos > 5) {
|
||||||
$uri = substr($uri, 0, $pos);
|
$uri = substr($uri, 0, $pos);
|
||||||
}
|
}
|
||||||
log_message('critical', "API-GATE URI -> ".$uri );
|
log_message('critical', "API-GATE URI -> " . $uri);
|
||||||
$pieces = explode('/', $uri);
|
$pieces = explode('/', $uri);
|
||||||
$psc = count($pieces);
|
$psc = count($pieces);
|
||||||
|
|
||||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||||
log_message('critical', "Enpoint-> ".$endpoint );
|
log_message('critical', "Enpoint-> " . $endpoint);
|
||||||
|
|
||||||
$endpoints = $this->endPointList();
|
$endpoints = $this->endPointList();
|
||||||
$out = array();
|
$out = array();
|
||||||
$res1 = [];
|
$res1 = [];
|
||||||
// if (array_key_exists($endpoint, $endpoints)) {
|
// if (array_key_exists($endpoint, $endpoints)) {
|
||||||
@@ -286,26 +296,26 @@ class WrenchResources extends BaseController
|
|||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$current_env = $this->getSiteConfigurations("system.live");
|
$current_env = $this->getSiteConfigurations("system.live");
|
||||||
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
||||||
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
||||||
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||||
|
|
||||||
// echo "EXYTACT INPUT DATA HERE";
|
// echo "EXYTACT INPUT DATA HERE";
|
||||||
$raw_json = file_get_contents('php://input');
|
$raw_json = file_get_contents('php://input');
|
||||||
$raw_array = json_decode($raw_json, true);
|
$raw_array = json_decode($raw_json, true);
|
||||||
$local_out =[];
|
$local_out = [];
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||||
log_message('critical', "Enpoint LOC2 HERE -> ".$endpoint );
|
log_message('critical', "Enpoint LOC2 HERE -> " . $endpoint);
|
||||||
$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;
|
||||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||||
log_message('critical', "WrenchResources Path GATE 005");
|
log_message('critical', "WrenchResources Path GATE 005");
|
||||||
// $res1['tab_categories'] = json_encode( $this->getFamilyResourceCategory($in));
|
// $res1['tab_categories'] = json_encode( $this->getFamilyResourceCategory($in));
|
||||||
$res1 = $this->getFamilyResourceCategory($in);
|
$res1 = $this->getFamilyResourceCategory($in);
|
||||||
log_message('critical', "WrenchResources Path GATE 010 " . serialize($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 010 " . serialize($res1['tab_categories']));
|
||||||
log_message('critical', "WrenchResources Path GATE 11");
|
log_message('critical', "WrenchResources Path GATE 11");
|
||||||
@@ -313,14 +323,15 @@ class WrenchResources extends BaseController
|
|||||||
return $this->response->setJson($res1);
|
return $this->response->setJson($res1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function commonmedia(){
|
public function commonmedia()
|
||||||
|
{
|
||||||
|
|
||||||
log_message('critical', "WrenchResources-> " );
|
log_message('critical', "WrenchResources-> ");
|
||||||
|
|
||||||
log_message('critical', "0001");
|
log_message('critical', "0001");
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
log_message('critical', "WrenchResources Path GATE 001");
|
log_message('critical', "WrenchResources Path GATE 001");
|
||||||
$call_backend = true;
|
$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");
|
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");
|
log_message('critical', "0003");
|
||||||
@@ -330,13 +341,12 @@ class WrenchResources extends BaseController
|
|||||||
header('content-type: application/json; charset=utf-8');
|
header('content-type: application/json; charset=utf-8');
|
||||||
$method = $_SERVER['REQUEST_METHOD'];
|
$method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
|
||||||
$ip_loc = $this->getIpData();
|
$ip_loc = $this->getIpData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($method == "OPTIONS") {
|
if ($method == "OPTIONS") {
|
||||||
header("HTTP/1.1 200 OK CORS");
|
header("HTTP/1.1 200 OK CORS");
|
||||||
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****" );
|
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,71 +358,74 @@ class WrenchResources extends BaseController
|
|||||||
if ($pos > 5) {
|
if ($pos > 5) {
|
||||||
$uri = substr($uri, 0, $pos);
|
$uri = substr($uri, 0, $pos);
|
||||||
}
|
}
|
||||||
log_message('critical', "API-GATE URI -> ".$uri );
|
log_message('critical', "API-GATE URI -> " . $uri);
|
||||||
$pieces = explode('/', $uri);
|
$pieces = explode('/', $uri);
|
||||||
$psc = count($pieces);
|
$psc = count($pieces);
|
||||||
|
|
||||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||||
log_message('critical', "Enpoint-> ".$endpoint );
|
log_message('critical', "Enpoint-> " . $endpoint);
|
||||||
|
|
||||||
$endpoints = $this->endPointList();
|
$endpoints = $this->endPointList();
|
||||||
$out = array();
|
$out = array();
|
||||||
$res1 = [];
|
$res1 = [];
|
||||||
|
|
||||||
|
|
||||||
$current_env = $this->getSiteConfigurations("system.live");
|
$current_env = $this->getSiteConfigurations("system.live");
|
||||||
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
||||||
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
||||||
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||||
|
|
||||||
// echo "EXYTACT INPUT DATA HERE";
|
// echo "EXYTACT INPUT DATA HERE";
|
||||||
$raw_json = file_get_contents('php://input');
|
$raw_json = file_get_contents('php://input');
|
||||||
$raw_array = json_decode($raw_json, true);
|
$raw_array = json_decode($raw_json, true);
|
||||||
$local_out =[];
|
$local_out = [];
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||||
log_message('critical', "Enpoint LOC2 HERE -> ".$endpoint );
|
log_message('critical', "Enpoint LOC2 HERE -> " . $endpoint);
|
||||||
$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;
|
||||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||||
log_message('critical', "WrenchResources Path GATE 005");
|
log_message('critical', "WrenchResources Path GATE 005");
|
||||||
$res1 = $this->getCommonMediaList($in);
|
$res1 = $this->getCommonMediaList($in);
|
||||||
log_message('critical', "WrenchResources Path GATE 010 " . serialize($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 010 " . serialize($res1['tab_categories']));
|
||||||
log_message('critical', "WrenchResources Path GATE 11");
|
log_message('critical', "WrenchResources Path GATE 11");
|
||||||
|
|
||||||
return $this->response->setJson($res1);
|
return $this->response->setJson($res1);
|
||||||
}
|
}
|
||||||
private function getFamilyResourceCategory($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/famresourcecat";
|
|
||||||
log_message('critical', "WrenchResources Path GATE 00666 -> ".$local_url);
|
|
||||||
return $this->APIcall('GET', $local_url, $in);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
log_message('critical', "WrenchResources Path GATE 007 - ".$e->getMessage());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getCommonMediaList($in){
|
private function getFamilyResourceCategory($in)
|
||||||
|
{
|
||||||
log_message('critical', "WrenchResources Path GATE 006");
|
log_message('critical', "WrenchResources Path GATE 006");
|
||||||
try {
|
try {
|
||||||
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||||
$local_url = "http://".$micro_service_net1.":3034/commonmedia";
|
$local_url = "http://" . $micro_service_net1 . ":3034/famresourcecat";
|
||||||
log_message('critical', "WrenchResources Path GATE 00-commonmedia-> ".$local_url);
|
log_message('critical', "WrenchResources Path GATE 00666 -> " . $local_url);
|
||||||
return $this->APIcall('GET', $local_url, $in);
|
return $this->APIcall('GET', $local_url, $in);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
log_message('critical', "WrenchResources Path GATE 007 commonmedia - ".$e->getMessage());
|
log_message('critical', "WrenchResources Path GATE 007 - " . $e->getMessage());
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CollectionData(){
|
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()
|
||||||
|
{
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
"data" => [
|
"data" => [
|
||||||
[
|
[
|
||||||
@@ -534,9 +547,11 @@ class WrenchResources extends BaseController
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
private function ProductData(){
|
|
||||||
|
private function ProductData()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
@@ -616,9 +631,11 @@ return $arrayVar;
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
private function MarketData(){
|
|
||||||
|
private function MarketData()
|
||||||
|
{
|
||||||
|
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
"data" => [
|
"data" => [
|
||||||
@@ -742,9 +759,141 @@ return $arrayVar;
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $arrayVar ;
|
return $arrayVar;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCountryStates(){
|
||||||
|
$raw_json = file_get_contents('php://input');
|
||||||
|
$in = json_decode($raw_json, true);
|
||||||
|
$out =[];
|
||||||
|
$in["action"] = -1; //
|
||||||
|
$out["country_state"]['US'] = $this->usStates();
|
||||||
|
$out["country_state"]['NG'] = $this->ngStates();
|
||||||
|
$out["country_state"]['CA'] = $this->caStates();
|
||||||
|
return $this->summaryReturnData($in,$out); //json_encode( $final_out );
|
||||||
|
}
|
||||||
|
private function usStates()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'AL' => 'Alabama',
|
||||||
|
'AK' => 'Alaska',
|
||||||
|
'AZ' => 'Arizona',
|
||||||
|
'AR' => 'Arkansas',
|
||||||
|
'CA' => 'California',
|
||||||
|
'CO' => 'Colorado',
|
||||||
|
'CT' => 'Connecticut',
|
||||||
|
'DE' => 'Delaware',
|
||||||
|
'DC' => 'District Of Columbia',
|
||||||
|
'FL' => 'Florida',
|
||||||
|
'GA' => 'Georgia',
|
||||||
|
'HI' => 'Hawaii',
|
||||||
|
'ID' => 'Idaho',
|
||||||
|
'IL' => 'Illinois',
|
||||||
|
'IN' => 'Indiana',
|
||||||
|
'IA' => 'Iowa',
|
||||||
|
'KS' => 'Kansas',
|
||||||
|
'KY' => 'Kentucky',
|
||||||
|
'LA' => 'Louisiana',
|
||||||
|
'ME' => 'Maine',
|
||||||
|
'MD' => 'Maryland',
|
||||||
|
'MA' => 'Massachusetts',
|
||||||
|
'MI' => 'Michigan',
|
||||||
|
'MN' => 'Minnesota',
|
||||||
|
'MS' => 'Mississippi',
|
||||||
|
'MO' => 'Missouri',
|
||||||
|
'MT' => 'Montana',
|
||||||
|
'NE' => 'Nebraska',
|
||||||
|
'NV' => 'Nevada',
|
||||||
|
'NH' => 'New Hampshire',
|
||||||
|
'NJ' => 'New Jersey',
|
||||||
|
'NM' => 'New Mexico',
|
||||||
|
'NY' => 'New York',
|
||||||
|
'NC' => 'North Carolina',
|
||||||
|
'ND' => 'North Dakota',
|
||||||
|
'OH' => 'Ohio',
|
||||||
|
'OK' => 'Oklahoma',
|
||||||
|
'OR' => 'Oregon',
|
||||||
|
'PA' => 'Pennsylvania',
|
||||||
|
'RI' => 'Rhode Island',
|
||||||
|
'SC' => 'South Carolina',
|
||||||
|
'SD' => 'South Dakota',
|
||||||
|
'TN' => 'Tennessee',
|
||||||
|
'TX' => 'Texas',
|
||||||
|
'UT' => 'Utah',
|
||||||
|
'VT' => 'Vermont',
|
||||||
|
'VA' => 'Virginia',
|
||||||
|
'WA' => 'Washington',
|
||||||
|
'WV' => 'West Virginia',
|
||||||
|
'WI' => 'Wisconsin',
|
||||||
|
'WY' => 'Wyoming',
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function ngStates()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'FC' => 'Abuja',
|
||||||
|
'AB' => 'Abia',
|
||||||
|
'AD' => 'Adamawa',
|
||||||
|
'AK' => 'Akwa Ibom',
|
||||||
|
'AN' => 'Anambra',
|
||||||
|
'BA' => 'Bauchi',
|
||||||
|
'BY' => 'Bayelsa',
|
||||||
|
'BE' => 'Benue',
|
||||||
|
'BO' => 'Borno',
|
||||||
|
'CR' => 'Cross River',
|
||||||
|
'DE' => 'Delta',
|
||||||
|
'EB' => 'Ebonyi',
|
||||||
|
'ED' => 'Edo',
|
||||||
|
'EK' => 'Ekiti',
|
||||||
|
'EN' => 'Enugu',
|
||||||
|
'GO' => 'Gombe',
|
||||||
|
'IM' => 'Imo',
|
||||||
|
'JI' => 'Jigawa',
|
||||||
|
'KD' => 'Kaduna',
|
||||||
|
'KN' => 'Kano',
|
||||||
|
'KT' => 'Katsina',
|
||||||
|
'KE' => 'Kebbi',
|
||||||
|
'KO' => 'Kogi',
|
||||||
|
'KW' => 'Kwara',
|
||||||
|
'LA' => 'Lagos',
|
||||||
|
'NA' => 'Nassarawa',
|
||||||
|
'NI' => 'Niger',
|
||||||
|
'OG' => 'Ogun',
|
||||||
|
'ON' => 'Ondo',
|
||||||
|
'OS' => 'Osun',
|
||||||
|
'OY' => 'Oyo',
|
||||||
|
'PL' => 'Plateau',
|
||||||
|
'RI' => 'Rivers',
|
||||||
|
'SO' => 'Sokoto',
|
||||||
|
'TA' => 'Taraba',
|
||||||
|
'YO' => 'Yobe',
|
||||||
|
'ZA' => 'Zamfara',
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function caStates()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'AB' => 'Alberta',
|
||||||
|
'BC' => 'British Columbia',
|
||||||
|
'MB' => 'Manitoba',
|
||||||
|
'NB' => 'New Brunswick',
|
||||||
|
'NL' => 'Newfoundland and Labrador',
|
||||||
|
'NS' => 'Nova Scotia',
|
||||||
|
'ON' => 'Ontario',
|
||||||
|
'PE' => 'Prince Edward Island',
|
||||||
|
'QC' => 'Quebec',
|
||||||
|
'SK' => 'Saskatchewan',
|
||||||
|
'NT' => 'Northwest Territories',
|
||||||
|
'NU' => 'Nunavut',
|
||||||
|
'YT' => 'Yukon',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user