o2oa_www.service.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import 'package:get/get.dart';
  2. import '../models/index.dart';
  3. import '../utils/index.dart';
  4. import '../values/index.dart';
  5. class O2OAWwwService extends GetxService {
  6. static O2OAWwwService get to => Get.find();
  7. String baseUrl() {
  8. return O2.o2oaWwwUrl;
  9. }
  10. ///官网服务 获取演示环境服务器列表
  11. Future<List<O2CloudServer>?> executeSampleServerListShell() async {
  12. try {
  13. Map<String, dynamic> body = {};
  14. ApiResponse response = await O2HttpClient.instance.post('${baseUrl()}x_program_center/jaxrs/invoke/demo_app_get_server_list/execute', body);
  15. if (response.isSuccess()) {
  16. final value = ScriptExecuteResponse.fromJson(response.data);
  17. final list = value.value == null ? [] : value.value as List;
  18. return list.map((e) => O2CloudServer.fromJson(e) ).toList();
  19. }
  20. } catch (err, stackTrace) {
  21. OLogger.e('获取服务器列表失败', err, stackTrace);
  22. }
  23. return null;
  24. }
  25. /// 官网服务 获取演示环境的账号列表
  26. Future<WwwGetSampleAccounts?> executeSampleAccountsShell(WwwGetSampleAccountPost body) async {
  27. try {
  28. ApiResponse response = await O2HttpClient.instance.post('${baseUrl()}x_program_center/jaxrs/invoke/demo_app_get_login_accounts/execute', body.toJson());
  29. if (response.isSuccess()) {
  30. final value = ScriptExecuteResponse.fromJson(response.data);
  31. return WwwGetSampleAccounts.fromJson(value.value);
  32. }
  33. } catch (err, stackTrace) {
  34. OLogger.e('获取账号列表失败', err, stackTrace);
  35. }
  36. return null;
  37. }
  38. }