track_dao.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'package:dio/dio.dart';
  2. import 'package:flutter_tracker/dio/api.dart';
  3. import 'package:flutter_tracker/model/submit_model.dart';
  4. /// Description:
  5. /// Time : 2021年12月03日 Friday
  6. /// Author : liuyuqi.gov@msncn
  7. class TrackDao {
  8. static Map<String, dynamic> params = <String, dynamic>{};
  9. static Future<SubmitModel> uploadImg(
  10. String token, String filePath, String fileName) async {
  11. params.addAll({"token": token, "filePath": filePath, "fileName": fileName});
  12. await Dio()
  13. .post(Api.uploadImgUrl, queryParameters: params)
  14. .then((response) {
  15. return SubmitModel.fromJson(response.data);
  16. });
  17. return SubmitModel.fromJson({"success": false, "msg": "网络错误"});
  18. }
  19. static Future<SubmitModel> uploadTrack(
  20. String token, String telphone, String address, bool health) async {
  21. params.addAll({
  22. "token": token,
  23. "telphone": telphone,
  24. "address": address,
  25. "health": health
  26. });
  27. await Dio()
  28. .post(Api.uploadTrackUrl, queryParameters: params)
  29. .then((response) {
  30. return SubmitModel.fromJson(response.data);
  31. });
  32. return SubmitModel.fromJson({"success": false, "msg": "网络错误"});
  33. }
  34. }