x_app_packaging_client_assemble_control.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import 'package:get/get.dart';
  2. import '../models/index.dart';
  3. import '../utils/index.dart';
  4. class AppPackingClientAssembleControlService {
  5. static AppPackingClientAssembleControlService get to => Get.find();
  6. String baseUrl() {
  7. return O2ApiManager.instance
  8. .getModuleBaseUrl(O2DistributeModuleEnum.x_app_packaging_client_assemble_control) ??
  9. '';
  10. }
  11. String apkDownloadUrl(String fileId, {String? outBaseUrl}) {
  12. String url = baseUrl();
  13. if (outBaseUrl != null) {
  14. url = outBaseUrl;
  15. }
  16. return '${url}jaxrs/apppackanony/file/download/$fileId';
  17. }
  18. /// 最后一次打包对象
  19. Future<O2AppInnerUpdateInfo?> androidPackLastAPk({String? outBaseUrl}) async {
  20. try {
  21. String url = baseUrl();
  22. if (outBaseUrl != null) {
  23. url = outBaseUrl;
  24. }
  25. ApiResponse response =
  26. await O2HttpClient.instance.get('${url}jaxrs/apppackanony/file/type/android/last');
  27. return O2AppInnerUpdateInfo.fromJson(response.data);
  28. } catch (err, stackTrace) {
  29. OLogger.e('配置文件读取失败', err, stackTrace);
  30. }
  31. return null;
  32. }
  33. }