作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -34,13 +34,14 @@ class BTemplateLogController extends BaseController @@ -34,13 +34,14 @@ class BTemplateLogController extends BaseController
34 */ 34 */
35 public function lists(BTemplateLog $bTemplateLog){ 35 public function lists(BTemplateLog $bTemplateLog){
36 $this->map['project_id'] = $this->user['project_id']; 36 $this->map['project_id'] = $this->user['project_id'];
  37 + $this->map['source'] = 1;
37 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); 38 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']);
38 if(!empty($lists['list'])){ 39 if(!empty($lists['list'])){
39 $templateModel = new Template(); 40 $templateModel = new Template();
40 $userModel = new User(); 41 $userModel = new User();
41 foreach ($lists['list'] as $k => $v){ 42 foreach ($lists['list'] as $k => $v){
42 $v['template_name'] = $templateModel->read(['id'=>$v['template_id']],['name'])['name']; 43 $v['template_name'] = $templateModel->read(['id'=>$v['template_id']],['name'])['name'];
43 - $v['operator_name'] = $userModel->read(['id'=>$v['operator_id']],['name'])['name']; 44 + $v['operator_name'] = $userModel->getName($v['operator_id']);
44 $lists['list'][$k] = $v; 45 $lists['list'][$k] = $v;
45 } 46 }
46 } 47 }
@@ -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 }