526 lines
18 KiB
PHP
526 lines
18 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
//use CodeIgniter\API\ResponseTrait;
|
|
use Orhanerday\OpenAi\OpenAi;
|
|
|
|
class WrenchResources extends BaseController
|
|
{
|
|
|
|
public function blogTopics(){
|
|
|
|
$open_ai_key = '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';
|
|
|
|
$open_ai = new OpenAi($open_ai_key);
|
|
|
|
$prompt = "autonomous cars";
|
|
|
|
$complete = $open_ai->completion([
|
|
'model' => 'davinci-instruct-beta-v3',
|
|
'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";
|
|
|
|
$complete = $open_ai->completion([
|
|
'model' => 'text-davinci-003',
|
|
'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);
|
|
}
|
|
public function index()
|
|
{
|
|
|
|
}
|
|
|
|
private function AskCategoryData(){
|
|
|
|
|
|
$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(){
|
|
|
|
//JPG, PNG, GIP, SVG, MP4, MP3, WEBM, OGG, GLB, GLTF
|
|
$arrayVar = [
|
|
"data" => [
|
|
[
|
|
"id" => "JPG",
|
|
"name" => "JPG",
|
|
"max_size_mb" => "5",
|
|
],
|
|
[
|
|
"id" => "PNG",
|
|
"name" => "PNG",
|
|
"max_size_mb" => "4",
|
|
],
|
|
[
|
|
"id" => "GIP",
|
|
"name" => "GIP",
|
|
"max_size_mb" => "4",
|
|
],
|
|
[
|
|
"id" => "BMP",
|
|
"name" => "BMP",
|
|
"max_size_mb" => "4",
|
|
],
|
|
[
|
|
"id" => "PDF",
|
|
"name" => "PDF",
|
|
"max_size_mb" => "4",
|
|
],
|
|
[
|
|
"id" => "MP4",
|
|
"name" => "MP4",
|
|
"max_size_mb" => "10",
|
|
],
|
|
|
|
]
|
|
];
|
|
|
|
return $arrayVar;
|
|
|
|
}
|
|
private function CategoryData(){
|
|
|
|
|
|
$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;
|
|
}
|
|
|
|
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 ;
|
|
|
|
|
|
}
|
|
|
|
} |