Commit code. Update time: 2023-06-25

This commit is contained in:
TK
2023-06-25 11:50:55 +08:00
parent 2d74227878
commit 39a5f2fa92
244 changed files with 26147 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// To parse this JSON data, do
//
// final loginEntity = loginEntityFromMap(jsonString);
import 'dart:convert';
class LoginEntity {
LoginEntity({
required this.token,
required this.authData,
});
final String token;
final String authData;
factory LoginEntity.fromJson(String str) =>
LoginEntity.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory LoginEntity.fromMap(Map<String, dynamic> json) => LoginEntity(
token: json["token"],
authData: json["auth_data"],
);
Map<String, dynamic> toMap() => {
"token": token,
"auth_token": authData,
};
}
+96
View File
@@ -0,0 +1,96 @@
// To parse this JSON data, do
//
// final planEntity = planEntityFromMap(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
List<PlanEntity> planEntityFromList(List data) => List<PlanEntity>.from(data.map((x) => PlanEntity.fromMap(x)));
class PlanEntity {
PlanEntity({
required this.id,
required this.groupId,
required this.transferEnable,
required this.name,
required this.show,
required this.sort,
required this.renew,
required this.content,
required this.monthPrice,
required this.quarterPrice,
required this.halfYearPrice,
required this.yearPrice,
required this.twoYearPrice,
required this.threeYearPrice,
required this.onetimePrice,
required this.resetPrice,
required this.createdAt,
required this.updatedAt,
});
final int id;
final int groupId;
final int transferEnable;
final String name;
final int show;
final dynamic sort;
final int renew;
final String? content;
final int? monthPrice;
final int? quarterPrice;
final int? halfYearPrice;
final int? yearPrice;
final int? twoYearPrice;
final int? threeYearPrice;
final int? onetimePrice;
final int? resetPrice;
final DateTime? createdAt;
final DateTime? updatedAt;
factory PlanEntity.fromJson(String str) => PlanEntity.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory PlanEntity.fromMap(Map<String, dynamic> json) => PlanEntity(
id: json["id"],
groupId: json["group_id"],
transferEnable: json["transfer_enable"],
name: json["name"],
show: json["show"],
sort: json["sort"],
renew: json["renew"],
content: json["content"],
monthPrice: json["month_price"],
quarterPrice: json["quarter_price"],
halfYearPrice: json["half_year_price"],
yearPrice: json["year_price"],
twoYearPrice: json["two_year_price"],
threeYearPrice: json["three_year_price"],
onetimePrice: json["onetime_price"],
resetPrice: json["reset_price"],
createdAt: json["created_at"] == null ? null : DateTime.fromMillisecondsSinceEpoch(json["created_at"] * 1000),
updatedAt: json["updated_at"] == null ? null : DateTime.fromMillisecondsSinceEpoch(json["updated_at"] * 1000),
);
Map<String, dynamic> toMap() => {
"id": id,
"group_id": groupId,
"transfer_enable": transferEnable,
"name": name,
"show": show,
"sort": sort,
"renew": renew,
"content": content,
"month_price": monthPrice,
"quarter_price": quarterPrice,
"half_year_price": halfYearPrice,
"year_price": yearPrice,
"two_year_price": twoYearPrice,
"three_year_price": threeYearPrice,
"onetime_price": onetimePrice,
"reset_price": resetPrice,
"created_at": createdAt == null ? null : createdAt!.millisecondsSinceEpoch ~/ 1000,
"updated_at": updatedAt == null ? null : updatedAt!.millisecondsSinceEpoch ~/ 1000,
};
}
+90
View File
@@ -0,0 +1,90 @@
// To parse this JSON data, do
//
// final serverEntity = serverEntityFromMap(jsonString);
import 'dart:convert';
List<ServerEntity> serverEntityFromList(List<dynamic> data) =>
List<ServerEntity>.from(data.map((x) => ServerEntity.fromMap((x))));
class ServerEntity {
ServerEntity({
required this.id,
required this.groupId,
required this.parentId,
required this.tags,
required this.name,
required this.rate,
required this.host,
required this.port,
required this.serverPort,
required this.cipher,
required this.show,
required this.sort,
required this.createdAt,
required this.updatedAt,
required this.type,
required this.lastCheckAt,
});
final int id;
final List<String> groupId;
final int? parentId;
final List<String> tags;
final String name;
final String rate;
final String host;
final int port;
final int serverPort;
final String cipher;
final int show;
final int sort;
Duration? ping;
final int createdAt;
final int updatedAt;
final String type;
final String lastCheckAt;
factory ServerEntity.fromJson(String str) =>
ServerEntity.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory ServerEntity.fromMap(Map<String, dynamic> json) => ServerEntity(
id: json["id"],
groupId: List<String>.from(json["group_id"]?.map((x) => x) ?? []),
parentId: json["parent_id"],
tags: List<String>.from(json["tags"]?.map((x) => x) ?? []),
name: json["name"],
rate: json["rate"],
host: json["host"],
port: json["port"],
serverPort: json["server_port"],
cipher: json["cipher"],
show: json["show"],
sort: json["sort"],
createdAt: json["created_at"],
updatedAt: json["updated_at"],
type: json["type"],
lastCheckAt: json["last_check_at"] ?? "",
);
Map<String, dynamic> toMap() => {
"id": id,
"group_id": List<dynamic>.from(groupId.map((x) => x)),
"parent_id": parentId,
"tags": List<dynamic>.from(tags.map((x) => x)),
"name": name,
"rate": rate,
"host": host,
"port": port,
"server_port": serverPort,
"cipher": cipher,
"show": show,
"sort": sort,
"created_at": createdAt,
"updated_at": updatedAt,
"type": type,
"last_check_at": lastCheckAt,
};
}
+99
View File
@@ -0,0 +1,99 @@
// To parse this JSON data, do
//
// final userEntity = userEntityFromMap(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
class UserEntity {
UserEntity({
required this.email,
required this.transferEnable,
required this.lastLoginAt,
required this.createdAt,
required this.banned,
required this.remindExpire,
required this.remindTraffic,
required this.expiredAt,
required this.balance,
required this.commissionBalance,
required this.planId,
@required this.discount,
@required this.commissionRate,
@required this.telegramId,
required this.uuid,
required this.avatarUrl,
});
final String email;
final int transferEnable;
final DateTime? lastLoginAt;
final DateTime? createdAt;
final int banned;
final int remindExpire;
final int remindTraffic;
final DateTime? expiredAt;
final int balance;
final int commissionBalance;
final int planId;
final dynamic discount;
final dynamic commissionRate;
final dynamic telegramId;
final String uuid;
final String avatarUrl;
factory UserEntity.fromJson(String str) =>
UserEntity.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory UserEntity.fromMap(Map<String, dynamic> json) => UserEntity(
email: json["email"],
transferEnable: json["transfer_enable"],
lastLoginAt: json["last_login_at"] == null
? null
: DateTime.fromMillisecondsSinceEpoch(json["last_login_at"] * 1000),
createdAt: json["created_at"] == null
? null
: DateTime.fromMillisecondsSinceEpoch(json["created_at"] * 1000),
banned: json["banned"],
remindExpire: json["remind_expire"],
remindTraffic: json["remind_traffic"],
expiredAt: json["expired_at"] == null
? null
: DateTime.fromMillisecondsSinceEpoch(json["expired_at"] * 1000),
balance: json["balance"],
commissionBalance: json["commission_balance"],
planId: json["plan_id"] ?? 0,
discount: json["discount"] ?? 0,
commissionRate: json["commission_rate"],
telegramId: json["telegram_id"],
uuid: json["uuid"],
avatarUrl: json["avatar_url"],
);
Map<String, dynamic> toMap() => {
"email": email,
"transfer_enable": transferEnable,
"last_login_at": lastLoginAt == null
? null
: lastLoginAt!.millisecondsSinceEpoch ~/ 1000,
"created_at": createdAt == null
? null
: createdAt!.millisecondsSinceEpoch ~/ 1000,
"banned": banned,
"remind_expire": remindExpire,
"remind_traffic": remindTraffic,
"expired_at": expiredAt == null
? null
: expiredAt!.millisecondsSinceEpoch ~/ 1000,
"balance": balance,
"commission_balance": commissionBalance,
"plan_id": planId,
"discount": discount,
"commission_rate": commissionRate,
"telegram_id": telegramId,
"uuid": uuid,
"avatar_url": avatarUrl,
};
}
@@ -0,0 +1,156 @@
// To parse this JSON data, do
//
// final userSubscribeEntity = userSubscribeEntityFromMap(jsonString);
import 'package:meta/meta.dart';
import 'dart:convert';
class UserSubscribeEntity {
UserSubscribeEntity({
required this.planId,
required this.token,
required this.expiredAt,
required this.u,
required this.d,
required this.transferEnable,
required this.email,
required this.plan,
required this.subscribeUrl,
required this.resetDay,
});
final int planId;
final String token;
final int expiredAt;
final int u;
final int d;
final int transferEnable;
final String email;
final Plan? plan;
final String subscribeUrl;
final int? resetDay;
factory UserSubscribeEntity.fromJson(String str) =>
UserSubscribeEntity.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory UserSubscribeEntity.fromMap(Map<String, dynamic> json) =>
UserSubscribeEntity(
planId: json["plan_id"] ?? 0,
token: json["token"],
expiredAt: json["expired_at"] ?? 0,
u: json["u"],
d: json["d"],
transferEnable: json["transfer_enable"],
email: json["email"],
plan: json["plan"] == null ? null : Plan.fromMap(json["plan"]),
subscribeUrl: json["subscribe_url"],
resetDay: json["reset_day"],
);
Map<String, dynamic> toMap() => {
"plan_id": planId,
"token": token,
"expired_at": expiredAt,
"u": u,
"d": d,
"transfer_enable": transferEnable,
"email": email,
"plan": plan?.toMap(),
"subscribe_url": subscribeUrl,
"reset_day": resetDay,
};
}
class Plan {
Plan({
required this.id,
required this.groupId,
required this.transferEnable,
required this.name,
required this.show,
required this.sort,
required this.renew,
required this.content,
required this.monthPrice,
required this.quarterPrice,
required this.halfYearPrice,
required this.yearPrice,
required this.twoYearPrice,
required this.threeYearPrice,
required this.onetimePrice,
required this.resetPrice,
required this.resetTrafficMethod,
required this.createdAt,
required this.updatedAt,
});
final int id;
final int groupId;
final int transferEnable;
final String name;
final int show;
final int sort;
final int renew;
final String? content;
final int? monthPrice;
final int? quarterPrice;
final int? halfYearPrice;
final int? yearPrice;
final int? twoYearPrice;
final int? threeYearPrice;
final int? onetimePrice;
final int? resetPrice;
final int? resetTrafficMethod;
final int? createdAt;
final int? updatedAt;
factory Plan.fromJson(String str) => Plan.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory Plan.fromMap(Map<String, dynamic> json) => Plan(
id: json["id"],
groupId: json["group_id"],
transferEnable: json["transfer_enable"],
name: json["name"],
show: json["show"],
sort: json["sort"] ?? 0,
renew: json["renew"],
content: json["content"] ?? "",
monthPrice: json["month_price"] ?? 0,
quarterPrice: json["quarter_price"] ?? 0,
halfYearPrice: json["half_year_price"] ?? 0,
yearPrice: json["year_price"] ?? 0,
twoYearPrice: json["two_year_price"] ?? 0,
threeYearPrice: json["three_year_price"] ?? 0,
onetimePrice: json["onetime_price"] ?? 0,
resetPrice: json["reset_price"] ?? 0,
resetTrafficMethod: json["reset_traffic_method"] ?? 0,
createdAt: json["created_at"] ?? 0,
updatedAt: json["updated_at"] ?? 0,
);
Map<String, dynamic> toMap() => {
"id": id,
"group_id": groupId,
"transfer_enable": transferEnable,
"name": name,
"show": show,
"sort": sort,
"renew": renew,
"content": content,
"month_price": monthPrice,
"quarter_price": quarterPrice,
"half_year_price": halfYearPrice,
"year_price": yearPrice,
"two_year_price": twoYearPrice,
"three_year_price": threeYearPrice,
"onetime_price": onetimePrice,
"reset_price": resetPrice,
"reset_traffic_method": resetTrafficMethod,
"created_at": createdAt,
"updated_at": updatedAt,
};
}