import 'package:get/get.dart'; import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart'; import '../common/safetyVerification/entity/SafetyVerificationEntity.dart'; import '../login/login/entity/LoginEntity.dart'; import '../login/register/entity/SendValidationCodeEntity.dart'; import 'api_provider.dart'; class ApiRepository { final ApiProvider apiProvider; static ApiRepository get to => Get.find(); ApiRepository(this.apiProvider); // 发送验证码 Future sendValidationCode( String countryCode, String account, String channel, String uniqueid, String xWidth ) async { final res = await apiProvider.getVerificationCode(countryCode, account, channel, uniqueid, xWidth); return SendValidationCodeEntity.fromJson(res.body); } // 注册 Future register( String countryCode, String countryId, String mobile, String password, String uniqueid, String verificationCode ) async { final res = await apiProvider.register(countryCode, countryId, mobile, password, uniqueid, verificationCode); return LoginEntity.fromJson(res.body); } // 获取图片验证码 Future getSliderVerifyImg( String countryCode, String account ) async { final res = await apiProvider.getSliderVerifyImg(countryCode, account); return SafetyVerificationEntity.fromJson(res.body); } // 检验图片验证码 Future checkSliderVerifyImg( String countryCode, String account, String xWidth) async { final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth); return CheckSafetyVerificationEntity.fromJson(res.body); } Future login( String loginType, String password, String countryCode, String username) async { final res = await apiProvider.login(loginType, password, countryCode, username); return LoginEntity.fromJson(res.body); } }