作者 李小龙

可视化数据类型接口,数据结构调整

... ... @@ -20,3 +20,6 @@ composer.lock
app/Console/Commands/Test/Demo.php
/public/upload
/public/runtime
public/nginx.htaccess
public/.htaccess
.gitignore
... ...
... ... @@ -3,6 +3,10 @@
namespace App\Http\Logic\Bside\BTemplate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Blog\BlogCategory;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\Product;
use App\Models\Template\ModuleSetting;
use App\Models\Template\Template;
use App\Models\Template\BSetting;
... ... @@ -148,16 +152,92 @@ class BTemplateLogic extends BaseLogic
* @remark :获取类型
* @name :getModuleType
* @author :lyh
* @method :post
* @method :any
* @time :2023/7/17 16:03
*/
public function getModuleType(){
$data = [];
$moduleTypeModel = new ModuleSetting();
$list = $moduleTypeModel->list();
foreach ($list as $v){
$data[$v['type']][] = [$v['values']=>$v['key']];
public function getModuleType(): array
{
//定义数据结构
$data = [
"products"=>[
"category"=>[
[
"id"=>"hot",
"title"=>"热销产品",
],
[
"id"=>"recommend",
"title"=>"推荐产品",
],
],
"imageType"=>[
[
"id"=>1,
"title"=>"产品图片",
],[
"id"=>2,
"title"=>"产品分类图片",
],[
"id"=>3,
"title"=>"产品图标",
]
],
],
"news"=>[
"category"=>[
[
"id"=>"new",
"name"=>"最新",
],
],
],
"blogs"=>[
"category"=>[
[
"id"=>"new",
"name"=>"最新",
],
],
],
"productCategory"=>[
"category"=>[
[
"id"=>1,
"title"=>"分类1",
],
[
"id"=>2,
"title"=>"分类2",
],
[
"id"=>3,
"title"=>"分类3",
],
],
]
];
//产品,新闻,博客,一级分类数据
$productCategory = Category::where("pid",0)->get();
$newCategory = NewsCategory::where("pid",0)->get();
$blogCategory = BlogCategory::where("pid",0)->get();
if (!empty($productCategory)){
foreach ($productCategory as $item){
$data["products"]["category"][] =$item;
}
}
if (!empty($newCategory)){
foreach ($newCategory as $item){
$data["news"]["category"][] =$item;
}
}
if (!empty($blogCategory)){
foreach ($blogCategory as $item){
$data["blogs"]["category"][] =$item;
}
}
//返回
return $this->success($data);
}
}
... ...
... ... @@ -35,7 +35,7 @@ class BaseLogic extends Logic
$this->request = request();
$this->requestAll = request()->all();
$this->user = Cache::get(request()->header('token'));
$this->project = (new ProjectLogic())->getInfo($this->user['project_id']);
// $this->project = (new ProjectLogic())->getInfo($this->user['project_id']);
}
... ...
... ... @@ -4,6 +4,10 @@ namespace App\Models\Blog;
use App\Models\Base;
/**
* @method static get()
* @method static where(string $string, int $int)
*/
class BlogCategory extends Base
{
protected $table = 'gl_blog_category';
... ...
... ... @@ -4,6 +4,10 @@ namespace App\Models\News;
use App\Models\Base;
/**
* @method static get()
* @method static where(string $string, int $int)
*/
class NewsCategory extends Base
{
protected $table = 'gl_news_category';
... ...
... ... @@ -8,6 +8,10 @@ use App\Models\RouteMap;
use App\Services\Facades\Upload;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @method static get()
* @method static where(string $string, int $int)
*/
class Category extends Base
{
use SoftDeletes;
... ...
... ... @@ -8,6 +8,9 @@ use App\Models\RouteMap;
use App\Services\Facades\Upload;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* @method static get()
*/
class Product extends Base
{
use SoftDeletes;
... ...
此 diff 太大无法显示。
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>