|
@@ -1124,18 +1124,10 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if(empty($template)){
|
|
|
return Result::error('皮肤不存在!');
|
|
|
}
|
|
|
- // 皮肤相关信息
|
|
|
- $data['template_name'] = $template['template_name'];
|
|
|
- $data['template_id'] = $template['template_id'];
|
|
|
- // 风格相关信息
|
|
|
- $template_class = TemplateClass::where('class_id',$template['template_class_id'])->first();
|
|
|
- if(empty($template_class)){
|
|
|
- return Result::error('所属风格不存在!');
|
|
|
- }
|
|
|
- // $data['sector_keyword'] = json_encode($data['sector_keyword']);
|
|
|
- $data['template_class_id'] = $template_class['class_id'];
|
|
|
- $data['template_class_name'] = $template_class['name'];
|
|
|
-
|
|
|
+ $sector_id = Sector::where('sector_id',$data['sector_id'])->first();
|
|
|
+ if(!empty($sector_id)){
|
|
|
+ return Result::error('通栏编号已存在!');
|
|
|
+ }
|
|
|
$result = Sector::insertGetId($data);
|
|
|
if(empty($result)){
|
|
|
return Result::error('添加失败');
|
|
@@ -1172,6 +1164,12 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if(empty($sector)){
|
|
|
return Result::error('通栏不存在!');
|
|
|
}
|
|
|
+ if($sector['sector_id'] != $data['sector_id']){
|
|
|
+ $sector_id = Sector::where('sector_id',$data['sector_id'])->first();
|
|
|
+ if(!empty($sector_id)){
|
|
|
+ return Result::error('通栏编号已存在!');
|
|
|
+ }
|
|
|
+ }
|
|
|
// 对传入的 page_type 数组进行去重、转换为整数并重新索引
|
|
|
$data['page_type'] = array_values(array_unique(array_map('intval', $data['page_type'])));
|
|
|
$data['page_type'] = json_encode($data['page_type']);
|
|
@@ -1181,17 +1179,6 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if(empty($template)){
|
|
|
return Result::error('皮肤不存在!');
|
|
|
}
|
|
|
- // 皮肤相关信息
|
|
|
- $data['template_name'] = $template['template_name'];
|
|
|
- $data['template_id'] = $template['template_id'];
|
|
|
- // 风格相关信息
|
|
|
- $template_class = TemplateClass::where('class_id',$template['template_class_id'])->first();
|
|
|
- if(empty($template_class)){
|
|
|
- return Result::error('所属风格不存在!');
|
|
|
- }
|
|
|
- // $data['sector_keyword'] = json_encode($data['sector_keyword']);
|
|
|
- $data['template_class_id'] = $template_class['class_id'];
|
|
|
- $data['template_class_name'] = $template_class['name'];
|
|
|
$result = Sector::where('id', $data['id'])->update($data);
|
|
|
if ($result == 1) {
|
|
|
return Result::success('修改成功');
|