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); // 发送验证码 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号 Future sendValidationCode( String countryCode, String account, String channel, String codeType, String uniqueid, String xWidth) async { final res = await apiProvider.getVerificationCode( countryCode, account, channel, codeType, 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); } //重置密码 Future resetPassword( String countryCode, String account, String date, String newPassword, String uniqueid, String verificationCode) async { final res = await apiProvider.resetPassword( countryCode, account, date, newPassword, uniqueid, verificationCode); return LoginEntity.fromJson(res.body); } }