| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- import 'dart:convert';
- /// 解析 JSON 字符串
- StatLogEntry statLogEntryFromJson(String str) =>
- StatLogEntry.fromJson(json.decode(str));
- /// 序列化为 JSON 字符串
- String statLogEntryToJson(StatLogEntry data) => json.encode(data.toJson());
- class StatLogEntry {
- final String? id;
- final int? time;
- final String? level;
- final String? module;
- final String? category;
- final Fields? fields;
- StatLogEntry({
- this.id,
- this.time,
- this.level,
- this.module,
- this.category,
- this.fields,
- });
- factory StatLogEntry.fromJson(Map<String, dynamic> json) => StatLogEntry(
- id: json["id"],
- time: json["time"],
- level: json["level"],
- module: json["module"],
- category: json["category"],
- fields: json["fields"] == null ? null : Fields.fromJson(json["fields"]),
- );
- Map<String, dynamic> toJson() => {
- "id": id,
- "time": time,
- "level": level,
- "module": module,
- "category": category,
- "fields": fields?.toJson(),
- };
- }
- class Fields {
- final int? code;
- final String? boostSessionId;
- final bool? success;
- final int? locationId;
- final List<ConnectionHistory>? connectionHistory;
- final String? locationCode;
- final int? generatedTime;
- Fields({
- this.code,
- this.boostSessionId,
- this.success,
- this.locationId,
- this.connectionHistory,
- this.locationCode,
- this.generatedTime,
- });
- factory Fields.fromJson(Map<String, dynamic> json) => Fields(
- code: json["code"],
- boostSessionId: json["boostSessionId"],
- success: json["success"],
- locationId: json["locationId"],
- connectionHistory: json["connectionHistory"] == null
- ? []
- : List<ConnectionHistory>.from(
- json["connectionHistory"]!.map(
- (x) => ConnectionHistory.fromJson(x),
- ),
- ),
- locationCode: json["locationCode"],
- generatedTime: json["generatedTime"],
- );
- Map<String, dynamic> toJson() => {
- "code": code,
- "boostSessionId": boostSessionId,
- "success": success,
- "locationId": locationId,
- "connectionHistory": connectionHistory == null
- ? []
- : List<dynamic>.from(connectionHistory!.map((x) => x.toJson())),
- "locationCode": locationCode,
- "generatedTime": generatedTime,
- };
- }
- class ConnectionHistory {
- final String? firstHop;
- final int? duration;
- final String? address;
- final int? code;
- final int? startTime;
- final int? endTime;
- final String? nodeId;
- ConnectionHistory({
- this.firstHop,
- this.duration,
- this.address,
- this.code,
- this.startTime,
- this.endTime,
- this.nodeId,
- });
- factory ConnectionHistory.fromJson(Map<String, dynamic> json) =>
- ConnectionHistory(
- firstHop: json["firstHop"],
- duration: json["duration"],
- address: json["address"],
- code: json["code"],
- startTime: json["startTime"],
- endTime: json["endTime"],
- nodeId: json["nodeId"],
- );
- Map<String, dynamic> toJson() => {
- "firstHop": firstHop,
- "duration": duration,
- "address": address,
- "code": code,
- "startTime": startTime,
- "endTime": endTime,
- "nodeId": nodeId,
- };
- }
|