作者 刘锟

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

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AiBlogAuthorId.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:57
  8 + */
  9 +
  10 +namespace App\Console\Commands\Ai;
  11 +
  12 +use App\Models\Domain\DomainInfo;
  13 +use App\Models\Project\AiBlogTask as AiBlogTaskModel;
  14 +use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
  15 +use App\Services\AiBlogService;
  16 +use App\Services\ProjectServer;
  17 +use Illuminate\Console\Command;
  18 +use Illuminate\Support\Facades\DB;
  19 +use Illuminate\Support\Facades\Redis;
  20 +
  21 +class AiBlogAuthorId extends Command
  22 +{
  23 + /**
  24 + * The name and signature of the console command.
  25 + *
  26 + * @var string
  27 + */
  28 + protected $signature = 'save_ai_blog_author_id';
  29 +
  30 + /**
  31 + * The console command description.
  32 + *
  33 + * @var string
  34 + */
  35 + protected $description = '拉取对应作者的页面';
  36 +
  37 + public $route = [];
  38 +
  39 + public function handle(){
  40 + while (true){
  41 + //获取任务id
  42 + $task_id = $this->getTaskId();
  43 + if(empty($task_id)){
  44 + sleep(300);
  45 + continue;
  46 + }
  47 + $this->_action($task_id);
  48 + }
  49 + }
  50 +
  51 + public function getTaskId()
  52 + {
  53 + $task_id = Redis::rpop('ai_blog_author_id');
  54 + if (empty($task_id)) {
  55 + $aiBlogTaskModel = new AiBlogTaskModel();
  56 + $ids = $aiBlogTaskModel->formatQuery(['status'=>$aiBlogTaskModel::STATUS_RUNNING, 'type'=>$aiBlogTaskModel::TYPE_AUTHOR_ID])->pluck('id');
  57 + if(!empty($ids)){
  58 + foreach ($ids as $id) {
  59 + Redis::lpush('ai_blog_author_id', $id);
  60 + }
  61 + }
  62 + $task_id = Redis::rpop('ai_blog_author_id');
  63 + }
  64 + return $task_id;
  65 + }
  66 +
  67 + /**
  68 + * @remark :执行方法
  69 + * @name :_action
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2025/5/26 16:06
  73 + */
  74 + public function _action($task_id){
  75 + $aiBlogTaskModel = new AiBlogTaskModel();
  76 + $item = $aiBlogTaskModel->read(['id'=>$task_id]);
  77 + if($item === false){
  78 + echo '当前数据不存在.'.$item['id'].PHP_EOL;
  79 + return true;
  80 + }
  81 + $aiBlogService = new AiBlogService($item['project_id']);
  82 + ProjectServer::useProject($item['project_id']);
  83 + $aiBlogService->author_id = $item['task_id'];
  84 + $result = $aiBlogService->getAuthorDetail();
  85 + if(isset($result['status']) && $result['status'] == 200){
  86 + //当前作者的页面
  87 + $aiBlogAuthorModel = new AiBlogAuthorModel();
  88 + $authorInfo = $aiBlogAuthorModel->read(['author_id'=>$item['task_id']],['id','route']);
  89 + if($authorInfo !== false && !empty($result['data']['section'])){
  90 + $this->route[] = $authorInfo['route'];
  91 + $aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$item['task_id']]);
  92 + }
  93 + }
  94 + DB::disconnect('custom_mysql');
  95 + $aiBlogTaskModel->edit(['status'=>2],['id'=>$task_id]);
  96 + $this->sendCPost($item['project_id']);
  97 + return true;
  98 + }
  99 +
  100 + /**
  101 + * @remark :通知C端
  102 + * @name :sendCPost
  103 + * @author :lyh
  104 + * @method :post
  105 + * @time :2025/5/26 16:21
  106 + */
  107 + public function sendCPost($project_id){
  108 + $domainModel = new DomainInfo();
  109 + $domain = $domainModel->getProjectIdDomain($project_id);
  110 + $c_url = $domain.'api/update_page/';
  111 + $param = [
  112 + 'project_id' => $project_id,
  113 + 'type' => 1,
  114 + 'route' => 3,
  115 + 'url' => $this->route,
  116 + 'language'=> [],
  117 + 'is_sitemap' => 0
  118 + ];
  119 + $res = http_post($c_url, json_encode($param,true));
  120 + echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
  121 + }
  122 +}
@@ -42,7 +42,8 @@ class RemainDay extends Command @@ -42,7 +42,8 @@ class RemainDay extends Command
42 1703, 42 1703,
43 1893, 43 1893,
44 2066, 44 2066,
45 - 2250 45 + 2250,
  46 + 2193
46 ];//需要单独处理的项目 47 ];//需要单独处理的项目
47 /** 48 /**
48 * The console command description. 49 * The console command description.
@@ -126,11 +127,12 @@ class RemainDay extends Command @@ -126,11 +127,12 @@ class RemainDay extends Command
126 }else{ 127 }else{
127 $seo_remain_day = $deploy_build['seo_service_duration']; 128 $seo_remain_day = $deploy_build['seo_service_duration'];
128 } 129 }
129 - if($seo_remain_day < 0){  
130 - $seo_remain_day = 0;  
131 - }  
132 - if($deploy_build['plan'] == 0 && $seo_remain_day == 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常未0,放入未续费中  
133 - $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]); 130 +// if($seo_remain_day < 0){
  131 +// $seo_remain_day = 0;
  132 +// }
  133 + if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
  134 +// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
  135 + $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
134 }else{ 136 }else{
135 //同时包括白帽版本+默认版本的项目 137 //同时包括白帽版本+默认版本的项目
136 $this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]); 138 $this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]);
@@ -174,10 +176,10 @@ class RemainDay extends Command @@ -174,10 +176,10 @@ class RemainDay extends Command
174 } 176 }
175 } 177 }
176 $extend_type = 0; 178 $extend_type = 0;
177 - if($remain_day < 0 && $deploy_build['service_duration'] != 0){  
178 - $remain_day = 0;  
179 - $extend_type = Project::TYPE_FIVE;  
180 - } 179 +// if($remain_day < 0 && $deploy_build['service_duration'] != 0){
  180 +// $remain_day = 0;
  181 +// $extend_type = Project::TYPE_FIVE;
  182 +// }
181 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); 183 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
182 return true; 184 return true;
183 } 185 }
@@ -52,14 +52,55 @@ class LyhImportTest extends Command @@ -52,14 +52,55 @@ class LyhImportTest extends Command
52 * @time :2023/11/20 15:13 52 * @time :2023/11/20 15:13
53 */ 53 */
54 public function handle(){ 54 public function handle(){
55 - ProjectServer::useProject(2140); 55 + ProjectServer::useProject(3951);
56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
57 - $this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',2140); 57 + $this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',3951);
58 DB::disconnect('custom_mysql'); 58 DB::disconnect('custom_mysql');
59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
60 } 60 }
61 61
62 /** 62 /**
  63 + * @remark :3951项目导入产品
  64 + * @name :import3951Product
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2025/5/24 11:32
  68 + */
  69 + public function import3951Product($url,$project_id){
  70 + $line_of_text = [];
  71 + $opts = [
  72 + 'http' => [
  73 + 'method' => 'GET',
  74 + 'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
  75 + ],
  76 + 'ssl' => [
  77 + 'verify_peer' => false,
  78 + 'verify_peer_name' => false
  79 + ]
  80 + ];
  81 + $file_handle = fopen($url, 'r', null, stream_context_create($opts));
  82 + while (!feof($file_handle)) {
  83 + $line_of_text[] = fgetcsv($file_handle, 0, ',');
  84 + }
  85 + fclose($file_handle);
  86 + $saveData = [];
  87 + foreach ($line_of_text as $k => $val){
  88 + if($k < 1){
  89 + continue;
  90 + }
  91 + if(empty($val[0])){
  92 + echo '跳过的名称:'.$val[0];
  93 + continue;
  94 + }
  95 + $saveData[] = [
  96 + 'title'=>$val[0],
  97 + 'thumb' => json_encode(['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]],true),
  98 + 'gallery' => json_encode([['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]]],true)
  99 + ];
  100 + }
  101 + }
  102 +
  103 + /**
63 * @remark :导入产品分类 104 * @remark :导入产品分类
64 * @name :productCategory 105 * @name :productCategory
65 * @author :lyh 106 * @author :lyh
@@ -15,6 +15,7 @@ use App\Models\Ai\AiBlog; @@ -15,6 +15,7 @@ use App\Models\Ai\AiBlog;
15 use App\Models\Ai\AiBlogAuthor; 15 use App\Models\Ai\AiBlogAuthor;
16 use App\Models\Com\NoticeLog; 16 use App\Models\Com\NoticeLog;
17 use App\Models\Com\V6WeeklyReport; 17 use App\Models\Com\V6WeeklyReport;
  18 +use App\Models\Product\Category;
18 use App\Models\Project\AiBlogTask; 19 use App\Models\Project\AiBlogTask;
19 use App\Models\Project\DeployBuild; 20 use App\Models\Project\DeployBuild;
20 use App\Models\Project\DeployOptimize; 21 use App\Models\Project\DeployOptimize;
@@ -23,6 +24,8 @@ use App\Models\Project\Project; @@ -23,6 +24,8 @@ use App\Models\Project\Project;
23 use App\Models\Project\ProjectAiSetting; 24 use App\Models\Project\ProjectAiSetting;
24 use App\Models\ProjectAssociation\ProjectAssociation; 25 use App\Models\ProjectAssociation\ProjectAssociation;
25 use App\Models\RouteMap\RouteMap; 26 use App\Models\RouteMap\RouteMap;
  27 +use App\Models\Template\BTemplateMain;
  28 +use App\Models\Template\TemplateTypeMain;
26 use App\Models\Visit\Visit; 29 use App\Models\Visit\Visit;
27 use App\Models\WebSetting\WebLanguage; 30 use App\Models\WebSetting\WebLanguage;
28 use App\Models\WebSetting\WebSetting; 31 use App\Models\WebSetting\WebSetting;
@@ -51,9 +54,38 @@ class lyhDemo extends Command @@ -51,9 +54,38 @@ class lyhDemo extends Command
51 protected $description = '更新路由'; 54 protected $description = '更新路由';
52 55
53 public function handle(){ 56 public function handle(){
54 - dd(111); 57 + return true;
  58 + }
  59 +
  60 + public function _actionTemplateMain(){
  61 + $data = [];
  62 + $projectModel = new Project();
  63 + $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
  64 + foreach ($lists as $val){
  65 + echo date('Y-m-d H:i:s') . '开始--项目的id:'. $val['id'] . PHP_EOL;
  66 + ProjectServer::useProject($val['id']);
  67 + $bTemplateMainModel = new BTemplateMain();
  68 + $info = $bTemplateMainModel->read(['type'=>2,'is_list'=>1],['id']);
  69 + $categoryModel = new Category();
  70 + $count = $categoryModel->counts(['id'=>['>',0]]);
  71 + if(($info === false) && ($count > 0)){
  72 + $mainModel = new TemplateTypeMain();
  73 + $mainInfo = $mainModel->read(['type'=>2,'is_list'=>1]);
  74 + $main_html = $mainInfo['main_html'];
  75 + $main_css = "<style id='globalsojs-styles'></style>";
  76 + //写入一条初始数据
  77 + $bTemplateMainModel->addReturnId(['type'=>2,'is_list'=>1,'is_custom'=>0,'project_id'=>$val['id'],'main_html'=>$main_html,'main_css'=>$main_css]);
  78 + $data[] = $val['id'];
  79 + }
  80 + DB::disconnect('custom_mysql');
  81 + echo date('Y-m-d H:i:s') . '结束--项目的id:'. $val['id'] . PHP_EOL;
  82 + }
  83 + dd($data);
  84 + }
  85 +
  86 + public function _action_ai_blog(){
55 $projectModel = new Project(); 87 $projectModel = new Project();
56 - $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']); 88 + $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
57 foreach ($lists as $val) { 89 foreach ($lists as $val) {
58 $aiSettingInfo = $this->getSetting($val['id']); 90 $aiSettingInfo = $this->getSetting($val['id']);
59 if($aiSettingInfo === false){ 91 if($aiSettingInfo === false){
@@ -35,6 +35,7 @@ class UpdateKeyword extends Command @@ -35,6 +35,7 @@ class UpdateKeyword extends Command
35 35
36 36
37 public function handle(){ 37 public function handle(){
  38 + dd(1111);
38 while (true){ 39 while (true){
39 $keywordPageModel = new KeywordPage(); 40 $keywordPageModel = new KeywordPage();
40 $lists = $keywordPageModel->list(['status'=>0]); 41 $lists = $keywordPageModel->list(['status'=>0]);
@@ -74,19 +75,40 @@ class UpdateKeyword extends Command @@ -74,19 +75,40 @@ class UpdateKeyword extends Command
74 return false; 75 return false;
75 } 76 }
76 $number = count($text); 77 $number = count($text);
77 - $randomNumber = rand(0, $number - 1);  
78 if($updateObject['type'] == 0){//更新所有关键字 78 if($updateObject['type'] == 0){//更新所有关键字
79 - $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]); 79 + //获取所有关键字的id
  80 + $idArr = $keywordModel->selectField(['id'=>['>',0]],'id');
  81 + if($info['update_method'] != 1){
  82 + $idArr = shuffle($idArr);
  83 + }
  84 + $result = $this->splitArrayIntoParts($idArr,$number);
  85 + foreach ($result as $key => $val){
  86 + $keywordModel->edit(['keyword_content'=>$text[$key]],['id'=>['in',$val]]);
  87 + }
80 }else{ 88 }else{
81 //按传递的关键字更新 89 //按传递的关键字更新
82 if(!empty($updateObject['keyword'])){ 90 if(!empty($updateObject['keyword'])){
83 $updateObject['keyword'] = (array)$updateObject['keyword']; 91 $updateObject['keyword'] = (array)$updateObject['keyword'];
84 - $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>['in',$updateObject['keyword']]]); 92 + foreach ($updateObject['keyword'] as $key => $item){
  93 + if($info['update_method'] != 1){
  94 + $randomNumber = rand(0, $number - 1);
  95 + }else{
  96 + $randomNumber = $text[$key] ?? rand(0, $number - 1);
  97 + }
  98 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
  99 + }
85 } 100 }
86 //按给定的数量更新 101 //按给定的数量更新
87 if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){ 102 if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){
88 $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray(); 103 $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray();
89 - $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['id'=>['in',$keywordIdArr]]); 104 + foreach ($keywordIdArr as $key => $item){
  105 + if($info['update_method'] != 1){
  106 + $randomNumber = rand(0, $number - 1);
  107 + }else{
  108 + $randomNumber = $text[$key] ?? rand(0, $number - 1);
  109 + }
  110 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
  111 + }
90 } 112 }
91 } 113 }
92 return true; 114 return true;
@@ -108,4 +130,21 @@ class UpdateKeyword extends Command @@ -108,4 +130,21 @@ class UpdateKeyword extends Command
108 return true; 130 return true;
109 } 131 }
110 132
  133 +
  134 + public function splitArrayIntoParts(array $data, int $parts): array
  135 + {
  136 + $count = count($data);
  137 + // 每份的最小长度(向下取整)
  138 + $minSize = intdiv($count, $parts);
  139 + // 余数(说明有一些数组项要平均分配给前面的几份)
  140 + $remainder = $count % $parts;
  141 + $result = [];
  142 + $start = 0;
  143 + for ($i = 0; $i < $parts; $i++) {
  144 + $size = $minSize + ($i < $remainder ? 1 : 0);
  145 + $result[] = array_slice($data, $start, $size);
  146 + $start += $size;
  147 + }
  148 + return $result;
  149 + }
111 } 150 }
1 <?php 1 <?php
2 2
  3 +use App\Helper\Translate;
3 use App\Models\File\Image; 4 use App\Models\File\Image;
4 use App\Models\File\File as FileModel; 5 use App\Models\File\File as FileModel;
5 use App\Models\Project\DeployOptimize; 6 use App\Models\Project\DeployOptimize;
@@ -851,7 +852,7 @@ function getCustomRouteMap($module_route,$route = '') @@ -851,7 +852,7 @@ function getCustomRouteMap($module_route,$route = '')
851 * @method :post 852 * @method :post
852 * @time :2023/11/10 14:29 853 * @time :2023/11/10 14:29
853 */ 854 */
854 -function getRouteMap($source,$source_id,$is_upgrade = 0){ 855 +function getRouteMap($source,$source_id,$is_upgrade = 0, $returnModel = false){
855 $route = ''; 856 $route = '';
856 $routeMapModel = new RouteMap(); 857 $routeMapModel = new RouteMap();
857 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); 858 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]);
@@ -878,6 +879,9 @@ function getRouteMap($source,$source_id,$is_upgrade = 0){ @@ -878,6 +879,9 @@ function getRouteMap($source,$source_id,$is_upgrade = 0){
878 $route = $info['route']; 879 $route = $info['route'];
879 } 880 }
880 } 881 }
  882 + if($returnModel){
  883 + return $info;
  884 + }
881 return $route; 885 return $route;
882 } 886 }
883 887
@@ -1237,4 +1241,115 @@ function getDomain($url) { @@ -1237,4 +1241,115 @@ function getDomain($url) {
1237 } 1241 }
1238 1242
1239 1243
  1244 +/**
  1245 + * 解析url的 route
  1246 + * @param $pathInfo
  1247 + * @return string
  1248 + * @author zbj
  1249 + * @date 2025/5/24
  1250 + */
  1251 +function analysisRoute($pathInfo)
  1252 +{
  1253 + $language = '';
  1254 + $router = "";
  1255 + $page = null;
  1256 +
  1257 + $pathArr = explode("/", $pathInfo);
  1258 + $pathArr = array_filter($pathArr);
  1259 + $first = array_shift($pathArr);
  1260 + $last = array_pop($pathArr);
  1261 + $other = implode("/", $pathArr);
  1262 +
  1263 + $first = $first == "zh-ct" ? "zh-TW" : $first;
  1264 + $tlsLang = array_keys(Translate::$tls_list);
  1265 + if (in_array($first, $tlsLang)) {
  1266 + $language = $first;
  1267 + $first = '';
  1268 + }
  1269 + $lastIsRoute = RouteMap::select("id")->where("route", $last)->first();
  1270 + if (is_numeric($last) && empty($lastIsRoute)) {
  1271 + $page = $last;
  1272 + $last = '';
  1273 + }
  1274 + $router_array = compact('first', 'other', 'last');
  1275 + $router_array = array_filter($router_array);
  1276 +
  1277 + //解析路由5.0 + 6.0
  1278 + $keyword = new \App\Models\Product\Keyword();
  1279 + $topSearchRoute = $keyword->product_keyword_route;
  1280 + if (isset($router_array['first'])) {
  1281 + if (isset($router_array['other'])) {
  1282 + if ($router_array['other'] == "page") {
  1283 + $router = $router_array['first'];
  1284 + } else {
  1285 + $otherArr = explode("/", $router_array['other']);
  1286 + $otherArr = array_filter($otherArr);
  1287 + if (count($otherArr) >= 1) {
  1288 + $router = $otherArr[0];
  1289 + }
  1290 + }
  1291 + } else {
  1292 + if (isset($router_array['last'])) {
  1293 + if (in_array($router_array['first'], $topSearchRoute)) {
  1294 + $router = $router_array['first'];
  1295 + $page = (int)$router_array['last'];
  1296 + } else {
  1297 + $router = $router_array['last'];
  1298 + }
  1299 + } else {
  1300 + $router = $router_array['first'];
  1301 + }
  1302 + }
  1303 + } else {
  1304 + if (isset($router_array['last'])) {
  1305 + if ($router_array['last'] != "page") {
  1306 + if (isset($router_array['other']) && in_array($router_array['other'], $topSearchRoute)) {
  1307 + $router = $router_array['other'];
  1308 + $page = (int)$router_array['last'];
  1309 + } else {
  1310 + $router = $router_array['last'];
  1311 + }
  1312 + } else {
  1313 + $otherArr = explode("/", $router_array['other']);
  1314 + $otherArr = array_filter($otherArr);
  1315 + if (count($otherArr) == 1) {
  1316 + $router = $otherArr[0];
  1317 + } else {
  1318 + $router = $otherArr[1];
  1319 + }
  1320 + }
  1321 + } else {
  1322 + if (!empty($router_array)) {
  1323 + $otherArr = explode("/", $router_array['other']);
  1324 + $otherArr = array_filter($otherArr);
  1325 + if (count($otherArr) == 3) {
  1326 + $router = $otherArr[1];
  1327 + } else {
  1328 + $router = $otherArr[0];
  1329 + }
  1330 + }
  1331 + }
  1332 + }
1240 1333
  1334 + //路由算法处理,路由只有一级,route_map表中route(规定),不考虑小语种
  1335 + //新增考虑小语种,判断是否小语种访问,有页面不说,当nginx 404页面之后进程序,生成当前小语种页面
  1336 + $lang = $language;
  1337 + if ($page == null) {
  1338 + if ($router != null) {
  1339 + if ($lang != null) {
  1340 + $tlsLang = array_keys(Translate::$tls_list);
  1341 + $isLang = in_array($lang, $tlsLang);
  1342 + if (!$isLang) {
  1343 + $router = $lang;
  1344 + }
  1345 + }
  1346 + } else {
  1347 + $tlsLang = array_keys(Translate::$tls_list);
  1348 + $isLang = in_array($lang, $tlsLang);
  1349 + if (!$isLang) {
  1350 + $router = $lang;
  1351 + }
  1352 + }
  1353 + }
  1354 + return $router;
  1355 +}
@@ -23,6 +23,7 @@ use App\Models\Project\DeployBuild; @@ -23,6 +23,7 @@ use App\Models\Project\DeployBuild;
23 use App\Models\Project\DeployOptimize; 23 use App\Models\Project\DeployOptimize;
24 use App\Models\Project\OnlineCheck; 24 use App\Models\Project\OnlineCheck;
25 use App\Models\Project\Project; 25 use App\Models\Project\Project;
  26 +use App\Models\Project\ProjectAiSetting;
26 use App\Models\Project\ProjectKeyword; 27 use App\Models\Project\ProjectKeyword;
27 use App\Models\RouteMap\RouteMap; 28 use App\Models\RouteMap\RouteMap;
28 use App\Models\User\User; 29 use App\Models\User\User;
@@ -538,4 +539,21 @@ class PrivateController extends BaseController @@ -538,4 +539,21 @@ class PrivateController extends BaseController
538 ]; 539 ];
539 return $this->success($result); 540 return $this->success($result);
540 } 541 }
  542 +
  543 + /**
  544 + * 获取项目信息,通过商户号
  545 + * @param Request $request
  546 + * @return false|string
  547 + */
  548 + public function getProjectByMchId(Request $request)
  549 + {
  550 + $mch_id = intval($request->input('mch_id'));
  551 + $project_setting = ProjectAiSetting::where(['mch_id' => $mch_id])->first();
  552 + if (empty($project_setting))
  553 + return $this->error('商户号未匹配到项目');
  554 + $domain = DomainInfo::where(['status' => 1, 'project_id' => $project_setting->project_id])->first();
  555 + if (empty($domain))
  556 + return $this->error('项目未匹配到域名');
  557 + return $this->success(['domain' => $domain->domain]);
  558 + }
541 } 559 }
@@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Optimize; @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Optimize;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
  14 +use App\Models\Project\OptimizeCheckList;
14 use App\Models\Project\OptimizeCheckLog; 15 use App\Models\Project\OptimizeCheckLog;
15 use Illuminate\Http\Request; 16 use Illuminate\Http\Request;
16 17
@@ -44,6 +45,7 @@ class CheckLogController extends BaseController @@ -44,6 +45,7 @@ class CheckLogController extends BaseController
44 ]); 45 ]);
45 $field = ['id','check_id','date','status','images','result','created_at']; 46 $field = ['id','check_id','date','status','images','result','created_at'];
46 $this->map['status'] = 1; 47 $this->map['status'] = 1;
  48 + $this->map['type'] = $this->map['type'] ?? 1;
47 $lists = $this->model->lists($this->map,$this->page,$this->row,'id',$field); 49 $lists = $this->model->lists($this->map,$this->page,$this->row,'id',$field);
48 $this->response('success',Code::SUCCESS,$lists); 50 $this->response('success',Code::SUCCESS,$lists);
49 } 51 }
@@ -80,6 +82,11 @@ class CheckLogController extends BaseController @@ -80,6 +82,11 @@ class CheckLogController extends BaseController
80 'project_id.required' => 'project_id不能为空', 'check_id.required' => '问题id不能为空', 82 'project_id.required' => 'project_id不能为空', 'check_id.required' => '问题id不能为空',
81 'date.required' => '时间不能为空', 'result.required' => '检查结果不能为空', 83 'date.required' => '时间不能为空', 'result.required' => '检查结果不能为空',
82 ]); 84 ]);
  85 + $checkListModel = new OptimizeCheckList();
  86 + $listInfo = $checkListModel->read(['id'=>$this->param['check_id']],['id','type']);
  87 + if($listInfo !== false){
  88 + $this->param['type'] = $listInfo['type'];
  89 + }
83 $this->param = $this->model->saveHandleParam($this->param,$this->manage['id']); 90 $this->param = $this->model->saveHandleParam($this->param,$this->manage['id']);
84 if(isset($this->param['id']) && !empty($this->param['id'])){ 91 if(isset($this->param['id']) && !empty($this->param['id'])){
85 $id = $this->param['id']; 92 $id = $this->param['id'];
@@ -195,6 +195,7 @@ class OptimizeController extends BaseController @@ -195,6 +195,7 @@ class OptimizeController extends BaseController
195 'gl_project.remain_day AS remain_day', 195 'gl_project.remain_day AS remain_day',
196 'gl_project.seo_remain_day AS seo_remain_day', 196 'gl_project.seo_remain_day AS seo_remain_day',
197 'gl_project.robots AS robots', 197 'gl_project.robots AS robots',
  198 + 'gl_project.is_analysis AS is_analysis',
198 'gl_project.is_minor_languages AS is_minor_languages', 199 'gl_project.is_minor_languages AS is_minor_languages',
199 'gl_project.is_translate AS is_translate', 200 'gl_project.is_translate AS is_translate',
200 'gl_project.is_translate_tag AS is_translate_tag', 201 'gl_project.is_translate_tag AS is_translate_tag',
@@ -593,5 +594,23 @@ class OptimizeController extends BaseController @@ -593,5 +594,23 @@ class OptimizeController extends BaseController
593 $this->response('success',Code::SUCCESS,$resultData); 594 $this->response('success',Code::SUCCESS,$resultData);
594 } 595 }
595 596
596 - 597 + /**
  598 + * @remark :是否开启泛解析
  599 + * @name :saveIsAnalysis
  600 + * @author :lyh
  601 + * @method :post
  602 + * @time :2025/5/24 14:48
  603 + */
  604 + public function saveIsAnalysis(){
  605 + $this->request->validate([
  606 + 'id' => 'required',
  607 + 'is_analysis' => 'required',
  608 + ], [
  609 + 'id.required' => '项目id不能为空',
  610 + 'is_analysis.required' => 'is_analysis不能为空',
  611 + ]);
  612 + $projectModel = new Project();
  613 + $data = $projectModel->edit(['is_analysis'=>$this->param['is_analysis']],['id'=>$this->param['id']]);
  614 + $this->response('success',Code::SUCCESS,$data);
  615 + }
597 } 616 }
@@ -16,6 +16,7 @@ use App\Models\ASide\APublicModel; @@ -16,6 +16,7 @@ use App\Models\ASide\APublicModel;
16 use App\Models\Channel\Channel; 16 use App\Models\Channel\Channel;
17 use App\Models\Domain\DomainInfo; 17 use App\Models\Domain\DomainInfo;
18 use App\Models\Manage\Manage; 18 use App\Models\Manage\Manage;
  19 +use App\Models\Manage\ManageHr;
19 use App\Models\Project\Project; 20 use App\Models\Project\Project;
20 use App\Models\Project\ProjectRenew; 21 use App\Models\Project\ProjectRenew;
21 use App\Models\Task\Task; 22 use App\Models\Task\Task;
@@ -36,7 +37,7 @@ class RenewProjectController extends BaseController @@ -36,7 +37,7 @@ class RenewProjectController extends BaseController
36 ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page); 37 ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
37 if(!empty($lists)){ 38 if(!empty($lists)){
38 $lists = $lists->toArray(); 39 $lists = $lists->toArray();
39 - $manageModel = new Manage(); 40 + $manageModel = new ManageHr();
40 $domainModel = new DomainInfo(); 41 $domainModel = new DomainInfo();
41 foreach ($lists['list'] as $k=>$item){ 42 foreach ($lists['list'] as $k=>$item){
42 $item = $this->handleParam($item,$manageModel,$domainModel); 43 $item = $this->handleParam($item,$manageModel,$domainModel);
@@ -122,7 +123,7 @@ class RenewProjectController extends BaseController @@ -122,7 +123,7 @@ class RenewProjectController extends BaseController
122 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); 123 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page);
123 if(!empty($lists)){ 124 if(!empty($lists)){
124 $lists = $lists->toArray(); 125 $lists = $lists->toArray();
125 - $manageModel = new Manage(); 126 + $manageModel = new ManageHr();
126 $domainModel = new DomainInfo(); 127 $domainModel = new DomainInfo();
127 foreach ($lists['list'] as $k=>$item){ 128 foreach ($lists['list'] as $k=>$item){
128 $item = $this->handleParam($item,$manageModel,$domainModel); 129 $item = $this->handleParam($item,$manageModel,$domainModel);
@@ -215,9 +215,9 @@ class CNoticeController extends BaseController @@ -215,9 +215,9 @@ class CNoticeController extends BaseController
215 $project_id = $this->user['project_id']; 215 $project_id = $this->user['project_id'];
216 $type = intval($request->input('type', 1)); 216 $type = intval($request->input('type', 1));
217 $route = intval($request->input('page', 1)); 217 $route = intval($request->input('page', 1));
218 - if(($this->user['is_upgrade'] == 0) && ($type == 2) && in_array($route,[4,6])){  
219 - $this->fail('聚合页翻译请联系管理员');  
220 - } 218 +// if(($this->user['is_upgrade'] == 0) && ($type == 2) && in_array($route,[4,6])){
  219 +// $this->fail('聚合页翻译请联系管理员');
  220 +// }
221 $url = $request->input('url', []); 221 $url = $request->input('url', []);
222 $language = $request->input('language', []); 222 $language = $request->input('language', []);
223 $is_sitemap = intval($request->input('is_sitemap', 0)); 223 $is_sitemap = intval($request->input('is_sitemap', 0));
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:05
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\News;
  11 +
  12 +use App\Http\Controllers\Bside\BaseController;
  13 +use App\Http\Logic\Bside\News\NewsExtendLogic;
  14 +use App\Models\News\NewsExtend;
  15 +use Illuminate\Http\Request;
  16 +
  17 +class NewsExtendController extends BaseController
  18 +{
  19 + public function __construct(Request $request)
  20 + {
  21 + parent::__construct($request);
  22 + $this->logic = new NewsExtendLogic();
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取所有扩展字段
  27 + * @name :lists
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/26 15:08
  31 + */
  32 + public function lists()
  33 + {
  34 + $lists = $this->logic->list($this->map);
  35 + $this->response('success', Code::SUCCESS, $lists);
  36 + }
  37 +
  38 + /**
  39 + * @remark :保存扩展字段
  40 + * @name :save
  41 + * @author :lyh
  42 + * @method :post
  43 + * @time :2025/5/26 15:09
  44 + */
  45 + public function save()
  46 + {
  47 + $this->request->validate([
  48 + 'title' => 'required',
  49 + 'type' => 'required',
  50 + ], [
  51 + 'title.required' => '字段名称不能为空',
  52 + 'type.required' => '字段类型不能为空',
  53 + ]);
  54 + $data = $this->logic->extendSave();
  55 + $this->response('success', Code::SUCCESS, $data);
  56 + }
  57 +
  58 + /**
  59 + * @remark :删除扩展字段
  60 + * @name :del
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2025/5/26 15:43
  64 + */
  65 + public function del(){
  66 + $this->request->validate([
  67 + 'id' => 'required',
  68 + ], [
  69 + 'id.required' => '主键不能为空',
  70 + ]);
  71 + $data = $this->logic->extendDel();
  72 + $this->response('success', Code::SUCCESS, $data);
  73 + }
  74 +}
@@ -61,7 +61,9 @@ class ProductController extends BaseController @@ -61,7 +61,9 @@ class ProductController extends BaseController
61 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id 61 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
62 $userModel = new User(); 62 $userModel = new User();
63 foreach ($lists['list'] as $k=>$v){ 63 foreach ($lists['list'] as $k=>$v){
64 - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); 64 + $route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
  65 + $v['url'] = $this->user['domain'] . $route['route'];
  66 + $v['pv'] = $route['pv'];
65 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 67 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
66 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 68 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
67 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 69 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
@@ -97,7 +99,9 @@ class ProductController extends BaseController @@ -97,7 +99,9 @@ class ProductController extends BaseController
97 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id 99 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
98 $userModel = new User(); 100 $userModel = new User();
99 foreach ($lists['list'] as $k=>$v){ 101 foreach ($lists['list'] as $k=>$v){
100 - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); 102 + $route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
  103 + $v['url'] = $this->user['domain'] . $route['route'];
  104 + $v['pv'] = $route['pv'];
101 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 105 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
102 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 106 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
103 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 107 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
@@ -471,7 +471,7 @@ class ProjectLogic extends BaseLogic @@ -471,7 +471,7 @@ class ProjectLogic extends BaseLogic
471 } 471 }
472 $param['upload_config'] = json_encode($param['upload_config'] ?? []); 472 $param['upload_config'] = json_encode($param['upload_config'] ?? []);
473 $param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []); 473 $param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []);
474 - unset($param['robots']);//项目不保存robots 474 + unset($param['robots'],$param['is_analysis']);//项目不保存robots
475 $this->model->edit($param,['id'=>$param['id']]); 475 $this->model->edit($param,['id'=>$param['id']]);
476 Common::del_user_cache($this->model->getTable(),$param['id']); 476 Common::del_user_cache($this->model->getTable(),$param['id']);
477 return $this->success(); 477 return $this->success();
@@ -92,6 +92,8 @@ class AiBlogLogic extends BaseLogic @@ -92,6 +92,8 @@ class AiBlogLogic extends BaseLogic
92 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 92 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
93 $aiBlogService->key = $aiSettingInfo['key']; 93 $aiBlogService->key = $aiSettingInfo['key'];
94 $aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'route'=>$this->param['route'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]); 94 $aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'route'=>$this->param['route'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]);
  95 + $aiBlogTask = new AiBlogTask();
  96 + $aiBlogTask->addReturnId(['type'=>$aiBlogTask::TYPE_AUTHOR_ID,'task_id'=>$this->param['author_id'],'status'=>1,'project_id'=>$this->user['project_id']]);
95 }catch (\Exception $e){ 97 }catch (\Exception $e){
96 $this->fail('保存失败,请联系管理员'); 98 $this->fail('保存失败,请联系管理员');
97 } 99 }
@@ -52,7 +52,7 @@ class CustomTemplateLogic extends BaseLogic @@ -52,7 +52,7 @@ class CustomTemplateLogic extends BaseLogic
52 $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); 52 $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
53 if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ 53 if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
54 $template_id = $this->getTemplateId(); 54 $template_id = $this->getTemplateId();
55 - $html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id); 55 + $html = $this->getTemplateComHtml(empty($info['html']) ? $info['text'] : $info['html'],$info['html_style'],$template_id);
56 $info['html'] = $this->getHeadFooter($html); 56 $info['html'] = $this->getHeadFooter($html);
57 } 57 }
58 return $this->success($info); 58 return $this->success($info);
@@ -555,6 +555,7 @@ class CustomTemplateLogic extends BaseLogic @@ -555,6 +555,7 @@ class CustomTemplateLogic extends BaseLogic
555 'is_visualization' => $info['is_visualization'], 555 'is_visualization' => $info['is_visualization'],
556 'created_at' => date('Y-m-d H:i:s'), 556 'created_at' => date('Y-m-d H:i:s'),
557 'updated_at' => date('Y-m-d H:i:s'), 557 'updated_at' => date('Y-m-d H:i:s'),
  558 + 'text'=>$info['text'] ?? '',
558 ]; 559 ];
559 } 560 }
560 } 561 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:11
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\News;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\News\NewsExtend;
  14 +use App\Models\Product\ExtendInfo;
  15 +
  16 +class NewsExtendLogic extends BaseLogic
  17 +{
  18 + public function __construct()
  19 + {
  20 + parent::__construct();
  21 + $this->model = new NewsExtend();
  22 + $this->param = $this->requestAll;
  23 + }
  24 +
  25 + /**
  26 + * @remark :列表页
  27 + * @name :list
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/26 15:17
  31 + */
  32 + public function list($map){
  33 + $data = $this->model->list($map);
  34 + return $this->success($data);
  35 + }
  36 +
  37 + /**
  38 + * @remark :保存扩展字段
  39 + * @name :extendSave
  40 + * @author :lyh
  41 + * @method :post
  42 + * @time :2025/5/26 15:13
  43 + * @param :id->主键;title->名称
  44 + */
  45 + public function extendSave(){
  46 + if(isset($this->param['id']) && !empty($this->param['id'])){
  47 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  48 + }else{
  49 + $info = $this->model->read(['title'=>$this->param['title']]);
  50 + if($info !== false){
  51 + $this->fail('当前扩展名称已存在');
  52 + }
  53 + $this->param['key'] = $this->model->getKey();
  54 + $this->param['project_id'] = $this->user['project_id'];
  55 + $rs = $this->model->add($this->param);
  56 + }
  57 + if($rs === false){
  58 + $this->fail('error');
  59 + }
  60 + return $this->success($this->param);
  61 + }
  62 +
  63 + /**
  64 + * @remark :删除字段
  65 + * @name :extendDel
  66 + * @author :lyh
  67 + * @method :post
  68 + * @time :2025/5/26 15:45
  69 + * @param :id->主键
  70 + */
  71 + public function extendDel(){
  72 + $info = $this->model->read(['id'=>$this->param['id']]);
  73 + //查看当前扩展字段是否设置了值
  74 + $extendInfoModel = new ExtendInfo();
  75 + $extendInfo = $extendInfoModel->read(['key'=>$info['key']]);
  76 + if($extendInfo !== false){
  77 + $this->fail('当前扩展字段已有产品在使用,不允许删除');
  78 + }
  79 + $this->model->del(['id'=>$this->param['id']]);
  80 + }
  81 +
  82 +}
@@ -489,14 +489,10 @@ class ProductLogic extends BaseLogic @@ -489,14 +489,10 @@ class ProductLogic extends BaseLogic
489 foreach ($data as $k => $v){ 489 foreach ($data as $k => $v){
490 $map = []; 490 $map = [];
491 $cateModel = new Category(); 491 $cateModel = new Category();
492 - $status = [];  
493 - if($v != 3){  
494 - $status = ['status'=>$v];  
495 - }  
496 - $cateList = $cateModel->list($status,'id',['id','pid']); 492 + $cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
497 $this->param['featured_status'] = $this->param['featured_status'] ?? 0; 493 $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
498 if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){ 494 if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
499 - $featured_ids = $cateModel->where('title', 'Featured')->pluck('id')->toArray(); 495 + $featured_ids = $cateModel->formatQuery(['title'=>['in',['Featured','featured']]])->pluck('id')->toArray();
500 //获取当前的子集 496 //获取当前的子集
501 $featured_arr = []; 497 $featured_arr = [];
502 foreach ($featured_ids as $id){ 498 foreach ($featured_ids as $id){
@@ -549,7 +549,7 @@ class RankDataLogic extends BaseLogic @@ -549,7 +549,7 @@ class RankDataLogic extends BaseLogic
549 $without_extension_project_ids = [658]; //是否达标只统计主词的 549 $without_extension_project_ids = [658]; //是否达标只统计主词的
550 $extension_project_ids = [354]; //扩展词也到达标的 550 $extension_project_ids = [354]; //扩展词也到达标的
551 $compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的 551 $compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的
552 - $ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250];//暂停的项目 552 + $ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193];//暂停的项目
553 $uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目 553 $uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
554 //一个项目多个api_no 554 //一个项目多个api_no
555 $multiple_api_no_project_ids = [ 555 $multiple_api_no_project_ids = [
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :AiBlogAuthor.php 4 + * @name :AiBlogAuthorId.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2025/2/21 10:59 7 * @time :2025/2/21 10:59
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtend.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:08
  8 + */
  9 +
  10 +namespace App\Models\News;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class NewsExtend extends Base
  15 +{
  16 + protected $table = 'gl_news_extend';
  17 + protected $connection = 'custom_mysql';
  18 +
  19 + const EXTEND_KEY = 'pd_extended_field_';
  20 +
  21 + /**
  22 + * @remark :添加扩展字段
  23 + * @name :getKey
  24 + * @author :lyh
  25 + * @method :post
  26 + * @time :2025/5/26 15:39
  27 + */
  28 + public function getKey($key = self::EXTEND_KEY,$i = 1){
  29 + $info = $this->model->read(['key'=>$key.$i]);
  30 + if($info !== false){
  31 + return $this->getKey($key,$i+1);
  32 + }else{
  33 + return $key.$i;
  34 + }
  35 + }
  36 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendInfo.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:49
  8 + */
  9 +
  10 +namespace App\Models\News;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class NewsExtendInfo extends Base
  15 +{
  16 + protected $table = 'gl_news_extend_info';
  17 + protected $connection = 'custom_mysql';
  18 +}
@@ -197,4 +197,35 @@ class Keyword extends Base @@ -197,4 +197,35 @@ class Keyword extends Base
197 $string_key = array_search($first_title, $this->firstNumWord); 197 $string_key = array_search($first_title, $this->firstNumWord);
198 return $string_key ?: 27; 198 return $string_key ?: 27;
199 } 199 }
  200 +
  201 + public $product_keyword_route = [
  202 + "top-search",
  203 + "top-search-a",
  204 + "top-search-b",
  205 + "top-search-c",
  206 + "top-search-d",
  207 + "top-search-e",
  208 + "top-search-f",
  209 + "top-search-g",
  210 + "top-search-h",
  211 + "top-search-i",
  212 + "top-search-j",
  213 + "top-search-k",
  214 + "top-search-l",
  215 + "top-search-m",
  216 + "top-search-n",
  217 + "top-search-o",
  218 + "top-search-p",
  219 + "top-search-q",
  220 + "top-search-r",
  221 + "top-search-s",
  222 + "top-search-t",
  223 + "top-search-u",
  224 + "top-search-v",
  225 + "top-search-w",
  226 + "top-search-x",
  227 + "top-search-y",
  228 + "top-search-z",
  229 + "top-search-0",
  230 + ];
200 } 231 }
@@ -26,5 +26,5 @@ class AiBlogTask extends Base @@ -26,5 +26,5 @@ class AiBlogTask extends Base
26 */ 26 */
27 const TYPE_AUTHOR = 1; 27 const TYPE_AUTHOR = 1;
28 const TYPE_BLOG = 2; 28 const TYPE_BLOG = 2;
29 - const TYPE_VIDEO = 3; 29 + const TYPE_AUTHOR_ID = 3;//根据对应id页面
30 } 30 }
@@ -9,10 +9,12 @@ use App\Models\Domain\CountryCode; @@ -9,10 +9,12 @@ use App\Models\Domain\CountryCode;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
10 use App\Models\Inquiry\InquiryForm; 10 use App\Models\Inquiry\InquiryForm;
11 use App\Models\Inquiry\InquiryFormData; 11 use App\Models\Inquiry\InquiryFormData;
  12 +use App\Models\Inquiry\InquiryRelateDomain;
12 use App\Models\Project\AutoEmail; 13 use App\Models\Project\AutoEmail;
13 use App\Models\Project\AutoEmailLog; 14 use App\Models\Project\AutoEmailLog;
14 use App\Models\Project\InquiryFilterConfig; 15 use App\Models\Project\InquiryFilterConfig;
15 use App\Models\Project\Project; 16 use App\Models\Project\Project;
  17 +use App\Models\RouteMap\RouteMap;
16 use App\Models\Subscribe\Email; 18 use App\Models\Subscribe\Email;
17 use App\Models\SyncSubmitTask\SyncSubmitTask; 19 use App\Models\SyncSubmitTask\SyncSubmitTask;
18 use App\Models\Visit\Visit; 20 use App\Models\Visit\Visit;
@@ -20,6 +22,7 @@ use App\Models\WebSetting\WebLanguage; @@ -20,6 +22,7 @@ use App\Models\WebSetting\WebLanguage;
20 use App\Models\Workchat\MessagePush; 22 use App\Models\Workchat\MessagePush;
21 use App\Utils\LogUtils; 23 use App\Utils\LogUtils;
22 use Illuminate\Support\Facades\Cache; 24 use Illuminate\Support\Facades\Cache;
  25 +use Illuminate\Support\Facades\DB;
23 use Illuminate\Support\Facades\Http; 26 use Illuminate\Support\Facades\Http;
24 use Illuminate\Support\Facades\Log; 27 use Illuminate\Support\Facades\Log;
25 use Illuminate\Support\Facades\URL; 28 use Illuminate\Support\Facades\URL;
@@ -337,6 +340,20 @@ class SyncSubmitTaskService @@ -337,6 +340,20 @@ class SyncSubmitTaskService
337 } 340 }
338 Visit::saveData($visit_data, $visit_data['updated_date']); 341 Visit::saveData($visit_data, $visit_data['updated_date']);
339 342
  343 + //pv
  344 + try {
  345 + $url_path = trim(parse_url($visit_data['url'], PHP_URL_PATH), '/');
  346 + if($url_path){
  347 + $route = analysisRoute($url_path);
  348 + $row = RouteMap::where('route', $route)->increment('pv');
  349 + if(!$row){
  350 + Log::channel('visit')->info('route not found:' . $visit_data['url'] );
  351 + }
  352 + }
  353 + }catch (\Exception $e){
  354 + Log::channel('visit')->info('pv inc error:' . $visit_data['url'], [$e->getMessage(), $e->getFile(), $e->getLine()]);
  355 + }
  356 +
340 return true; 357 return true;
341 } 358 }
342 359
@@ -383,7 +400,15 @@ class SyncSubmitTaskService @@ -383,7 +400,15 @@ class SyncSubmitTaskService
383 public static function checkIpCountry($domain, $ip, $type){ 400 public static function checkIpCountry($domain, $ip, $type){
384 $project = Project::getProjectByDomain($domain); 401 $project = Project::getProjectByDomain($domain);
385 if(empty($project)){ 402 if(empty($project)){
386 - throw new InquiryFilterException('项目不存在'); 403 + //是否有关联的域名
  404 + $relate_domain = InquiryRelateDomain::getRelateDomain($domain);
  405 + if(!$relate_domain){
  406 + throw new InquiryFilterException('项目不存在1');
  407 + }
  408 + $project = Project::getProjectByDomain($relate_domain);
  409 + if(!$project){
  410 + throw new InquiryFilterException('项目不存在2');
  411 + }
387 } 412 }
388 413
389 // 访问记录过滤测试环境 414 // 访问记录过滤测试环境
@@ -191,6 +191,12 @@ return [ @@ -191,6 +191,12 @@ return [
191 'level' => 'debug', 191 'level' => 'debug',
192 'days' => 14, 192 'days' => 14,
193 ], 193 ],
  194 + 'visit' => [
  195 + 'driver' => 'daily',
  196 + 'path' => storage_path('logs/visit/laravel.log'),
  197 + 'level' => 'debug',
  198 + 'days' => 14,
  199 + ],
194 'ai_blog' => [ 200 'ai_blog' => [
195 'driver' => 'daily', 201 'driver' => 'daily',
196 'path' => storage_path('logs/ai_blog/laravel.log'), 202 'path' => storage_path('logs/ai_blog/laravel.log'),
@@ -73,3 +73,6 @@ Route::any('/addRedirect',[\App\Http\Controllers\Api\NoticeController::class,'ad @@ -73,3 +73,6 @@ Route::any('/addRedirect',[\App\Http\Controllers\Api\NoticeController::class,'ad
73 Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateController::class, 'inquiry_relate_domain']); 73 Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateController::class, 'inquiry_relate_domain']);
74 // 通过域名获取项目人员配置 74 // 通过域名获取项目人员配置
75 Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']); 75 Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']);
  76 +
  77 +// 获取信息通过商户号
  78 +Route::any('/get_project_by_mch_id', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectByMchId']);
@@ -307,7 +307,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -307,7 +307,7 @@ Route::middleware(['aloginauth'])->group(function () {
307 Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关 307 Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关
308 Route::any('/getAfterCount', [Aside\Optimize\AfterCountController::class, 'getAfterCount'])->name('admin.optimize_getAfterCount');//售后统计数据 308 Route::any('/getAfterCount', [Aside\Optimize\AfterCountController::class, 'getAfterCount'])->name('admin.optimize_getAfterCount');//售后统计数据
309 Route::any('/getAfterCountInfo', [Aside\Optimize\AfterCountController::class, 'getAfterCountInfo'])->name('admin.optimize_getAfterCountInfo');//售后统计数据详情 309 Route::any('/getAfterCountInfo', [Aside\Optimize\AfterCountController::class, 'getAfterCountInfo'])->name('admin.optimize_getAfterCountInfo');//售后统计数据详情
310 - 310 + Route::any('/saveIsAnalysis', [Aside\Optimize\OptimizeController::class, 'saveIsAnalysis'])->name('admin.optimize_saveIsAnalysis');//优化中台开启与关闭泛解析
311 //检查列表 311 //检查列表
312 Route::prefix('check_list')->group(function () { 312 Route::prefix('check_list')->group(function () {
313 Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists'); 313 Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists');
@@ -353,12 +353,6 @@ Route::middleware(['aloginauth'])->group(function () { @@ -353,12 +353,6 @@ Route::middleware(['aloginauth'])->group(function () {
353 Route::any('/save', [Aside\Optimize\ProjectGscController::class, 'save'])->name('admin.gsc_save'); 353 Route::any('/save', [Aside\Optimize\ProjectGscController::class, 'save'])->name('admin.gsc_save');
354 Route::any('/del', [Aside\Optimize\ProjectGscController::class, 'del'])->name('admin.gsc_del'); 354 Route::any('/del', [Aside\Optimize\ProjectGscController::class, 'del'])->name('admin.gsc_del');
355 }); 355 });
356 - //上线审核  
357 - Route::prefix('process')->group(function () {  
358 - Route::any('/', [Aside\Optimize\ProcessController::class, 'lists'])->name('admin.process_lists');  
359 - Route::any('/save', [Aside\Optimize\ProcessController::class, 'save'])->name('admin.process_save');  
360 - });  
361 -  
362 //询盘 356 //询盘
363 Route::prefix('inquiry')->group(function () { 357 Route::prefix('inquiry')->group(function () {
364 Route::any('/', [Aside\Optimize\InquiryInfoController::class, 'lists'])->name('admin.inquiry_lists'); 358 Route::any('/', [Aside\Optimize\InquiryInfoController::class, 'lists'])->name('admin.inquiry_lists');
@@ -516,11 +516,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -516,11 +516,6 @@ Route::middleware(['bloginauth'])->group(function () {
516 Route::any('/getKeyword', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getKeyword'])->name('month_getKeyword'); 516 Route::any('/getKeyword', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getKeyword'])->name('month_getKeyword');
517 }); 517 });
518 518
519 - //更新tdk  
520 - Route::prefix('tdk')->group(function () {  
521 - Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk');  
522 - });  
523 -  
524 //导入任务 519 //导入任务
525 Route::prefix('import')->group(function () { 520 Route::prefix('import')->group(function () {
526 Route::any('/add_task', [\App\Http\Controllers\Bside\Import\ImportController::class, 'save'])->name('import_add_task'); 521 Route::any('/add_task', [\App\Http\Controllers\Bside\Import\ImportController::class, 'save'])->name('import_add_task');