|
...
|
...
|
@@ -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);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|