version_repository.dart
1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'dart:io';
import 'package:appframe/config/locator.dart';
import 'package:appframe/services/api_service.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
class VersionRepository {
late final ApiService _appService;
VersionRepository() {
_appService = getIt<ApiService>(instanceName: 'appApiService');
}
///
/// 参数
/// {
/// "userid":"xxxxxxx",
/// "ver":"1.0.9",
/// "sence":"xxj"
/// }
/// 返回
/// {"code":0,"data":{"force":0,"lastVersion":"","url":""},"message":"查询成功"}
///
///
Future<dynamic> globalVersion(String userid, String ver, String sence) async {
try {
Response resp = await _appService.get(
'/api/v1/comm/golbal/version',
queryParameters: {
"userid": userid,
"ver": ver,
"sence": sence,
},
);
return resp.statusCode == HttpStatus.ok ? resp.data : null;
} on DioException catch (e) {
debugPrint('globalVersion网络异常: $e');
return null;
}
}
}