作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -56,6 +56,9 @@ class AiBlogAuthorTask extends Command @@ -56,6 +56,9 @@ class AiBlogAuthorTask extends Command
56 echo '开始->project_id:' . $info['project_id'] . PHP_EOL . date('Y-m-d H:i:s'); 56 echo '开始->project_id:' . $info['project_id'] . PHP_EOL . date('Y-m-d H:i:s');
57 //获取配置 57 //获取配置
58 $aiSettingInfo = $this->getSetting($info['project_id']); 58 $aiSettingInfo = $this->getSetting($info['project_id']);
  59 + if(empty($aiSettingInfo)){
  60 + continue;
  61 + }
59 $aiBlogService = new AiBlogService(); 62 $aiBlogService = new AiBlogService();
60 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 63 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
61 $aiBlogService->key = $aiSettingInfo['key']; 64 $aiBlogService->key = $aiSettingInfo['key'];
@@ -121,13 +121,8 @@ class AiBlogTask extends Command @@ -121,13 +121,8 @@ class AiBlogTask extends Command
121 * @time :2025/2/14 11:27 121 * @time :2025/2/14 11:27
122 */ 122 */
123 public function getSetting($project_id){ 123 public function getSetting($project_id){
124 - $ai_cache = Cache::get('ai_blog_'.$project_id);  
125 - if($ai_cache){  
126 - return $ai_cache;  
127 - }  
128 $projectAiSettingModel = new ProjectAiSetting(); 124 $projectAiSettingModel = new ProjectAiSetting();
129 $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]); 125 $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
130 - Cache::put('ai_blog_'.$project_id,$aiSettingInfo,3600);  
131 return $aiSettingInfo; 126 return $aiSettingInfo;
132 } 127 }
133 128
  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 +}
@@ -83,6 +83,7 @@ class ProjectController extends BaseController @@ -83,6 +83,7 @@ class ProjectController extends BaseController
83 'gl_project.channel AS channel', 83 'gl_project.channel AS channel',
84 'gl_project.company AS company', 84 'gl_project.company AS company',
85 'gl_project.type AS type', 85 'gl_project.type AS type',
  86 + 'gl_project.project_type AS project_type',
86 'gl_project.extend_type AS extend_type', 87 'gl_project.extend_type AS extend_type',
87 'gl_project.uptime AS uptime', 88 'gl_project.uptime AS uptime',
88 'gl_project.is_upgrade AS is_upgrade', 89 'gl_project.is_upgrade AS is_upgrade',
@@ -7,8 +7,6 @@ use App\Exceptions\BsideGlobalException; @@ -7,8 +7,6 @@ use App\Exceptions\BsideGlobalException;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Http\Controllers\Controller; 8 use App\Http\Controllers\Controller;
9 use App\Http\Requests\Scene; 9 use App\Http\Requests\Scene;
10 -use App\Models\Project\DeployOptimize;  
11 -use App\Models\Project\ProjectKeyword;  
12 use App\Models\Template\BTemplate; 10 use App\Models\Template\BTemplate;
13 use App\Models\Template\Setting; 11 use App\Models\Template\Setting;
14 use Illuminate\Http\JsonResponse; 12 use Illuminate\Http\JsonResponse;
  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 }
@@ -103,8 +103,7 @@ class AiBlogLogic extends BaseLogic @@ -103,8 +103,7 @@ class AiBlogLogic extends BaseLogic
103 if($result['status'] == 200){ 103 if($result['status'] == 200){
104 $aiBlogTaskModel = new AiBlogTask(); 104 $aiBlogTaskModel = new AiBlogTask();
105 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]); 105 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]);
106 - $aiBlogModel = new AiBlog();  
107 - $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'anchor'=>json_encode($this->param['anchor'] ?? [],true) 106 + $this->model->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'anchor'=>json_encode($this->param['anchor'] ?? [],true)
108 ]); 107 ]);
109 } 108 }
110 return $this->success(); 109 return $this->success();
@@ -274,6 +274,7 @@ class UserLoginLogic @@ -274,6 +274,7 @@ class UserLoginLogic
274 $info['is_watermark'] = $project['is_watermark']; 274 $info['is_watermark'] = $project['is_watermark'];
275 $info['configuration'] = $project['deploy_build']['configuration']; 275 $info['configuration'] = $project['deploy_build']['configuration'];
276 $info['project_type'] = $project['type']; 276 $info['project_type'] = $project['type'];
  277 + $info['project_seo_type'] = $project['project_type'];
277 $info['storage_type'] = $project['storage_type']; 278 $info['storage_type'] = $project['storage_type'];
278 $info['open_export_product'] = $project['open_export_product']; 279 $info['open_export_product'] = $project['open_export_product'];
279 $info['project_location'] = $project['project_location']; 280 $info['project_location'] = $project['project_location'];
@@ -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 }
  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 //无需登录验证的路由组