Преглед на файлове

修改版式的画布数据

FengR преди 1 месец
родител
ревизия
8f60bdc98a
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      app/JsonRpc/PublicRpcService.php

+ 7 - 0
app/JsonRpc/PublicRpcService.php

@@ -2507,6 +2507,13 @@ class PublicRpcService implements PublicRpcServiceInterface
         if (empty($sector_type_info)) {
             return Result::error('通栏版式类别不存在!');
         }
+        $allcomponent_type = array_column($component, 'type');
+        if($sector_type_info['column_num'] > 1 && in_array(13,$allcomponent_type)){
+            $aboutArtcle_catkey = array_search(13,$allcomponent_type);
+            // 确保取到的是数字类型的 width,避免与模型对象相乘
+            $width = (int) ($component[$aboutArtcle_catkey]['width'] ?? 1);
+            $sector_type_info['width'] = $sector_type_info['width'] + $width;
+        }
         $row_num = 1;
         $cat_num = 0;
         $row_width = [];