admin
2022-01-12 8327000a0cce5e47226372e0e25c1e6faec497e7
lib/api/http.dart
@@ -28,7 +28,7 @@
  DialogUtil.showDialog(context, LoadingDialog(""));
}
_dismissDialog(BuildContext context) {
dismissDialog(BuildContext context) {
  Navigator.pop(context);
}
@@ -87,6 +87,10 @@
      params["device"] = _iosInfo!.identifierForVendor;
    }
    if (Global.channel != null) {
      params["channel"] = Global.channel;
    }
    params["sign"] = _getSign(params);
    return params;
@@ -102,10 +106,18 @@
    httpClient.connectionTimeout = const Duration(seconds: 20);
    var uri = Uri(
        scheme: "http",
        host: "192.168.3.122",
        host: "api.location.izzql.com",
        path: api,
        port: 8082,
        port: 8090,
        queryParameters: params);
    // var uri = Uri(
    //     scheme: "http",
    //     host: "192.168.3.122",
    //     path: api,
    //     port: 8082,
    //     queryParameters: params);
    print("uri:$uri");
    if (onStart != null) {
@@ -143,7 +155,7 @@
        await HttpUtil.baseRequest("/api/v1/sms/sendSMS", {"phone": phone}, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -183,7 +195,7 @@
        await HttpUtil.baseRequest("/api/v1/user/loginPhone", params, () {
      showLoading(context);
    }, notifyError: true);
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -220,7 +232,7 @@
class LocationApiUtil {
  ///上传位置
  static Future<Map<String, dynamic>?> uploadLocation(
      BaiduLocation location) async {
      SimpleLocation location) async {
    var uid = await UserUtil.getUid();
    var result = await HttpUtil.baseRequest(
        "/api/v1/location/uploadLocation",
@@ -228,7 +240,7 @@
          "latitude": location.latitude.toString(),
          "longitude": location.longitude.toString(),
          "address": location.address,
          "addressDetail": location.locationDetail,
          "addressDetail": location.addressDetail,
          "uid": uid.toString()
        },
        () {});
@@ -287,7 +299,7 @@
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -311,7 +323,7 @@
        "/api/v1/location/updateLocationUser", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -326,7 +338,7 @@
        "/api/v1/location/deleteLocationUser", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -390,6 +402,29 @@
    }
    return null;
  }
  //拒绝定位邀请
  static Future<Map<String, dynamic>?> searchNearBy(
      String kw, double lat, double lon) async {
    var params = {"kw": kw, "lat": lat.toString(), "lon": lon.toString()};
    var result = await HttpUtil.baseRequest(
        "/api/v1/location/searchNearBy", params, () {});
    if (result.success) {
      return result.data;
    }
    return null;
  }
  ///地理位置编码
  static Future<Map<String, dynamic>?> geoCode(double lat, double lon) async {
    var params = {"lat": lat.toString(), "lon": lon.toString()};
    var result =
        await HttpUtil.baseRequest("/api/v1/location/geoCode", params, () {});
    if (result.success) {
      return result.data;
    }
    return null;
  }
}
class SOSApiUtil {
@@ -418,7 +453,7 @@
        "/api/v1/sos/addEmergencyContacts", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -462,7 +497,7 @@
        "/api/v1/sos/deleteEmergencyContacts", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -495,7 +530,7 @@
        "/api/v1/sos/updateEmergencyContacts", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -516,13 +551,14 @@
    params["latitude"] = location.latitude.toString();
    params["longitude"] = location.longitude.toString();
    params["address"] = location.address.toString();
    params["addressDetail"] = location.addressDetail.toString();
    params["addressDetail"] =
        location.addressDetail == null ? "" : location.addressDetail.toString();
    var result =
        await HttpUtil.baseRequest("/api/v1/sos/addSOSRecord", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -565,7 +601,7 @@
        await HttpUtil.baseRequest("/api/v1/sos/clearSOSRecord", params, () {
      showLoading(context);
    });
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }
@@ -633,7 +669,7 @@
      showLoading(context);
    }, notifyError: true);
    _dismissDialog(context);
    dismissDialog(context);
    if (result.success) {
      return result.data;
    }