作者 刘锟

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

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Console\Commands\Domain; 3 namespace App\Console\Commands\Domain;
4 4
  5 +use App\Models\Project\DeployOptimize;
5 use App\Models\Project\OnlineCheck; 6 use App\Models\Project\OnlineCheck;
6 use App\Models\Project\Project; 7 use App\Models\Project\Project;
7 use Illuminate\Console\Command; 8 use Illuminate\Console\Command;
@@ -22,6 +23,9 @@ class RemainDay extends Command @@ -22,6 +23,9 @@ class RemainDay extends Command
22 */ 23 */
23 protected $signature = 'remain_day'; 24 protected $signature = 'remain_day';
24 25
  26 + protected $projectId = [
  27 + 1434
  28 + ];//需要单独处理的项目
25 /** 29 /**
26 * The console command description. 30 * The console command description.
27 * 31 *
@@ -44,20 +48,29 @@ class RemainDay extends Command @@ -44,20 +48,29 @@ class RemainDay extends Command
44 */ 48 */
45 public function handle() 49 public function handle()
46 { 50 {
47 - $list = Project::whereIn('type', [2,3,4])->get(); 51 + $list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get();
48 foreach ($list as $item){ 52 foreach ($list as $item){
49 - if($item['type'] == Project::TYPE_TWO){  
50 - //获取当前项目的达标天数  
51 - $compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0;  
52 - $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; 53 + if(in_array($item->id,$this->projectId)){//已开始优化的时间结算
  54 + $optimizeModel = new DeployOptimize();
  55 + $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']);
  56 + if($opInfo === false){
  57 + continue;
  58 + }
  59 + $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime);
  60 + $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24));
53 }else{ 61 }else{
54 - //审核上线后开始  
55 - $check_time = OnlineCheck::where('project_id', $item['id'])->where('status', 1)->value('created_at') ?: '';  
56 - if(!$check_time){  
57 - $remain_day = $item['deploy_build']['service_duration']; 62 + if($item['type'] == Project::TYPE_TWO){
  63 + //获取当前项目的达标天数
  64 + $compliance_day = $item->finish_remain_day ?? 0;
  65 + $remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
58 }else{ 66 }else{
59 - $diff = time() - strtotime($check_time);  
60 - $remain_day = floor($diff / (60 * 60 * 24)); 67 + if($item->uptime){
  68 + $diff = time() - strtotime($item->uptime);
  69 + $item->finish_remain_day = floor($diff / (60 * 60 * 24));
  70 + $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24));
  71 + }else{
  72 + $remain_day = $item['deploy_build']['service_duration'];
  73 + }
61 } 74 }
62 } 75 }
63 $item->remain_day = $remain_day > 0 ? $remain_day : 0; 76 $item->remain_day = $remain_day > 0 ? $remain_day : 0;
@@ -10,6 +10,7 @@ use App\Models\Domain\DomainInfo; @@ -10,6 +10,7 @@ use App\Models\Domain\DomainInfo;
10 use App\Models\Mail\Mail; 10 use App\Models\Mail\Mail;
11 use App\Models\Project\DeployBuild; 11 use App\Models\Project\DeployBuild;
12 use App\Models\Project\DeployOptimize; 12 use App\Models\Project\DeployOptimize;
  13 +use App\Models\Project\ProjectKeyword;
13 use App\Models\Project\ProjectUpdateTdk; 14 use App\Models\Project\ProjectUpdateTdk;
14 use App\Models\User\User; 15 use App\Models\User\User;
15 use App\Models\WebSetting\WebLanguage; 16 use App\Models\WebSetting\WebLanguage;
@@ -375,7 +376,13 @@ class UpdateSeoTdk extends Command @@ -375,7 +376,13 @@ class UpdateSeoTdk extends Command
375 $info = Cache::get($cache_key); 376 $info = Cache::get($cache_key);
376 if(!$info){ 377 if(!$info){
377 $projectOptimizeModel = new DeployOptimize(); 378 $projectOptimizeModel = new DeployOptimize();
378 - $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']); 379 + $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']);
  380 + $projectKeywordModel = new ProjectKeyword();
  381 + $keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
  382 + $info['main_keyword'] = '';
  383 + if($keywordInfo === false){
  384 + $info['main_keyword'] = $keywordInfo['main_keyword'];
  385 + }
379 Cache::put($cache_key, $info, 600); 386 Cache::put($cache_key, $info, 600);
380 } 387 }
381 return $info; 388 return $info;
@@ -412,12 +419,12 @@ class UpdateSeoTdk extends Command @@ -412,12 +419,12 @@ class UpdateSeoTdk extends Command
412 { 419 {
413 $str = ''; 420 $str = '';
414 $info = $this->getDeployOptimize($project_id); 421 $info = $this->getDeployOptimize($project_id);
415 - if (!empty($info['main_keywords'])) {  
416 - $main_keywords = explode("\r\n", $info['main_keywords']); 422 + if (!empty($info['main_keyword'])) {
  423 + $main_keyword = explode("\r\n", $info['main_keyword']);
417 //随机取 424 //随机取
418 - shuffle($main_keywords);  
419 - $main_keywords = array_slice($main_keywords, 0, $num);  
420 - $str = implode(", ", $main_keywords); 425 + shuffle($main_keyword);
  426 + $main_keyword = array_slice($main_keyword, 0, $num);
  427 + $str = implode(", ", $main_keyword);
421 } 428 }
422 return $str; 429 return $str;
423 } 430 }
@@ -10,6 +10,7 @@ use App\Models\Domain\DomainInfo; @@ -10,6 +10,7 @@ use App\Models\Domain\DomainInfo;
10 use App\Models\Mail\Mail; 10 use App\Models\Mail\Mail;
11 use App\Models\Project\DeployBuild; 11 use App\Models\Project\DeployBuild;
12 use App\Models\Project\DeployOptimize; 12 use App\Models\Project\DeployOptimize;
  13 +use App\Models\Project\ProjectKeyword;
13 use App\Models\Project\ProjectUpdateTdk; 14 use App\Models\Project\ProjectUpdateTdk;
14 use App\Models\User\User; 15 use App\Models\User\User;
15 use App\Models\WebSetting\WebLanguage; 16 use App\Models\WebSetting\WebLanguage;
@@ -373,7 +374,13 @@ class UpdateSeoTdkByTaskId extends Command @@ -373,7 +374,13 @@ class UpdateSeoTdkByTaskId extends Command
373 $info = Cache::get($cache_key); 374 $info = Cache::get($cache_key);
374 if(!$info){ 375 if(!$info){
375 $projectOptimizeModel = new DeployOptimize(); 376 $projectOptimizeModel = new DeployOptimize();
376 - $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']); 377 + $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']);
  378 + $projectKeywordModel = new ProjectKeyword();
  379 + $keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
  380 + $info['main_keyword'] = '';
  381 + if($keywordInfo === false){
  382 + $info['main_keyword'] = $keywordInfo['main_keyword'];
  383 + }
377 Cache::put($cache_key, $info, 600); 384 Cache::put($cache_key, $info, 600);
378 } 385 }
379 return $info; 386 return $info;
@@ -410,12 +417,12 @@ class UpdateSeoTdkByTaskId extends Command @@ -410,12 +417,12 @@ class UpdateSeoTdkByTaskId extends Command
410 { 417 {
411 $str = ''; 418 $str = '';
412 $info = $this->getDeployOptimize($project_id); 419 $info = $this->getDeployOptimize($project_id);
413 - if (!empty($info['main_keywords'])) {  
414 - $main_keywords = explode("\r\n", $info['main_keywords']); 420 + if (!empty($info['main_keyword'])) {
  421 + $main_keyword = explode("\r\n", $info['main_keyword']);
415 //随机取 422 //随机取
416 - shuffle($main_keywords);  
417 - $main_keywords = array_slice($main_keywords, 0, $num);  
418 - $str = implode(", ", $main_keywords); 423 + shuffle($main_keyword);
  424 + $main_keyword = array_slice($main_keyword, 0, $num);
  425 + $str = implode(", ", $main_keyword);
419 } 426 }
420 return $str; 427 return $str;
421 } 428 }
@@ -48,7 +48,7 @@ class Demo extends Command @@ -48,7 +48,7 @@ class Demo extends Command
48 protected $description = 'demo'; 48 protected $description = 'demo';
49 49
50 public function handle(){ 50 public function handle(){
51 - $this->synchronizationFile('/upload/p/1720/file/2024-07/4d.mp4'); 51 + $this->synchronizationFile('/upload/m/file/2024-07/tongli-haiyuan-keywords.pdf');
52 } 52 }
53 53
54 public function synchronizationFile($path_name){ 54 public function synchronizationFile($path_name){
@@ -93,4 +93,9 @@ class TdkTest extends Command @@ -93,4 +93,9 @@ class TdkTest extends Command
93 } 93 }
94 } 94 }
95 } 95 }
  96 +
  97 + public function ceshi(){
  98 + //under_ceshi
  99 + $model = new Cesjo();
  100 + }
96 } 101 }
@@ -19,7 +19,7 @@ class Kernel extends ConsoleKernel @@ -19,7 +19,7 @@ class Kernel extends ConsoleKernel
19 $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 19 $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
20 $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 20 $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
21 // $schedule->command('inspire')->hourly(); 21 // $schedule->command('inspire')->hourly();
22 - $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 22 + $schedule->command('remain_day')->dailyAt('06:00')->withoutOverlapping(1); // 项目剩余服务时长
23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
24 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 24 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
25 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 25 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
@@ -13,6 +13,7 @@ use App\Enums\Common\Code; @@ -13,6 +13,7 @@ use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
14 use App\Models\Project\DeployOptimize; 14 use App\Models\Project\DeployOptimize;
15 use App\Models\Project\Project; 15 use App\Models\Project\Project;
  16 +use App\Models\Project\ProjectKeyword;
16 17
17 class KeywordsController extends BaseController 18 class KeywordsController extends BaseController
18 { 19 {
@@ -24,9 +25,9 @@ class KeywordsController extends BaseController @@ -24,9 +25,9 @@ class KeywordsController extends BaseController
24 * @time :2023/9/4 10:13 25 * @time :2023/9/4 10:13
25 */ 26 */
26 public function lists(){ 27 public function lists(){
27 - $projectDeployOptimizeModel = new DeployOptimize();  
28 - $ids = $projectDeployOptimizeModel->where('customer_keywords','like','%'.$this->map['search'].'%')  
29 - ->orWhere('main_keywords', 'like' , '%'.$this->map['search'].'%')->pluck('project_id')->toArray(); 28 + $projectKeywordModel = new ProjectKeyword();
  29 + $ids = $projectKeywordModel->where('customer_keywords','like','%'.$this->map['search'].'%')
  30 + ->orWhere('main_keyword', 'like' , '%'.$this->map['search'].'%')->pluck('project_id')->toArray();
30 $projectModel = new Project(); 31 $projectModel = new Project();
31 $lists = $projectModel->formatQuery(['id'=>['in',$ids]])->with('payment')->with('deploy_build') 32 $lists = $projectModel->formatQuery(['id'=>['in',$ids]])->with('payment')->with('deploy_build')
32 ->with('deploy_optimize')->with('domainInfo')->get()->toArray(); 33 ->with('deploy_optimize')->with('domainInfo')->get()->toArray();
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Keyword; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Keyword;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\Project\DeployOptimize; 14 use App\Models\Project\DeployOptimize;
  15 +use App\Models\Project\ProjectKeyword;
15 16
16 class ProjectKeywordController extends BaseController 17 class ProjectKeywordController extends BaseController
17 { 18 {
@@ -28,9 +29,16 @@ class ProjectKeywordController extends BaseController @@ -28,9 +29,16 @@ class ProjectKeywordController extends BaseController
28 if($info === false){ 29 if($info === false){
29 $this->response('success'); 30 $this->response('success');
30 } 31 }
31 - $data['search_keywords'] = $info['search_keywords'];  
32 - $data['customer_keywords'] = $info['customer_keywords'];  
33 $data['brand_keyword'] = $info['brand_keyword']; 32 $data['brand_keyword'] = $info['brand_keyword'];
  33 + $projectKeywordModel = new ProjectKeyword();
  34 + $keywordInfo = $projectKeywordModel->read(['project_id'=>$this->user['project_id']]);
  35 + if($keywordInfo === false){
  36 + $data['search_keywords'] = '';
  37 + $data['customer_keywords'] = '';
  38 + $this->response('success',Code::SUCCESS,$data);
  39 + }
  40 + $data['search_keywords'] = $keywordInfo['search_keywords'];
  41 + $data['customer_keywords'] = $keywordInfo['customer_keywords'];
34 $this->response('success',Code::SUCCESS,$data); 42 $this->response('success',Code::SUCCESS,$data);
35 } 43 }
36 44
@@ -571,8 +571,8 @@ class ProductController extends BaseController @@ -571,8 +571,8 @@ class ProductController extends BaseController
571 } 571 }
572 572
573 /** 573 /**
574 - * @remark :Ai发布新闻  
575 - * @name :sendAiNews 574 + * @remark :Ai发布
  575 + * @name :sendAiProduct
576 * @author :lyh 576 * @author :lyh
577 * @method :post 577 * @method :post
578 * @time :2024/1/26 15:33 578 * @time :2024/1/26 15:33
@@ -236,8 +236,9 @@ class InquiryInfoLogic extends BaseLogic @@ -236,8 +236,9 @@ class InquiryInfoLogic extends BaseLogic
236 public function getKeywordUrl($map){ 236 public function getKeywordUrl($map){
237 $projectModel = new Project(); 237 $projectModel = new Project();
238 $lists = $projectModel->leftJoin('gl_project_deploy_optimize', 'gl_project_deploy_optimize.project_id', '=', 'gl_project.id') 238 $lists = $projectModel->leftJoin('gl_project_deploy_optimize', 'gl_project_deploy_optimize.project_id', '=', 'gl_project.id')
239 - ->where('gl_project_deploy_optimize.main_keywords','like','%'.$map['keyword'].'%')  
240 - ->orWhere('gl_project_deploy_optimize.customer_keywords','like','%'.$map['keyword'].'%') 239 + ->leftJoin('gl_project_keyword', 'gl_project_keyword.project_id', '=', 'gl_project.id')
  240 + ->where('gl_project_keyword.main_keyword','like','%'.$map['keyword'].'%')
  241 + ->orWhere('gl_project_keyword.customer_keywords','like','%'.$map['keyword'].'%')
241 ->select($this->selectParam())->get(); 242 ->select($this->selectParam())->get();
242 if(!empty($lists)){ 243 if(!empty($lists)){
243 $lists = $lists->toArray(); 244 $lists = $lists->toArray();
@@ -30,6 +30,7 @@ use App\Models\Project\InquiryFilterConfig; @@ -30,6 +30,7 @@ use App\Models\Project\InquiryFilterConfig;
30 use App\Models\Project\MinorLanguages; 30 use App\Models\Project\MinorLanguages;
31 use App\Models\Project\Payment; 31 use App\Models\Project\Payment;
32 use App\Models\Project\Project; 32 use App\Models\Project\Project;
  33 +use App\Models\Project\ProjectKeyword;
33 use App\Models\Project\ProjectRenew; 34 use App\Models\Project\ProjectRenew;
34 use App\Models\Project\WebTrafficConfig; 35 use App\Models\Project\WebTrafficConfig;
35 use App\Models\RankData\ExternalLinks; 36 use App\Models\RankData\ExternalLinks;
@@ -71,7 +72,8 @@ class ProjectLogic extends BaseLogic @@ -71,7 +72,8 @@ class ProjectLogic extends BaseLogic
71 * @time :2023/7/28 17:11 72 * @time :2023/7/28 17:11
72 */ 73 */
73 public function getProjectInfo($id){ 74 public function getProjectInfo($id){
74 - $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', 'project_after','inquiry_filter_config','web_traffic_config'])->where(['id'=>$id])->first()->toArray(); 75 + $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check',
  76 + 'project_after','inquiry_filter_config','web_traffic_config','project_keyword'])->where(['id'=>$id])->first()->toArray();
75 $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); 77 $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0);
76 $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; 78 $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain'];
77 if($info['extend_type'] != 0){ 79 if($info['extend_type'] != 0){
@@ -157,6 +159,8 @@ class ProjectLogic extends BaseLogic @@ -157,6 +159,8 @@ class ProjectLogic extends BaseLogic
157 $this->saveProjectPayment($this->param['payment']); 159 $this->saveProjectPayment($this->param['payment']);
158 //保存优化信息 160 //保存优化信息
159 $this->saveProjectDeployOptimize($this->param['deploy_optimize']); 161 $this->saveProjectDeployOptimize($this->param['deploy_optimize']);
  162 + //保存项目关键字
  163 + $this->saveProjectKeyword($this->param['project_keyword'] ?? [],$this->param['id']);
160 //保存售后信息 164 //保存售后信息
161 $this->saveProjectAfter($this->param['project_after']); 165 $this->saveProjectAfter($this->param['project_after']);
162 //单独保存小语种配置 166 //单独保存小语种配置
@@ -354,6 +358,30 @@ class ProjectLogic extends BaseLogic @@ -354,6 +358,30 @@ class ProjectLogic extends BaseLogic
354 } 358 }
355 359
356 /** 360 /**
  361 + * @remark :保存项目关键字
  362 + * @name :saveProjectKeyword
  363 + * @author :lyh
  364 + * @method :post
  365 + * @time :2024/7/22 11:45
  366 + */
  367 + public function saveProjectKeyword($project_keyword,$project_id){
  368 + $projectKeywordModel = new ProjectKeyword();
  369 + $info = $projectKeywordModel->read(['project_id'=>$project_id]);
  370 + $data = [
  371 + 'main_keyword'=>$project_keyword['main_keyword'] ?? '',
  372 + 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '',
  373 + 'search_keywords'=>$project_keyword['search_keywords'] ?? '',
  374 + ];
  375 + if($info === false){
  376 + $data['project_id'] = $project_id;
  377 + $projectKeywordModel->addReturnId($data);
  378 + }else{
  379 + $projectKeywordModel->edit($data,['id'=>$info['id']]);
  380 + }
  381 + return $this->success();
  382 + }
  383 +
  384 + /**
357 * @remark :保存为售后部署 385 * @remark :保存为售后部署
358 * @name :saveProjectAfter 386 * @name :saveProjectAfter
359 * @author :lyh 387 * @author :lyh
@@ -8,6 +8,7 @@ use App\Helper\Translate; @@ -8,6 +8,7 @@ use App\Helper\Translate;
8 use App\Http\Logic\Bside\BaseLogic; 8 use App\Http\Logic\Bside\BaseLogic;
9 use App\Models\Ai\AiCommand; 9 use App\Models\Ai\AiCommand;
10 use App\Models\Project\DeployOptimize; 10 use App\Models\Project\DeployOptimize;
  11 +use App\Models\Project\ProjectKeyword;
11 use App\Models\WebSetting\WebLanguage; 12 use App\Models\WebSetting\WebLanguage;
12 use Illuminate\Support\Facades\Cache; 13 use Illuminate\Support\Facades\Cache;
13 14
@@ -43,14 +44,14 @@ class AiCommandLogic extends BaseLogic @@ -43,14 +44,14 @@ class AiCommandLogic extends BaseLogic
43 $prompt = str_replace('{company name}', $company_name, $prompt); 44 $prompt = str_replace('{company name}', $company_name, $prompt);
44 } 45 }
45 if(strpos($prompt, '{core keywords 8}') !== false) { 46 if(strpos($prompt, '{core keywords 8}') !== false) {
46 - $main_keywords = $this->getDeployOptimize('main_keywords');  
47 - if ($main_keywords) {  
48 - $main_keywords = explode("\r\n", $main_keywords); 47 + $main_keyword = $this->getDeployOptimize('main_keyword');
  48 + if ($main_keyword) {
  49 + $main_keyword = explode("\r\n", $main_keyword);
49 //随机取 50 //随机取
50 - shuffle($main_keywords);  
51 - $main_keywords = array_slice($main_keywords, 0, 8);  
52 - $main_keywords = implode(", ", $main_keywords);  
53 - $prompt = str_replace('{core keywords 8}', $main_keywords, $prompt); 51 + shuffle($main_keyword);
  52 + $main_keyword = array_slice($main_keyword, 0, 8);
  53 + $main_keyword = implode(", ", $main_keyword);
  54 + $prompt = str_replace('{core keywords 8}', $main_keyword, $prompt);
54 }else{ 55 }else{
55 $prompt = ''; 56 $prompt = '';
56 } 57 }
@@ -99,7 +100,13 @@ class AiCommandLogic extends BaseLogic @@ -99,7 +100,13 @@ class AiCommandLogic extends BaseLogic
99 $info = Cache::get($cache_key); 100 $info = Cache::get($cache_key);
100 if(!$info){ 101 if(!$info){
101 $projectOptimizeModel = new DeployOptimize(); 102 $projectOptimizeModel = new DeployOptimize();
102 - $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'main_keywords']); 103 + $info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description']);
  104 + $projectKeywordModel = new ProjectKeyword();
  105 + $keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
  106 + $info['main_keyword'] = '';
  107 + if($keywordInfo === false){
  108 + $info['main_keyword'] = $keywordInfo['main_keyword'];
  109 + }
103 Cache::put($cache_key, $info, 600); 110 Cache::put($cache_key, $info, 600);
104 } 111 }
105 if($key){ 112 if($key){
@@ -442,6 +442,24 @@ class BTemplateLogic extends BaseLogic @@ -442,6 +442,24 @@ class BTemplateLogic extends BaseLogic
442 */ 442 */
443 public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){ 443 public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){
444 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目 444 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目
  445 + //TODO::扩展模块定制单独处理
  446 + if($is_custom == BTemplate::IS_CUSTOM){
  447 + $customModuleModel = new CustomModule();
  448 + $info = $customModuleModel->read(['id'=>$source]);
  449 + if($info === false){
  450 + $this->fail('当前扩展模块不存在或已被删除');
  451 + }
  452 + //todo::扩展模块(列表页/详情页)定制
  453 + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
  454 + $data['html'] = $html;
  455 + $data['type'] = BTemplate::ALL_HTML;
  456 + }else{
  457 + $mainInfo = $this->handleTemplateHtml($html);
  458 + $data['main_html'] = $mainInfo['main_html'];
  459 + $data['main_css'] = $mainInfo['main_css'];
  460 + }
  461 + return $this->success($data);
  462 + }
445 $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 463 $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
446 //查看当前页面是否定制,是否开启可视化 464 //查看当前页面是否定制,是否开启可视化
447 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 465 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
@@ -449,19 +467,6 @@ class BTemplateLogic extends BaseLogic @@ -449,19 +467,6 @@ class BTemplateLogic extends BaseLogic
449 $data['html'] = $html; 467 $data['html'] = $html;
450 $data['type'] = BTemplate::ALL_HTML; 468 $data['type'] = BTemplate::ALL_HTML;
451 }else{ 469 }else{
452 - //TODO::扩展模块定制单独处理  
453 - if($is_custom == BTemplate::IS_CUSTOM){  
454 - $customModuleModel = new CustomModule();  
455 - $info = $customModuleModel->read(['id'=>$source]);  
456 - if($info === false){  
457 - $this->fail('当前扩展模块不存在或已被删除');  
458 - }  
459 - //todo::扩展模块(列表页/详情页)定制  
460 - if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {  
461 - $data['html'] = $html;  
462 - $data['type'] = BTemplate::ALL_HTML;  
463 - }  
464 - }  
465 $mainInfo = $this->handleTemplateHtml($html); 470 $mainInfo = $this->handleTemplateHtml($html);
466 $data['main_html'] = $mainInfo['main_html']; 471 $data['main_html'] = $mainInfo['main_html'];
467 $data['main_css'] = $mainInfo['main_css']; 472 $data['main_css'] = $mainInfo['main_css'];
@@ -424,7 +424,7 @@ class BlogLogic extends BaseLogic @@ -424,7 +424,7 @@ class BlogLogic extends BaseLogic
424 public function copyBlogInfo(){ 424 public function copyBlogInfo(){
425 $info = $this->model->read(['id'=>$this->param['id']]); 425 $info = $this->model->read(['id'=>$this->param['id']]);
426 $param = [ 426 $param = [
427 - 'name'=>$info['name']."-copy", 427 + 'name'=>$info['name']."-1",
428 'status'=>0, 428 'status'=>0,
429 'sort'=>$info['sort'], 429 'sort'=>$info['sort'],
430 'category_id'=>$info['category_id'], 430 'category_id'=>$info['category_id'],
@@ -8,6 +8,7 @@ use App\Models\HomeCount\Count; @@ -8,6 +8,7 @@ use App\Models\HomeCount\Count;
8 use App\Models\HomeCount\MonthCount; 8 use App\Models\HomeCount\MonthCount;
9 use App\Models\Inquiry\InquiryFormData; 9 use App\Models\Inquiry\InquiryFormData;
10 use App\Models\Project\DeployOptimize; 10 use App\Models\Project\DeployOptimize;
  11 +use App\Models\Project\ProjectKeyword;
11 use App\Services\ProjectServer; 12 use App\Services\ProjectServer;
12 use Carbon\Carbon; 13 use Carbon\Carbon;
13 use Illuminate\Support\Facades\DB; 14 use Illuminate\Support\Facades\DB;
@@ -85,8 +86,14 @@ class MonthCountLogic extends BaseLogic @@ -85,8 +86,14 @@ class MonthCountLogic extends BaseLogic
85 * @time :2023/7/4 10:19 86 * @time :2023/7/4 10:19
86 */ 87 */
87 public function getKeywordLists(){ 88 public function getKeywordLists(){
88 - $optimizeModel = new DeployOptimize();  
89 - $info = $optimizeModel->read(['project_id'=>$this->user['project_id']],['main_keywords','customer_keywords']); 89 + $projectKeywordModel = new ProjectKeyword();
  90 + $info = $projectKeywordModel->read(['project_id'=>$this->user['project_id']],['main_keyword','customer_keywords']);
  91 + if($info === false){
  92 + $info = [
  93 + 'main_keyword'=>'',
  94 + 'customer_keywords'=>''
  95 + ];
  96 + }
90 return $this->success($info); 97 return $this->success($info);
91 } 98 }
92 } 99 }
@@ -462,7 +462,7 @@ class NewsLogic extends BaseLogic @@ -462,7 +462,7 @@ class NewsLogic extends BaseLogic
462 public function copyNewsInfo(){ 462 public function copyNewsInfo(){
463 $info = $this->model->read(['id'=>$this->param['id']]); 463 $info = $this->model->read(['id'=>$this->param['id']]);
464 $param = [ 464 $param = [
465 - 'name'=>$info['name']."-copy", 465 + 'name'=>$info['name']."-1",
466 'status'=>0, 466 'status'=>0,
467 'sort'=>$info['sort'], 467 'sort'=>$info['sort'],
468 'category_id'=>$info['category_id'], 468 'category_id'=>$info['category_id'],
@@ -299,6 +299,8 @@ class ProductLogic extends BaseLogic @@ -299,6 +299,8 @@ class ProductLogic extends BaseLogic
299 } 299 }
300 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ 300 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
301 $param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).','; 301 $param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).',';
  302 + }else{
  303 + $param['keyword_id'] = '';
302 } 304 }
303 $param['attrs'] = Arr::a2s($param['attrs'] ?? []); 305 $param['attrs'] = Arr::a2s($param['attrs'] ?? []);
304 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); 306 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
@@ -434,8 +436,8 @@ class ProductLogic extends BaseLogic @@ -434,8 +436,8 @@ class ProductLogic extends BaseLogic
434 public function setCopyProduct(){ 436 public function setCopyProduct(){
435 $info = $this->model->read(['id'=>$this->param['id']]); 437 $info = $this->model->read(['id'=>$this->param['id']]);
436 $param = $this->setProductParams($info); 438 $param = $this->setProductParams($info);
437 - DB::beginTransaction();  
438 - try { 439 +// DB::beginTransaction();
  440 +// try {
439 $save_id = $this->model->insertGetId($param); 441 $save_id = $this->model->insertGetId($param);
440 CategoryRelated::saveRelated($save_id, $info['category_id']); 442 CategoryRelated::saveRelated($save_id, $info['category_id']);
441 $route = preg_replace('/-product.*/', '', $param['route']); 443 $route = preg_replace('/-product.*/', '', $param['route']);
@@ -446,11 +448,11 @@ class ProductLogic extends BaseLogic @@ -446,11 +448,11 @@ class ProductLogic extends BaseLogic
446 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); 448 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
447 //同步扩展字段 449 //同步扩展字段
448 $this->copyExtendInfo($info['id'],$save_id); 450 $this->copyExtendInfo($info['id'],$save_id);
449 - DB::commit();  
450 - }catch (\Exception $e){  
451 - DB::rollBack();  
452 - $this->fail('复制失败,请联系管理员');  
453 - } 451 +// DB::commit();
  452 +// }catch (\Exception $e){
  453 +// DB::rollBack();
  454 +// $this->fail('复制失败,请联系管理员');
  455 +// }
454 return $this->success(['id'=>$save_id]); 456 return $this->success(['id'=>$save_id]);
455 } 457 }
456 458
@@ -537,7 +539,7 @@ class ProductLogic extends BaseLogic @@ -537,7 +539,7 @@ class ProductLogic extends BaseLogic
537 public function setProductParams($info){ 539 public function setProductParams($info){
538 $param = [ 540 $param = [
539 'project_id'=>$info['project_id'], 541 'project_id'=>$info['project_id'],
540 - 'title'=>$info['title']."-copy", 542 + 'title'=>$info['title']."-1",
541 'attrs'=>Arr::a2s($info['attrs']), 543 'attrs'=>Arr::a2s($info['attrs']),
542 'attr_id'=>Arr::arrToSet($info['attr_id']), 544 'attr_id'=>Arr::arrToSet($info['attr_id']),
543 'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '', 545 'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '',
@@ -316,7 +316,7 @@ class TranslateLogic extends BaseLogic @@ -316,7 +316,7 @@ class TranslateLogic extends BaseLogic
316 if(strtolower($route) == 'all'){ 316 if(strtolower($route) == 'all'){
317 return $this->success($data); 317 return $this->success($data);
318 } 318 }
319 - if($route == 'index'){ 319 + if($route == 'index' || $route == '/'){
320 $data['source'] = 1; 320 $data['source'] = 1;
321 return $this->success($data); 321 return $this->success($data);
322 } 322 }
@@ -231,7 +231,17 @@ class Project extends Base @@ -231,7 +231,17 @@ class Project extends Base
231 return self::hasOne(After::class, 'project_id', 'id'); 231 return self::hasOne(After::class, 'project_id', 'id');
232 } 232 }
233 233
234 - 234 + /**
  235 + * @remark :项目关键字
  236 + * @name :project_keyword
  237 + * @author :lyh
  238 + * @method :post
  239 + * @time :2024/7/22 11:38
  240 + */
  241 + public function project_keyword()
  242 + {
  243 + return self::hasOne(ProjectKeyword::class, 'project_id', 'id');
  244 + }
235 /** 245 /**
236 * 询盘过滤配置 246 * 询盘过滤配置
237 * @return \Illuminate\Database\Eloquent\Relations\HasOne 247 * @return \Illuminate\Database\Eloquent\Relations\HasOne
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ProjectKeyword.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/7/22 11:35
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ProjectKeyword extends Base
  15 +{
  16 + //设置关联表名
  17 + protected $table = 'gl_project_keyword';
  18 +}
  1 +<?php
  2 +
  3 +/**
  4 + * @remark :
  5 + * @name :toH.php
  6 + * @author :lyh
  7 + * @method :post
  8 + * @time :2024/7/23 14:14
  9 + */
  10 +class toH
  11 +{
  12 +
  13 +}