905 lines
31 KiB
PHP
905 lines
31 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
//use CodeIgniter\API\ResponseTrait;
|
|
use CodeIgniter\API\ResponseTrait;
|
|
use Exception;
|
|
use Orhanerday\OpenAi\OpenAi;
|
|
|
|
class WrenchResources extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
|
|
public function generatives()
|
|
{
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
|
|
$a = rand(1, 20);
|
|
$b = rand(1, 30);
|
|
$c = $a + $b;
|
|
|
|
$ansPos = rand(1, 4);
|
|
$option_mix = [];
|
|
for ($ii = 1; $ii <= 4; $ii++) {
|
|
if ($ii == $ansPos) {
|
|
$option_mix[] = $c;
|
|
} else {
|
|
$ansRand = rand(1000, 9999);
|
|
$option_mix[] = ($ansRand == $c) ? $ansRand + rand(1, 5) : $ansRand;
|
|
}
|
|
}
|
|
|
|
//[ rand(1000,9999), $c , rand(1000,9999)]
|
|
|
|
$next_question = [
|
|
"question" => "What is C ? <br> C = $a + $b .",
|
|
"option" => $option_mix,
|
|
"answer" => $c,
|
|
'option_mix' => $option_mix,
|
|
"last" => false,
|
|
"points" => 10
|
|
];
|
|
$out = [
|
|
"next_question" => $next_question
|
|
];
|
|
log_message('critical', "***** ***** WrenchResources::generatives Ret ");
|
|
return $this->respond($this->summaryReturnData($in, $out), 200);
|
|
}
|
|
|
|
public function blogTopics()
|
|
{
|
|
|
|
$open_ai_key = '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';
|
|
|
|
$open_ai = new OpenAi($open_ai_key);
|
|
|
|
$prompt = "autonomous cars";
|
|
// text-davinci-003 davinci-instruct-beta-v3
|
|
$complete = $open_ai->completion([
|
|
'model' => 'gpt-3.5-turbo-instruct',
|
|
'prompt' => 'Generate blog topics on: ' . $prompt,
|
|
'temperature' => 0.9,
|
|
'max_tokens' => 150,
|
|
'frequency_penalty' => 0,
|
|
'presence_penalty' => 0.6,
|
|
]);
|
|
|
|
$response = json_decode($complete, true);
|
|
//$response = $response["choices"][0]["text"];
|
|
// return $this->response->setJson($response);
|
|
return $response;
|
|
}
|
|
|
|
public function aigate()
|
|
{
|
|
|
|
$open_ai_key = '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';
|
|
|
|
$open_ai = new OpenAi($open_ai_key);
|
|
|
|
$prompt = " autonomous cars";
|
|
// 'model' => 'text-davinci-003',
|
|
$complete = $open_ai->completion([
|
|
|
|
'model' => 'gpt-3.5-turbo-instruct',
|
|
'prompt' => 'Writing 3 marketing Facebook caption for ' . $prompt,
|
|
'temperature' => 0.9,
|
|
'max_tokens' => 150,
|
|
'frequency_penalty' => 0,
|
|
'presence_penalty' => 0.6,
|
|
]);
|
|
|
|
$response = json_decode($complete, true);
|
|
//$response = $response["choices"][0]["text"];
|
|
$response["other_topic"] = $this->blogTopics();
|
|
return $this->response->setJson($response);
|
|
}
|
|
|
|
public function website()
|
|
{
|
|
log_message('critical', "WrenchResources-> ");
|
|
$res1['tab_categories'] = $this->CategoryData();
|
|
$res1['ask_categories'] = $this->AskCategoryData();
|
|
$res1['upload_types'] = $this->uploadTypes();
|
|
$res1['marketdata'] = $this->MarketData();
|
|
$res1['productdata'] = $this->ProductData();
|
|
$res1['collectiondata'] = $this->CollectionData();
|
|
$res1['blogdata'] = $this->getBlogData();
|
|
return $this->response->setJson($res1);
|
|
}
|
|
|
|
private function getBlogData()
|
|
{
|
|
return (new \App\Models\BlogDataModel())->blogData(100);
|
|
}
|
|
|
|
//************************
|
|
private function AskCategoryData(): array
|
|
{
|
|
|
|
|
|
$arrayVar = [
|
|
"data" => [
|
|
[
|
|
"id" => "0",
|
|
"name" => "Possible Topics on ",
|
|
"question_key" => "ASK01",
|
|
],
|
|
[
|
|
"id" => "1",
|
|
"name" => "Summary description of",
|
|
"question_key" => "ASK02",
|
|
],
|
|
]
|
|
];
|
|
return $arrayVar;
|
|
}
|
|
|
|
private function uploadTypes(): array
|
|
{
|
|
|
|
//JPG, PNG, GIP, SVG, MP4, MP3, WEBM, OGG, GLB, GLTF
|
|
$arrayVar = [
|
|
"data" => [
|
|
[
|
|
"id" => "JPG",
|
|
"name" => "JPG",
|
|
"max_size_mb" => "8",
|
|
],
|
|
[
|
|
"id" => "PNG",
|
|
"name" => "PNG",
|
|
"max_size_mb" => "15",
|
|
],
|
|
[
|
|
"id" => "GIP",
|
|
"name" => "GIP",
|
|
"max_size_mb" => "8",
|
|
],
|
|
[
|
|
"id" => "BMP",
|
|
"name" => "BMP",
|
|
"max_size_mb" => "8",
|
|
],
|
|
[
|
|
"id" => "PDF",
|
|
"name" => "PDF",
|
|
"max_size_mb" => "4",
|
|
],
|
|
[
|
|
"id" => "MP4",
|
|
"name" => "MP4",
|
|
"max_size_mb" => "60",
|
|
],
|
|
|
|
]
|
|
];
|
|
|
|
return $arrayVar;
|
|
|
|
}
|
|
|
|
private function CategoryData(): array
|
|
{
|
|
|
|
|
|
$arrayVar = [
|
|
"data" => [
|
|
[
|
|
"id" => "0",
|
|
"name" => "blog",
|
|
"content" => "Blog",
|
|
"enabled" => 1
|
|
],
|
|
[
|
|
"id" => "1",
|
|
"name" => "onsale",
|
|
"content" => "Questions?",
|
|
"enabled" => 1
|
|
],
|
|
[
|
|
"id" => "2",
|
|
"name" => "owned",
|
|
"content" => "Interesting",
|
|
"enabled" => 0
|
|
],
|
|
[
|
|
"id" => "3",
|
|
"name" => "created",
|
|
"content" => "My Items",
|
|
"enabled" => 1
|
|
],
|
|
|
|
]
|
|
];
|
|
/*
|
|
* [
|
|
"id" => "4",
|
|
"name" => "hidden",
|
|
"content" => "Hidden",
|
|
],
|
|
[
|
|
"id" => "5",
|
|
"name" => "collection",
|
|
"content" => "Collection",
|
|
],
|
|
[
|
|
"id" => "6",
|
|
"name" => "activity",
|
|
"content" => "Activity",
|
|
],
|
|
*/
|
|
return $arrayVar;
|
|
}
|
|
|
|
//************************************
|
|
|
|
public function index()
|
|
{
|
|
|
|
}
|
|
|
|
public function familyresources()
|
|
{
|
|
|
|
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 = [];
|
|
// if (array_key_exists($endpoint, $endpoints)) {
|
|
// } else {
|
|
// http_response_code(404);
|
|
// // tell the user product does not exist
|
|
// echo json_encode([
|
|
// 'message' => 'Endpoint not found.',
|
|
// 'URI' => $uri,
|
|
// ]);
|
|
// }
|
|
|
|
$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['tab_categories'] = json_encode( $this->getFamilyResourceCategory($in));
|
|
$res1 = $this->getFamilyResourceCategory($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);
|
|
}
|
|
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
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 = [
|
|
"data" => [
|
|
[
|
|
"id" => 0,
|
|
"uniqKey" => "627b4cb23264a7b4da238c4c",
|
|
"owner" => "profile.png",
|
|
"title" => "Seo Planes",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "plan",
|
|
"images" => [
|
|
"collection-plan-1.jpg",
|
|
"collection-plan-2.jpg",
|
|
"collection-plan-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 1,
|
|
"uniqKey" => "627b4cb295315cc47b9f68bc",
|
|
"owner" => "profile.png",
|
|
"title" => "Amazing Game",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "game",
|
|
"images" => [
|
|
"collection-game-1.jpg",
|
|
"collection-game-2.jpg",
|
|
"collection-game-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 2,
|
|
"uniqKey" => "627b4cb2f0da1da277df14a4",
|
|
"owner" => "profile.png",
|
|
"title" => "Arts",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "arts",
|
|
"images" => [
|
|
"collection-arts-1.jpg",
|
|
"collection-arts-2.jpg",
|
|
"collection-arts-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 3,
|
|
"uniqKey" => "627b4cb20335c7c1d90557fb",
|
|
"owner" => "profile.png",
|
|
"title" => "Photography",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "photography",
|
|
"images" => [
|
|
"collection-photography-1.jpg",
|
|
"collection-photography-2.jpg",
|
|
"collection-photography-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 4,
|
|
"uniqKey" => "627b4cb208149e95b9bcde87",
|
|
"owner" => "profile.png",
|
|
"title" => "Domin",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "domain",
|
|
"images" => [
|
|
"collection-domain-1.jpg",
|
|
"collection-domain-2.jpg",
|
|
"collection-domain-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 5,
|
|
"uniqKey" => "627b4cb26b6ca42ddc5fa898",
|
|
"owner" => "profile.png",
|
|
"title" => "Sports",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "sports",
|
|
"images" => [
|
|
"collection-sports-1.jpg",
|
|
"collection-sports-2.jpg",
|
|
"collection-sports-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 6,
|
|
"uniqKey" => "627b4cb20c73cb389f40b602",
|
|
"owner" => "profile.png",
|
|
"title" => "Cards",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "cards",
|
|
"images" => [
|
|
"collection-cards-1.jpg",
|
|
"collection-cards-2.jpg",
|
|
"collection-cards-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 7,
|
|
"uniqKey" => "627b4cb264bf47d65f559e35",
|
|
"owner" => "profile.png",
|
|
"title" => "Uitily",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "uitily",
|
|
"images" => [
|
|
"collection-uitily-1.jpg",
|
|
"collection-uitily-2.jpg",
|
|
"collection-uitily-3.jpg",
|
|
],
|
|
],
|
|
[
|
|
"id" => 8,
|
|
"uniqKey" => "627b4cb27db9314a4c802c4c",
|
|
"owner" => "profile.png",
|
|
"title" => "Virtural Worlds",
|
|
"NumberOfItem" => "324 Item",
|
|
"category" => "worlds",
|
|
"images" => [
|
|
"collection-worlds-1.jpg",
|
|
"collection-worlds-2.jpg",
|
|
"collection-worlds-3.jpg",
|
|
],
|
|
],
|
|
],
|
|
];
|
|
return $arrayVar;
|
|
}
|
|
|
|
private function ProductData()
|
|
{
|
|
|
|
|
|
$arrayVar = [
|
|
"datas" => [
|
|
[
|
|
"id" => 0,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-1.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "laborum cupidatat sit",
|
|
],
|
|
[
|
|
"id" => 1,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-2.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "velit occaecat voluptate",
|
|
],
|
|
[
|
|
"id" => 2,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-3.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "est reprehenderit amet",
|
|
],
|
|
[
|
|
"id" => 3,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-4.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "velit tempor nostrud",
|
|
],
|
|
[
|
|
"id" => 4,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-4.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "adipisicing sit nostrud",
|
|
],
|
|
[
|
|
"id" => 5,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-3.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "occaecat veniam commodo",
|
|
],
|
|
[
|
|
"id" => 6,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-2.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "nostrud ex pariatur",
|
|
],
|
|
[
|
|
"id" => 7,
|
|
"username" => "Bilout",
|
|
"profile_img" => "profile.png",
|
|
"price" => "75,320 ETH",
|
|
"thumbnil" => "tranding-1.jpg",
|
|
"remaing" => "2023-03-04 4:00:00",
|
|
"title" => "culpa ad proident",
|
|
],
|
|
],
|
|
];
|
|
|
|
return $arrayVar;
|
|
}
|
|
|
|
private function MarketData()
|
|
{
|
|
|
|
$arrayVar = [
|
|
"data" => [
|
|
[
|
|
"id" => 0,
|
|
"owner" => "Long",
|
|
"creator" => "Riddle",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => true,
|
|
"thumbnil" => "marketplace-product-1.jpg",
|
|
"title" => "fugiat labore cillum",
|
|
"isActive" => true,
|
|
],
|
|
[
|
|
"id" => 1,
|
|
"owner" => "Alford",
|
|
"creator" => "Reese",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-2.jpg",
|
|
"title" => "veniam dolore dolore",
|
|
"isActive" => true,
|
|
],
|
|
[
|
|
"id" => 2,
|
|
"owner" => "Coffey",
|
|
"creator" => "Sheppard",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-3.jpg",
|
|
"title" => "pariatur cillum et",
|
|
"isActive" => true,
|
|
],
|
|
[
|
|
"id" => 3,
|
|
"owner" => "Strickland",
|
|
"creator" => "Macias",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-4.jpg",
|
|
"title" => "pariatur cillum dolore",
|
|
"isActive" => false,
|
|
],
|
|
[
|
|
"id" => 4,
|
|
"owner" => "Whitfield",
|
|
"creator" => "Buckley",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-5.jpg",
|
|
"title" => "enim ad tempor",
|
|
"isActive" => true,
|
|
],
|
|
[
|
|
"id" => 5,
|
|
"owner" => "Casey",
|
|
"creator" => "Gaines",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-6.jpg",
|
|
"title" => "enim Lorem fugiat",
|
|
"isActive" => false,
|
|
],
|
|
[
|
|
"id" => 6,
|
|
"owner" => "Tate",
|
|
"creator" => "Berry",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-7.jpg",
|
|
"title" => "consectetur sit anim",
|
|
"isActive" => false,
|
|
],
|
|
[
|
|
"id" => 7,
|
|
"owner" => "Wells",
|
|
"creator" => "Golden",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => false,
|
|
"thumbnil" => "marketplace-product-8.jpg",
|
|
"title" => "consectetur sunt duis",
|
|
"isActive" => true,
|
|
],
|
|
[
|
|
"id" => 8,
|
|
"owner" => "Mcfadden",
|
|
"creator" => "Obrien",
|
|
"owner_img" => "owner.png",
|
|
"creator_img" => "creator.png",
|
|
"eth_price" => "75,320 ETH",
|
|
"usd_price" => "773.69 USD",
|
|
"whishlisted" => true,
|
|
"thumbnil" => "marketplace-product-9.jpg",
|
|
"title" => "officia ad reprehenderit",
|
|
"isActive" => true,
|
|
],
|
|
],
|
|
];
|
|
|
|
return $arrayVar;
|
|
|
|
|
|
}
|
|
|
|
public function getCountryStates(){
|
|
$raw_json = file_get_contents('php://input');
|
|
$in = json_decode($raw_json, true);
|
|
$out =[];
|
|
$outx = [];
|
|
$in["action"] = -1; //
|
|
$outx["country_state"]['US'] = $this->usStates();
|
|
$outx["country_state"]['NG'] = $this->ngStates();
|
|
$outx["country_state"]['CA'] = $this->caStates();
|
|
if ( $in["country"] !=''){
|
|
if (isset($outx["country_state"][$in["country"]])){
|
|
$out["country_state"] = $outx["country_state"][$in["country"]];
|
|
}
|
|
}
|
|
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',
|
|
|
|
];
|
|
|
|
}
|
|
} |