BTemplateLogLogic.php
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* @remark :
* @name :BTemplateLogLogic.php
* @author :lyh
* @method :post
* @time :2023/8/23 11:54
*/
namespace App\Http\Logic\Bside\BTemplate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateLog;
class BTemplateLogLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new BTemplateLog();
$this->param = $this->requestAll;
}
/**
* @remark :回滚版本
* @name :saveRollbackVersion
* @author :lyh
* @method :post
* @time :2023/8/23 11:55
*/
public function saveRollbackVersion(){
//获取当前数据详情
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('error');
}
$bTemplateModel = new BTemplate();
//演示项目,不允许其他号码编辑
if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
$this->fail('演示项目仅支持演示功能,无法更改首页');
}
$data = $this->setParam($info);
$BTemplateModel = new BTemplate();
$rs = $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @remark :设置回滚参数
* @name :setParam
* @author :lyh
* @method :post
* @time :2023/8/23 14:18
*/
public function setParam($info){
$data = [
'html'=>$info['text'],
'head_html'=>$info['head_html'],
'head_css'=>$info['head_css'],
'main_html'=>$info['main_html'],
'main_css'=>$info['main_css'],
'footer_html'=>$info['footer_html'],
'footer_css'=>$info['footer_css'],
];
return $this->success($data);
}
/**
* @remark :获取数据详情
* @name :templateLogInfo
* @author :lyh
* @method :post
* @time :2023/9/19 14:42
*/
public function templateLogInfo(){
$info = $this->model->read($this->param);
if($info === false){
$this->fail('当前数据不存在,或已被删除');
}
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
$data = [
'info' => $info,
'header_footer'=>$list,
];
return $this->success($data);
}
}