35 lines
611 B
TypeScript
35 lines
611 B
TypeScript
import { RecordModel } from "pocketbase"
|
|
|
|
import { managePbError } from "../../utils/pbTools"
|
|
import pbClient from "../pbClient"
|
|
|
|
const DB_NAME = "message_log"
|
|
|
|
export interface Log {
|
|
api_key: string
|
|
group_id?: string
|
|
receive_id?: string
|
|
receive_id_type?: string
|
|
msg_type: string
|
|
content: string
|
|
final_content?: string
|
|
send_result?: any
|
|
error?: string
|
|
}
|
|
|
|
export type LogModel = Log & RecordModel
|
|
|
|
/**
|
|
* 创建一条日志
|
|
* @param log
|
|
* @returns
|
|
*/
|
|
const create = (log: Log) =>
|
|
managePbError(() => pbClient.collection(DB_NAME).create(log))
|
|
|
|
const log = {
|
|
create,
|
|
}
|
|
|
|
export default log
|