docs(deploy): 添加部署文档和安全设计规范
- 新增 XuqmGroup 部署文档,包含部署方案、架构建议和部署步骤 - 添加安全设计规范,涵盖密码安全、AppSecret验证和服务端API认证 - 补充平台REST API规范,定义Server-to-Server调用接口和错误码 - 创建Java IM服务端SDK计划文档,规划Maven包发布和接口实现
这个提交包含在:
父节点
09d42fa94f
当前提交
005860814d
@ -4,7 +4,7 @@ import { field, date } from '@nozbe/watermelondb/decorators'
|
|||||||
export class ConversationModel extends Model {
|
export class ConversationModel extends Model {
|
||||||
static table = 'im_conversations'
|
static table = 'im_conversations'
|
||||||
|
|
||||||
@field('app_id') appKey!: string
|
@field('app_key') appKey!: string
|
||||||
@field('target_id') targetId!: string
|
@field('target_id') targetId!: string
|
||||||
@field('chat_type') chatType!: string
|
@field('chat_type') chatType!: string
|
||||||
@field('last_msg_id') lastMsgId!: string | null
|
@field('last_msg_id') lastMsgId!: string | null
|
||||||
|
|||||||
@ -91,7 +91,7 @@ export const ImDatabase = {
|
|||||||
// upsert conversation — preserve isMuted/isPinned on update
|
// upsert conversation — preserve isMuted/isPinned on update
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', msg.appKey), Q.where('target_id', msg.toId))
|
.query(Q.where('app_key', msg.appKey), Q.where('target_id', msg.toId))
|
||||||
.fetch()
|
.fetch()
|
||||||
|
|
||||||
const msgTime = new Date(msg.createdAt).getTime()
|
const msgTime = new Date(msg.createdAt).getTime()
|
||||||
@ -132,7 +132,7 @@ export const ImDatabase = {
|
|||||||
const db = getDb()
|
const db = getDb()
|
||||||
const messages = await db
|
const messages = await db
|
||||||
.get<MessageModel>('im_messages')
|
.get<MessageModel>('im_messages')
|
||||||
.query(Q.where('app_id', appKey), Q.where('server_id', messageId))
|
.query(Q.where('app_key', appKey), Q.where('server_id', messageId))
|
||||||
.fetch()
|
.fetch()
|
||||||
if (messages.length === 0) return
|
if (messages.length === 0) return
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ export const ImDatabase = {
|
|||||||
|
|
||||||
const conversations = await db
|
const conversations = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', message.toId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', message.toId))
|
||||||
.fetch()
|
.fetch()
|
||||||
|
|
||||||
if (conversations.length > 0) {
|
if (conversations.length > 0) {
|
||||||
@ -182,7 +182,7 @@ export const ImDatabase = {
|
|||||||
return db
|
return db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(
|
.query(
|
||||||
Q.where('app_id', appKey),
|
Q.where('app_key', appKey),
|
||||||
Q.sortBy('last_msg_time', Q.desc),
|
Q.sortBy('last_msg_time', Q.desc),
|
||||||
)
|
)
|
||||||
.fetch()
|
.fetch()
|
||||||
@ -192,7 +192,7 @@ export const ImDatabase = {
|
|||||||
const db = getDb()
|
const db = getDb()
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', targetId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', targetId))
|
||||||
.fetch()
|
.fetch()
|
||||||
if (convs.length > 0) {
|
if (convs.length > 0) {
|
||||||
await db.write(async () => {
|
await db.write(async () => {
|
||||||
@ -206,7 +206,7 @@ export const ImDatabase = {
|
|||||||
const db = getDb()
|
const db = getDb()
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', targetId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', targetId))
|
||||||
.fetch()
|
.fetch()
|
||||||
if (convs.length > 0) {
|
if (convs.length > 0) {
|
||||||
await db.write(async () => {
|
await db.write(async () => {
|
||||||
@ -227,7 +227,7 @@ export const ImDatabase = {
|
|||||||
async searchMessages(appKey: string, params: MessageSearchParams): Promise<MessageModel[]> {
|
async searchMessages(appKey: string, params: MessageSearchParams): Promise<MessageModel[]> {
|
||||||
const db = getDb()
|
const db = getDb()
|
||||||
const conditions: any[] = [
|
const conditions: any[] = [
|
||||||
Q.where('app_id', appKey),
|
Q.where('app_key', appKey),
|
||||||
]
|
]
|
||||||
|
|
||||||
if (params.toId) {
|
if (params.toId) {
|
||||||
@ -271,7 +271,7 @@ export const ImDatabase = {
|
|||||||
const query = db
|
const query = db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(
|
.query(
|
||||||
Q.where('app_id', appKey),
|
Q.where('app_key', appKey),
|
||||||
Q.sortBy('is_pinned', Q.desc),
|
Q.sortBy('is_pinned', Q.desc),
|
||||||
Q.sortBy('last_msg_time', Q.desc),
|
Q.sortBy('last_msg_time', Q.desc),
|
||||||
)
|
)
|
||||||
@ -284,7 +284,7 @@ export const ImDatabase = {
|
|||||||
const db = getDb()
|
const db = getDb()
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', targetId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', targetId))
|
||||||
.fetch()
|
.fetch()
|
||||||
if (convs.length > 0) {
|
if (convs.length > 0) {
|
||||||
await db.write(async () => {
|
await db.write(async () => {
|
||||||
@ -297,7 +297,7 @@ export const ImDatabase = {
|
|||||||
const db = getDb()
|
const db = getDb()
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', targetId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', targetId))
|
||||||
.fetch()
|
.fetch()
|
||||||
if (convs.length > 0) {
|
if (convs.length > 0) {
|
||||||
await db.write(async () => {
|
await db.write(async () => {
|
||||||
@ -314,7 +314,7 @@ export const ImDatabase = {
|
|||||||
const db = getDb()
|
const db = getDb()
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', targetId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', targetId))
|
||||||
.fetch()
|
.fetch()
|
||||||
if (convs.length === 0) return null
|
if (convs.length === 0) return null
|
||||||
return convs[0].draft
|
return convs[0].draft
|
||||||
@ -325,7 +325,7 @@ export const ImDatabase = {
|
|||||||
const convId = conversationId(appKey, currentUserId, targetId, chatType)
|
const convId = conversationId(appKey, currentUserId, targetId, chatType)
|
||||||
const convs = await db
|
const convs = await db
|
||||||
.get<ConversationModel>('im_conversations')
|
.get<ConversationModel>('im_conversations')
|
||||||
.query(Q.where('app_id', appKey), Q.where('target_id', targetId))
|
.query(Q.where('app_key', appKey), Q.where('target_id', targetId))
|
||||||
.fetch()
|
.fetch()
|
||||||
const messages = await db
|
const messages = await db
|
||||||
.get<MessageModel>('im_messages')
|
.get<MessageModel>('im_messages')
|
||||||
|
|||||||
@ -5,7 +5,7 @@ export class MessageModel extends Model {
|
|||||||
static table = 'im_messages'
|
static table = 'im_messages'
|
||||||
|
|
||||||
@field('server_id') serverId!: string
|
@field('server_id') serverId!: string
|
||||||
@field('app_id') appKey!: string
|
@field('app_key') appKey!: string
|
||||||
@field('conversation_id') conversationId!: string
|
@field('conversation_id') conversationId!: string
|
||||||
@field('from_user_id') fromUserId!: string
|
@field('from_user_id') fromUserId!: string
|
||||||
@field('to_id') toId!: string
|
@field('to_id') toId!: string
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const imDbSchema = appSchema({
|
|||||||
tableSchema({
|
tableSchema({
|
||||||
name: 'im_conversations',
|
name: 'im_conversations',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'app_id', type: 'string', isIndexed: true },
|
{ name: 'app_key', type: 'string', isIndexed: true },
|
||||||
{ name: 'target_id', type: 'string', isIndexed: true },
|
{ name: 'target_id', type: 'string', isIndexed: true },
|
||||||
{ name: 'chat_type', type: 'string' },
|
{ name: 'chat_type', type: 'string' },
|
||||||
{ name: 'last_msg_id', type: 'string', isOptional: true },
|
{ name: 'last_msg_id', type: 'string', isOptional: true },
|
||||||
@ -24,7 +24,7 @@ export const imDbSchema = appSchema({
|
|||||||
name: 'im_messages',
|
name: 'im_messages',
|
||||||
columns: [
|
columns: [
|
||||||
{ name: 'server_id', type: 'string', isIndexed: true },
|
{ name: 'server_id', type: 'string', isIndexed: true },
|
||||||
{ name: 'app_id', type: 'string', isIndexed: true },
|
{ name: 'app_key', type: 'string', isIndexed: true },
|
||||||
{ name: 'conversation_id', type: 'string', isIndexed: true },
|
{ name: 'conversation_id', type: 'string', isIndexed: true },
|
||||||
{ name: 'from_user_id', type: 'string' },
|
{ name: 'from_user_id', type: 'string' },
|
||||||
{ name: 'to_id', type: 'string' },
|
{ name: 'to_id', type: 'string' },
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户