70 lines
2.0 KiB
Dart
70 lines
2.0 KiB
Dart
|
|
|
|
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>();
|
|
ApiRepository(this.apiProvider);
|
|
|
|
// 发送验证码
|
|
Future<SendValidationCodeEntity> 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<LoginEntity> 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<SafetyVerificationEntity> getSliderVerifyImg(
|
|
String countryCode,
|
|
String account
|
|
) async {
|
|
final res = await apiProvider.getSliderVerifyImg(countryCode, account);
|
|
return SafetyVerificationEntity.fromJson(res.body);
|
|
}
|
|
|
|
// 检验图片验证码
|
|
Future<CheckSafetyVerificationEntity> checkSliderVerifyImg(
|
|
String countryCode,
|
|
String account,
|
|
String xWidth) async {
|
|
final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth);
|
|
return CheckSafetyVerificationEntity.fromJson(res.body);
|
|
}
|
|
|
|
Future<LoginEntity> login(
|
|
String loginType,
|
|
String password,
|
|
String countryCode,
|
|
String username) async {
|
|
final res = await apiProvider.login(loginType, password, countryCode, username);
|
|
return LoginEntity.fromJson(res.body);
|
|
}
|
|
|
|
}
|
|
|