|
@@ -443,25 +443,16 @@ class FormService implements FormServiceInterface
|
|
|
if (empty($globalTable)) {
|
|
|
return Result::error('表单不存在');
|
|
|
}
|
|
|
-
|
|
|
unset($data['table_id']);
|
|
|
-
|
|
|
// 转换数组字段为字符串
|
|
|
$data = array_map(function ($value) {
|
|
|
if (is_array($value)) {
|
|
|
- // 如果是关联数组,转换为JSON字符串
|
|
|
- if (array_keys($value) !== range(0, count($value) - 1)) {
|
|
|
- return json_encode($value, JSON_UNESCAPED_UNICODE);
|
|
|
- }
|
|
|
- // 如果是索引数组,转换为逗号分隔字符串
|
|
|
- return implode(',', $value);
|
|
|
+ return json_encode($value, JSON_UNESCAPED_UNICODE);
|
|
|
}
|
|
|
return $value;
|
|
|
}, $data);
|
|
|
-
|
|
|
$query = Db::connection('global')->table($globalTable->table);
|
|
|
$query->where('id', $data['id'])->update($data);
|
|
|
-
|
|
|
return Result::success('修改成功');
|
|
|
} catch (\Throwable $e) {
|
|
|
return Result::error('修改失败:' . $e->getMessage());
|