Merge branch 'tuoyun'

pull/215/head
wangchuxiao 3 years ago
commit b536165910

@ -10,6 +10,7 @@ import (
"Open_IM/internal/api/office"
apiThird "Open_IM/internal/api/third"
"Open_IM/internal/api/user"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"flag"
@ -67,7 +68,11 @@ func main() {
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1
groupRouterGroup.POST("/dismiss_group", group.DismissGroup)
groupRouterGroup.POST("/dismiss_group", group.DismissGroup) //
groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember)
groupRouterGroup.POST("/cancel_mute_group_member", group.CancelMuteGroupMember) //MuteGroup
groupRouterGroup.POST("/mute_group", group.MuteGroup)
groupRouterGroup.POST("/cancel_mute_group", group.CancelMuteGroup)
}
//certificate
authRouterGroup := r.Group("/auth")
@ -114,6 +119,7 @@ func main() {
officeGroup := r.Group("/office")
{
officeGroup.POST("/get_user_tags", office.GetUserTags)
officeGroup.POST("/get_user_tag_by_id", office.GetUserTagByID)
officeGroup.POST("/create_tag", office.CreateTag)
officeGroup.POST("/delete_tag", office.DeleteTag)
officeGroup.POST("/set_tag", office.SetTag)
@ -121,7 +127,7 @@ func main() {
officeGroup.POST("/get_send_tag_log", office.GetTagSendLogs)
}
apiThird.MinioInit()
log.NewPrivateLog("api")
log.NewPrivateLog(constant.LogFileName)
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
flag.Parse()
r.Run(":" + strconv.Itoa(*ginPort))

@ -2,6 +2,7 @@ package main
import (
"Open_IM/internal/demo/register"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"flag"
@ -23,7 +24,7 @@ func main() {
authRouterGroup.POST("/login", register.Login)
authRouterGroup.POST("/reset_password", register.ResetPassword)
}
log.NewPrivateLog("demo")
log.NewPrivateLog(constant.LogFileName)
ginPort := flag.Int("port", 42233, "get ginServerPort from cmd,default 42233 as port")
flag.Parse()
r.Run(":" + strconv.Itoa(*ginPort))

@ -1,6 +1,7 @@
package main
import (
"Open_IM/pkg/common/constant"
commonDB "Open_IM/pkg/common/db"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
@ -8,7 +9,7 @@ import (
)
func main() {
log.NewPrivateLog("timer")
log.NewPrivateLog(constant.LogFileName)
//for {
// fmt.Println("start delete mongodb expired record")
// timeUnixBegin := time.Now().Unix()

@ -148,7 +148,7 @@ log:
rotationTime: 24
remainRotationCount: 3 #日志数量
#日志级别 6表示全都打印测试阶段建议设置为6
remainLogLevel: 4
remainLogLevel: 6
elasticSearchSwitch: false
elasticSearchAddr: [ 127.0.0.1:9201 ]
elasticSearchUser: ""
@ -366,6 +366,56 @@ notification:
ext: "groupDismissed ext"
defaultTips:
tips: "group dismissed"
groupMuted:
conversation:
reliabilityLevel: 3
unreadCount: true
offlinePush:
switch: false
title: "groupMuted title"
desc: "groupMuted desc"
ext: "groupMuted ext"
defaultTips:
tips: "group Muted"
groupCancelMuted:
conversation:
reliabilityLevel: 3
unreadCount: true
offlinePush:
switch: false
title: "groupCancelMuted title"
desc: "groupCancelMuted desc"
ext: "groupCancelMuted ext"
defaultTips:
tips: "group Cancel Muted"
groupMemberMuted:
conversation:
reliabilityLevel: 3
unreadCount: true
offlinePush:
switch: false
title: "groupMemberMuted title"
desc: "groupMemberMuted desc"
ext: "groupMemberMuted ext"
defaultTips:
tips: "group Member Muted"
groupMemberCancelMuted:
conversation:
reliabilityLevel: 3
unreadCount: true
offlinePush:
switch: false
title: "groupMemberCancelMuted title"
desc: "groupMemberCancelMuted desc"
ext: "groupMemberCancelMuted ext"
defaultTips:
tips: "group Member Cancel Muted"
#############################friend#################################
friendApplicationAdded:
@ -501,6 +551,19 @@ notification:
defaultTips:
tips: "conversation opt update"
conversationSetPrivate:
conversation:
reliabilityLevel: 2
unreadCount: true
offlinePush:
switch: true
title: "burn after reading"
desc: "burn after reading"
ext: "burn after reading"
defaultTips:
openTips: "burn after reading was opened"
closeTips: "burn after reading was closed"
#---------------demo configuration---------------------#

@ -22,7 +22,7 @@ require (
github.com/gin-gonic/gin v1.7.0
github.com/go-playground/validator/v10 v10.4.1
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.1.0
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4 // indirect

@ -53,6 +53,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alibabacloud-go/darabonba-openapi v0.1.7/go.mod h1:6FV1Bt1AItYIlC2rVopPTumrRNtkfPBmrPVAZ8v2bLk=
github.com/alibabacloud-go/darabonba-openapi v0.1.11 h1:w59gtSA0s87p0U5NNG/N/PIHsRP3rtj7qCP9hx9+GL8=
github.com/alibabacloud-go/darabonba-openapi v0.1.11/go.mod h1:MPJMxv7HYrFm5m9uOZWkDYsAWyZztEgnBRfk9Fg0eIU=
github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA=
@ -62,8 +63,11 @@ github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8 h1:KXMiCg99Jx7B6V+DlRFbWw
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8/go.mod h1:8aL6tSyQIWJygF7W/Vqxdf/QDbN2S+u57k36bEA8hD8=
github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
github.com/alibabacloud-go/openapi-util v0.0.8/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
github.com/alibabacloud-go/openapi-util v0.0.9 h1:Z0DP4LFzkM/rW2nxOMiiLoQVZSeE3jVc5jrZ9Fd/UX0=
github.com/alibabacloud-go/openapi-util v0.0.9/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
github.com/alibabacloud-go/sts-20150401 v1.1.0 h1:1yVyKz02ES6aKo3xVjmoPLBH1OAmmSqPkhKRdjEkmYs=
github.com/alibabacloud-go/sts-20150401 v1.1.0/go.mod h1:QW4O/c7Hp4krHYt+6xwnoG8EyZW3V9GYkl6EgIBmxJc=
github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg=
github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
@ -1095,6 +1099,8 @@ gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c=
gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=

@ -128,7 +128,7 @@ func GetConversation(c *gin.Context) {
client := pbUser.NewUserClient(etcdConn)
respPb, err := client.GetConversation(context.Background(), &reqPb)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetConversation rpc failed, ", reqPb.String(), err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
return
}
@ -192,7 +192,7 @@ func SetRecvMsgOpt(c *gin.Context) {
client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetRecvMsgOpt(context.Background(), &reqPb)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetRecvMsgOpt rpc failed, ", reqPb.String(), err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
return
}

@ -568,3 +568,131 @@ func DismissGroup(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
c.JSON(http.StatusOK, resp)
}
func MuteGroupMember(c *gin.Context) {
params := api.MuteGroupMemberReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
req := &rpc.MuteGroupMemberReq{}
utils.CopyStructFields(req, &params)
var ok bool
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
client := rpc.NewGroupClient(etcdConn)
reply, err := client.MuteGroupMember(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
resp := api.MuteGroupMemberResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
c.JSON(http.StatusOK, resp)
}
func CancelMuteGroupMember(c *gin.Context) {
params := api.CancelMuteGroupMemberReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
req := &rpc.CancelMuteGroupMemberReq{}
utils.CopyStructFields(req, &params)
var ok bool
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
client := rpc.NewGroupClient(etcdConn)
reply, err := client.CancelMuteGroupMember(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
resp := api.CancelMuteGroupMemberResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
c.JSON(http.StatusOK, resp)
}
func MuteGroup(c *gin.Context) {
params := api.MuteGroupReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
req := &rpc.MuteGroupReq{}
utils.CopyStructFields(req, &params)
var ok bool
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
client := rpc.NewGroupClient(etcdConn)
reply, err := client.MuteGroup(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
resp := api.MuteGroupResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
c.JSON(http.StatusOK, resp)
}
func CancelMuteGroup(c *gin.Context) {
params := api.CancelMuteGroupReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
req := &rpc.CancelMuteGroupReq{}
utils.CopyStructFields(req, &params)
var ok bool
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
client := rpc.NewGroupClient(etcdConn)
reply, err := client.CancelMuteGroup(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
resp := api.CancelMuteGroupResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
c.JSON(http.StatusOK, resp)
}

@ -140,7 +140,7 @@ func ManagementSendMsg(c *gin.Context) {
}
log.NewInfo("", data, params)
token := c.Request.Header.Get("token")
claims, err := token_verify.ParseToken(token)
claims, err := token_verify.ParseToken(token, params.OperationID)
if err != nil {
log.NewError(params.OperationID, "parse token failed", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
@ -218,16 +218,16 @@ type ManagementSendMsgReq struct {
type PictureBaseInfo struct {
UUID string `mapstructure:"uuid"`
Type string `mapstructure:"type" validate:"required"`
Size int64 `mapstructure:"size" validate:"required"`
Width int32 `mapstructure:"width" validate:"required"`
Height int32 `mapstructure:"height" validate:"required"`
Url string `mapstructure:"url" validate:"required"`
Type string `mapstructure:"type" `
Size int64 `mapstructure:"size" `
Width int32 `mapstructure:"width" `
Height int32 `mapstructure:"height"`
Url string `mapstructure:"url" `
}
type PictureElem struct {
SourcePath string `mapstructure:"sourcePath"`
SourcePicture PictureBaseInfo `mapstructure:"sourcePicture" validate:"required"`
SourcePicture PictureBaseInfo `mapstructure:"sourcePicture"`
BigPicture PictureBaseInfo `mapstructure:"bigPicture" `
SnapshotPicture PictureBaseInfo `mapstructure:"snapshotPicture"`
}
@ -282,25 +282,15 @@ type RevokeElem struct {
RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"`
}
type OANotificationElem struct {
NotificationName string `mapstructure:"notificationName" validate:"required"`
NotificationFaceURL string `mapstructure:"notificationFaceURL" validate:"required"`
NotificationType int32 `mapstructure:"notificationType" validate:"required"`
Text string `mapstructure:"text" validate:"required"`
Url string `mapstructure:"url"`
MixType int32 `mapstructure:"mixType"`
Image struct {
SourceUrl string `mapstructure:"sourceUrl"`
SnapshotUrl string `mapstructure:"snapshotUrl"`
} `mapstructure:"image"`
Video struct {
SourceUrl string `mapstructure:"sourceUrl"`
SnapshotUrl string `mapstructure:"snapshotUrl"`
Duration int64 `mapstructure:"duration"`
} `mapstructure:"video"`
File struct {
SourceUrl string `mapstructure:"sourceUrl"`
FileName string `mapstructure:"fileName"`
FileSize int64 `mapstructure:"fileSize"`
} `mapstructure:"file"`
Ex string `mapstructure:"ex"`
NotificationName string `mapstructure:"notificationName" validate:"required"`
NotificationFaceURL string `mapstructure:"notificationFaceURL" validate:"required"`
NotificationType int32 `mapstructure:"notificationType" validate:"required"`
Text string `mapstructure:"text" validate:"required"`
Url string `mapstructure:"url"`
MixType int32 `mapstructure:"mixType"`
PictureElem PictureElem `mapstructure:"pictureElem"`
SoundElem SoundElem `mapstructure:"soundElem"`
VideoElem VideoElem `mapstructure:"videoElem"`
FileElem FileElem `mapstructure:"fileElem"`
Ex string `mapstructure:"ex"`
}

@ -46,7 +46,11 @@ func GetUserTags(c *gin.Context) {
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
}
resp.Data.Tags = respPb.Tags
if respPb.Tags != nil {
resp.Data.Tags = respPb.Tags
} else {
resp.Data.Tags = []*pbOffice.Tag{}
}
c.JSON(http.StatusOK, resp)
}
@ -229,8 +233,48 @@ func GetTagSendLogs(c *gin.Context) {
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
}
resp.Data.Logs = respPb.TagSendLogs
if respPb.TagSendLogs != nil {
resp.Data.Logs = respPb.TagSendLogs
} else {
resp.Data.Logs = []*pbOffice.TagSendLog{}
}
resp.Data.ShowNumber = respPb.Pagination.ShowNumber
resp.Data.CurrentPage = respPb.Pagination.CurrentPage
c.JSON(http.StatusOK, resp)
}
func GetUserTagByID(c *gin.Context) {
var (
req apistruct.GetUserTagByIDReq
resp apistruct.GetUserTagByIDResp
reqPb pbOffice.GetUserTagByIDReq
respPb *pbOffice.GetUserTagByIDResp
)
if err := c.BindJSON(&req); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
return
}
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return
}
reqPb.UserID = userID
reqPb.OperationID = req.OperationID
reqPb.TagID = req.TagID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.GetUserTagByID(context.Background(), &reqPb)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTagByID failed", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()})
return
}
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
}
resp.Data.Tag = respPb.Tag
c.JSON(http.StatusOK, resp)
}

@ -81,7 +81,7 @@ func MinioUploadFile(c *gin.Context) {
_, err = minioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType})
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "open file error")
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()})
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "invalid file path" + err.Error()})
return
}
resp.NewName = newName

@ -2,6 +2,7 @@ package gate
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
"Open_IM/pkg/statistics"
"fmt"
@ -20,7 +21,7 @@ var (
func Init(rpcPort, wsPort int) {
//log initialization
log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName)
log.NewPrivateLog(constant.LogFileName)
rwLock = new(sync.RWMutex)
validate = validator.New()
statistics.NewStatistics(&sendMsgCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway sendMsgCount", sendMsgCount), 300)

@ -80,6 +80,22 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
mc.groupMsgCount++
}
go sendMessageToPush(&msgFromMQ, msgFromMQ.MsgData.RecvID)
case constant.NotificationChatType:
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = NotificationChatType", isHistory, isPersist)
if isHistory {
err := saveUserChat(msgKey, &msgFromMQ)
if err != nil {
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
return
}
mc.singleMsgCount++
log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time)
}
if !isSenderSync && msgKey == msgFromMQ.MsgData.SendID {
} else {
go sendMessageToPush(&msgFromMQ, msgKey)
}
log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time)
default:
log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String())
return

@ -2,6 +2,7 @@ package logic
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log"
)
@ -13,7 +14,7 @@ var (
)
func Init() {
log.NewPrivateLog(config.Config.ModuleName.MsgTransferName)
log.NewPrivateLog(constant.LogFileName)
persistentCH.Init()
historyCH.Init()
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ms2pschat.Addr, config.Config.Kafka.Ms2pschat.Topic)

@ -34,26 +34,31 @@ func (pc *PersistentConsumerHandler) Init() {
func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey string) {
log.NewInfo("msg come here mysql!!!", "", "msg", string(msg))
var tag bool
msgFromMQ := pbMsg.MsgDataToMQ{}
err := proto.Unmarshal(msg, &msgFromMQ)
if err != nil {
log.ErrorByKv("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
log.NewError(msgFromMQ.OperationID, "msg_transfer Unmarshal msg err", "msg", string(msg), "err", err.Error())
return
}
//Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
//Only process receiver data
if isPersist {
if msgKey == msgFromMQ.MsgData.RecvID && msgFromMQ.MsgData.SessionType == constant.SingleChatType {
log.InfoByKv("msg_transfer msg persisting", msgFromMQ.OperationID)
if err = im_mysql_msg_model.InsertMessageToChatLog(msgFromMQ); err != nil {
log.ErrorByKv("Message insert failed", msgFromMQ.OperationID, "err", err.Error(), "msg", msgFromMQ.String())
return
switch msgFromMQ.MsgData.SessionType {
case constant.SingleChatType, constant.NotificationChatType:
if msgKey == msgFromMQ.MsgData.RecvID {
tag = true
}
} else if msgFromMQ.MsgData.SessionType == constant.GroupChatType && msgKey == msgFromMQ.MsgData.SendID {
log.InfoByKv("msg_transfer msg persisting", msgFromMQ.OperationID)
case constant.GroupChatType:
if msgKey == msgFromMQ.MsgData.SendID || utils.IsContain(msgFromMQ.MsgData.SendID, config.Config.Manager.AppManagerUid) {
tag = true
}
}
if tag {
log.NewInfo(msgFromMQ.OperationID, "msg_transfer msg persisting", string(msg))
if err = im_mysql_msg_model.InsertMessageToChatLog(msgFromMQ); err != nil {
log.ErrorByKv("Message insert failed", msgFromMQ.OperationID, "err", err.Error(), "msg", msgFromMQ.String())
log.NewError(msgFromMQ.OperationID, "Message insert failed", "err", err.Error(), "msg", msgFromMQ.String())
return
}
}

@ -24,7 +24,7 @@ var (
)
func Init(rpcPort int) {
log.NewPrivateLog(config.Config.ModuleName.PushName)
log.NewPrivateLog(constant.LogFileName)
rpcServer.Init(rpcPort)
pushCh.Init()
pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID}

@ -24,7 +24,7 @@ type adminCMSServer struct {
}
func NewAdminCMSServer(port int) *adminCMSServer {
log.NewPrivateLog("AdminCMS")
log.NewPrivateLog(constant.LogFileName)
return &adminCMSServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImAdminCMSName,
@ -66,12 +66,12 @@ func (s *adminCMSServer) Run() {
func (s *adminCMSServer) AdminLogin(_ context.Context, req *pbAdminCMS.AdminLoginReq) (*pbAdminCMS.AdminLoginResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp := &pbAdminCMS.AdminLoginResp{}
for i, adminID := range config.Config.Manager.AppManagerUid{
for i, adminID := range config.Config.Manager.AppManagerUid {
if adminID == req.AdminID && config.Config.Manager.Secrets[i] == req.Secret {
token, expTime, err := token_verify.CreateToken(adminID, constant.SingleChatType)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "generate token success", "token: ", token, "expTime:", expTime)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "generate token failed", "adminID: ", adminID, err.Error())
log.NewError(req.OperationID, utils.GetSelfFuncName(), "generate token failed", "adminID: ", adminID, err.Error())
return resp, openIMHttp.WrapError(constant.ErrTokenUnknown)
}
resp.Token = token
@ -84,4 +84,4 @@ func (s *adminCMSServer) AdminLogin(_ context.Context, req *pbAdminCMS.AdminLogi
return resp, openIMHttp.WrapError(constant.ErrTokenMalformed)
}
return resp, nil
}
}

@ -63,7 +63,7 @@ type rpcAuth struct {
}
func NewRpcAuthServer(port int) *rpcAuth {
log.NewPrivateLog("auth")
log.NewPrivateLog(constant.LogFileName)
return &rpcAuth{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName,

@ -29,7 +29,7 @@ type friendServer struct {
}
func NewFriendServer(port int) *friendServer {
log.NewPrivateLog("friend")
log.NewPrivateLog(constant.LogFileName)
return &friendServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,

@ -31,7 +31,7 @@ type groupServer struct {
}
func NewGroupServer(port int) *groupServer {
log.NewPrivateLog("group")
log.NewPrivateLog(constant.LogFileName)
return &groupServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName,
@ -41,16 +41,16 @@ func NewGroupServer(port int) *groupServer {
}
func (s *groupServer) Run() {
log.NewInfo("0", "group rpc start ")
log.NewInfo("", "group rpc start ")
ip := utils.ServerIP
registerAddress := ip + ":" + strconv.Itoa(s.rpcPort)
//listener network
listener, err := net.Listen("tcp", registerAddress)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), registerAddress)
log.NewError("", "Listen failed ", err.Error(), registerAddress)
return
}
log.NewInfo("0", "listen network success, ", registerAddress, listener)
log.NewInfo("", "listen network success, ", registerAddress, listener)
defer listener.Close()
//grpc server
srv := grpc.NewServer()
@ -59,15 +59,15 @@ func (s *groupServer) Run() {
pbGroup.RegisterGroupServer(srv, s)
err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10)
if err != nil {
log.NewError("0", "RegisterEtcd failed ", err.Error())
log.NewError("", "RegisterEtcd failed ", err.Error())
return
}
err = srv.Serve(listener)
if err != nil {
log.NewError("0", "Serve failed ", err.Error())
log.NewError("", "Serve failed ", err.Error())
return
}
log.NewInfo("0", "group rpc success")
log.NewInfo("", "group rpc success")
}
func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) {
@ -273,8 +273,11 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
}
for _, v := range memberList {
log.Debug(req.OperationID, v)
var node open_im_sdk.GroupMemberFullInfo
cp.GroupMemberDBCopyOpenIM(&node, &v)
log.Debug(req.OperationID, "db value:", v.MuteEndTime, "seconds: ", v.MuteEndTime.Unix())
log.Debug(req.OperationID, "cp value: ", node)
resp.MemberList = append(resp.MemberList, &node)
}
log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", resp.String())
@ -355,7 +358,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
//remove
var resp pbGroup.KickGroupMemberResp
for _, v := range req.KickedUserIDList {
//owner cant kicked
//owner cant kicked
if v == groupOwnerUserID {
log.NewError(req.OperationID, "failed, can't kick owner ", v)
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
@ -969,24 +972,26 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.UserID) && !token_verify.IsMangerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.OpUserID, req.GroupID)
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.GroupID, req.UserID)
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
}
groupMemberInfo := db.GroupMember{GroupID: req.GroupID, UserID: req.UserID}
groupMemberInfo.MuteEndTime = time.Unix(int64(time.Now().Second())+int64(req.MutedSeconds), 0)
groupMemberInfo.MuteEndTime = time.Unix(int64(time.Now().Second())+int64(req.MutedSeconds), time.Now().UnixNano())
err := imdb.UpdateGroupMemberInfo(groupMemberInfo)
if err != nil {
log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo)
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
chat.GroupMemberMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, req.MutedSeconds)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""})
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
}
func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.UserID) && !token_verify.IsMangerUserID(req.OpUserID) {
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.OpUserID, req.GroupID)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
}
@ -997,14 +1002,40 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca
log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
chat.GroupMemberCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""})
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
}
func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) (*pbGroup.MuteGroupResp, error) {
return nil, nil
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.GroupID, req.GroupID)
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
}
err := imdb.OperateGroupStatus(req.GroupID, constant.GroupStatusMuted)
if err != nil {
log.Error(req.OperationID, "OperateGroupStatus failed ", err.Error(), req.GroupID, constant.GroupStatusMuted)
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
chat.GroupMutedNotification(req.OperationID, req.OpUserID, req.GroupID)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""})
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
}
func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMuteGroupReq) (*pbGroup.CancelMuteGroupResp, error) {
return nil, nil
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.OpUserID, req.GroupID)
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
}
err := imdb.UpdateGroupInfoDefaultZero(req.GroupID, map[string]interface{}{"status": constant.GroupOk})
if err != nil {
log.Error(req.OperationID, "UpdateGroupInfoDefaultZero failed ", err.Error(), req.GroupID)
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
chat.GroupCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""})
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
}

@ -31,7 +31,7 @@ type messageCMSServer struct {
}
func NewMessageCMSServer(port int) *messageCMSServer {
log.NewPrivateLog("MessageCMS")
log.NewPrivateLog(constant.LogFileName)
return &messageCMSServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImMessageCMSName,
@ -84,8 +84,8 @@ func (s *messageCMSServer) GetChatLogs(_ context.Context, req *pbMessageCMS.GetC
log.NewError(req.OperationID, utils.GetSelfFuncName(), "time string parse error", err.Error())
}
chatLog := db.ChatLog{
Content: req.Content,
SendTime: time,
Content: req.Content,
SendTime: time,
ContentType: req.ContentType,
SessionType: req.SessionType,
}
@ -101,20 +101,20 @@ func (s *messageCMSServer) GetChatLogs(_ context.Context, req *pbMessageCMS.GetC
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetChatLogCount", err.Error())
}
chatLogs, err := imdb.GetChatLog(chatLog, req.Pagination.PageNumber, req.Pagination.ShowNumber)
chatLogs, err := imdb.GetChatLog(chatLog, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetChatLog", err.Error())
return resp, errors.WrapError(constant.ErrDB)
}
for _, chatLog := range chatLogs {
pbChatLog := &pbMessageCMS.ChatLogs{
SessionType: chatLog.SessionType,
ContentType: chatLog.ContentType,
SearchContent: req.Content,
WholeContent: chatLog.Content,
Date: chatLog.CreateTime.String(),
SessionType: chatLog.SessionType,
ContentType: chatLog.ContentType,
SearchContent: req.Content,
WholeContent: chatLog.Content,
Date: chatLog.CreateTime.String(),
SenderNickName: chatLog.SenderNickname,
SenderId: chatLog.SendID,
SenderId: chatLog.SendID,
}
if chatLog.SenderNickname == "" {
sendUser, err := imdb.GetUserByUserID(chatLog.SendID)

@ -10,12 +10,12 @@ import (
"github.com/golang/protobuf/proto"
)
func conversationNotification(contentType int32, m proto.Message, operationID, userID string) {
func SetConversationNotification(operationID, sendID, recvID string, contentType int, m proto.Message, tips open_im_sdk.TipsComm) {
log.NewInfo(operationID, "args: ", sendID, recvID, contentType, m.String(), tips.String())
var err error
var tips open_im_sdk.TipsComm
tips.Detail, err = proto.Marshal(m)
if err != nil {
log.Error(operationID, utils.GetSelfFuncName(), "Marshal failed ", err.Error(), m.String())
log.NewError(operationID, "Marshal failed ", err.Error(), m.String())
return
}
marshaler := jsonpb.Marshaler{
@ -24,15 +24,10 @@ func conversationNotification(contentType int32, m proto.Message, operationID, u
EmitDefaults: false,
}
tips.JsonDetail, _ = marshaler.MarshalToString(m)
cn := config.Config.Notification
switch contentType {
case constant.ConversationOptChangeNotification:
tips.DefaultTips = cn.ConversationOptUpdate.DefaultTips.Tips
}
var n NotificationMsg
n.SendID = userID
n.RecvID = userID
n.ContentType = contentType
n.SendID = sendID
n.RecvID = recvID
n.ContentType = int32(contentType)
n.SessionType = constant.SingleChatType
n.MsgFrom = constant.SysMsgType
n.OperationID = operationID
@ -44,10 +39,38 @@ func conversationNotification(contentType int32, m proto.Message, operationID, u
Notification(&n)
}
func SetConversationNotification(operationID, userID string) {
log.NewInfo(operationID, utils.GetSelfFuncName(), "userID: ", userID)
conversationUpdateTips := open_im_sdk.ConversationUpdateTips{
// SetPrivate调用
func ConversationSetPrivateNotification(operationID, sendID, recvID string, isPrivateChat bool) {
log.NewInfo(operationID, utils.GetSelfFuncName())
conversationSetPrivateTips := &open_im_sdk.ConversationSetPrivateTips{
RecvID: recvID,
SendID: sendID,
IsPrivate: isPrivateChat,
}
var tips open_im_sdk.TipsComm
var tipsMsg string
//var senderName string
//senderName, err := im_mysql_model.GetUserNameByUserID(sendID)
//if err != nil {
// log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
// senderName = sendID
//}
if isPrivateChat == true {
tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.OpenTips
} else {
tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.CloseTips
}
tips.DefaultTips = tipsMsg
SetConversationNotification(operationID, sendID, recvID, constant.ConversationPrivateChatNotification, conversationSetPrivateTips, tips)
}
// 会话改变
func ConversationChangeNotification(operationID, userID string) {
log.NewInfo(operationID, utils.GetSelfFuncName())
ConversationChangedTips := &open_im_sdk.ConversationUpdateTips{
UserID: userID,
}
conversationNotification(constant.ConversationOptChangeNotification, &conversationUpdateTips, operationID, userID)
var tips open_im_sdk.TipsComm
tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips
SetConversationNotification(operationID, userID, userID, constant.ConversationOptChangeNotification, ConversationChangedTips, tips)
}

@ -16,7 +16,7 @@ func (rpc *rpcChat) DelMsgList(_ context.Context, req *commonPb.DelMsgListReq) (
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsg failed", err.Error())
resp.ErrMsg = constant.ErrDB.ErrMsg
resp.ErrCode = constant.ErrDB.ErrCode
return resp, err
return resp, nil
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil

@ -160,6 +160,14 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv
tips.DefaultTips = toNickname + " " + cn.MemberEnter.DefaultTips.Tips
case constant.GroupDismissedNotification:
tips.DefaultTips = toNickname + "" + cn.GroupDismissed.DefaultTips.Tips
case constant.GroupMutedNotification:
tips.DefaultTips = toNickname + "" + cn.GroupMuted.DefaultTips.Tips
case constant.GroupCancelMutedNotification:
tips.DefaultTips = toNickname + "" + cn.GroupCancelMuted.DefaultTips.Tips
case constant.GroupMemberMutedNotification:
tips.DefaultTips = toNickname + "" + cn.GroupMemberMuted.DefaultTips.Tips
case constant.GroupMemberCancelMutedNotification:
tips.DefaultTips = toNickname + "" + cn.GroupMemberCancelMuted.DefaultTips.Tips
default:
log.Error(operationID, "contentType failed ", contentType)
return
@ -227,6 +235,71 @@ func GroupInfoSetNotification(operationID, opUserID, groupID string) {
groupNotification(constant.GroupInfoSetNotification, &GroupInfoChangedTips, opUserID, groupID, "", operationID)
}
func GroupMutedNotification(operationID, opUserID, groupID string) {
tips := open_im_sdk.GroupMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
}
if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
return
}
groupNotification(constant.GroupMutedNotification, &tips, opUserID, groupID, "", operationID)
}
func GroupCancelMutedNotification(operationID, opUserID, groupID string) {
tips := open_im_sdk.GroupCancelMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
}
if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
return
}
groupNotification(constant.GroupCancelMutedNotification, &tips, opUserID, groupID, "", operationID)
}
func GroupMemberMutedNotification(operationID, opUserID, groupID, groupMemberUserID string, mutedSeconds uint32) {
tips := open_im_sdk.GroupMemberMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}}
tips.MutedSeconds = mutedSeconds
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
}
if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
return
}
if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.MutedUser); err != nil {
log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID)
return
}
groupNotification(constant.GroupMemberMutedNotification, &tips, opUserID, groupID, "", operationID)
}
func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMemberUserID string) {
tips := open_im_sdk.GroupMemberCancelMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
}
if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
return
}
if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.MutedUser); err != nil {
log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID)
return
}
groupNotification(constant.GroupMemberCancelMutedNotification, &tips, opUserID, groupID, "", operationID)
}
//message ReceiveJoinApplicationTips{
// GroupInfo Group = 1;
// PublicUserInfo Applicant = 2;

@ -2,6 +2,7 @@ package msg
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
@ -22,7 +23,7 @@ type rpcChat struct {
}
func NewRpcChatServer(port int) *rpcChat {
log.NewPrivateLog("msg")
log.NewPrivateLog(constant.LogFileName)
rc := rpcChat{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName,

@ -281,6 +281,23 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendGroupMsg failed", err.Error())
}
return returnMsg(&replay, pb, 0, "", msgToMQ.MsgData.ServerMsgID, msgToMQ.MsgData.SendTime)
case constant.NotificationChatType:
msgToMQ.MsgData = pb.MsgData
log.NewInfo(msgToMQ.OperationID, msgToMQ)
err1 := rpc.sendMsgToKafka(&msgToMQ, msgToMQ.MsgData.RecvID)
if err1 != nil {
log.NewError(msgToMQ.OperationID, "kafka send msg err:RecvID", msgToMQ.MsgData.RecvID, msgToMQ.String())
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
}
if msgToMQ.MsgData.SendID != msgToMQ.MsgData.RecvID { //Filter messages sent to yourself
err2 := rpc.sendMsgToKafka(&msgToMQ, msgToMQ.MsgData.SendID)
if err2 != nil {
log.NewError(msgToMQ.OperationID, "kafka send msg err:SendID", msgToMQ.MsgData.SendID, msgToMQ.String())
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
}
}
return returnMsg(&replay, pb, 0, "", msgToMQ.MsgData.ServerMsgID, msgToMQ.MsgData.SendTime)
default:
return returnMsg(&replay, pb, 203, "unkonwn sessionType", "", 0)
}
@ -513,6 +530,38 @@ func Notification(n *NotificationMsg) {
ex = config.Config.Notification.GroupDismissed.OfflinePush.Ext
reliabilityLevel = config.Config.Notification.GroupDismissed.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.GroupDismissed.Conversation.UnreadCount
case constant.GroupMutedNotification:
pushSwitch = config.Config.Notification.GroupMuted.OfflinePush.PushSwitch
title = config.Config.Notification.GroupMuted.OfflinePush.Title
desc = config.Config.Notification.GroupMuted.OfflinePush.Desc
ex = config.Config.Notification.GroupMuted.OfflinePush.Ext
reliabilityLevel = config.Config.Notification.GroupMuted.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.GroupMuted.Conversation.UnreadCount
case constant.GroupCancelMutedNotification:
pushSwitch = config.Config.Notification.GroupCancelMuted.OfflinePush.PushSwitch
title = config.Config.Notification.GroupCancelMuted.OfflinePush.Title
desc = config.Config.Notification.GroupCancelMuted.OfflinePush.Desc
ex = config.Config.Notification.GroupCancelMuted.OfflinePush.Ext
reliabilityLevel = config.Config.Notification.GroupCancelMuted.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.GroupCancelMuted.Conversation.UnreadCount
case constant.GroupMemberMutedNotification:
pushSwitch = config.Config.Notification.GroupMemberMuted.OfflinePush.PushSwitch
title = config.Config.Notification.GroupMemberMuted.OfflinePush.Title
desc = config.Config.Notification.GroupMemberMuted.OfflinePush.Desc
ex = config.Config.Notification.GroupMemberMuted.OfflinePush.Ext
reliabilityLevel = config.Config.Notification.GroupMemberMuted.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.GroupMemberMuted.Conversation.UnreadCount
case constant.GroupMemberCancelMutedNotification:
pushSwitch = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.PushSwitch
title = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Title
desc = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Desc
ex = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Ext
reliabilityLevel = config.Config.Notification.GroupMemberCancelMuted.Conversation.ReliabilityLevel
unReadCount = config.Config.Notification.GroupMemberCancelMuted.Conversation.UnreadCount
}
switch reliabilityLevel {
case constant.UnreliableNotification:
@ -539,6 +588,6 @@ func Notification(n *NotificationMsg) {
if err != nil {
log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String(), err.Error())
} else if reply.ErrCode != 0 {
log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String())
log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String(), reply.ErrCode, reply.ErrMsg)
}
}

@ -10,20 +10,24 @@ import (
"Open_IM/pkg/utils"
"context"
"strings"
"time"
)
func TagSendMessage(operationID, sendID, recvID, content string, contentType int32) {
log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content, contentType)
func TagSendMessage(operationID, sendID, recvID, content string, senderPlatformID int32) {
log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content)
var req pbChat.SendMsgReq
var msgData pbCommon.MsgData
msgData.SendID = sendID
msgData.RecvID = recvID
msgData.ContentType = contentType
msgData.ContentType = constant.Custom
msgData.SessionType = constant.SingleChatType
msgData.MsgFrom = constant.UserMsgType
msgData.Content = []byte(content)
msgData.Options = map[string]bool{}
msgData.Options[constant.IsSenderConversationUpdate] = false
msgData.SendTime = time.Now().Unix()
msgData.CreateTime = time.Now().Unix()
msgData.SenderPlatformID = senderPlatformID
req.MsgData = &msgData
req.OperationID = operationID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)

@ -16,6 +16,7 @@ import (
"net"
"strconv"
"strings"
"time"
)
type officeServer struct {
@ -26,7 +27,7 @@ type officeServer struct {
}
func NewOfficeServer(port int) *officeServer {
log.NewPrivateLog("office")
log.NewPrivateLog(constant.LogFileName)
return &officeServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfficeName,
@ -103,7 +104,7 @@ func (s *officeServer) GetUserTags(_ context.Context, req *pbOffice.GetUserTagsR
func (s *officeServer) CreateTag(_ context.Context, req *pbOffice.CreateTagReq) (resp *pbOffice.CreateTagResp, err error) {
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)
resp = &pbOffice.CreateTagResp{CommonResp: &pbOffice.CommonResp{}}
if err := db.DB.CreateTag(req.UserID, req.TagName, userIDList); err != nil {
@ -132,8 +133,8 @@ func (s *officeServer) DeleteTag(_ context.Context, req *pbOffice.DeleteTagReq)
func (s *officeServer) SetTag(_ context.Context, req *pbOffice.SetTagReq) (resp *pbOffice.SetTagResp, err error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp = &pbOffice.SetTagResp{CommonResp: &pbOffice.CommonResp{}}
IncreaseUserIDList := utils.RemoveUserIDRepByMap(req.IncreaseUserIDList)
reduceUserIDList := utils.RemoveUserIDRepByMap(req.ReduceUserIDList)
IncreaseUserIDList := utils.RemoveRepeatedStringInList(req.IncreaseUserIDList)
reduceUserIDList := utils.RemoveRepeatedStringInList(req.ReduceUserIDList)
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())
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
@ -147,11 +148,57 @@ func (s *officeServer) SetTag(_ context.Context, req *pbOffice.SetTagReq) (resp
func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagReq) (resp *pbOffice.SendMsg2TagResp, err error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp = &pbOffice.SendMsg2TagResp{CommonResp: &pbOffice.CommonResp{}}
userIDList, err := db.DB.GetUserIDListByTagID(req.SendID, req.TagID)
var tagUserIDList []string
for _, tagID := range req.TagList {
userIDList, err := db.DB.GetUserIDListByTagID(req.SendID, tagID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserIDListByTagID failed", err.Error())
continue
}
tagUserIDList = append(tagUserIDList, userIDList...)
}
var groupUserIDList []string
for _, groupID := range req.GroupList {
userIDList, err := im_mysql_model.GetGroupMemberIDListByGroupID(groupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMemberIDListByGroupID failed", err.Error())
continue
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), userIDList)
groupUserIDList = append(groupUserIDList, userIDList...)
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), groupUserIDList, req.GroupList)
var userIDList []string
userIDList = append(userIDList, tagUserIDList...)
userIDList = append(userIDList, groupUserIDList...)
userIDList = append(userIDList, req.UserList...)
userIDList = utils.RemoveRepeatedStringInList(userIDList)
for i, userID := range userIDList {
if userID == req.SendID || userID == "" {
userIDList = append(userIDList[:i], userIDList[i+1:]...)
}
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "total userIDList result: ", userIDList)
for _, userID := range userIDList {
msg.TagSendMessage(req.OperationID, req.SendID, userID, req.Content, req.ContentType)
msg.TagSendMessage(req.OperationID, req.SendID, userID, req.Content, req.SenderPlatformID)
}
if err := db.DB.SaveTagSendLog(req); err != nil {
var tagSendLogs db.TagSendLog
for _, userID := range userIDList {
userName, err := im_mysql_model.GetUserNameByUserID(userID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserNameByUserID failed", err.Error())
continue
}
tagSendLogs.UserList = append(tagSendLogs.UserList, db.TagUser{
UserID: userID,
UserName: userName,
})
}
tagSendLogs.SendID = req.SendID
tagSendLogs.Content = req.Content
tagSendLogs.SenderPlatformID = req.SenderPlatformID
tagSendLogs.SendTime = time.Now().Unix()
if err := db.DB.SaveTagSendLog(&tagSendLogs); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SaveTagSendLog failed", err.Error())
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
@ -184,3 +231,33 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil
}
func (s *officeServer) GetUserTagByID(_ context.Context, req *pbOffice.GetUserTagByIDReq) (resp *pbOffice.GetUserTagByIDResp, err error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp = &pbOffice.GetUserTagByIDResp{
CommonResp: &pbOffice.CommonResp{},
Tag: &pbOffice.Tag{},
}
tag, err := db.DB.GetTagByID(req.UserID, req.TagID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetTagByID failed", err.Error())
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
return resp, nil
}
for _, userID := range tag.UserList {
userName, err := im_mysql_model.GetUserNameByUserID(userID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserNameByUserID failed", err.Error())
continue
}
resp.Tag.UserList = append(resp.Tag.UserList, &pbOffice.TagUser{
UserID: userID,
UserName: userName,
})
}
resp.Tag.TagID = tag.TagID
resp.Tag.TagName = tag.TagName
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil
}

@ -19,10 +19,10 @@ import (
//open_im_sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
//"context"
errors "Open_IM/pkg/common/http"
"net"
"strconv"
"strings"
errors "Open_IM/pkg/common/http"
"google.golang.org/grpc"
)
@ -35,7 +35,7 @@ type statisticsServer struct {
}
func NewStatisticsServer(port int) *statisticsServer {
log.NewPrivateLog("Statistics")
log.NewPrivateLog(constant.LogFileName)
return &statisticsServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImStatisticsName,
@ -164,7 +164,7 @@ func GetRangeDate(from, to time.Time) [][2]time.Time {
}
// month
case !isInOneMonth(from, to):
if to.Sub(from) < time.Hour * 24 * 30 {
if to.Sub(from) < time.Hour*24*30 {
for i := 0; ; i++ {
fromTime := from.Add(time.Hour * 24 * time.Duration(i))
toTime := from.Add(time.Hour * 24 * time.Duration(i+1))
@ -251,7 +251,7 @@ func (s *statisticsServer) GetGroupStatistics(_ context.Context, req *pbStatisti
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetIncreaseGroupNum", v, err.Error())
}
resp.TotalGroupNumList[index] = &pbStatistics.DateNumList{
Date: v[0].String(),
Date: v[0].String(),
Num: num,
}
}(wg, i, v)

@ -32,7 +32,7 @@ type userServer struct {
}
func NewUserServer(port int) *userServer {
log.NewPrivateLog("user")
log.NewPrivateLog(constant.LogFileName)
return &userServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName,
@ -72,6 +72,30 @@ func (s *userServer) Run() {
log.NewInfo("0", "rpc user success")
}
func syncPeerUserConversation(conversation *pbUser.Conversation, operationID string) error {
peerUserConversation := db.Conversation{
OwnerUserID: conversation.UserID,
ConversationID: "single_" + conversation.OwnerUserID,
ConversationType: constant.SingleChatType,
UserID: conversation.OwnerUserID,
GroupID: "",
RecvMsgOpt: 0,
UnreadCount: 0,
DraftTextTime: 0,
IsPinned: false,
IsPrivateChat: conversation.IsPrivateChat,
AttachedInfo: "",
Ex: "",
}
err := imdb.PeerUserSetConversation(peerUserConversation)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "SetConversation error", err.Error())
return err
}
chat.ConversationSetPrivateNotification(operationID, conversation.OwnerUserID, conversation.UserID, conversation.IsPrivateChat)
return nil
}
func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) {
log.NewInfo(req.OperationID, "GetUserInfo args ", req.String())
var userInfoList []*sdkws.UserInfo
@ -96,6 +120,9 @@ func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq
func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.BatchSetConversationsReq) (*pbUser.BatchSetConversationsResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
if req.NotificationType == 0 {
req.NotificationType = constant.ConversationOptChangeNotification
}
resp := &pbUser.BatchSetConversationsResp{}
for _, v := range req.Conversations {
conversation := db.Conversation{}
@ -113,8 +140,14 @@ func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.Batc
continue
}
resp.Success = append(resp.Success, v.ConversationID)
// if is set private chat operationthen peer user need to sync and set tips\
if v.ConversationType == constant.SingleChatType && req.NotificationType == constant.ConversationPrivateChatNotification {
if err := syncPeerUserConversation(v, req.OperationID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
}
}
}
chat.SetConversationNotification(req.OperationID, req.OwnerUserID)
chat.ConversationChangeNotification(req.OperationID, req.OwnerUserID)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
resp.CommonResp = &pbUser.CommonResp{}
return resp, nil
@ -173,6 +206,9 @@ func (s *userServer) GetConversations(ctx context.Context, req *pbUser.GetConver
func (s *userServer) SetConversation(ctx context.Context, req *pbUser.SetConversationReq) (*pbUser.SetConversationResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
if req.NotificationType == 0 {
req.NotificationType = constant.ConversationOptChangeNotification
}
resp := &pbUser.SetConversationResp{}
var conversation db.Conversation
if err := utils.CopyStructFields(&conversation, req.Conversation); err != nil {
@ -189,7 +225,17 @@ func (s *userServer) SetConversation(ctx context.Context, req *pbUser.SetConvers
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
return resp, nil
}
chat.SetConversationNotification(req.OperationID, req.Conversation.OwnerUserID)
// notification
if req.Conversation.ConversationType == constant.SingleChatType && req.NotificationType == constant.ConversationPrivateChatNotification {
//sync peer user conversation if conversation is singleChatType
if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error())
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
return resp, nil
}
} else {
chat.ConversationChangeNotification(req.OperationID, req.Conversation.OwnerUserID)
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String())
resp.CommonResp = &pbUser.CommonResp{}
return resp, nil
@ -207,13 +253,24 @@ func (s *userServer) SetRecvMsgOpt(ctx context.Context, req *pbUser.SetRecvMsgOp
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
return resp, nil
}
stringList := strings.Split(req.ConversationID, "_")
if len(stringList) > 1 {
switch stringList[0] {
case "single_":
conversation.UserID = stringList[1]
conversation.ConversationType = constant.SingleChatType
case "group":
conversation.GroupID = stringList[1]
conversation.ConversationType = constant.GroupChatType
}
}
err := imdb.SetRecvMsgOpt(conversation)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation error", err.Error())
resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}
return resp, nil
}
chat.SetConversationNotification(req.OperationID, req.OwnerUserID)
chat.ConversationChangeNotification(req.OperationID, req.OwnerUserID)
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
resp.CommonResp = &pbUser.CommonResp{}
return resp, nil

@ -76,7 +76,7 @@ func Test_ParseToken(t *testing.T) {
uid := "1"
platform := int32(1)
tokenString, _, _ := token_verify.CreateToken(uid, platform)
claims, err := token_verify.ParseToken(tokenString)
claims, err := token_verify.ParseToken(tokenString, "")
if err == nil {
assert.Equal(t, claims.UID, uid)
}

@ -34,8 +34,8 @@ type SetReceiveMessageOptResp struct {
type Conversation struct {
OwnerUserID string `json:"ownerUserID" binding:"required"`
ConversationID string `json:"conversationID"`
ConversationType int32 `json:"conversationType"`
ConversationID string `json:"conversationID" binding:"required"`
ConversationType int32 `json:"conversationType" binding:"required"`
UserID string `json:"userID"`
GroupID string `json:"groupID"`
RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"`
@ -49,7 +49,8 @@ type Conversation struct {
type SetConversationReq struct {
Conversation
OperationID string `json:"operationID" binding:"required"`
NotificationType int32 `json:"notificationType"`
OperationID string `json:"operationID" binding:"required"`
}
type SetConversationResp struct {
@ -57,9 +58,10 @@ type SetConversationResp struct {
}
type BatchSetConversationsReq struct {
Conversations []Conversation `json:"conversations" binding:"required"`
OwnerUserID string `json:"ownerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
Conversations []Conversation `json:"conversations" binding:"required"`
NotificationType int32 `json:"notificationType"`
OwnerUserID string `json:"ownerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type BatchSetConversationsResp struct {
@ -103,10 +105,11 @@ type GetConversationsResp struct {
}
type SetRecvMsgOptReq struct {
OwnerUserID string `json:"ownerUserID" binding:"required"`
ConversationID string `json:"conversationID"`
RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"`
OperationID string `json:"operationID" binding:"required"`
OwnerUserID string `json:"ownerUserID" binding:"required"`
ConversationID string `json:"conversationID"`
RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"`
OperationID string `json:"operationID" binding:"required"`
NotificationType int32 `json:"notificationType"`
}
type SetRecvMsgOptResp struct {

@ -185,3 +185,38 @@ type DismissGroupReq struct {
type DismissGroupResp struct {
CommResp
}
type MuteGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
UserID string `json:"userID" binding:"required"`
MutedSeconds uint32 `json:"mutedSeconds" binding:"required"`
}
type MuteGroupMemberResp struct {
CommResp
}
type CancelMuteGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
UserID string `json:"userID" binding:"required"`
}
type CancelMuteGroupMemberResp struct {
CommResp
}
type MuteGroupReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
}
type MuteGroupResp struct {
CommResp
}
type CancelMuteGroupReq struct {
OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"`
}
type CancelMuteGroupResp struct {
CommResp
}

@ -5,7 +5,7 @@ import (
)
type GetUserTagsReq struct {
OperationID string `json:"operationID"`
OperationID string `json:"operationID" binding:"required"`
}
type GetUserTagsResp struct {
@ -47,10 +47,12 @@ type SetTagResp struct {
}
type SendMsg2TagReq struct {
TagID string `json:"tagID" binding:"required"`
TagList []string `json:"tagList"`
UserList []string `json:"userList"`
GroupList []string `json:"groupList"`
SenderPlatformID int32 `json:"senderPlatformID" binding:"required"`
Content string `json:"content" binding:"required"`
ContentType int32 `json:"contentType" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
@ -72,3 +74,15 @@ type GetTagSendLogsResp struct {
ShowNumber int32 `json:"showNumber"`
} `json:"data"`
}
type GetUserTagByIDReq struct {
TagID string `json:"tagID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type GetUserTagByIDResp struct {
CommResp
Data struct {
Tag *pbOffice.Tag `json:"tag"`
} `json:"data"`
}

@ -270,6 +270,30 @@ type config struct {
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupDismissed"`
GroupMuted struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupMuted"`
GroupCancelMuted struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupCancelMuted"`
GroupMemberMuted struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupMemberMuted"`
GroupMemberCancelMuted struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupMemberCancelMuted"`
////////////////////////user///////////////////////
UserInfoUpdated struct {
Conversation PConversation `yaml:"conversation"`
@ -326,6 +350,14 @@ type config struct {
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"conversationOptUpdate"`
ConversationSetPrivate struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips struct {
OpenTips string `yaml:"openTips"`
CloseTips string `yaml:"closeTips"`
} `yaml:"defaultTips"`
} `yaml:"conversationSetPrivate"`
}
Demo struct {
Port []int `yaml:"openImDemoPort"`

@ -56,13 +56,11 @@ const (
FriendRemarkSetNotification = 1206 //set_friend_remark?
BlackAddedNotification = 1207 //add_black
BlackDeletedNotification = 1208 //remove_black
ConversationOptChangeNotification = 1300 // change conversation opt
ConversationOptChangeNotification = 1300 // change conversation opt
UserNotificationBegin = 1301
UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204
ConversationNotification = 1307
ConversationNotNotification = 1308
ConversationDefault = 0
UserNotificationEnd = 1399
OANotification = 1400
@ -79,11 +77,18 @@ const (
MemberInvitedNotification = 1509
MemberEnterNotification = 1510
GroupDismissedNotification = 1511
GroupMemberMutedNotification = 1512
GroupMemberCancelMutedNotification = 1513
GroupMutedNotification = 1514
GroupCancelMutedNotification = 1515
SignalingNotificationBegin = 1600
SignalingNotification = 1601
SignalingNotificationEnd = 1699
NotificationEnd = 2000
ConversationPrivateChatNotification = 1701
NotificationEnd = 2000
//status
MsgNormal = 1
@ -226,3 +231,5 @@ func GroupIsBanPrivateChat(status int32) bool {
}
const BigVersion = "v3"
const LogFileName = "OpenIM.log"

@ -2,6 +2,7 @@ package db
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"fmt"
@ -33,6 +34,7 @@ func key(dbAddress, dbName string) string {
}
func init() {
log.NewPrivateLog(constant.LogFileName)
//var mgoSession *mgo.Session
var mongoClient *mongo.Client
var err1 error
@ -51,7 +53,7 @@ func init() {
}
mongoClient, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))
if err != nil{
if err != nil {
log.NewError(" mongo.Connect failed, try ", utils.GetSelfFuncName(), err.Error(), uri)
time.Sleep(time.Duration(30) * time.Second)
mongoClient, err1 = mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))

@ -5,7 +5,6 @@ import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
pbMsg "Open_IM/pkg/proto/chat"
officePb "Open_IM/pkg/proto/office"
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"context"
@ -470,6 +469,14 @@ func (d *DataBases) CreateTag(userID, tagName string, userList []string) error {
return err
}
func (d *DataBases) GetTagByID(userID, tagID string) (Tag, error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
var tag Tag
err := c.FindOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}).Decode(&tag)
return tag, err
}
func (d *DataBases) DeleteTag(userID, tagID string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
@ -491,7 +498,7 @@ func (d *DataBases) SetTag(userID, tagID, newName string, increaseUserIDList []s
}
}
tag.UserList = append(tag.UserList, increaseUserIDList...)
tag.UserList = utils.RemoveUserIDRepByMap(tag.UserList)
tag.UserList = utils.RemoveRepeatedStringInList(tag.UserList)
for _, v := range reduceUserIDList {
for i2, v2 := range tag.UserList {
if v == v2 {
@ -526,30 +533,16 @@ type TagUser struct {
}
type TagSendLog struct {
TagID string `bson:"tag_id"`
TagName string `bson:"tag_name"`
SendID string `bson:"send_id"`
SenderPlatformID int32 `bson:"sender_platform_id"`
Content string `bson:"content"`
ContentType int32 `bson:"content_type"`
SendTime int64 `bson:"send_time"`
UserList []TagUser `bson:"tag_list"`
SendID string `bson:"send_id"`
SenderPlatformID int32 `bson:"sender_platform_id"`
Content string `bson:"content"`
SendTime int64 `bson:"send_time"`
}
func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error {
func (d *DataBases) SaveTagSendLog(tagSendLog *TagSendLog) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
var tag Tag
_ = c.FindOne(ctx, bson.M{"user_id": sendReq.SendID, "tag_id": sendReq.TagID}).Decode(&tag)
c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
tagSendLog := TagSendLog{
TagID: sendReq.TagID,
TagName: tag.TagName,
SendID: sendReq.SendID,
SenderPlatformID: sendReq.SenderPlatformID,
Content: sendReq.Content,
ContentType: sendReq.ContentType,
SendTime: time.Now().Unix(),
}
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
_, err := c.InsertOne(ctx, tagSendLog)
return err
}
@ -571,7 +564,7 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32)
}
func generateTagID(tagName, userID string) string {
return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()))
return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String())
}
func getCurrentTimestampByMill() int64 {

@ -30,9 +30,7 @@ func InsertIntoGroupMember(toInsertInfo db.GroupMember) error {
if toInsertInfo.RoleLevel == 0 {
toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers
}
if toInsertInfo.MuteEndTime.Unix() == 0 {
toInsertInfo.MuteEndTime = time.Unix(0, 0)
}
toInsertInfo.MuteEndTime = time.Unix(int64(time.Now().Second()), 0)
err = dbConn.Table("group_members").Create(toInsertInfo).Error
if err != nil {
return err
@ -68,6 +66,24 @@ func GetGroupMemberListByGroupID(groupID string) ([]db.GroupMember, error) {
return groupMemberList, nil
}
func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return nil, err
}
dbConn.LogMode(true)
var groupMembers []db.GroupMember
err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMembers).Error
if err != nil {
return nil, err
}
var groupMemberIDList []string
for _, v := range groupMembers {
groupMemberIDList = append(groupMemberIDList, v.UserID)
}
return groupMemberIDList, nil
}
func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]db.GroupMember, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {

@ -216,10 +216,10 @@ func GetGroupMaster(groupId string) (db.GroupMember, error) {
return groupMember, nil
}
func UpdateGroupInfoDefaultZero(groupInfo db.Group, args map[string]interface{}) error {
func UpdateGroupInfoDefaultZero(groupID string, args map[string]interface{}) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
return dbConn.Model(groupInfo).Updates(args).Error
return dbConn.Table("groups").Where("group_id = ? ", groupID).Update(args).Error
}

@ -325,6 +325,25 @@ func SetConversation(conversation db.Conversation) error {
}
}
func PeerUserSetConversation(conversation db.Conversation) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
dbConn.LogMode(true)
newConversation := conversation
if dbConn.Model(&db.Conversation{}).Find(&newConversation).RowsAffected == 0 {
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "not exist in db, create")
return dbConn.Model(&db.Conversation{}).Create(conversation).Error
// if exist, then update record
}
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "exist in db, update")
//force update
return dbConn.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID).
Update(map[string]interface{}{"is_private_chat": conversation.IsPrivateChat}).Error
}
func SetRecvMsgOpt(conversation db.Conversation) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {

@ -63,10 +63,10 @@ func loggerInit(moduleName string) *Logger {
}
func NewLfsHook(rotationTime time.Duration, maxRemainNum uint, moduleName string) logrus.Hook {
lfsHook := lfshook.NewHook(lfshook.WriterMap{
logrus.DebugLevel: initRotateLogs(rotationTime, maxRemainNum, "debug", moduleName),
logrus.InfoLevel: initRotateLogs(rotationTime, maxRemainNum, "info", moduleName),
logrus.WarnLevel: initRotateLogs(rotationTime, maxRemainNum, "warn", moduleName),
logrus.ErrorLevel: initRotateLogs(rotationTime, maxRemainNum, "error", moduleName),
logrus.DebugLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
logrus.InfoLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
logrus.WarnLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
logrus.ErrorLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
}, &nested.Formatter{
TimestampFormat: "2006-01-02 15:04:05.000",
HideKeys: false,

@ -101,7 +101,7 @@ func GetClaimFromToken(tokensString string) (*Claims, error) {
}
func IsAppManagerAccess(token string, OpUserID string) bool {
claims, err := ParseToken(token)
claims, err := ParseToken(token, "")
if err != nil {
return false
}
@ -130,7 +130,7 @@ func CheckAccess(OpUserID string, OwnerUserID string) bool {
}
func GetUserIDFromToken(token string, operationID string) (bool, string) {
claims, err := ParseToken(token)
claims, err := ParseToken(token, operationID)
if err != nil {
log.Error(operationID, "ParseToken failed, ", err.Error(), token)
return false, ""
@ -138,31 +138,31 @@ func GetUserIDFromToken(token string, operationID string) (bool, string) {
return true, claims.UID
}
func ParseToken(tokensString string) (claims *Claims, err error) {
func ParseToken(tokensString, operationID string) (claims *Claims, err error) {
claims, err = GetClaimFromToken(tokensString)
if err != nil {
log.NewError("", "token validate err", err.Error())
log.NewError(operationID, "token validate err", err.Error(), tokensString)
return nil, err
}
m, err := commonDB.DB.GetTokenMapByUidPid(claims.UID, claims.Platform)
if err != nil {
log.NewError("", "get token from redis err", err.Error())
log.NewError(operationID, "get token from redis err", err.Error(), tokensString)
return nil, &constant.ErrTokenInvalid
}
if m == nil {
log.NewError("", "get token from redis err", "m is nil")
log.NewError(operationID, "get token from redis err", "m is nil", tokensString)
return nil, &constant.ErrTokenInvalid
}
if v, ok := m[tokensString]; ok {
switch v {
case constant.NormalToken:
log.NewDebug("", "this is normal return", claims)
log.NewDebug(operationID, "this is normal return", claims)
return claims, nil
case constant.InValidToken:
return nil, &constant.ErrTokenInvalid
case constant.KickedToken:
log.Error(operationID, "this token has been kicked by other same terminal ", constant.ErrTokenKicked)
return nil, &constant.ErrTokenKicked
case constant.ExpiredToken:
return nil, &constant.ErrTokenExpired
@ -170,6 +170,7 @@ func ParseToken(tokensString string) (claims *Claims, err error) {
return nil, &constant.ErrTokenUnknown
}
}
log.NewError(operationID, "redis token map not find", constant.ErrTokenUnknown)
return nil, &constant.ErrTokenUnknown
}
@ -195,7 +196,7 @@ func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) {
//Validation token, false means failure, true means successful verification
func VerifyToken(token, uid string) (bool, error) {
claims, err := ParseToken(token)
claims, err := ParseToken(token, "")
if err != nil {
return false, err
}
@ -207,7 +208,7 @@ func VerifyToken(token, uid string) (bool, error) {
return true, nil
}
func WsVerifyToken(token, uid string, platformID string) (bool, error, string) {
claims, err := ParseToken(token)
claims, err := ParseToken(token, "")
if err != nil {
return false, err, "parse token err"
}

@ -118,7 +118,14 @@ func GroupMemberDBCopyOpenIM(dst *open_im_sdk.GroupMemberFullInfo, src *db.Group
dst.AppMangerLevel = 1
}
dst.JoinTime = int32(src.JoinTime.Unix())
dst.MuteEndTime = uint32(src.JoinTime.Unix())
if src.MuteEndTime.Unix() < 0 {
dst.JoinTime = 0
return nil
}
dst.MuteEndTime = uint32(src.MuteEndTime.Unix())
if dst.MuteEndTime < uint32(time.Now().Unix()) {
dst.MuteEndTime = 0
}
return nil
}

@ -36,7 +36,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} }
func (m *CommonResp) String() string { return proto.CompactTextString(m) }
func (*CommonResp) ProtoMessage() {}
func (*CommonResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{0}
return fileDescriptor_office_7f5adce6bc494f97, []int{0}
}
func (m *CommonResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommonResp.Unmarshal(m, b)
@ -82,7 +82,7 @@ func (m *TagUser) Reset() { *m = TagUser{} }
func (m *TagUser) String() string { return proto.CompactTextString(m) }
func (*TagUser) ProtoMessage() {}
func (*TagUser) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{1}
return fileDescriptor_office_7f5adce6bc494f97, []int{1}
}
func (m *TagUser) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TagUser.Unmarshal(m, b)
@ -129,7 +129,7 @@ func (m *Tag) Reset() { *m = Tag{} }
func (m *Tag) String() string { return proto.CompactTextString(m) }
func (*Tag) ProtoMessage() {}
func (*Tag) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{2}
return fileDescriptor_office_7f5adce6bc494f97, []int{2}
}
func (m *Tag) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Tag.Unmarshal(m, b)
@ -182,7 +182,7 @@ func (m *GetUserTagsReq) Reset() { *m = GetUserTagsReq{} }
func (m *GetUserTagsReq) String() string { return proto.CompactTextString(m) }
func (*GetUserTagsReq) ProtoMessage() {}
func (*GetUserTagsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{3}
return fileDescriptor_office_7f5adce6bc494f97, []int{3}
}
func (m *GetUserTagsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserTagsReq.Unmarshal(m, b)
@ -228,7 +228,7 @@ func (m *GetUserTagsResp) Reset() { *m = GetUserTagsResp{} }
func (m *GetUserTagsResp) String() string { return proto.CompactTextString(m) }
func (*GetUserTagsResp) ProtoMessage() {}
func (*GetUserTagsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{4}
return fileDescriptor_office_7f5adce6bc494f97, []int{4}
}
func (m *GetUserTagsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserTagsResp.Unmarshal(m, b)
@ -276,7 +276,7 @@ func (m *CreateTagReq) Reset() { *m = CreateTagReq{} }
func (m *CreateTagReq) String() string { return proto.CompactTextString(m) }
func (*CreateTagReq) ProtoMessage() {}
func (*CreateTagReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{5}
return fileDescriptor_office_7f5adce6bc494f97, []int{5}
}
func (m *CreateTagReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateTagReq.Unmarshal(m, b)
@ -335,7 +335,7 @@ func (m *CreateTagResp) Reset() { *m = CreateTagResp{} }
func (m *CreateTagResp) String() string { return proto.CompactTextString(m) }
func (*CreateTagResp) ProtoMessage() {}
func (*CreateTagResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{6}
return fileDescriptor_office_7f5adce6bc494f97, []int{6}
}
func (m *CreateTagResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateTagResp.Unmarshal(m, b)
@ -375,7 +375,7 @@ func (m *DeleteTagReq) Reset() { *m = DeleteTagReq{} }
func (m *DeleteTagReq) String() string { return proto.CompactTextString(m) }
func (*DeleteTagReq) ProtoMessage() {}
func (*DeleteTagReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{7}
return fileDescriptor_office_7f5adce6bc494f97, []int{7}
}
func (m *DeleteTagReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteTagReq.Unmarshal(m, b)
@ -427,7 +427,7 @@ func (m *DeleteTagResp) Reset() { *m = DeleteTagResp{} }
func (m *DeleteTagResp) String() string { return proto.CompactTextString(m) }
func (*DeleteTagResp) ProtoMessage() {}
func (*DeleteTagResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{8}
return fileDescriptor_office_7f5adce6bc494f97, []int{8}
}
func (m *DeleteTagResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteTagResp.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *SetTagReq) Reset() { *m = SetTagReq{} }
func (m *SetTagReq) String() string { return proto.CompactTextString(m) }
func (*SetTagReq) ProtoMessage() {}
func (*SetTagReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{9}
return fileDescriptor_office_7f5adce6bc494f97, []int{9}
}
func (m *SetTagReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetTagReq.Unmarshal(m, b)
@ -543,7 +543,7 @@ func (m *SetTagResp) Reset() { *m = SetTagResp{} }
func (m *SetTagResp) String() string { return proto.CompactTextString(m) }
func (*SetTagResp) ProtoMessage() {}
func (*SetTagResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{10}
return fileDescriptor_office_7f5adce6bc494f97, []int{10}
}
func (m *SetTagResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetTagResp.Unmarshal(m, b)
@ -571,12 +571,13 @@ func (m *SetTagResp) GetCommonResp() *CommonResp {
}
type SendMsg2TagReq struct {
TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"`
SendID string `protobuf:"bytes,2,opt,name=sendID" json:"sendID,omitempty"`
SenderPlatformID int32 `protobuf:"varint,3,opt,name=senderPlatformID" json:"senderPlatformID,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"`
ContentType int32 `protobuf:"varint,5,opt,name=contentType" json:"contentType,omitempty"`
OperationID string `protobuf:"bytes,6,opt,name=operationID" json:"operationID,omitempty"`
TagList []string `protobuf:"bytes,1,rep,name=tagList" json:"tagList,omitempty"`
UserList []string `protobuf:"bytes,2,rep,name=UserList" json:"UserList,omitempty"`
GroupList []string `protobuf:"bytes,3,rep,name=GroupList" json:"GroupList,omitempty"`
SendID string `protobuf:"bytes,4,opt,name=sendID" json:"sendID,omitempty"`
SenderPlatformID int32 `protobuf:"varint,5,opt,name=senderPlatformID" json:"senderPlatformID,omitempty"`
Content string `protobuf:"bytes,6,opt,name=content" json:"content,omitempty"`
OperationID string `protobuf:"bytes,7,opt,name=operationID" json:"operationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -586,7 +587,7 @@ func (m *SendMsg2TagReq) Reset() { *m = SendMsg2TagReq{} }
func (m *SendMsg2TagReq) String() string { return proto.CompactTextString(m) }
func (*SendMsg2TagReq) ProtoMessage() {}
func (*SendMsg2TagReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{11}
return fileDescriptor_office_7f5adce6bc494f97, []int{11}
}
func (m *SendMsg2TagReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsg2TagReq.Unmarshal(m, b)
@ -606,11 +607,25 @@ func (m *SendMsg2TagReq) XXX_DiscardUnknown() {
var xxx_messageInfo_SendMsg2TagReq proto.InternalMessageInfo
func (m *SendMsg2TagReq) GetTagID() string {
func (m *SendMsg2TagReq) GetTagList() []string {
if m != nil {
return m.TagID
return m.TagList
}
return ""
return nil
}
func (m *SendMsg2TagReq) GetUserList() []string {
if m != nil {
return m.UserList
}
return nil
}
func (m *SendMsg2TagReq) GetGroupList() []string {
if m != nil {
return m.GroupList
}
return nil
}
func (m *SendMsg2TagReq) GetSendID() string {
@ -634,13 +649,6 @@ func (m *SendMsg2TagReq) GetContent() string {
return ""
}
func (m *SendMsg2TagReq) GetContentType() int32 {
if m != nil {
return m.ContentType
}
return 0
}
func (m *SendMsg2TagReq) GetOperationID() string {
if m != nil {
return m.OperationID
@ -659,7 +667,7 @@ func (m *SendMsg2TagResp) Reset() { *m = SendMsg2TagResp{} }
func (m *SendMsg2TagResp) String() string { return proto.CompactTextString(m) }
func (*SendMsg2TagResp) ProtoMessage() {}
func (*SendMsg2TagResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{12}
return fileDescriptor_office_7f5adce6bc494f97, []int{12}
}
func (m *SendMsg2TagResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsg2TagResp.Unmarshal(m, b)
@ -699,7 +707,7 @@ func (m *GetTagSendLogsReq) Reset() { *m = GetTagSendLogsReq{} }
func (m *GetTagSendLogsReq) String() string { return proto.CompactTextString(m) }
func (*GetTagSendLogsReq) ProtoMessage() {}
func (*GetTagSendLogsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{13}
return fileDescriptor_office_7f5adce6bc494f97, []int{13}
}
func (m *GetTagSendLogsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetTagSendLogsReq.Unmarshal(m, b)
@ -741,21 +749,19 @@ func (m *GetTagSendLogsReq) GetOperationID() string {
}
type TagSendLog struct {
TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"`
TagName string `protobuf:"bytes,2,opt,name=tagName" json:"tagName,omitempty"`
ContentType int32 `protobuf:"varint,3,opt,name=contentType" json:"contentType,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"`
SendTime int64 `protobuf:"varint,5,opt,name=sendTime" json:"sendTime,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
UserList []*TagUser `protobuf:"bytes,1,rep,name=userList" json:"userList,omitempty"`
Content string `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"`
SendTime int64 `protobuf:"varint,3,opt,name=sendTime" json:"sendTime,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TagSendLog) Reset() { *m = TagSendLog{} }
func (m *TagSendLog) String() string { return proto.CompactTextString(m) }
func (*TagSendLog) ProtoMessage() {}
func (*TagSendLog) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{14}
return fileDescriptor_office_7f5adce6bc494f97, []int{14}
}
func (m *TagSendLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TagSendLog.Unmarshal(m, b)
@ -775,25 +781,11 @@ func (m *TagSendLog) XXX_DiscardUnknown() {
var xxx_messageInfo_TagSendLog proto.InternalMessageInfo
func (m *TagSendLog) GetTagID() string {
func (m *TagSendLog) GetUserList() []*TagUser {
if m != nil {
return m.TagID
}
return ""
}
func (m *TagSendLog) GetTagName() string {
if m != nil {
return m.TagName
}
return ""
}
func (m *TagSendLog) GetContentType() int32 {
if m != nil {
return m.ContentType
return m.UserList
}
return 0
return nil
}
func (m *TagSendLog) GetContent() string {
@ -823,7 +815,7 @@ func (m *GetTagSendLogsResp) Reset() { *m = GetTagSendLogsResp{} }
func (m *GetTagSendLogsResp) String() string { return proto.CompactTextString(m) }
func (*GetTagSendLogsResp) ProtoMessage() {}
func (*GetTagSendLogsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_8580c3f7b2871da9, []int{15}
return fileDescriptor_office_7f5adce6bc494f97, []int{15}
}
func (m *GetTagSendLogsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetTagSendLogsResp.Unmarshal(m, b)
@ -864,6 +856,106 @@ func (m *GetTagSendLogsResp) GetTagSendLogs() []*TagSendLog {
return nil
}
type GetUserTagByIDReq struct {
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
TagID string `protobuf:"bytes,2,opt,name=tagID" json:"tagID,omitempty"`
OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUserTagByIDReq) Reset() { *m = GetUserTagByIDReq{} }
func (m *GetUserTagByIDReq) String() string { return proto.CompactTextString(m) }
func (*GetUserTagByIDReq) ProtoMessage() {}
func (*GetUserTagByIDReq) Descriptor() ([]byte, []int) {
return fileDescriptor_office_7f5adce6bc494f97, []int{16}
}
func (m *GetUserTagByIDReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserTagByIDReq.Unmarshal(m, b)
}
func (m *GetUserTagByIDReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetUserTagByIDReq.Marshal(b, m, deterministic)
}
func (dst *GetUserTagByIDReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetUserTagByIDReq.Merge(dst, src)
}
func (m *GetUserTagByIDReq) XXX_Size() int {
return xxx_messageInfo_GetUserTagByIDReq.Size(m)
}
func (m *GetUserTagByIDReq) XXX_DiscardUnknown() {
xxx_messageInfo_GetUserTagByIDReq.DiscardUnknown(m)
}
var xxx_messageInfo_GetUserTagByIDReq proto.InternalMessageInfo
func (m *GetUserTagByIDReq) GetUserID() string {
if m != nil {
return m.UserID
}
return ""
}
func (m *GetUserTagByIDReq) GetTagID() string {
if m != nil {
return m.TagID
}
return ""
}
func (m *GetUserTagByIDReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
type GetUserTagByIDResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"`
Tag *Tag `protobuf:"bytes,2,opt,name=tag" json:"tag,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUserTagByIDResp) Reset() { *m = GetUserTagByIDResp{} }
func (m *GetUserTagByIDResp) String() string { return proto.CompactTextString(m) }
func (*GetUserTagByIDResp) ProtoMessage() {}
func (*GetUserTagByIDResp) Descriptor() ([]byte, []int) {
return fileDescriptor_office_7f5adce6bc494f97, []int{17}
}
func (m *GetUserTagByIDResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserTagByIDResp.Unmarshal(m, b)
}
func (m *GetUserTagByIDResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetUserTagByIDResp.Marshal(b, m, deterministic)
}
func (dst *GetUserTagByIDResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetUserTagByIDResp.Merge(dst, src)
}
func (m *GetUserTagByIDResp) XXX_Size() int {
return xxx_messageInfo_GetUserTagByIDResp.Size(m)
}
func (m *GetUserTagByIDResp) XXX_DiscardUnknown() {
xxx_messageInfo_GetUserTagByIDResp.DiscardUnknown(m)
}
var xxx_messageInfo_GetUserTagByIDResp proto.InternalMessageInfo
func (m *GetUserTagByIDResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
func (m *GetUserTagByIDResp) GetTag() *Tag {
if m != nil {
return m.Tag
}
return nil
}
func init() {
proto.RegisterType((*CommonResp)(nil), "office.CommonResp")
proto.RegisterType((*TagUser)(nil), "office.TagUser")
@ -881,6 +973,8 @@ func init() {
proto.RegisterType((*GetTagSendLogsReq)(nil), "office.GetTagSendLogsReq")
proto.RegisterType((*TagSendLog)(nil), "office.TagSendLog")
proto.RegisterType((*GetTagSendLogsResp)(nil), "office.GetTagSendLogsResp")
proto.RegisterType((*GetUserTagByIDReq)(nil), "office.GetUserTagByIDReq")
proto.RegisterType((*GetUserTagByIDResp)(nil), "office.GetUserTagByIDResp")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -900,6 +994,7 @@ type OfficeServiceClient interface {
SetTag(ctx context.Context, in *SetTagReq, opts ...grpc.CallOption) (*SetTagResp, error)
SendMsg2Tag(ctx context.Context, in *SendMsg2TagReq, opts ...grpc.CallOption) (*SendMsg2TagResp, error)
GetTagSendLogs(ctx context.Context, in *GetTagSendLogsReq, opts ...grpc.CallOption) (*GetTagSendLogsResp, error)
GetUserTagByID(ctx context.Context, in *GetUserTagByIDReq, opts ...grpc.CallOption) (*GetUserTagByIDResp, error)
}
type officeServiceClient struct {
@ -964,6 +1059,15 @@ func (c *officeServiceClient) GetTagSendLogs(ctx context.Context, in *GetTagSend
return out, nil
}
func (c *officeServiceClient) GetUserTagByID(ctx context.Context, in *GetUserTagByIDReq, opts ...grpc.CallOption) (*GetUserTagByIDResp, error) {
out := new(GetUserTagByIDResp)
err := grpc.Invoke(ctx, "/office.OfficeService/GetUserTagByID", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for OfficeService service
type OfficeServiceServer interface {
@ -973,6 +1077,7 @@ type OfficeServiceServer interface {
SetTag(context.Context, *SetTagReq) (*SetTagResp, error)
SendMsg2Tag(context.Context, *SendMsg2TagReq) (*SendMsg2TagResp, error)
GetTagSendLogs(context.Context, *GetTagSendLogsReq) (*GetTagSendLogsResp, error)
GetUserTagByID(context.Context, *GetUserTagByIDReq) (*GetUserTagByIDResp, error)
}
func RegisterOfficeServiceServer(s *grpc.Server, srv OfficeServiceServer) {
@ -1087,6 +1192,24 @@ func _OfficeService_GetTagSendLogs_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _OfficeService_GetUserTagByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserTagByIDReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OfficeServiceServer).GetUserTagByID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/office.OfficeService/GetUserTagByID",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OfficeServiceServer).GetUserTagByID(ctx, req.(*GetUserTagByIDReq))
}
return interceptor(ctx, in, info, handler)
}
var _OfficeService_serviceDesc = grpc.ServiceDesc{
ServiceName: "office.OfficeService",
HandlerType: (*OfficeServiceServer)(nil),
@ -1115,60 +1238,68 @@ var _OfficeService_serviceDesc = grpc.ServiceDesc{
MethodName: "GetTagSendLogs",
Handler: _OfficeService_GetTagSendLogs_Handler,
},
{
MethodName: "GetUserTagByID",
Handler: _OfficeService_GetUserTagByID_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "office/office.proto",
}
func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_8580c3f7b2871da9) }
var fileDescriptor_office_8580c3f7b2871da9 = []byte{
// 751 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xc1, 0x6e, 0xd3, 0x4c,
0x10, 0x96, 0x93, 0x26, 0x6d, 0x26, 0x6d, 0xf3, 0x77, 0xff, 0x52, 0x82, 0x0f, 0x10, 0x2c, 0x90,
0x2a, 0x90, 0x12, 0x29, 0x70, 0x40,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x97, 0x54, 0xce, 0xd3, 0xb9, 0x0a, 0x8b, 0x30, 0xf0, 0x05, 0x2e, 0x90, 0xf8, 0x25, 0xd4, 0x65,
0x86, 0x46, 0xbf, 0x1c, 0xc4, 0x98, 0xbe, 0x7a, 0x8b, 0x9a, 0x61, 0xdd, 0x5f, 0x25, 0xd8, 0x38,
0x51, 0x21, 0x67, 0xc8, 0x6f, 0xbd, 0x11, 0x92, 0x3d, 0xa8, 0x1b, 0xaf, 0x00, 0xd9, 0x49, 0x2a,
0xe4, 0x9f, 0x19, 0xfb, 0xfe, 0x5c, 0xbf, 0x08, 0xc9, 0x2b, 0xa8, 0xa5, 0x83, 0x95, 0x6c, 0xa7,
0xdc, 0x8d, 0x79, 0x6f, 0xdf, 0x9b, 0xe3, 0x8d, 0x33, 0xd3, 0x69, 0x97, 0x65, 0x9a, 0x03, 0x36,
0xcb, 0xcc, 0x8f, 0xc5, 0x0e, 0x54, 0xe3, 0x71, 0x40, 0xb6, 0x92, 0x80, 0x74, 0xe2, 0xd9, 0xa4,
0xe8, 0x12, 0x61, 0x44, 0xd2, 0xb8, 0x32, 0x19, 0xc9, 0xfc, 0x44, 0xc8, 0x48, 0x16, 0xef, 0xd7,
0x81, 0x7a, 0x76, 0x8d, 0xee, 0x93, 0x07, 0x86, 0x1e, 0xf9, 0x2b, 0x64, 0xdb, 0x8b, 0xb6, 0x44,
0xf8, 0x6e, 0xeb, 0x63, 0xa3, 0xad, 0xbf, 0x6f, 0x5e, 0xc7, 0x3f, 0x17, 0x55, 0xf5, 0xf1, 0xf2,
0xe2, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x72, 0xfc, 0x2a, 0x94, 0xfe, 0x08, 0x00, 0x00,
func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_7f5adce6bc494f97) }
var fileDescriptor_office_7f5adce6bc494f97 = []byte{
// 810 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x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0x5a, 0xd6, 0x64, 0x5e, 0x07,
0xfa, 0xe2, 0xd7, 0x41, 0x99, 0x65, 0xf2, 0x9f, 0xc2, 0x87, 0x7e, 0xd4, 0x4d, 0x73, 0xd5, 0x92,
0x2c, 0xa4, 0x6c, 0xb4, 0x56, 0x48, 0x9f, 0x32, 0xad, 0x50, 0x6e, 0x36, 0x8e, 0x76, 0x3f, 0xd5,
0x5b, 0xc9, 0xcf, 0xde, 0xdb, 0xf8, 0x71, 0x55, 0x16, 0x7f, 0x72, 0xaf, 0x7e, 0x07, 0x00, 0x00,
0xff, 0xff, 0xed, 0x02, 0x0a, 0x32, 0x0b, 0x0a, 0x00, 0x00,
}

@ -64,12 +64,13 @@ message SetTagResp {
}
message SendMsg2TagReq {
string tagID = 1;
string sendID = 2;
int32 senderPlatformID = 3;
string content = 4;
int32 contentType = 5;
string operationID = 6;
repeated string tagList = 1;
repeated string UserList = 2;
repeated string GroupList = 3;
string sendID = 4;
int32 senderPlatformID = 5;
string content = 6;
string operationID = 7;
}
message SendMsg2TagResp {
@ -83,11 +84,9 @@ message GetTagSendLogsReq {
}
message TagSendLog {
string tagID = 1;
string tagName = 2;
int32 contentType = 3;
string content = 4;
int64 sendTime = 5;
repeated TagUser userList = 1;
string content = 2;
int64 sendTime = 3;
}
message GetTagSendLogsResp {
@ -96,6 +95,17 @@ message GetTagSendLogsResp {
repeated TagSendLog tagSendLogs = 3;
}
message GetUserTagByIDReq {
string userID = 1;
string tagID = 2;
string operationID = 3;
}
message GetUserTagByIDResp {
CommonResp commonResp = 1;
Tag tag = 2;
}
service OfficeService {
rpc GetUserTags(GetUserTagsReq) returns(GetUserTagsResp);
rpc CreateTag(CreateTagReq) returns(CreateTagResp);
@ -103,5 +113,6 @@ service OfficeService {
rpc SetTag(SetTagReq) returns(SetTagResp);
rpc SendMsg2Tag(SendMsg2TagReq) returns(SendMsg2TagResp);
rpc GetTagSendLogs(GetTagSendLogsReq) returns(GetTagSendLogsResp);
rpc GetUserTagByID(GetUserTagByIDReq) returns(GetUserTagByIDResp);
}

File diff suppressed because it is too large Load Diff

@ -261,6 +261,33 @@ message GroupDismissedTips{
int64 operationTime = 3;
}
message GroupMemberMutedTips{
GroupInfo group = 1;
GroupMemberFullInfo opUser = 2;
int64 operationTime = 3;
GroupMemberFullInfo mutedUser = 4;
uint32 mutedSeconds = 5;
}
message GroupMemberCancelMutedTips{
GroupInfo group = 1;
GroupMemberFullInfo opUser = 2;
int64 operationTime = 3;
GroupMemberFullInfo mutedUser = 4;
}
message GroupMutedTips{
GroupInfo group = 1;
GroupMemberFullInfo opUser = 2;
int64 operationTime = 3;
}
message GroupCancelMutedTips{
GroupInfo group = 1;
GroupMemberFullInfo opUser = 2;
int64 operationTime = 3;
}
//////////////////////friend/////////////////////
//message FriendInfo{
@ -333,7 +360,12 @@ message UserInfoUpdatedTips{
//////////////////////conversation/////////////////////
message ConversationUpdateTips{
string UserID = 1;
}
message ConversationSetPrivateTips{
string recvID = 1;
string sendID = 2;
bool isPrivate = 3;
}

File diff suppressed because it is too large Load Diff

@ -84,7 +84,8 @@ message Conversation{
message SetConversationReq{
Conversation Conversation = 1;
string OperationID = 2;
int32 notificationType = 2;
string OperationID = 3;
}
message SetConversationResp{
@ -95,7 +96,8 @@ message SetRecvMsgOptReq {
string OwnerUserID = 1;
string ConversationID = 2;
int32 RecvMsgOpt = 3;
string OperationID = 4;
int32 notificationType = 4;
string OperationID = 5;
}
message SetRecvMsgOptResp {
@ -137,7 +139,8 @@ message GetAllConversationsResp{
message BatchSetConversationsReq{
repeated Conversation Conversations = 1;
string OwnerUserID = 2;
string OperationID = 3;
int32 notificationType = 3;
string OperationID = 4;
}
message BatchSetConversationsResp{

@ -77,7 +77,7 @@ func OperationIDGenerator() string {
return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10)
}
func RemoveUserIDRepByMap(slc []string) []string {
func RemoveRepeatedStringInList(slc []string) []string {
var result []string
tempMap := map[string]byte{}
for _, e := range slc {

Loading…
Cancel
Save