|
@@ -42,6 +42,8 @@ use App\Model\WebsiteCategory;
|
|
|
use App\Model\AdPlace;
|
|
|
use App\Model\WebsiteImg;
|
|
|
use App\Model\SectorComponent;
|
|
|
+use App\Model\ComponentImg;
|
|
|
+
|
|
|
#[RpcService(name: "PublicRpcService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
|
class PublicRpcService implements PublicRpcServiceInterface
|
|
|
{
|
|
@@ -2567,4 +2569,75 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
}
|
|
|
return Result::success($sector);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 自助建站-组件管理-获取组件预览图列表
|
|
|
+ */
|
|
|
+ public function getComponentImgList(array $data): array
|
|
|
+ {
|
|
|
+
|
|
|
+ $where['component_img.component_id'] = $data['component_id'];
|
|
|
+ if(isset($data['template_id']) && !empty($data['template_id'])){
|
|
|
+ $where['component_img.template_id'] = $data['template_id'];
|
|
|
+ }
|
|
|
+ $component_img = ComponentImg::where($where)
|
|
|
+ ->leftJoin('template','component_img.template_id','=','template.template_id')
|
|
|
+ ->leftJoin('component','component_img.component_id','=','component.component_type')
|
|
|
+ ->select('component_img.*','template.template_name','component.component_name')
|
|
|
+ ->paginate($data['page_size'], ['*'], 'page', $data['page']);
|
|
|
+ if(empty($component_img)){
|
|
|
+ return Result::error('组件预览图不存在!');
|
|
|
+ }
|
|
|
+ return Result::success($component_img);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 自助建站-组件管理-添加组件预览图
|
|
|
+ */
|
|
|
+ public function addComponentImg(array $data): array
|
|
|
+ {
|
|
|
+ unset($data['user_id']);
|
|
|
+ $img = ComponentImg::where('component_id',$data['component_id'])->where('template_id',$data['template_id'])->get()->all();
|
|
|
+ if(!empty($img)){
|
|
|
+ return Result::error('该组件已存在此皮肤的预览图!');
|
|
|
+ }
|
|
|
+ $component_img = ComponentImg::insertGetId($data);
|
|
|
+ if(empty($component_img)){
|
|
|
+ return Result::error('添加失败!');
|
|
|
+ }
|
|
|
+ return Result::success($component_img);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 自助建站-组件管理-删除组件预览图
|
|
|
+ */
|
|
|
+ public function delComponentImg(array $data): array
|
|
|
+ {
|
|
|
+ $component_img = ComponentImg::where('id',$data['id'])->delete();
|
|
|
+ if(empty($component_img)){
|
|
|
+ return Result::error('删除失败!');
|
|
|
+ }
|
|
|
+ return Result::success($component_img);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 自助建站-组件管理-更新组件预览图
|
|
|
+ */
|
|
|
+ public function updateComponentImg(array $data): array
|
|
|
+ {
|
|
|
+ $img = ComponentImg::where('id','!=',$data['id'])->where('component_id',$data['component_id'])->where('template_id',$data['template_id'])->get()->all();
|
|
|
+ if(!empty($img)){
|
|
|
+ return Result::error('该组件已存在此皮肤的预览图!');
|
|
|
+ }
|
|
|
+ unset($data['user_id']);
|
|
|
+ // unset($data['updated_at']);
|
|
|
+ $id = $data['id'];
|
|
|
+ unset($data['id']);
|
|
|
+ // return Result::success($data);
|
|
|
+
|
|
|
+ $component_img = ComponentImg::where('id',$id)->update($data);
|
|
|
+ if(empty($component_img)){
|
|
|
+ return Result::error('更新失败!');
|
|
|
+ }
|
|
|
+ return Result::success($component_img);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|