作者 李小龙

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

@@ -20,3 +20,6 @@ composer.lock @@ -20,3 +20,6 @@ composer.lock
20 app/Console/Commands/Test/Demo.php 20 app/Console/Commands/Test/Demo.php
21 /public/upload 21 /public/upload
22 /public/runtime 22 /public/runtime
  23 +public/nginx.htaccess
  24 +public/.htaccess
  25 +.gitignore
@@ -3,6 +3,10 @@ @@ -3,6 +3,10 @@
3 namespace App\Http\Logic\Bside\BTemplate; 3 namespace App\Http\Logic\Bside\BTemplate;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\Blog\BlogCategory;
  7 +use App\Models\News\NewsCategory;
  8 +use App\Models\Product\Category;
  9 +use App\Models\Product\Product;
6 use App\Models\Template\ModuleSetting; 10 use App\Models\Template\ModuleSetting;
7 use App\Models\Template\Template; 11 use App\Models\Template\Template;
8 use App\Models\Template\BSetting; 12 use App\Models\Template\BSetting;
@@ -148,16 +152,92 @@ class BTemplateLogic extends BaseLogic @@ -148,16 +152,92 @@ class BTemplateLogic extends BaseLogic
148 * @remark :获取类型 152 * @remark :获取类型
149 * @name :getModuleType 153 * @name :getModuleType
150 * @author :lyh 154 * @author :lyh
151 - * @method :post 155 + * @method :any
152 * @time :2023/7/17 16:03 156 * @time :2023/7/17 16:03
153 */ 157 */
154 - public function getModuleType(){  
155 - $data = [];  
156 - $moduleTypeModel = new ModuleSetting();  
157 - $list = $moduleTypeModel->list();  
158 - foreach ($list as $v){  
159 - $data[$v['type']][] = [$v['values']=>$v['key']]; 158 + public function getModuleType(): array
  159 + {
  160 + //定义数据结构
  161 + $data = [
  162 + "products"=>[
  163 + "category"=>[
  164 + [
  165 + "id"=>"hot",
  166 + "title"=>"热销产品",
  167 + ],
  168 + [
  169 + "id"=>"recommend",
  170 + "title"=>"推荐产品",
  171 + ],
  172 + ],
  173 + "imageType"=>[
  174 + [
  175 + "id"=>1,
  176 + "title"=>"产品图片",
  177 + ],[
  178 + "id"=>2,
  179 + "title"=>"产品分类图片",
  180 + ],[
  181 + "id"=>3,
  182 + "title"=>"产品图标",
  183 + ]
  184 + ],
  185 + ],
  186 + "news"=>[
  187 + "category"=>[
  188 + [
  189 + "id"=>"new",
  190 + "name"=>"最新",
  191 + ],
  192 + ],
  193 + ],
  194 + "blogs"=>[
  195 + "category"=>[
  196 + [
  197 + "id"=>"new",
  198 + "name"=>"最新",
  199 + ],
  200 + ],
  201 + ],
  202 + "productCategory"=>[
  203 + "category"=>[
  204 + [
  205 + "id"=>1,
  206 + "title"=>"分类1",
  207 + ],
  208 + [
  209 + "id"=>2,
  210 + "title"=>"分类2",
  211 + ],
  212 + [
  213 + "id"=>3,
  214 + "title"=>"分类3",
  215 + ],
  216 + ],
  217 + ]
  218 + ];
  219 +
  220 + //产品,新闻,博客,一级分类数据
  221 + $productCategory = Category::where("pid",0)->get();
  222 + $newCategory = NewsCategory::where("pid",0)->get();
  223 + $blogCategory = BlogCategory::where("pid",0)->get();
  224 + if (!empty($productCategory)){
  225 + foreach ($productCategory as $item){
  226 + $data["products"]["category"][] =$item;
  227 + }
160 } 228 }
  229 + if (!empty($newCategory)){
  230 + foreach ($newCategory as $item){
  231 + $data["news"]["category"][] =$item;
  232 + }
  233 + }
  234 + if (!empty($blogCategory)){
  235 + foreach ($blogCategory as $item){
  236 + $data["blogs"]["category"][] =$item;
  237 + }
  238 + }
  239 +
  240 + //返回
161 return $this->success($data); 241 return $this->success($data);
162 } 242 }
163 } 243 }
@@ -35,7 +35,7 @@ class BaseLogic extends Logic @@ -35,7 +35,7 @@ class BaseLogic extends Logic
35 $this->request = request(); 35 $this->request = request();
36 $this->requestAll = request()->all(); 36 $this->requestAll = request()->all();
37 $this->user = Cache::get(request()->header('token')); 37 $this->user = Cache::get(request()->header('token'));
38 - $this->project = (new ProjectLogic())->getInfo($this->user['project_id']); 38 +// $this->project = (new ProjectLogic())->getInfo($this->user['project_id']);
39 } 39 }
40 40
41 41
@@ -4,6 +4,10 @@ namespace App\Models\Blog; @@ -4,6 +4,10 @@ namespace App\Models\Blog;
4 4
5 use App\Models\Base; 5 use App\Models\Base;
6 6
  7 +/**
  8 + * @method static get()
  9 + * @method static where(string $string, int $int)
  10 + */
7 class BlogCategory extends Base 11 class BlogCategory extends Base
8 { 12 {
9 protected $table = 'gl_blog_category'; 13 protected $table = 'gl_blog_category';
@@ -4,6 +4,10 @@ namespace App\Models\News; @@ -4,6 +4,10 @@ namespace App\Models\News;
4 4
5 use App\Models\Base; 5 use App\Models\Base;
6 6
  7 +/**
  8 + * @method static get()
  9 + * @method static where(string $string, int $int)
  10 + */
7 class NewsCategory extends Base 11 class NewsCategory extends Base
8 { 12 {
9 protected $table = 'gl_news_category'; 13 protected $table = 'gl_news_category';
@@ -8,6 +8,10 @@ use App\Models\RouteMap; @@ -8,6 +8,10 @@ use App\Models\RouteMap;
8 use App\Services\Facades\Upload; 8 use App\Services\Facades\Upload;
9 use Illuminate\Database\Eloquent\SoftDeletes; 9 use Illuminate\Database\Eloquent\SoftDeletes;
10 10
  11 +/**
  12 + * @method static get()
  13 + * @method static where(string $string, int $int)
  14 + */
11 class Category extends Base 15 class Category extends Base
12 { 16 {
13 use SoftDeletes; 17 use SoftDeletes;
@@ -8,6 +8,9 @@ use App\Models\RouteMap; @@ -8,6 +8,9 @@ use App\Models\RouteMap;
8 use App\Services\Facades\Upload; 8 use App\Services\Facades\Upload;
9 use Illuminate\Database\Eloquent\SoftDeletes; 9 use Illuminate\Database\Eloquent\SoftDeletes;
10 10
  11 +/**
  12 + * @method static get()
  13 + */
11 class Product extends Base 14 class Product extends Base
12 { 15 {
13 use SoftDeletes; 16 use SoftDeletes;
此 diff 太大无法显示。
1 -<IfModule mod_rewrite.c>  
2 - <IfModule mod_negotiation.c>  
3 - Options -MultiViews -Indexes  
4 - </IfModule>  
5 -  
6 - RewriteEngine On  
7 -  
8 - # Handle Authorization Header  
9 - RewriteCond %{HTTP:Authorization} .  
10 - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]  
11 -  
12 - # Redirect Trailing Slashes If Not A Folder...  
13 - RewriteCond %{REQUEST_FILENAME} !-d  
14 - RewriteCond %{REQUEST_URI} (.+)/$  
15 - RewriteRule ^ %1 [L,R=301]  
16 -  
17 - # Send Requests To Front Controller...  
18 - RewriteCond %{REQUEST_FILENAME} !-d  
19 - RewriteCond %{REQUEST_FILENAME} !-f  
20 - RewriteRule ^ index.php [L]  
21 -</IfModule>