exportData(); return 0; } private function exportData() { $list = DB::table('dep_interface')->get(); foreach ($list as $row) { $row = get_object_vars($row); $websiteId = $row['website_id']; $row['request_settings'] = json_decode($row['request_settings'], true); $row['condition_settings'] = json_decode($row['condition_settings'], true); $row['sort_settings'] = json_decode($row['sort_settings'], true); $row['result_settings'] = json_decode($row['result_settings'], true); $row['conditions'] = json_decode($row['conditions'], true); unset($row['id']); unset($row['mid']); unset($row['weight']); unset($row['is_delete']); unset($row['created_at']); unset($row['updated_at']); $assemble_id = $row['assemble_id']; $assembleInfo = DB::table('sys_assemble')->where('id', $assemble_id)->first(); if ($assembleInfo) { $row['assemble_id'] = $assembleInfo->schema; } else { $row['assemble_id'] = 0; } if (!file_exists(storage_path('interface/' . $websiteId))) { mkdir(storage_path('interface/' . $websiteId), "0777", true); } file_put_contents(storage_path('interface/' . $websiteId . '/' . $row['en_alias'] . '.js'), 'return ' . json_encode($row)); } } }