|
@@ -1168,7 +1168,21 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if(!empty($sector_id)){
|
|
|
return Result::error('通栏编号已存在!');
|
|
|
}
|
|
|
- $data['status'] = 0;
|
|
|
+ $sector_place = SectorPlace::where('sector_type',$data['place_type'])->get();
|
|
|
+ if(empty($sector_place)){
|
|
|
+ return Result::error('位置不存在!');
|
|
|
+ }
|
|
|
+ $sector = [
|
|
|
+ 'template_id' => $data['template_id'],
|
|
|
+ 'sector_type' => $data['sector_type'],
|
|
|
+ 'sector_name' => $data['sector_name'],
|
|
|
+ 'sector_id' => $data['sector_id'],
|
|
|
+ 'place_type' => $data['place_type'],
|
|
|
+ 'sector_width' => $data['sector_width'],
|
|
|
+ 'sector_height' => $data['sector_height'],
|
|
|
+ 'component_num' => $data['component_num'],
|
|
|
+ 'page_type' => $data['page_type'],
|
|
|
+ ];
|
|
|
// 通栏分类:1:资讯类:2:通栏广告类;3:混合类;4:头条类;5:轮播图类;
|
|
|
$sector_code = [
|
|
|
'sectorName' => $data['sector_name'],
|
|
@@ -1412,6 +1426,7 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
];
|
|
|
$add_arr['ad'] = json_encode($ad,true);
|
|
|
$add_arr['component_column'] = $component_type['com_code'] ?? '';
|
|
|
+ $ad_imginfo = json_decode($data['img_info'],true);
|
|
|
break;
|
|
|
case 13: //13:底部导航类;
|
|
|
$component_data['componentData'] = [
|
|
@@ -1460,10 +1475,32 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- // return Result::success($add_arr['component_data']);
|
|
|
- $result = Component::insertGetId($add_arr);
|
|
|
- if(empty($result)){
|
|
|
- return Result::error('添加失败!');
|
|
|
+ var_dump($ad_imginfo);
|
|
|
+ if($data['type_id'] == 11){
|
|
|
+ Db::beginTransaction();
|
|
|
+ try{
|
|
|
+ $website_img = WebsiteImg::insertGetId($ad_imginfo);
|
|
|
+ var_dump($website_img);
|
|
|
+ $add_arr['ad_imgid'] = $website_img;
|
|
|
+ if(empty($website_img)){
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error('广告默认图上传失败!');
|
|
|
+ }
|
|
|
+ $result = Component::insertGetId($add_arr);
|
|
|
+ if(empty($result)){
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error('添加失败!');
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ }catch(\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return Result::error('添加失败!');
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $result = Component::insertGetId($add_arr);
|
|
|
+ if(empty($result)){
|
|
|
+ return Result::error('添加组件失败!');
|
|
|
+ }
|
|
|
}
|
|
|
return Result::success($result);
|
|
|
}
|
|
@@ -1605,6 +1642,7 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
];
|
|
|
$add_arr['ad'] = json_encode($ad,true);
|
|
|
$add_arr['component_column'] = $component_type['com_code'] ?? '';
|
|
|
+ $ad_imginfo = json_decode($data['img_info'],true);
|
|
|
break;
|
|
|
case 13: //13:底部导航类;
|
|
|
$component_data['componentData'] = [
|
|
@@ -1671,13 +1709,56 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
'ad_height' => null,
|
|
|
'ad' => '',
|
|
|
'ad_type' => null,
|
|
|
+ 'ad_imgid' => null,
|
|
|
];
|
|
|
- $add_arr = array_merge($cll_column,$add_arr);
|
|
|
- $result = Component::where('id',$id)->update($add_arr);
|
|
|
- if(empty($result)){
|
|
|
+ Db::beginTransaction();
|
|
|
+ try{
|
|
|
+ $component = Component::where('id',$id)->first();
|
|
|
+ // return Result::success($add_arr);
|
|
|
+ if($component['type_id'] == 11 && $component['type_id'] != $data['type_id']){
|
|
|
+ $website_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
|
|
|
+
|
|
|
+ if(empty($website_img)){
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error('广告默认图删除失败!');
|
|
|
+ }
|
|
|
+ var_dump("删除",$website_img);
|
|
|
+
|
|
|
+ }
|
|
|
+ if($data['type_id'] == 11 && $component['type_id'] != $data['type_id']){
|
|
|
+ $website_img = WebsiteImg::insertGetId($ad_imginfo);
|
|
|
+ $add_arr['ad_imgid'] = $website_img;
|
|
|
+ if(empty($website_img)){
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error('广告默认图上传失败!');
|
|
|
+ }
|
|
|
+ var_dump("上传",$website_img);
|
|
|
+
|
|
|
+ }
|
|
|
+ if($data['type_id'] == 11 && $component['type_id'] == $data['type_id']){
|
|
|
+ $website_img = WebsiteImg::where('id',$component['ad_imgid'])->update($ad_imginfo);
|
|
|
+ if(empty($website_img)){
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error('广告默认图修改失败!');
|
|
|
+ }
|
|
|
+ var_dump("修改",$website_img);
|
|
|
+
|
|
|
+ }
|
|
|
+ $add_arr = array_merge($cll_column,$add_arr);
|
|
|
+ // $result = Component::where('id',$id)->get();
|
|
|
+ // return Result::success($result);
|
|
|
+ $result = Component::where('id',$id)->update($add_arr);
|
|
|
+ // var_dump("修改zj",$add_arr);
|
|
|
+ // if(empty($result)){
|
|
|
+ // Db::rollBack();
|
|
|
+ // return Result::error('修改失败!');
|
|
|
+ // }
|
|
|
+ Db::commit();
|
|
|
+ }catch(\Exception $e){
|
|
|
Db::rollBack();
|
|
|
return Result::error('修改失败!');
|
|
|
}
|
|
|
+
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
|