合并分支 'lyh-server' 到 'master'
Lyh server 查看合并请求 !3153
正在显示
3 个修改的文件
包含
32 行增加
和
0 行删除
| @@ -4,6 +4,7 @@ namespace App\Console\Commands\Ai; | @@ -4,6 +4,7 @@ namespace App\Console\Commands\Ai; | ||
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\Project\ProjectLogic; | 5 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 6 | use App\Models\Ai\AiBlog; | 6 | use App\Models\Ai\AiBlog; |
| 7 | +use App\Models\Ai\AiBlogKeyword; | ||
| 7 | use App\Models\Ai\AiBlogOpenLog; | 8 | use App\Models\Ai\AiBlogOpenLog; |
| 8 | use App\Models\Project\AiBlogTask as AiBlogTaskModel; | 9 | use App\Models\Project\AiBlogTask as AiBlogTaskModel; |
| 9 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| @@ -77,6 +78,9 @@ class AiBlogAutoPublish extends Command | @@ -77,6 +78,9 @@ class AiBlogAutoPublish extends Command | ||
| 77 | $this->output("项目{$project->id}未到执行时间" . $next_auto_date); | 78 | $this->output("项目{$project->id}未到执行时间" . $next_auto_date); |
| 78 | continue; | 79 | continue; |
| 79 | } | 80 | } |
| 81 | + $aiKeywordModel = new AiBlogKeyword(); | ||
| 82 | + $keywords = $aiKeywordModel->getValue(['project_id'=>$this->user['project_id']],'keywords'); | ||
| 83 | + if(!empty($keywords)){ | ||
| 80 | //核心关键词+网站关键词+白帽关键词 | 84 | //核心关键词+网站关键词+白帽关键词 |
| 81 | $main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword'); | 85 | $main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword'); |
| 82 | $main_keywords = explode("\r\n", $main_keywords); | 86 | $main_keywords = explode("\r\n", $main_keywords); |
| @@ -88,6 +92,11 @@ class AiBlogAutoPublish extends Command | @@ -88,6 +92,11 @@ class AiBlogAutoPublish extends Command | ||
| 88 | $site_keywords = explode(",", $site_keywords); | 92 | $site_keywords = explode(",", $site_keywords); |
| 89 | $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords)); | 93 | $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords)); |
| 90 | $keywords = array_map('trim', $keywords); | 94 | $keywords = array_map('trim', $keywords); |
| 95 | + }else{ | ||
| 96 | + $keywords = explode("\r\n", $keywords); | ||
| 97 | + $keywords = array_map('trim', $keywords); // 清理空格 | ||
| 98 | + $keywords = array_filter($keywords); // 移除空值 | ||
| 99 | + } | ||
| 91 | if (empty($keywords)) { | 100 | if (empty($keywords)) { |
| 92 | $this->output("项目{$project->id}未获取到关键词"); | 101 | $this->output("项目{$project->id}未获取到关键词"); |
| 93 | continue; | 102 | continue; |
| @@ -15,6 +15,9 @@ class CountController extends BaseController | @@ -15,6 +15,9 @@ class CountController extends BaseController | ||
| 15 | * @time :2023/5/23 17:23 | 15 | * @time :2023/5/23 17:23 |
| 16 | */ | 16 | */ |
| 17 | public function count(CountLogic $countLogic){ | 17 | public function count(CountLogic $countLogic){ |
| 18 | + if($this->user['project_id'] == 5172){ | ||
| 19 | + $this->user['project_id'] = 3298; | ||
| 20 | + } | ||
| 18 | $data = []; | 21 | $data = []; |
| 19 | //TODO::昨日数据统计 | 22 | //TODO::昨日数据统计 |
| 20 | $data['yesterday'] = $countLogic->yesterday_count(); | 23 | $data['yesterday'] = $countLogic->yesterday_count(); |
| @@ -11,6 +11,10 @@ namespace App\Http\Logic\Bside\Ai; | @@ -11,6 +11,10 @@ namespace App\Http\Logic\Bside\Ai; | ||
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\Ai\AiBlogKeyword; | 13 | use App\Models\Ai\AiBlogKeyword; |
| 14 | +use App\Models\Project\ProjectKeyword; | ||
| 15 | +use App\Models\WebSetting\WebSetting; | ||
| 16 | +use App\Services\ProjectServer; | ||
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 14 | 18 | ||
| 15 | class AiBlogKeywordLogic extends BaseLogic | 19 | class AiBlogKeywordLogic extends BaseLogic |
| 16 | { | 20 | { |
| @@ -32,6 +36,22 @@ class AiBlogKeywordLogic extends BaseLogic | @@ -32,6 +36,22 @@ class AiBlogKeywordLogic extends BaseLogic | ||
| 32 | public function getKeywordInfo() | 36 | public function getKeywordInfo() |
| 33 | { | 37 | { |
| 34 | $data = $this->model->read(['project_id'=>$this->user['project_id']]); | 38 | $data = $this->model->read(['project_id'=>$this->user['project_id']]); |
| 39 | + if($data === false){ | ||
| 40 | + //核心关键词+网站关键词+白帽关键词 | ||
| 41 | + $main_keywords = ProjectKeyword::where('project_id', $this->user['project_id'])->value('main_keyword'); | ||
| 42 | + $main_keywords = explode("\r\n", $main_keywords); | ||
| 43 | + $seo_keywords = ProjectKeyword::where('project_id', $this->user['project_id'])->value('seo_keywords'); | ||
| 44 | + $seo_keywords = explode("\r\n", $seo_keywords); | ||
| 45 | + $site_keywords = WebSetting::where('project_id', $this->user['project_id'])->value('keyword'); | ||
| 46 | + $site_keywords = explode(",", $site_keywords); | ||
| 47 | + $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords)); | ||
| 48 | + $keywords = array_map('trim', $keywords); | ||
| 49 | + $keywords_string = implode("\n", $keywords); | ||
| 50 | + $data = [ | ||
| 51 | + 'project_id'=>$this->user['project_id'], | ||
| 52 | + 'keywords'=>$keywords_string | ||
| 53 | + ]; | ||
| 54 | + } | ||
| 35 | return $this->success($data); | 55 | return $this->success($data); |
| 36 | } | 56 | } |
| 37 | 57 |
-
请 注册 或 登录 后发表评论