Skip to content

Commit

Permalink
Merge pull request #17 from CloudStriver/fix/删除文件后删除文件的所有关系
Browse files Browse the repository at this point in the history
  • Loading branch information
Love-YeLin authored Apr 2, 2024
2 parents a003b51 + 2918db3 commit 7972a21
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
3 changes: 0 additions & 3 deletions app/mq/createNotification.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)

const chanCount = 10
const bufferCount = 1024

type CreateNotificationMq struct {
ctx context.Context
svcCtx *svc.ServiceContext
Expand Down
5 changes: 2 additions & 3 deletions app/mq/deleteFileRelation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"github.com/CloudStriver/cloudmind-mq/app/svc"
"github.com/CloudStriver/cloudmind-mq/app/util/message"
"github.com/CloudStriver/go-pkg/utils/pconvertor"
"github.com/CloudStriver/service-idl-gen-go/kitex_gen/cloudmind/content"
"github.com/CloudStriver/service-idl-gen-go/kitex_gen/platform/relation"
"github.com/bytedance/sonic"
"github.com/samber/lo"
Expand All @@ -32,14 +31,14 @@ func (l *DeleteFileRelationMq) Consume(_, value string) error {
return err
}

if err := mr.Finish(lo.Map(msg.Files, func(item *content.FileParameter, _ int) func() error {
if err := mr.Finish(lo.Map(msg.Files, func(item string, _ int) func() error {
var i int64
for i = 1; i <= l.svcCtx.Config.RelationLength; i++ {
_, _ = l.svcCtx.RelationRPC.DeleteRelation(l.ctx, &relation.DeleteRelationReq{
FromType: msg.FromType,
FromId: msg.FromId,
ToType: msg.ToType,
ToId: item.FileId,
ToId: item,
RelationType: i,
})
}
Expand Down
10 changes: 4 additions & 6 deletions app/util/message/message.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package message

import "github.com/CloudStriver/service-idl-gen-go/kitex_gen/cloudmind/content"

type CreateNotificationMessage struct {
TargetUserId string
SourceUserId string
Expand Down Expand Up @@ -41,8 +39,8 @@ type DeleteNotificationsMessage struct {
}

type DeleteFileRelationsMessage struct {
FromType int64 `json:"fromType"`
FromId string `json:"fromId"`
ToType int64 `json:"toType"`
Files []*content.FileParameter `json:"files"`
FromType int64 `json:"fromType"`
FromId string `json:"fromId"`
ToType int64 `json:"toType"`
Files []string `json:"files"`
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/CloudStriver/go-pkg v0.0.0-20240206060942-84060a3dd273
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240320133349-b226a7105473
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402021409-326abc356747
github.com/bytedance/sonic v1.10.2
github.com/samber/lo v1.39.0
github.com/zeromicro/go-queue v1.1.8
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ github.com/CloudStriver/service-idl-gen-go v0.0.0-20240316123600-5ec7ab682e84 h1
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240316123600-5ec7ab682e84/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240320133349-b226a7105473 h1:DmHH+V9hMFgGcXZSV8n/IW9OvD0ge9AiA+ZE+I73zUo=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240320133349-b226a7105473/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402021409-326abc356747 h1:+wHcqO0Mfk7UBKBXl0eD5ctjHTN08WpB71g0F9arBYQ=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402021409-326abc356747/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down

0 comments on commit 7972a21

Please sign in to comment.