作者 lyh

gx

@@ -78,14 +78,11 @@ class RemainDay extends Command @@ -78,14 +78,11 @@ class RemainDay extends Command
78 continue; 78 continue;
79 } 79 }
80 $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime); 80 $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime);
81 - $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24)); 81 + $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24));
82 }else{ 82 }else{
83 if($item['type'] == Project::TYPE_TWO){ 83 if($item['type'] == Project::TYPE_TWO){
84 $compliance_day = ($item->finish_remain_day ?? 0); 84 $compliance_day = ($item->finish_remain_day ?? 0);
85 - if($item->finish_remain_day < $item->pause_days){  
86 - $item->pause_days = $item->finish_remain_day;  
87 - }  
88 - $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - $compliance_day; 85 + $remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
89 }else{ 86 }else{
90 if($item->uptime){ 87 if($item->uptime){
91 $diff = time() - strtotime($item->uptime); 88 $diff = time() - strtotime($item->uptime);
@@ -9,6 +9,7 @@ namespace App\Console\Commands\Test; @@ -9,6 +9,7 @@ namespace App\Console\Commands\Test;
9 9
10 10
11 use App\Helper\Arr; 11 use App\Helper\Arr;
  12 +use App\Helper\Translate;
12 use App\Models\Blog\Blog; 13 use App\Models\Blog\Blog;
13 use App\Models\Blog\BlogCategory; 14 use App\Models\Blog\BlogCategory;
14 use App\Models\Com\KeywordVideoTask; 15 use App\Models\Com\KeywordVideoTask;
@@ -58,33 +59,6 @@ class Demo extends Command @@ -58,33 +59,6 @@ class Demo extends Command
58 */ 59 */
59 protected $description = 'demo'; 60 protected $description = 'demo';
60 61
61 - public static $main404Html = '<main>  
62 - <section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"  
63 - id="sectionIdyxqu938">  
64 - <div class="layout" data-unable="demo01-error404">  
65 - <img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />  
66 - </div>  
67 - <p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>  
68 - <style>  
69 - .section-block-error404 .layout {  
70 - height: 700px;  
71 - display: flex;  
72 - align-items: center;  
73 - justify-content: center;  
74 - }  
75 - .section-block-error404 img {  
76 - width: 400px;  
77 - }  
78 - @media only screen and (max-width:500) {  
79 - .section-block-error404 img {  
80 - max-width: 100%;  
81 - }  
82 - }  
83 - </style>  
84 - <script>  
85 - </script>  
86 - </section>  
87 - </main>';  
88 public function handle(){ 62 public function handle(){
89 $projectModel = new Project(); 63 $projectModel = new Project();
90 $list = $projectModel->list(['is_upgrade'=>1]); 64 $list = $projectModel->list(['is_upgrade'=>1]);
@@ -97,26 +71,33 @@ class Demo extends Command @@ -97,26 +71,33 @@ class Demo extends Command
97 } 71 }
98 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 72 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
99 } 73 }
100 - public static function init404Page($project_id){  
101 - $time = date('Y-m-d H:i:s');  
102 - $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->where('url',BCustomTemplate::NOT_FOUND_PAGE_URL)->first();  
103 - if(empty($info)) {  
104 - $data = [  
105 - 'project_id' => $project_id,  
106 - 'name' => BCustomTemplate::NOT_FOUND_PAGE_URL,  
107 - 'status' => 1,  
108 - 'url' => BCustomTemplate::NOT_FOUND_PAGE_URL,  
109 - 'html' => self::$main404Html,  
110 - 'html_style' => '<style id="globalsojs-styles"></style>',  
111 - 'title' => '404-Page not found',  
112 - 'description' => 'Sorry. The page has either moved or cannot be found.',  
113 - 'created_at' => $time, 'updated_at' => $time];  
114 - $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);  
115 - //路由  
116 - $info = DB::connection('custom_mysql')->table('gl_route_map')->first();  
117 - if(empty($info)) {  
118 - $data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'created_at' => $time, 'updated_at' => $time];  
119 - DB::connection('custom_mysql')->table('gl_route_map')->insert($data); 74 +
  75 + public function getProduct(){
  76 + $productModel = new Product();
  77 + $lists = $productModel->list(['status'=>['!=',2]]);
  78 + if(!empty($lists)){
  79 + foreach ($lists as $v){
  80 + if(!empty($v['route'])){
  81 + $tag = "-product";
  82 + if (!(substr($v['route'], -strlen($tag)) === $tag)) {
  83 + echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;
  84 + $route = $v['route'].$tag;
  85 + // 如果不是以 '-product' 结尾,则拼接上 '-product'
  86 + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
  87 + $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  88 + }else{
  89 + echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
  90 + $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
  91 + $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  92 + }
  93 + continue;
  94 + }else{
  95 + echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
  96 + $v['title'] = Translate::tran($v['title'], 'en');
  97 + $v['title'] = str_replace('.','',$v['title']).'-product';
  98 + $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
  99 + $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  100 + }
120 } 101 }
121 } 102 }
122 } 103 }
@@ -447,7 +447,10 @@ class RankDataLogic extends BaseLogic @@ -447,7 +447,10 @@ class RankDataLogic extends BaseLogic
447 $without_project_ids = []; //不用处理排名的项目 447 $without_project_ids = []; //不用处理排名的项目
448 $without_extension_project_ids = [658]; //是否达标只统计主词的 448 $without_extension_project_ids = [658]; //是否达标只统计主词的
449 $extension_project_ids = [354]; //扩展词也到达标的 449 $extension_project_ids = [354]; //扩展词也到达标的
450 - 450 + $ceaseProjectId = [
  451 + 354,
  452 + 1283
  453 + ];//暂停项目id
451 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0; 454 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
452 $first_page_without_extension_num = 0; //不算扩展词在首页的数量 455 $first_page_without_extension_num = 0; //不算扩展词在首页的数量
453 $first_page_extension_num = 0; //扩展词在首页的数量 456 $first_page_extension_num = 0; //扩展词在首页的数量
@@ -516,8 +519,13 @@ class RankDataLogic extends BaseLogic @@ -516,8 +519,13 @@ class RankDataLogic extends BaseLogic
516 //项目表更新 519 //项目表更新
517 if (($model->updated_date != date('Y-m-d') || empty($model_is_compliance)) && !$lang) { 520 if (($model->updated_date != date('Y-m-d') || empty($model_is_compliance)) && !$lang) {
518 $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0; 521 $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
519 - Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);  
520 - Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1)); 522 + if(!in_array($project_id,$ceaseProjectId)){
  523 + Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);
  524 + Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1));
  525 + }else{
  526 + Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day]);
  527 + Log::channel('rank_data')->info('项目' . $project_id . '暂停项目达标天数不加:'. ($compliance_day));
  528 + }
521 } 529 }
522 $model->is_compliance = 1; 530 $model->is_compliance = 1;
523 } else { 531 } else {