queryMaxOrderSeqMsgWithChannel method

Future<WKMsg?> queryMaxOrderSeqMsgWithChannel(
  1. String channelID,
  2. int channelType
)

Implementation

Future<WKMsg?> queryMaxOrderSeqMsgWithChannel(
    String channelID, int channelType) async {
  WKMsg? wkMsg;
  String sql =
      "select * from ${WKDBConst.tableMessage} where channel_id=? and channel_type=? and is_deleted=0 and type<>0 and type<>99 order by order_seq desc limit 1";
  List<Map<String, Object?>> list = await WKDBHelper.shared
      .getDB()!
      .rawQuery(sql, [channelID, channelType]);
  if (list.isNotEmpty) {
    dynamic data = list[0];
    if (data != null) {
      wkMsg = WKDBConst.serializeWKMsg(data);
    }
  }
  if (wkMsg != null) {
    wkMsg.reactionList =
        await ReactionDB.shared.queryWithMessageId(wkMsg.messageID);
  }
  return wkMsg;
}