|
...
|
...
|
@@ -9,6 +9,7 @@ namespace App\Console\Commands\Test; |
|
|
|
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Models\Blog\Blog;
|
|
|
|
use App\Models\Blog\BlogCategory;
|
|
|
|
use App\Models\Com\KeywordVideoTask;
|
|
...
|
...
|
@@ -58,33 +59,6 @@ class Demo extends Command |
|
|
|
*/
|
|
|
|
protected $description = 'demo';
|
|
|
|
|
|
|
|
public static $main404Html = '<main>
|
|
|
|
<section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
|
|
|
|
id="sectionIdyxqu938">
|
|
|
|
<div class="layout" data-unable="demo01-error404">
|
|
|
|
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
|
|
|
|
</div>
|
|
|
|
<p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
|
|
|
|
<style>
|
|
|
|
.section-block-error404 .layout {
|
|
|
|
height: 700px;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
.section-block-error404 img {
|
|
|
|
width: 400px;
|
|
|
|
}
|
|
|
|
@media only screen and (max-width:500) {
|
|
|
|
.section-block-error404 img {
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
</script>
|
|
|
|
</section>
|
|
|
|
</main>';
|
|
|
|
public function handle(){
|
|
|
|
$projectModel = new Project();
|
|
|
|
$list = $projectModel->list(['is_upgrade'=>1]);
|
|
...
|
...
|
@@ -97,26 +71,33 @@ class Demo extends Command |
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
}
|
|
|
|
public static function init404Page($project_id){
|
|
|
|
$time = date('Y-m-d H:i:s');
|
|
|
|
$info = DB::connection('custom_mysql')->table('gl_web_custom_template')->where('url',BCustomTemplate::NOT_FOUND_PAGE_URL)->first();
|
|
|
|
if(empty($info)) {
|
|
|
|
$data = [
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'name' => BCustomTemplate::NOT_FOUND_PAGE_URL,
|
|
|
|
'status' => 1,
|
|
|
|
'url' => BCustomTemplate::NOT_FOUND_PAGE_URL,
|
|
|
|
'html' => self::$main404Html,
|
|
|
|
'html_style' => '<style id="globalsojs-styles"></style>',
|
|
|
|
'title' => '404-Page not found',
|
|
|
|
'description' => 'Sorry. The page has either moved or cannot be found.',
|
|
|
|
'created_at' => $time, 'updated_at' => $time];
|
|
|
|
$id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);
|
|
|
|
//路由
|
|
|
|
$info = DB::connection('custom_mysql')->table('gl_route_map')->first();
|
|
|
|
if(empty($info)) {
|
|
|
|
$data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'created_at' => $time, 'updated_at' => $time];
|
|
|
|
DB::connection('custom_mysql')->table('gl_route_map')->insert($data);
|
|
|
|
|
|
|
|
public function getProduct(){
|
|
|
|
$productModel = new Product();
|
|
|
|
$lists = $productModel->list(['status'=>['!=',2]]);
|
|
|
|
if(!empty($lists)){
|
|
|
|
foreach ($lists as $v){
|
|
|
|
if(!empty($v['route'])){
|
|
|
|
$tag = "-product";
|
|
|
|
if (!(substr($v['route'], -strlen($tag)) === $tag)) {
|
|
|
|
echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;
|
|
|
|
$route = $v['route'].$tag;
|
|
|
|
// 如果不是以 '-product' 结尾,则拼接上 '-product'
|
|
|
|
$route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
|
|
|
|
$productModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
}else{
|
|
|
|
echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
|
|
|
|
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
|
|
|
|
$productModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}else{
|
|
|
|
echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
|
|
|
|
$v['title'] = Translate::tran($v['title'], 'en');
|
|
|
|
$v['title'] = str_replace('.','',$v['title']).'-product';
|
|
|
|
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
|
|
|
|
$productModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|