mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-11 02:36:54 +08:00
feat: optimize chat list sorting
This commit is contained in:
@@ -148,6 +148,7 @@ export class ChatRecord {
|
||||
export class Chat {
|
||||
id?: number
|
||||
create_time?: Date | string
|
||||
latest_record_time?: Date | string
|
||||
create_by?: number
|
||||
brief?: string
|
||||
chat_type?: string
|
||||
@@ -161,6 +162,7 @@ export class Chat {
|
||||
constructor(
|
||||
id: number,
|
||||
create_time: Date | string,
|
||||
latest_record_time: Date | string,
|
||||
create_by: number,
|
||||
brief: string,
|
||||
chat_type: string,
|
||||
@@ -170,6 +172,7 @@ export class Chat {
|
||||
constructor(
|
||||
id?: number,
|
||||
create_time?: Date | string,
|
||||
latest_record_time?: Date | string,
|
||||
create_by?: number,
|
||||
brief?: string,
|
||||
chat_type?: string,
|
||||
@@ -178,6 +181,7 @@ export class Chat {
|
||||
) {
|
||||
this.id = id
|
||||
this.create_time = getDate(create_time)
|
||||
this.latest_record_time = getDate(latest_record_time ?? create_time)
|
||||
this.create_by = create_by
|
||||
this.brief = brief
|
||||
this.chat_type = chat_type
|
||||
@@ -196,6 +200,7 @@ export class ChatInfo extends Chat {
|
||||
constructor(
|
||||
id: number,
|
||||
create_time: Date | string,
|
||||
latest_record_time: Date | string,
|
||||
create_by: number,
|
||||
brief: string,
|
||||
chat_type: string,
|
||||
@@ -211,6 +216,7 @@ export class ChatInfo extends Chat {
|
||||
constructor(
|
||||
param1?: number | Chat,
|
||||
create_time?: Date | string,
|
||||
latest_record_time?: Date | string,
|
||||
create_by?: number,
|
||||
brief?: string,
|
||||
chat_type?: string,
|
||||
@@ -228,6 +234,7 @@ export class ChatInfo extends Chat {
|
||||
if (param1 instanceof Chat) {
|
||||
this.id = param1.id
|
||||
this.create_time = getDate(param1.create_time)
|
||||
this.latest_record_time = getDate(param1.latest_record_time ?? param1.create_time)
|
||||
this.create_by = param1.create_by
|
||||
this.brief = param1.brief
|
||||
this.chat_type = param1.chat_type
|
||||
@@ -239,6 +246,7 @@ export class ChatInfo extends Chat {
|
||||
} else {
|
||||
this.id = param1
|
||||
this.create_time = getDate(create_time)
|
||||
this.latest_record_time = getDate(latest_record_time ?? create_time)
|
||||
this.create_by = create_by
|
||||
this.brief = brief
|
||||
this.chat_type = chat_type
|
||||
@@ -408,6 +416,7 @@ export const chatApi = {
|
||||
return new ChatInfo(
|
||||
data.id,
|
||||
data.create_time,
|
||||
data.latest_record_time,
|
||||
data.create_by,
|
||||
data.brief,
|
||||
data.chat_type,
|
||||
|
||||
Reference in New Issue
Block a user