增加两步验证提醒

This commit is contained in:
jyuesong
2022-01-19 09:56:17 +08:00
parent ca6f1db16f
commit c51ebc16d2
5 changed files with 139 additions and 122 deletions

View File

@@ -2,6 +2,7 @@ import 'package:qinglong_app/base/http/http.dart';
import 'package:qinglong_app/module/config/config_bean.dart';
import 'package:qinglong_app/module/env/env_bean.dart';
import 'package:qinglong_app/module/login/login_bean.dart';
import 'package:qinglong_app/module/login/user_bean.dart';
import 'package:qinglong_app/module/others/dependencies/dependency_bean.dart';
import 'package:qinglong_app/module/others/login_log/login_log_bean.dart';
import 'package:qinglong_app/module/others/scripts/script_bean.dart';
@@ -12,8 +13,7 @@ import 'package:qinglong_app/module/task/task_detail/task_detail_bean.dart';
import 'url.dart';
class Api {
static Future<HttpResponse<LoginBean>> login(
String userName, String passWord) async {
static Future<HttpResponse<LoginBean>> login(String userName, String passWord) async {
return await Http.post<LoginBean>(
Url.login,
{
@@ -23,6 +23,13 @@ class Api {
);
}
static Future<HttpResponse<UserBean>> user() async {
return await Http.get<UserBean>(
Url.user,
null,
);
}
static Future<HttpResponse<List<TaskBean>>> crons() async {
return await Http.get<List<TaskBean>>(
Url.tasks,
@@ -30,16 +37,14 @@ class Api {
);
}
static Future<HttpResponse<NullResponse>> startTasks(
List<String> crons) async {
static Future<HttpResponse<NullResponse>> startTasks(List<String> crons) async {
return await Http.put<NullResponse>(
Url.runTasks,
crons,
);
}
static Future<HttpResponse<NullResponse>> stopTasks(
List<String> crons) async {
static Future<HttpResponse<NullResponse>> stopTasks(List<String> crons) async {
return await Http.put<NullResponse>(
Url.runTasks,
crons,
@@ -60,9 +65,7 @@ class Api {
);
}
static Future<HttpResponse<TaskDetailBean>> addTask(
String name, String command, String cron,
{String? id}) async {
static Future<HttpResponse<TaskDetailBean>> addTask(String name, String command, String cron, {String? id}) async {
var data = {"name": name, "command": command, "schedule": cron};
if (id != null) {
@@ -127,8 +130,7 @@ class Api {
);
}
static Future<HttpResponse<NullResponse>> saveFile(
String name, String content) async {
static Future<HttpResponse<NullResponse>> saveFile(String name, String content) async {
return await Http.post<NullResponse>(
Url.saveFile,
{"content": content, "name": name},
@@ -163,9 +165,7 @@ class Api {
);
}
static Future<HttpResponse<NullResponse>> addEnv(
String name, String value, String remarks,
{String? id}) async {
static Future<HttpResponse<NullResponse>> addEnv(String name, String value, String remarks, {String? id}) async {
var data = {
"value": value,
"remarks": remarks,
@@ -185,8 +185,7 @@ class Api {
);
}
static Future<HttpResponse<NullResponse>> moveEnv(
String id, int fromIndex, int toIndex) async {
static Future<HttpResponse<NullResponse>> moveEnv(String id, int fromIndex, int toIndex) async {
return await Http.put<NullResponse>(
Url.envMove(id),
{"fromIndex": fromIndex, "toIndex": toIndex},
@@ -201,8 +200,7 @@ class Api {
}
static Future<HttpResponse<List<TaskLogBean>>> taskLog() async {
return await Http.get<List<TaskLogBean>>(Url.taskLog, null,
serializationName: "dirs");
return await Http.get<List<TaskLogBean>>(Url.taskLog, null, serializationName: "dirs");
}
static Future<HttpResponse<String>> taskLogDetail(String name) async {
@@ -219,8 +217,7 @@ class Api {
);
}
static Future<HttpResponse<String>> scriptDetail(
String name, String? path) async {
static Future<HttpResponse<String>> scriptDetail(String name, String? path) async {
return await Http.get<String>(
Url.scriptDetail + name,
{
@@ -229,8 +226,7 @@ class Api {
);
}
static Future<HttpResponse<List<DependencyBean>>> dependencies(
String type) async {
static Future<HttpResponse<List<DependencyBean>>> dependencies(String type) async {
return await Http.get<List<DependencyBean>>(
Url.dependencies,
{
@@ -239,8 +235,7 @@ class Api {
);
}
static Future<HttpResponse<NullResponse>> dependencyReinstall(
String id) async {
static Future<HttpResponse<NullResponse>> dependencyReinstall(String id) async {
return await Http.put<NullResponse>(
Url.dependencies,
[id],
@@ -254,8 +249,7 @@ class Api {
);
}
static Future<HttpResponse<NullResponse>> addDependency(
String name, int type) async {
static Future<HttpResponse<NullResponse>> addDependency(String name, int type) async {
return await Http.post<NullResponse>(
Url.dependencies,
[