|
@@ -225,19 +225,29 @@ class CmsContentTemplateSetRepository {
|
|
|
'apply_type'=>$template->apply_type,
|
|
|
];
|
|
|
$templates = $this->cmsContentTemplate->where($where)->get();
|
|
|
+ $update_is_open_ids=[];
|
|
|
foreach ($templates->toArray() as $k=>$v) {
|
|
|
if ($v['is_open'] == 1) {
|
|
|
- $update_open = $this->cmsContentTemplate->where('is_open', 1)->update(['is_open' => 0]);
|
|
|
- if (!$update_open) {
|
|
|
- throw new HttpException(500, '修改失败,请重试');
|
|
|
- }
|
|
|
+ $update_is_open_ids[]=$v['id'];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ $update_open = $this->cmsContentTemplate->whereIn('id', $update_is_open_ids)->update(['is_open' => 0]);
|
|
|
+ if (!$update_open) {
|
|
|
+ throw new HttpException(500, '修改失败,请重试');
|
|
|
+ }
|
|
|
+
|
|
|
$update_tpl = $this->cmsContentTemplate->where('id', $request['tpl_id'])->update(['is_open' => 1]);
|
|
|
if (!$update_tpl) {
|
|
|
throw new HttpException(500, '修改失败,请重试');
|
|
|
}
|
|
|
+ $update_open = $this->cmsContentTemplateSet->whereIn('tpl_id', $update_is_open_ids)->update(['status' => 0]);
|
|
|
+
|
|
|
+ if (!$update_open) {
|
|
|
+ throw new HttpException(500, '修改失败,请重试');
|
|
|
+ }
|
|
|
$res = $this->cmsContentTemplateSet->where('tpl_id',$request['tpl_id'])->update(['status'=>1]);
|
|
|
+
|
|
|
if (!$res){
|
|
|
throw new HttpException(500, '修改失败,请重试');
|
|
|
}
|