作者 Richer

功能优化

  1 +<?php
  2 +/**
  3 ++-----------------------------------------------------------------------------------------------------------------------
  4 + * 管理端控制层: Category 控制类
  5 ++-----------------------------------------------------------------------------------------------------------------------
  6 + *
  7 + * PHP version 7
  8 + *
  9 + * @category App\Admin\Controllers
  10 + * @package App\Admin\Controllers
  11 + * @author Richer <yangzi1028@163.com>
  12 + * @date 2023年4月20日14:26:14
  13 + * @copyright 2020-2022 Richer (http://www.Richer.com/)
  14 + * @license http://www.Richer.com/ License
  15 + * @link http://www.Richer.com/
  16 + */
  17 +namespace App\Admin\Controllers;
  18 +
  19 +use App\Admin\Forms\FirstCategoryForm;
  20 +use App\Admin\Grids\FirstCategoryGrid;
  21 +use App\Jobs\Category\CategoryLabelCreatedJob;
  22 +use App\Models\Category\Category;
  23 +use App\Models\Category\CategoryExample;
  24 +use App\Models\Category\CategoryLabel;
  25 +use App\Models\Category\CategoryLabelItem;
  26 +use App\Models\Label;
  27 +use App\Models\LabelItem;
  28 +use Illuminate\Database\Eloquent\ModelNotFoundException;
  29 +use Illuminate\Http\JsonResponse;
  30 +
  31 +/**
  32 + * Class FirstCategoriesController.
  33 + *
  34 + * @package App\Admin\Controllers
  35 + */
  36 +class FirstCategoriesController extends BaseController
  37 +{
  38 + use FirstCategoryGrid, FirstCategoryForm;
  39 +
  40 + /**
  41 + * FirstCategoriesController constructor.
  42 + *
  43 + * @param Category $model 注入model
  44 + */
  45 + public function __construct(Category $model)
  46 + {
  47 + // 资源显示的中名称
  48 + $this->title = $model::OBJ_NAME_ZH;
  49 + // 是否可查看
  50 + $this->can_view = false;
  51 + // 是否可新增
  52 + $this->can_create = true;
  53 + // 是否可编辑
  54 + $this->can_edit = true;
  55 + // 是否可删除
  56 + $this->can_delete = true;
  57 + // 是否开启下拉菜单
  58 + $this->dropdownActions = false;
  59 +
  60 + // 执行父类构造方法
  61 + parent::__construct($model);
  62 + }
  63 +
  64 + /**
  65 + * 获取 实例
  66 + *
  67 + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|JsonResponse
  68 + */
  69 + public function examples($id)
  70 + {
  71 + $list = null;
  72 + try {
  73 + // 获取数据,如果没有获取到抛出异常
  74 + $model = $this->model->findOrFail($id);
  75 +
  76 + $list = $model->examples()->get();
  77 + return view('admin::category.examples', compact('id', 'list')) ;
  78 +
  79 + } catch (ModelNotFoundException $e) {
  80 + return view('admin::category.examples', compact('id', 'list')) ;
  81 + }
  82 + }
  83 +
  84 + /**
  85 + * 添加实例界面
  86 + *
  87 + * @param $id
  88 + */
  89 + public function examplePage($id)
  90 + {
  91 + $example_id = request('example_id', 0);
  92 + $example = null;
  93 + if ($example_id) {
  94 + $example = CategoryExample::find($example_id);
  95 + }
  96 + // 获取数据,如果没有获取到抛出异常
  97 + return view('admin::category.example', compact('id', 'example_id','example')) ;
  98 + }
  99 +
  100 + /**
  101 + * 添加站点
  102 + *
  103 + * @param integer $id 主键id
  104 + *
  105 + * @return JsonResponse
  106 + */
  107 + public function addExample($id)
  108 + {
  109 + try {
  110 +
  111 + $example_id = request('example_id', 0);
  112 + if ($example_id > 0) {
  113 + // 获取数据,如果没有获取到抛出异常
  114 + $model = CategoryExample::findOrFail($example_id);
  115 + $model->question = request('question');
  116 + $model->answer = request('answer');
  117 + $model->save();
  118 + } else {
  119 + // 获取数据,如果没有获取到抛出异常
  120 + $model = $this->model->findOrFail($id);
  121 + $model->examples()->create([
  122 + 'question' => request('question'),
  123 + 'answer' => request('answer'),
  124 + ]);
  125 + }
  126 +
  127 + return response()->json(
  128 + [
  129 + 'code' => 0,
  130 + 'status' => 1,
  131 + 'message' => __('operate_succeeded'),
  132 + ]
  133 + );
  134 + } catch (\Exception $e) {
  135 + return response()->json(
  136 + [
  137 + 'code' => 1,
  138 + 'status' => 0,
  139 + 'message' => $e->getMessage(),
  140 + ]
  141 + );
  142 + }
  143 + }
  144 +
  145 + /**
  146 + * 线路更新站点的顺序
  147 + *
  148 + * @param integer $id 主键id
  149 + *
  150 + * @return JsonResponse
  151 + */
  152 + public function deleteExample($id)
  153 + {
  154 + try {
  155 + // 获取数据,如果没有获取到抛出异常
  156 +
  157 + $model = $this->model->findOrFail($id);
  158 +
  159 + $result = $model->examples()->where('id', request('id'))->delete();
  160 +
  161 + if ($result) {
  162 + return response()->json(
  163 + [
  164 + 'code' => 0,
  165 + 'status' => 1,
  166 + 'message' =>__('operate_succeeded'),
  167 + ]
  168 + );
  169 + }
  170 +
  171 + return response()->json(
  172 + [
  173 + 'code' => 1,
  174 + 'status' => 1,
  175 + 'message' =>__('操作失败。'),
  176 + ]
  177 + );
  178 +
  179 +
  180 + } catch (\Exception $e) {
  181 + return response()->json(
  182 + [
  183 + 'code' => 1,
  184 + 'status' => 0,
  185 + 'message' => $e->getMessage(),
  186 + ]
  187 + );
  188 + }
  189 + }
  190 +
  191 + /**
  192 + * 获取 实例
  193 + *
  194 + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|JsonResponse
  195 + */
  196 + public function labels($id)
  197 + {
  198 + $list = null;
  199 + try {
  200 + // 获取数据,如果没有获取到抛出异常
  201 + $model = $this->model->findOrFail($id);
  202 +
  203 + $list = $model->labels()->get();
  204 + return view('admin::category.labels', compact('id', 'list')) ;
  205 +
  206 + } catch (ModelNotFoundException $e) {
  207 + return view('admin::category.labels', compact('id', 'list')) ;
  208 + }
  209 + }
  210 +
  211 + /**
  212 + * 添加 标签 界面
  213 + *
  214 + * @param $id
  215 + */
  216 + public function labelPage($id)
  217 + {
  218 + $label_id = request('label_id', 0);
  219 + $label = null;
  220 + if ($label_id) {
  221 + $label = CategoryLabel::find($label_id);
  222 + }
  223 + // 获取数据,如果没有获取到抛出异常
  224 + return view('admin::category.label', compact('id', 'label_id','label')) ;
  225 + }
  226 +
  227 + /**
  228 + * 添加 标签
  229 + *
  230 + * @param integer $id 主键id
  231 + *
  232 + * @return JsonResponse
  233 + */
  234 + public function addLabel($id)
  235 + {
  236 + try {
  237 + $label_id = request('label_id', 0);
  238 + if ($label_id > 0) {
  239 + // 获取数据,如果没有获取到抛出异常
  240 + $model = CategoryLabel::findOrFail($label_id);
  241 + $model->name = request('name');
  242 + $model->can_multiple = request('can_multiple', 0);
  243 + $model->semantics = request('semantics');
  244 + $model->description = request('description');
  245 + $model->save();
  246 +
  247 + } else {
  248 + // 获取数据,如果没有获取到抛出异常
  249 + $model = $this->model->findOrFail($id);
  250 + $result = $model->labels()->create([
  251 + 'name' => request('name'),
  252 + 'semantics' => request('semantics'),
  253 + 'description' => request('description'),
  254 + 'can_multiple' => request('can_multiple', 0),
  255 + ]);
  256 +
  257 + // 同步到远程服务器
  258 +// CategoryLabelCreatedJob::dispatch($result);
  259 +
  260 + }
  261 +
  262 + return response()->json(
  263 + [
  264 + 'code' => 0,
  265 + 'status' => 1,
  266 + 'message' => __('operate_succeeded'),
  267 + ]
  268 + );
  269 + } catch (\Exception $e) {
  270 + return response()->json(
  271 + [
  272 + 'code' => 1,
  273 + 'status' => 0,
  274 + 'message' => $e->getMessage(),
  275 + ]
  276 + );
  277 + }
  278 + }
  279 +
  280 + /**
  281 + * 删除 标签
  282 + *
  283 + * @param integer $id 主键id
  284 + *
  285 + * @return JsonResponse
  286 + */
  287 + public function deleteLabel($id)
  288 + {
  289 + try {
  290 + // 获取数据,如果没有获取到抛出异常
  291 +
  292 + $model = $this->model->findOrFail($id);
  293 +
  294 + $result = $model->labels()->where('id', request('id'))->delete();
  295 +
  296 + if ($result) {
  297 + return response()->json(
  298 + [
  299 + 'code' => 0,
  300 + 'status' => 1,
  301 + 'message' =>__('operate_succeeded'),
  302 + ]
  303 + );
  304 + }
  305 +
  306 + return response()->json(
  307 + [
  308 + 'code' => 1,
  309 + 'status' => 1,
  310 + 'message' =>__('操作失败。'),
  311 + ]
  312 + );
  313 +
  314 +
  315 + } catch (\Exception $e) {
  316 + return response()->json(
  317 + [
  318 + 'code' => 1,
  319 + 'status' => 0,
  320 + 'message' => $e->getMessage(),
  321 + ]
  322 + );
  323 + }
  324 + }
  325 +
  326 + /**
  327 + * 添加 标签明细 界面
  328 + *
  329 + * @param $id
  330 + */
  331 + public function labelItemPage($id)
  332 + {
  333 + $label_item_id = request('label_item_id', 0);
  334 + $label_item = null;
  335 + if ($label_item_id) {
  336 + $label_item = CategoryExample::find($label_item_id);
  337 + }
  338 + // 获取数据,如果没有获取到抛出异常
  339 + return view('admin::category.label-item', compact('id', 'label_item_id','label_item')) ;
  340 + }
  341 +
  342 + /**
  343 + * 添加 标签明细
  344 + *
  345 + * @param integer $id 主键id
  346 + *
  347 + * @return JsonResponse
  348 + */
  349 + public function addLabelItem($id)
  350 + {
  351 + try {
  352 + $label_id = request('label_item_id', 0);
  353 + if ($label_id > 0) {
  354 + // 获取数据,如果没有获取到抛出异常
  355 + $model = CategoryLabelItem::findOrFail($label_id);
  356 + $model->name = request('name');
  357 + $model->description = request('description');
  358 + $model->save();
  359 + } else {
  360 + // 获取数据,如果没有获取到抛出异常
  361 + $model = CategoryLabel::findOrFail($id);
  362 + $model->items()->create([
  363 + 'name' => request('name'),
  364 + 'description' => request('description'),
  365 + ]);
  366 + }
  367 +
  368 + return response()->json(
  369 + [
  370 + 'code' => 0,
  371 + 'status' => 1,
  372 + 'message' => __('operate_succeeded'),
  373 + ]
  374 + );
  375 + } catch (\Exception $e) {
  376 + return response()->json(
  377 + [
  378 + 'code' => 1,
  379 + 'status' => 0,
  380 + 'message' => $e->getMessage(),
  381 + ]
  382 + );
  383 + }
  384 + }
  385 +
  386 + /**
  387 + * 删除 标签明细
  388 + *
  389 + * @param integer $id 主键id
  390 + *
  391 + * @return JsonResponse
  392 + */
  393 + public function deleteLabelItem($id)
  394 + {
  395 + try {
  396 + // 获取数据,如果没有获取到抛出异常
  397 + $result = CategoryLabelItem::where('id', request('id'))->delete();
  398 +
  399 + if ($result) {
  400 + return response()->json(
  401 + [
  402 + 'code' => 0,
  403 + 'status' => 1,
  404 + 'message' =>__('operate_succeeded'),
  405 + ]
  406 + );
  407 + }
  408 +
  409 + return response()->json(
  410 + [
  411 + 'code' => 1,
  412 + 'status' => 1,
  413 + 'message' =>__('操作失败。'),
  414 + ]
  415 + );
  416 +
  417 +
  418 + } catch (\Exception $e) {
  419 + return response()->json(
  420 + [
  421 + 'code' => 1,
  422 + 'status' => 0,
  423 + 'message' => $e->getMessage(),
  424 + ]
  425 + );
  426 + }
  427 + }
  428 +
  429 +// /**
  430 +// * 获取 实例
  431 +// *
  432 +// * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|JsonResponse
  433 +// */
  434 +// public function labels($id)
  435 +// {
  436 +// $list = null;
  437 +// try {
  438 +// // 获取数据,如果没有获取到抛出异常
  439 +// $model = $this->model->findOrFail($id);
  440 +//
  441 +// $list = $model->labels()->get();
  442 +// return view('admin::category.labels', compact('id', 'list')) ;
  443 +//
  444 +// } catch (ModelNotFoundException $e) {
  445 +// return view('admin::category.labels', compact('id', 'list')) ;
  446 +// }
  447 +// }
  448 +
  449 + /**
  450 + * 添加 标签 界面
  451 + *
  452 + * @param $id
  453 + */
  454 + public function childPage($id)
  455 + {
  456 + $label_id = request('id', 0);
  457 + $label = null;
  458 + if ($label_id) {
  459 + $label = CategoryLabel::find($label_id);
  460 + }
  461 + // 获取数据,如果没有获取到抛出异常
  462 + return view('admin::category.child', compact('id', 'label_id','label')) ;
  463 + }
  464 +
  465 + /**
  466 + * 添加 标签
  467 + *
  468 + * @param integer $id 主键id
  469 + *
  470 + * @return JsonResponse
  471 + */
  472 + public function addChild($id)
  473 + {
  474 + try {
  475 + $label_id = request('label_id', 0);
  476 + if ($label_id > 0) {
  477 + // 获取数据,如果没有获取到抛出异常
  478 + $model = CategoryLabel::findOrFail($label_id);
  479 + $model->name = request('name');
  480 + $model->can_multiple = request('can_multiple', 0);
  481 + $model->semantics = request('semantics');
  482 + $model->description = request('description');
  483 + $model->save();
  484 +
  485 + } else {
  486 + // 获取数据,如果没有获取到抛出异常
  487 + $model = $this->model->findOrFail($id);
  488 + $result = $model->labels()->create([
  489 + 'name' => request('name'),
  490 + 'semantics' => request('semantics'),
  491 + 'description' => request('description'),
  492 + 'can_multiple' => request('can_multiple', 0),
  493 + ]);
  494 +
  495 + // 同步到远程服务器
  496 +// CategoryLabelCreatedJob::dispatch($result);
  497 +
  498 + }
  499 +
  500 + return response()->json(
  501 + [
  502 + 'code' => 0,
  503 + 'status' => 1,
  504 + 'message' => __('operate_succeeded'),
  505 + ]
  506 + );
  507 + } catch (\Exception $e) {
  508 + return response()->json(
  509 + [
  510 + 'code' => 1,
  511 + 'status' => 0,
  512 + 'message' => $e->getMessage(),
  513 + ]
  514 + );
  515 + }
  516 + }
  517 +
  518 +}
@@ -40,19 +40,11 @@ trait CategoryForm @@ -40,19 +40,11 @@ trait CategoryForm
40 // $this->formDisplayField('id', __('ID')); 40 // $this->formDisplayField('id', __('ID'));
41 $this->formTextField('name', '', 20, 1); 41 $this->formTextField('name', '', 20, 1);
42 42
43 - $this->formSingleSelectField('pid', '一级分类', Category::getParents('store'))  
44 - ->when('>=', 1, function () {  
45 - $this->formNumberField('consume_times')  
46 - ->setGroupClass('col-sm-12')->setWidth(8, 2)  
47 - ;  
48 - $this->formRadioField('context', '', ChatRecord::CONTEXT_OPTIONS)  
49 - ->setGroupClass('col-sm-12')->setWidth(8, 2)  
50 - ;  
51 - $this->formTextAreaField('start_statement', '', 0, 5)  
52 - ->setGroupClass('col-sm-12')->setWidth(8, 2)  
53 - ; 43 + $this->formSingleSelectField('pid', '一级分类', Category::getParents());
54 44
55 - }); 45 + $this->formNumberField('consume_times');
  46 + $this->formRadioField('context', '', ChatRecord::CONTEXT_OPTIONS);
  47 + $this->formTextAreaField('start_statement', '', 0, 5);
56 $required = 1; 48 $required = 1;
57 if ($id > 0) { 49 if ($id > 0) {
58 $required = 0; 50 $required = 0;
  1 +<?php
  2 +/**
  3 ++-----------------------------------------------------------------------------------------------------------------------
  4 + * 管理端表单 trait层:渲染生成 Category form 表单
  5 ++-----------------------------------------------------------------------------------------------------------------------
  6 + *
  7 + * PHP version 7
  8 + *
  9 + * @category App\Admin\Forms
  10 + * @package App\Admin\Forms
  11 + * @author Richer <yangzi1028@163.com>
  12 + * @date 2023年4月20日14:26:14
  13 + * @copyright 2022-2022 Richer (http://www.Richer.com/)
  14 + * @license http://www.Richer.com/ License
  15 + * @link http://www.Richer.com/
  16 + */
  17 +namespace App\Admin\Forms;
  18 +
  19 +use App\Admin\Rewrite\Form;
  20 +use App\Models\Category\Category;
  21 +use App\Models\Chat\ChatRecord;
  22 +use Illuminate\Support\Str;
  23 +
  24 +/**
  25 + * Trait FirstCategoryForm
  26 + *
  27 + * @package App\Admin\Forms\Category
  28 + */
  29 +trait FirstCategoryForm
  30 +{
  31 + /**
  32 + * 渲染表单字段
  33 + *
  34 + * @param Int $id 用户id
  35 + *
  36 + * @return void
  37 + */
  38 + public function renderFormFields($id)
  39 + {
  40 +// $this->formDisplayField('id', __('ID'));
  41 + $this->formTextField('name', '', 20, 1);
  42 +
  43 + $required = 1;
  44 + if ($id > 0) {
  45 + $required = 0;
  46 + }
  47 + $this->formSingleImageField('icon', '图标', $required);
  48 +
  49 + $this->formTextAreaField('body', '内容', 0, 5);
  50 +// $this->formTextAreaField('description', '', 255, 3);
  51 + $this->formCommonFields(1, 0, 1, 1);
  52 + }
  53 +
  54 + /**
  55 + * 保存前回调
  56 + *
  57 + * @return void
  58 + */
  59 + public function saving()
  60 + {
  61 + parent::saving();
  62 +
  63 + //保存前回调
  64 + $this->form->saving(function (Form $form) {
  65 + //
  66 + });
  67 + }
  68 +
  69 + /**
  70 + * 保存前回调
  71 + *
  72 + * @return void
  73 + */
  74 + public function saved()
  75 + {
  76 + parent::saved();
  77 +
  78 + //保存前回调
  79 + $this->form->saved(function (Form $form) {
  80 + $actions = request()->route()->getAction();
  81 + // 如果是以@store结尾则为新增操作
  82 + if (Str::endsWith($actions['uses'], '@store')) {
  83 + //
  84 + }
  85 + });
  86 + }
  87 +}
@@ -51,7 +51,7 @@ trait CategoryGrid @@ -51,7 +51,7 @@ trait CategoryGrid
51 // 执行父类方法,设置默认的查询条件 51 // 执行父类方法,设置默认的查询条件
52 parent::setGridQuery(); 52 parent::setGridQuery();
53 53
54 - $this->grid->model()->with(['parent', 'children'])->withCount(['labels','examples', 'children']); 54 + $this->grid->model()->where('pid','>', 0)->with(['parent', 'children'])->withCount(['labels','examples', 'children']);
55 } 55 }
56 56
57 /** 57 /**
@@ -112,7 +112,7 @@ trait CategoryGrid @@ -112,7 +112,7 @@ trait CategoryGrid
112 return '--'; 112 return '--';
113 } 113 }
114 return $value; 114 return $value;
115 - }); 115 + })->limit(100);
116 // $this->gridBoolField('context'); 116 // $this->gridBoolField('context');
117 $this->gridTextField('context')->display(function ($value) { 117 $this->gridTextField('context')->display(function ($value) {
118 if ($this->pid == 0) { 118 if ($this->pid == 0) {
  1 +<?php
  2 +/**
  3 ++-----------------------------------------------------------------------------------------------------------------------
  4 + * 管理端列表grid trait层:渲染生成 Category grid 列表
  5 ++-----------------------------------------------------------------------------------------------------------------------
  6 + *
  7 + * PHP version 7
  8 + *
  9 + * @category App\Admin\Grids
  10 + * @package App\Admin\Grids
  11 + * @author Richer <yangzi1028@163.com>
  12 + * @date 2023年4月20日14:26:14
  13 + * @copyright 2020-2022 Richer (http://www.Richer.com/)
  14 + * @license http://www.Richer.com/ License
  15 + * @link http://www.Richer.com/
  16 + */
  17 +namespace App\Admin\Grids;
  18 +
  19 +use App\Admin\Extensions\CustomActions;
  20 +use App\Admin\Grids\Modal\CategoryExampleModal;
  21 +use App\Models\Category\Category;
  22 +use Encore\Admin\Grid;
  23 +use Encore\Admin\Widgets\Table;
  24 +use function Clue\StreamFilter\fun;
  25 +
  26 +/**
  27 + * Class FirstCategoryGrid.
  28 + *
  29 + * @package App\Admin\Grids
  30 + */
  31 +trait FirstCategoryGrid
  32 +{
  33 + /**
  34 + * 设置默认排序规则
  35 + */
  36 + public function setGridOrder()
  37 + {
  38 + if (!request('_sort')) {
  39 + $this->grid->model()->orderByDesc('sort')->latest();
  40 + } else {
  41 + $this->setGridOrderSpecial();
  42 + }
  43 + }
  44 +
  45 + /**
  46 + * 设置默认查询条件
  47 + * 增加数据权限的判断
  48 + */
  49 + public function setGridQuery()
  50 + {
  51 + // 执行父类方法,设置默认的查询条件
  52 + parent::setGridQuery();
  53 +
  54 + $this->grid->model()->where(function ($query) {
  55 + $query->whereNull('pid')->orWhere('pid', 0)->orWhere('pid', '');
  56 + });//with(['parent', 'children'])->withCount(['labels','examples', 'children']);
  57 + }
  58 +
  59 + /**
  60 + * 自定义每行的操作
  61 + * 根据每个模块设置的权限来判断当前的操作
  62 + *
  63 + * @param $actions
  64 + * @return void $grid grid
  65 + */
  66 + public function setRowCustomActions($actions)
  67 + {
  68 + // 当前数据的主键
  69 + $id = $actions->getKey();
  70 + // 当前的url
  71 + $url = $actions->getResource();
  72 +// if (!$actions->row->pid) {
  73 +//// $actions->append(CustomActions::renderChildCategory($id, $url));
  74 +// } else {
  75 +// $actions->append(CustomActions::renderAddExample($id, $url));
  76 +// $actions->append(CustomActions::renderAddLabel($id, $url));
  77 +// }
  78 + }
  79 +
  80 + /**
  81 + * 为grid增加筛选条件
  82 + *
  83 + * @return Grid
  84 + */
  85 + public function renderGridFilter()
  86 + {
  87 + $this->grid->filter(
  88 + function ($filter) {
  89 + // 筛选条件默认展开
  90 + $filter->expand();
  91 + $this->filterText($filter, 'name');
  92 +// $this->filterSingleSelect($filter, 'pid', '一级分类', Category::getParents());
  93 + //去掉默认的搜索
  94 + $filter->disableIdFilter();
  95 + }
  96 + );
  97 +
  98 + return $this->grid;
  99 + }
  100 +
  101 + /**
  102 + * 渲染grid字段
  103 + *
  104 + * @return void
  105 + */
  106 + public function renderGridFields()
  107 + {
  108 + $this->gridRowNo();
  109 + $this->gridSingleImageField('icon');
  110 + $this->gridTextField('name');
  111 + $this->gridCommonFields(1, 0, 1, 1);
  112 + }
  113 +}
@@ -214,6 +214,16 @@ Route::group([ @@ -214,6 +214,16 @@ Route::group([
214 | AI分类 模块 214 | AI分类 模块
215 |------------------------------------------------------------------------------------------------------------------- 215 |-------------------------------------------------------------------------------------------------------------------
216 */ 216 */
  217 + $router->resource('first-categories', 'FirstCategoriesController');
  218 + $router->group(['prefix' => 'first-categories'], function ($router){
  219 +
  220 + });
  221 +
  222 + /*
  223 + |-------------------------------------------------------------------------------------------------------------------
  224 + | AI分类 模块
  225 + |-------------------------------------------------------------------------------------------------------------------
  226 + */
217 $router->resource('categories', 'CategoriesController'); 227 $router->resource('categories', 'CategoriesController');
218 $router->group(['prefix' => 'categories'], function ($router){ 228 $router->group(['prefix' => 'categories'], function ($router){
219 $router->get('{id}/example', 'CategoriesController@examplePage')->where('id', '[0-9]+'); 229 $router->get('{id}/example', 'CategoriesController@examplePage')->where('id', '[0-9]+');
@@ -230,10 +240,6 @@ Route::group([ @@ -230,10 +240,6 @@ Route::group([
230 $router->get('{id}/children', 'CategoriesController@children')->where('id', '[0-9]+'); 240 $router->get('{id}/children', 'CategoriesController@children')->where('id', '[0-9]+');
231 $router->post('{id}/children', 'CategoriesController@addChild')->where('id', '[0-9]+'); 241 $router->post('{id}/children', 'CategoriesController@addChild')->where('id', '[0-9]+');
232 $router->delete('{id}/labels', 'CategoriesController@deleteLabel')->where('id', '[0-9]+'); 242 $router->delete('{id}/labels', 'CategoriesController@deleteLabel')->where('id', '[0-9]+');
233 -  
234 -// $router->get('{id}/label-item', 'CategoriesController@labelItemPage')->where('id', '[0-9]+');  
235 -// $router->post('{id}/label-items', 'CategoriesController@addLabelItem')->where('id', '[0-9]+');  
236 -// $router->delete('{id}/label-items', 'CategoriesController@deleteLabelItem')->where('id', '[0-9]+');  
237 }); 243 });
238 244
239 /* 245 /*
  1 +
  2 +INSERT INTO `admin_menu` (`id`, `parent_id`, `order`, `title`, `icon`, `uri`, `permission`, `visible`, `created_at`, `updated_at`, `deleted_at`) VALUES (NULL, 12, 4, '分类列表', 'fa-tag', '/first-categories', '*', 1, '2023-5-18 13:58:42', '2023-05-18 13:57:31', NULL);
  3 +
  4 +INSERT INTO `admin_menu` (`id`, `parent_id`, `order`, `title`, `icon`, `uri`, `permission`, `visible`, `created_at`, `updated_at`, `deleted_at`) VALUES (NULL, 12, 5, '场景列表', 'fa-tags', '/categories', '*', 1, '2023-5-18 13:58:42', '2023-5-18 13:58:42', NULL);
不能预览此文件类型