|
@@ -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
|
}
|