|
...
|
...
|
@@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException; |
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Http\Requests\Scene;
|
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
use App\Models\Template\Setting;
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
...
|
...
|
@@ -127,7 +129,7 @@ class BaseController extends Controller |
|
|
|
* @param bool $objectData
|
|
|
|
* @return JsonResponse
|
|
|
|
*/
|
|
|
|
function success($data) :array
|
|
|
|
function success($data)
|
|
|
|
{
|
|
|
|
return $data;
|
|
|
|
}
|
|
...
|
...
|
@@ -170,4 +172,85 @@ class BaseController extends Controller |
|
|
|
return \Illuminate\Support\Facades\Request::isMethod('post');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取当前用户选择的模版
|
|
|
|
* @name :getTemplateId
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/1/3 10:52
|
|
|
|
*/
|
|
|
|
public function getTemplateId($source,$is_list){
|
|
|
|
$template_id = 0;
|
|
|
|
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)) {//是定制界面
|
|
|
|
return $this->success($template_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$bSettingModel = new Setting();
|
|
|
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($info === false){
|
|
|
|
return $this->success($template_id);
|
|
|
|
}
|
|
|
|
$template_id = $info['template_id'];
|
|
|
|
return $this->success($template_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 :getIsRenovation
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/13 14:02
|
|
|
|
*/
|
|
|
|
public function getIsRenovation($source,$is_list,$template_id,$id){
|
|
|
|
$webTemplateModel = new BTemplate();
|
|
|
|
$param = [
|
|
|
|
'source'=>$source,
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$id,
|
|
|
|
'template_id'=>$template_id,
|
|
|
|
'is_list'=>$is_list
|
|
|
|
];
|
|
|
|
$templateInfo = $webTemplateModel->read($param);
|
|
|
|
if($templateInfo !== false){
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|