作者 lyh

gx

@@ -66,11 +66,11 @@ class Handler extends ExceptionHandler @@ -66,11 +66,11 @@ class Handler extends ExceptionHandler
66 '-------错误行数:' . $exception->getLine(); 66 '-------错误行数:' . $exception->getLine();
67 //A端错误 67 //A端错误
68 if ($exception instanceof AsideGlobalException) { 68 if ($exception instanceof AsideGlobalException) {
69 - LogUtils::error("AsideGlobalException", [], $exceptionMessage); 69 +// LogUtils::error("AsideGlobalException", [], $exceptionMessage);
70 } 70 }
71 //B端错误 71 //B端错误
72 elseif($exception instanceof BsideGlobalException) { 72 elseif($exception instanceof BsideGlobalException) {
73 - LogUtils::error("BsideGlobalException", [], $exceptionMessage); 73 +// LogUtils::error("BsideGlobalException", [], $exceptionMessage);
74 } 74 }
75 //验证错误(非手动抛出) 75 //验证错误(非手动抛出)
76 elseif ($exception instanceof ValidationException) { 76 elseif ($exception instanceof ValidationException) {
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CreateKeywordController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/19 9:14
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Optimize;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Http\Logic\Aside\Optimize\CreateKeywordLogic;
  15 +use App\Models\Com\CreateKeyword;
  16 +
  17 +/**
  18 + * @remark :生成关键字
  19 + * @name :CreateKeywordController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/12/19 9:14
  23 + */
  24 +class CreateKeywordController extends BaseController
  25 +{
  26 + /**
  27 + * @remark :根据类型获取对应的语种
  28 + * @name :lists
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2023/12/19 9:31
  32 + */
  33 + public function lists(CreateKeyword $createKeyword){
  34 + $this->request->validate([
  35 + 'type'=>'required',
  36 + ],[
  37 + 'type.required' => 'id不能为空',
  38 + ]);
  39 + $list = $createKeyword->list($this->map);
  40 + $this->response('success',Code::SUCCESS,$list);
  41 + }
  42 +
  43 + /**
  44 + * @remark :保存数据
  45 + * @name :save
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2023/12/19 9:35
  49 + */
  50 + public function save(CreateKeywordLogic $logic){
  51 + $this->request->validate([
  52 + 'type'=>'required|integer',
  53 + 'name'=>'required',
  54 + ],[
  55 + 'type.required' => '类型不能为空',
  56 + 'type.integer' => '类型必须为数字',
  57 + 'name.required' => '名称不能为空',
  58 + ]);
  59 + $logic->saveKeyword();
  60 + $this->response('success');
  61 + }
  62 +
  63 + /**
  64 + * @remark :创建关键字
  65 + * @name :createKeyword
  66 + * @author :lyh
  67 + * @method :post
  68 + * @time :2023/12/19 10:12
  69 + */
  70 + public function createKeyword(){
  71 +
  72 + }
  73 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CreateKeywordLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/19 9:45
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\Optimize;
  11 +
  12 +use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Com\CreateKeyword;
  14 +
  15 +class CreateKeywordLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->model = new CreateKeyword();
  21 + $this->param = $this->requestAll;
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存关键字
  26 + * @name :saveCreateKeyword
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/12/19 9:47
  30 + */
  31 + public function saveKeyword(){
  32 + $data = $this->handleParam($this->param);
  33 + try {
  34 + if(isset($this->param['id']) && !empty($this->param['id'])){
  35 + $this->model->edit($data,['id'=>$this->param['id']]);
  36 + }else{
  37 + $this->model->add($data);
  38 + }
  39 + }catch (\Exception $e){
  40 + $this->fail('保存失败,请联系管理员');
  41 + }
  42 + return $this->success();
  43 + }
  44 +
  45 + /**
  46 + * @remark :请求参数处理
  47 + * @name :handleParam
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2023/12/19 10:03
  51 + */
  52 + public function handleParam($param){
  53 + $data = [
  54 + 'type'=>$param['type'],
  55 + 'name'=>$param['name']
  56 + ];
  57 + return $this->success($data);
  58 + }
  59 +
  60 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :CreateKeyword.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/19 9:34
  8 + */
  9 +
  10 +namespace App\Models\Com;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :关键字
  16 + * @name :CreateKeyword
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2023/12/19 9:34
  20 + */
  21 +class CreateKeyword extends Base
  22 +{
  23 + protected $table = 'gl_create_keyword';
  24 +}
@@ -259,6 +259,12 @@ Route::middleware(['aloginauth'])->group(function () { @@ -259,6 +259,12 @@ Route::middleware(['aloginauth'])->group(function () {
259 Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀 259 Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀
260 Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关 260 Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关
261 }); 261 });
  262 + //生成关键字
  263 + Route::prefix('create_keyword')->group(function () {
  264 + Route::any('/', [Aside\Optimize\CreateKeywordController::class, 'lists'])->name('admin.create_keywords_lists');//创建关键字获取语种+前后缀
  265 + Route::any('/save', [Aside\Optimize\CreateKeywordController::class, 'save'])->name('admin.create_keywords_save');//保存关键字获取语种+前后缀
  266 + });
  267 +
262 268
263 //优化中台 269 //优化中台
264 Route::prefix('keyword')->group(function () { 270 Route::prefix('keyword')->group(function () {