|
@@ -2613,9 +2613,15 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
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 = Component::where('component_type',$data['component_id'])->first();
|
|
|
+ if(empty($component)){
|
|
|
+ return Result::error('组件不存在!');
|
|
|
+ }
|
|
|
+ if($component['type_id'] == 11){
|
|
|
+ $img = ComponentImg::where('component_id',$data['component_id'])->where('template_id',$data['template_id'])->get()->all();
|
|
|
+ if(!empty($img)){
|
|
|
+ return Result::error('该组件已存在此皮肤的预览图!');
|
|
|
+ }
|
|
|
}
|
|
|
$component = ComponentImg::where('component_id',$data['component_id'])->where('img_id',$data['img_id'])->first();
|
|
|
if(!empty($component)){
|
|
@@ -2643,14 +2649,20 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
*/
|
|
|
public function updateComponentImg(array $data): array
|
|
|
{
|
|
|
+ $component = Component::where('component_type',$data['component_id'])->first();
|
|
|
+ if(empty($component)){
|
|
|
+ return Result::error('组件不存在!');
|
|
|
+ }
|
|
|
+
|
|
|
$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('该组件已存在此皮肤的预览图!');
|
|
|
}
|
|
|
- $component = ComponentImg::where('component_id',$data['component_id'])->where('id','!=',$data['id'])->where('img_id',$data['img_id'])->first();
|
|
|
-
|
|
|
- if(!empty($component)){
|
|
|
- return Result::error('组件预览图编号已存在!');
|
|
|
+ if($component['type_id'] == 11){
|
|
|
+ $img = ComponentImg::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']);
|