getMessageNotifyList static method

Future<String> getMessageNotifyList(
  1. String userId,
  2. String? deviceId,
  3. int? readStatus
)

获取消息通知列表 userId app用户id deviceId 绑定的设备id readStatus 阅读状态 0-未阅 1-已阅

Implementation

static Future<String> getMessageNotifyList(String userId,String? deviceId,int? readStatus) 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,
    'readStatus': readStatus,
  };
  if(deviceId == null) {
    params.remove('deviceId');
  }
  if(readStatus == null) {
    params.remove('readStatus');
  }
  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_MESSAGE_NOTIFY_LIST,
      data: data,
      options: options);
  return formatResponse(result);
}