|
...
|
...
|
@@ -9,6 +9,8 @@ |
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Template\BCustomTemplate;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
...
|
...
|
@@ -99,25 +101,70 @@ class ProjectServer extends BaseService |
|
|
|
* @time :2023/9/19 14:45
|
|
|
|
*/
|
|
|
|
public static function saveInitParam($project_id){
|
|
|
|
$info = DB::connection('custom_mysql')->table('gl_web_nav')->first();
|
|
|
|
if(empty($info)){
|
|
|
|
$created_at = date('Y-m-d H:i:s');
|
|
|
|
|
|
|
|
//菜单
|
|
|
|
$info = DB::connection('custom_mysql')->table('gl_web_nav')->first();
|
|
|
|
if(empty($info)) {
|
|
|
|
$data = [
|
|
|
|
['project_id'=>$project_id,'name'=>'Home','url'=>'nav-home-'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id'=>$project_id,'name'=>'Products','url'=>'nav-product'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id'=>$project_id,'name'=>'News','url'=>'nav-news'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id'=>$project_id,'name'=>'ABOUT US','url'=>'nav-about-us'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id'=>$project_id,'name'=>'Contact Us','url'=>'nav-contact-us'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id'=>$project_id,'name'=>'FAQ','url'=>'nav-faq'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id' => $project_id, 'name' => 'Home', 'url' => 'nav-home-' . $project_id, 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
['project_id' => $project_id, 'name' => 'Products', 'url' => 'nav-product' . $project_id, 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
['project_id' => $project_id, 'name' => 'News', 'url' => 'nav-news' . $project_id, 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
['project_id' => $project_id, 'name' => 'ABOUT US', 'url' => 'nav-about-us' . $project_id, 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
['project_id' => $project_id, 'name' => 'Contact Us', 'url' => 'nav-contact-us' . $project_id, 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
['project_id' => $project_id, 'name' => 'FAQ', 'url' => 'nav-faq' . $project_id, 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
];
|
|
|
|
DB::connection('custom_mysql')->table('gl_web_nav')->insert($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
//菜单组
|
|
|
|
$info = DB::connection('custom_mysql')->table('gl_web_nav_group')->first();
|
|
|
|
if(empty($info)) {
|
|
|
|
$data = [
|
|
|
|
['project_id'=>$project_id,'name'=>'全局顶部菜单','created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['project_id'=>$project_id,'name'=>'底部菜单','created_at'=>$created_at,'updated_at'=>$created_at],
|
|
|
|
['id' => 1, 'project_id' => $project_id, 'name' => '全局顶部菜单', 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
['id' => 2, 'project_id' => $project_id, 'name' => '底部菜单', 'created_at' => $created_at, 'updated_at' => $created_at],
|
|
|
|
];
|
|
|
|
DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
//初始化单页
|
|
|
|
$info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
|
|
|
|
if(empty($info)) {
|
|
|
|
$data = ['project_id' => $project_id, 'name' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'status' => 1, 'url' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'html' => '<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>
|
|
|
|
<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>', 'html_style' => '<style id="globalsojs-styles"></style>','created_at' => $created_at, 'updated_at' => $created_at];
|
|
|
|
$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' => $created_at, 'updated_at' => $created_at];
|
|
|
|
DB::connection('custom_mysql')->table('gl_route_map')->insert($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return true;
|
|
|
|
}
|
...
|
...
|
|