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]); } } (new OperationLogService())->inLog(OperationType::Update, '修改-全市基础数据统计', null, $input); return $this->success(); } }