rkljw 5 ngày trước cách đây
mục cha
commit
e4ca46df5a
1 tập tin đã thay đổi với 15 bổ sung1 xóa
  1. 15 1
      app/JsonRpc/FormService.php

+ 15 - 1
app/JsonRpc/FormService.php

@@ -520,7 +520,21 @@ class FormService implements FormServiceInterface
                     'b.field_type as type_definition'
                 )
                 ->get();
-      
+            $fields->transform(function ($field) {
+                    $optionValue = [];
+                    $optionStr = trim((string) $field->option);
+                    if (!empty($optionStr)) {
+                        $options = explode("\n", $optionStr);
+                        foreach ($options as $option) {
+                            $parts = explode('|', $option);
+                            if (count($parts) === 2) {
+                                $optionValue[$parts[1]] = $parts[0];
+                            }
+                        }
+                    }
+                    $field->option_value = $optionValue;
+                    return $field;
+                });
             $config = new \EasySwoole\VerifyCode\Config();
             $code = new \EasySwoole\VerifyCode\VerifyCode($config);
             $img_code = '';