select_country_controller.dart 1005 B

123456789101112131415161718192021222324252627282930313233
  1. import 'package:domain/constants/api_constants.dart';
  2. import 'package:get/get.dart';
  3. import 'package:plugin_basic/constants/app_constant.dart';
  4. import 'package:plugin_basic/service/app_config_service.dart';
  5. import 'package:plugin_basic/service/http_provider_injection.dart';
  6. import 'package:plugin_platform/engine/sp/sp_util.dart';
  7. import 'package:shared/utils/log_utils.dart';
  8. class SelectCountryController extends GetxController {
  9. //设置下一步
  10. void setupNext() {
  11. int country = ConfigService.to.selectCountry.value;
  12. SPUtil.putInt(AppConstant.storageSelectedCountry, country);
  13. String baseUrl;
  14. if (country == 1) {
  15. //新加坡
  16. baseUrl = ApiConstants.sgBaseUrl;
  17. } else if (country == 2) {
  18. //韩国
  19. baseUrl = ApiConstants.koreaBaseUrl;
  20. } else {
  21. baseUrl = ApiConstants.baseUrl;
  22. }
  23. Log.d("当前选择的国家:$country 当前要切换的域名为:$baseUrl");
  24. HttpProviderInjection.switchBaseUrl(baseUrl);
  25. Get.back();
  26. }
  27. }