29 lines
821 B
Dart
29 lines
821 B
Dart
|
|
import '../../core/constants/api_endpoints.dart';
|
||
|
|
import '../../core/network/api_response.dart';
|
||
|
|
import '../../core/network/dio_client.dart';
|
||
|
|
|
||
|
|
/// 福利服务
|
||
|
|
class BonusService {
|
||
|
|
final DioClient _client;
|
||
|
|
|
||
|
|
BonusService(this._client);
|
||
|
|
|
||
|
|
/// 查询新人福利状态
|
||
|
|
Future<ApiResponse<Map<String, dynamic>>> getStatus() async {
|
||
|
|
final response = await _client.get<Map<String, dynamic>>(
|
||
|
|
ApiEndpoints.bonusStatus,
|
||
|
|
);
|
||
|
|
if (response.success && response.data != null) {
|
||
|
|
return ApiResponse.success(response.data!, response.message);
|
||
|
|
}
|
||
|
|
return ApiResponse.fail(response.message ?? '获取福利状态失败');
|
||
|
|
}
|
||
|
|
|
||
|
|
/// 领取新人福利
|
||
|
|
Future<ApiResponse<Map<String, dynamic>>> claim() async {
|
||
|
|
return _client.post<Map<String, dynamic>>(
|
||
|
|
ApiEndpoints.bonusClaim,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|