作者 lyh

gx

... ... @@ -259,26 +259,31 @@ class BTemplateLogic extends BaseLogic
$this->fail('演示项目仅支持演示功能,无法更改首页');
}
//查询当前模版是否已保存
DB::beginTransaction();
try {
// DB::beginTransaction();
// try {
$info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
//字符串截取
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND);
$this->param = $this->stringProcessing($this->param);
//保存头部信息
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(22222, true) . PHP_EOL, FILE_APPEND);
$this->saveCommonTemplate($this->param);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(33333, true) . PHP_EOL, FILE_APPEND);
$this->param = $this->templateSaveParam($this->param);//组装数据
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(44444, true) . PHP_EOL, FILE_APPEND);
if($info === false){
$this->model->add($this->param);
}else{
$this->model->edit($this->param,['id'=>$info['id']]);
}
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(5555, true) . PHP_EOL, FILE_APPEND);
//写入操作模版记录
$this->setTemplateLog($this->param);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
//通知更新
$this->homeOrProduct($this->param['source'],$this->param['source_id']);
return $this->success();
... ...