route("id"); $fields_josn = ""; if($id == 6) { $fields_josn ='{ "id": 6, "api": "/api/maternity_matron_order/store", "fields": [ { "name": "level", "name_cn": "一价全包", "input_group": [ { "type": "radio", "value": "8800(初级月嫂)" }, { "type": "radio", "value": "9800(普通月嫂)" }, { "type": "radio", "value": "12800(高级月嫂)" }, { "type": "radio", "value": "15800(金牌月嫂)" }, { "type": "radio", "value": "18800(特级月嫂)" } ] } ] }'; } else { $fields_josn = '{ "id": 7, "api": "/api/housekeeper_order/store", "fields": [ { "name": "contents", "name_cn": "服务内容", "input_group": [ { "type": "radio", "value": "保洁" }, { "type": "radio", "value": "婴儿看护" }, { "type": "radio", "value": "老人看护" }, { "type": "radio", "value": "全护理老人" }, { "type": "radio", "value": "空调清洗" }, { "type": "radio", "value": "冰箱清洗" }, { "type": "radio", "value": "抽油烟机清洗" }, { "type": "radio", "value": "家庭除螨" }, { "type": "radio", "value": "开荒清洁" }, { "type": "radio", "value": "催乳" }, { "type": "radio", "value": "产后康复" } ] }, { "name": "people_num", "name_cn": "人口数量", "input_group": [ { "type": "radio", "value": "1-2人" }, { "type": "radio", "value": "3-4人" }, { "type": "radio", "value": "5-6人" }, { "type": "radio", "value": "6人以上" } ] }, { "name": "area", "name_cn": "房屋面积", "input_group": [ { "type": "radio", "value": "60平以下" }, { "type": "radio", "value": "60-120平" }, { "type": "radio", "value": "120-160平" }, { "type": "radio", "value": "160-200平" }, { "type": "radio", "value": "200平以上" } ] }, { "name": "server_time", "name_cn": "服务时间", "input_group": [ { "type": "radio", "value": "全白天" }, { "type": "radio", "value": "住家" } ] }, { "name": "rest", "name_cn": "休息安排", "input_group": [ { "type": "radio", "value": "每周单休" }, { "type": "radio", "value": "每周双休" } ] } ] }'; } $data = json_decode($fields_josn, true); $data["id"] = $id; if ($id) { $record = Classify::find($id); if ($record) { return Response()->json([ "status" => 0, "data" => [ "id" => $record->id, "pid" => $record->pid, "name" => $record->name, "info" => $record->info, "content" => $record->content, "api" => $data["api"], "fields" => $data["fields"] ] ]); } return Response()->json([ "status" => -2, "message" => "不存在的记录!" ]); } else { return Response()->json([ "status" => -1, "message" => "id不能为空!" ]); } } }