|
...
|
...
|
@@ -33,16 +33,9 @@ class TemplateController extends BaseController |
|
|
|
* @time 2023/5/9 14:20
|
|
|
|
*/
|
|
|
|
public function index(){
|
|
|
|
|
|
|
|
$limit = intval($this->param['limit']??20);
|
|
|
|
|
|
|
|
|
|
|
|
// 读取列表
|
|
|
|
$data = ATemplate::_bAll($limit)->toArray();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -53,7 +46,6 @@ class TemplateController extends BaseController |
|
|
|
* @time 2023/5/9 15:19
|
|
|
|
*/
|
|
|
|
public function info(){
|
|
|
|
|
|
|
|
// 保存更新
|
|
|
|
if($this->isPost()){
|
|
|
|
$template_id = intval($this->param['template_id']??0);
|
|
...
|
...
|
@@ -64,12 +56,10 @@ class TemplateController extends BaseController |
|
|
|
return $this->response('无法使用不存在的模板',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 读取我的模板
|
|
|
|
$conf = BSetting::_get($this->user['project_id']);
|
|
|
|
// 读取模板信息
|
|
|
|
$data = ATemplate::_bFind($conf['template_id']);
|
|
|
|
|
|
|
|
return $this->success([
|
|
|
|
'template_id' => $data['id']??0,
|
|
|
|
'name' => $data['name']??'',
|
|
...
|
...
|
@@ -78,6 +68,22 @@ class TemplateController extends BaseController |
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :使用模版
|
|
|
|
* @name :read
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/27 15:07
|
|
|
|
*/
|
|
|
|
public function read(TemplateLogic $templateLogic){
|
|
|
|
$this->request->validate([
|
|
|
|
'template_id' => 'required',
|
|
|
|
],[
|
|
|
|
'template_id.required' => 'template_id不能为空'
|
|
|
|
]);
|
|
|
|
$data = $templateLogic->usingTemplates();
|
|
|
|
$this->response('选中模版信息',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 保存模板
|
|
...
|
...
|
@@ -85,19 +91,11 @@ class TemplateController extends BaseController |
|
|
|
* @time 2023/5/10 10:53
|
|
|
|
*/
|
|
|
|
public function save(){
|
|
|
|
|
|
|
|
$html = '<header id="globalso-header" class="web_head sticky-top py-1 py-md-0" style="background-color: #318fff;">asdf</header>';
|
|
|
|
|
|
|
|
// 替换 header
|
|
|
|
$html = preg_replace("/<header(.*)id=\"globalso-header\"(.*)>([\s\S]*)<\/header>/iU",'',$html);
|
|
|
|
$html = preg_replace("/<main(.*)id=\"globalso-main\"(.*)>([\s\S]*)<\/main>/iU",'',$html);
|
|
|
|
$html = preg_replace("/<footer(.*)id=\"globalso-footer\"(.*)>([\s\S]*)<\/footer>/iU",'',$html);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
...
|
...
|
@@ -127,7 +125,6 @@ class TemplateController extends BaseController |
|
|
|
'name' => 'example',
|
|
|
|
];
|
|
|
|
return $this->response('',Code::SUCCESS,$res);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -136,7 +133,6 @@ class TemplateController extends BaseController |
|
|
|
* @time 2023/5/11 11:00
|
|
|
|
*/
|
|
|
|
public function save_html(TemplateRequest $request){
|
|
|
|
|
|
|
|
$data = $request->validated();
|
|
|
|
$data['data_source'] = $data['source'];
|
|
|
|
$data['data_source_id'] = $data['source_id'];
|
|
...
|
...
|
@@ -160,10 +156,8 @@ class TemplateController extends BaseController |
|
|
|
unset($info['css']);
|
|
|
|
unset($info['script']);
|
|
|
|
unset($info['data_ext']);
|
|
|
|
|
|
|
|
return $this->success($info,Code::SUCCESS,'保存成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->response('保存失败',Code::SYSTEM_ERROR);
|
|
|
|
|
|
|
|
}
|
|
...
|
...
|
@@ -178,11 +172,8 @@ class TemplateController extends BaseController |
|
|
|
* @time 2023/5/15 14:43
|
|
|
|
*/
|
|
|
|
public function status(TemplateRequest $request){
|
|
|
|
|
|
|
|
$data = $request->validated();
|
|
|
|
|
|
|
|
TemplateLogic::instance()->status($data['source'],$data['source_id'],$data['status']);
|
|
|
|
|
|
|
|
return $this->response('保存成功');
|
|
|
|
|
|
|
|
}
|
|
...
|
...
|
@@ -194,14 +185,12 @@ class TemplateController extends BaseController |
|
|
|
* @time 2023/5/10 14:55
|
|
|
|
*/
|
|
|
|
public function chunk(){
|
|
|
|
|
|
|
|
$lists = TemplateChunkLogic::instance()->getList([['status','=',1]],['sort'=>'asc'],['*'],false);
|
|
|
|
foreach ($lists as &$list){
|
|
|
|
unset($list['created_at']);
|
|
|
|
unset($list['updated_at']);
|
|
|
|
unset($list['status']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success($lists);
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|