作者 李宇航

合并分支 'develop' 到 'master'

Develop



查看合并请求 !352
... ... @@ -65,6 +65,7 @@ class OnlineController extends BaseController
'gl_project.channel AS channel',
'gl_project.type AS type',
'gl_project.created_at AS created_at',
'gl_project.is_upgrade AS is_upgrade',
'gl_project_online_check.id AS online_check_id',
'gl_project_online_check.question AS question',
'gl_project_online_check.optimist_status AS optimist_status',
... ... @@ -145,6 +146,9 @@ class OnlineController extends BaseController
if(isset($this->map['all_status'])){
$query->where('gl_project_online_check.qa_status',$this->map['all_status']);
}
if(isset($this->map['is_upgrade'])){
$query->where('gl_project.is_upgrade',$this->map['is_upgrade']);
}
if(isset($this->map['optimist_status'])){
$query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']);
}
... ...
... ... @@ -133,6 +133,7 @@ class OptimizeController extends BaseController
'gl_project.robots AS robots',
'gl_project.is_translate AS is_translate',
'gl_project.is_translate_tag AS is_translate_tag',
'gl_project.is_upgrade AS is_upgrade',
'gl_project_online_check.id AS online_check_id',
'gl_project_online_check.question AS question',
'gl_project_online_check.go_question AS go_question',
... ... @@ -191,6 +192,9 @@ class OptimizeController extends BaseController
if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){
$query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%');
}
if(isset($this->map['is_upgrade']) && !empty($this->map['is_upgrade'])){
$query = $query->where('gl_project.is_upgrade',$this->map['is_upgrade']);
}
if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){
$query = $query->where('gl_project_deploy_optimize.tech_mid','like','%'.$this->map['optimize_tech_mid'].'%');
}
... ...
... ... @@ -240,7 +240,7 @@ class ProductController extends BaseController
}
$v['status_text'] = Product::statusMap()[$v['status']] ?? '';
//获取当前用户选择的模版
$v['video'] = json_decode($v['video']);
$v['video'] = json_decode($v['video'] ?? '');
$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']);
$v['url'] = $this->user['domain'].$v['route'];
... ... @@ -421,4 +421,16 @@ class ProductController extends BaseController
$logic->setSort();
$this->response('success');
}
/**
* @remark :批量更新排序
* @name :allSort
* @author :lyh
* @method :post
* @time :2024/1/10 15:34
*/
public function allSort(ProductLogic $logic){
$logic->setAllSort();
$this->response('success');
}
}
... ...
... ... @@ -66,43 +66,118 @@ class BTemplateLogic extends BaseLogic
public function getTemplateHtml(){
$is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
$is_list = $this->param['is_list'] ?? 0;//是否为列表页
$template_id = $this->getSettingTemplate($this->param['source'],$is_list);//设置的模版id
$templateInfo = $this->model->read([
'template_id'=>$template_id, 'source'=>$this->param['source'],
'project_id'=>$this->user['project_id'], 'source_id'=>$this->param['source_id'],
'is_custom'=>$is_custom, 'is_list'=>$is_list
]);
$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($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据
$html = $this->isCustomizedPage($this->param['source'],$is_list);//获取定制页面的html
if(!empty($html)){
return $this->success(['html'=>$html,'template_id'=>$template_id]);
$html = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list);
if($html !== false){
return $this->success($html);
}
}
//非定制初始中间部分
$mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码
}else{
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
$type = $this->getCustomizedType($this->param['source'],$is_list);
$commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
return $this->getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list);
}
$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->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'];
$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 :获取整个html代码
* @name :getCustomizeAllHtml
* @author :lyh
* @method :post
* @time :2024/1/10 14:15
*/
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);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
}else{
$type = $this->getCustomizedType($this->param['source'],$is_list);
$commonInfo = $this->getCustomizedCommonHtml($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']]);
}
/**
* @remark :获取装修详情
* @name :webTemplateInfo
* @author :lyh
* @method :post
* @time :2024/1/10 13:43
*/
public function webTemplateInfo($source,$source_id,$template_id,$is_custom,$is_list){
$templateInfo = $this->model->read([
'template_id'=>$template_id, 'source'=>$source,
'project_id'=>$this->user['project_id'], 'source_id'=>$source_id,
'is_custom'=>$is_custom, 'is_list'=>$is_list
]);
return $this->success($templateInfo);
}
/**
* @remark :定制页面获取html
* @name :customizedReturnHtml
* @author :lyh
* @method :post
* @time :2024/1/10 13:46
*/
public function customizedReturnHtml($source,$template_id,$is_custom,$is_list){
//TODO::扩展模块定制单独处理
if($is_custom == BTemplate::IS_CUSTOM){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
//扩展模块定制
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION){
$html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom);
return $this->success(['html'=>$html,'template_id'=>$template_id]);
}
return false;
}
//TODO::默认模块定制
$html = $this->isCustomizedPage($source,$is_list);//获取定制页面的html
if(!empty($html)){
return $this->success(['html'=>$html,'template_id'=>$template_id]);
}
return false;
}
/**
* @remark :扩展模块定制html
* @name :customModuleInfo
* @author :lyh
* @method :post
* @time :2024/1/10 9:20
*/
public function customModuleCustomizeHtml($source,$is_list,$is_custom){
$bTemplateMainModel = new BTemplateMain();
//TODO::获取初始代码
$customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom]);
if($customHtmlInfo === false){
$this->fail('定制页面,请先上传代码块');
}
$commonInfo = $this->getCustomizedCommonHtml($source,$is_custom,$is_list);//获取定制头部
if($commonInfo !== false){
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
}
return $customHtmlInfo['main_html'];
}
/**
* @remark :获取中间部分的html
* @name :getMAinHtml
* @author :lyh
... ... @@ -163,7 +238,7 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/13 10:55
*/
public function isCustomizedPage($source,$is_list)
public function isCustomizedPage($source,$is_list,$is_custom)
{
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
... ... @@ -171,17 +246,17 @@ class BTemplateLogic extends BaseLogic
if (in_array($type, $page_array)) {//是定制界面
//TODO::获取初始代码
$bTemplateMainModel = new BTemplateMain();
$customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list]);
$customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list]);
if($customHtmlInfo === false){
$this->fail('定制页面,请先上传代码块');
}
$commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部
$commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部
if($commonInfo !== false){
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
}
return $customHtmlInfo['main_html'];
}
return [];
return false;
}
/**
... ... @@ -191,11 +266,13 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/29 13:13
*/
public function getCustomizedCommonHtml($type){
public function getCustomizedCommonHtml($type,$is_custom = 0,$is_list = 0){
$data = [
'template_id' => 0,
'project_id' => $this->user['project_id'],
'type'=>$type
'type'=>$type,
'is_custom'=>$is_custom,
'is_list'=>$is_list
];
$commonTemplateModel = new BTemplateCommon();
return $commonTemplateModel->read($data);
... ... @@ -241,9 +318,19 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/13 10:48
*/
public function getSettingTemplate($source,$is_list){
public function getSettingTemplate($source,$is_list,$is_custom){
$template_id = 0;
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目
if($is_custom == BTemplate::IS_CUSTOM){
$customModuleModel = new CustomModule();
$info = $customModuleModel->read(['id'=>$source]);
if($info === false){
$this->fail('当前扩展模块不存在或已被删除');
}
if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION){
return $this->success($template_id);
}
}else{
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
... ... @@ -251,6 +338,7 @@ class BTemplateLogic extends BaseLogic
return $this->success($template_id);
}
}
}
$bSettingModel = new Setting();
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
if($info === false){
... ... @@ -272,7 +360,8 @@ class BTemplateLogic extends BaseLogic
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id'],
'type'=>$type
'type'=>$type,
'is_custom'=>$is_custom,
];
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read($data);
... ... @@ -294,16 +383,10 @@ class BTemplateLogic extends BaseLogic
* @time :2023/6/29 11:05
*/
public function templateSave(){
//演示项目不允许修改
//TODO::演示项目不允许修改
$this->showProjectNoEdit($this->param['source']);
$this->param = $this->handleDefaultString($this->param);//设置默认数据
$templateInfo = $this->model->read([
'template_id'=>$this->param['template_id'],
'source'=>$this->param['source'],
'source_id'=>$this->param['source_id'],
'is_custom'=>$this->param['is_custom'],
'is_list'=>$this->param['is_list']
]);
$templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']);
if($templateInfo === false){//执行新增
$data = [
'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],'type'=>BTemplate::PAGE_HTML,
... ... @@ -311,7 +394,7 @@ class BTemplateLogic extends BaseLogic
'section_list_id'=>$this->param['section_list_id'],'is_custom'=>$this->param['is_custom'],
'is_list'=>$this->param['is_list']
];
$data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data);
$data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data);
$this->model->add($data);
}else{//执行编辑
$condition = [
... ... @@ -322,7 +405,7 @@ class BTemplateLogic extends BaseLogic
$data = [
'section_list_id'=>$this->param['section_list_id']
];
$data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data);
$data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data);
$this->model->edit($data,$condition);
}
//更新头部信息
... ... @@ -355,7 +438,7 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/15 10:59
*/
public function handleVisualizationParam($html,$source, $is_list,$data){
public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
... ... @@ -364,6 +447,19 @@ class BTemplateLogic extends BaseLogic
$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'];
... ... @@ -376,7 +472,6 @@ class BTemplateLogic extends BaseLogic
return $data;
}
/**
* @remark :保存公共头部底部
* @name :saveCommonHtml
... ... @@ -385,12 +480,20 @@ class BTemplateLogic extends BaseLogic
* @time :2023/12/13 17:05
*/
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]);//查看当前头部是否存在
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>0]);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
... ... @@ -411,6 +514,45 @@ class BTemplateLogic extends BaseLogic
}
/**
* @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);
}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']]);
}
return false;
}
return true;
}
/**
* @remark :演示项目不允许修改首页
* @name :showProject
* @author :lyh
... ... @@ -457,7 +599,7 @@ class BTemplateLogic extends BaseLogic
return $this->success($param);
}
/**
* @remark :保存时获取获取设置的类型
* @remark :(非定制)保存时获取获取设置的类型
* @name :getType
* @author :lyh
* @method :post
... ...
... ... @@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic
}
/**
* @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();
}
/**
* 产品导入
* @param $project_id
* @param $user_id
... ... @@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic
if($data[10]??''){
$seo_description = substr(strip_tags($data[10]),0,200);
}
$seo_mate = [
'title' => $seo_title,
'keyword' => $seo_keywords,
'description' => $seo_description
];
//处理参数
$attrs = [];
if($data[4]??''){
... ... @@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic
}
}
}
//处理描述切换栏
$describe = [];
for ($i=11;$i<=20;$i+=2){
if(($data[$i]??'') && ($data[$i+1]??'')){
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc);
... ... @@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic
$new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]);
}
}
preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video);
if($result_desc_video[2]??[]){
foreach ($result_desc_video[2] as $vdesc_video){
... ... @@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic
break;
}
}
$id = $this->model->addReturnId(
[
'project_id' => $project_id,
... ... @@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic
'status' => Product::STATUS_ON
]
);
//更新路由
if($route){
$route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first();
... ... @@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic
}else{
$route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
}
$this->edit(['route' => $route], ['id' => $id]);
//关联分类
if($category_arr){
CategoryRelated::saveRelated($id, $category_arr);
}
return true;
}
return false;
}
}
... ...
... ... @@ -204,6 +204,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save');
Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList');
Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort');
Route::post('/allSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'allSort'])->name('product_allSort');
Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete');
Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum');
Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct');
... ...