getAllRecords static method

Future<String> getAllRecords(
  1. String userId,
  2. String deviceId,
  3. int? extractType,
  4. String? startDate,
  5. String? endDate,
)

获取所有萃取记录 userId app用户id deviceId 绑定的设备id extractType 萃取模式类型,0-标准模式1-专业模式 2-变压模式 3-手动模式 4-滤滴模式 startDate 开始时间,yyyy-MM-dd,为空则是不限制起始时间 endDate 结束时间,yyyy-MM-dd,为空则是不限制结束时间

Implementation

static Future<String> getAllRecords(String userId,String deviceId,int? extractType,String? startDate,String? endDate) async {
  Map<String,String> headers = {
    'tenantId': '10002',
    'token': SpUtil().getString(SpUtil.SP_KEY_ACCESS_TOKEN) ?? '',
    'appSource': 'Maxims',
    'reqSource': '1',
  };
  int timestamp = DateTime.now().millisecondsSinceEpoch;
  String randomStr = CipherUtil.generateRandomString(6);
  Map<String,dynamic> params = {
    'userId': userId,
    'deviceId': deviceId,
    'extractType': extractType,
    'startDate': startDate,
    'endDate': endDate,
  };
  if(extractType == null){
    params.remove("extractType");
  }
  if(startDate == null){
    params.remove("startDate");
  }
  if(endDate == null){
    params.remove("endDate");
  }
  Map<String,dynamic> data = {
    'timestamp': timestamp,
    'appKey': BaseHttpConstant.APP_BUSINESS_KEY,
    'nonceStr': randomStr,
    'signVersion': '1',
    'data': params,
  };
  String sign = CipherUtil.generateSignature2(data, ['data'], BaseHttpConstant.APP_BUSINESS_SECRET);
  data['sign'] = sign;
  Options options = Options(
    headers: headers,
    contentType: Headers.jsonContentType,
  );
  var result = await HttpUtils.post(true, Api.PATH_GET_ALL_EXTRACT_RECORD,
      data: data,
      options: options);
  return formatResponse(result);
}