正在显示
6 个修改的文件
包含
173 行增加
和
2 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AggregateKeywordController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/17 16:03 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\Project; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Http\Logic\Aside\Project\AggregateKeywordLogic; | ||
| 15 | +use App\Models\Project\AggregateKeyword; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :聚合页关键词设置 | ||
| 19 | + * @name :AggregateKeywordController | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2025/3/17 16:04 | ||
| 23 | + */ | ||
| 24 | +class AggregateKeywordController extends BaseController | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * @remark :根据项目获取项目对应的聚合页关键词 | ||
| 28 | + * @name :lists | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2025/3/17 16:04 | ||
| 32 | + */ | ||
| 33 | + public function lists(AggregateKeyword $aggregateKeyword){ | ||
| 34 | + $this->request->validate([ | ||
| 35 | + 'project_id'=>'required', | ||
| 36 | + ],[ | ||
| 37 | + 'project_id.required' => 'project_id不能为空', | ||
| 38 | + ]); | ||
| 39 | + $lists = $aggregateKeyword->list($this->map); | ||
| 40 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * @remark :获取数据详情 | ||
| 45 | + * @name :info | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2025/3/17 16:18 | ||
| 49 | + */ | ||
| 50 | + public function info(AggregateKeyword $aggregateKeyword){ | ||
| 51 | + $this->request->validate([ | ||
| 52 | + 'id'=>'required', | ||
| 53 | + ],[ | ||
| 54 | + 'id.required' => '主键不能为空', | ||
| 55 | + ]); | ||
| 56 | + $data = $aggregateKeyword->read($this->map); | ||
| 57 | + $this->response('success',Code::SUCCESS,$data); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @remark :保存数据 | ||
| 62 | + * @name :save | ||
| 63 | + * @author :lyh | ||
| 64 | + * @method :post | ||
| 65 | + * @time :2025/3/17 16:05 | ||
| 66 | + * @param :created_at->创建使劲; operator->创建人; keywords->关键字一行一个; project_id->项目id | ||
| 67 | + */ | ||
| 68 | + public function save(AggregateKeywordLogic $logic){ | ||
| 69 | + $this->request->validate([ | ||
| 70 | + 'project_id'=>'required', | ||
| 71 | + 'created_at'=>'required', | ||
| 72 | + 'operator'=>'required', | ||
| 73 | + 'keywords'=>'required', | ||
| 74 | + ],[ | ||
| 75 | + 'project_id.required' => 'project_id不能为空', | ||
| 76 | + 'created_at.required' => 'created_at不能为空', | ||
| 77 | + 'operator.required' => 'operator不能为空', | ||
| 78 | + 'keywords.required' => 'keywords不能为空', | ||
| 79 | + ]); | ||
| 80 | + $data = $logic->saveKeyword(); | ||
| 81 | + $this->response('success',Code::SUCCESS,$data); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * @remark :删除数据 | ||
| 86 | + * @name :del | ||
| 87 | + * @author :lyh | ||
| 88 | + * @method :post | ||
| 89 | + * @time :2025/3/17 16:05 | ||
| 90 | + */ | ||
| 91 | + public function del(AggregateKeyword $aggregateKeyword){ | ||
| 92 | + $this->request->validate([ | ||
| 93 | + 'id'=>'required', | ||
| 94 | + ],[ | ||
| 95 | + 'id.required' => '主键不能为空', | ||
| 96 | + ]); | ||
| 97 | + $data = $aggregateKeyword->del($this->map); | ||
| 98 | + $this->response('success',Code::SUCCESS,$data); | ||
| 99 | + } | ||
| 100 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AggregateKeywordLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/17 16:10 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Aside\Project; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | +use App\Models\Project\AggregateKeyword; | ||
| 14 | + | ||
| 15 | +class AggregateKeywordLogic extends BaseLogic | ||
| 16 | +{ | ||
| 17 | + public function __construct() | ||
| 18 | + { | ||
| 19 | + parent::__construct(); | ||
| 20 | + $this->param = $this->requestAll; | ||
| 21 | + $this->model = new AggregateKeyword(); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * @remark : | ||
| 26 | + * @name :saveKeyword | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2025/3/17 16:11 | ||
| 30 | + */ | ||
| 31 | + public function saveKeyword(){ | ||
| 32 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 33 | + $id = $this->param['id']; | ||
| 34 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 35 | + }else{ | ||
| 36 | + $id = $this->model->addReturnId($this->param); | ||
| 37 | + } | ||
| 38 | + return $this->success(['id'=>$id]); | ||
| 39 | + } | ||
| 40 | +} |
| @@ -11,7 +11,6 @@ class DeployBuildLogic extends BaseLogic | @@ -11,7 +11,6 @@ class DeployBuildLogic extends BaseLogic | ||
| 11 | public function __construct() | 11 | public function __construct() |
| 12 | { | 12 | { |
| 13 | parent::__construct(); | 13 | parent::__construct(); |
| 14 | - | ||
| 15 | $this->model = new DeployBuild(); | 14 | $this->model = new DeployBuild(); |
| 16 | } | 15 | } |
| 17 | } | 16 | } |
| @@ -96,7 +96,7 @@ class Base extends Model | @@ -96,7 +96,7 @@ class Base extends Model | ||
| 96 | */ | 96 | */ |
| 97 | public function add($data){ | 97 | public function add($data){ |
| 98 | $data = $this->filterRequestData($data); | 98 | $data = $this->filterRequestData($data); |
| 99 | - $data['created_at'] = date('Y-m-d H:i:s'); | 99 | + $data['created_at'] = $data['created_at'] ?? date('Y-m-d H:i:s'); |
| 100 | $data['updated_at'] = $data['created_at']; | 100 | $data['updated_at'] = $data['created_at']; |
| 101 | return $this->insert($data); | 101 | return $this->insert($data); |
| 102 | } | 102 | } |
app/Models/Project/AggregateKeyword.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AggregateKeyword.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/17 16:02 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Project; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :聚合页关键词设置 | ||
| 16 | + * @name :AggregateKeyword | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/3/17 16:02 | ||
| 20 | + */ | ||
| 21 | +class AggregateKeyword extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_aggregate_keyword'; | ||
| 24 | +} |
| @@ -533,6 +533,14 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -533,6 +533,14 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 533 | Route::prefix('industry')->group(function () { | 533 | Route::prefix('industry')->group(function () { |
| 534 | Route::any('/', [Aside\Project\ProjectController::class, 'industryList'])->name('admin.industryList'); | 534 | Route::any('/', [Aside\Project\ProjectController::class, 'industryList'])->name('admin.industryList'); |
| 535 | }); | 535 | }); |
| 536 | + | ||
| 537 | + //聚合页关键词设置 | ||
| 538 | + Route::prefix('aggregateKeyword')->group(function () { | ||
| 539 | + Route::any('/', [Aside\Project\AggregateKeywordController::class, 'lists'])->name('admin.aggregateKeyword'); | ||
| 540 | + Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info'); | ||
| 541 | + Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save'); | ||
| 542 | + Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del'); | ||
| 543 | + }); | ||
| 536 | }); | 544 | }); |
| 537 | 545 | ||
| 538 | //无需登录验证的路由组 | 546 | //无需登录验证的路由组 |
-
请 注册 或 登录 后发表评论