Prechádzať zdrojové kódy

修改广告位同步数据的接口(同步画布部分---对应逻辑关系修改)

FengR 2 mesiacov pred
rodič
commit
a79858c9f3
1 zmenil súbory, kde vykonal 10 pridanie a 7 odobranie
  1. 10 7
      app/JsonRpc/AdService.php

+ 10 - 7
app/JsonRpc/AdService.php

@@ -217,7 +217,7 @@ class AdService implements AdServiceInterface
                 $ad_places = [];
                 // 模板数据及画布数据
                 $oldtemplate_data = json_decode($template_module['template_data'],true);
-                $canvas_data = json_decode($template_module['canvas_data'],true);
+                $oldcanvas_data = json_decode($template_module['canvas_data'],true);
                 if(array_key_exists( $page,$oldtemplate_data['ad'])){
                     $ad_places = $oldtemplate_data['ad'][$page];
                 }
@@ -268,11 +268,12 @@ class AdService implements AdServiceInterface
                         $num = $key;
                     }
                 }
-                foreach($canvas_data['template'][$page] as $key=>$val){
-                    $canvas_ad[$key] = $val;
-                    if(array_key_exists('ad',$val['content']) && $key == $num){
-                        // $canvas_ad[$key]['ad'] = $template_ad;
-                        $canvas_ad[$num]['content']['ad'] = [
+                 $canvas_data = $oldcanvas_data;
+                foreach($oldcanvas_data['template'][$page] as $key=>$val){
+                    // $canvas_info_ad[$key] = $val;
+                    if(array_key_exists('ad',$val['content']) && $val['content']['ad']['ad_tag'] == $template_data['ad_tag']){
+                        // $canvas_info_ad[$key]['ad'] = $template_ad;
+                        $canvas_ad['content']['ad'] = [
                             'width' => $val['content']['ad']['width'],
                             'height' => $val['content']['ad']['height'],
                             'name'=>$template_data['name'],   //广告位名称可更改
@@ -283,9 +284,11 @@ class AdService implements AdServiceInterface
                             'typeid'=>$val['content']['ad']['typeid'],
                             'ad_tag'=>$val['content']['ad']['ad_tag'],
                         ];
+                        $canvas_data['template'][$page][$key]['content'] = $canvas_ad['content'];
                     }
                 }
-                $canvas_data['template'][$page] = $canvas_ad;
+               
+                
                 $oldtemplate_data['template'][$page] = $ad_info;    //模板广告位相关信息已修改
             }
                 // return Result::success($ad_place);