|
|
@@ -1003,10 +1003,26 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if (isset($data['template_name']) && !empty($data['template_name'])) {
|
|
|
$where[] = ['template_name', 'like', '%' . $data['template_name'] . '%'];
|
|
|
}
|
|
|
- $result = Template::where($where)->select('id','template_id','template_name','template_keyword','page_type','template_class_id')->get()->all();
|
|
|
+ $result = Template::where($where)
|
|
|
+ ->select('id','template_id','template_name','template_keyword','page_type',
|
|
|
+ 'template_class_id','template_img','updated_at')
|
|
|
+ ->get()->all();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无皮肤", 0);
|
|
|
}
|
|
|
+ // $num = 1;
|
|
|
+ // $result['update_time'] = '1970-01-01 00:00:00';
|
|
|
+ foreach ($result as $key => $value) {
|
|
|
+ $template_img = json_decode($value['template_img'], true);
|
|
|
+ // $result['update_time'] = $value['updated_at'];
|
|
|
+ $update_time = $value['updated_at'] ?? '';
|
|
|
+ $result[$key]['template_img'] = $template_img[0];
|
|
|
+ // 若当前记录的更新时间晚于本条数据的更新时间,则刷新最新时间
|
|
|
+ // if (strtotime($result['update_time']) < strtotime($update_time)) {
|
|
|
+ // $result['update_time'] = $update_time;
|
|
|
+ // }
|
|
|
+ // $num++;
|
|
|
+ }
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/**
|
|
|
@@ -2554,10 +2570,15 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
// $id = $data['id'];
|
|
|
// 1:通栏;2:组件;
|
|
|
if ($data['type_id'] == 1) {
|
|
|
- $sector_type = SectorPlace::where('id', $data['id'])->where('type_id',1)->first();
|
|
|
+ $sector_type = SectorPlace::where('id', $data['id'])
|
|
|
+ ->where('type_id',1)
|
|
|
+ ->first();
|
|
|
if (empty($sector_type)) {
|
|
|
return Result::error('通栏版式不存在!');
|
|
|
}
|
|
|
+ unset($data['sort_id']);
|
|
|
+ unset($data['component_type']);
|
|
|
+ unset($data['type']);
|
|
|
// return Result::success($map);
|
|
|
$sector_place_id = SectorPlace::where('id', '!=', $data['id'])->where('sector_type', $data['sector_type'])->where('type_id', 1)->first();
|
|
|
if (!empty($sector_place_id)) {
|
|
|
@@ -2578,12 +2599,18 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if(empty($com_place)){
|
|
|
return Result::error('组件版式编号同步更新失败!');
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+ $map = $this->changeSectorPlaceJson($data['sector_type']) ?? [];
|
|
|
+ $data['cat_num'] = $map['cat_num'] ?? 0;
|
|
|
+ $map = json_encode($map['map_json'] ?? []);
|
|
|
+ $result = SectorPlace::where('id', $data['id'])->update($data);
|
|
|
} else {
|
|
|
- $sector_type = SectorPlace::where('id', $data['id'])->where('type_id', 2)->first();
|
|
|
- if (empty($sector_type)) {
|
|
|
+ $component_type = SectorPlace::where('id', $data['id'])->where('type_id', 2)->first();
|
|
|
+ if (empty($component_type)) {
|
|
|
return Result::error('组件版式不存在!');
|
|
|
}
|
|
|
+ unset($data['component_num']);
|
|
|
+ unset($data['map']);
|
|
|
$component = SectorPlace::where('sector_type', $data['sector_type'])
|
|
|
->where(function($query)use($data){
|
|
|
$query->where('component_type', $data['component_type'])
|
|
|
@@ -2595,15 +2622,20 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if (!empty($component)) {
|
|
|
return Result::error('组件版式编号或位置已存在!');
|
|
|
}
|
|
|
-
|
|
|
+ $result['component'] = SectorPlace::where('id', $data['id'])->update($data);
|
|
|
+ $map = $this->changeSectorPlaceJson($data['sector_type']) ?? [];
|
|
|
+ $data['cat_num'] = $map['cat_num'] ?? 0;
|
|
|
+ $map = json_encode($map['map_json'] ?? []);
|
|
|
+ $result['map'] = SectorPlace::where('sector_type', $data['sector_type'])
|
|
|
+ ->where('type_id', 1)
|
|
|
+ ->update(['map'=>$map,'cat_num'=>$data['cat_num']]);
|
|
|
}
|
|
|
- $map = $this->changeSectorPlaceJson($data['sector_type']) ?? [];
|
|
|
- $data['map'] = json_encode($map['map_json'] ?? []);
|
|
|
- $data['cat_num'] = $map['cat_num'] ?? 0;
|
|
|
- $result = SectorPlace::where('id', $data['id'])->update($data);
|
|
|
+
|
|
|
if (empty($result)) {
|
|
|
return Result::error('修改失败!');
|
|
|
}
|
|
|
+ // $update_result['sector_place'] = SectorPlace::where('id',$data['id'])->first();
|
|
|
+ // $update_result['map'] = $map;
|
|
|
return Result::success([
|
|
|
'result'=>$result,
|
|
|
]);
|
|
|
@@ -2619,7 +2651,6 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
}
|
|
|
$sector = Sector::where('place_type', $sector_place['sector_type'])->first();
|
|
|
if (!empty($sector)) {
|
|
|
- Db::rollBack();
|
|
|
return Result::error('通栏版式分类已应用,暂不可删除!');
|
|
|
}
|
|
|
Db::beginTransaction();
|
|
|
@@ -3006,10 +3037,13 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
return Result::error('该组件已存在此皮肤的预览图!');
|
|
|
}
|
|
|
}
|
|
|
- $component = ComponentImg::where('template_id', $data['template_id'])->where('component_id', $data['component_id'])->where('img_id', $data['img_id'])->first();
|
|
|
- if (!empty($component)) {
|
|
|
+ $component = ComponentImg::where('template_id', $data['template_id'])->where('component_id', $data['component_id']);
|
|
|
+ if (!empty($component->where('img_id', $data['img_id'])->first())) {
|
|
|
return Result::error('组件预览图编号已存在!');
|
|
|
}
|
|
|
+ if(!empty($component->where('img_name', $data['img_name'])->first())){
|
|
|
+ return Result::error('组件预览图名称已存在!');
|
|
|
+ }
|
|
|
$component_img = ComponentImg::insertGetId($data);
|
|
|
if(empty($component_img)){
|
|
|
return Result::error('添加失败!');
|
|
|
@@ -3042,10 +3076,13 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
return Result::error('该组件已存在此皮肤的预览图!');
|
|
|
}
|
|
|
}
|
|
|
- $component = ComponentImg::where('id', '!=', $data['id'])->where('component_id', $data['component_id'])->where('template_id', $data['template_id'])->where('img_id', $data['img_id'])->first();
|
|
|
- if (!empty($component)) {
|
|
|
+ $component = ComponentImg::where('id', '!=', $data['id'])->where('component_id', $data['component_id'])->where('template_id', $data['template_id']);
|
|
|
+ if (!empty($component->where('img_id', $data['img_id'])->first())) {
|
|
|
return Result::error('组件预览图编号已存在!');
|
|
|
}
|
|
|
+ if(!empty($component->where('img_name', $data['img_name'])->first())){
|
|
|
+ return Result::error('组件预览图名称已存在!');
|
|
|
+ }
|
|
|
// return Result::success($component);
|
|
|
unset($data['user_id']);
|
|
|
// unset($data['updated_at']);
|
|
|
@@ -3060,8 +3097,8 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
return Result::success($component_img);
|
|
|
}
|
|
|
/**
|
|
|
- * 自助建站-获取通栏类型
|
|
|
- */
|
|
|
+ * 自助建站-获取通栏类型
|
|
|
+ */
|
|
|
public function getSectorType(array $data): array
|
|
|
{
|
|
|
$sector = SectorType::get()->all();
|
|
|
@@ -3071,8 +3108,8 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
return Result::success($sector);
|
|
|
}
|
|
|
/**
|
|
|
- * 自助建站-随机获取模板
|
|
|
- */
|
|
|
+ * 自助建站-随机获取模板
|
|
|
+ */
|
|
|
public function randomWebTemplate(array $data): array
|
|
|
{
|
|
|
$web = Website::where('id',$data['website_id'])->first();
|
|
|
@@ -3112,7 +3149,6 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
$query = WebsiteCategory::where('website_id', $data['website_id']);
|
|
|
$cate_num = $query->where('is_show', 1)->count();
|
|
|
if ($cate_num < 5) {
|
|
|
@@ -3962,13 +3998,11 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
'component.component_column',
|
|
|
'component.ad',
|
|
|
'component.type_id',
|
|
|
- // 'component.component_code',
|
|
|
'component_img.img_name',
|
|
|
'component_img.img_id',
|
|
|
'component_img.img_url',
|
|
|
'sector_component.sort_id',
|
|
|
'sector_component.sectorid',
|
|
|
- // 'sector.sector_type',
|
|
|
)
|
|
|
->orderBy('sector_component.sort_id')
|
|
|
->orderBy('component.component_type')
|
|
|
@@ -3988,6 +4022,7 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
$componentId = $item->component_type;
|
|
|
$component_data = $item->component_data;
|
|
|
$component_column = $item->component_column;
|
|
|
+ $component_keyword = $item->component_keyword;
|
|
|
$component_type = $item->type_id;
|
|
|
$component_ad = $item->ad;
|
|
|
$imgId = $item->img_id;
|
|
|
@@ -4020,17 +4055,9 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
'pic_height' => $pic_height,
|
|
|
];
|
|
|
}
|
|
|
- if(in_array($component_type,[19,20,21,22,23,24])){
|
|
|
- $sortId = $sortId*2-1;
|
|
|
- $sort_id = intval($sortId-1);
|
|
|
- }else{
|
|
|
- $sort_id = intval($sortId - 1);
|
|
|
- }
|
|
|
+ $sort_id = intval($sortId - 1);
|
|
|
if (!isset($com_key) || !in_array($sectorId, $sector_ids) || !isset($sort_ids[$sectorId]) || !in_array($sortId, $sort_ids[$sectorId])) {
|
|
|
$com_key = 0;
|
|
|
- // if(!in_array($componentId,$component_ids)){
|
|
|
- // $img_key = 0;
|
|
|
- // }
|
|
|
$img_key = 0;
|
|
|
} else if (in_array($sortId, $sort_ids[$sectorId]) && in_array($sectorId, $sector_ids) && !in_array($componentId, $component_ids)) {
|
|
|
$com_key++;
|
|
|
@@ -4045,45 +4072,21 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
'component_type' => $item->component_type,
|
|
|
'type_id' => $component_type,
|
|
|
'sort' => $sortId,
|
|
|
- // 'width' => $item->component_width,
|
|
|
- // 'height' => $item->component_height,
|
|
|
];
|
|
|
- if(in_array($component_type,[19,20,21,22,23,24])){
|
|
|
- $groupedResults[$sectorId]['component_list'][$sort_id+1][$com_key] = [
|
|
|
- 'component_type' => $item->component_type,
|
|
|
- 'type_id' => $component_type,
|
|
|
- 'sort' => $sortId+1,
|
|
|
- // 'width' => $item->component_width,
|
|
|
- // 'height' => $item->component_height,
|
|
|
- ];
|
|
|
- }
|
|
|
}
|
|
|
if($component_type == 11){
|
|
|
$groupedResults[$sectorId]['component_list'][$sort_id][$com_key]['component_style_data'][$img_key] = [
|
|
|
'img_name' => $item->img_name,
|
|
|
'img_id' => $imgId,
|
|
|
'img_url' => $item->img_url,
|
|
|
- // 'component_type' => $componentId,
|
|
|
];
|
|
|
}else{
|
|
|
$groupedResults[$sectorId]['component_list'][$sort_id][$com_key]['component_style_data'][$img_key] = [
|
|
|
'img_name' => $item->img_name,
|
|
|
'img_id' => $imgId,
|
|
|
- // 'img_url' => $item->img_url,
|
|
|
- // 'component_type' => $componentId,
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- if(in_array($component_type,[19,20,21,22,23,24])){
|
|
|
- $groupedResults[$sectorId]['component_list'][$sort_id+1][$com_key]['component_style_data'][$img_key] = [
|
|
|
- 'img_name' => $item->img_name,
|
|
|
- 'img_id' => $imgId,
|
|
|
- // 'img_url' => $item->img_url,
|
|
|
- // 'component_type' => $componentId,
|
|
|
];
|
|
|
- }
|
|
|
-
|
|
|
- $com_key = 0;
|
|
|
+ }
|
|
|
+ $com_key = 0;
|
|
|
// }
|
|
|
// 组件分类:1.头条资讯;2.轮播图资讯;3.推荐图;4.最新资讯;5.推荐资讯;6.热点资讯;7.栏目资讯;8.列表类;9.详情类;
|
|
|
// 10.二级导航类;11.广告类;12.静态类;13.单页导航类;14.资讯广告混合类;15.滚动图文类;16.搜索框类;17.单页列表类;18.单页详情类;
|
|
|
@@ -4096,15 +4099,9 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
}
|
|
|
if ($component_type != 11) {
|
|
|
$groupedResults[(int)$sectorId]['component_list'][(int)$sort_id][$com_key]['componentData'] = $component_code['componentData'];
|
|
|
- if(in_array($component_type,[19,20,21,22,23,24])){
|
|
|
- $groupedResults[(int)$sectorId]['component_list'][(int)$sort_id+1][$com_key]['componentData'] = $component_code['componentData'];
|
|
|
- }
|
|
|
}
|
|
|
} else {
|
|
|
$groupedResults[(int)$sectorId]['component_list'][(int)$sort_id][$com_key]['componentData'] = [];
|
|
|
- // if(in_array($component_type,[19,20,21,22,23,24])){
|
|
|
- // $groupedResults[(int)$sectorId][(int)$sort_id+1][$com_key]['componentData'] = [];
|
|
|
- // }
|
|
|
}
|
|
|
} else {
|
|
|
// 处理非法键类型的情况,可根据实际需求修改错误处理逻辑
|
|
|
@@ -4279,7 +4276,10 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
if(empty($session)){
|
|
|
return Result::error('会话不存在!');
|
|
|
}
|
|
|
- $aichat = Aichat::where($where)->orderBy('send_time','asc')->get()->all();
|
|
|
+ $aichat = Aichat::where('user_id',$data['user_id'])
|
|
|
+ ->where('session_id',$data['session_id'])
|
|
|
+ ->orderBy('send_time','desc')
|
|
|
+ ->get()->all();
|
|
|
if(empty($aichat)){
|
|
|
return Result::error('消息不存在!');
|
|
|
}
|
|
|
@@ -4363,4 +4363,73 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
}
|
|
|
return Result::success($template_draftbox);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 自助建站-验证关键词填写重复问题
|
|
|
+ */
|
|
|
+ public function checkRepeatKeyword(array $data): array
|
|
|
+ {
|
|
|
+ $keyword = json_decode($data['keyword'],true);
|
|
|
+ if(empty($keyword)){
|
|
|
+ return Result::error('关键词不能为空!');
|
|
|
+ }
|
|
|
+ // $keyword_list = array_column($keyword,'keyword');
|
|
|
+ if(count($keyword) != count(array_unique($keyword))){
|
|
|
+ return Result::error('关键词不能重复!');
|
|
|
+ }
|
|
|
+ if($data['type'] == 'style'){
|
|
|
+ $template_class_keyword = TemplateClass::pluck('keyword')->toArray();
|
|
|
+ if(in_array($data['keyword'],$template_class_keyword)){
|
|
|
+ return Result::error('关键词不能与风格关键词重复!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($data['type'] == 'skin'){
|
|
|
+ $template_keyword = Template::pluck('template_keyword')->toArray();
|
|
|
+ if(in_array($data['keyword'],$template_keyword)){
|
|
|
+ return Result::error('关键词不能与皮肤关键词重复!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($data['type'] == 'sector'){
|
|
|
+ $sector_keyword = Sector::where('template_id',$data['template_id'])->pluck('sector_keyword')->toArray();
|
|
|
+ if(in_array($data['keyword'],$sector_keyword)){
|
|
|
+ return Result::error('关键词不能与通栏关键词重复!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($data['type'] == 'component'){
|
|
|
+ $component_keyword = Component::pluck('component_keyword')->toArray();
|
|
|
+ if(in_array($data['keyword'],$component_keyword)){
|
|
|
+ return Result::error('关键词不能与组件关键词重复!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return Result::success($data);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 自助建站-验证网站模板相关类型
|
|
|
+ * 版本1----在构建网站首页之后使用
|
|
|
+ */
|
|
|
+ public function checkWebTemplate(array $data): array
|
|
|
+ {
|
|
|
+ // 网站id (是否存在该网站)
|
|
|
+ // (若是只传这个字段会判断是否关联导航池;)
|
|
|
+ // (再判断是否有三种类型的友情链接)
|
|
|
+ // (头部信息是否填写)
|
|
|
+ // (两种类型的底部导航)
|
|
|
+ $website = Website::where('id',$data['website_id'])->first();
|
|
|
+ if(empty($website)){
|
|
|
+ return Result::error('网站不存在!');
|
|
|
+ }
|
|
|
+ $template_data = json_decode($data['template_data'],true);
|
|
|
+ if(empty($template_data)){
|
|
|
+ return Result::error('模板数据不能为空!');
|
|
|
+ }
|
|
|
+ return Result::success($template_data);
|
|
|
+ if(!isset($template_data['website_id']) || empty($template_data['website_id'])){
|
|
|
+ return Result::error('网站ID不能为空!');
|
|
|
+ }
|
|
|
+ if(!isset($template_data['template_id']) || empty($template_data['template_id'])){
|
|
|
+ return Result::error('模板ID不能为空!');
|
|
|
+ }
|
|
|
+ return Result::success($template_data);
|
|
|
+ }
|
|
|
}
|