import 'dart:async'; import 'dart:io'; import 'package:dio/dio.dart'; import 'package:sk_base_mobile/constants/global_url.dart'; import 'package:sk_base_mobile/services/dio.service.dart'; import '../constants/constants.dart'; Future login(String? oauthType, String? token) { return DioService.dio.post(Urls.login, data: {'oauthType': oauthType, 'token': token}, options: Options(contentType: "application/x-www-form-urlencoded")); } Future logout() { return DioService.dio.post( Urls.logout, ); } Future deleteAccount() { return DioService.dio.post( Urls.deleteAccount, ); } Future getAppConfig() { Map query = {'ver': 0}; return DioService.dio.get(Urls.getAppConfig, queryParameters: query); } Future saveUserInfo(Map data) { return DioService.dio.post(Urls.saveUserInfo, data: data); } Future getUserInfo(String userId) { Map data = { "userId": userId, }; return DioService.dio.get(Urls.getUserInfo, queryParameters: data); } Future uploadImg(File file) async { // DateTime dateTime = DateTime.now(); // String fileName = file.path.split('/').last; // String format = fileName.split('.').last; // int imageTimeName = dateTime.millisecondsSinceEpoch + // (dateTime.microsecondsSinceEpoch ~/ 1000000); // String imageName = '$imageTimeName.$format'; // String host = AppInfoService.to.ossPolicy.host!; // String dir = AppInfoService.to.ossPolicy.dir!; // final filePath = await MultipartFile.fromFile(file.path, filename: fileName); // final formData = FormData.fromMap({ // 'ossaccessKeyId': AppInfoService.to.ossPolicy.accessKeyId, // 'policy': AppInfoService.to.ossPolicy.policy, // 'signature': AppInfoService.to.ossPolicy.signature, // 'callback': AppInfoService.to.ossPolicy.callback, // 'key': '$dir/$imageName', // 'file': filePath, // }); // return DioService.dio.post(host, data: formData); return {} as Response; } Future updateAvatar(String filename) { return DioService.dio.post(Urls.updateAvatar, data: {'avatarPath': filename}); }