|
@@ -1148,37 +1148,23 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
// 对传入的 page_type 数组进行去重、转换为整数并重新索引
|
|
// 对传入的 page_type 数组进行去重、转换为整数并重新索引
|
|
$data['page_type'] = array_values(array_unique(array_map('intval', $data['page_type'])));
|
|
$data['page_type'] = array_values(array_unique(array_map('intval', $data['page_type'])));
|
|
$data['page_type'] = json_encode($data['page_type']);
|
|
$data['page_type'] = json_encode($data['page_type']);
|
|
- if($data['component_num'] == 1){
|
|
|
|
- $component_arr[0] = [
|
|
|
|
- 'size_id' => $data['size_id'],
|
|
|
|
- ];
|
|
|
|
- }else{
|
|
|
|
- $size = SectorPlace::where('type',$data['place_type'])
|
|
|
|
- ->leftJoin('size','size.id','=','sector_place.size_id')
|
|
|
|
- ->select('sector_place.*','size.width','size.height')
|
|
|
|
- ->orderBy('sector_place.sort_id','asc')
|
|
|
|
- ->get()->all();
|
|
|
|
- if(!empty($size)){
|
|
|
|
- for ($i=0; $i < $data['component_num']; $i++) {
|
|
|
|
- $component_arr[$i] = [
|
|
|
|
- 'size_id' => $size[$i]['size_id'],
|
|
|
|
- 'width' => $size[$i]['width'],
|
|
|
|
- 'height' => $size[$i]['height'],
|
|
|
|
- 'sort' => $size[$i]['sort_id'],
|
|
|
|
- 'place_name' => $size[$i]['name'],
|
|
|
|
- ];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // $code_arr
|
|
|
|
-
|
|
|
|
|
|
+ $template = Template::where('template_id', $data['template_id'])
|
|
|
|
+ ->first();
|
|
|
|
+ if (empty($template)) {
|
|
|
|
+ return Result::error('皮肤不存在!');
|
|
}
|
|
}
|
|
|
|
+ $sector_id = Sector::where('sector_id',$data['sector_id'])->first();
|
|
|
|
+ if(!empty($sector_id)){
|
|
|
|
+ return Result::error('通栏编号已存在!');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 通栏分类:1:资讯类:2:通栏广告类;3:混合类;4:头条类;5:轮播图类;
|
|
if($data['sector_type'] == 2 || $data['sector_type'] == 3){
|
|
if($data['sector_type'] == 2 || $data['sector_type'] == 3){
|
|
$sector_code = [
|
|
$sector_code = [
|
|
'sectorName' => $data['sector_name'],
|
|
'sectorName' => $data['sector_name'],
|
|
'sectorId' => $data['sector_id'],
|
|
'sectorId' => $data['sector_id'],
|
|
'sectorType' => $data['sector_type'],
|
|
'sectorType' => $data['sector_type'],
|
|
'sectorPlace' => $data['place_type'],
|
|
'sectorPlace' => $data['place_type'],
|
|
- 'compnentList' => $component_arr,
|
|
|
|
'ad' => [],
|
|
'ad' => [],
|
|
];
|
|
];
|
|
}else{
|
|
}else{
|
|
@@ -1187,20 +1173,10 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
'sectorId' => $data['sector_id'],
|
|
'sectorId' => $data['sector_id'],
|
|
'sectorType' => $data['sector_type'],
|
|
'sectorType' => $data['sector_type'],
|
|
'sectorPlace' => $data['place_type'],
|
|
'sectorPlace' => $data['place_type'],
|
|
- 'compnentList' => $component_arr,
|
|
|
|
];
|
|
];
|
|
}
|
|
}
|
|
// return Result::success($sector_code);
|
|
// return Result::success($sector_code);
|
|
- $data['sector_code'] = json_encode($sector_code);
|
|
|
|
- $template = Template::where('template_id', $data['template_id'])
|
|
|
|
- ->first();
|
|
|
|
- if (empty($template)) {
|
|
|
|
- return Result::error('皮肤不存在!');
|
|
|
|
- }
|
|
|
|
- $sector_id = Sector::where('sector_id',$data['sector_id'])->first();
|
|
|
|
- if(!empty($sector_id)){
|
|
|
|
- return Result::error('通栏编号已存在!');
|
|
|
|
- }
|
|
|
|
|
|
+ $data['sector_code'] = json_encode($sector_code);
|
|
$result = Sector::insertGetId($data);
|
|
$result = Sector::insertGetId($data);
|
|
if (empty($result)) {
|
|
if (empty($result)) {
|
|
return Result::error('添加失败');
|
|
return Result::error('添加失败');
|
|
@@ -1243,47 +1219,20 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
return Result::error('通栏编号已存在!');
|
|
return Result::error('通栏编号已存在!');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if($data['component_num'] == 1){
|
|
|
|
- $component_arr[0] = [
|
|
|
|
- 'size_id' => $data['size_id'],
|
|
|
|
- ];
|
|
|
|
- }else{
|
|
|
|
- $size = SectorPlace::where('type',$data['place_type'])
|
|
|
|
- ->leftJoin('size','size.id','=','sector_place.size_id')
|
|
|
|
- ->select('sector_place.*','size.width','size.height')
|
|
|
|
- ->orderBy('sector_place.sort_id','asc')
|
|
|
|
- ->get()->all();
|
|
|
|
- if(!empty($size)){
|
|
|
|
- for ($i=0; $i < $data['component_num']; $i++) {
|
|
|
|
- $component_arr[$i] = [
|
|
|
|
- 'size_id' => intval($size[$i]['size_id']),
|
|
|
|
- 'width' => intval($size[$i]['width']),
|
|
|
|
- 'height' => intval($size[$i]['height']),
|
|
|
|
- 'sort' => intval($size[$i]['sort_id']),
|
|
|
|
- 'place_name' => strval($size[$i]['name']),
|
|
|
|
- ];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // $code_arr
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
if($data['sector_type'] == 2 || $data['sector_type'] == 3){
|
|
if($data['sector_type'] == 2 || $data['sector_type'] == 3){
|
|
$sector_code = [
|
|
$sector_code = [
|
|
'sectorName' => strval($data['sector_name']),
|
|
'sectorName' => strval($data['sector_name']),
|
|
'sectorId' => intval($data['sector_id']),
|
|
'sectorId' => intval($data['sector_id']),
|
|
'sectorType' => intval($data['sector_type']),
|
|
'sectorType' => intval($data['sector_type']),
|
|
'sectorPlace' => intval($data['place_type']),
|
|
'sectorPlace' => intval($data['place_type']),
|
|
- 'compnentList' => $component_arr,
|
|
|
|
'ad' => [],
|
|
'ad' => [],
|
|
];
|
|
];
|
|
}else{
|
|
}else{
|
|
$sector_code = [
|
|
$sector_code = [
|
|
'sectorName' => strval($data['sector_name']),
|
|
'sectorName' => strval($data['sector_name']),
|
|
-
|
|
|
|
'sectorId' => intval($data['sector_id']),
|
|
'sectorId' => intval($data['sector_id']),
|
|
'sectorType' => intval($data['sector_type']),
|
|
'sectorType' => intval($data['sector_type']),
|
|
'sectorPlace' => intval($data['place_type']),
|
|
'sectorPlace' => intval($data['place_type']),
|
|
- 'compnentList' => $component_arr,
|
|
|
|
];
|
|
];
|
|
}
|
|
}
|
|
// return Result::success($sector_code);
|
|
// return Result::success($sector_code);
|
|
@@ -1851,4 +1800,25 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
}
|
|
}
|
|
return Result::success($sort);
|
|
return Result::success($sort);
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有通栏版式
|
|
|
|
+ */
|
|
|
|
+ public function getAllSectorPlace(array $data): array
|
|
|
|
+ {
|
|
|
|
+ $where['type_id'] = $data['type_id'];
|
|
|
|
+ if(isset($data['sector_type']) && !empty($data['sector_type'])){
|
|
|
|
+ $where['sector_type'] = $data['sector_type'];
|
|
|
|
+ }
|
|
|
|
+ if(isset($data['component_num']) && !empty($data['component_num'])){
|
|
|
|
+ $where['component_num'] = $data['component_num'];
|
|
|
|
+ }
|
|
|
|
+ $sector_place = SectorPlace::where($where)
|
|
|
|
+ ->leftJoin('size','sector_place.size_id','=','size.id')
|
|
|
|
+ ->select('sector_place.*','size.width','size.height')
|
|
|
|
+ ->get()->all();
|
|
|
|
+ if(empty($sector_place)){
|
|
|
|
+ return Result::error('通栏版式不存在!');
|
|
|
|
+ }
|
|
|
|
+ return Result::success($sector_place);
|
|
|
|
+ }
|
|
}
|
|
}
|