作者 lyh

gx

正在显示 40 个修改的文件 包含 1419 行增加613 行删除
... ... @@ -64,12 +64,14 @@ class Demo extends Command
public function handle()
{
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0]);
$list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
DB::table('gl_web_template_com')->truncate();
$templateComModel = new BTemplateCom();
$templateComModel->truncate();
$this->saveTemplateCom($v['id']);
DB::disconnect('custom_mysql');
}
... ...
... ... @@ -43,6 +43,7 @@ class KeywordVideoController extends BaseController
'gl_keyword_video_task.project_id AS project_id',
'gl_keyword_video_task.number AS number',
'gl_keyword_video_task.status AS status',
'gl_keyword_video_task.keywords AS keywords',
'gl_keyword_video_task.sort AS sort',
'gl_keyword_video_task.created_at AS created_at',
'gl_keyword_video_task.updated_at AS updated_at',
... ...
<?php
/**
* @remark :
* @name :ReplaceHtmlController.php
* @author :lyh
* @method :post
* @time :2024/5/8 10:02
*/
namespace App\Http\Controllers\Aside\Template;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Template\ReplaceHtmlLogic;
use App\Models\Template\TemplateReplaceHtml;
use App\Models\Template\TemplateReplaceHtmlLog;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class ReplaceHtmlController extends BaseController
{
/**
* @remark :替换同一种类型的html代码
* @name :replaceTemplateMainHtml
* @author :lyh
* @method :post
* @time :2024/5/7 14:39
*/
public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){
$this->request->validate([
'old_html'=>'required',
'html'=>'required',
'type'=>'required',
'is_list'=>'required',
'is_custom'=>'required',
'project_id'=>'required',
],[
'old_html.required' => '需替换的html不能为空',
'html.required' => 'html不能为空',
'type.required' => '类型type不能为空',
'is_custom.required' => '类型is_custom不能为空',
'is_list.required' => '类型is_list不能为空',
'project_id.required' => 'project_id不能为空',
]);
$logic->replaceHtml();
$this->response('success');
}
/**
* @remark :替换的记录
* @name :replaceTemplateLog
* @author :lyh
* @method :post
* @time :2024/5/8 10:28
*/
public function replaceTemplateLog(TemplateReplaceHtml $replaceModel){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => 'project_id不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
$lists = $replaceModel->lists($this->map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
$templateLogModel = new TemplateReplaceHtmlLog();
foreach ($lists['list'] as $k => $v){
$v['sub'] = $templateLogModel->list(['replace_id'=>$v['id']]);
$lists['list'][$k] = $v;
}
}
DB::disconnect('custom_mysql');
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :还原
* @name :reductionHtml
* @author :lyh
* @method :post
* @time :2024/5/8 10:27
*/
public function reductionHtml(ReplaceHtmlLogic $logic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$logic->reductionHtml();
$this->response('success');
}
}
... ...
... ... @@ -24,7 +24,7 @@ class PageSettingController extends BaseController
*/
public function info(){
$pageSettingModel = new PageSetting();
$info = $pageSettingModel->read(['project_id'=>$this->user['project_id']]);
$info = $pageSettingModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'] ?? 1]);
if($info === false){
$info = [
'project_id'=>$this->user['project_id'],
... ... @@ -36,6 +36,8 @@ class PageSettingController extends BaseController
'news_list'=>0,
'news_details'=>0,
'polymerization'=>0,
'home'=>0,
'type'=>$this->param['type'] ?? 1,
];
$pageSettingModel->add($info);
}
... ... @@ -51,7 +53,7 @@ class PageSettingController extends BaseController
*/
public function edit(){
$pageSettingModel = new PageSetting();
$rs = $pageSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]);
$rs = $pageSettingModel->edit($this->param,['project_id'=>$this->user['project_id'],'type'=>$this->param['type'] ?? 1]);
if($rs === false){
$this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR);
}
... ...
... ... @@ -151,4 +151,17 @@ class BlogCategoryController extends BaseController
//TODO::写入操作日志
$this->response('success');
}
/**
* @remark :批量排序
* @name :allSort
* @author :lyh
* @method :post
* @time :2024/1/11 9:46
*/
public function allSort(BlogCategoryLogic $blogCategoryLogic){
$blogCategoryLogic->setAllSort();
$this->response('success');
}
}
... ...
... ... @@ -298,13 +298,28 @@ class BlogController extends BaseController
$this->request->validate([
'id'=>'required',
'category_id'=>'required',
'status'=>'required'
],[
'id.required' => '产品ID不能为空',
'category_id.required' => '分类ID不能为空',
'status.required'=>'状态不能为空'
]);
$logic->batchSetCategory();
$this->response('success');
}
/**
* @remark :复制新闻
* @name :copyNews
* @author :lyh
* @method :post
* @time :2024/4/28 11:53
*/
public function copyBlog(BlogLogic $blog){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$data = $blog->copyBlogInfo();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\CustomModule;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic;
use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic;
use App\Models\CustomModule\CustomModule;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\Template\BTemplate;
... ... @@ -173,4 +174,18 @@ class CustomModuleCategoryController extends BaseController
$logic->categorySort();
$this->response('success');
}
/**
* @remark :批量排序
* @name :allSort
* @author :lyh
* @method :post
* @time :2024/1/11 9:46
*/
public function allSort(CustomModuleCategoryLogic $logic){
$logic->setAllSort();
$this->response('success');
}
}
... ...
... ... @@ -243,4 +243,28 @@ class CustomModuleContentController extends BaseController
$logic->contentSort();
$this->response('success');
}
/**
* @remark :批量排序
* @name :allSort
* @author :lyh
* @method :post
* @time :2024/1/11 9:46
*/
public function allSort(CustomModuleContentLogic $logic){
$logic->setAllSort();
$this->response('success');
}
/**
* @remark :复制扩展模块
* @name :copyModuleContent
* @author :lyh
* @method :post
* @time :2024/4/28 16:31
*/
public function copyModuleContent(CustomModuleContentLogic $logic){
$logic->copyModuleContentInfo();
$this->response('success');
}
}
... ...
... ... @@ -148,4 +148,17 @@ class NewsCategoryController extends BaseController
$this->response('success');
}
/**
* @remark :批量排序
* @name :allSort
* @author :lyh
* @method :post
* @time :2024/1/11 9:46
*/
public function allSort(NewsCategoryLogic $newsCategoryLogic){
$newsCategoryLogic->setAllSort();
$this->response('success');
}
}
... ...
... ... @@ -281,7 +281,7 @@ class NewsController extends BaseController
/**
* @remark :批量设置产品分类及状态
* @remark :批量设置分类及状态
* @name :batchSetCategory
* @author :lyh
* @method :post
... ... @@ -291,11 +291,9 @@ class NewsController extends BaseController
$this->request->validate([
'id'=>'required',
'category_id'=>'required',
'status'=>'required'
],[
'id.required' => '产品ID不能为空',
'category_id.required' => '分类ID不能为空',
'status.required'=>'状态不能为空'
]);
$logic->batchSetCategory();
$this->response('success');
... ... @@ -338,7 +336,13 @@ class NewsController extends BaseController
* @method :post
* @time :2024/4/28 11:53
*/
public function copyNews(NewsModel $news){
public function copyNews(NewsLogic $news){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$data = $news->copyNewsInfo();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -164,4 +164,17 @@ class CategoryController extends BaseController
$data = $logic->categoryDelete();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :批量更新排序
* @name :allSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:34
*/
public function allSort(CategoryLogic $logic){
$logic->setAllSort();
$this->response('success');
}
}
... ...
... ... @@ -297,7 +297,7 @@ class ProductController extends BaseController
$v = $this->getHandleFileImage($v);
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id'] ?? 0);
$v['url'] = $this->user['domain'].$v['route'] ?? '';
$v['url'] = $this->user['domain'].($v['route'] ?? '');
//获取当前数据扩展字段及值
$v['extend'] = $this->getExtendInfo($v['id']);
return $v;
... ... @@ -433,12 +433,17 @@ class ProductController extends BaseController
* @time :2023/7/29 14:59
*/
public function copyProduct(ProductLogic $logic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$data = $logic->setCopyProduct();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :批量设置产品分类及状态
* @remark :批量设置产品分类
* @name :batchSetCategory
* @author :lyh
* @method :post
... ... @@ -448,11 +453,9 @@ class ProductController extends BaseController
$this->request->validate([
'id'=>'required',
'category_id'=>'required',
'status'=>'required'
],[
'id.required' => '产品ID不能为空',
'category_id.required' => '分类ID不能为空',
'status.required'=>'状态不能为空'
]);
$logic->batchSetCategory();
$this->response('success');
... ...
... ... @@ -51,7 +51,7 @@ class BTemplateController extends BaseController
}
/**
* @remark :获取当前已选择的模板
* @remark :获取可视化数据
* @name :getModuleTemplate
* @author :lyh
* @method :post
... ...
... ... @@ -156,4 +156,21 @@ class CustomTemplateController extends BaseController
$logic->saveRollbackVersion();
$this->response('success');
}
/**
* @remark :复制单页
* @name :copyCustomTemplate
* @author :lyh
* @method :post
* @time :2024/4/28 16:13
*/
public function copyCustomTemplate(CustomTemplateLogic $logic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'ID不能为空',
]);
$logic->copyCustomTemplateInfo();
$this->response('success');
}
}
... ...
... ... @@ -165,14 +165,16 @@ class FileController
*/
public function getOnlyFilename($name,$project_id = 0){
$nameArr = explode('.',$name);
$enName = generateRoute(Translate::tran($nameArr[0], 'en'));
$suffix = array_pop($nameArr) ?? 'jpg';
$nameStr = implode('-', $nameArr);
$enName = generateRoute(Translate::tran($nameStr, 'en'));
$fileName = $enName;
$i=1;
while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){
while($this->onlyName($enName.'.'.$suffix,$project_id)){
$enName = $fileName .'-'.$i;
$i++;
}
return $enName.'.'.$nameArr[1];
return $enName.'.'.$suffix;
}
/**
... ...
... ... @@ -224,15 +224,18 @@ class ImageController extends Controller
* @time :2024/4/26 16:10
*/
public function getOnlyFilename($name,$project_id = 0){
$nameArr = explode('.',$name);
$enName = generateRoute(Translate::tran($nameArr[0], 'en'));
$suffix = array_pop($nameArr) ?? 'jpg';
$nameStr = implode('-', $nameArr);
$enName = generateRoute(Translate::tran($nameStr, 'en'));
$fileName = $enName;
$i=1;
while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){
while($this->onlyName($enName.'.'.$suffix,$project_id)){
$enName = $fileName .'-'.$i;
$i++;
}
return $enName.'.'.$nameArr[1];
return $enName.'.'.$suffix;
}
/**
... ...
... ... @@ -6,6 +6,7 @@ use App\Http\Logic\Aside\BaseLogic;
use App\Models\RouteMap\RouteMap;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateCom;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\Template;
use App\Models\Template\Setting;
... ... @@ -203,25 +204,34 @@ class ATemplateLogic extends BaseLogic
$templateInfo = $this->model->read(['id'=>$template_id]);
ProjectServer::useProject($project_id);
$bTemplateModel = new BTemplate();
$info = $bTemplateModel->read(['source'=>1,'template_id'=>$template_id]);
$info = $bTemplateModel->read(['source'=>BTemplate::SOURCE_HOME,'template_id'=>$template_id]);
if($info === false){
$data = [
'source'=>1, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'],
'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id,
'source'=>BTemplate::SOURCE_HOME, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'],
'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id
];
$bTemplateModel->add($data);
}
//保存一次公共头部信息
$bCommonTemplateModel = new BTemplateCommon();
$commonInfo = $bCommonTemplateModel->read(['template_id'=>$template_id,'type'=>1]);
if($commonInfo === false){
$commonData = [
'type'=>1, 'template_id'=>$template_id, 'head_html'=>$templateInfo['head_html'],
'head_css'=>$templateInfo['head_css'], 'footer_html'=>$templateInfo['footer_html'],
'footer_css'=>$templateInfo['footer_css'],'project_id'=>$project_id,
'other'=>str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"))
];
$bCommonTemplateModel->add($commonData);
//保存一次公共头部+底部+other信息
$bComTemplateModel = new BTemplateCom();
$condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_COM];
$headInfo = $bComTemplateModel->read($condition);
if($headInfo === false){
$headData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id];
$bComTemplateModel->add(array_merge($condition,$headData));
}
$condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_FOOTER,'source'=>BTemplate::SOURCE_COM];
$footerInfo = $bComTemplateModel->read($condition);
if($footerInfo === false){
$footerData = ['html'=>$templateInfo['footer_html'], 'html_style'=>$templateInfo['footer_css'], 'project_id'=>$project_id];
$bComTemplateModel->add(array_merge($condition,$footerData));
}
$condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_OTHER,'source'=>BTemplate::SOURCE_COM];
$footerInfo = $bComTemplateModel->read($condition);
if($footerInfo === false){
$other = str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"));
$otherData = ['html'=>$other, 'html_style'=>'', 'project_id'=>$project_id];
$bComTemplateModel->add(array_merge($condition,$otherData));
}
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $project_id);
DB::disconnect('custom_mysql');
... ...
<?php
/**
* @remark :
* @name :ReplaceHtmlLogic.php
* @author :lyh
* @method :post
* @time :2024/5/8 10:03
*/
namespace App\Http\Logic\Aside\Template;
use App\Http\Logic\aside\BaseLogic;
use App\Models\Template\BTemplate;
use App\Models\Template\TemplateReplaceHtml;
use App\Models\Template\TemplateReplaceHtmlLog;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class ReplaceHtmlLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new TemplateReplaceHtml();
$this->param = $this->requestAll;
}
/**
* @remark :替换可视化的html代码(按类型)
* @name :replaceHtml
* @author :lyh
* @method :post
* @time :2024/5/7 15:52
*/
public function replaceHtml(){
ProjectServer::useProject($this->param['project_id']);
//TODO::生成一条任务记录
$replaceId = $this->saveReplaceHtml($this->param);
//查询当前类型所有装修的记录
$condition = ['source'=>$this->param['type'],'is_custom'=>$this->param['is_custom'],'is_list'=>$this->param['is_list'],
'template_id'=>$this->param['template_id']];
$list = $this->model->list($condition);
foreach ($list as $v){
if($v['type'] == 0){
$main_html = str_replace($this->param['old_html'],$this->param['html'],$v['main_html']);
$this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
}else{
$html = str_replace($this->param['old_html'],$this->param['html'],$v['html']);
$this->model->edit(['html'=>$html],['id'=>$v['id']]);
}
$this->saveReplaceHtmlLog($replaceId,$v['id']);
}
DB::disconnect('custom_mysql');
return $this->success();
}
/**
* @remark :生成一条记录
* @name :saveTemplateLog
* @author :lyh
* @method :post
* @time :2024/5/8 9:23
*/
public function saveReplaceHtml($data,$template_id){
$logData = [
'type'=>$data['type'],
'is_custom'=>$data['is_custom'],
'is_list'=>$data['is_list'],
'template_id'=>$template_id,
'old_html'=>$data['old_html'],
'html'=>$data['html'],
];
return $this->model->addReturnId($logData);
}
/**
* @remark :保存每条替换记录
* @name :saveReplaceHtmlLog
* @author :lyh
* @method :post
* @time :2024/5/8 9:37
*/
public function saveReplaceHtmlLog($replace_id,$replace_template_id){
$logData = [
'replace_id'=>$replace_id,
'replace_template_id'=>$replace_template_id,
'uid'=>$this->user['manager_id'],
];
$replaceHtmlModel = new TemplateReplaceHtmlLog();
return $replaceHtmlModel->add($logData);
}
/**
* @remark :还原所有记录
* @name :reductionHtml
* @author :lyh
* @method :post
* @time :2024/5/8 10:35
*/
public function reductionHtml(){
ProjectServer::useProject($this->param['project_id']);
//获取当前数据详情
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在');
}
$replaceLogModel = new TemplateReplaceHtmlLog();
$logList = $replaceLogModel->list(['replace_id'=>$this->param['id']]);
$replaceArr = [];
foreach ($logList as $v){
$replaceArr[] = $v['replace_template_id'];
}
if(!empty($replaceArr)){
//查询可视化数据
$bTemplateModel = new BTemplate();
$templateList = $bTemplateModel->list(['id'=>['in',$replaceArr]]);
foreach ($templateList as $value){
if($v['type'] == 0){
$main_html = str_replace($info['html'],$info['old_html'],$value['main_html']);
$this->model->edit(['main_html'=>$main_html],['id'=>$v['id']]);
}else{
$html = str_replace($info['html'],$info['old_html'],$value['html']);
$this->model->edit(['html'=>$html],['id'=>$v['id']]);
}
}
}
DB::disconnect('custom_mysql');
return $this->success();
}
}
... ...
... ... @@ -13,6 +13,7 @@ use App\Http\Logic\Bside\BaseLogic;
use App\Models\Project\PageSetting;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateCom;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\BTemplateLog;
use App\Models\Template\Setting;
... ... @@ -64,13 +65,14 @@ class BTemplateLogLogic extends BaseLogic
'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']];
//TODO::还原头部+底部
$bTemplateModel->edit(['html'=>$info['text']],$condition);
$commonData = [
'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'],
'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css']
];
$type = $this->getCustomizedType($info['source'],$info['is_list']);
$commonTemplateModel = new BTemplateCommon();
$commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]);
//还原头部
$condition = ['template_id'=>$info['template_id'],'source'=>$info['source'],
'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom'],'project_id'=>$this->user['project_id']];
$condition['common_type'] = BTemplate::COMMON_HEAD;
$commonTemplateModel->edit(['head'=>$info['head_html'], 'head_style'=>$info['head_css']],$condition);
$condition['common_type'] = BTemplate::COMMON_FOOTER;
$commonTemplateModel->edit(['footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css']],$condition);
return $this->success();
}
... ... @@ -99,18 +101,9 @@ class BTemplateLogLogic extends BaseLogic
$bTemplateModel->edit($data,$condition);
//还原头部+底部
$commonData = [
'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'], 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css']
'head_html'=>$info['head_html'], 'head_style'=>$info['head_css'], 'footer_html'=>$info['footer_html'], 'footer_style'=>$info['footer_css'],'other'=>$info['other']
];
$commonTemplateModel = new BTemplateCommon();
$type = $this->getType($info['source'],$info['is_list'],$info['is_custom']);
$commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]);
if(!empty($info['other'])){
$commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$info['type']]);
}else{
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
$commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$type]);
}
$this->saveTemplateCom($commonData,$info['template_id'],$info['source'],$info['is_list'],$info['is_custom']);
}catch (\Exception $e){
$this->fail('系统错误,请联系管理员');
}
... ... @@ -118,36 +111,40 @@ class BTemplateLogLogic extends BaseLogic
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @remark :保存公共部分(头部。底部。连接部分)
* @name :saveTemplateCom
* @author :lyh
* @method :post
* @time :2023/11/16 11:20
* @time :2024/4/29 10:32
*/
public function getCustomizedType($source,$is_list){
$type = BTemplate::TYPE_HOME;
if($source == BTemplate::SOURCE_PRODUCT){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_PRODUCT_LIST;
}else{
$type = BTemplate::TYPE_PRODUCT_DETAIL;
}
}
if($source == BTemplate::SOURCE_BLOG){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_BLOG_LIST;
public function saveTemplateCom($handleInfo,$template_id,$source,$is_list,$is_custom){
$typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER];
$templateComModel = new BTemplateCom();
foreach ($typeArr as $type){
if($type == BTemplate::COMMON_HEAD){
$param['html'] = $handleInfo['head_html'];
$param['html_style'] = $handleInfo['head_style'];
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);//头部是否为独立头部
}elseif ($type == BTemplate::COMMON_FOOTER){
$param['html'] = $handleInfo['footer_html'];
$param['html_style'] = $handleInfo['footer_style'];
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);
}else{
$type = BTemplate::TYPE_BLOG_DETAIL;
$param['html'] = $handleInfo['other'];
$param['html_style'] = null;
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);
}
}
if($source == BTemplate::SOURCE_NEWS){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_NEWS_LIST;
//查看当前数据是否还存在
$condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type];
$info = $templateComModel->read($condition);
if($info === false){
$data = array_merge($param,$condition);
$templateComModel->add($data);
}else{
$type = BTemplate::TYPE_NEWS_DETAIL;
$templateComModel->edit($param,$condition);
}
}
return $type;
return $this->success();
}
/**
... ... @@ -157,27 +154,30 @@ class BTemplateLogLogic extends BaseLogic
* @method :post
* @time :2023/10/21 17:29
*/
public function getType($source,$is_list,$is_custom = 0){
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
public function getType($source,$is_list,$is_custom = BTemplate::IS_NO_CUSTOM,$CommonType = BTemplate::COMMON_HEAD,$template_id = 0){
if($template_id == 0){//定制全为独立头部和底部
$type = $source;
return $this->success($type);
}
$type = BTemplate::SOURCE_COM;//公共头部底部
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
if($is_custom == BTemplate::IS_CUSTOM || $is_head == BTemplate::IS_NO_HEADER){//拓展模块为首页头部
return $this->success($type);
}
//查看页面是否设置自定义头部底部
if($is_head != BTemplate::IS_NO_HEADER) {
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
if ($pageInfo === false) {
return $this->success($type);
}
if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}}
else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}}
if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}}
else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}}
if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}}
else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}}
if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}}
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id'],'type'=>$CommonType]);
if ($pageInfo === false) {
return $this->success($type);
}
if($source == BTemplate::SOURCE_HOME){if ($pageInfo['home'] != 0){$type = BTemplate::SOURCE_HOME;}}
if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::SOURCE_PRODUCT;}}
else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::SOURCE_PRODUCT;}}}
if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::SOURCE_BLOG;}}
else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::SOURCE_BLOG;}}}
if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::SOURCE_NEWS;}}
else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::SOURCE_NEWS;}}}
if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}}
return $this->success($type);
}
... ...
... ... @@ -15,12 +15,15 @@ use App\Models\Project\PageSetting;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BTemplateCom;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\BTemplateMain;
use App\Models\Template\Setting;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateLog;
use App\Models\Template\Template;
use App\Models\Template\TemplateReplaceHtml;
use App\Models\Template\TemplateReplaceHtmlLog;
use App\Models\Template\TemplateTypeMain;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
... ... @@ -68,11 +71,11 @@ class BTemplateLogic extends BaseLogic
$is_list = $this->param['is_list'] ?? 0;//是否为列表页
$template_id = $this->getSettingTemplate($this->param['source'],$is_list,$is_custom);//设置的模版id
$templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$template_id,$is_custom,$is_list);
if($templateInfo === false){
if($templateInfo === false){//todo::无装修数据处理
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据
$html = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list);
if($html !== false){
return $this->success($html);
$data = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list);
if($data !== false){
return $this->success($data);
}
}
//非定制初始中间部分
... ... @@ -83,15 +86,87 @@ class BTemplateLogic extends BaseLogic
}
$mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
}
$commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取非定制头部
$html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
$commonInfo = $this->getTemplateComHtml($this->param['source'],$is_list,$is_custom,$template_id);//获取非定制头部
$html = $commonInfo['head_style'].$mainInfo['main_css'].$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
$html = $this->getHeadFooter($html);
$result = ['html'=>$html,'template_id'=>$template_id];
if($templateInfo !== false) {$result['id'] = $templateInfo['id'];$result['updated_at'] = $templateInfo['updated_at'];}
if($templateInfo !== false) {
$result['id'] = $templateInfo['id'];
$result['updated_at'] = $templateInfo['updated_at'];
}
return $this->success($result);
}
/**
* @remark :非定制获取头部+底部
* @name :getTemplateComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 16:53
*/
public function getTemplateComHtml($source,$is_list,$is_custom,$template_id){
$condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>'','is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id];
$headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id);
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_OTHER;
$condition['source'] = $headComInfo['source'];
$otherInfo = $bTemplateComModel->read($condition);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员');
}
$footerComInfo = $this->getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id);
$data = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
return $this->success($data);
}
/**
* @remark :公共头部
* @name :HeadComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 17:20
*/
public function getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id){
$commonHead = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id);
$bTemplateComModel = new BTemplateCom();
$condition['source'] = $commonHead;
$condition['common_type'] = BTemplate::COMMON_HEAD;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
//取默认公共的
$condition['source'] = BTemplate::SOURCE_COM;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
$this->fail('获取失败,请联系管理员');
}
}
return $this->success($headComInfo);
}
/**
* @remark :公共底部
* @name :footerComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 17:18
*/
public function getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id){
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_FOOTER;
$condition['source'] = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_FOOTER,$template_id);
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
//取默认首页的
$condition['source'] = BTemplate::SOURCE_COM;
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
$this->fail('获取失败,请联系管理员');
}
}
return $this->success($footerComInfo);
}
/**
* @remark :获取整个html代码
* @name :getCustomizeAllHtml
* @author :lyh
... ... @@ -100,11 +175,11 @@ class BTemplateLogic extends BaseLogic
*/
public function getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list){
if($is_custom == BTemplate::IS_CUSTOM){
$commonInfo = $this->getCustomizedCommonHtml($this->param['source'],$is_custom,$is_list);//获取定制头部
$commonInfo = $this->getCustomizeTemplateComHtml($templateInfo['source'],$is_custom,$is_list);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
}else{
$type = $this->getCustomizedType($this->param['source'],$is_list);
$commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部
$type = $this->getCustomizedType($templateInfo['source'],$is_list);
$commonInfo = $this->getCustomizeTemplateComHtml($type,$is_custom,$is_list);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
}
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
... ... @@ -174,7 +249,7 @@ class BTemplateLogic extends BaseLogic
if($customHtmlInfo === false){
$this->fail('定制页面,请先上传代码块');
}
$commonInfo = $this->getCustomizedCommonHtml($source,$is_custom,$is_list);//获取定制头部
$commonInfo = $this->getCustomizeTemplateComHtml($source,$is_custom,$is_list);//获取定制头部
if($commonInfo !== false){
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
}
... ... @@ -254,7 +329,7 @@ class BTemplateLogic extends BaseLogic
if($customHtmlInfo === false){
$this->fail('定制页面,请先上传代码块');
}
$commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部
$commonInfo = $this->getCustomizeTemplateComHtml($type,$is_custom,$is_list);//获取定制头部
if($commonInfo !== false){
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
}
... ... @@ -263,6 +338,7 @@ class BTemplateLogic extends BaseLogic
return false;
}
/**
* @remark :定制项目获取头部底部
* @name :getCustomizedCommonHtml
... ... @@ -270,49 +346,25 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/29 13:13
*/
public function getCustomizedCommonHtml($type,$is_custom = 0,$is_list = 0){
$data = [
'template_id' => 0,
'project_id' => $this->user['project_id'],
'type'=>$type,
'is_custom'=>$is_custom,
'is_list'=>$is_list
];
$commonTemplateModel = new BTemplateCommon();
return $commonTemplateModel->read($data);
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/11/16 11:20
*/
public function getCustomizedType($source,$is_list){
$type = BTemplate::TYPE_HOME;
if($source == BTemplate::SOURCE_PRODUCT){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_PRODUCT_LIST;
}else{
$type = BTemplate::TYPE_PRODUCT_DETAIL;
}
}
if($source == BTemplate::SOURCE_BLOG){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_BLOG_LIST;
}else{
$type = BTemplate::TYPE_BLOG_DETAIL;
}
}
if($source == BTemplate::SOURCE_NEWS){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_NEWS_LIST;
}else{
$type = BTemplate::TYPE_NEWS_DETAIL;
public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){
$data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>''];
$param = ['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list];
$commonTemplateModel = new BTemplateCom();
$commonList = $commonTemplateModel->list($param);
if(!empty($commonList)){
foreach ($commonList as $v){
if($v['common_type'] == BTemplate::COMMON_HEAD){
$data['head_html'] = $v['html'];
$data['head_style'] = $v['html_style'];
}elseif ($v['common_type'] == BTemplate::COMMON_FOOTER){
$data['footer_html'] = $v['html'];
$data['footer_style'] = $v['html_style'];
}else{
$data['other'] = $v['html'];
}
}
}
return $type;
return $this->success($data);
}
/**
... ... @@ -351,38 +403,10 @@ class BTemplateLogic extends BaseLogic
if($info === false){
$this->fail('请先选择模版');
}
$template_id = $info['template_id'];
return $this->success($template_id);
return $this->success($info['template_id']);
}
/**
* @remark :根据类型获取公共头和底
* @name :getCommonPage
* @author :lyh
* @method :post
* @time :2023/10/21 16:55
*/
public function getCommonHtml($source,$is_list,$template_id,$is_custom = 0){
$type = $this->getType($source,$is_list,$is_custom);
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id'],
'type'=>$type,
'is_custom'=>0,
];
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$data['type'] = BTemplate::SOURCE_HOME;
$commonInfo = $commonTemplateModel->read($data);
}
return $this->success($commonInfo);
}
/**
* @remark :保存修改后的模版
* @name :templateSave
* @author :lyh
... ... @@ -409,14 +433,12 @@ class BTemplateLogic extends BaseLogic
'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'],
'is_list'=>$this->param['is_list']
];
$data = [
'section_list_id'=>$this->param['section_list_id']
];
$data = ['section_list_id'=>$this->param['section_list_id']];
$data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data);
$this->model->edit($data,$condition);
}
//更新头部信息
$this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']);
$this->saveTemplateCom($this->param['html'],$this->param['template_id'],$this->param['source'],$this->param['is_list'],$this->param['is_custom']);
$this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']);
//通知更新
$this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']);
... ... @@ -446,119 +468,70 @@ class BTemplateLogic extends BaseLogic
* @time :2023/12/15 10:59
*/
public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目
//TODO::扩展模块定制单独处理
if($is_custom == BTemplate::IS_CUSTOM){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
//todo::扩展模块(列表页/详情页)定制
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
$data['html'] = $html;
$data['type'] = BTemplate::ALL_HTML;
return $this->success($data);
}
}
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
if (in_array($type, $page_array)) {//当前页面是定制界面
if(in_array($type, $page_array)){
$data['html'] = $html;
$data['type'] = BTemplate::ALL_HTML;
}else{
//TODO::扩展模块定制单独处理
if($is_custom == BTemplate::IS_CUSTOM){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
//todo::扩展模块(列表页/详情页)定制
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
$data['html'] = $html;
$data['type'] = BTemplate::ALL_HTML;
}
}
$mainInfo = $this->handleTemplateHtml($html);
$data['main_html'] = $mainInfo['main_html'];
$data['main_css'] = $mainInfo['main_css'];
return $this->success($data);
}
}else{
$mainInfo = $this->handleTemplateHtml($html);
$data['main_html'] = $mainInfo['main_html'];
$data['main_css'] = $mainInfo['main_css'];
}
return $data;
$data['main_html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
$data['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
return $this->success($data);
}
/**
* @remark :保存公共头部底部
* @name :saveCommonHtml
* @remark :保存公共部分(头部。底部。连接部分)
* @name :saveTemplateCom
* @author :lyh
* @method :post
* @time :2023/12/13 17:05
* @time :2024/4/29 10:32
*/
public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
//TODO::定制扩展模块单独处理
if($is_custom == BTemplate::IS_CUSTOM){
$code = $this->saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id);
if($code === false){
return $this->success();
}
}
//其他情况
$type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
if($template_id == 0){//定制页面默认为独立头部
$type = $this->getCustomizedType($source,$is_list);//定制默认独立头部
}
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>0]);//查看当前头部是否存在
public function saveTemplateCom($html,$template_id,$source,$is_list,$is_custom){
$typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER];
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'],
];
$templateCommonModel->add($data);
}else{
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
];
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
}
//更新所有界面的other
if($template_id != 0){
return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
}
}
/**
* @remark :扩展模块定制保存头部处理
* @name :saveCustomModuleCommonHtml
* @author :lyh
* @method :post
* @time :2024/1/10 11:33
*/
public function saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
//todo::扩展模块(列表页/详情页)定制
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
$data = ['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list,'template_id'=>$template_id];
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read($data);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
'type'=>$source,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'],
'is_custom'=>$is_custom,'is_list'=>$is_list,
];
$templateCommonModel->add($data);
$templateComModel = new BTemplateCom();
foreach ($typeArr as $type){
if($type == BTemplate::COMMON_HEAD){
$param['html'] = $handleInfo['head_html'];
$param['html_style'] = $handleInfo['head_style'];
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);//头部是否为独立头部
}elseif ($type == BTemplate::COMMON_FOOTER){
$param['html'] = $handleInfo['footer_html'];
$param['html_style'] = $handleInfo['footer_style'];
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);
}else{
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
];
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
$param['html'] = $handleInfo['other'];
$param['html_style'] = null;
$typeSource = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id);
}
//查看当前数据是否还存在
$condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type];
$info = $templateComModel->read($condition);
if($info === false){
$data = array_merge($param,$condition);
$templateComModel->add($data);
}else{
$templateComModel->edit($param,$condition);
}
return false;
}
return true;
return $this->success();
}
/**
... ... @@ -587,55 +560,43 @@ class BTemplateLogic extends BaseLogic
//字符串截取
$param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s');
$param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s');
$param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s');
$param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s');
$param['head_style'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s');
$param['footer_style'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s');
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
return $this->success($param);
}
/**
* @remark :保存时字符串处理
* @name :handleSaveParam
* @author :lyh
* @method :post
* @time :2023/6/29 15:35
*/
public function handleTemplateHtml($html){
//字符串截取
$param['main_html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
$param['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
return $this->success($param);
}
/**
* @remark :(非定制)保存时获取获取设置的类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/10/21 17:29
*/
public function getType($source,$is_list,$is_custom = 0){
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
public function getType($source,$is_list,$is_custom = BTemplate::IS_NO_CUSTOM,$CommonType = BTemplate::COMMON_HEAD,$template_id = 0){
if($template_id == 0){
return $this->success($source);
}
$type = BTemplate::SOURCE_COM;//公共头部底部
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
if($is_custom == BTemplate::IS_CUSTOM || $is_head == BTemplate::IS_NO_HEADER){//拓展模块为公共头+底
return $this->success($type);
}
//查看页面是否设置自定义头部底部
if($is_head != BTemplate::IS_NO_HEADER) {
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
if ($pageInfo === false) {
return $this->success($type);
}
if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}}
else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}}
if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}}
else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}}
if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}}
else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}}
if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}}
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id'],'type'=>$CommonType]);
if ($pageInfo === false) {
return $this->success($type);
}
if($source == BTemplate::SOURCE_HOME){if ($pageInfo['home'] != 0){$type = BTemplate::SOURCE_HOME;}}
if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::SOURCE_PRODUCT;}}
else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::SOURCE_PRODUCT;}}}
if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::SOURCE_BLOG;}}
else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::SOURCE_BLOG;}}}
if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::SOURCE_NEWS;}}
else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::SOURCE_NEWS;}}}
if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::SOURCE_KEYWORD;}}
return $this->success($type);
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Models\Project\PageSetting;
use App\Models\RouteMap\RouteMap;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BCustomTemplate;
use App\Models\Template\BTemplateCom;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\BTemplateLog;
use App\Models\Template\Setting;
... ... @@ -49,13 +50,81 @@ class CustomTemplateLogic extends BaseLogic
$this->fail('当前数据不存在');
}
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
$html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
$html = $this->getTemplateComHtml($info['html'],$info['html_style']);
$info['html'] = $this->getHeadFooter($html);
}
return $this->success($info);
}
/**
* @remark :非定制获取头部+底部
* @name :getTemplateComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 16:53
*/
public function getTemplateComHtml($html,$html_style){
$headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD]);
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_OTHER;
$condition['source'] = $headComInfo['source'];
$otherInfo = $bTemplateComModel->read($condition);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员');
}
$footerComInfo = $this->getFooterComHtml();
$commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
$html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html'];
return $this->success($html);
}
/**
* @remark :公共头部
* @name :HeadComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 17:20
*/
public function getHeadComHtml($condition){
$bTemplateComModel = new BTemplateCom();
$condition['source'] = $this->getType();
$condition['common_type'] = BTemplate::COMMON_HEAD;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
//取默认公共的
$condition['source'] = BTemplate::SOURCE_COM;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
$this->fail('获取失败,请联系管理员');
}
}
return $this->success($headComInfo);
}
/**
* @remark :公共底部
* @name :footerComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 17:18
*/
public function getFooterComHtml(){
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_FOOTER;
$condition['source'] = $this->getType(BTemplate::COMMON_FOOTER);
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
//取默认首页的
$condition['source'] = BTemplate::SOURCE_COM;
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
$this->fail('获取失败,请联系管理员');
}
}
return $this->success($footerComInfo);
}
/**
* @remark :保存自定义界面
* @name :customTemplateSave
* @author :lyh
... ... @@ -108,15 +177,16 @@ class CustomTemplateLogic extends BaseLogic
if($bSettingInfo === false){
$this->fail('请先选择模版');
}
$this->saveCommonTemplate($html,$bSettingInfo['template_id']);
$this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
$handleInfo = $this->handleResultParam($html);
$this->saveTemplateCom($handleInfo,$bSettingInfo['template_id']);
$this->param['html'] = $handleInfo['main_html'];
$this->param['html_style'] = $handleInfo['main_style'];
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id'],'project_id'=>$this->user['project_id']]);
if($rs === false){
$this->fail('系统错误,请联系管理');
}
$this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']);
$this->setTemplateLog($bSettingInfo['template_id'],$handleInfo,$this->param['id']);
//通知
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
$this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]);
... ... @@ -131,6 +201,7 @@ class CustomTemplateLogic extends BaseLogic
* @time :2023/8/23 11:16
*/
public function setTemplateLog($template_id,$html,$source_id){
$handleInfo = $this->handleResultParam($html);
$data = [
'template_id'=>$template_id,
'project_id'=>$this->user['project_id'],
... ... @@ -138,71 +209,99 @@ class CustomTemplateLogic extends BaseLogic
'text'=>$html,
'source'=>9,
'source_id'=>$source_id,
'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),
'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),
'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'),
'main_css' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'),
'head_html'=>$handleInfo['head_html'],
'head_css'=>$handleInfo['head_style'],
'footer_html'=>$handleInfo['footer_html'],
'footer_css'=>$handleInfo['footer_style'],
'main_html' => $handleInfo['main_html'],
'main_css' => $handleInfo['main_style'],
'other'=>$handleInfo['other']
];
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
$bTemplateLogModel = new BTemplateLog();
return $bTemplateLogModel->add($data);
}
/**
* @remark :保存头部公共数据
* @name :saveCommonTemplate
* @remark :截取数据返回
* @name :handleResultParam
* @author :lyh
* @method :post
* @time :2023/10/13 14:27
* @time :2024/5/6 14:14
*/
public function saveCommonTemplate($html,$template_id){
$type = $this->getType();
$templateCommonModel = new BTemplateCommon();
$info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
$data = [
public function handleResultParam($html){
$handleInfo = [
'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'),
'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),
'head_style'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),
'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
'footer_style'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'),
'main_style' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'),
];
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
if($info === false){
$data['template_id'] = $template_id;
$data['project_id'] = $this->user['project_id'];
$data['type'] = $type;
$templateCommonModel->add($data);
}else{
$templateCommonModel->edit($data,['id'=>$info['id']]);
$handleInfo['other'] = $other;
return $this->success($handleInfo);
}
/**
* @remark :保存公共部分(头部。底部。连接部分)
* @name :saveTemplateCom
* @author :lyh
* @method :post
* @time :2024/4/29 10:32
*/
public function saveTemplateCom($handleInfo,$template_id){
$typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER];
$templateComModel = new BTemplateCom();
foreach ($typeArr as $type){
if($type == BTemplate::COMMON_HEAD){
$param['html'] = $handleInfo['head_html'];
$param['html_style'] = $handleInfo['head_style'];
$typeSource = $this->getType($type);//头部是否为独立头部
}elseif ($type == BTemplate::COMMON_FOOTER){
$param['html'] = $handleInfo['footer_html'];
$param['html_style'] = $handleInfo['footer_style'];
$typeSource = $this->getType($type);
}else{
$param['html'] = $handleInfo['other'];
$param['html_style'] = null;
$type == BTemplate::COMMON_HEAD;
$typeSource = $this->getType($type);
}
//查看当前数据是否还存在
$condition = ['template_id'=>$template_id,'source'=>$typeSource,'common_type'=>$type];
$info = $templateComModel->read($condition);
if($info === false){
$data = array_merge($param,$condition);
$rs = $templateComModel->add($data);
}else{
$rs = $templateComModel->edit($param,$condition);
}
if($rs === false){
$this->fail('保存错误,请联系管理员');
}
}
//更新所有界面的other
$templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]);
return $this->success();
}
/**
* @remark :获取设置的类型
* @remark :(非定制)保存时获取获取设置的类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/10/21 17:29
*/
public function getType(){
$type = 1;//首页公共头部底部
//查看页面是否设置自定义头部底部
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
if ($pageInfo !== false) {
if ($pageInfo['page_list'] != 0) {
$type = 9;
}
}
public function getType($CommonType = BTemplate::COMMON_HEAD){
$type = BTemplate::SOURCE_COM;//公共头部底部
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
if($is_head == BTemplate::IS_NO_HEADER){
return $this->success($type);
}
return $type;
//查看页面是否设置自定义头部底部
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id'],'type'=>$CommonType]);
if ($pageInfo !== false) {if ($pageInfo['page_list'] != 0) {$type = 9;}}
return $this->success($type);
}
/**
... ... @@ -288,7 +387,7 @@ class CustomTemplateLogic extends BaseLogic
$this->fail('请先设置模版');
}
//获取type类型
$commonInfo = $this->getCommonPage($info['template_id']);
$commonInfo = $this->getType();
$html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other'].
$commonInfo['head_html'].$preg_html.$commonInfo['footer_html'];
return $this->success($html);
... ... @@ -395,7 +494,44 @@ class CustomTemplateLogic extends BaseLogic
}else{
$this->model->edit(['html'=>$logInfo['text']],['id'=>$logInfo['source_id']]);
}
return $this->success();
}
/**
* @remark :复制单页面
* @name :copyCustomTemplateInfo
* @author :lyh
* @method :post
* @time :2024/4/28 16:16
*/
public function copyCustomTemplateInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = $this->setCustomTemplateParams($info);
$save_id = $this->model->insertGetId($param);
$route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$save_id]);
return $this->success(['id'=>$save_id]);
}
/**
* @remark :组装数据
* @name :setCustomTemplateParams
* @author :lyh
* @method :post
* @time :2024/4/28 16:18
*/
public function setCustomTemplateParams($info){
return [
'name'=>$info['name'].'-copy',
'status'=>$info['status'],
'url'=>$info['url'],
'html'=>$info['html'],
'html_style'=>$info['html_style'],
'project_id'=>$info['project_id'],
'section_list_id'=>$info['section_list_id'],
'is_visualization'=>$info['is_visualization'],
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
}
}
... ...
... ... @@ -14,6 +14,7 @@ use App\Models\Project\PageSetting;
use App\Models\RouteMap\RouteMap;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateCom;
use App\Models\Template\BTemplateCommon;
use App\Models\Template\BTemplateMain;
use App\Models\Template\Setting;
... ... @@ -51,14 +52,83 @@ class InitHtmlLogic extends BaseLogic
$data['id'] = $mainInfo['id'];
$data['updated_at'] = $mainInfo['updated_at'];
}
$commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部
$html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
$commonInfo = $this->getTemplateComHtml($this->param['type'],$is_list,$is_custom,$template_id); //获取头部
$html = $commonInfo['head_style'].$main_style.$commonInfo['footer_style'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
$html = $this->getHeadFooter($html);//组装数据
$data['html'] = $html;
return $this->success($data);
}
/**
* @remark :非定制获取头部+底部
* @name :getTemplateComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 16:53
*/
public function getTemplateComHtml($source,$is_list,$is_custom,$template_id){
$condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id];
$headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id);
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_OTHER;
$condition['source'] = $headComInfo['source'];
$otherInfo = $bTemplateComModel->read($condition);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员');
}
$footerComInfo = $this->getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id);
$data = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
return $this->success($data);
}
/**
* @remark :公共头部
* @name :HeadComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 17:20
*/
public function getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id){
$commonHead = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id);
$bTemplateComModel = new BTemplateCom();
$condition['source'] = $commonHead;
$condition['common_type'] = BTemplate::COMMON_HEAD;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
//取默认公共的
$condition['source'] = BTemplate::SOURCE_COM;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
$this->fail('获取失败,请联系管理员');
}
}
return $this->success($headComInfo);
}
/**
* @remark :公共底部
* @name :footerComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 17:18
*/
public function getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id){
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_FOOTER;
$condition['source'] = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_FOOTER,$template_id);
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
//取默认首页的
$condition['source'] = BTemplate::SOURCE_COM;
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
$this->fail('获取失败,请联系管理员');
}
}
return $this->success($footerComInfo);
}
/**
* @remark :拼接获取公共头部底部
* @name :getHeadFooter
* @author :lyh
... ... @@ -114,93 +184,80 @@ class InitHtmlLogic extends BaseLogic
];
$bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]);
}
$this->saveCommonHtml($this->param['html'],$this->param['type'],$is_list,$template_id,$is_custom);
$this->saveTemplateCom($this->param['html'],$template_id,$this->param['type'],$is_list,$is_custom);
$route = RouteMap::getRoute('all',0,$this->user['project_id']);
$this->curlDelRoute(['route'=>$route,'new_route'=>$route]);
return $this->success();
}
/**
* @remark :保存公共头部底部
* @name :saveCommonHtml
* @remark :保存公共部分(头部。底部。连接部分)
* @name :saveTemplateCom
* @author :lyh
* @method :post
* @time :2023/12/13 17:05
* @time :2024/4/29 10:32
*/
public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
$type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
public function saveTemplateCom($html,$template_id,$source,$is_list,$is_custom){
$typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER];
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'],
];
$templateCommonModel->add($data);
}else{
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
];
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
}
//更新所有界面的other
return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
}
/**
* @remark :根据类型获取公共头和底
* @name :getCommonPage
* @author :lyh
* @method :post
* @time :2023/10/21 16:55
*/
public function getCommonHtml($source,$is_list,$template_id,$is_custom){
$type = $this->getType($source,$is_list,$is_custom);
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id'],
'type'=>$type
];
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$data['type'] = BTemplate::SOURCE_HOME;
$commonInfo = $commonTemplateModel->read($data);
$templateComModel = new BTemplateCom();
foreach ($typeArr as $type){
if($type == BTemplate::COMMON_HEAD){
$param['html'] = $handleInfo['head_html'];
$param['html_style'] = $handleInfo['head_style'];
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);//头部是否为独立头部
}elseif ($type == BTemplate::COMMON_FOOTER){
$param['html'] = $handleInfo['footer_html'];
$param['html_style'] = $handleInfo['footer_style'];
$typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);
}else{
$param['html'] = $handleInfo['other'];
$param['html_style'] = null;
$typeSource = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id);
}
//查看当前数据是否还存在
$condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type];
$info = $templateComModel->read($condition);
if($info === false){
$data = array_merge($param,$condition);
$templateComModel->add($data);
}else{
$templateComModel->edit($param,$condition);
}
}
return $this->success($commonInfo);
return $this->success();
}
/**
* @remark :保存时获取获取设置的类型
* @remark :(非定制)保存时获取获取设置的类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/10/21 17:29
*/
public function getType($source,$is_list,$is_custom = 0){
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
public function getType($source,$is_list,$is_custom = BTemplate::IS_NO_CUSTOM,$CommonType = BTemplate::COMMON_HEAD,$template_id = 0){
if($template_id == 0){
return $this->success($source);
}
$type = BTemplate::SOURCE_COM;//公共头部底部
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
if($is_custom == BTemplate::IS_CUSTOM || $is_head == BTemplate::IS_NO_HEADER){//拓展模块为首页头部
return $this->success($type);
}
//查看页面是否设置自定义头部底部
if($is_head != BTemplate::IS_NO_HEADER) {
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
if ($pageInfo === false) {
return $this->success($type);
}
if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}}
else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}}
if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}}
else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}}
if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}}
else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}}
if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}}
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id'],'type'=>$CommonType]);
if ($pageInfo === false) {
return $this->success($type);
}
if($source == BTemplate::SOURCE_HOME){if ($pageInfo['home'] != 0){$type = BTemplate::SOURCE_HOME;}}
if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::SOURCE_PRODUCT;}}
else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::SOURCE_PRODUCT;}}}
if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::SOURCE_BLOG;}}
else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::SOURCE_BLOG;}}}
if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::SOURCE_NEWS;}}
else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::SOURCE_NEWS;}}}
if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::SOURCE_KEYWORD;}}
return $this->success($type);
}
... ... @@ -215,8 +272,8 @@ class InitHtmlLogic extends BaseLogic
//字符串截取
$param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s');
$param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s');
$param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s');
$param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s');
$param['head_style'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s');
$param['footer_style'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s');
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
return $this->success($param);
... ... @@ -269,24 +326,42 @@ class InitHtmlLogic extends BaseLogic
if($info === false){
$html = '';
}else{
//扩展模块获取头部
if($is_custom == BTemplate::IS_CUSTOM){
$type = $this->param['type'];
}else{
$type = $this->getCustomizedType($this->param['type'],$is_list);
}
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);
if($commonInfo !== false){
$info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']);
}
$html = $info['main_html'];
$commonInfo = $this->getCustomizeTemplateComHtml($this->param['type'],$is_custom,$is_list);
$html = $this->handleAllHtml($commonInfo,$info['main_html']);
}
//更新头部底部
return $this->success(['html'=>$html]);
}
/**
* @remark :定制获取头部底部
* @name :getCustomizedCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/29 13:13
*/
public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){
$data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>''];
$param = ['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list];
$commonTemplateModel = new BTemplateCom();
$commonList = $commonTemplateModel->list($param);
if(!empty($commonList)){
foreach ($commonList as $v){
if($v['common_type'] == BTemplate::COMMON_HEAD){
$data['head_html'] = $v['html'];
$data['head_style'] = $v['html_style'];
}elseif ($v['common_type'] == BTemplate::COMMON_FOOTER){
$data['footer_html'] = $v['html'];
$data['footer_style'] = $v['html_style'];
}else{
$data['other'] = $v['html'];
}
}
}
return $this->success($data);
}
/**
* @remark :返回整个html截取代码
* @name :handleAllHtml
* @author :lyh
... ... @@ -329,7 +404,7 @@ class InitHtmlLogic extends BaseLogic
$bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);
}
//更新头部底部
$this->saveCustomizeCommon($this->param['html'],$this->param['type'],$is_list,$is_custom);
$this->saveTemplateCom($this->param['html'],0,$this->param['type'],$is_list,$is_custom);
}catch (\Exception $exception){
$this->fail('保存失败,请联系开发人员');
}
... ... @@ -337,73 +412,6 @@ class InitHtmlLogic extends BaseLogic
}
/**
* @remark :定制代码更新头部信息
* @name :saveCustomizeCommon
* @author :lyh
* @method :post
* @time :2024/1/6 10:29
*/
public function saveCustomizeCommon($html,$source,$is_list,$is_custom){
if($is_custom == BTemplate::IS_CUSTOM){
$type = $source;
}else{
$type = $this->getCustomizedType($source,$is_list);
}
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'],
'is_custom'=>$is_custom,'is_list'=>$is_list
];
$templateCommonModel->add($data);
}else{
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
];
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
}
return $this->success();
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/11/16 11:20
*/
public function getCustomizedType($source,$is_list){
$type = BTemplate::TYPE_HOME;
if($source == BTemplate::SOURCE_PRODUCT){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_PRODUCT_LIST;
}else{
$type = BTemplate::TYPE_PRODUCT_DETAIL;
}
}
if($source == BTemplate::SOURCE_BLOG){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_BLOG_LIST;
}else{
$type = BTemplate::TYPE_BLOG_DETAIL;
}
}
if($source == BTemplate::SOURCE_NEWS){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_NEWS_LIST;
}else{
$type = BTemplate::TYPE_NEWS_DETAIL;
}
}
return $type;
}
/**
* @remark :前端获取设置模块(侧边栏)
* @name :getInitModuleMain
* @author :lyh
... ...
... ... @@ -4,8 +4,11 @@ namespace App\Http\Logic\Bside\Blog;
use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Blog\Blog;
use App\Models\Blog\Blog as BlogModel;
use App\Models\Blog\BlogCategory;
use App\Models\Blog\BlogCategory as BlogCategoryModel;
use App\Models\News\NewsCategory as NewsCategoryModel;
use App\Models\RouteMap\RouteMap;
use Illuminate\Support\Facades\DB;
... ... @@ -90,32 +93,13 @@ class BlogCategoryLogic extends BaseLogic
*/
public function delBlogCategory(){
foreach ($this->param['id'] as $id){
$this->verifyIsDelete($id);
//删除路由
$this->delRoute($id);
$this->model->del(['id'=>$id]);
}
return $this->success();
}
/**
* @remark :验证是否可删除
* @name :VerifyIsDelete
* @author :lyh
* @method :post
* @time :2023/9/7 14:40
*/
public function verifyIsDelete($id){
//查询是否有子分类
$rs = $this->model->read(['pid'=>$id],['id']);
if($rs !== false){
$this->response('当前分类拥有子分类不允许删除');
}
//查看当前分内下是否有博客
$blogModel = new BlogModel();
$rs = $blogModel->read(['category_id'=>['like','%,'.$id.',%']],['id']);
if($rs !== false){
$this->response('当前分类拥有博客,不允许删除');
//同步删除产品字段category_id
$blogModel = new Blog();
$blogModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
$blogModel->edit(['category_id'=>null],['category_id'=>',']);
}
return $this->success();
}
... ... @@ -278,4 +262,19 @@ class BlogCategoryLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :设置批量排序
* @name :setAllSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:40
*/
public function setAllSort(){
foreach ($this->param['data'] as $k => $v){
$this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
}
return $this->success();
}
}
... ...
... ... @@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory as BlogCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Services\CosService;
use Illuminate\Support\Facades\DB;
... ... @@ -16,7 +17,6 @@ class BlogLogic extends BaseLogic
public function __construct()
{
parent::__construct();
$this->model = new Blog();
$this->param = $this->requestAll;
}
... ... @@ -382,15 +382,26 @@ class BlogLogic extends BaseLogic
public function batchSetCategory(){
if(isset($this->param['category_id']) && !empty($this->param['category_id'])) {
DB::connection('custom_mysql')->beginTransaction();
$this->param['category_id'] = ','.implode(',',$this->param['category_id']).',';
$category_id_str = ','.implode(',',$this->param['category_id']).',';
try {
//批量
$param = [
'category_id'=>$this->param['category_id'],
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
DB::connection('custom_mysql')->commit();
if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){
//批量覆盖
$param = [
'category_id'=>$category_id_str,
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
DB::connection('custom_mysql')->commit();
}else{
foreach ($this->param['id'] as $id){
//获取当前产品的分类
$blogInfo = $this->model->read(['id'=>$id],['id','category_id']);
$category_ids = explode(',',trim($blogInfo['category_id'],','));
$category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
$category_ids = ','.implode(',',$category_ids_arr).',';
$this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
}
}
//对应添加关联表
}catch (\Exception $e){
DB::connection('custom_mysql')->rollBack();
... ... @@ -399,4 +410,71 @@ class BlogLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :复制新闻
* @name :copyNewsInfo
* @author :lyh
* @method :post
* @time :2024/4/28 14:51
*/
public function copyBlogInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = [
'name'=>$info['name']."-copy",
'status'=>$info['status'],
'sort'=>$info['sort'],
'category_id'=>$info['category_id'],
'text'=>$info['text'],
'remark'=>$info['remark'],
'url'=>$info['url'],
'label_id'=>$info['label_id'],
'image'=>$info['image'],
'project_id'=>$info['project_id'],
'operator_id'=>$this->user['id'],
'create_id'=>$this->user['id'],
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
$save_id = $this->model->insertGetId($param);
$route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_BLOG, $save_id, $this->user['project_id']);
$this->model->edit(['url'=>$route],['id'=>$save_id]);
//同步可视化装修数据
$this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
return $this->success(['id'=>$save_id]);
}
/**
* @remark :同步模版数据
* @name :copyTemplate
* @author :lyh
* @method :post
* @time :2023/7/29 15:53
*/
public function copyTemplate($id,$project_id,$save_id){
$BTemplateModel = new BTemplate();
$list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_BLOG,'source_id'=>$id,'project_id'=>$project_id]);
if(!empty($list)){
$data = [];
foreach ($list as $v){
$data[] = [
'html'=>$v['html'],
'project_id'=>$project_id,
'source'=>$v['source'],
'source_id'=>$save_id,
'template_id'=>$v['template_id'],
'section_list_id'=>$v['section_list_id'],
'main_html'=>$v['main_html'],
'main_css'=>$v['main_css'],
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
}
$rs = $BTemplateModel->insert($data);
if($rs === false){
$this->fail('error');
}
}
return $this->success();
}
}
... ...
... ... @@ -189,18 +189,13 @@ class CustomModuleCategoryLogic extends BaseLogic
public function categoryDel(){
$ids = $this->param['id'];
foreach ($ids as $id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info !== false){
$this->fail('分类id:'.$id.'拥有子集不允许删除');
}
$contentModel = new CustomModuleContent();
$contentInfo = $contentModel->read(['category_id'=>['like','%,'.$id.',%']]);
if($contentInfo !== false){
$this->fail('当前分类拥有产品不允许删除');
}
//删除路由
$this->delRoute($id);
$this->model->del(['id'=>$id]);
//同步删除产品字段category_id
$contentModel = new CustomModuleContent();
$contentModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
$contentModel->edit(['category_id'=>null],['category_id'=>',']);
}
return $this->success();
}
... ... @@ -238,4 +233,18 @@ class CustomModuleCategoryLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :设置批量排序
* @name :setAllSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:40
*/
public function setAllSort(){
foreach ($this->param['data'] as $k => $v){
$this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
}
return $this->success();
}
}
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\CustomModule\CustomModuleContent;
use App\Models\CustomModule\CustomModuleExtend;
use App\Models\CustomModule\CustomModuleExtentContent;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;
... ... @@ -377,4 +378,106 @@ class CustomModuleContentLogic extends BaseLogic
$contentExtendModel->del(['content_id'=>$id]);
return $this->success();
}
/**
* @remark :设置批量排序
* @name :setAllSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:40
*/
public function setAllSort(){
foreach ($this->param['data'] as $k => $v){
$this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
}
return $this->success();
}
/**
* @remark :复制扩展模块内容页
* @name :copyModuleContentInfo
* @author :lyh
* @method :post
* @time :2024/4/28 16:32
*/
public function copyModuleContentInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = $this->setContentParams($info);
$save_id = $this->model->insertGetId($param);
$this->copyTemplate($this->param['id'],$info['project_id'],$save_id,$info['module_id']);
$this->response('success');
}
/**
* @remark :字段处理
* @name :setContentParams
* @author :lyh
* @method :post
* @time :2024/4/28 16:33
*/
public function setContentParams($info){
return [
'name'=>$info['name'].'-copy',
'status'=>$info['status'],
'sort'=>$info['sort'],
'content'=>$info['content'],
'remark'=>$info['remark'],
'route'=>$info['route'],
'image'=>$info['image'],
'project_id'=>$info['project_id'],
'operator_id'=>$this->user['id'],
'module_id'=>$info['module_id'],
'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '',
'video'=>Arr::a2s($info['video']),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
/**
* @remark :同步模版数据
* @name :copyTemplate
* @author :lyh
* @method :post
* @time :2023/7/29 15:53
*/
public function copyTemplate($id,$project_id,$save_id,$module_id){
$BTemplateModel = new BTemplate();
$list = $BTemplateModel->list(['source'=>$module_id,'source_id'=>$id,'is_custom'=>BTemplate::IS_CUSTOM,'project_id'=>$project_id]);
if(!empty($list)){
$data = [];
foreach ($list as $v){
$data[] = $this->setTemplateParams($v,$project_id,$save_id);
}
$rs = $BTemplateModel->insert($data);
if($rs === false){
$this->fail('error');
}
}
return $this->success();
}
/**
* @remark :组装模版数据
* @name :setTemplateParams
* @author :lyh
* @method :post
* @time :2023/7/29 15:54
*/
public function setTemplateParams($v,$project_id,$save_id){
$param = [
'html'=>$v['html'],
'project_id'=>$project_id,
'source'=>$v['source'],
'source_id'=>$save_id,
'template_id'=>$v['template_id'],
'section_list_id'=>$v['section_list_id'],
'main_html'=>$v['main_html'],
'main_css'=>$v['main_css'],
'is_custom'=>$v['is_custom'],
'created_at'=>$v['created_at'],
'updated_at'=>$v['updated_at']
];
return $this->success($param);
}
}
... ...
... ... @@ -46,7 +46,7 @@ class CountLogic extends BaseLogic
//获取项目的剩余时长
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']);
$info['service_day'] = $this->project['deploy_build']['service_duration'] - $projectInfo['finish_remain_day'];
$info['service_day'] = ($this->project['deploy_build']['service_duration'] ?? 0 - $projectInfo['finish_remain_day'] ?? 0);
$info['compliance_day'] = $projectInfo['finish_remain_day'];
return $this->success($info);
}
... ...
... ... @@ -4,8 +4,10 @@ namespace App\Http\Logic\Bside\News;
use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\News\News;
use App\Models\News\News as NewsModel;
use App\Models\News\NewsCategory as NewsCategoryModel;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use Illuminate\Support\Facades\DB;
... ... @@ -88,19 +90,12 @@ class NewsCategoryLogic extends BaseLogic
*/
public function del_news_category(){
foreach ($this->param['id'] as $id){
//查询是否有子分类
$rs = $this->model->read(['pid'=>$id],['id']);
if($rs !== false){
$this->fail('当前分类拥有子分类不允许删除');
}
//查看当前分内下是否有商品
$newsModel = new NewsModel();
$rs = $newsModel->read(['category_id'=>$id],['id']);
if($rs !== false){
$this->fail('当前分类拥有商品,不允许删除');
}
$this->delRoute($id);
$this->model->del(['id'=>$id]);
//同步删除产品字段category_id
$newsModel = new NewsModel();
$newsModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
$newsModel->edit(['category_id'=>null],['category_id'=>',']);
}
return $this->success();
}
... ... @@ -259,4 +254,18 @@ class NewsCategoryLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :设置批量排序
* @name :setAllSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:40
*/
public function setAllSort(){
foreach ($this->param['data'] as $k => $v){
$this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
}
return $this->success();
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\News\NewsCategory as NewsCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Services\CosService;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;
... ... @@ -270,7 +271,7 @@ class NewsLogic extends BaseLogic
}
/**
* @remark :
* @remark :设置批量排序
* @name :setAllSort
* @author :lyh
* @method :post
... ... @@ -427,16 +428,26 @@ class NewsLogic extends BaseLogic
public function batchSetCategory(){
if(isset($this->param['category_id']) && !empty($this->param['category_id'])) {
DB::connection('custom_mysql')->beginTransaction();
$this->param['category_id'] = ','.implode(',',$this->param['category_id']).',';
$category_id_str = ','.implode(',',$this->param['category_id']).',';
try {
//批量
$param = [
'category_id'=>$this->param['category_id'],
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
DB::connection('custom_mysql')->commit();
//对应添加关联表
if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){
//批量覆盖
$param = [
'category_id'=>$category_id_str,
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
DB::connection('custom_mysql')->commit();
}else{
foreach ($this->param['id'] as $id){
//获取当前产品的分类
$newsInfo = $this->model->read(['id'=>$id],['id','category_id']);
$category_ids = explode(',',trim($newsInfo['category_id'],','));
$category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
$category_ids = ','.implode(',',$category_ids_arr).',';
$this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
}
}
}catch (\Exception $e){
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误,请联系管理员');
... ... @@ -444,4 +455,70 @@ class NewsLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :复制新闻
* @name :copyNewsInfo
* @author :lyh
* @method :post
* @time :2024/4/28 14:51
*/
public function copyNewsInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$param = [
'name'=>$info['name']."-copy",
'status'=>$info['status'],
'sort'=>$info['sort'],
'category_id'=>$info['category_id'],
'text'=>$info['text'],
'remark'=>$info['remark'],
'url'=>$info['url'],
'image'=>$info['image'],
'project_id'=>$info['project_id'],
'operator_id'=>$this->user['id'],
'create_id'=>$this->user['id'],
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
$save_id = $this->model->insertGetId($param);
$route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_NEWS, $save_id, $this->user['project_id']);
$this->model->edit(['url'=>$route],['id'=>$save_id]);
//同步可视化装修数据
$this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
return $this->success(['id'=>$save_id]);
}
/**
* @remark :同步模版数据
* @name :copyTemplate
* @author :lyh
* @method :post
* @time :2023/7/29 15:53
*/
public function copyTemplate($id,$project_id,$save_id){
$BTemplateModel = new BTemplate();
$list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_NEWS,'source_id'=>$id,'project_id'=>$project_id]);
if(!empty($list)){
$data = [];
foreach ($list as $v){
$data[] = [
'html'=>$v['html'],
'project_id'=>$project_id,
'source'=>$v['source'],
'source_id'=>$save_id,
'template_id'=>$v['template_id'],
'section_list_id'=>$v['section_list_id'],
'main_html'=>$v['main_html'],
'main_css'=>$v['main_css'],
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
}
$rs = $BTemplateModel->insert($data);
if($rs === false){
$this->fail('error');
}
}
return $this->success();
}
}
... ...
... ... @@ -168,18 +168,16 @@ class CategoryLogic extends BaseLogic
public function categoryDelete(){
$ids = $this->param['ids'];
foreach ($ids as $id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info !== false){
$this->fail('分类id:'.$id.'拥有子集不允许删除');
}
$productModel = new Product();
$product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]);
if($product_info !== false){
$this->fail('当前分类拥有产品不允许删除');
}
//删除路由
$this->delRoute($id);
$this->model->del(['id'=>$id]);
//同步删除关联表
$categoryRelatedModel = new CategoryRelated();
$categoryRelatedModel->del(['cate_id'=>$id]);
//同步删除产品字段category_id
$productModel = new Product();
$productModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
$productModel->edit(['category_id'=>null],['category_id'=>',']);
}
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
... ... @@ -273,4 +271,18 @@ class CategoryLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :批量设置排序
* @name :setAllSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:40
*/
public function setAllSort(){
foreach ($this->param['data'] as $k => $v){
$this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
}
return $this->success();
}
}
... ...
... ... @@ -335,22 +335,6 @@ class ProductLogic extends BaseLogic
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
* @remark :获取最后一级分类id(数组)
* @name :getLastCategory
* @author :lyh
* @method :post
* @time :2023/10/20 9:02
*/
public function getLastCategoryArr($category){
$arr = [];
if(isset($category) && !empty($category)){
foreach ($category as $v){
$arr[] = $v;
}
}
return $arr;
}
/**
* @remark :编辑产品
... ... @@ -575,27 +559,29 @@ class ProductLogic extends BaseLogic
* @time :2023/8/15 17:53
*/
public function batchSetCategory(){
if(isset($this->param['category_id']) && !empty($this->param['category_id'])) {
DB::connection('custom_mysql')->beginTransaction();
$category_ids = $this->getLastCategoryArr($this->param['category_id']);
$this->param['category_id'] = ','.implode(',',$category_ids).',';
try {
//批量
$param = [
'category_id'=>$this->param['category_id'],
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
if(!isset($this->param['category_id']) || empty($this->param['category_id'])){
$this->fail('请选择分类');
}
try {
if(!isset($this->param['is_cover']) || ($this->param['is_cover'] == 1)){
$category_ids = ','.implode(',',$this->param['category_id']).',';
$this->model->edit(['category_id'=>$category_ids],['id'=>['in',$this->param['id']]]);
//分类关联
foreach ($this->param['id'] as $id){
CategoryRelated::saveRelated($id, $category_ids);
CategoryRelated::saveRelated($id, $this->param['category_id']);
}
}else{
foreach ($this->param['id'] as $id){
//获取当前产品的分类
$productInfo = $this->model->read(['id'=>$id],['id','category_id']);
$category_ids_arr = array_values(array_unique(array_merge($productInfo['category_id'],$this->param['category_id'])));
$category_ids = ','.implode(',',$category_ids_arr).',';
$this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
CategoryRelated::saveRelated($id, $category_ids_arr);
}
DB::connection('custom_mysql')->commit();
//对应添加关联表
}catch (\Exception $e){
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误,请联系管理员');
}
}catch (\Exception $e){
$this->fail('设置分类失败,请联系管理员');
}
return $this->success();
}
... ...
... ... @@ -158,7 +158,9 @@ class UserLoginLogic
$info['aicc'] = $project['aicc'] ?? '';
$info['hagro'] = $project['hagro'] ?? '';
$info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
$info['test_domain'] = $project['deploy_build']['test_domain'] ?? '';
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
$info['is_customized'] = $project['is_customized'];
$info['is_upload_manage'] = $project['is_upload_manage'];
$info['is_upgrade'] = $project['is_upgrade'];
... ... @@ -258,8 +260,9 @@ class UserLoginLogic
$info['hagro'] = $project['hagro'] ?? '';
$info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
$info['is_domain'] = empty($project['deploy_optimize']['domain']) ? 0 : 1;
$info['test_domain'] = $project['deploy_build']['test_domain'] ?? '';
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
$info['is_customized'] = $project['is_customized'];
$info['is_upgrade'] = $project['is_upgrade'];
$info['is_upload_manage'] = $project['is_upload_manage'];
... ...
... ... @@ -52,7 +52,7 @@ class VisitLogic extends BaseLogic
$itemModel = new VisitItem();
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['sub'] = $itemModel->list(['customer_visit_id' => $v['id']]);
$v['sub'] = $itemModel->list(['customer_visit_id' => $v['id']]);
$lists['list'][$k] = $v;
}
}
... ...
... ... @@ -15,6 +15,7 @@ class BTemplate extends Base
/**
* 模块类型
*/
const SOURCE_COM = 99;//公共页面
const SOURCE_HOME = 1;//首页
const SOURCE_PRODUCT = 2;//产品
... ... @@ -29,7 +30,12 @@ class BTemplate extends Base
*/
const ALL_HTML = 1;//无需拼接数据,获取整个html
const PAGE_HTML = 0;//默认保存方式为0,
/**
* 公共头部底部连接部分
*/
const COMMON_HEAD = 1;//公共头部
const COMMON_FOOTER = 2;//公共头部
const COMMON_OTHER = 3;//公共头部
/**
* 独立头部类型
*/
... ... @@ -52,7 +58,7 @@ class BTemplate extends Base
const IS_NO_CUSTOM = 0;//为默认模块
const IS_VISUALIZATION = 1;//定制项目
const IS_NO_VISUALIZATION = 1;//定制项目
const IS_NO_VISUALIZATION = 0;//非定制项目
const STATUS = 0;
/**
... ...
... ... @@ -4,13 +4,24 @@
* @name :BTemplateCom.php
* @author :lyh
* @method :post
<<<<<<< HEAD
* @time :2024/5/7 10:13
=======
* @time :2024/4/29 10:29
>>>>>>> 6ab07f6903cde5505cc85cd6989e6f0401614405
*/
namespace App\Models\Template;
use App\Models\Base;
/**
* @remark :可视化公共部分
* @name :BTemplateCom
* @author :lyh
* @method :post
* @time :2024/4/29 10:29
*/
class BTemplateCom extends Base
{
protected $table = 'gl_web_template_com';
... ...
<?php
/**
* @remark :
* @name :TemplateReplaceHtml.php
* @author :lyh
* @method :post
* @time :2024/5/8 9:05
*/
namespace App\Models\Template;
use App\Models\Base;
class TemplateReplaceHtml extends Base
{
protected $table = 'gl_replace_html';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
<?php
/**
* @remark :
* @name :TemplateReplaceHtmlLog.php
* @author :lyh
* @method :post
* @time :2024/5/8 9:34
*/
namespace App\Models\Template;
use App\Models\Base;
class TemplateReplaceHtmlLog extends Base
{
protected $table = 'gl_replace_html_log';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -133,7 +133,7 @@ class ProjectServer
//初始化模块数据
self::initModule($project_id);
//初始化search页面
self::initSearchPage($project_id);
// self::initSearchPage($project_id);
DB::disconnect('custom_mysql');
return true;
}
... ...
... ... @@ -376,7 +376,12 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/del', [Aside\Template\ATemplateTypeController::class, 'del'])->name('admin.ATemplateType_del');
});
});
//可视化数据替换
Route::prefix('replace')->group(function () {
Route::any('/replaceTemplateMainHtml', [Aside\Template\ReplaceHtmlController::class, 'replaceTemplateMainHtml'])->name('admin.replace_replaceTemplateMainHtml');
Route::any('/replaceTemplateLog', [Aside\Template\ReplaceHtmlController::class, 'replaceTemplateLog'])->name('admin.replace_replaceTemplateLog');
Route::any('/reductionHtml', [Aside\Template\ReplaceHtmlController::class, 'reductionHtml'])->name('admin.replace_reductionHtml');
});
Route::any('/generate_aicc_token', [Aside\Com\IndexController::class, 'generateAiCCToken'])->name('admin.generate_aicc_token');
Route::any('/getAutoToken', [Aside\Com\IndexController::class, 'getAutoToken'])->name('admin.getAutoToken');
... ...
... ... @@ -77,12 +77,14 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info');
Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit');
Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del');
Route::any('/category/allSort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'allSort'])->name('news_category_allSort');
Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort');
Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
//新闻
Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists');
Route::any('/newsNoPage', [\App\Http\Controllers\Bside\News\NewsController::class, 'newsNoPage'])->name('news_newsNoPage');
Route::any('/copyNews', [\App\Http\Controllers\Bside\News\NewsController::class, 'copyNews'])->name('news_copyNews');
Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list');
Route::any('/add', [\App\Http\Controllers\Bside\News\NewsController::class, 'save'])->name('news_add');
Route::any('/edit_seo', [\App\Http\Controllers\Bside\News\NewsController::class, 'edit_seo'])->name('news_edit_seo');
... ... @@ -111,6 +113,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort');
Route::any('/allSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'allSort'])->name('blog_allSort');
Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'batchSetCategory'])->name('blog_batchSetCategory');
Route::any('/copyBlog', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'copyBlog'])->name('blog_copyBlog');
Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum');
//分类
Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists');
... ... @@ -118,6 +121,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info');
Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit');
Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del');
Route::any('/category/allSort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'allSort'])->name('blog_category_allSort');
Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status');
Route::any('/category/sort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'sort'])->name('blog_category_sort');
Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList');
... ... @@ -250,7 +254,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::post('category/save', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'save'])->name('product_category_save');
Route::post('category/sort', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'sort'])->name('product_category_sort');
Route::any('category/delete', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'delete'])->name('product_category_delete');
Route::any('category/allSort', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'allSort'])->name('product_category_allSort');
//产品关键词
Route::get('keyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'index'])->name('product_keyword');
Route::get('keyword/info', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'info'])->name('product_keyword_info');
... ... @@ -353,7 +357,6 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
Route::any('/getSource', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getSource'])->name('template_getSource');
// 模板
Route::prefix('module')->group(function () {
//获取所有左侧模版
... ... @@ -398,6 +401,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del');
Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'rollbackVersion'])->name('custom_rollbackVersion');
Route::any('/getCustomTemplateLog', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'getCustomTemplateLog'])->name('custom_getCustomTemplateLog');
Route::any('/copyCustomTemplate', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'copyCustomTemplate'])->name('custom_copyCustomTemplate');
});
// 菜单组
Route::prefix('nav_group')->group(function () {
... ... @@ -487,6 +491,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save');
Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del');
Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'sort'])->name('custom_category_sort');
Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'allSort'])->name('custom_category_allSort');
});
Route::prefix('content')->group(function () {
... ... @@ -496,6 +501,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'save'])->name('custom_content_save');
Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'sort'])->name('custom_content_sort');
Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del');
Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'allSort'])->name('custom_content_allSort');
Route::any('/copyModuleContent', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'copyModuleContent'])->name('custom_content_copyModuleContent');
});
Route::prefix('extend')->group(function () {
... ...