x_portal_assemble_surface.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:get/get.dart';
  2. import '../models/index.dart';
  3. import '../utils/index.dart';
  4. ///
  5. /// 门户服务
  6. ///
  7. class PortalSurfaceService extends GetxService {
  8. static PortalSurfaceService get to => Get.find();
  9. String baseUrl() {
  10. return O2ApiManager.instance.getModuleBaseUrl(
  11. O2DistributeModuleEnum.x_portal_assemble_surface) ?? '';
  12. }
  13. ///
  14. /// 当前用户可访问的移动端门户列表
  15. ///
  16. Future<List<PortalList>?> portalMobileList() async {
  17. try {
  18. ApiResponse response =
  19. await O2HttpClient.instance.get('${baseUrl()}jaxrs/portal/list/mobile');
  20. var list = response.data == null ? [] : response.data as List;
  21. return list.map((group) => PortalList.fromJson(group)).toList();
  22. } catch (err, stackTrace) {
  23. OLogger.e('查询用户可访问移动门户失败', err, stackTrace);
  24. }
  25. return null;
  26. }
  27. /// 红色角标,根据门户的脚本配置数量,显示在门户应用的角标位置
  28. Future<PortalCornerMarkData?> portalCornerMarkNumber(String portalId) async {
  29. try {
  30. ApiResponse response =
  31. await O2HttpClient.instance.get('${baseUrl()}jaxrs/portal/$portalId/corner/mark');
  32. return PortalCornerMarkData.fromJson(response.data);
  33. } catch (err, stackTrace) {
  34. OLogger.e('门户角标查询失败', err, stackTrace);
  35. }
  36. return null;
  37. }
  38. }