正在显示
4 个修改的文件
包含
149 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AggregateKeywordAffixController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/5/27 14:20 | ||
| 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\AggregateKeywordAffixLogic; | ||
| 15 | +use Illuminate\Http\Request; | ||
| 16 | + | ||
| 17 | +class AggregateKeywordAffixController extends BaseController | ||
| 18 | +{ | ||
| 19 | + public function __construct(Request $request) | ||
| 20 | + { | ||
| 21 | + parent::__construct($request); | ||
| 22 | + $this->logic = new AggregateKeywordAffixLogic(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark :获取当前项目关键字前后缀 | ||
| 27 | + * @name :getAffix | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2025/5/27 14:23 | ||
| 31 | + */ | ||
| 32 | + public function getAffix(){ | ||
| 33 | + $this->request->validate([ | ||
| 34 | + 'project_id'=>'required', | ||
| 35 | + ],[ | ||
| 36 | + 'project_id.required' => 'project_id不能为空', | ||
| 37 | + ]); | ||
| 38 | + $data = $this->logic->getAffix(); | ||
| 39 | + $this->response('success',Code::SUCCESS,$data); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @remark :保存关键字前后缀 | ||
| 44 | + * @name :save | ||
| 45 | + * @author :lyh | ||
| 46 | + * @method :post | ||
| 47 | + * @time :2025/5/27 14:23 | ||
| 48 | + */ | ||
| 49 | + public function saveAffix(){ | ||
| 50 | + $this->request->validate([ | ||
| 51 | + 'project_id'=>'required', | ||
| 52 | + 'prefix'=>'required', | ||
| 53 | + 'suffix'=>'required', | ||
| 54 | + ],[ | ||
| 55 | + 'project_id.required' => 'project_id不能为空', | ||
| 56 | + 'prefix.required' => '前缀不能为空', | ||
| 57 | + 'suffix.required' => '后缀不能为空', | ||
| 58 | + ]); | ||
| 59 | + $data = $this->logic->saveAffix(); | ||
| 60 | + $this->response('success',Code::SUCCESS,$data); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AggregateKeywordAffixLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/5/27 14:21 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Aside\Project; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | +use App\Models\Project\AggregateKeywordAffix; | ||
| 14 | + | ||
| 15 | +class AggregateKeywordAffixLogic extends BaseLogic | ||
| 16 | +{ | ||
| 17 | + public function __construct() | ||
| 18 | + { | ||
| 19 | + parent::__construct(); | ||
| 20 | + $this->param = $this->requestAll; | ||
| 21 | + $this->model = new AggregateKeywordAffix(); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * @remark :保存数据 | ||
| 26 | + * @name :getAffix | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2025/5/27 14:25 | ||
| 30 | + */ | ||
| 31 | + public function getAffix(){ | ||
| 32 | + $data = $this->model->read(['project_id'=>$this->param['project_id']]); | ||
| 33 | + return $this->success($data); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @remark :保存数据 | ||
| 38 | + * @name :saveAffix | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2025/5/27 14:28 | ||
| 42 | + */ | ||
| 43 | + public function saveAffix(){ | ||
| 44 | + $info = $this->model->read(['project_id'=>$this->param['project_id']]); | ||
| 45 | + try { | ||
| 46 | + if($info === false){ | ||
| 47 | + $this->model->addReturnId(['project_id'=>$this->param['project_id'],'prefix'=>$this->param['prefix'] ?? '','suffix'=>$this->param['suffix'] ?? '']); | ||
| 48 | + }else{ | ||
| 49 | + $this->model->edit(['prefix'=>$this->param['prefix'] ?? '','suffix'=>$this->param['suffix'] ?? ''],['project_id'=>$this->param['project_id']]); | ||
| 50 | + } | ||
| 51 | + }catch (\Exception $e){ | ||
| 52 | + $this->fail('保存失败,请联系管理员'); | ||
| 53 | + } | ||
| 54 | + return $this->success(); | ||
| 55 | + } | ||
| 56 | +} |
app/Models/Project/AggregateKeywordAffix.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AggregateKeywordAffix.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/5/27 14:16 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Project; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :聚合页关键字前后缀 | ||
| 16 | + * @name :AggregateKeywordAffix | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/5/27 14:16 | ||
| 20 | + */ | ||
| 21 | +class AggregateKeywordAffix extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_aggregate_keyword_affix'; | ||
| 24 | +} |
| @@ -220,6 +220,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -220,6 +220,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 220 | Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); | 220 | Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); |
| 221 | Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages'); | 221 | Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages'); |
| 222 | }); | 222 | }); |
| 223 | + | ||
| 223 | //更新项目tdk | 224 | //更新项目tdk |
| 224 | Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); | 225 | Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); |
| 225 | //项目内容采集 | 226 | //项目内容采集 |
| @@ -562,6 +563,11 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -562,6 +563,11 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 562 | Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info'); | 563 | Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info'); |
| 563 | Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save'); | 564 | Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save'); |
| 564 | Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del'); | 565 | Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del'); |
| 566 | + //聚合页关键词前后缀 | ||
| 567 | + Route::prefix('affix')->group(function () { | ||
| 568 | + Route::any('/getAffix', [Aside\Project\AggregateKeywordAffixController::class, 'getAffix'])->name('admin.affix_getAffix'); | ||
| 569 | + Route::any('/saveAffix', [Aside\Project\AggregateKeywordAffixController::class, 'saveAffix'])->name('admin.affix_saveAffix'); | ||
| 570 | + }); | ||
| 565 | }); | 571 | }); |
| 566 | 572 | ||
| 567 | }); | 573 | }); |
-
请 注册 或 登录 后发表评论