Merge remote-tracking branch 'origin/master' into akun
正在显示
15 个修改的文件
包含
263 行增加
和
203 行删除
| @@ -82,17 +82,6 @@ class InitProject extends Command | @@ -82,17 +82,6 @@ class InitProject extends Command | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /** | 84 | /** |
| 85 | - * @remark :保存默认扩展模块 | ||
| 86 | - * @name :saveModule | ||
| 87 | - * @author :lyh | ||
| 88 | - * @method :post | ||
| 89 | - * @time :2023/12/28 15:53 | ||
| 90 | - */ | ||
| 91 | - public function saveModule(){ | ||
| 92 | - | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - /** | ||
| 96 | * @param NoticeLog $log | 85 | * @param NoticeLog $log |
| 97 | */ | 86 | */ |
| 98 | public function retry($log, $remark){ | 87 | public function retry($log, $remark){ |
| @@ -54,11 +54,11 @@ class UpdateRoute extends Command | @@ -54,11 +54,11 @@ class UpdateRoute extends Command | ||
| 54 | */ | 54 | */ |
| 55 | public function handle(){ | 55 | public function handle(){ |
| 56 | $projectModel = new Project(); | 56 | $projectModel = new Project(); |
| 57 | - $list = $projectModel->list(['id'=>['in',[518,241]],'is_upgrade'=>0]); | 57 | + $list = $projectModel->list(['id'=>['in',[183]],'is_upgrade'=>0]); |
| 58 | foreach ($list as $v){ | 58 | foreach ($list as $v){ |
| 59 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 59 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 60 | ProjectServer::useProject($v['id']); | 60 | ProjectServer::useProject($v['id']); |
| 61 | - $this->getProduct(); | 61 | +// $this->getProduct(); |
| 62 | $this->setProductKeyword(); | 62 | $this->setProductKeyword(); |
| 63 | DB::disconnect('custom_mysql'); | 63 | DB::disconnect('custom_mysql'); |
| 64 | } | 64 | } |
| @@ -182,7 +182,10 @@ class OptimizeController extends BaseController | @@ -182,7 +182,10 @@ class OptimizeController extends BaseController | ||
| 182 | }); | 182 | }); |
| 183 | } | 183 | } |
| 184 | if(isset($this->map['domain']) && !empty($this->map['domain'])){ | 184 | if(isset($this->map['domain']) && !empty($this->map['domain'])){ |
| 185 | - $query = $query->where('gl_project_deploy_optimize.domain','like','%'.$this->map['domain'].'%'); | 185 | + $parsedUrl = parse_url($this->map['domain']); |
| 186 | + $this->map['domain'] = $parsedUrl['host'] ?? $this->map['domain']; | ||
| 187 | + $ids = DomainInfo::where('domain', 'like', '%'.$this->map['domain'].'%')->pluck('id')->toArray(); | ||
| 188 | + $query = $query->whereIn('gl_project_deploy_optimize.domain', $ids); | ||
| 186 | } | 189 | } |
| 187 | if(isset($this->map['test_domain']) && !empty($this->map['test_domain'])){ | 190 | if(isset($this->map['test_domain']) && !empty($this->map['test_domain'])){ |
| 188 | $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%'); | 191 | $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%'); |
| @@ -179,6 +179,8 @@ class ProjectController extends BaseController | @@ -179,6 +179,8 @@ class ProjectController extends BaseController | ||
| 179 | $query->where(function ($subQuery) { | 179 | $query->where(function ($subQuery) { |
| 180 | // 搜索域名 | 180 | // 搜索域名 |
| 181 | if ($this->map['search_type'] == 'domain') { | 181 | if ($this->map['search_type'] == 'domain') { |
| 182 | + $parsedUrl = parse_url($this->map['search']); | ||
| 183 | + $this->map['search'] = $parsedUrl['host'] ?? $this->map['search']; | ||
| 182 | $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray(); | 184 | $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray(); |
| 183 | $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids); | 185 | $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids); |
| 184 | } else if($this->map['search_type'] == 'test_domain'){ | 186 | } else if($this->map['search_type'] == 'test_domain'){ |
| @@ -333,8 +335,8 @@ class ProjectController extends BaseController | @@ -333,8 +335,8 @@ class ProjectController extends BaseController | ||
| 333 | * @method :post | 335 | * @method :post |
| 334 | * @time :2023/8/17 16:42 | 336 | * @time :2023/8/17 16:42 |
| 335 | */ | 337 | */ |
| 336 | - public function info(Request $request, ProjectLogic $logic){ | ||
| 337 | - $request->validate([ | 338 | + public function info(ProjectLogic $logic){ |
| 339 | + $this->request->validate([ | ||
| 338 | 'id'=>'required' | 340 | 'id'=>'required' |
| 339 | ],[ | 341 | ],[ |
| 340 | 'id.required' => 'ID不能为空' | 342 | 'id.required' => 'ID不能为空' |
| @@ -352,17 +354,17 @@ class ProjectController extends BaseController | @@ -352,17 +354,17 @@ class ProjectController extends BaseController | ||
| 352 | */ | 354 | */ |
| 353 | public function save(ProjectLogic $logic) | 355 | public function save(ProjectLogic $logic) |
| 354 | { | 356 | { |
| 357 | + $this->request->validate([ | ||
| 358 | + 'type'=>'required' | ||
| 359 | + ],[ | ||
| 360 | + 'type.required' => '类型不能为空' | ||
| 361 | + ]); | ||
| 355 | $logic->projectSave(); | 362 | $logic->projectSave(); |
| 356 | $this->response('success'); | 363 | $this->response('success'); |
| 357 | } | 364 | } |
| 358 | 365 | ||
| 359 | /** | 366 | /** |
| 360 | * 询盘通知设置 | 367 | * 询盘通知设置 |
| 361 | - * @param ProjectRequest $request | ||
| 362 | - * @param ProjectLogic $logic | ||
| 363 | - * @return \Illuminate\Http\JsonResponse | ||
| 364 | - * @throws \Psr\Container\ContainerExceptionInterface | ||
| 365 | - * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 366 | * @author zbj | 368 | * @author zbj |
| 367 | * @date 2023/5/17 | 369 | * @date 2023/5/17 |
| 368 | */ | 370 | */ |
| @@ -400,10 +402,6 @@ class ProjectController extends BaseController | @@ -400,10 +402,6 @@ class ProjectController extends BaseController | ||
| 400 | 402 | ||
| 401 | /** | 403 | /** |
| 402 | * 省市数据源 | 404 | * 省市数据源 |
| 403 | - * @param ProjectLogic $logic | ||
| 404 | - * @return \Illuminate\Http\JsonResponse | ||
| 405 | - * @throws \Psr\Container\ContainerExceptionInterface | ||
| 406 | - * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 407 | * @author zbj | 405 | * @author zbj |
| 408 | * @date 2023/6/27 | 406 | * @date 2023/6/27 |
| 409 | */ | 407 | */ |
| @@ -414,10 +412,6 @@ class ProjectController extends BaseController | @@ -414,10 +412,6 @@ class ProjectController extends BaseController | ||
| 414 | 412 | ||
| 415 | /** | 413 | /** |
| 416 | * 渠道数据源 | 414 | * 渠道数据源 |
| 417 | - * @param ProjectLogic $logic | ||
| 418 | - * @return \Illuminate\Http\JsonResponse | ||
| 419 | - * @throws \Psr\Container\ContainerExceptionInterface | ||
| 420 | - * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 421 | * @author zbj | 415 | * @author zbj |
| 422 | * @date 2023/6/27 | 416 | * @date 2023/6/27 |
| 423 | */ | 417 | */ |
| @@ -750,6 +744,13 @@ class ProjectController extends BaseController | @@ -750,6 +744,13 @@ class ProjectController extends BaseController | ||
| 750 | $this->response('success',Code::SUCCESS,$list); | 744 | $this->response('success',Code::SUCCESS,$list); |
| 751 | } | 745 | } |
| 752 | 746 | ||
| 747 | + /** | ||
| 748 | + * @remark :处理tdk | ||
| 749 | + * @name :handleTdk | ||
| 750 | + * @author :lyh | ||
| 751 | + * @method :post | ||
| 752 | + * @time :2023/12/29 11:16 | ||
| 753 | + */ | ||
| 753 | public function handleTdk($item){ | 754 | public function handleTdk($item){ |
| 754 | $data = [ | 755 | $data = [ |
| 755 | 'gl_product'=>'产品', | 756 | 'gl_product'=>'产品', |
| @@ -29,11 +29,9 @@ class ComController extends BaseController | @@ -29,11 +29,9 @@ class ComController extends BaseController | ||
| 29 | public function get_menu(){ | 29 | public function get_menu(){ |
| 30 | //根据当前登录用户角色返回用户菜单列表 | 30 | //根据当前登录用户角色返回用户菜单列表 |
| 31 | $projectMenuModel = new ProjectMenuModel(); | 31 | $projectMenuModel = new ProjectMenuModel(); |
| 32 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND); | ||
| 33 | if($this->user['role_id'] != 0){ | 32 | if($this->user['role_id'] != 0){ |
| 34 | $this->map = $this->getNoAdminMenuCondition(); | 33 | $this->map = $this->getNoAdminMenuCondition(); |
| 35 | }else{ | 34 | }else{ |
| 36 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($this->map, true) . PHP_EOL, FILE_APPEND); | ||
| 37 | $this->map = $this->getAdminMenuCondition(); | 35 | $this->map = $this->getAdminMenuCondition(); |
| 38 | } | 36 | } |
| 39 | $lists = $projectMenuModel->list($this->map,'sort'); | 37 | $lists = $projectMenuModel->list($this->map,'sort'); |
| @@ -45,7 +45,6 @@ class FileManageController extends BaseController | @@ -45,7 +45,6 @@ class FileManageController extends BaseController | ||
| 45 | $this->map['project_id'] = $this->user['project_id']; | 45 | $this->map['project_id'] = $this->user['project_id']; |
| 46 | $this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%']; | 46 | $this->request['name'] && $this->map['name'] = ['like','%'.$this->request['name'].'%']; |
| 47 | $lists = $fileManage->lists($this->map, $this->page, $this->row); | 47 | $lists = $fileManage->lists($this->map, $this->page, $this->row); |
| 48 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($lists, true) . PHP_EOL, FILE_APPEND); | ||
| 49 | if(!empty($lists) && !empty($lists['list'])){ | 48 | if(!empty($lists) && !empty($lists['list'])){ |
| 50 | foreach ($lists['list'] as $k => $v){ | 49 | foreach ($lists['list'] as $k => $v){ |
| 51 | $v['download_url'] = url('b/file_manager_downLoad?path='.$v['path']); | 50 | $v['download_url'] = url('b/file_manager_downLoad?path='.$v['path']); |
| @@ -89,7 +89,6 @@ class NewsController extends BaseController | @@ -89,7 +89,6 @@ class NewsController extends BaseController | ||
| 89 | $str = []; | 89 | $str = []; |
| 90 | $str[] = $this->map['category_id']; | 90 | $str[] = $this->map['category_id']; |
| 91 | $this->getAllSub($this->map['category_id'],$str); | 91 | $this->getAllSub($this->map['category_id'],$str); |
| 92 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($str, true) . PHP_EOL, FILE_APPEND); | ||
| 93 | $query->where(function ($subQuery) use ($str) { | 92 | $query->where(function ($subQuery) use ($str) { |
| 94 | foreach ($str as $v) { | 93 | foreach ($str as $v) { |
| 95 | $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | 94 | $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); |
| @@ -111,9 +111,6 @@ class DomainInfoLogic extends BaseLogic | @@ -111,9 +111,6 @@ class DomainInfoLogic extends BaseLogic | ||
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| 113 | * 删除域名 | 113 | * 删除域名 |
| 114 | - * @return array | ||
| 115 | - * @throws \App\Exceptions\AsideGlobalException | ||
| 116 | - * @throws \App\Exceptions\BsideGlobalException | ||
| 117 | */ | 114 | */ |
| 118 | public function delDomain(){ | 115 | public function delDomain(){ |
| 119 | $ids = $this->param['id']; | 116 | $ids = $this->param['id']; |
| @@ -73,20 +73,23 @@ class BTemplateLogic extends BaseLogic | @@ -73,20 +73,23 @@ class BTemplateLogic extends BaseLogic | ||
| 73 | 'is_custom'=>$is_custom, 'is_list'=>$is_list | 73 | 'is_custom'=>$is_custom, 'is_list'=>$is_list |
| 74 | ]); | 74 | ]); |
| 75 | if($templateInfo === false){ | 75 | if($templateInfo === false){ |
| 76 | - if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据 | 76 | + if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据 |
| 77 | $html = $this->isCustomizedPage($this->param['source'],$is_list);//获取定制页面的html | 77 | $html = $this->isCustomizedPage($this->param['source'],$is_list);//获取定制页面的html |
| 78 | - return $this->success(['html'=>$html,'template_id'=>$template_id]); | 78 | + if(!empty($html)){ |
| 79 | + return $this->success(['html'=>$html,'template_id'=>$template_id]); | ||
| 80 | + } | ||
| 79 | } | 81 | } |
| 80 | $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码 | 82 | $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码 |
| 81 | }else{ | 83 | }else{ |
| 82 | if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 | 84 | if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 |
| 83 | - $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,0);//获取定制头部 | 85 | + $type = $this->getCustomizedType($this->param['source'],$is_list); |
| 86 | + $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部 | ||
| 84 | $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); | 87 | $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); |
| 85 | return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); | 88 | return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); |
| 86 | } | 89 | } |
| 87 | $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; | 90 | $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; |
| 88 | } | 91 | } |
| 89 | - $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id);//获取定制头部 | 92 | + $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取定制头部 |
| 90 | $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. | 93 | $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. |
| 91 | $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; | 94 | $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; |
| 92 | $html = $this->getHeadFooter($html); | 95 | $html = $this->getHeadFooter($html); |
| @@ -128,8 +131,8 @@ class BTemplateLogic extends BaseLogic | @@ -128,8 +131,8 @@ class BTemplateLogic extends BaseLogic | ||
| 128 | * @time :2023/7/27 15:08 | 131 | * @time :2023/7/27 15:08 |
| 129 | */ | 132 | */ |
| 130 | public function getInitModule($type,$is_custom,$is_list){ | 133 | public function getInitModule($type,$is_custom,$is_list){ |
| 131 | - if($is_custom == BTemplate::SOURCE_CUSTOM) { | ||
| 132 | - $type = BTemplate::TYPE_CUSTOM; | 134 | + if($is_custom == BTemplate::IS_CUSTOM) { |
| 135 | + $type = BTemplate::SOURCE_CUSTOM; | ||
| 133 | } | 136 | } |
| 134 | $mainModel = new TemplateTypeMain(); | 137 | $mainModel = new TemplateTypeMain(); |
| 135 | $info = $mainModel->read(['type'=>$type,'is_list'=>$is_list]); | 138 | $info = $mainModel->read(['type'=>$type,'is_list'=>$is_list]); |
| @@ -172,7 +175,7 @@ class BTemplateLogic extends BaseLogic | @@ -172,7 +175,7 @@ class BTemplateLogic extends BaseLogic | ||
| 172 | if($customHtmlInfo === false){ | 175 | if($customHtmlInfo === false){ |
| 173 | $this->fail('定制页面,请先上传代码块'); | 176 | $this->fail('定制页面,请先上传代码块'); |
| 174 | } | 177 | } |
| 175 | - $commonInfo = $this->getCommonHtml($type,$is_list,0);//获取定制头部 | 178 | + $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部 |
| 176 | if($commonInfo !== false){ | 179 | if($commonInfo !== false){ |
| 177 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); | 180 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); |
| 178 | } | 181 | } |
| @@ -182,33 +185,50 @@ class BTemplateLogic extends BaseLogic | @@ -182,33 +185,50 @@ class BTemplateLogic extends BaseLogic | ||
| 182 | } | 185 | } |
| 183 | 186 | ||
| 184 | /** | 187 | /** |
| 185 | - * @remark :根据source获取type类型 | 188 | + * @remark :定制项目获取头部底部 |
| 189 | + * @name :getCustomizedCommonHtml | ||
| 190 | + * @author :lyh | ||
| 191 | + * @method :post | ||
| 192 | + * @time :2023/12/29 13:13 | ||
| 193 | + */ | ||
| 194 | + public function getCustomizedCommonHtml($type){ | ||
| 195 | + $data = [ | ||
| 196 | + 'template_id' => 0, | ||
| 197 | + 'project_id' => $this->user['project_id'], | ||
| 198 | + 'type'=>$type | ||
| 199 | + ]; | ||
| 200 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 201 | + return $commonTemplateModel->read($data); | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + /** | ||
| 205 | + * @remark :定制页面头部类型---根据source获取type类型 | ||
| 186 | * @name :getType | 206 | * @name :getType |
| 187 | * @author :lyh | 207 | * @author :lyh |
| 188 | * @method :post | 208 | * @method :post |
| 189 | * @time :2023/11/16 11:20 | 209 | * @time :2023/11/16 11:20 |
| 190 | */ | 210 | */ |
| 191 | public function getCustomizedType($source,$is_list){ | 211 | public function getCustomizedType($source,$is_list){ |
| 192 | - $type = BTemplate::TYPE_ONE; | 212 | + $type = BTemplate::TYPE_HOME; |
| 193 | if($source == BTemplate::SOURCE_PRODUCT){ | 213 | if($source == BTemplate::SOURCE_PRODUCT){ |
| 194 | if($is_list == BTemplate::IS_LIST){ | 214 | if($is_list == BTemplate::IS_LIST){ |
| 195 | - $type = BTemplate::TYPE_THREE; | 215 | + $type = BTemplate::TYPE_PRODUCT_LIST; |
| 196 | }else{ | 216 | }else{ |
| 197 | - $type = BTemplate::TYPE_TWO; | 217 | + $type = BTemplate::TYPE_PRODUCT_DETAIL; |
| 198 | } | 218 | } |
| 199 | } | 219 | } |
| 200 | if($source == BTemplate::SOURCE_BLOG){ | 220 | if($source == BTemplate::SOURCE_BLOG){ |
| 201 | if($is_list == BTemplate::IS_LIST){ | 221 | if($is_list == BTemplate::IS_LIST){ |
| 202 | - $type = BTemplate::TYPE_FIVE; | 222 | + $type = BTemplate::TYPE_BLOG_LIST; |
| 203 | }else{ | 223 | }else{ |
| 204 | - $type = BTemplate::TYPE_FOUR; | 224 | + $type = BTemplate::TYPE_BLOG_DETAIL; |
| 205 | } | 225 | } |
| 206 | } | 226 | } |
| 207 | if($source == BTemplate::SOURCE_NEWS){ | 227 | if($source == BTemplate::SOURCE_NEWS){ |
| 208 | if($is_list == BTemplate::IS_LIST){ | 228 | if($is_list == BTemplate::IS_LIST){ |
| 209 | - $type = BTemplate::TYPE_SEVEN; | 229 | + $type = BTemplate::TYPE_NEWS_LIST; |
| 210 | }else{ | 230 | }else{ |
| 211 | - $type = BTemplate::TYPE_SIX; | 231 | + $type = BTemplate::TYPE_NEWS_DETAIL; |
| 212 | } | 232 | } |
| 213 | } | 233 | } |
| 214 | return $type; | 234 | return $type; |
| @@ -223,7 +243,7 @@ class BTemplateLogic extends BaseLogic | @@ -223,7 +243,7 @@ class BTemplateLogic extends BaseLogic | ||
| 223 | */ | 243 | */ |
| 224 | public function getSettingTemplate($source,$is_list){ | 244 | public function getSettingTemplate($source,$is_list){ |
| 225 | $template_id = 0; | 245 | $template_id = 0; |
| 226 | - if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION) {//定制项目 | 246 | + if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目 |
| 227 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | 247 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 |
| 228 | //查看当前页面是否定制,是否开启可视化 | 248 | //查看当前页面是否定制,是否开启可视化 |
| 229 | $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 | 249 | $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 |
| @@ -247,8 +267,8 @@ class BTemplateLogic extends BaseLogic | @@ -247,8 +267,8 @@ class BTemplateLogic extends BaseLogic | ||
| 247 | * @method :post | 267 | * @method :post |
| 248 | * @time :2023/10/21 16:55 | 268 | * @time :2023/10/21 16:55 |
| 249 | */ | 269 | */ |
| 250 | - public function getCommonHtml($source,$is_list,$template_id){ | ||
| 251 | - $type = $this->getType($source,$is_list,$template_id); | 270 | + public function getCommonHtml($source,$is_list,$template_id,$is_custom = 0){ |
| 271 | + $type = $this->getType($source,$is_list,$is_custom); | ||
| 252 | $data = [ | 272 | $data = [ |
| 253 | 'template_id' => $template_id, | 273 | 'template_id' => $template_id, |
| 254 | 'project_id' => $this->user['project_id'], | 274 | 'project_id' => $this->user['project_id'], |
| @@ -306,7 +326,7 @@ class BTemplateLogic extends BaseLogic | @@ -306,7 +326,7 @@ class BTemplateLogic extends BaseLogic | ||
| 306 | $this->model->edit($data,$condition); | 326 | $this->model->edit($data,$condition); |
| 307 | } | 327 | } |
| 308 | //更新头部信息 | 328 | //更新头部信息 |
| 309 | - $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id']); | 329 | + $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']); |
| 310 | $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']); | 330 | $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']); |
| 311 | //通知更新 | 331 | //通知更新 |
| 312 | $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); | 332 | $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); |
| @@ -336,7 +356,7 @@ class BTemplateLogic extends BaseLogic | @@ -336,7 +356,7 @@ class BTemplateLogic extends BaseLogic | ||
| 336 | * @time :2023/12/15 10:59 | 356 | * @time :2023/12/15 10:59 |
| 337 | */ | 357 | */ |
| 338 | public function handleVisualizationParam($html,$source, $is_list,$data){ | 358 | public function handleVisualizationParam($html,$source, $is_list,$data){ |
| 339 | - if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//定制项目 | 359 | + if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目 |
| 340 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | 360 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 |
| 341 | //查看当前页面是否定制,是否开启可视化 | 361 | //查看当前页面是否定制,是否开启可视化 |
| 342 | $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 | 362 | $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 |
| @@ -364,8 +384,11 @@ class BTemplateLogic extends BaseLogic | @@ -364,8 +384,11 @@ class BTemplateLogic extends BaseLogic | ||
| 364 | * @method :post | 384 | * @method :post |
| 365 | * @time :2023/12/13 17:05 | 385 | * @time :2023/12/13 17:05 |
| 366 | */ | 386 | */ |
| 367 | - public function saveCommonHtml($html,$source,$is_list,$template_id){ | ||
| 368 | - $type = $this->getType($source,$is_list,$template_id);//获取头部类型1-9(首页到自定义页面) | 387 | + public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){ |
| 388 | + $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) | ||
| 389 | + if($template_id == 0){//定制页面默认为独立头部 | ||
| 390 | + $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部 | ||
| 391 | + } | ||
| 369 | $templateCommonModel = new BTemplateCommon(); | 392 | $templateCommonModel = new BTemplateCommon(); |
| 370 | $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 | 393 | $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 |
| 371 | $handleInfo = $this->handleCommonParam($html); | 394 | $handleInfo = $this->handleCommonParam($html); |
| @@ -440,11 +463,11 @@ class BTemplateLogic extends BaseLogic | @@ -440,11 +463,11 @@ class BTemplateLogic extends BaseLogic | ||
| 440 | * @method :post | 463 | * @method :post |
| 441 | * @time :2023/10/21 17:29 | 464 | * @time :2023/10/21 17:29 |
| 442 | */ | 465 | */ |
| 443 | - public function getType($source,$is_list,$template_id){ | 466 | + public function getType($source,$is_list,$is_custom = 0){ |
| 444 | $type = BTemplate::SOURCE_HOME;//首页公共头部底部 | 467 | $type = BTemplate::SOURCE_HOME;//首页公共头部底部 |
| 445 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | 468 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; |
| 446 | - if($template_id == 0){//保存上传的代码块时,默认为独立头部 | ||
| 447 | - $is_head == BTemplate::IS_HEADER; | 469 | + if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部 |
| 470 | + return $this->success($type); | ||
| 448 | } | 471 | } |
| 449 | //查看页面是否设置自定义头部底部 | 472 | //查看页面是否设置自定义头部底部 |
| 450 | if($is_head != BTemplate::IS_NO_HEADER) { | 473 | if($is_head != BTemplate::IS_NO_HEADER) { |
| @@ -453,17 +476,18 @@ class BTemplateLogic extends BaseLogic | @@ -453,17 +476,18 @@ class BTemplateLogic extends BaseLogic | ||
| 453 | if ($pageInfo === false) { | 476 | if ($pageInfo === false) { |
| 454 | return $this->success($type); | 477 | return $this->success($type); |
| 455 | } | 478 | } |
| 456 | - if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list == 0) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_TWO;}} | ||
| 457 | - else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_THREE;}}} | ||
| 458 | - if ($source == BTemplate::SOURCE_BLOG) {if ($is_list == 0) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_FOUR;}} | ||
| 459 | - else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_FIVE;}}} | ||
| 460 | - if ($source == BTemplate::SOURCE_NEWS) {if ($is_list == 0) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_SIX;}} | ||
| 461 | - else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_SEVEN;}}} | ||
| 462 | - if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_EIGHT;}} | 479 | + if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}} |
| 480 | + else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}} | ||
| 481 | + if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}} | ||
| 482 | + else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}} | ||
| 483 | + if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}} | ||
| 484 | + else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}} | ||
| 485 | + if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}} | ||
| 463 | } | 486 | } |
| 464 | return $this->success($type); | 487 | return $this->success($type); |
| 465 | } | 488 | } |
| 466 | 489 | ||
| 490 | + | ||
| 467 | /** | 491 | /** |
| 468 | * @remark :生成记录 | 492 | * @remark :生成记录 |
| 469 | * @name :setTemplateLog | 493 | * @name :setTemplateLog |
| @@ -581,7 +605,7 @@ class BTemplateLogic extends BaseLogic | @@ -581,7 +605,7 @@ class BTemplateLogic extends BaseLogic | ||
| 581 | $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | 605 | $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); |
| 582 | $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | 606 | $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'); |
| 583 | if(!isset($param['is_custom'])){ | 607 | if(!isset($param['is_custom'])){ |
| 584 | - $param['is_custom'] = BTemplate::SOURCE_NO_CUSTOM; | 608 | + $param['is_custom'] = BTemplate::IS_NO_CUSTOM; |
| 585 | } | 609 | } |
| 586 | $param['type'] = BTemplate::PAGE_HTML;//不显示整个HTML | 610 | $param['type'] = BTemplate::PAGE_HTML;//不显示整个HTML |
| 587 | return $this->success($param); | 611 | return $this->success($param); |
| @@ -285,25 +285,9 @@ class CustomTemplateLogic extends BaseLogic | @@ -285,25 +285,9 @@ class CustomTemplateLogic extends BaseLogic | ||
| 285 | } | 285 | } |
| 286 | //获取type类型 | 286 | //获取type类型 |
| 287 | $commonInfo = $this->getCommonPage($info['template_id']); | 287 | $commonInfo = $this->getCommonPage($info['template_id']); |
| 288 | - $html = ''; | ||
| 289 | - if($commonInfo !== false){ | ||
| 290 | - $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other']. | ||
| 291 | - $commonInfo['head_html'].$preg_html.$commonInfo['footer_html']; | ||
| 292 | - }else{ | ||
| 293 | - //兼容老数据,获取首页数据 | ||
| 294 | - $TemplateInfo = (new BTemplate())->read([ | ||
| 295 | - 'template_id'=>$info['template_id'], | ||
| 296 | - 'source'=>1, | ||
| 297 | - 'project_id'=>$this->user['project_id'], | ||
| 298 | - 'source_id'=>0, | ||
| 299 | - ]);; | ||
| 300 | - if($TemplateInfo !== false){ | ||
| 301 | - $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']); | ||
| 302 | - //内容 | ||
| 303 | - $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html); | ||
| 304 | - } | ||
| 305 | - } | ||
| 306 | - return $html; | 288 | + $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other']. |
| 289 | + $commonInfo['head_html'].$preg_html.$commonInfo['footer_html']; | ||
| 290 | + return $this->success($html); | ||
| 307 | } | 291 | } |
| 308 | 292 | ||
| 309 | /** | 293 | /** |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Http\Logic\Bside\BTemplate; | 10 | namespace App\Http\Logic\Bside\BTemplate; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | +use App\Models\Project\PageSetting; | ||
| 13 | use App\Models\RouteMap\RouteMap; | 14 | use App\Models\RouteMap\RouteMap; |
| 14 | use App\Models\Service\Service as ServiceSettingModel; | 15 | use App\Models\Service\Service as ServiceSettingModel; |
| 15 | use App\Models\Template\BTemplate; | 16 | use App\Models\Template\BTemplate; |
| @@ -47,7 +48,7 @@ class InitHtmlLogic extends BaseLogic | @@ -47,7 +48,7 @@ class InitHtmlLogic extends BaseLogic | ||
| 47 | $main_html = $mainInfo['main_html']; | 48 | $main_html = $mainInfo['main_html']; |
| 48 | $main_style = $mainInfo['main_css']; | 49 | $main_style = $mainInfo['main_css']; |
| 49 | } | 50 | } |
| 50 | - $commonInfo = $this->getTypeCommonHtml($template_id,$this->param['type'],$is_custom,$is_list); //获取头部 | 51 | + $commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部 |
| 51 | $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; | 52 | $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; |
| 52 | $html = $this->getHeadFooter($html);//组装数据 | 53 | $html = $this->getHeadFooter($html);//组装数据 |
| 53 | return $this->success($html); | 54 | return $this->success($html); |
| @@ -109,43 +110,94 @@ class InitHtmlLogic extends BaseLogic | @@ -109,43 +110,94 @@ class InitHtmlLogic extends BaseLogic | ||
| 109 | ]; | 110 | ]; |
| 110 | $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]); | 111 | $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]); |
| 111 | } | 112 | } |
| 112 | - $this->saveDetailCommonHtml($this->param['html'],$this->param['type'],$template_id,$is_custom,$is_list); | 113 | + $this->saveCommonHtml($this->param['html'],$this->param['type'],$is_list,$template_id,$is_custom); |
| 113 | $route = RouteMap::getRoute('all',0,$this->user['project_id']); | 114 | $route = RouteMap::getRoute('all',0,$this->user['project_id']); |
| 114 | $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); | 115 | $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); |
| 115 | return $this->success(); | 116 | return $this->success(); |
| 116 | } | 117 | } |
| 118 | + | ||
| 117 | /** | 119 | /** |
| 118 | - * @remark :保存详情页模版头部底部 | ||
| 119 | - * @name :saveDetailCommonHtml | 120 | + * @remark :保存公共头部底部 |
| 121 | + * @name :saveCommonHtml | ||
| 120 | * @author :lyh | 122 | * @author :lyh |
| 121 | * @method :post | 123 | * @method :post |
| 122 | - * @time :2023/12/15 18:12 | 124 | + * @time :2023/12/13 17:05 |
| 123 | */ | 125 | */ |
| 124 | - public function saveDetailCommonHtml($html,$type,$template_id,$is_custom,$is_list){ | ||
| 125 | - $publicData = $this->handleCommonParam($html); | 126 | + public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){ |
| 127 | + $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) | ||
| 126 | $templateCommonModel = new BTemplateCommon(); | 128 | $templateCommonModel = new BTemplateCommon(); |
| 127 | - //查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部 | ||
| 128 | - $is_head = $this->user['configuration']['is_head'] ?? 0; | ||
| 129 | - if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::扩展模块无独立头部底部 | ||
| 130 | - $is_head = BTemplate::IS_NO_HEADER; | 129 | + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 |
| 130 | + $handleInfo = $this->handleCommonParam($html); | ||
| 131 | + if($commonInfo === false){ | ||
| 132 | + $data = [ | ||
| 133 | + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 134 | + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 135 | + 'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'], | ||
| 136 | + ]; | ||
| 137 | + $templateCommonModel->add($data); | ||
| 138 | + }else{ | ||
| 139 | + $data = [ | ||
| 140 | + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 141 | + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 142 | + ]; | ||
| 143 | + $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | ||
| 131 | } | 144 | } |
| 132 | - if($is_head == BTemplate::IS_HEADER) { | ||
| 133 | - //有独立头部,更新独立头部 | ||
| 134 | - $commonType = $this->getHeaderType($type,$is_list); | ||
| 135 | - $templateCommonInfo = $templateCommonModel->read(['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'type'=>$commonType]); | ||
| 136 | - if($templateCommonInfo === false){ | ||
| 137 | - $publicData['type'] = $type; | ||
| 138 | - $publicData['project_id'] = $this->user['project_id']; | ||
| 139 | - $publicData['template_id'] = $template_id; | ||
| 140 | - $templateCommonModel->add($publicData); | ||
| 141 | - }else{ | ||
| 142 | - $templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]); | 145 | + //更新所有界面的other |
| 146 | + return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * @remark :根据类型获取公共头和底 | ||
| 151 | + * @name :getCommonPage | ||
| 152 | + * @author :lyh | ||
| 153 | + * @method :post | ||
| 154 | + * @time :2023/10/21 16:55 | ||
| 155 | + */ | ||
| 156 | + public function getCommonHtml($source,$is_list,$template_id,$is_custom){ | ||
| 157 | + $type = $this->getType($source,$is_list,$is_custom); | ||
| 158 | + $data = [ | ||
| 159 | + 'template_id' => $template_id, | ||
| 160 | + 'project_id' => $this->user['project_id'], | ||
| 161 | + 'type'=>$type | ||
| 162 | + ]; | ||
| 163 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 164 | + $commonInfo = $commonTemplateModel->read($data); | ||
| 165 | + if($commonInfo === false){ | ||
| 166 | + $data['type'] = BTemplate::SOURCE_HOME; | ||
| 167 | + $commonInfo = $commonTemplateModel->read($data); | ||
| 168 | + } | ||
| 169 | + return $this->success($commonInfo); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 173 | + * @remark :保存时获取获取设置的类型 | ||
| 174 | + * @name :getType | ||
| 175 | + * @author :lyh | ||
| 176 | + * @method :post | ||
| 177 | + * @time :2023/10/21 17:29 | ||
| 178 | + */ | ||
| 179 | + public function getType($source,$is_list,$is_custom = 0){ | ||
| 180 | + $type = BTemplate::SOURCE_HOME;//首页公共头部底部 | ||
| 181 | + $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | ||
| 182 | + if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部 | ||
| 183 | + return $this->success($type); | ||
| 184 | + } | ||
| 185 | + //查看页面是否设置自定义头部底部 | ||
| 186 | + if($is_head != BTemplate::IS_NO_HEADER) { | ||
| 187 | + $pageSettingModel = new PageSetting(); | ||
| 188 | + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 189 | + if ($pageInfo === false) { | ||
| 190 | + return $this->success($type); | ||
| 143 | } | 191 | } |
| 144 | - }else{ | ||
| 145 | - //更新首页头部底部 | ||
| 146 | - $templateCommonModel->edit($publicData,['type'=>BTemplate::SOURCE_HOME,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]); | 192 | + if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}} |
| 193 | + else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}} | ||
| 194 | + if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}} | ||
| 195 | + else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}} | ||
| 196 | + if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}} | ||
| 197 | + else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}} | ||
| 198 | + if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}} | ||
| 147 | } | 199 | } |
| 148 | - return $this->success(); | 200 | + return $this->success($type); |
| 149 | } | 201 | } |
| 150 | 202 | ||
| 151 | /** | 203 | /** |
| @@ -174,8 +226,8 @@ class InitHtmlLogic extends BaseLogic | @@ -174,8 +226,8 @@ class InitHtmlLogic extends BaseLogic | ||
| 174 | * @time :2023/7/27 15:08 | 226 | * @time :2023/7/27 15:08 |
| 175 | */ | 227 | */ |
| 176 | public function getInitModule($type,$is_custom,$is_list){ | 228 | public function getInitModule($type,$is_custom,$is_list){ |
| 177 | - if($is_custom == BTemplate::SOURCE_CUSTOM) { | ||
| 178 | - $type = BTemplate::TYPE_CUSTOM; | 229 | + if($is_custom == BTemplate::IS_CUSTOM) { |
| 230 | + $type = BTemplate::SOURCE_CUSTOM; | ||
| 179 | } | 231 | } |
| 180 | $mainModel = new TemplateTypeMain(); | 232 | $mainModel = new TemplateTypeMain(); |
| 181 | $info = $mainModel->read(['type'=>$type,'is_list'=>$is_list]); | 233 | $info = $mainModel->read(['type'=>$type,'is_list'=>$is_list]); |
| @@ -183,67 +235,6 @@ class InitHtmlLogic extends BaseLogic | @@ -183,67 +235,6 @@ class InitHtmlLogic extends BaseLogic | ||
| 183 | } | 235 | } |
| 184 | 236 | ||
| 185 | /** | 237 | /** |
| 186 | - * @remark :根据type获取头部html | ||
| 187 | - * @name :getHeaderFooter | ||
| 188 | - * @author :lyh | ||
| 189 | - * @method :post | ||
| 190 | - * @time :2023/12/15 18:06 | ||
| 191 | - */ | ||
| 192 | - public function getTypeCommonHtml($template_id,$type,$is_custom,$is_list){ | ||
| 193 | - //判断当前项目是否有设置独立头部的权限 | ||
| 194 | - $is_head = $this->user['configuration']['is_head'] ?? 0; | ||
| 195 | - if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::拓展模块默认取首页 | ||
| 196 | - $is_head = BTemplate::IS_NO_HEADER; | ||
| 197 | - } | ||
| 198 | - //获取首页公共部分 | ||
| 199 | - $templateCommonModel = new BTemplateCommon(); | ||
| 200 | - if($is_head == BTemplate::IS_HEADER) { | ||
| 201 | - //有独立头部,获取独立头部 | ||
| 202 | - $commonType = $this->getHeaderType($type,$is_list); | ||
| 203 | - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$commonType]); | ||
| 204 | - if($commonInfo !== false){ | ||
| 205 | - return $this->success($commonInfo); | ||
| 206 | - } | ||
| 207 | - } | ||
| 208 | - //首页头底 | ||
| 209 | - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>BTemplate::SOURCE_HOME]); | ||
| 210 | - return $this->success($commonInfo); | ||
| 211 | - } | ||
| 212 | - | ||
| 213 | - /** | ||
| 214 | - * @remark :独立头部获取头部底部类型 | ||
| 215 | - * @name :getHeaderType | ||
| 216 | - * @author :lyh | ||
| 217 | - * @method :post | ||
| 218 | - * @time :2023/12/27 11:36 | ||
| 219 | - */ | ||
| 220 | - public function getHeaderType($type,$is_list){ | ||
| 221 | - $resultType = BTemplate::SOURCE_HOME; | ||
| 222 | - if($type == BTemplate::SOURCE_PRODUCT){ | ||
| 223 | - if($is_list == BTemplate::IS_LIST){ | ||
| 224 | - $resultType = BTemplate::TYPE_THREE; | ||
| 225 | - }else{ | ||
| 226 | - $resultType = BTemplate::TYPE_TWO; | ||
| 227 | - } | ||
| 228 | - } | ||
| 229 | - if($type == BTemplate::SOURCE_BLOG){ | ||
| 230 | - if($is_list == BTemplate::IS_LIST){ | ||
| 231 | - $resultType = BTemplate::TYPE_FIVE; | ||
| 232 | - }else{ | ||
| 233 | - $resultType = BTemplate::TYPE_FOUR; | ||
| 234 | - } | ||
| 235 | - } | ||
| 236 | - if($type == BTemplate::SOURCE_NEWS){ | ||
| 237 | - if($is_list == BTemplate::IS_LIST){ | ||
| 238 | - $resultType = BTemplate::TYPE_SEVEN; | ||
| 239 | - }else{ | ||
| 240 | - $resultType = BTemplate::TYPE_SIX; | ||
| 241 | - } | ||
| 242 | - } | ||
| 243 | - return $this->success($resultType); | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - /** | ||
| 247 | * @remark :获取模版id | 238 | * @remark :获取模版id |
| 248 | * @name :getTemplateId | 239 | * @name :getTemplateId |
| 249 | * @author :lyh | 240 | * @author :lyh |
| @@ -142,6 +142,9 @@ class KeywordLogic extends BaseLogic | @@ -142,6 +142,9 @@ class KeywordLogic extends BaseLogic | ||
| 142 | } | 142 | } |
| 143 | try { | 143 | try { |
| 144 | foreach ($this->param['title'] as $k=>$v){ | 144 | foreach ($this->param['title'] as $k=>$v){ |
| 145 | + if(empty($v)){ | ||
| 146 | + continue; | ||
| 147 | + } | ||
| 145 | $this->model = new Keyword(); | 148 | $this->model = new Keyword(); |
| 146 | $info = $this->model->read(['title'=>$v]); | 149 | $info = $this->model->read(['title'=>$v]); |
| 147 | if($info === false){ | 150 | if($info === false){ |
| @@ -480,7 +480,6 @@ class RankDataLogic extends BaseLogic | @@ -480,7 +480,6 @@ class RankDataLogic extends BaseLogic | ||
| 480 | $model->lang = $lang; | 480 | $model->lang = $lang; |
| 481 | $model->data = $data; | 481 | $model->data = $data; |
| 482 | $model->updated_date = date('Y-m-d'); | 482 | $model->updated_date = date('Y-m-d'); |
| 483 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($model, true) . PHP_EOL, FILE_APPEND); | ||
| 484 | $model->save(); | 483 | $model->save(); |
| 485 | } | 484 | } |
| 486 | } | 485 | } |
| @@ -12,35 +12,49 @@ use App\Models\Base; | @@ -12,35 +12,49 @@ use App\Models\Base; | ||
| 12 | */ | 12 | */ |
| 13 | class BTemplate extends Base | 13 | class BTemplate extends Base |
| 14 | { | 14 | { |
| 15 | - const SOURCE_CUSTOM = 1;//自定义模块 | 15 | + /** |
| 16 | + * 模块类型 | ||
| 17 | + */ | ||
| 16 | const SOURCE_HOME = 1;//首页 | 18 | const SOURCE_HOME = 1;//首页 |
| 17 | const SOURCE_PRODUCT = 2;//产品 | 19 | const SOURCE_PRODUCT = 2;//产品 |
| 20 | + | ||
| 18 | const SOURCE_BLOG = 3;//博客 | 21 | const SOURCE_BLOG = 3;//博客 |
| 22 | + | ||
| 19 | const SOURCE_NEWS = 4;//新闻详情页 | 23 | const SOURCE_NEWS = 4;//新闻详情页 |
| 20 | const SOURCE_KEYWORD = 5;//聚合页 | 24 | const SOURCE_KEYWORD = 5;//聚合页 |
| 25 | + const SOURCE_CUSTOM = 7;//自定义模块 | ||
| 21 | 26 | ||
| 27 | + /** | ||
| 28 | + * 拼接数据还是返回整个html | ||
| 29 | + */ | ||
| 22 | const ALL_HTML = 1;//无需拼接数据,获取整个html | 30 | const ALL_HTML = 1;//无需拼接数据,获取整个html |
| 23 | - | ||
| 24 | const PAGE_HTML = 0;//默认保存方式为0, | 31 | const PAGE_HTML = 0;//默认保存方式为0, |
| 25 | - const SOURCE_VISUALIZATION = 1;//定制项目 | ||
| 26 | 32 | ||
| 27 | - const SOURCE_NO_CUSTOM = 0;//默认模块 | ||
| 28 | - const STATUS = 0; | ||
| 29 | - | ||
| 30 | - const TYPE_ONE = 1;//首页类型 | ||
| 31 | - const TYPE_TWO = 2;//产品详情 | ||
| 32 | - const TYPE_THREE = 3;//产品列表 | ||
| 33 | - const TYPE_FOUR = 4;//博客详情 | ||
| 34 | - const TYPE_FIVE = 5;//博客列表 | ||
| 35 | - const TYPE_SIX = 6;//新闻详情 | ||
| 36 | - const TYPE_SEVEN = 7;//新闻列表 | ||
| 37 | - const TYPE_EIGHT = 8;//自定义页面 | ||
| 38 | - | ||
| 39 | - const TYPE_CUSTOM = 7;//扩展详情 | 33 | + /** |
| 34 | + * 独立头部类型 | ||
| 35 | + */ | ||
| 36 | + const TYPE_HOME = 1;//首页类型 | ||
| 37 | + const TYPE_PRODUCT_DETAIL = 2;//产品详情 | ||
| 38 | + const TYPE_PRODUCT_LIST = 3;//产品列表 | ||
| 39 | + const TYPE_BLOG_DETAIL = 4;//博客详情 | ||
| 40 | + const TYPE_BLOG_LIST = 5;//博客列表 | ||
| 41 | + const TYPE_NEWS_DETAIL = 6;//新闻详情 | ||
| 42 | + const TYPE_NEWS_LIST = 7;//新闻列表 | ||
| 43 | + const TYPE_CUSTOM_PAGE = 8;//自定义页面 | ||
| 44 | + /** | ||
| 45 | + * 其他相关定义 | ||
| 46 | + */ | ||
| 40 | const IS_LIST = 1;//列表页 | 47 | const IS_LIST = 1;//列表页 |
| 41 | const IS_HEADER = 1;//独立头部底部 | 48 | const IS_HEADER = 1;//独立头部底部 |
| 42 | const IS_NO_HEADER = 0;//非独立头部底部 | 49 | const IS_NO_HEADER = 0;//非独立头部底部 |
| 50 | + const IS_CUSTOM = 1;//为扩展模块 | ||
| 51 | + const IS_NO_CUSTOM = 0;//为默认模块 | ||
| 52 | + const IS_VISUALIZATION = 1;//定制项目 | ||
| 53 | + const STATUS = 0; | ||
| 43 | 54 | ||
| 55 | + /** | ||
| 56 | + * @var string | ||
| 57 | + */ | ||
| 44 | protected $table = 'gl_web_template'; | 58 | protected $table = 'gl_web_template'; |
| 45 | //连接数据库 | 59 | //连接数据库 |
| 46 | protected $connection = 'custom_mysql'; | 60 | protected $connection = 'custom_mysql'; |
| @@ -110,10 +124,21 @@ class BTemplate extends Base | @@ -110,10 +124,21 @@ class BTemplate extends Base | ||
| 110 | ] | 124 | ] |
| 111 | ]; | 125 | ]; |
| 112 | 126 | ||
| 127 | + /** | ||
| 128 | + * @remark :对用模块类型 | ||
| 129 | + * @name :typeMap | ||
| 130 | + * @author :lyh | ||
| 131 | + * @method :post | ||
| 132 | + * @time :2023/12/29 10:57 | ||
| 133 | + */ | ||
| 113 | public function typeMap() | 134 | public function typeMap() |
| 114 | { | 135 | { |
| 115 | return [ | 136 | return [ |
| 116 | - self::SOURCE_HOME => 'xxxx', | 137 | + 'SOURCE_HOME'=>self::SOURCE_HOME, |
| 138 | + 'SOURCE_PRODUCT'=>self::SOURCE_PRODUCT, | ||
| 139 | + 'SOURCE_BLOG'=>self::SOURCE_BLOG, | ||
| 140 | + 'SOURCE_NEWS'=>self::SOURCE_NEWS, | ||
| 141 | + 'SOURCE_KEYWORD'=>self::SOURCE_KEYWORD, | ||
| 117 | ]; | 142 | ]; |
| 118 | } | 143 | } |
| 119 | } | 144 | } |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | namespace App\Services; | 9 | namespace App\Services; |
| 10 | 10 | ||
| 11 | +use App\Models\CustomModule\CustomModule; | ||
| 11 | use App\Models\Project\Project; | 12 | use App\Models\Project\Project; |
| 12 | use App\Models\RouteMap\RouteMap; | 13 | use App\Models\RouteMap\RouteMap; |
| 13 | use App\Models\Template\BCustomTemplate; | 14 | use App\Models\Template\BCustomTemplate; |
| @@ -102,8 +103,43 @@ class ProjectServer extends BaseService | @@ -102,8 +103,43 @@ class ProjectServer extends BaseService | ||
| 102 | */ | 103 | */ |
| 103 | public static function saveInitParam($project_id){ | 104 | public static function saveInitParam($project_id){ |
| 104 | $created_at = date('Y-m-d H:i:s'); | 105 | $created_at = date('Y-m-d H:i:s'); |
| 106 | + self::initGroup($project_id,$created_at); | ||
| 107 | + //初始化单页 | ||
| 108 | + self::init404Page($project_id); | ||
| 109 | + //初始化模块数据 | ||
| 110 | + self::initModule($project_id); | ||
| 111 | + DB::disconnect('custom_mysql'); | ||
| 112 | + return true; | ||
| 113 | + } | ||
| 105 | 114 | ||
| 106 | - //菜单 | 115 | + /** |
| 116 | + * @remark :初始化模块 | ||
| 117 | + * @name :initModule | ||
| 118 | + * @author :lyh | ||
| 119 | + * @method :post | ||
| 120 | + * @time :2023/12/29 9:34 | ||
| 121 | + */ | ||
| 122 | + public function initModule($project_id){ | ||
| 123 | + $moduleModel = new CustomModule(); | ||
| 124 | + $info = $moduleModel->read(['route'=>'video']); | ||
| 125 | + if($info === false){ | ||
| 126 | + $data = [ | ||
| 127 | + 'name'=>'视频模块', | ||
| 128 | + 'project_id'=>$project_id, | ||
| 129 | + 'route'=>'video', | ||
| 130 | + ]; | ||
| 131 | + $moduleModel->add($data); | ||
| 132 | + } | ||
| 133 | + return true; | ||
| 134 | + } | ||
| 135 | + /** | ||
| 136 | + * @remark :菜单 | ||
| 137 | + * @name :initGroup | ||
| 138 | + * @author :lyh | ||
| 139 | + * @method :post | ||
| 140 | + * @time :2023/12/29 9:30 | ||
| 141 | + */ | ||
| 142 | + public static function initGroup($project_id,$created_at){ | ||
| 107 | $info = DB::connection('custom_mysql')->table('gl_web_nav')->first(); | 143 | $info = DB::connection('custom_mysql')->table('gl_web_nav')->first(); |
| 108 | if(empty($info)) { | 144 | if(empty($info)) { |
| 109 | $data = [ | 145 | $data = [ |
| @@ -116,7 +152,6 @@ class ProjectServer extends BaseService | @@ -116,7 +152,6 @@ class ProjectServer extends BaseService | ||
| 116 | ]; | 152 | ]; |
| 117 | DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); | 153 | DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); |
| 118 | } | 154 | } |
| 119 | - | ||
| 120 | //菜单组 | 155 | //菜单组 |
| 121 | $info = DB::connection('custom_mysql')->table('gl_web_nav_group')->first(); | 156 | $info = DB::connection('custom_mysql')->table('gl_web_nav_group')->first(); |
| 122 | if(empty($info)) { | 157 | if(empty($info)) { |
| @@ -126,11 +161,20 @@ class ProjectServer extends BaseService | @@ -126,11 +161,20 @@ class ProjectServer extends BaseService | ||
| 126 | ]; | 161 | ]; |
| 127 | DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data); | 162 | DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data); |
| 128 | } | 163 | } |
| 164 | + return true; | ||
| 165 | + } | ||
| 129 | 166 | ||
| 130 | - //初始化单页 | 167 | + /** |
| 168 | + * @remark :初始化404页面 | ||
| 169 | + * @name :init404Page | ||
| 170 | + * @author :lyh | ||
| 171 | + * @method :post | ||
| 172 | + * @time :2023/12/29 9:32 | ||
| 173 | + */ | ||
| 174 | + public function init404Page($project_id){ | ||
| 131 | $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first(); | 175 | $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first(); |
| 132 | if(empty($info)) { | 176 | 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> | 177 | + $main_404_html = '<main> |
| 134 | <section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404" | 178 | <section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404" |
| 135 | id="sectionIdyxqu938"> | 179 | id="sectionIdyxqu938"> |
| 136 | <div class="layout" data-unable="demo01-error404"> | 180 | <div class="layout" data-unable="demo01-error404"> |
| @@ -156,7 +200,14 @@ class ProjectServer extends BaseService | @@ -156,7 +200,14 @@ class ProjectServer extends BaseService | ||
| 156 | <script> | 200 | <script> |
| 157 | </script> | 201 | </script> |
| 158 | </section> | 202 | </section> |
| 159 | - </main>', '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' => $created_at, 'updated_at' => $created_at]; | 203 | + </main>'; |
| 204 | + $data = [ | ||
| 205 | + 'project_id' => $project_id, | ||
| 206 | + 'name' => BCustomTemplate::NOT_FOUND_PAGE_URL, | ||
| 207 | + 'status' => 1, | ||
| 208 | + 'url' => BCustomTemplate::NOT_FOUND_PAGE_URL, | ||
| 209 | + 'html' => $main_404_html, | ||
| 210 | + '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' => $created_at, 'updated_at' => $created_at]; | ||
| 160 | $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data); | 211 | $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data); |
| 161 | //路由 | 212 | //路由 |
| 162 | $info = DB::connection('custom_mysql')->table('gl_route_map')->first(); | 213 | $info = DB::connection('custom_mysql')->table('gl_route_map')->first(); |
| @@ -165,8 +216,5 @@ class ProjectServer extends BaseService | @@ -165,8 +216,5 @@ class ProjectServer extends BaseService | ||
| 165 | DB::connection('custom_mysql')->table('gl_route_map')->insert($data); | 216 | DB::connection('custom_mysql')->table('gl_route_map')->insert($data); |
| 166 | } | 217 | } |
| 167 | } | 218 | } |
| 168 | - | ||
| 169 | - DB::disconnect('custom_mysql'); | ||
| 170 | - return true; | ||
| 171 | } | 219 | } |
| 172 | } | 220 | } |
-
请 注册 或 登录 后发表评论