mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 05:52:29 +08:00
add groupName Condition
This commit is contained in:
parent
c39d9d3e7b
commit
717a409aaa
@ -20,6 +20,7 @@ import (
|
||||
|
||||
pbgroup "github.com/openimsdk/protocol/group"
|
||||
"github.com/openimsdk/protocol/sdkws"
|
||||
"github.com/openimsdk/tools/errs"
|
||||
"github.com/openimsdk/tools/mcontext"
|
||||
)
|
||||
|
||||
@ -54,11 +55,11 @@ func UpdateGroupInfoMap(ctx context.Context, group *sdkws.GroupInfoForSet) map[s
|
||||
return m
|
||||
}
|
||||
|
||||
func UpdateGroupInfoExMap(ctx context.Context, group *pbgroup.SetGroupInfoExReq) map[string]any {
|
||||
func UpdateGroupInfoExMap(ctx context.Context, group *pbgroup.SetGroupInfoExReq) (map[string]any, error) {
|
||||
m := make(map[string]any)
|
||||
|
||||
if group.GroupName != nil {
|
||||
m["group_name"] = group.GroupName
|
||||
if group.GroupName != nil && group.GroupName.Value != "" {
|
||||
return nil, errs.ErrArgs.WrapMsg("group name is empty")
|
||||
}
|
||||
if group.Notification != nil {
|
||||
m["notification"] = group.Notification.Value
|
||||
@ -84,7 +85,7 @@ func UpdateGroupInfoExMap(ctx context.Context, group *pbgroup.SetGroupInfoExReq)
|
||||
m["ex"] = group.Ex.Value
|
||||
}
|
||||
|
||||
return m
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func UpdateGroupStatusMap(status int) map[string]any {
|
||||
|
||||
@ -1104,11 +1104,15 @@ func (g *groupServer) SetGroupInfoEx(ctx context.Context, req *pbgroup.SetGroupI
|
||||
return nil, err
|
||||
}
|
||||
|
||||
updatedData := UpdateGroupInfoExMap(ctx, req)
|
||||
updatedData, err := UpdateGroupInfoExMap(ctx, req)
|
||||
if len(updatedData) == 0 {
|
||||
return &pbgroup.SetGroupInfoExResp{}, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := g.db.UpdateGroup(ctx, group.GroupID, updatedData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user