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