Browse Source

Merge branch '20250522_diywebfr'

15313670163 9 hours ago
parent
commit
5061a206de
1 changed files with 68 additions and 67 deletions
  1. 68 67
      app/JsonRpc/PublicRpcService.php

+ 68 - 67
app/JsonRpc/PublicRpcService.php

@@ -1514,6 +1514,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['component_data'] = json_encode($component_data,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
                 break;
+                
             case 8:                      //8:列表类组件;
                 $add_arr['pageSize'] = intval($data['pageSize']);
                 $component_data['componentData'] = [
@@ -1550,7 +1551,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['component_width'] = intval($data['ad_width']);
                 $add_arr['component_height'] = intval($data['ad_height']);
                 $add_arr['ad_type'] = intval($data['ad_type']);
-                $add_arr['ad_img'] = $data['ad_img'];
+                // $add_arr['ad_img'] = $data['ad_img'];
                 $ad = [
                     'width' => $add_arr['ad_width'],
                     'height' => $add_arr['ad_height'],
@@ -1558,14 +1559,14 @@ class PublicRpcService implements PublicRpcServiceInterface
                     'price' => '',
                     'introduce' => '',
                     'website_id' => '',
-                    'thumb' => $add_arr['ad_img'],
+                    // 'thumb' => $add_arr['ad_img'],
                     'typeid' => $add_arr['ad_type'],
                     'ad_tag' => '',
                 ];
                 $add_arr['ad'] = json_encode($ad,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
-                $add_arr['adimg_info'] = $data['img_info'];
-                $ad_imginfo = json_decode($data['img_info'],true);
+                // $add_arr['adimg_info'] = $data['img_info'];
+                // $ad_imginfo = json_decode($data['img_info'],true);
                 
                 break;
             case 13:                     //13:底部导航类;
@@ -1581,7 +1582,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['component_width'] = intval($data['component_width']);
                 $add_arr['component_height'] = intval($data['component_height']);
                 $add_arr['ad_type'] = intval($data['ad_type']);
-                $add_arr['ad_img'] = $data['ad_img'];
+                // $add_arr['ad_img'] = $data['ad_img'];
                 $add_arr['img_num'] = intval($data['img_num']);
                 $add_arr['text_num'] = intval($data['text_num']);
                 $add_arr['child_imgnum'] = intval($data['child_imgnum'] ?? null);
@@ -1604,15 +1605,15 @@ class PublicRpcService implements PublicRpcServiceInterface
                     'price' => '',
                     'introduce' => '',
                     'website_id' => '',
-                    'thumb' => $add_arr['ad_img'],
+                    // 'thumb' => $add_arr['ad_img'],
                     'typeid' => $add_arr['ad_type'],
                     'ad_tag' => '',
                 ];
                 $add_arr['ad'] = json_encode($ad,true);
                 $add_arr['component_data'] = json_encode($component_data,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
-                $add_arr['adimg_info'] = $data['img_info'];
-                $ad_imginfo = json_decode($data['img_info'],true);
+                // $add_arr['adimg_info'] = $data['img_info'];
+                // $ad_imginfo = json_decode($data['img_info'],true);
                 break;
             default:
                 break;
@@ -1620,13 +1621,13 @@ class PublicRpcService implements PublicRpcServiceInterface
         if($data['type_id'] == 11 || $data['type_id'] == 14){
             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('广告默认图上传失败!');
-                }
+                // $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();
@@ -1658,16 +1659,16 @@ class PublicRpcService implements PublicRpcServiceInterface
         }
         Db::beginTransaction();
         try{
-            if($component['type_id'] == 11 || $component['type_id'] == 14){
-                $ad_img = WebsiteImg::where('id',$component['ad_imgid'])->first();
-                if(!empty($ad_img)){
-                    $ad_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
-                    if(empty($ad_img)){
-                        Db::rollBack();
-                        return Result::error('删除广告默认图失败!');
-                    }
-                }
-            }
+            // if($component['type_id'] == 11 || $component['type_id'] == 14){
+            //     $ad_img = WebsiteImg::where('id',$component['ad_imgid'])->first();
+            //     if(!empty($ad_img)){
+            //         $ad_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
+            //         if(empty($ad_img)){
+            //             Db::rollBack();
+            //             return Result::error('删除广告默认图失败!');
+            //         }
+            //     }
+            // }
             $component_img = ComponentImg::where('component_id',$component['component_type'])->first();
             if(!empty($component_img)){
                 $del_img = ComponentImg::where('component_id',$component['component_type'])->delete();
@@ -1805,7 +1806,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['component_width'] = intval($data['ad_width']);
                 $add_arr['component_height'] = intval($data['ad_height']);
                 $add_arr['ad_type'] = intval($data['ad_type']);
-                $add_arr['ad_img'] = $data['ad_img'];
+                // $add_arr['ad_img'] = $data['ad_img'];
                 $ad = [
                     'width' => $add_arr['ad_width'],
                     'height' => $add_arr['ad_height'],
@@ -1813,14 +1814,14 @@ class PublicRpcService implements PublicRpcServiceInterface
                     'price' => '',
                     'introduce' => '',
                     'website_id' => '',
-                    'thumb' => $add_arr['ad_img'],
+                    // 'thumb' => $add_arr['ad_img'],
                     'typeid' => $add_arr['ad_type'],
                     'ad_tag' => '',
                 ];
                 $add_arr['ad'] = json_encode($ad,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
-                $add_arr['adimg_info'] = $data['img_info'];
-                $ad_imginfo = json_decode($data['img_info'],true);
+                // $add_arr['adimg_info'] = $data['img_info'];
+                // $ad_imginfo = json_decode($data['img_info'],true);
                 break;
             case 13:                     //13:底部导航类;
                 $component_data['componentData'] = [
@@ -1835,7 +1836,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['component_width'] = intval($data['component_width']);
                 $add_arr['component_height'] = intval($data['component_height']);
                 $add_arr['ad_type'] = intval($data['ad_type']);
-                $add_arr['ad_img'] = $data['ad_img'];
+                // $add_arr['ad_img'] = $data['ad_img'];
                 $add_arr['img_num'] = intval($data['img_num']);
                 $add_arr['text_num'] = intval($data['text_num']);
                 $add_arr['child_imgnum'] = intval($data['child_imgnum'] ?? null);
@@ -1858,15 +1859,15 @@ class PublicRpcService implements PublicRpcServiceInterface
                     'price' => '',
                     'introduce' => '',
                     'website_id' => '',
-                    'thumb' => $add_arr['ad_img'],
+                    // 'thumb' => $add_arr['ad_img'],
                     'typeid' => $add_arr['ad_type'],
                     'ad_tag' => '',
                 ];
                 $add_arr['ad'] = json_encode($ad,true);
                 $add_arr['component_data'] = json_encode($component_data,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
-                $add_arr['adimg_info'] = $data['img_info'];
-                $ad_imginfo = json_decode($data['img_info'],true);
+                // $add_arr['adimg_info'] = $data['img_info'];
+                // $ad_imginfo = json_decode($data['img_info'],true);
                 break;
             default:
                 break;
@@ -1886,52 +1887,52 @@ class PublicRpcService implements PublicRpcServiceInterface
             'article_id' => null,
             'cate_place' => null,
             'pageSize' => null,
-            'ad_img' => null,
+            // 'ad_img' => null,
             'ad_width' => null,
             'ad_height' => null,
             'ad' => '',
             'ad_type' => null,
-            'ad_imgid' => null,
+            // 'ad_imgid' => null,
             'adimg_info' => '[]',
         ];
         Db::beginTransaction();
         try{
-        // return Result::success($add_arr);
-            if(($component['type_id'] == 11 || $component['type_id'] == 14) && ($data['type_id'] != 11 && $data['type_id'] != 14)){
-                $website_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
+            // return Result::success($add_arr);
+            // if(($component['type_id'] == 11 || $component['type_id'] == 14) && ($data['type_id'] != 11 && $data['type_id'] != 14)){
+            //     // $website_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
                 
-                if(empty($website_img)){
-                    Db::rollBack();
-                    return Result::error('广告默认图删除失败!');
-                }
-                var_dump("删除",$website_img);
+            //     if(empty($website_img)){
+            //         Db::rollBack();
+            //         return Result::error('广告默认图删除失败!');
+            //     }
+            //     var_dump("删除",$website_img);
                 
-            }
-            if(($data['type_id'] == 11 || $data['type_id'] == 14) && ($component['type_id'] != 11 && $component['type_id'] != 14)){
-                $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 || $data['type_id'] == 14) && ($component['type_id'] != 11 && $component['type_id'] != 14)){
+            //     $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(($component['type_id'] == 11 || $component['type_id'] == 14) && ($data['type_id'] == 11 || $data['type_id'] == 14)){
-                $website_img = WebsiteImg::where('id',$component['ad_imgid'])->first();
-                if(empty($website_img)){
-                    $website_img = WebsiteImg::insertGetId($ad_imginfo);
-                    $add_arr['ad_imgid'] = $website_img;
-                }else{
-                    $website_img = WebsiteImg::where('id',$component['ad_imgid'])->update($ad_imginfo);
-                    $add_arr['ad_imgid'] = $component['ad_imgid'];
-                }
-                if(empty($website_img)){
-                    Db::rollBack();
-                    return Result::error('广告默认图修改失败!');
-                }
+            // }
+            // if(($component['type_id'] == 11 || $component['type_id'] == 14) && ($data['type_id'] == 11 || $data['type_id'] == 14)){
+            //     $website_img = WebsiteImg::where('id',$component['ad_imgid'])->first();
+            //     if(empty($website_img)){
+            //         $website_img = WebsiteImg::insertGetId($ad_imginfo);
+            //         $add_arr['ad_imgid'] = $website_img;
+            //     }else{
+            //         $website_img = WebsiteImg::where('id',$component['ad_imgid'])->update($ad_imginfo);
+            //         $add_arr['ad_imgid'] = $component['ad_imgid'];
+            //     }
+            //     if(empty($website_img)){
+            //         Db::rollBack();
+            //         return Result::error('广告默认图修改失败!');
+            //     }
                 
-            }
+            // }
             $add_arr = array_merge($cll_column,$add_arr);
             $result =  Component::where('id',$id)->update($add_arr);
             if(empty($result)){