get()->toArray(); return $this->json(array_map(function ($item) { $_value = json_decode($item['value'], true); return [ 'name' => $item['name'], 'slug' => $item['slug'], 'value' => $_value['value'] ?? 0, 'unit' => $_value['unit'] ?? '未知', ]; }, $settings)); } public function updateStatistics(Request $request){ $input = $request->input(); foreach ($input as $key => $value){ if(Setting::where('slug', $key)->exists()){ Setting::where('slug', $key)->update(['value->value'=>$value]); } } return $this->success(); } }