conversation

This commit is contained in:
wangchuxiao 2023-04-20 16:23:41 +08:00
parent b05bedf243
commit 934e531840
3 changed files with 8 additions and 7 deletions

View File

@ -168,10 +168,11 @@ func (c *ConversationDataBase) SetUserConversations(ctx context.Context, ownerUs
return err
}
if len(existConversations) > 0 {
log.ZDebug(ctx, "SetUserConversations", "existConversations", existConversations)
err = conversationTx.Update(ctx, conversations)
if err != nil {
return err
for _, conversation := range conversations {
err = conversationTx.Update(ctx, conversation)
if err != nil {
return err
}
}
}
var existConversationIDs []string

View File

@ -33,8 +33,8 @@ func (c *ConversationGorm) UpdateByMap(ctx context.Context, userIDList []string,
return utils.Wrap(c.db(ctx).Where("owner_user_id IN (?) and conversation_id=?", userIDList, conversationID).Updates(args).Error, "")
}
func (c *ConversationGorm) Update(ctx context.Context, conversations []*relation.ConversationModel) (err error) {
return utils.Wrap(c.db(ctx).Updates(&conversations).Error, "")
func (c *ConversationGorm) Update(ctx context.Context, conversation *relation.ConversationModel) (err error) {
return utils.Wrap(c.db(ctx).Updates(conversation).Error, "")
}
func (c *ConversationGorm) Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*relation.ConversationModel, err error) {

View File

@ -33,7 +33,7 @@ type ConversationModelInterface interface {
Create(ctx context.Context, conversations []*ConversationModel) (err error)
Delete(ctx context.Context, groupIDs []string) (err error)
UpdateByMap(ctx context.Context, userIDs []string, conversationID string, args map[string]interface{}) (err error)
Update(ctx context.Context, conversations []*ConversationModel) (err error)
Update(ctx context.Context, conversation *ConversationModel) (err error)
Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*ConversationModel, err error)
FindUserID(ctx context.Context, userIDs []string, conversationID string) ([]string, error)
FindUserIDAllConversationID(ctx context.Context, userID string) ([]string, error)