作者 lyh

gx数据

<?php
/**
* @remark :
* @name :AggregateKeywordController.php
* @author :lyh
* @method :post
* @time :2025/3/17 16:03
*/
namespace App\Http\Controllers\Aside\Project;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Project\AggregateKeywordLogic;
use App\Models\Project\AggregateKeyword;
/**
* @remark :聚合页关键词设置
* @name :AggregateKeywordController
* @author :lyh
* @method :post
* @time :2025/3/17 16:04
*/
class AggregateKeywordController extends BaseController
{
/**
* @remark :根据项目获取项目对应的聚合页关键词
* @name :lists
* @author :lyh
* @method :post
* @time :2025/3/17 16:04
*/
public function lists(AggregateKeyword $aggregateKeyword){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => 'project_id不能为空',
]);
$lists = $aggregateKeyword->list($this->map);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/3/17 16:18
*/
public function info(AggregateKeyword $aggregateKeyword){
$this->request->validate([
'id'=>'required',
],[
'id.required' => '主键不能为空',
]);
$data = $aggregateKeyword->read($this->map);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/3/17 16:05
* @param :created_at->创建使劲; operator->创建人; keywords->关键字一行一个; project_id->项目id
*/
public function save(AggregateKeywordLogic $logic){
$this->request->validate([
'project_id'=>'required',
'created_at'=>'required',
'operator'=>'required',
'keywords'=>'required',
],[
'project_id.required' => 'project_id不能为空',
'created_at.required' => 'created_at不能为空',
'operator.required' => 'operator不能为空',
'keywords.required' => 'keywords不能为空',
]);
$data = $logic->saveKeyword();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2025/3/17 16:05
*/
public function del(AggregateKeyword $aggregateKeyword){
$this->request->validate([
'id'=>'required',
],[
'id.required' => '主键不能为空',
]);
$data = $aggregateKeyword->del($this->map);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :AggregateKeywordLogic.php
* @author :lyh
* @method :post
* @time :2025/3/17 16:10
*/
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\AggregateKeyword;
class AggregateKeywordLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new AggregateKeyword();
}
/**
* @remark :
* @name :saveKeyword
* @author :lyh
* @method :post
* @time :2025/3/17 16:11
*/
public function saveKeyword(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
}
... ...
... ... @@ -11,7 +11,6 @@ class DeployBuildLogic extends BaseLogic
public function __construct()
{
parent::__construct();
$this->model = new DeployBuild();
}
}
... ...
... ... @@ -96,7 +96,7 @@ class Base extends Model
*/
public function add($data){
$data = $this->filterRequestData($data);
$data['created_at'] = date('Y-m-d H:i:s');
$data['created_at'] = $data['created_at'] ?? date('Y-m-d H:i:s');
$data['updated_at'] = $data['created_at'];
return $this->insert($data);
}
... ...
<?php
/**
* @remark :
* @name :AggregateKeyword.php
* @author :lyh
* @method :post
* @time :2025/3/17 16:02
*/
namespace App\Models\Project;
use App\Models\Base;
/**
* @remark :聚合页关键词设置
* @name :AggregateKeyword
* @author :lyh
* @method :post
* @time :2025/3/17 16:02
*/
class AggregateKeyword extends Base
{
protected $table = 'gl_aggregate_keyword';
}
... ...
... ... @@ -533,6 +533,14 @@ Route::middleware(['aloginauth'])->group(function () {
Route::prefix('industry')->group(function () {
Route::any('/', [Aside\Project\ProjectController::class, 'industryList'])->name('admin.industryList');
});
//聚合页关键词设置
Route::prefix('aggregateKeyword')->group(function () {
Route::any('/', [Aside\Project\AggregateKeywordController::class, 'lists'])->name('admin.aggregateKeyword');
Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info');
Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save');
Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del');
});
});
//无需登录验证的路由组
... ...