mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-23 18:00:32 +08:00
OA tag fields modify
This commit is contained in:
parent
60418276bd
commit
5639c985df
@ -289,16 +289,16 @@ type OANotificationElem struct {
|
|||||||
Url string `mapstructure:"url"`
|
Url string `mapstructure:"url"`
|
||||||
MixType int32 `mapstructure:"mixType"`
|
MixType int32 `mapstructure:"mixType"`
|
||||||
Image struct {
|
Image struct {
|
||||||
SourceUrl string `mapstructure:"sourceUrl"`
|
SourceUrl string `mapstructure:"sourceURL"`
|
||||||
SnapshotUrl string `mapstructure:"snapshotUrl"`
|
SnapshotUrl string `mapstructure:"snapshotURL"`
|
||||||
} `mapstructure:"image"`
|
} `mapstructure:"image"`
|
||||||
Video struct {
|
Video struct {
|
||||||
SourceUrl string `mapstructure:"sourceUrl"`
|
SourceUrl string `mapstructure:"sourceURL"`
|
||||||
SnapshotUrl string `mapstructure:"snapshotUrl"`
|
SnapshotUrl string `mapstructure:"snapshotURL"`
|
||||||
Duration int64 `mapstructure:"duration"`
|
Duration int64 `mapstructure:"duration"`
|
||||||
} `mapstructure:"video"`
|
} `mapstructure:"video"`
|
||||||
File struct {
|
File struct {
|
||||||
SourceUrl string `mapstructure:"sourceUrl"`
|
SourceUrl string `mapstructure:"sourceURL"`
|
||||||
FileName string `mapstructure:"fileName"`
|
FileName string `mapstructure:"fileName"`
|
||||||
FileSize int64 `mapstructure:"fileSize"`
|
FileSize int64 `mapstructure:"fileSize"`
|
||||||
} `mapstructure:"file"`
|
} `mapstructure:"file"`
|
||||||
|
@ -103,7 +103,7 @@ func (s *officeServer) GetUserTags(_ context.Context, req *pbOffice.GetUserTagsR
|
|||||||
|
|
||||||
func (s *officeServer) CreateTag(_ context.Context, req *pbOffice.CreateTagReq) (resp *pbOffice.CreateTagResp, err error) {
|
func (s *officeServer) CreateTag(_ context.Context, req *pbOffice.CreateTagReq) (resp *pbOffice.CreateTagResp, err error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "CreateTag req", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "CreateTag req", req.String())
|
||||||
userIDList := utils.RemoveUserIDRepByMap(req.UserIDList)
|
userIDList := utils.RemoveRepeatedStringInList(req.UserIDList)
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "userIDList: ", userIDList)
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "userIDList: ", userIDList)
|
||||||
resp = &pbOffice.CreateTagResp{CommonResp: &pbOffice.CommonResp{}}
|
resp = &pbOffice.CreateTagResp{CommonResp: &pbOffice.CommonResp{}}
|
||||||
if err := db.DB.CreateTag(req.UserID, req.TagName, userIDList); err != nil {
|
if err := db.DB.CreateTag(req.UserID, req.TagName, userIDList); err != nil {
|
||||||
@ -132,8 +132,8 @@ func (s *officeServer) DeleteTag(_ context.Context, req *pbOffice.DeleteTagReq)
|
|||||||
func (s *officeServer) SetTag(_ context.Context, req *pbOffice.SetTagReq) (resp *pbOffice.SetTagResp, err error) {
|
func (s *officeServer) SetTag(_ context.Context, req *pbOffice.SetTagReq) (resp *pbOffice.SetTagResp, err error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp = &pbOffice.SetTagResp{CommonResp: &pbOffice.CommonResp{}}
|
resp = &pbOffice.SetTagResp{CommonResp: &pbOffice.CommonResp{}}
|
||||||
IncreaseUserIDList := utils.RemoveUserIDRepByMap(req.IncreaseUserIDList)
|
IncreaseUserIDList := utils.RemoveRepeatedStringInList(req.IncreaseUserIDList)
|
||||||
reduceUserIDList := utils.RemoveUserIDRepByMap(req.ReduceUserIDList)
|
reduceUserIDList := utils.RemoveRepeatedStringInList(req.ReduceUserIDList)
|
||||||
if err := db.DB.SetTag(req.UserID, req.TagID, req.NewName, IncreaseUserIDList, reduceUserIDList); err != nil {
|
if err := db.DB.SetTag(req.UserID, req.TagID, req.NewName, IncreaseUserIDList, reduceUserIDList); err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetTag failed", err.Error())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetTag failed", err.Error())
|
||||||
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
||||||
@ -171,7 +171,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR
|
|||||||
userIDList = append(userIDList, tagUserIDList...)
|
userIDList = append(userIDList, tagUserIDList...)
|
||||||
userIDList = append(userIDList, groupUserIDList...)
|
userIDList = append(userIDList, groupUserIDList...)
|
||||||
userIDList = append(userIDList, req.UserList...)
|
userIDList = append(userIDList, req.UserList...)
|
||||||
userIDList = utils.RemoveUserIDRepByMap(userIDList)
|
userIDList = utils.RemoveRepeatedStringInList(userIDList)
|
||||||
for i, userID := range userIDList {
|
for i, userID := range userIDList {
|
||||||
if userID == req.SendID || userID == "" {
|
if userID == req.SendID || userID == "" {
|
||||||
userIDList = append(userIDList[:i], userIDList[i+1:]...)
|
userIDList = append(userIDList[:i], userIDList[i+1:]...)
|
||||||
|
@ -491,7 +491,7 @@ func (d *DataBases) SetTag(userID, tagID, newName string, increaseUserIDList []s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tag.UserList = append(tag.UserList, increaseUserIDList...)
|
tag.UserList = append(tag.UserList, increaseUserIDList...)
|
||||||
tag.UserList = utils.RemoveUserIDRepByMap(tag.UserList)
|
tag.UserList = utils.RemoveRepeatedStringInList(tag.UserList)
|
||||||
for _, v := range reduceUserIDList {
|
for _, v := range reduceUserIDList {
|
||||||
for i2, v2 := range tag.UserList {
|
for i2, v2 := range tag.UserList {
|
||||||
if v == v2 {
|
if v == v2 {
|
||||||
|
@ -77,7 +77,7 @@ func OperationIDGenerator() string {
|
|||||||
return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10)
|
return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemoveUserIDRepByMap(slc []string) []string {
|
func RemoveRepeatedStringInList(slc []string) []string {
|
||||||
var result []string
|
var result []string
|
||||||
tempMap := map[string]byte{}
|
tempMap := map[string]byte{}
|
||||||
for _, e := range slc {
|
for _, e := range slc {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user