Resource function
This commit is contained in:
@@ -10,7 +10,9 @@ use Orhanerday\OpenAi\OpenAi;
|
|||||||
class WrenchResources extends BaseController
|
class WrenchResources extends BaseController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
public function generatives(){
|
|
||||||
|
public function generatives()
|
||||||
|
{
|
||||||
$raw_json = file_get_contents('php://input');
|
$raw_json = file_get_contents('php://input');
|
||||||
$in = json_decode($raw_json, true);
|
$in = json_decode($raw_json, true);
|
||||||
|
|
||||||
@@ -23,8 +25,7 @@ class WrenchResources extends BaseController
|
|||||||
for ($ii = 1; $ii <= 4; $ii++) {
|
for ($ii = 1; $ii <= 4; $ii++) {
|
||||||
if ($ii == $ansPos) {
|
if ($ii == $ansPos) {
|
||||||
$option_mix[] = $c;
|
$option_mix[] = $c;
|
||||||
}else
|
} else {
|
||||||
{
|
|
||||||
$ansRand = rand(1000, 9999);
|
$ansRand = rand(1000, 9999);
|
||||||
$option_mix[] = ($ansRand == $c) ? $ansRand + rand(1, 5) : $ansRand;
|
$option_mix[] = ($ansRand == $c) ? $ansRand + rand(1, 5) : $ansRand;
|
||||||
}
|
}
|
||||||
@@ -46,7 +47,9 @@ class WrenchResources extends BaseController
|
|||||||
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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';
|
||||||
|
|
||||||
@@ -69,7 +72,8 @@ class WrenchResources extends BaseController
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function aigate(){
|
public function aigate()
|
||||||
|
{
|
||||||
|
|
||||||
$open_ai_key = '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';
|
$open_ai_key = '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';
|
||||||
|
|
||||||
@@ -92,7 +96,9 @@ 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(){
|
|
||||||
|
public function website()
|
||||||
|
{
|
||||||
log_message('critical', "WrenchResources-> ");
|
log_message('critical', "WrenchResources-> ");
|
||||||
$res1['tab_categories'] = $this->CategoryData();
|
$res1['tab_categories'] = $this->CategoryData();
|
||||||
$res1['ask_categories'] = $this->AskCategoryData();
|
$res1['ask_categories'] = $this->AskCategoryData();
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -172,6 +180,7 @@ class WrenchResources extends BaseController
|
|||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CategoryData(): array
|
private function CategoryData(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -224,6 +233,7 @@ class WrenchResources extends BaseController
|
|||||||
*/
|
*/
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
//************************************
|
//************************************
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
@@ -231,7 +241,8 @@ class WrenchResources extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function familyresources(){
|
public function familyresources()
|
||||||
|
{
|
||||||
|
|
||||||
log_message('critical', "WrenchResources-> ");
|
log_message('critical', "WrenchResources-> ");
|
||||||
|
|
||||||
@@ -251,7 +262,6 @@ class WrenchResources extends BaseController
|
|||||||
$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*****");
|
||||||
@@ -313,7 +323,8 @@ 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-> ");
|
||||||
|
|
||||||
@@ -333,7 +344,6 @@ class WrenchResources extends BaseController
|
|||||||
$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*****");
|
||||||
@@ -385,7 +395,9 @@ class WrenchResources extends BaseController
|
|||||||
|
|
||||||
return $this->response->setJson($res1);
|
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 {
|
||||||
$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";
|
||||||
@@ -398,7 +410,8 @@ class WrenchResources extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCommonMediaList($in){
|
private function getCommonMediaList($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";
|
||||||
@@ -411,8 +424,8 @@ class WrenchResources extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function CollectionData(){
|
private function CollectionData()
|
||||||
|
{
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
"data" => [
|
"data" => [
|
||||||
[
|
[
|
||||||
@@ -536,7 +549,9 @@ class WrenchResources extends BaseController
|
|||||||
];
|
];
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
private function ProductData(){
|
|
||||||
|
private function ProductData()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
@@ -618,7 +633,9 @@ return $arrayVar;
|
|||||||
|
|
||||||
return $arrayVar;
|
return $arrayVar;
|
||||||
}
|
}
|
||||||
private function MarketData(){
|
|
||||||
|
private function MarketData()
|
||||||
|
{
|
||||||
|
|
||||||
$arrayVar = [
|
$arrayVar = [
|
||||||
"data" => [
|
"data" => [
|
||||||
@@ -747,4 +764,136 @@ 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