作者 刘锟

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

@@ -2,12 +2,15 @@ @@ -2,12 +2,15 @@
2 2
3 namespace App\Console\Commands\RankData; 3 namespace App\Console\Commands\RankData;
4 4
  5 +
5 use App\Helper\QuanqiusouApi; 6 use App\Helper\QuanqiusouApi;
6 use App\Http\Logic\Bside\RankData\RankDataLogic; 7 use App\Http\Logic\Bside\RankData\RankDataLogic;
  8 +use App\Models\Domain\DomainInfo;
7 use App\Models\Project\DeployOptimize; 9 use App\Models\Project\DeployOptimize;
8 use App\Models\Project\Project; 10 use App\Models\Project\Project;
9 use App\Models\RankData\RankData as GoogleRankModel; 11 use App\Models\RankData\RankData as GoogleRankModel;
10 use App\Utils\LogUtils; 12 use App\Utils\LogUtils;
  13 +use Illuminate\Database\Eloquent\Model;
11 14
12 /** 15 /**
13 * Class GoogleRank 16 * Class GoogleRank
@@ -38,6 +41,9 @@ class RankData extends BaseCommands @@ -38,6 +41,9 @@ class RankData extends BaseCommands
38 */ 41 */
39 public function do() 42 public function do()
40 { 43 {
  44 + //同步api_no
  45 + $this->SyncApiNo();
  46 +
41 //所有项目 今日是否达标 重置 47 //所有项目 今日是否达标 重置
42 Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]); 48 Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]);
43 49
@@ -62,4 +68,35 @@ class RankData extends BaseCommands @@ -62,4 +68,35 @@ class RankData extends BaseCommands
62 } 68 }
63 return !$error; 69 return !$error;
64 } 70 }
  71 +
  72 + /**
  73 + * 同步项目api_no
  74 + * @author zbj
  75 + * @date 2023/10/16
  76 + */
  77 + public function SyncApiNo(){
  78 + $deploy_optimizes = DeployOptimize::leftJoin('gl_project', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
  79 + ->whereIn('gl_project.type', [Project::TYPE_TWO,Project::TYPE_THREE])->where('gl_project_deploy_optimize.api_no', 0)
  80 + ->where('gl_project_deploy_optimize.domain', '>', 0)
  81 + ->get();
  82 + if(!$deploy_optimizes){
  83 + return true;
  84 + }
  85 +
  86 + $api = new QuanqiusouApi();
  87 + $ai_nos = $api->getWebApiNo();
  88 +
  89 + foreach ($deploy_optimizes as $deploy_optimize){
  90 + $domain = DomainInfo::where('id', $deploy_optimize['domain'])->value('domain');
  91 + if(!$domain){
  92 + continue;
  93 + }
  94 + $api_no = array_search($domain, $ai_nos);
  95 + if($api_no){
  96 + $deploy_optimize->api_no = $api_no;
  97 + $deploy_optimize->save();
  98 + }
  99 + }
  100 + }
  101 +
65 } 102 }
@@ -205,7 +205,7 @@ class SyncProject extends Command @@ -205,7 +205,7 @@ class SyncProject extends Command
205 'login_mobile'=>$param['principal_mobile'] 205 'login_mobile'=>$param['principal_mobile']
206 ], 206 ],
207 'deploy_optimize' => [ 207 'deploy_optimize' => [
208 - 'api_no' => $param['id'] 208 + 'api_no' => 0
209 ], 209 ],
210 'project_after' => [], 210 'project_after' => [],
211 'payment' => [ 211 'payment' => [
@@ -231,5 +231,33 @@ class QuanqiusouApi @@ -231,5 +231,33 @@ class QuanqiusouApi
231 return $res; 231 return $res;
232 } 232 }
233 233
  234 + /**
  235 + * 项目api_no对应关系
  236 + * @return array|false|int|mixed|null
  237 + * @author zbj
  238 + * @date 2023/10/16
  239 + */
  240 + public function getWebApiNo(){
  241 + $key = "quanqiusou_web_api_no_" . date('Y-m-d');
  242 + $res = Cache::get($key);
  243 + if (!$res) {
  244 + $api_url = $this->url . '/api/index/weblist';
  245 + $param = [
  246 + 'key' => '289c1fc81c89d79c04ed4fd72822948e',
  247 + ];
  248 + try {
  249 + $res = HttpUtils::get($api_url, $param);
  250 + if($res){
  251 + $res = Arr::s2a($res);
  252 + Cache::put($key, $res, 24 * 3600);
  253 + }
  254 + } catch (\Exception | GuzzleException $e) {
  255 + errorLog('获取项目API_NO数据失败', [], $e);
  256 + return false;
  257 + }
  258 + }
  259 + return $res;
  260 + }
  261 +
234 262
235 } 263 }
@@ -156,6 +156,8 @@ class ProjectController extends BaseController @@ -156,6 +156,8 @@ class ProjectController extends BaseController
156 if ($this->map['search_type'] == 'domain') { 156 if ($this->map['search_type'] == 'domain') {
157 $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray(); 157 $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray();
158 $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids); 158 $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
  159 + } else if($this->map['search_type'] == 'test_domain'){
  160 + $subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%');
159 } else { 161 } else {
160 // 搜索名称 162 // 搜索名称
161 $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%') 163 $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
@@ -2,10 +2,12 @@ @@ -2,10 +2,12 @@
2 2
3 namespace App\Http\Controllers\Bside\Product; 3 namespace App\Http\Controllers\Bside\Product;
4 4
  5 +use App\Enums\Common\Code;
5 use App\Helper\Arr; 6 use App\Helper\Arr;
6 use App\Http\Controllers\Bside\BaseController; 7 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Product\DescribeLogic; 8 use App\Http\Logic\Bside\Product\DescribeLogic;
8 use App\Http\Requests\Bside\Product\DescribeRequest; 9 use App\Http\Requests\Bside\Product\DescribeRequest;
  10 +use App\Models\Product\Describe;
9 use App\Rules\Ids; 11 use App\Rules\Ids;
10 use Illuminate\Http\Request; 12 use Illuminate\Http\Request;
11 13
@@ -18,15 +20,14 @@ use Illuminate\Http\Request; @@ -18,15 +20,14 @@ use Illuminate\Http\Request;
18 class DescribeController extends BaseController 20 class DescribeController extends BaseController
19 { 21 {
20 22
21 - public function index(DescribeLogic $logic) 23 + public function index(Describe $describe)
22 { 24 {
23 - $map = [];  
24 - if(!empty($this->param['search'])){  
25 - $map[] = ['title', 'like', "%{$this->param['search']}%"]; 25 + if(!empty($this->map['search'])){
  26 + $this->map['title'] = ['like',"%{$this->param['search']}%"];
  27 + unset($this->map['search']);
26 } 28 }
27 - $sort = ['id' => 'desc'];  
28 - $data = $logic->getList($map, $sort, ['id', 'title', 'text', 'status', 'created_at'],$this->row);  
29 - return $this->success($data); 29 + $data = $describe->lists($this->map,$this->page,$this->row, 'id', ['id', 'title', 'text', 'status', 'created_at']);
  30 + $this->response('success',Code::SUCCESS,$data);
30 } 31 }
31 32
32 public function info(Request $request, DescribeLogic $logic){ 33 public function info(Request $request, DescribeLogic $logic){
@@ -39,10 +40,18 @@ class DescribeController extends BaseController @@ -39,10 +40,18 @@ class DescribeController extends BaseController
39 return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'text', 'created_at'])); 40 return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'text', 'created_at']));
40 } 41 }
41 42
42 - public function save(DescribeRequest $request, DescribeLogic $logic) 43 + /**
  44 + * @remark :baocun
  45 + * @name :save
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2023/10/17 10:36
  49 + */
  50 + public function save(DescribeRequest $request,DescribeLogic $logic)
43 { 51 {
44 - $data = $logic->save($this->param);  
45 - return $this->success($data); 52 + $request->validated();
  53 + $logic->describeSave();
  54 + return $this->success();
46 } 55 }
47 56
48 public function delete(Request $request, DescribeLogic $logic) 57 public function delete(Request $request, DescribeLogic $logic)
@@ -260,7 +260,7 @@ class ImageController extends Controller @@ -260,7 +260,7 @@ class ImageController extends Controller
260 foreach ($files as $file) { 260 foreach ($files as $file) {
261 $imageModel = new ImageModel(); 261 $imageModel = new ImageModel();
262 $hash = hash_file('md5', $file->getPathname()); 262 $hash = hash_file('md5', $file->getPathname());
263 - $name = $files->getClientOriginalName(); 263 + $name = $file->getClientOriginalName();
264 //查看图片是否已上传 264 //查看图片是否已上传
265 $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; 265 $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0];
266 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ 266 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
@@ -139,7 +139,7 @@ class BTemplateLogic extends BaseLogic @@ -139,7 +139,7 @@ class BTemplateLogic extends BaseLogic
139 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 139 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
140 if($commonInfo !== false){ 140 if($commonInfo !== false){
141 $html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['footer_css'].$commonInfo['other']. 141 $html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['footer_css'].$commonInfo['other'].
142 - $commonInfo['head_html'].$this->getProductModule().$commonInfo['footer_html']; 142 + $commonInfo['head_html']."<main>{$this->getProductModule()}</main>".$commonInfo['footer_html'];
143 }else{ 143 }else{
144 $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']); 144 $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']);
145 $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', "<main>{$this->getProductModule()}</main>", $html); 145 $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', "<main>{$this->getProductModule()}</main>", $html);
@@ -64,6 +64,9 @@ class CustomTemplateLogic extends BaseLogic @@ -64,6 +64,9 @@ class CustomTemplateLogic extends BaseLogic
64 $id = $this->editCustomRoute($this->param['id'],$this->param['url']); 64 $id = $this->editCustomRoute($this->param['id'],$this->param['url']);
65 $this->model->edit($this->param,['id'=>$this->param['id']]); 65 $this->model->edit($this->param,['id'=>$this->param['id']]);
66 }else{ 66 }else{
  67 + if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
  68 + $this->fail('404页面已存在');
  69 + }
67 $this->param['project_id'] = $this->user['project_id']; 70 $this->param['project_id'] = $this->user['project_id'];
68 $id = $this->model->addReturnId($this->param); 71 $id = $this->model->addReturnId($this->param);
69 } 72 }
@@ -84,6 +87,7 @@ class CustomTemplateLogic extends BaseLogic @@ -84,6 +87,7 @@ class CustomTemplateLogic extends BaseLogic
84 */ 87 */
85 public function saveHtml(){ 88 public function saveHtml(){
86 $html = $this->param['html']; 89 $html = $this->param['html'];
  90 + $this->saveCommonTemplate($html);
87 $this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s'); 91 $this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');
88 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 92 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
89 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 93 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
@@ -98,6 +102,38 @@ class CustomTemplateLogic extends BaseLogic @@ -98,6 +102,38 @@ class CustomTemplateLogic extends BaseLogic
98 } 102 }
99 103
100 /** 104 /**
  105 + * @remark :保存头部公共数据
  106 + * @name :saveCommonTemplate
  107 + * @author :lyh
  108 + * @method :post
  109 + * @time :2023/10/13 14:27
  110 + */
  111 + public function saveCommonTemplate($html){
  112 + //获取设置的默认模版
  113 + $bSettingModel = new Setting();
  114 + $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  115 + if($settingInfo === false){
  116 + $this->fail('请先设置模版');
  117 + }
  118 + //查看当前
  119 + $templateCommonModel = new BTemplateCommon();
  120 + $commonInfo = $templateCommonModel->read(['template_id'=>$settingInfo['template_id'],'project_id'=>$this->user['project_id']]);
  121 + if($commonInfo === false){
  122 + $this->fail('请先装修首页');
  123 + }
  124 + $data = [
  125 + 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),
  126 + 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),
  127 + 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
  128 + 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
  129 + 'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")),
  130 + ];
  131 + $templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
  132 + return $this->success();
  133 + }
  134 +
  135 +
  136 + /**
101 * @remark :查看路由是否更新 137 * @remark :查看路由是否更新
102 * @name :editProduct 138 * @name :editProduct
103 * @author :lyh 139 * @author :lyh
@@ -106,6 +142,9 @@ class CustomTemplateLogic extends BaseLogic @@ -106,6 +142,9 @@ class CustomTemplateLogic extends BaseLogic
106 */ 142 */
107 public function editCustomRoute($id,$route){ 143 public function editCustomRoute($id,$route){
108 $info = $this->model->read(['id'=>$this->param['id']]); 144 $info = $this->model->read(['id'=>$this->param['id']]);
  145 + if($info['url'] == $this->model::NOT_FOUND_PAGE_URL && $route['url'] != '404'){
  146 + $this->fail('404页面链接不可修改');
  147 + }
109 if($info['url'] != $route){ 148 if($info['url'] != $route){
110 //生成一条删除路由记录 149 //生成一条删除路由记录
111 $data = [ 150 $data = [
@@ -129,6 +168,9 @@ class CustomTemplateLogic extends BaseLogic @@ -129,6 +168,9 @@ class CustomTemplateLogic extends BaseLogic
129 if($info === false){ 168 if($info === false){
130 $this->fail('当前数据不存在或者已被删除'); 169 $this->fail('当前数据不存在或者已被删除');
131 } 170 }
  171 + if($info['url'] == $this->model::NOT_FOUND_PAGE_URL){
  172 + $this->fail('404页面不可删除');
  173 + }
132 try { 174 try {
133 if($info['status'] != 2){ 175 if($info['status'] != 2){
134 $this->model->edit(['status'=>2],['id'=>$this->param['id']]); 176 $this->model->edit(['status'=>2],['id'=>$this->param['id']]);
@@ -170,10 +212,17 @@ class CustomTemplateLogic extends BaseLogic @@ -170,10 +212,17 @@ class CustomTemplateLogic extends BaseLogic
170 * @method :post 212 * @method :post
171 * @time :2023/7/21 18:08 213 * @time :2023/7/21 18:08
172 */ 214 */
173 - public function getBodyHeaderFooter($preg_html = "<main></main>",$html_style = "<style id='globalsojs-styles'></style>"){ 215 + public function getBodyHeaderFooter($preg_html,$html_style){
  216 + if(empty($preg_html)){
  217 + $preg_html = "<main></main>";
  218 + $html_style = "<style id='globalsojs-styles'></style>";
  219 + }
174 //获取设置的默认模版 220 //获取设置的默认模版
175 $bSettingModel = new Setting(); 221 $bSettingModel = new Setting();
176 $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]); 222 $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  223 + if($info === false){
  224 + $this->fail('请先设置模版');
  225 + }
177 //兼容老数据 226 //兼容老数据
178 $commonTemplateModel = new BTemplateCommon(); 227 $commonTemplateModel = new BTemplateCommon();
179 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 228 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
@@ -122,11 +122,11 @@ class CategoryLogic extends BaseLogic @@ -122,11 +122,11 @@ class CategoryLogic extends BaseLogic
122 if($param['pid'] == $param['id']){ 122 if($param['pid'] == $param['id']){
123 $this->fail('上级分类不能是本分类'); 123 $this->fail('上级分类不能是本分类');
124 } 124 }
125 - $info = $this->model->read(['id'=>$param['id']]);  
126 - $sub_info = $this->model->read(['pid'=>$param['id']]);  
127 - if(($info['pid'] != $param['pid']) && ($sub_info != false)){  
128 - $this->fail('当前分类拥有子分类,不允许修改上级分类');  
129 - } 125 +// $info = $this->model->read(['id'=>$param['id']]);
  126 +// $sub_info = $this->model->read(['pid'=>$param['id']]);
  127 +// if(($info['pid'] != $param['pid']) && ($sub_info != false)){
  128 +// $this->fail('当前分类拥有子分类,不允许修改上级分类');
  129 +// }
130 // $productModel = new Product(); 130 // $productModel = new Product();
131 // $product_info = $productModel->read(['category_id'=>['like','%'.$param['id'].'%']]); 131 // $product_info = $productModel->read(['category_id'=>['like','%'.$param['id'].'%']]);
132 // if(($product_info !== false) && ($info['pid'] != $param['pid'])){ 132 // if(($product_info !== false) && ($info['pid'] != $param['pid'])){
@@ -17,7 +17,26 @@ class DescribeLogic extends BaseLogic @@ -17,7 +17,26 @@ class DescribeLogic extends BaseLogic
17 public function __construct() 17 public function __construct()
18 { 18 {
19 parent::__construct(); 19 parent::__construct();
20 - 20 + $this->param = $this->requestAll;
21 $this->model = new Describe(); 21 $this->model = new Describe();
22 } 22 }
  23 +
  24 + /**
  25 + * @remark :保存通用描述
  26 + * @name :describeSave
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/10/17 10:37
  30 + */
  31 + public function describeSave(){
  32 + if(isset($this->param['id']) && !empty($this->param['id'])){
  33 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  34 + }else{
  35 + $rs = $this->model->add($this->param);
  36 + }
  37 + if($rs === false){
  38 + $this->fail('系统错误,请联系管理员');
  39 + }
  40 + return $this->success();
  41 + }
23 } 42 }
@@ -156,7 +156,7 @@ class RankDataLogic extends BaseLogic @@ -156,7 +156,7 @@ class RankDataLogic extends BaseLogic
156 $ai_projects = $this->getAiProjects()['data'] ?? []; 156 $ai_projects = $this->getAiProjects()['data'] ?? [];
157 $flg_ai = $this->getAiFlag($ai_projects, $domain); 157 $flg_ai = $this->getAiFlag($ai_projects, $domain);
158 $ai_domain = str_replace('www.', '', $this->getAiProjects($domain)['domain'] ?? ''); 158 $ai_domain = str_replace('www.', '', $this->getAiProjects($domain)['domain'] ?? '');
159 - $list = RankData::where('project_id', $project_id)->where('lang', $lang)->value('data'); 159 + $list = RankData::where('project_id', $project_id)->where('lang', $lang)->value('data') ?: [];
160 $list30 = []; //排名前三十的 160 $list30 = []; //排名前三十的
161 $list30_0 = []; //排名前三十且近三天没有排名的 161 $list30_0 = []; //排名前三十且近三天没有排名的
162 $list100 = []; //排名前100的 162 $list100 = []; //排名前100的
@@ -9,4 +9,6 @@ class BCustomTemplate extends Base @@ -9,4 +9,6 @@ class BCustomTemplate extends Base
9 protected $table = 'gl_web_custom_template'; 9 protected $table = 'gl_web_custom_template';
10 //连接数据库 10 //连接数据库
11 protected $connection = 'custom_mysql'; 11 protected $connection = 'custom_mysql';
  12 +
  13 + const NOT_FOUND_PAGE_URL = '404';
12 } 14 }
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 namespace App\Services; 9 namespace App\Services;
10 10
11 use App\Models\Project\Project; 11 use App\Models\Project\Project;
  12 +use App\Models\RouteMap\RouteMap;
  13 +use App\Models\Template\BCustomTemplate;
12 use Illuminate\Support\Facades\DB; 14 use Illuminate\Support\Facades\DB;
13 use Illuminate\Support\Facades\Schema; 15 use Illuminate\Support\Facades\Schema;
14 16
@@ -99,25 +101,70 @@ class ProjectServer extends BaseService @@ -99,25 +101,70 @@ class ProjectServer extends BaseService
99 * @time :2023/9/19 14:45 101 * @time :2023/9/19 14:45
100 */ 102 */
101 public static function saveInitParam($project_id){ 103 public static function saveInitParam($project_id){
  104 + $created_at = date('Y-m-d H:i:s');
  105 +
  106 + //菜单
102 $info = DB::connection('custom_mysql')->table('gl_web_nav')->first(); 107 $info = DB::connection('custom_mysql')->table('gl_web_nav')->first();
103 - if(empty($info)){  
104 - $created_at = date('Y-m-d H:i:s'); 108 + if(empty($info)) {
105 $data = [ 109 $data = [
106 - ['project_id'=>$project_id,'name'=>'Home','url'=>'nav-home-'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at],  
107 - ['project_id'=>$project_id,'name'=>'Products','url'=>'nav-product'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at],  
108 - ['project_id'=>$project_id,'name'=>'News','url'=>'nav-news'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at],  
109 - ['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],  
110 - ['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],  
111 - ['project_id'=>$project_id,'name'=>'FAQ','url'=>'nav-faq'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at], 110 + ['project_id' => $project_id, 'name' => 'Home', 'url' => 'nav-home-' . $project_id, 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at],
  111 + ['project_id' => $project_id, 'name' => 'Products', 'url' => 'nav-product' . $project_id, 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at],
  112 + ['project_id' => $project_id, 'name' => 'News', 'url' => 'nav-news' . $project_id, 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at],
  113 + ['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],
  114 + ['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],
  115 + ['project_id' => $project_id, 'name' => 'FAQ', 'url' => 'nav-faq' . $project_id, 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at],
112 ]; 116 ];
113 DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); 117 DB::connection('custom_mysql')->table('gl_web_nav')->insert($data);
  118 + }
114 119
  120 + //菜单组
  121 + $info = DB::connection('custom_mysql')->table('gl_web_nav_group')->first();
  122 + if(empty($info)) {
115 $data = [ 123 $data = [
116 - ['project_id'=>$project_id,'name'=>'全局顶部菜单','created_at'=>$created_at,'updated_at'=>$created_at],  
117 - ['project_id'=>$project_id,'name'=>'底部菜单','created_at'=>$created_at,'updated_at'=>$created_at], 124 + ['id' => 1, 'project_id' => $project_id, 'name' => '全局顶部菜单', 'created_at' => $created_at, 'updated_at' => $created_at],
  125 + ['id' => 2, 'project_id' => $project_id, 'name' => '底部菜单', 'created_at' => $created_at, 'updated_at' => $created_at],
118 ]; 126 ];
119 DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data); 127 DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data);
120 } 128 }
  129 +
  130 + //初始化单页
  131 + $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
  132 + if(empty($info)) {
  133 + $data = ['project_id' => $project_id, 'name' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'status' => 1, 'url' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'html' => '<main>
  134 + <section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
  135 + id="sectionIdyxqu938">
  136 + <div class="layout" data-unable="demo01-error404">
  137 + <img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
  138 + </div>
  139 + <style>
  140 + .section-block-error404 .layout {
  141 + height: 700px;
  142 + display: flex;
  143 + align-items: center;
  144 + justify-content: center;
  145 + }
  146 + .section-block-error404 img {
  147 + width: 400px;
  148 + }
  149 + @media only screen and (max-width:500) {
  150 + .section-block-error404 img {
  151 + max-width: 100%;
  152 + }
  153 + }
  154 + </style>
  155 + <script>
  156 + </script>
  157 + </section>
  158 + </main>', 'html_style' => '<style id="globalsojs-styles"></style>','created_at' => $created_at, 'updated_at' => $created_at];
  159 + $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);
  160 + //路由
  161 + $info = DB::connection('custom_mysql')->table('gl_route_map')->first();
  162 + if(empty($info)) {
  163 + $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];
  164 + DB::connection('custom_mysql')->table('gl_route_map')->insert($data);
  165 + }
  166 + }
  167 +
121 DB::disconnect('custom_mysql'); 168 DB::disconnect('custom_mysql');
122 return true; 169 return true;
123 } 170 }