|
...
|
...
|
@@ -13,6 +13,7 @@ use App\Models\Template\BSetting; |
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
use App\Models\Template\BTemplateLog;
|
|
|
|
use App\Models\Template\Template;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use mysql_xdevapi\Exception;
|
|
|
|
|
|
...
|
...
|
@@ -56,14 +57,19 @@ class BTemplateLogic extends BaseLogic |
|
|
|
public function getTemplate(){
|
|
|
|
$bSettingModel = new BSetting();
|
|
|
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('请先选择模版');
|
|
|
|
}
|
|
|
|
$TemplateInfo = [];
|
|
|
|
if($info !== false){
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
$TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_PRODUCT){//产品页
|
|
|
|
$TemplateInfo = $this->productHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
$key = 'template_'.$this->user['project_id'].'_'.$this->param['source'].'_'.$this->param['source_id'];
|
|
|
|
if(!empty(Cache::add($key))){
|
|
|
|
$this->fail('当前页面正在装修中');
|
|
|
|
}
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
$TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_PRODUCT){//产品页
|
|
|
|
$TemplateInfo = $this->productHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
return $this->success($TemplateInfo);
|
|
|
|
}
|
...
|
...
|
|