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

企业信息 增加字段

kphcdr 1 жил өмнө
parent
commit
3250efdb67

+ 13 - 1
app/Modules/Mini/Services/GoodsService.php

@@ -74,7 +74,19 @@ class GoodsService extends BaseService
                     "en_name" => $m->spec->en_name,
                 ];
             }),
-            "custom" => $goods->custom,
+            "custom" => array_map(function ($custom) {
+                return [
+                    "id" => $custom['id'],
+                    "title" => $custom['title'] ?? "",
+                    "en_title" => $custom['en_title'] ?? "",
+                    "attr" => array_filter(array_values(array_map(function ($attr) {
+                        if (is_null($attr['value'])) {
+                            return null;
+                        }
+                        return $attr;
+                    }, $custom['attr']))),
+                ];
+            }, $goods->custom),
         ];
 
     }