Эх сурвалжийг харах

Merge branch '20250522_diywebfr'

15313670163 1 өдөр өмнө
parent
commit
30bed5e81e

+ 15 - 10
app/JsonRpc/PublicRpcService.php

@@ -1426,7 +1426,9 @@ class PublicRpcService implements PublicRpcServiceInterface
                 ];
                 $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);
+                
                 break;
             case 13:                     //13:底部导航类;
                 $component_data['componentData'] = [
@@ -1475,7 +1477,6 @@ class PublicRpcService implements PublicRpcServiceInterface
             default:
                 break;
         }
-        var_dump($ad_imginfo);
         if($data['type_id'] == 11){
             Db::beginTransaction();
             try{
@@ -1534,6 +1535,10 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(empty($component_type)){
             return Result::error('组件分类不存在!');
         }
+        $component = Component::where('id',$id)->first();
+        if(empty($component)){
+            return Result::error('组件不存在!');
+        }
        // 组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
         // 7:资讯-栏目类组件;8:列表类组件;9:详情类组件;10:二级导航栏类组件;11:广告类;12:静态资源类;13:底部导航类;
         $data['type_id'] = intval($data['type_id']);
@@ -1646,6 +1651,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 ];
                 $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);
                 break;
             case 13:                     //13:底部导航类;
@@ -1695,6 +1701,8 @@ class PublicRpcService implements PublicRpcServiceInterface
             default:
                 break;
         }
+        
+        // var_dump("ad_imginfo:",$ad_imginfo);
         $cll_column = [
             'img_num' => null,
             'text_num' => null,
@@ -1714,10 +1722,10 @@ class PublicRpcService implements PublicRpcServiceInterface
             'ad' => '',
             'ad_type' => null,
             'ad_imgid' => null,
+            'adimg_info' => '[]',
         ];
         Db::beginTransaction();
         try{
-            $component = Component::where('id',$id)->first();
         // return Result::success($add_arr);
             if($component['type_id'] == 11 && $component['type_id'] != $data['type_id']){
                 $website_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
@@ -1746,23 +1754,20 @@ class PublicRpcService implements PublicRpcServiceInterface
                     $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('广告默认图修改失败!');
                 }
-                var_dump("修改",$website_img);
                 
             }
             $add_arr = array_merge($cll_column,$add_arr);
-            // $result =  Component::where('id',$id)->get();
-            // return Result::success($result);
             $result =  Component::where('id',$id)->update($add_arr);
-            // var_dump("修改zj",$add_arr);
-            // if(empty($result)){ 
-            //     Db::rollBack();
-            //     return Result::error('修改失败!');
-            // }
+            if(empty($result)){ 
+                Db::rollBack();
+                return Result::error('修改失败!');
+            }
             Db::commit();
         }catch(\Exception $e){
             Db::rollBack();