|
@@ -133,18 +133,16 @@ class CmsContentTemplateSetRepository {
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
];
|
|
];
|
|
|
|
|
|
- if ($advertisement_id){
|
|
|
|
|
|
+ if (empty($advertisement_id)){
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
$advertisement_ids = $this->cmsContentTemplateSet->where('id',$advertisement_id)->update($subject);
|
|
$advertisement_ids = $this->cmsContentTemplateSet->where('id',$advertisement_id)->update($subject);
|
|
if (!$advertisement_ids) {
|
|
if (!$advertisement_ids) {
|
|
throw new HttpException(500, '更新失败');
|
|
throw new HttpException(500, '更新失败');
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
- throw new HttpException(500, '添加失败');
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -161,15 +159,16 @@ class CmsContentTemplateSetRepository {
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
];
|
|
];
|
|
- if ($floor_id){
|
|
|
|
|
|
+ if (empty($floor_id)){
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
$floor_ids = $this->cmsContentTemplateSet->where('id',$floor_id)->update($subject);
|
|
$floor_ids = $this->cmsContentTemplateSet->where('id',$floor_id)->update($subject);
|
|
if (!$floor_ids) {
|
|
if (!$floor_ids) {
|
|
throw new HttpException(500, '更新失败');
|
|
throw new HttpException(500, '更新失败');
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
- throw new HttpException(500, '添加失败');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -182,22 +181,22 @@ class CmsContentTemplateSetRepository {
|
|
$category_id = $request['id'] ?? '';
|
|
$category_id = $request['id'] ?? '';
|
|
$subject = [
|
|
$subject = [
|
|
'tpl_id' => $request['tpl_id'],
|
|
'tpl_id' => $request['tpl_id'],
|
|
-// 'rule' => json_encode(json_decode($request['rule'],true)),
|
|
|
|
'rule' => $request['rule'],
|
|
'rule' => $request['rule'],
|
|
'area_type' => $request['area_type'],
|
|
'area_type' => $request['area_type'],
|
|
'status' => 0,
|
|
'status' => 0,
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
'updated_at' => date('Y-m-d H:i:s')
|
|
];
|
|
];
|
|
- if ($category_id){
|
|
|
|
|
|
+ if (empty($category_id)){
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
$category_ids = $this->cmsContentTemplateSet->where('id',$category_id)->update($subject);
|
|
$category_ids = $this->cmsContentTemplateSet->where('id',$category_id)->update($subject);
|
|
if (!$category_ids) {
|
|
if (!$category_ids) {
|
|
throw new HttpException(500, '更新失败');
|
|
throw new HttpException(500, '更新失败');
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
- throw new HttpException(500, '添加失败');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|