mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-29 05:38:45 +08:00
proto modify
This commit is contained in:
parent
7050b64b19
commit
96d9b25b57
@ -2,7 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/internal/task"
|
"OpenIM/internal/task"
|
||||||
|
"OpenIM/internal/tools"
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
@ -22,8 +24,33 @@ func main() {
|
|||||||
var userIDFixSeq = flag.String("user_id_fix_seq", "", "userID to Fix Seq")
|
var userIDFixSeq = flag.String("user_id_fix_seq", "", "userID to Fix Seq")
|
||||||
var superGroupIDFixSeq = flag.String("super_group_id_fix_seq", "", "super groupID to fix Seq")
|
var superGroupIDFixSeq = flag.String("super_group_id_fix_seq", "", "super groupID to fix Seq")
|
||||||
var fixAllSeq = flag.Bool("fix_all_seq", false, "fix seq")
|
var fixAllSeq = flag.Bool("fix_all_seq", false, "fix seq")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
fmt.Println(time.Now(), "start cronTask", *userIDFixSeq, *superGroupIDFixSeq)
|
msgTool, err := tools.InitMsgTool()
|
||||||
task.FixSeq(*userID, *superGroupID, *fixAllSeq)
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
ctx := context.Background()
|
||||||
|
if userIDFixSeq != nil {
|
||||||
|
msgTool.GetAndFixUserSeqs(ctx, *userIDFixSeq)
|
||||||
|
}
|
||||||
|
if superGroupIDFixSeq != nil {
|
||||||
|
msgTool.FixGroupSeq(ctx, *superGroupIDFixSeq)
|
||||||
|
}
|
||||||
|
if fixAllSeq != nil {
|
||||||
|
msgTool.FixAllSeq(ctx)
|
||||||
|
}
|
||||||
|
if userIDClearMsg != nil {
|
||||||
|
msgTool.ClearUsersMsg(ctx, []string{*userIDClearMsg})
|
||||||
|
}
|
||||||
|
|
||||||
|
if superGroupIDClearMsg != nil {
|
||||||
|
msgTool.ClearSuperGroupMsg(ctx, []string{*superGroupIDClearMsg})
|
||||||
|
}
|
||||||
|
if userIDShowSeq != nil {
|
||||||
|
msgTool.ShowUserSeqs(ctx, *userIDShowSeq)
|
||||||
|
}
|
||||||
|
|
||||||
|
if superGroupIDShowSeq != nil {
|
||||||
|
msgTool.ShowSuperGroupSeqs(ctx, *superGroupIDShowSeq)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/internal/task"
|
"OpenIM/internal/task"
|
||||||
|
"OpenIM/internal/tools"
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
@ -12,7 +13,7 @@ func main() {
|
|||||||
if err := config.InitConfig(); err != nil {
|
if err := config.InitConfig(); err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
if err := task.StartCronTask(); err != nil {
|
if err := tools.StartCronTask(); err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,8 +17,8 @@ func main() {
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "MessageTransferPrometheusPort default listen port")
|
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "MessageTransferPrometheusPort default listen port")
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
msgTransfer := msgtransfer.NewMsgTransfer()
|
if err := msgtransfer.StartTransfer(*prometheusPort); err != nil {
|
||||||
fmt.Println("start msg_transfer server ", ", OpenIM version: ", constant.CurrentVersion, "\n")
|
panic(err)
|
||||||
msgTransfer.Run(*prometheusPort)
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
@ -2,30 +2,18 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/internal/push"
|
"OpenIM/internal/push"
|
||||||
|
"OpenIM/internal/startrpc"
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if err := config.InitConfig(); err != nil {
|
if err := config.InitConfig(); err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
defaultPorts := config.Config.RpcPort.OpenImPushPort
|
|
||||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
|
||||||
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "PushrometheusPort default listen port")
|
|
||||||
flag.Parse()
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
wg.Add(1)
|
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
fmt.Println("start push rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
|
if err := startrpc.Start(config.Config.RpcPort.OpenImAuthPort[0], config.Config.RpcRegisterName.OpenImAuthName, config.Config.Prometheus.AuthPrometheusPort[0], push.Start); err != nil {
|
||||||
pusher := push.Push{}
|
|
||||||
if err := pusher.Init(*rpcPort); err != nil {
|
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
pusher.Run(*prometheusPort)
|
|
||||||
wg.Wait()
|
|
||||||
}
|
}
|
||||||
|
85
go.mod
85
go.mod
@ -1,10 +1,10 @@
|
|||||||
module OpenIM
|
module OpenIM
|
||||||
|
|
||||||
go 1.18
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
firebase.google.com/go v3.13.0+incompatible
|
firebase.google.com/go v3.13.0+incompatible
|
||||||
github.com/OpenIMSDK/openKeeper v0.9.7
|
github.com/OpenIMSDK/openKeeper v0.0.1
|
||||||
github.com/OpenIMSDK/open_utils v1.0.8
|
github.com/OpenIMSDK/open_utils v1.0.8
|
||||||
github.com/Shopify/sarama v1.32.0
|
github.com/Shopify/sarama v1.32.0
|
||||||
github.com/alibabacloud-go/darabonba-openapi v0.1.11
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11
|
||||||
@ -53,97 +53,16 @@ require (
|
|||||||
require github.com/minio/minio-go v6.0.14+incompatible
|
require github.com/minio/minio-go v6.0.14+incompatible
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go v0.105.0 // indirect
|
|
||||||
cloud.google.com/go/compute v1.13.0 // indirect
|
|
||||||
cloud.google.com/go/compute/metadata v0.2.1 // indirect
|
|
||||||
cloud.google.com/go/firestore v1.9.0 // indirect
|
|
||||||
cloud.google.com/go/iam v0.8.0 // indirect
|
|
||||||
cloud.google.com/go/longrunning v0.3.0 // indirect
|
|
||||||
cloud.google.com/go/storage v1.27.0 // indirect
|
|
||||||
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
|
|
||||||
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
|
|
||||||
github.com/alibabacloud-go/openapi-util v0.0.9 // indirect
|
|
||||||
github.com/alibabacloud-go/tea-utils v1.3.9 // indirect
|
|
||||||
github.com/aliyun/credentials-go v1.1.2 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 // indirect
|
|
||||||
github.com/aws/smithy-go v1.12.0 // indirect
|
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
|
||||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
|
||||||
github.com/eapache/go-resiliency v1.2.0 // indirect
|
|
||||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
|
||||||
github.com/eapache/queue v1.1.0 // indirect
|
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
|
||||||
github.com/go-ini/ini v1.67.0 // indirect
|
github.com/go-ini/ini v1.67.0 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
|
||||||
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
|
||||||
github.com/go-stack/stack v1.8.0 // indirect
|
|
||||||
github.com/go-zookeeper/zk v1.0.3 // indirect
|
|
||||||
github.com/goccy/go-json v0.10.0 // indirect
|
github.com/goccy/go-json v0.10.0 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
|
||||||
github.com/golang/snappy v0.0.3 // indirect
|
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
|
||||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
|
|
||||||
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
|
|
||||||
github.com/hashicorp/go-uuid v1.0.2 // indirect
|
|
||||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
|
||||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
|
||||||
github.com/jcmturner/gofork v1.0.0 // indirect
|
|
||||||
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
|
|
||||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
|
||||||
github.com/jonboulle/clockwork v0.3.0 // indirect
|
github.com/jonboulle/clockwork v0.3.0 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
|
||||||
github.com/klauspost/compress v1.13.6 // indirect
|
|
||||||
github.com/klauspost/cpuid v1.3.1 // indirect
|
|
||||||
github.com/leodido/go-urn v1.2.1 // indirect
|
|
||||||
github.com/lestrrat-go/strftime v1.0.6 // indirect
|
github.com/lestrrat-go/strftime v1.0.6 // indirect
|
||||||
github.com/lithammer/shortuuid v3.0.0+incompatible // indirect
|
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
|
||||||
github.com/minio/md5-simd v1.1.0 // indirect
|
|
||||||
github.com/minio/sha256-simd v0.1.1 // indirect
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
||||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
|
||||||
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
||||||
github.com/prometheus/client_model v0.2.0 // indirect
|
|
||||||
github.com/prometheus/common v0.37.0 // indirect
|
|
||||||
github.com/prometheus/procfs v0.8.0 // indirect
|
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
|
||||||
github.com/rs/xid v1.2.1 // indirect
|
|
||||||
github.com/tjfoc/gmsm v1.3.2 // indirect
|
|
||||||
github.com/ugorji/go/codec v1.2.8 // indirect
|
github.com/ugorji/go/codec v1.2.8 // indirect
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
|
||||||
github.com/xdg-go/scram v1.0.2 // indirect
|
|
||||||
github.com/xdg-go/stringprep v1.0.2 // indirect
|
|
||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
|
||||||
go.opencensus.io v0.24.0 // indirect
|
|
||||||
golang.org/x/crypto v0.5.0 // indirect
|
golang.org/x/crypto v0.5.0 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
|
|
||||||
golang.org/x/sync v0.1.0 // indirect
|
|
||||||
golang.org/x/sys v0.4.0 // indirect
|
|
||||||
golang.org/x/text v0.6.0 // indirect
|
|
||||||
golang.org/x/time v0.1.0 // indirect
|
|
||||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
|
||||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||||
gopkg.in/ini.v1 v1.66.2 // indirect
|
gopkg.in/ini.v1 v1.66.2 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/Shopify/sarama => github.com/Shopify/sarama v1.29.0
|
replace github.com/Shopify/sarama => github.com/Shopify/sarama v1.29.0
|
||||||
|
6
go.sum
6
go.sum
@ -389,8 +389,10 @@ firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIw
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
github.com/OpenIMSDK/openKeeper v0.9.7 h1:oWPAsXAHpMpZh8NPB9B8FktVfxk1Ec8tQPdxhzWgh7w=
|
github.com/OpenIMSDK/openKeeper v0.0.1 h1:JOz2nEcM/C7PeTnPnfIoYoaFA1X9BVt9W5OWNCDrNlo=
|
||||||
github.com/OpenIMSDK/openKeeper v0.9.7/go.mod h1:RvyRXEcvWbonkmHLtT8KxGSCNlXY7OfDohhu53E6INU=
|
github.com/OpenIMSDK/openKeeper v0.0.1/go.mod h1:RvyRXEcvWbonkmHLtT8KxGSCNlXY7OfDohhu53E6INU=
|
||||||
|
github.com/OpenIMSDK/openKeeper v0.9.8 h1:7IrOftwpGSyHkM0x10QDM7up1E9iB59cO9YwiT4mRXU=
|
||||||
|
github.com/OpenIMSDK/openKeeper v0.9.8/go.mod h1:RvyRXEcvWbonkmHLtT8KxGSCNlXY7OfDohhu53E6INU=
|
||||||
github.com/OpenIMSDK/open_utils v1.0.8 h1:IopxWgJwEF5ZAPsRuiZZOfcxNOQOCt/p8VDENcHN9r4=
|
github.com/OpenIMSDK/open_utils v1.0.8 h1:IopxWgJwEF5ZAPsRuiZZOfcxNOQOCt/p8VDENcHN9r4=
|
||||||
github.com/OpenIMSDK/open_utils v1.0.8/go.mod h1:FLoaQblWUVKQgqt2LrNzfSZLT6D3DICBn1kcOMDLUOI=
|
github.com/OpenIMSDK/open_utils v1.0.8/go.mod h1:FLoaQblWUVKQgqt2LrNzfSZLT6D3DICBn1kcOMDLUOI=
|
||||||
github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE=
|
github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE=
|
||||||
|
@ -27,10 +27,6 @@ func (a *Auth) getGroupClient() (auth.AuthClient, error) {
|
|||||||
return auth.NewAuthClient(conn), nil
|
return auth.NewAuthClient(conn), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Auth) UserRegister(c *gin.Context) {
|
|
||||||
a2r.Call(auth.AuthClient.UserRegister, a.getGroupClient, c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Auth) UserToken(c *gin.Context) {
|
func (a *Auth) UserToken(c *gin.Context) {
|
||||||
a2r.Call(auth.AuthClient.UserToken, a.getGroupClient, c)
|
a2r.Call(auth.AuthClient.UserToken, a.getGroupClient, c)
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ func NewGinRouter() *gin.Engine {
|
|||||||
userRouterGroup := r.Group("/user")
|
userRouterGroup := r.Group("/user")
|
||||||
{
|
{
|
||||||
u := NewUser(nil)
|
u := NewUser(nil)
|
||||||
|
userRouterGroup.POST("/user_register", u.UserRegister)
|
||||||
userRouterGroup.POST("/update_user_info", u.UpdateUserInfo) //1
|
userRouterGroup.POST("/update_user_info", u.UpdateUserInfo) //1
|
||||||
userRouterGroup.POST("/set_global_msg_recv_opt", u.SetGlobalRecvMessageOpt)
|
userRouterGroup.POST("/set_global_msg_recv_opt", u.SetGlobalRecvMessageOpt)
|
||||||
userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1
|
userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1
|
||||||
@ -99,7 +100,8 @@ func NewGinRouter() *gin.Engine {
|
|||||||
authRouterGroup := r.Group("/auth")
|
authRouterGroup := r.Group("/auth")
|
||||||
{
|
{
|
||||||
a := NewAuth(nil)
|
a := NewAuth(nil)
|
||||||
authRouterGroup.POST("/user_register", a.UserRegister) //1
|
u := NewUser(nil)
|
||||||
|
authRouterGroup.POST("/user_register", u.UserRegister) //1
|
||||||
authRouterGroup.POST("/user_token", a.UserToken) //1
|
authRouterGroup.POST("/user_token", a.UserToken) //1
|
||||||
authRouterGroup.POST("/parse_token", a.ParseToken) //1
|
authRouterGroup.POST("/parse_token", a.ParseToken) //1
|
||||||
authRouterGroup.POST("/force_logout", a.ForceLogout) //1
|
authRouterGroup.POST("/force_logout", a.ForceLogout) //1
|
||||||
|
@ -27,6 +27,10 @@ func (u *User) getGroupClient() (user.UserClient, error) {
|
|||||||
return user.NewUserClient(conn), nil
|
return user.NewUserClient(conn), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *User) UserRegister(c *gin.Context) {
|
||||||
|
a2r.Call(user.UserClient.UserRegister, u.getGroupClient, c)
|
||||||
|
}
|
||||||
|
|
||||||
func (u *User) UpdateUserInfo(c *gin.Context) {
|
func (u *User) UpdateUserInfo(c *gin.Context) {
|
||||||
a2r.Call(user.UserClient.UpdateUserInfo, u.getGroupClient, c)
|
a2r.Call(user.UserClient.UpdateUserInfo, u.getGroupClient, c)
|
||||||
}
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
package common
|
|
||||||
|
|
||||||
import (
|
|
||||||
"OpenIM/internal/api2rpc"
|
|
||||||
"OpenIM/pkg/proto/group"
|
|
||||||
"fmt"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AReq struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
type AResp struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func KickGroupMember(c *gin.Context) {
|
|
||||||
// 默认 全部自动
|
|
||||||
api2rpc.NewRpc(api2rpc.NewGin[AReq, AResp](c), group.NewGroupClient, group.GroupClient.KickGroupMember).Call()
|
|
||||||
|
|
||||||
//// 可以自定义编辑请求和响应
|
|
||||||
//a := NewRpc(NewGin[apistruct.KickGroupMemberReq, apistruct.KickGroupMemberResp](c), group.NewGroupClient, group.GroupClient.KickGroupMember)
|
|
||||||
//a.Before(func(apiReq *apistruct.KickGroupMemberReq, rpcReq *group.KickGroupMemberReq, bind func() error) error {
|
|
||||||
// return bind()
|
|
||||||
//}).After(func(rpcResp *group.KickGroupMemberResp, apiResp *apistruct.KickGroupMemberResp, bind func() error) error {
|
|
||||||
// return bind()
|
|
||||||
//}).Name("group").Call()
|
|
||||||
}
|
|
||||||
|
|
||||||
//func getInterfaceName(handler PackerHandler) string {
|
|
||||||
// funcInfo := runtime.FuncForPC(reflect.ValueOf(handler).Pointer())
|
|
||||||
// name := funcInfo.Name()
|
|
||||||
// names := strings.Split(name, "/")
|
|
||||||
// if len(names) == 0 {
|
|
||||||
// return ""
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return names[len(names)-1]
|
|
||||||
//}
|
|
||||||
|
|
||||||
func TestName(t *testing.T) {
|
|
||||||
n := 100000000
|
|
||||||
start := time.Now().UnixNano()
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
var val group.GroupClient
|
|
||||||
reflect.TypeOf(&val).Elem().String()
|
|
||||||
}
|
|
||||||
end := time.Now().UnixNano()
|
|
||||||
fmt.Println(time.Duration(end-start) / time.Duration(n))
|
|
||||||
}
|
|
@ -3,8 +3,8 @@ package check
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
"OpenIM/pkg/discoveryregistry"
|
||||||
sdkws "OpenIM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"OpenIM/pkg/proto/user"
|
"OpenIM/pkg/proto/user"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
@ -12,18 +12,18 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewUserCheck(zk discoveryRegistry.SvcDiscoveryRegistry) *UserCheck {
|
func NewUserCheck(client discoveryregistry.SvcDiscoveryRegistry) *UserCheck {
|
||||||
return &UserCheck{
|
return &UserCheck{
|
||||||
zk: zk,
|
client: client,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserCheck struct {
|
type UserCheck struct {
|
||||||
zk discoveryRegistry.SvcDiscoveryRegistry
|
client discoveryregistry.SvcDiscoveryRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserCheck) getConn() (*grpc.ClientConn, error) {
|
func (u *UserCheck) getConn() (*grpc.ClientConn, error) {
|
||||||
return u.zk.GetConn(config.Config.RpcRegisterName.OpenImUserName)
|
return u.client.GetConn(config.Config.RpcRegisterName.OpenImUserName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserCheck) GetUsersInfos(ctx context.Context, userIDs []string, complete bool) ([]*sdkws.UserInfo, error) {
|
func (u *UserCheck) GetUsersInfos(ctx context.Context, userIDs []string, complete bool) ([]*sdkws.UserInfo, error) {
|
||||||
@ -107,5 +107,8 @@ func (u *UserCheck) GetUserGlobalMsgRecvOpt(ctx context.Context, userID string)
|
|||||||
resp, err := user.NewUserClient(cc).GetGlobalRecvMessageOpt(ctx, &user.GetGlobalRecvMessageOptReq{
|
resp, err := user.NewUserClient(cc).GetGlobalRecvMessageOpt(ctx, &user.GetGlobalRecvMessageOptReq{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
return resp.GlobalRecvMsgOpt, err
|
return resp.GlobalRecvMsgOpt, err
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ func (c *Check) ExtendMessageUpdatedNotification(ctx context.Context, sendID str
|
|||||||
req *msg.SetMessageReactionExtensionsReq, resp *msg.SetMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
|
req *msg.SetMessageReactionExtensionsReq, resp *msg.SetMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
|
||||||
var m apistruct.ReactionMessageModifierNotification
|
var m apistruct.ReactionMessageModifierNotification
|
||||||
m.SourceID = req.SourceID
|
m.SourceID = req.SourceID
|
||||||
m.OpUserID = req.OpUserID
|
m.OpUserID = tracelog.GetOpUserID(ctx)
|
||||||
m.SessionType = req.SessionType
|
m.SessionType = req.SessionType
|
||||||
keyMap := make(map[string]*sdkws.KeyValue)
|
keyMap := make(map[string]*sdkws.KeyValue)
|
||||||
for _, valueResp := range resp.Result {
|
for _, valueResp := range resp.Result {
|
||||||
@ -33,7 +33,7 @@ func (c *Check) ExtendMessageUpdatedNotification(ctx context.Context, sendID str
|
|||||||
c.messageReactionSender(ctx, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
|
c.messageReactionSender(ctx, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
|
||||||
}
|
}
|
||||||
func (c *Check) ExtendMessageDeleteNotification(ctx context.Context, sendID string, sourceID string, sessionType int32,
|
func (c *Check) ExtendMessageDeleteNotification(ctx context.Context, sendID string, sourceID string, sessionType int32,
|
||||||
req *msg.DeleteMessageListReactionExtensionsReq, resp *msg.DeleteMessageListReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
|
req *msg.DeleteMessagesReactionExtensionsReq, resp *msg.DeleteMessagesReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
|
||||||
var m apistruct.ReactionMessageDeleteNotification
|
var m apistruct.ReactionMessageDeleteNotification
|
||||||
m.SourceID = req.SourceID
|
m.SourceID = req.SourceID
|
||||||
m.OpUserID = req.OpUserID
|
m.OpUserID = req.OpUserID
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
package rpcserver
|
|
||||||
|
|
||||||
import (
|
|
||||||
"OpenIM/internal/common/network"
|
|
||||||
"OpenIM/pkg/common/constant"
|
|
||||||
"OpenIM/pkg/common/log"
|
|
||||||
discoveryRegistry "OpenIM/pkg/discoveryregistry"
|
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
|
||||||
"net"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RpcServer struct {
|
|
||||||
Port int
|
|
||||||
RegisterName string
|
|
||||||
RegisterCenter discoveryRegistry.SvcDiscoveryRegistry
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRpcServer(registerIPInConfig string, port int, registerName string, zkServers []string, zkRoot string) (*RpcServer, error) {
|
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
|
||||||
s := &RpcServer{
|
|
||||||
Port: port,
|
|
||||||
RegisterName: registerName,
|
|
||||||
}
|
|
||||||
|
|
||||||
zkClient, err := openKeeper.NewClient(zkServers, zkRoot, 10, "", "")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
registerIP, err := network.GetRpcRegisterIP(registerIPInConfig)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
s.RegisterCenter = zkClient
|
|
||||||
err = s.RegisterCenter.Register(s.RegisterName, registerIP, s.Port)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetTcpListen(listenIPInConfig string, port int) (net.Listener, string, error) {
|
|
||||||
address := network.GetListenIP(listenIPInConfig) + ":" + strconv.Itoa(port)
|
|
||||||
listener, err := net.Listen("tcp", address)
|
|
||||||
return listener, address, err
|
|
||||||
}
|
|
@ -4,10 +4,10 @@ import (
|
|||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
prome "OpenIM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
"OpenIM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"OpenIM/pkg/proto/msggateway"
|
"OpenIM/pkg/proto/msggateway"
|
||||||
sdkws "OpenIM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
@ -44,12 +44,11 @@ func initPrometheus() {
|
|||||||
|
|
||||||
func (r *RPCServer) onInit(rpcPort int) {
|
func (r *RPCServer) onInit(rpcPort int) {
|
||||||
r.rpcPort = rpcPort
|
r.rpcPort = rpcPort
|
||||||
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImRelayName
|
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImMessageGatewayName
|
||||||
r.etcdSchema = config.Config.Etcd.EtcdSchema
|
|
||||||
r.etcdAddr = config.Config.Etcd.EtcdAddr
|
|
||||||
r.platformList = genPlatformArray()
|
r.platformList = genPlatformArray()
|
||||||
r.pushTerminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID}
|
r.pushTerminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RPCServer) run() {
|
func (r *RPCServer) run() {
|
||||||
listenIP := ""
|
listenIP := ""
|
||||||
if config.Config.ListenIP == "" {
|
if config.Config.ListenIP == "" {
|
||||||
@ -76,7 +75,7 @@ func (r *RPCServer) run() {
|
|||||||
}
|
}
|
||||||
srv := grpc.NewServer(grpcOpts...)
|
srv := grpc.NewServer(grpcOpts...)
|
||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
msggateway.RegisterRelayServer(srv, r)
|
msggateway.RegisterMsgGatewayServer(srv, r)
|
||||||
|
|
||||||
rpcRegisterIP := config.Config.RpcRegisterIP
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
@ -97,7 +96,7 @@ func (r *RPCServer) run() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (r *RPCServer) OnlinePushMsg(_ context.Context, in *msggateway.OnlinePushMsgReq) (*msggateway.OnlinePushMsgResp, error) {
|
func (r *RPCServer) OnlinePushMsg(ctx context.Context, in *msggateway.OnlinePushMsgReq) (*msggateway.OnlinePushMsgResp, error) {
|
||||||
log.NewInfo(in.OperationID, "PushMsgToUser is arriving", in.String())
|
log.NewInfo(in.OperationID, "PushMsgToUser is arriving", in.String())
|
||||||
var resp []*msggateway.SingleMsgToUserPlatform
|
var resp []*msggateway.SingleMsgToUserPlatform
|
||||||
msgBytes, _ := proto.Marshal(in.MsgData)
|
msgBytes, _ := proto.Marshal(in.MsgData)
|
||||||
|
@ -70,8 +70,8 @@ func (ws *WServer) run() {
|
|||||||
func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
|
func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
operationID := ""
|
operationID := ""
|
||||||
if len(query["operationID"]) != 0 {
|
if len(query[constant.OperationID]) != 0 {
|
||||||
operationID = query["operationID"][0]
|
operationID = query[constant.OperationID][0]
|
||||||
} else {
|
} else {
|
||||||
operationID = utils.OperationIDGenerator()
|
operationID = utils.OperationIDGenerator()
|
||||||
}
|
}
|
||||||
|
@ -2,27 +2,54 @@ package msgtransfer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/db/cache"
|
||||||
|
"OpenIM/pkg/common/db/controller"
|
||||||
|
"OpenIM/pkg/common/db/relation"
|
||||||
|
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||||
|
"OpenIM/pkg/common/db/unrelation"
|
||||||
"OpenIM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MsgTransfer struct {
|
type MsgTransfer struct {
|
||||||
persistentCH PersistentConsumerHandler // 聊天记录持久化到mysql的消费者 订阅的topic: ws2ms_chat
|
persistentCH *PersistentConsumerHandler // 聊天记录持久化到mysql的消费者 订阅的topic: ws2ms_chat
|
||||||
historyCH OnlineHistoryRedisConsumerHandler // 这个消费者聚合消息, 订阅的topic:ws2ms_chat, 修改通知发往msg_to_modify topic, 消息存入redis后Incr Redis, 再发消息到ms2pschat topic推送, 发消息到msg_to_mongo topic持久化
|
historyCH *OnlineHistoryRedisConsumerHandler // 这个消费者聚合消息, 订阅的topic:ws2ms_chat, 修改通知发往msg_to_modify topic, 消息存入redis后Incr Redis, 再发消息到ms2pschat topic推送, 发消息到msg_to_mongo topic持久化
|
||||||
historyMongoCH OnlineHistoryMongoConsumerHandler // mongoDB批量插入, 成功后删除redis中消息,以及处理删除通知消息删除的 订阅的topic: msg_to_mongo
|
historyMongoCH *OnlineHistoryMongoConsumerHandler // mongoDB批量插入, 成功后删除redis中消息,以及处理删除通知消息删除的 订阅的topic: msg_to_mongo
|
||||||
modifyCH ModifyMsgConsumerHandler // 负责消费修改消息通知的consumer, 订阅的topic: msg_to_modify
|
modifyCH *ModifyMsgConsumerHandler // 负责消费修改消息通知的consumer, 订阅的topic: msg_to_modify
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMsgTransfer() *MsgTransfer {
|
func StartTransfer(prometheusPort int) error {
|
||||||
msgTransfer := &MsgTransfer{}
|
db, err := relation.NewGormDB()
|
||||||
msgTransfer.persistentCH.Init()
|
if err != nil {
|
||||||
msgTransfer.historyCH.Init()
|
return err
|
||||||
msgTransfer.historyMongoCH.Init()
|
|
||||||
msgTransfer.modifyCH.Init()
|
|
||||||
if config.Config.Prometheus.Enable {
|
|
||||||
msgTransfer.initPrometheus()
|
|
||||||
}
|
}
|
||||||
return msgTransfer
|
if err := db.AutoMigrate(&relationTb.ChatLogModel{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rdb, err := cache.NewRedis()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mongo, err := unrelation.NewMongo()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cacheModel := cache.NewCacheModel(rdb)
|
||||||
|
msgDocModel := unrelation.NewMsgMongoDriver(mongo.GetDatabase())
|
||||||
|
extendMsgModel := unrelation.NewExtendMsgSetMongoDriver(mongo.GetDatabase())
|
||||||
|
|
||||||
|
chatLogDatabase := controller.NewChatLogDatabase(relation.NewChatLogGorm(db))
|
||||||
|
extendMsgDatabase := controller.NewExtendMsgDatabase(extendMsgModel)
|
||||||
|
msgDatabase := controller.NewMsgDatabase(msgDocModel, cacheModel)
|
||||||
|
|
||||||
|
msgTransfer := NewMsgTransfer(chatLogDatabase, extendMsgDatabase, msgDatabase)
|
||||||
|
msgTransfer.initPrometheus()
|
||||||
|
return msgTransfer.Start(prometheusPort)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMsgTransfer(chatLogDatabase controller.ChatLogDatabase, extendMsgDatabase controller.ExtendMsgDatabase, msgDatabase controller.MsgDatabase) *MsgTransfer {
|
||||||
|
return &MsgTransfer{persistentCH: NewPersistentConsumerHandler(chatLogDatabase), historyCH: NewOnlineHistoryRedisConsumerHandler(msgDatabase),
|
||||||
|
historyMongoCH: NewOnlineHistoryMongoConsumerHandler(msgDatabase), modifyCH: NewModifyMsgConsumerHandler(extendMsgDatabase)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgTransfer) initPrometheus() {
|
func (m *MsgTransfer) initPrometheus() {
|
||||||
@ -36,19 +63,18 @@ func (m *MsgTransfer) initPrometheus() {
|
|||||||
prome.NewMsgInsertMongoFailedCounter()
|
prome.NewMsgInsertMongoFailedCounter()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgTransfer) Run(promePort int) {
|
func (m *MsgTransfer) Start(prometheusPort int) error {
|
||||||
if config.Config.ChatPersistenceMysql {
|
if config.Config.ChatPersistenceMysql {
|
||||||
go m.persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(&m.persistentCH)
|
go m.persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(m.persistentCH)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("msg transfer not start mysql consumer")
|
fmt.Println("msg transfer not start mysql consumer")
|
||||||
}
|
}
|
||||||
go m.historyCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyCH)
|
go m.historyCH.historyConsumerGroup.RegisterHandleAndConsumer(m.historyCH)
|
||||||
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyMongoCH)
|
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(m.historyMongoCH)
|
||||||
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(&m.modifyCH)
|
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(m.modifyCH)
|
||||||
go func() {
|
err := prome.StartPrometheusSrv(prometheusPort)
|
||||||
err := prome.StartPrometheusSrv(promePort)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
panic(err)
|
}
|
||||||
}
|
return nil
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,13 @@ type ModifyMsgConsumerHandler struct {
|
|||||||
extendMsgDatabase controller.ExtendMsgDatabase
|
extendMsgDatabase controller.ExtendMsgDatabase
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mmc *ModifyMsgConsumerHandler) Init() {
|
func NewModifyMsgConsumerHandler(database controller.ExtendMsgDatabase) *ModifyMsgConsumerHandler {
|
||||||
mmc.modifyMsgConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
return &ModifyMsgConsumerHandler{
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToModify.Topic},
|
modifyMsgConsumerGroup: kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
||||||
config.Config.Kafka.MsgToModify.Addr, config.Config.Kafka.ConsumerGroupID.MsgToModify)
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToModify.Topic},
|
||||||
|
config.Config.Kafka.MsgToModify.Addr, config.Config.Kafka.ConsumerGroupID.MsgToModify),
|
||||||
|
extendMsgDatabase: database,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ModifyMsgConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (ModifyMsgConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
@ -38,7 +41,8 @@ func (mmc *ModifyMsgConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSessi
|
|||||||
for msg := range claim.Messages() {
|
for msg := range claim.Messages() {
|
||||||
log.NewDebug("", "kafka get info to mysql", "ModifyMsgConsumerHandler", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
|
log.NewDebug("", "kafka get info to mysql", "ModifyMsgConsumerHandler", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
|
||||||
if len(msg.Value) != 0 {
|
if len(msg.Value) != 0 {
|
||||||
mmc.ModifyMsg(msg, string(msg.Key), sess)
|
ctx := mmc.modifyMsgConsumerGroup.GetContextFromMsg(msg)
|
||||||
|
mmc.ModifyMsg(ctx, msg, string(msg.Key), sess)
|
||||||
} else {
|
} else {
|
||||||
log.Error("", "msg get from kafka but is nil", msg.Key)
|
log.Error("", "msg get from kafka but is nil", msg.Key)
|
||||||
}
|
}
|
||||||
@ -47,29 +51,30 @@ func (mmc *ModifyMsgConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSessi
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
|
func (mmc *ModifyMsgConsumerHandler) ModifyMsg(ctx context.Context, cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
|
||||||
log.NewInfo("msg come here ModifyMsg!!!", "", "msg", string(cMsg.Value), msgKey)
|
log.NewInfo("msg come here ModifyMsg!!!", "", "msg", string(cMsg.Value), msgKey)
|
||||||
msgFromMQ := pbMsg.MsgDataToModifyByMQ{}
|
msgFromMQ := pbMsg.MsgDataToModifyByMQ{}
|
||||||
|
operationID := tracelog.GetOperationID(ctx)
|
||||||
err := proto.Unmarshal(cMsg.Value, &msgFromMQ)
|
err := proto.Unmarshal(cMsg.Value, &msgFromMQ)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(msgFromMQ.TriggerID, "msg_transfer Unmarshal msg err", "msg", string(cMsg.Value), "err", err.Error())
|
log.NewError(msgFromMQ.TriggerID, "msg_transfer Unmarshal msg err", "msg", string(cMsg.Value), "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debug(msgFromMQ.TriggerID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
|
log.Debug(msgFromMQ.TriggerID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
|
||||||
for _, msgDataToMQ := range msgFromMQ.MessageList {
|
for _, msgDataToMQ := range msgFromMQ.Messages {
|
||||||
isReactionFromCache := utils.GetSwitchFromOptions(msgDataToMQ.MsgData.Options, constant.IsReactionFromCache)
|
isReactionFromCache := utils.GetSwitchFromOptions(msgDataToMQ.MsgData.Options, constant.IsReactionFromCache)
|
||||||
if !isReactionFromCache {
|
if !isReactionFromCache {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
tracelog.SetOperationID(ctx, msgDataToMQ.OperationID)
|
tracelog.SetOperationID(ctx, operationID)
|
||||||
if msgDataToMQ.MsgData.ContentType == constant.ReactionMessageModifier {
|
if msgDataToMQ.MsgData.ContentType == constant.ReactionMessageModifier {
|
||||||
notification := &apistruct.ReactionMessageModifierNotification{}
|
notification := &apistruct.ReactionMessageModifierNotification{}
|
||||||
if err := json.Unmarshal(msgDataToMQ.MsgData.Content, notification); err != nil {
|
if err := json.Unmarshal(msgDataToMQ.MsgData.Content, notification); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if notification.IsExternalExtensions {
|
if notification.IsExternalExtensions {
|
||||||
log.NewInfo(msgDataToMQ.OperationID, "msg:", notification, "this is external extensions")
|
log.NewInfo(operationID, "msg:", notification, "this is external extensions")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !notification.IsReact {
|
if !notification.IsReact {
|
||||||
@ -89,7 +94,7 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := mmc.extendMsgDatabase.InsertExtendMsg(ctx, notification.SourceID, notification.SessionType, &extendMsg); err != nil {
|
if err := mmc.extendMsgDatabase.InsertExtendMsg(ctx, notification.SourceID, notification.SessionType, &extendMsg); err != nil {
|
||||||
log.NewError(msgDataToMQ.OperationID, "MsgFirstModify InsertExtendMsg failed", notification.SourceID, notification.SessionType, extendMsg, err.Error())
|
log.NewError(operationID, "MsgFirstModify InsertExtendMsg failed", notification.SourceID, notification.SessionType, extendMsg, err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -103,7 +108,7 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg
|
|||||||
}
|
}
|
||||||
// is already modify
|
// is already modify
|
||||||
if err := mmc.extendMsgDatabase.InsertOrUpdateReactionExtendMsgSet(ctx, notification.SourceID, notification.SessionType, notification.ClientMsgID, notification.MsgFirstModifyTime, reactionExtensionList); err != nil {
|
if err := mmc.extendMsgDatabase.InsertOrUpdateReactionExtendMsgSet(ctx, notification.SourceID, notification.SessionType, notification.ClientMsgID, notification.MsgFirstModifyTime, reactionExtensionList); err != nil {
|
||||||
log.NewError(msgDataToMQ.OperationID, "InsertOrUpdateReactionExtendMsgSet failed")
|
log.NewError(operationID, "InsertOrUpdateReactionExtendMsgSet failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if msgDataToMQ.MsgData.ContentType == constant.ReactionMessageDeleter {
|
} else if msgDataToMQ.MsgData.ContentType == constant.ReactionMessageDeleter {
|
||||||
@ -112,7 +117,7 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := mmc.extendMsgDatabase.DeleteReactionExtendMsgSet(ctx, notification.SourceID, notification.SessionType, notification.ClientMsgID, notification.MsgFirstModifyTime, notification.SuccessReactionExtensionList); err != nil {
|
if err := mmc.extendMsgDatabase.DeleteReactionExtendMsgSet(ctx, notification.SourceID, notification.SessionType, notification.ClientMsgID, notification.MsgFirstModifyTime, notification.SuccessReactionExtensionList); err != nil {
|
||||||
log.NewError(msgDataToMQ.OperationID, "InsertOrUpdateReactionExtendMsgSet failed")
|
log.NewError(operationID, "InsertOrUpdateReactionExtendMsgSet failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,11 @@ package msgtransfer
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/db/cache"
|
|
||||||
"OpenIM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"OpenIM/pkg/common/kafka"
|
"OpenIM/pkg/common/kafka"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"OpenIM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbMsg "OpenIM/pkg/proto/msg"
|
pbMsg "OpenIM/pkg/proto/msg"
|
||||||
pbPush "OpenIM/pkg/proto/push"
|
|
||||||
"OpenIM/pkg/statistics"
|
"OpenIM/pkg/statistics"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
@ -57,10 +55,11 @@ type OnlineHistoryRedisConsumerHandler struct {
|
|||||||
producerToMongo *kafka.Producer
|
producerToMongo *kafka.Producer
|
||||||
|
|
||||||
msgDatabase controller.MsgDatabase
|
msgDatabase controller.MsgDatabase
|
||||||
cache cache.Cache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (och *OnlineHistoryRedisConsumerHandler) Init() {
|
func NewOnlineHistoryRedisConsumerHandler(database controller.MsgDatabase) *OnlineHistoryRedisConsumerHandler {
|
||||||
|
var och OnlineHistoryRedisConsumerHandler
|
||||||
|
och.msgDatabase = database
|
||||||
och.msgDistributionCh = make(chan Cmd2Value) //no buffer channel
|
och.msgDistributionCh = make(chan Cmd2Value) //no buffer channel
|
||||||
go och.MessagesDistributionHandle()
|
go och.MessagesDistributionHandle()
|
||||||
for i := 0; i < ChannelNum; i++ {
|
for i := 0; i < ChannelNum; i++ {
|
||||||
@ -73,8 +72,8 @@ func (och *OnlineHistoryRedisConsumerHandler) Init() {
|
|||||||
och.historyConsumerGroup = kafka.NewMConsumerGroup(&kafka.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
och.historyConsumerGroup = kafka.NewMConsumerGroup(&kafka.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
|
||||||
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToRedis)
|
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToRedis)
|
||||||
|
|
||||||
statistics.NewStatistics(&och.singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
|
statistics.NewStatistics(&och.singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
|
||||||
|
return &och
|
||||||
}
|
}
|
||||||
|
|
||||||
func (och *OnlineHistoryRedisConsumerHandler) Run(channelID int) {
|
func (och *OnlineHistoryRedisConsumerHandler) Run(channelID int) {
|
||||||
@ -242,17 +241,17 @@ func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerG
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (och *OnlineHistoryRedisConsumerHandler) sendMessageToPushMQ(ctx context.Context, message *pbMsg.MsgDataToMQ, pushToUserID string) {
|
func (och *OnlineHistoryRedisConsumerHandler) sendMessageToPushMQ(ctx context.Context, message *pbMsg.MsgDataToMQ, pushToUserID string) {
|
||||||
mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID}
|
mqPushMsg := pbMsg.PushMsgDataToMQ{MsgData: message.MsgData, SourceID: pushToUserID}
|
||||||
pid, offset, err := och.producerToPush.SendMessage(ctx, &mqPushMsg, mqPushMsg.PushToUserID)
|
pid, offset, err := och.producerToPush.SendMessage(ctx, &mqPushMsg, mqPushMsg.SourceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(mqPushMsg.OperationID, "kafka send failed", "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error())
|
log.Error(tracelog.GetOperationID(ctx), "kafka send failed", "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error())
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (och *OnlineHistoryRedisConsumerHandler) sendMessageToModifyMQ(ctx context.Context, aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ) {
|
func (och *OnlineHistoryRedisConsumerHandler) sendMessageToModifyMQ(ctx context.Context, aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ) {
|
||||||
if len(messages) > 0 {
|
if len(messages) > 0 {
|
||||||
pid, offset, err := och.producerToModify.SendMessage(ctx, &pbMsg.MsgDataToModifyByMQ{AggregationID: aggregationID, MessageList: messages, TriggerID: triggerID}, aggregationID)
|
pid, offset, err := och.producerToModify.SendMessage(ctx, &pbMsg.MsgDataToModifyByMQ{AggregationID: aggregationID, Messages: messages, TriggerID: triggerID}, aggregationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
|
log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
|
||||||
}
|
}
|
||||||
@ -261,7 +260,7 @@ func (och *OnlineHistoryRedisConsumerHandler) sendMessageToModifyMQ(ctx context.
|
|||||||
|
|
||||||
func (och *OnlineHistoryRedisConsumerHandler) SendMessageToMongoCH(ctx context.Context, aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ, lastSeq int64) {
|
func (och *OnlineHistoryRedisConsumerHandler) SendMessageToMongoCH(ctx context.Context, aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ, lastSeq int64) {
|
||||||
if len(messages) > 0 {
|
if len(messages) > 0 {
|
||||||
pid, offset, err := och.producerToMongo.SendMessage(ctx, &pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, AggregationID: aggregationID, MessageList: messages, TriggerID: triggerID}, aggregationID)
|
pid, offset, err := och.producerToMongo.SendMessage(ctx, &pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, AggregationID: aggregationID, Messages: messages, TriggerID: triggerID}, aggregationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
|
log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package msgtransfer
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/db/cache"
|
|
||||||
"OpenIM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
kfk "OpenIM/pkg/common/kafka"
|
kfk "OpenIM/pkg/common/kafka"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
@ -19,66 +18,68 @@ import (
|
|||||||
type OnlineHistoryMongoConsumerHandler struct {
|
type OnlineHistoryMongoConsumerHandler struct {
|
||||||
historyConsumerGroup *kfk.MConsumerGroup
|
historyConsumerGroup *kfk.MConsumerGroup
|
||||||
msgDatabase controller.MsgDatabase
|
msgDatabase controller.MsgDatabase
|
||||||
cache cache.Cache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mc *OnlineHistoryMongoConsumerHandler) Init() {
|
func NewOnlineHistoryMongoConsumerHandler(database controller.MsgDatabase) *OnlineHistoryMongoConsumerHandler {
|
||||||
mc.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
mc := &OnlineHistoryMongoConsumerHandler{
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToMongo.Topic},
|
historyConsumerGroup: kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
||||||
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo)
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToMongo.Topic},
|
||||||
|
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo),
|
||||||
|
msgDatabase: database,
|
||||||
|
}
|
||||||
|
return mc
|
||||||
}
|
}
|
||||||
func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
|
|
||||||
|
func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(ctx context.Context, cMsg *sarama.ConsumerMessage, msgKey string, session sarama.ConsumerGroupSession) {
|
||||||
msg := cMsg.Value
|
msg := cMsg.Value
|
||||||
msgFromMQ := pbMsg.MsgDataToMongoByMQ{}
|
msgFromMQ := pbMsg.MsgDataToMongoByMQ{}
|
||||||
|
operationID := tracelog.GetOperationID(ctx)
|
||||||
err := proto.Unmarshal(msg, &msgFromMQ)
|
err := proto.Unmarshal(msg, &msgFromMQ)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
|
log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info(msgFromMQ.TriggerID, "BatchInsertChat2DB userID: ", msgFromMQ.AggregationID, "msgFromMQ.LastSeq: ", msgFromMQ.LastSeq)
|
log.Info(operationID, "BatchInsertChat2DB userID: ", msgFromMQ.AggregationID, "msgFromMQ.LastSeq: ", msgFromMQ.LastSeq)
|
||||||
ctx := context.Background()
|
|
||||||
tracelog.SetOperationID(ctx, msgFromMQ.TriggerID)
|
|
||||||
//err = db.DB.BatchInsertChat2DB(msgFromMQ.AggregationID, msgFromMQ.MessageList, msgFromMQ.TriggerID, msgFromMQ.LastSeq)
|
//err = db.DB.BatchInsertChat2DB(msgFromMQ.AggregationID, msgFromMQ.MessageList, msgFromMQ.TriggerID, msgFromMQ.LastSeq)
|
||||||
err = mc.msgDatabase.BatchInsertChat2DB(ctx, msgFromMQ.AggregationID, msgFromMQ.MessageList, msgFromMQ.LastSeq)
|
err = mc.msgDatabase.BatchInsertChat2DB(ctx, msgFromMQ.AggregationID, msgFromMQ.Messages, msgFromMQ.LastSeq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(msgFromMQ.TriggerID, "single data insert to mongo err", err.Error(), msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
|
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.Messages, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
|
||||||
}
|
}
|
||||||
//err = db.DB.DeleteMessageFromCache(msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.GetTriggerID())
|
//err = db.DB.DeleteMessageFromCache(msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.GetTriggerID())
|
||||||
err = mc.msgDatabase.DeleteMessageFromCache(ctx, msgFromMQ.AggregationID, msgFromMQ.MessageList)
|
err = mc.msgDatabase.DeleteMessageFromCache(ctx, msgFromMQ.AggregationID, msgFromMQ.Messages)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(msgFromMQ.TriggerID, "remove cache msg from redis err", err.Error(), msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
|
log.NewError(operationID, "remove cache msg from redis err", err.Error(), msgFromMQ.Messages, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
|
||||||
}
|
}
|
||||||
for _, v := range msgFromMQ.MessageList {
|
for _, v := range msgFromMQ.Messages {
|
||||||
if v.MsgData.ContentType == constant.DeleteMessageNotification {
|
if v.MsgData.ContentType == constant.DeleteMessageNotification {
|
||||||
tips := sdkws.TipsComm{}
|
tips := sdkws.TipsComm{}
|
||||||
DeleteMessageTips := sdkws.DeleteMessageTips{}
|
DeleteMessageTips := sdkws.DeleteMessageTips{}
|
||||||
err := proto.Unmarshal(v.MsgData.Content, &tips)
|
err := proto.Unmarshal(v.MsgData.Content, &tips)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(msgFromMQ.TriggerID, "tips unmarshal err:", err.Error(), v.String())
|
log.NewError(operationID, "tips unmarshal err:", err.Error(), v.String())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err = proto.Unmarshal(tips.Detail, &DeleteMessageTips)
|
err = proto.Unmarshal(tips.Detail, &DeleteMessageTips)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(msgFromMQ.TriggerID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
|
log.NewError(operationID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if totalUnExistSeqs, err := mc.msgDatabase.DelMsgBySeqs(ctx, DeleteMessageTips.UserID, DeleteMessageTips.Seqs); err != nil {
|
if totalUnExistSeqs, err := mc.msgDatabase.DelMsgBySeqs(ctx, DeleteMessageTips.UserID, DeleteMessageTips.Seqs); err != nil {
|
||||||
log.NewError(v.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqs args: ", DeleteMessageTips.UserID, DeleteMessageTips.Seqs, "error:", err.Error(), "totalUnExistSeqs: ", totalUnExistSeqs)
|
log.NewError(operationID, utils.GetSelfFuncName(), "DelMsgBySeqs args: ", DeleteMessageTips.UserID, DeleteMessageTips.Seqs, "error:", err.Error(), "totalUnExistSeqs: ", totalUnExistSeqs)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
func (OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
func (mc *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
|
func (mc *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
|
||||||
claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
|
|
||||||
log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
|
log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
|
||||||
for msg := range claim.Messages() {
|
for msg := range claim.Messages() {
|
||||||
log.NewDebug("", "kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
|
log.NewDebug("", "kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
|
||||||
if len(msg.Value) != 0 {
|
if len(msg.Value) != 0 {
|
||||||
mc.handleChatWs2Mongo(msg, string(msg.Key), sess)
|
ctx := mc.historyConsumerGroup.GetContextFromMsg(msg)
|
||||||
|
mc.handleChatWs2Mongo(ctx, msg, string(msg.Key), sess)
|
||||||
} else {
|
} else {
|
||||||
log.Error("", "mongo msg get from kafka but is nil", msg.Key)
|
log.Error("", "mongo msg get from kafka but is nil", msg.Key)
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,10 @@ import (
|
|||||||
"OpenIM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
kfk "OpenIM/pkg/common/kafka"
|
kfk "OpenIM/pkg/common/kafka"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
|
"OpenIM/pkg/common/tracelog"
|
||||||
pbMsg "OpenIM/pkg/proto/msg"
|
pbMsg "OpenIM/pkg/proto/msg"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
@ -21,26 +23,30 @@ import (
|
|||||||
|
|
||||||
type PersistentConsumerHandler struct {
|
type PersistentConsumerHandler struct {
|
||||||
persistentConsumerGroup *kfk.MConsumerGroup
|
persistentConsumerGroup *kfk.MConsumerGroup
|
||||||
chatLogInterface controller.ChatLogDatabase
|
chatLogDatabase controller.ChatLogDatabase
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pc *PersistentConsumerHandler) Init() {
|
func NewPersistentConsumerHandler(database controller.ChatLogDatabase) *PersistentConsumerHandler {
|
||||||
pc.persistentConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
return &PersistentConsumerHandler{
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
|
persistentConsumerGroup: kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
||||||
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql)
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
|
||||||
|
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql),
|
||||||
|
chatLogDatabase: database,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
|
func (pc *PersistentConsumerHandler) handleChatWs2Mysql(ctx context.Context, cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
|
||||||
msg := cMsg.Value
|
msg := cMsg.Value
|
||||||
|
operationID := tracelog.GetOperationID(ctx)
|
||||||
log.NewInfo("msg come here mysql!!!", "", "msg", string(msg), msgKey)
|
log.NewInfo("msg come here mysql!!!", "", "msg", string(msg), msgKey)
|
||||||
var tag bool
|
var tag bool
|
||||||
msgFromMQ := pbMsg.MsgDataToMQ{}
|
msgFromMQ := pbMsg.MsgDataToMQ{}
|
||||||
err := proto.Unmarshal(msg, &msgFromMQ)
|
err := proto.Unmarshal(msg, &msgFromMQ)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(msgFromMQ.OperationID, "msg_transfer Unmarshal msg err", "msg", string(msg), "err", err.Error())
|
log.NewError(operationID, "msg_transfer Unmarshal msg err", "msg", string(msg), "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debug(msgFromMQ.OperationID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
|
log.Debug(operationID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
|
||||||
//Control whether to store history messages (mysql)
|
//Control whether to store history messages (mysql)
|
||||||
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
|
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
|
||||||
//Only process receiver data
|
//Only process receiver data
|
||||||
@ -58,23 +64,22 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMes
|
|||||||
tag = true
|
tag = true
|
||||||
}
|
}
|
||||||
if tag {
|
if tag {
|
||||||
log.NewInfo(msgFromMQ.OperationID, "msg_transfer msg persisting", string(msg))
|
log.NewInfo(operationID, "msg_transfer msg persisting", string(msg))
|
||||||
if err = pc.chatLogInterface.CreateChatLog(msgFromMQ); err != nil {
|
if err = pc.chatLogInterface.CreateChatLog(msgFromMQ); err != nil {
|
||||||
log.NewError(msgFromMQ.OperationID, "Message insert failed", "err", err.Error(), "msg", msgFromMQ.String())
|
log.NewError(operationID, "Message insert failed", "err", err.Error(), "msg", msgFromMQ.String())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (PersistentConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (PersistentConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
func (PersistentConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (PersistentConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
|
func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
|
||||||
claim sarama.ConsumerGroupClaim) error {
|
|
||||||
for msg := range claim.Messages() {
|
for msg := range claim.Messages() {
|
||||||
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
|
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
|
||||||
if len(msg.Value) != 0 {
|
if len(msg.Value) != 0 {
|
||||||
pc.handleChatWs2Mysql(msg, string(msg.Key), sess)
|
ctx := pc.persistentConsumerGroup.GetContextFromMsg(msg)
|
||||||
|
pc.handleChatWs2Mysql(ctx, msg, string(msg.Key), sess)
|
||||||
} else {
|
} else {
|
||||||
log.Error("", "msg get from kafka but is nil", msg.Key)
|
log.Error("", "msg get from kafka but is nil", msg.Key)
|
||||||
}
|
}
|
||||||
|
@ -107,143 +107,3 @@ func callbackBeforeSuperGroupOnlinePush(ctx context.Context, groupID string, msg
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//func callbackOfflinePush(operationID string, userIDList []string, msg *common.MsgData, offlinePushUserIDList *[]string) cbApi.CommonCallbackResp {
|
|
||||||
// callbackResp := cbapi.CommonCallbackResp{OperationID: operationID}
|
|
||||||
// if !config.Config.Callback.CallbackOfflinePush.Enable {
|
|
||||||
// return callbackResp
|
|
||||||
// }
|
|
||||||
// req := cbApi.CallbackBeforePushReq{
|
|
||||||
// UserStatusBatchCallbackReq: cbApi.UserStatusBatchCallbackReq{
|
|
||||||
// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{
|
|
||||||
// CallbackCommand: constant.CallbackOfflinePushCommand,
|
|
||||||
// OperationID: operationID,
|
|
||||||
// PlatformID: msg.SenderPlatformID,
|
|
||||||
// Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
|
|
||||||
// },
|
|
||||||
// UserIDList: userIDList,
|
|
||||||
// },
|
|
||||||
// OfflinePushInfo: msg.OfflinePushInfo,
|
|
||||||
// ClientMsgID: msg.ClientMsgID,
|
|
||||||
// SendID: msg.SendID,
|
|
||||||
// GroupID: msg.GroupID,
|
|
||||||
// ContentType: msg.ContentType,
|
|
||||||
// SessionType: msg.SessionType,
|
|
||||||
// AtUserIDList: msg.AtUserIDList,
|
|
||||||
// Content: callback.GetContent(msg),
|
|
||||||
// }
|
|
||||||
// resp := &cbApi.CallbackBeforePushResp{CommonCallbackResp: &callbackResp}
|
|
||||||
// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackOfflinePushCommand, req, resp, config.Config.Callback.CallbackOfflinePush.CallbackTimeOut); err != nil {
|
|
||||||
// callbackResp.ErrCode = http2.StatusInternalServerError
|
|
||||||
// callbackResp.ErrMsg = err.Error()
|
|
||||||
// if !*config.Config.Callback.CallbackOfflinePush.CallbackFailedContinue {
|
|
||||||
// callbackResp.ActionCode = constant.ActionForbidden
|
|
||||||
// return callbackResp
|
|
||||||
// } else {
|
|
||||||
// callbackResp.ActionCode = constant.ActionAllow
|
|
||||||
// return callbackResp
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
|
|
||||||
// if len(resp.UserIDList) != 0 {
|
|
||||||
// *offlinePushUserIDList = resp.UserIDList
|
|
||||||
// }
|
|
||||||
// if resp.OfflinePushInfo != nil {
|
|
||||||
// msg.OfflinePushInfo = resp.OfflinePushInfo
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// log.NewDebug(operationID, utils.GetSelfFuncName(), offlinePushUserIDList, resp.UserIDList)
|
|
||||||
// return callbackResp
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//func callbackOnlinePush(operationID string, userIDList []string, msg *common.MsgData) cbApi.CommonCallbackResp {
|
|
||||||
// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
|
|
||||||
// if !config.Config.Callback.CallbackOnlinePush.Enable || utils.IsContain(msg.SendID, userIDList) {
|
|
||||||
// return callbackResp
|
|
||||||
// }
|
|
||||||
// req := cbApi.CallbackBeforePushReq{
|
|
||||||
// UserStatusBatchCallbackReq: cbApi.UserStatusBatchCallbackReq{
|
|
||||||
// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{
|
|
||||||
// CallbackCommand: constant.CallbackOnlinePushCommand,
|
|
||||||
// OperationID: operationID,
|
|
||||||
// PlatformID: msg.SenderPlatformID,
|
|
||||||
// Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
|
|
||||||
// },
|
|
||||||
// UserIDList: userIDList,
|
|
||||||
// },
|
|
||||||
// //OfflinePushInfo: msg.OfflinePushInfo,
|
|
||||||
// ClientMsgID: msg.ClientMsgID,
|
|
||||||
// SendID: msg.SendID,
|
|
||||||
// GroupID: msg.GroupID,
|
|
||||||
// ContentType: msg.ContentType,
|
|
||||||
// SessionType: msg.SessionType,
|
|
||||||
// AtUserIDList: msg.AtUserIDList,
|
|
||||||
// Content: callback.GetContent(msg),
|
|
||||||
// }
|
|
||||||
// resp := &cbApi.CallbackBeforePushResp{CommonCallbackResp: &callbackResp}
|
|
||||||
// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackOnlinePushCommand, req, resp, config.Config.Callback.CallbackOnlinePush.CallbackTimeOut); err != nil {
|
|
||||||
// callbackResp.ErrCode = http2.StatusInternalServerError
|
|
||||||
// callbackResp.ErrMsg = err.Error()
|
|
||||||
// if !config.Config.Callback.CallbackOnlinePush.CallbackFailedContinue {
|
|
||||||
// callbackResp.ActionCode = constant.ActionForbidden
|
|
||||||
// return callbackResp
|
|
||||||
// } else {
|
|
||||||
// callbackResp.ActionCode = constant.ActionAllow
|
|
||||||
// return callbackResp
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
|
|
||||||
// //if resp.OfflinePushInfo != nil {
|
|
||||||
// // msg.OfflinePushInfo = resp.OfflinePushInfo
|
|
||||||
// //}
|
|
||||||
// }
|
|
||||||
// return callbackResp
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//func callbackBeforeSuperGroupOnlinePush(operationID string, groupID string, msg *common.MsgData, pushToUserList *[]string) cbApi.CommonCallbackResp {
|
|
||||||
// log.Debug(operationID, utils.GetSelfFuncName(), groupID, msg.String(), pushToUserList)
|
|
||||||
// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
|
|
||||||
// if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable {
|
|
||||||
// return callbackResp
|
|
||||||
// }
|
|
||||||
// req := cbApi.CallbackBeforeSuperGroupOnlinePushReq{
|
|
||||||
// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{
|
|
||||||
// CallbackCommand: constant.CallbackSuperGroupOnlinePushCommand,
|
|
||||||
// OperationID: operationID,
|
|
||||||
// PlatformID: msg.SenderPlatformID,
|
|
||||||
// Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
|
|
||||||
// },
|
|
||||||
// //OfflinePushInfo: msg.OfflinePushInfo,
|
|
||||||
// ClientMsgID: msg.ClientMsgID,
|
|
||||||
// SendID: msg.SendID,
|
|
||||||
// GroupID: groupID,
|
|
||||||
// ContentType: msg.ContentType,
|
|
||||||
// SessionType: msg.SessionType,
|
|
||||||
// AtUserIDList: msg.AtUserIDList,
|
|
||||||
// Content: callback.GetContent(msg),
|
|
||||||
// Seq: msg.Seq,
|
|
||||||
// }
|
|
||||||
// resp := &cbApi.CallbackBeforeSuperGroupOnlinePushResp{CommonCallbackResp: &callbackResp}
|
|
||||||
// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackSuperGroupOnlinePushCommand, req, resp, config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.CallbackTimeOut); err != nil {
|
|
||||||
// callbackResp.ErrCode = http2.StatusInternalServerError
|
|
||||||
// callbackResp.ErrMsg = err.Error()
|
|
||||||
// if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.CallbackFailedContinue {
|
|
||||||
// callbackResp.ActionCode = constant.ActionForbidden
|
|
||||||
// return callbackResp
|
|
||||||
// } else {
|
|
||||||
// callbackResp.ActionCode = constant.ActionAllow
|
|
||||||
// return callbackResp
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
|
|
||||||
// if len(resp.UserIDList) != 0 {
|
|
||||||
// *pushToUserList = resp.UserIDList
|
|
||||||
// }
|
|
||||||
// //if resp.OfflinePushInfo != nil {
|
|
||||||
// // msg.OfflinePushInfo = resp.OfflinePushInfo
|
|
||||||
// //}
|
|
||||||
// }
|
|
||||||
// log.NewDebug(operationID, utils.GetSelfFuncName(), pushToUserList, resp.UserIDList)
|
|
||||||
// return callbackResp
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
36
internal/push/consumer_init.go
Normal file
36
internal/push/consumer_init.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
** description("").
|
||||||
|
** copyright('open-im,www.open-im.io').
|
||||||
|
** author("fg,Gordon@open-im.io").
|
||||||
|
** time(2021/3/22 15:33).
|
||||||
|
*/
|
||||||
|
package push
|
||||||
|
|
||||||
|
import (
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/constant"
|
||||||
|
"OpenIM/pkg/common/prome"
|
||||||
|
"OpenIM/pkg/statistics"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Consumer struct {
|
||||||
|
pushCh ConsumerHandler
|
||||||
|
successCount uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewConsumer(pusher *Pusher) *Consumer {
|
||||||
|
return &Consumer{
|
||||||
|
pushCh: *NewConsumerHandler(pusher),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Consumer) initPrometheus() {
|
||||||
|
prome.NewMsgOfflinePushSuccessCounter()
|
||||||
|
prome.NewMsgOfflinePushFailedCounter()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Consumer) Start() {
|
||||||
|
statistics.NewStatistics(&c.successCount, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
|
||||||
|
go c.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&c.pushCh)
|
||||||
|
}
|
@ -19,10 +19,10 @@ var Terminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID, constan
|
|||||||
|
|
||||||
type Fcm struct {
|
type Fcm struct {
|
||||||
fcmMsgCli *messaging.Client
|
fcmMsgCli *messaging.Client
|
||||||
cache cache.Cache
|
cache cache.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cache cache.Cache) *Fcm {
|
func NewClient(cache cache.Model) *Fcm {
|
||||||
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
|
||||||
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Test_Push(t *testing.T) {
|
func Test_Push(t *testing.T) {
|
||||||
var redis cache.Cache
|
var redis cache.Model
|
||||||
offlinePusher := NewClient(redis)
|
offlinePusher := NewClient(redis)
|
||||||
err := offlinePusher.Push(context.Background(), []string{"userID1"}, "test", "test", &push.Opts{})
|
err := offlinePusher.Push(context.Background(), []string{"userID1"}, "test", "test", &push.Opts{})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
@ -38,12 +38,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
cache cache.Cache
|
cache cache.Model
|
||||||
tokenExpireTime int64
|
tokenExpireTime int64
|
||||||
taskIDTTL int64
|
taskIDTTL int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cache cache.Cache) *Client {
|
func NewClient(cache cache.Model) *Client {
|
||||||
return &Client{cache: cache, tokenExpireTime: tokenExpireTime, taskIDTTL: taskIDTTL}
|
return &Client{cache: cache, tokenExpireTime: tokenExpireTime, taskIDTTL: taskIDTTL}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
** description("").
|
|
||||||
** copyright('open-im,www.open-im.io').
|
|
||||||
** author("fg,Gordon@open-im.io").
|
|
||||||
** time(2021/3/22 15:33).
|
|
||||||
*/
|
|
||||||
package push
|
|
||||||
|
|
||||||
import (
|
|
||||||
fcm "OpenIM/internal/push/fcm"
|
|
||||||
"OpenIM/internal/push/getui"
|
|
||||||
jpush "OpenIM/internal/push/jpush"
|
|
||||||
"OpenIM/pkg/common/config"
|
|
||||||
"OpenIM/pkg/common/constant"
|
|
||||||
"OpenIM/pkg/common/db/cache"
|
|
||||||
"OpenIM/pkg/common/prome"
|
|
||||||
"OpenIM/pkg/statistics"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Push struct {
|
|
||||||
rpcServer PushServer
|
|
||||||
pushCh ConsumerHandler
|
|
||||||
offlinePusher OfflinePusher
|
|
||||||
successCount uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Push) Init(rpcPort int) error {
|
|
||||||
rdb, err := cache.NewRedis()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
var cacheInterface cache.Cache
|
|
||||||
p.rpcServer.Init(rpcPort, cacheInterface)
|
|
||||||
p.pushCh.Init()
|
|
||||||
statistics.NewStatistics(&p.successCount, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
|
|
||||||
if *config.Config.Push.Getui.Enable {
|
|
||||||
p.offlinePusher = getui.NewClient(cacheInterface)
|
|
||||||
}
|
|
||||||
if config.Config.Push.Jpns.Enable {
|
|
||||||
p.offlinePusher = jpush.NewClient()
|
|
||||||
}
|
|
||||||
if config.Config.Push.Fcm.Enable {
|
|
||||||
p.offlinePusher = fcm.NewClient(cacheInterface)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Push) initPrometheus() {
|
|
||||||
prome.NewMsgOfflinePushSuccessCounter()
|
|
||||||
prome.NewMsgOfflinePushFailedCounter()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Push) Run(prometheusPort int) {
|
|
||||||
go p.rpcServer.run()
|
|
||||||
go p.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&p.pushCh)
|
|
||||||
go func() {
|
|
||||||
err := prome.StartPrometheusSrv(prometheusPort)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package push
|
package jpush
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/internal/push"
|
"OpenIM/internal/push"
|
||||||
|
39
internal/push/offlinepush_interface.go
Normal file
39
internal/push/offlinepush_interface.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package push
|
||||||
|
|
||||||
|
import (
|
||||||
|
"OpenIM/internal/push/fcm"
|
||||||
|
"OpenIM/internal/push/getui"
|
||||||
|
"OpenIM/internal/push/jpush"
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/db/cache"
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OfflinePusher interface {
|
||||||
|
Push(ctx context.Context, userIDs []string, title, content string, opts *Opts) error
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewOfflinePusher(cache cache.Model) OfflinePusher {
|
||||||
|
var offlinePusher OfflinePusher
|
||||||
|
if config.Config.Push.Getui.Enable {
|
||||||
|
offlinePusher = getui.NewClient(cache)
|
||||||
|
}
|
||||||
|
if config.Config.Push.Fcm.Enable {
|
||||||
|
offlinePusher = fcm.NewClient(cache)
|
||||||
|
}
|
||||||
|
if config.Config.Push.Jpns.Enable {
|
||||||
|
offlinePusher = jpush.NewClient()
|
||||||
|
}
|
||||||
|
return offlinePusher
|
||||||
|
}
|
||||||
|
|
||||||
|
type Opts struct {
|
||||||
|
Signal *Signal
|
||||||
|
IOSPushSound string
|
||||||
|
IOSBadgeCount bool
|
||||||
|
Ex string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Signal struct {
|
||||||
|
ClientMsgID string
|
||||||
|
}
|
@ -22,16 +22,19 @@ import (
|
|||||||
|
|
||||||
type ConsumerHandler struct {
|
type ConsumerHandler struct {
|
||||||
pushConsumerGroup *kfk.MConsumerGroup
|
pushConsumerGroup *kfk.MConsumerGroup
|
||||||
pusher Pusher
|
pusher *Pusher
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConsumerHandler) Init() {
|
func NewConsumerHandler(pusher *Pusher) *ConsumerHandler {
|
||||||
c.pushConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
var consumerHandler ConsumerHandler
|
||||||
|
consumerHandler.pusher = pusher
|
||||||
|
consumerHandler.pushConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ms2pschat.Topic}, config.Config.Kafka.Ms2pschat.Addr,
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ms2pschat.Topic}, config.Config.Kafka.Ms2pschat.Addr,
|
||||||
config.Config.Kafka.ConsumerGroupID.MsgToPush)
|
config.Config.Kafka.ConsumerGroupID.MsgToPush)
|
||||||
|
return &consumerHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConsumerHandler) handleMs2PsChat(msg []byte) {
|
func (c *ConsumerHandler) handleMs2PsChat(ctx context.Context, msg []byte) {
|
||||||
log.NewDebug("", "msg come from kafka And push!!!", "msg", string(msg))
|
log.NewDebug("", "msg come from kafka And push!!!", "msg", string(msg))
|
||||||
msgFromMQ := pbChat.PushMsgDataToMQ{}
|
msgFromMQ := pbChat.PushMsgDataToMQ{}
|
||||||
if err := proto.Unmarshal(msg, &msgFromMQ); err != nil {
|
if err := proto.Unmarshal(msg, &msgFromMQ); err != nil {
|
||||||
@ -40,14 +43,13 @@ func (c *ConsumerHandler) handleMs2PsChat(msg []byte) {
|
|||||||
}
|
}
|
||||||
pbData := &pbPush.PushMsgReq{
|
pbData := &pbPush.PushMsgReq{
|
||||||
MsgData: msgFromMQ.MsgData,
|
MsgData: msgFromMQ.MsgData,
|
||||||
SourceID: msgFromMQ.PushToUserID,
|
SourceID: msgFromMQ.SourceID,
|
||||||
}
|
}
|
||||||
sec := msgFromMQ.MsgData.SendTime / 1000
|
sec := msgFromMQ.MsgData.SendTime / 1000
|
||||||
nowSec := utils.GetCurrentTimestampBySecond()
|
nowSec := utils.GetCurrentTimestampBySecond()
|
||||||
if nowSec-sec > 10 {
|
if nowSec-sec > 10 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx := context.Background()
|
|
||||||
tracelog.SetOperationID(ctx, "")
|
tracelog.SetOperationID(ctx, "")
|
||||||
var err error
|
var err error
|
||||||
switch msgFromMQ.MsgData.SessionType {
|
switch msgFromMQ.MsgData.SessionType {
|
||||||
@ -66,7 +68,8 @@ func (c *ConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
|
|||||||
claim sarama.ConsumerGroupClaim) error {
|
claim sarama.ConsumerGroupClaim) error {
|
||||||
for msg := range claim.Messages() {
|
for msg := range claim.Messages() {
|
||||||
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
|
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
|
||||||
c.handleMs2PsChat(msg.Value)
|
ctx := c.pushConsumerGroup.GetContextFromMsg(msg)
|
||||||
|
c.handleMs2PsChat(ctx, msg.Value)
|
||||||
sess.MarkMessage(msg, "")
|
sess.MarkMessage(msg, "")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
package push
|
|
||||||
|
|
||||||
import "context"
|
|
||||||
|
|
||||||
type OfflinePusher interface {
|
|
||||||
Push(ctx context.Context, userIDs []string, title, content string, opts *Opts) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type Opts struct {
|
|
||||||
Signal *Signal
|
|
||||||
IOSPushSound string
|
|
||||||
IOSBadgeCount bool
|
|
||||||
Ex string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Signal struct {
|
|
||||||
ClientMsgID string
|
|
||||||
}
|
|
@ -1,24 +1,47 @@
|
|||||||
package push
|
package push
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
|
"OpenIM/pkg/common/db/controller"
|
||||||
|
"OpenIM/pkg/common/db/localcache"
|
||||||
|
"OpenIM/pkg/discoveryregistry"
|
||||||
pbPush "OpenIM/pkg/proto/push"
|
pbPush "OpenIM/pkg/proto/push"
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
type pushServer struct {
|
type pushServer struct {
|
||||||
pusher *Pusher
|
pusher *Pusher
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
|
rdb, err := cache.NewRedis()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
cacheModel := cache.NewCacheModel(rdb)
|
||||||
|
|
||||||
pbPush.RegisterPushMsgServiceServer(server, &pushServer{
|
offlinePusher := NewOfflinePusher(cacheModel)
|
||||||
pusher: NewPusher(),
|
database := controller.NewPushDatabase(cacheModel)
|
||||||
})
|
pusher := NewPusher(client, offlinePusher, database, localcache.NewGroupLocalCache(client), localcache.NewConversationLocalCache(client))
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
wg.Add(2)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
pbPush.RegisterPushMsgServiceServer(server, &pushServer{
|
||||||
|
pusher: pusher,
|
||||||
|
})
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
consumer := NewConsumer(pusher)
|
||||||
|
consumer.initPrometheus()
|
||||||
|
consumer.Start()
|
||||||
|
}()
|
||||||
|
wg.Wait()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *pushServer) PushMsg(ctx context.Context, pbData *pbPush.PushMsgReq) (resp *pbPush.PushMsgResp, err error) {
|
func (r *pushServer) PushMsg(ctx context.Context, pbData *pbPush.PushMsgReq) (resp *pbPush.PushMsgResp, err error) {
|
||||||
|
@ -27,13 +27,13 @@ type Pusher struct {
|
|||||||
database controller.PushDatabase
|
database controller.PushDatabase
|
||||||
client discoveryregistry.SvcDiscoveryRegistry
|
client discoveryregistry.SvcDiscoveryRegistry
|
||||||
offlinePusher OfflinePusher
|
offlinePusher OfflinePusher
|
||||||
groupLocalCache localcache.GroupLocalCache
|
groupLocalCache *localcache.GroupLocalCache
|
||||||
conversationLocalCache localcache.ConversationLocalCache
|
conversationLocalCache *localcache.ConversationLocalCache
|
||||||
successCount int
|
successCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPusher(client discoveryregistry.SvcDiscoveryRegistry, offlinePusher OfflinePusher, database controller.PushDatabase,
|
func NewPusher(client discoveryregistry.SvcDiscoveryRegistry, offlinePusher OfflinePusher, database controller.PushDatabase,
|
||||||
groupLocalCache localcache.GroupLocalCache, conversationLocalCache localcache.ConversationLocalCache) *Pusher {
|
groupLocalCache *localcache.GroupLocalCache, conversationLocalCache *localcache.ConversationLocalCache) *Pusher {
|
||||||
return &Pusher{
|
return &Pusher{
|
||||||
database: database,
|
database: database,
|
||||||
client: client,
|
client: client,
|
||||||
@ -162,7 +162,7 @@ func (p *Pusher) MsgToSuperGroupUser(ctx context.Context, groupID string, msg *s
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData, pushToUserIDs []string) (wsResults []*msggateway.SingleMsgToUserResultList, err error) {
|
func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData, pushToUserIDs []string) (wsResults []*msggateway.SingleMsgToUserResults, err error) {
|
||||||
conns, err := p.client.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
|
conns, err := p.client.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -170,7 +170,7 @@ func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData,
|
|||||||
//Online push message
|
//Online push message
|
||||||
for _, v := range conns {
|
for _, v := range conns {
|
||||||
msgClient := msggateway.NewMsgGatewayClient(v)
|
msgClient := msggateway.NewMsgGatewayClient(v)
|
||||||
reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(ctx, &msggateway.OnlineBatchPushOneMsgReq{OperationID: tracelog.GetOperationID(ctx), MsgData: msg, PushToUserIDList: pushToUserIDs})
|
reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(ctx, &msggateway.OnlineBatchPushOneMsgReq{MsgData: msg, PushToUserIDs: pushToUserIDs})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(tracelog.GetOperationID(ctx), msg, len(pushToUserIDs), "err", err)
|
log.NewError(tracelog.GetOperationID(ctx), msg, len(pushToUserIDs), "err", err)
|
||||||
continue
|
continue
|
||||||
|
@ -6,8 +6,6 @@ import (
|
|||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
"OpenIM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"OpenIM/pkg/common/db/relation"
|
|
||||||
relationTb "OpenIM/pkg/common/db/table/relation"
|
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
"OpenIM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"OpenIM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
@ -20,19 +18,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type authServer struct {
|
type authServer struct {
|
||||||
controller.AuthDatabase
|
authDatabase controller.AuthDatabase
|
||||||
userCheck *check.UserCheck
|
userCheck *check.UserCheck
|
||||||
RegisterCenter discoveryRegistry.SvcDiscoveryRegistry
|
RegisterCenter discoveryRegistry.SvcDiscoveryRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(client discoveryRegistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client discoveryRegistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
mysql, err := relation.NewGormDB()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := mysql.AutoMigrate(&relationTb.FriendModel{}, &relationTb.FriendRequestModel{}, &relationTb.BlackModel{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
rdb, err := cache.NewRedis()
|
rdb, err := cache.NewRedis()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -40,7 +31,7 @@ func Start(client discoveryRegistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
|||||||
pbAuth.RegisterAuthServer(server, &authServer{
|
pbAuth.RegisterAuthServer(server, &authServer{
|
||||||
userCheck: check.NewUserCheck(client),
|
userCheck: check.NewUserCheck(client),
|
||||||
RegisterCenter: client,
|
RegisterCenter: client,
|
||||||
AuthDatabase: controller.NewAuthDatabase(cache.NewCache(rdb), config.Config.TokenPolicy.AccessSecret, config.Config.TokenPolicy.AccessExpire),
|
authDatabase: controller.NewAuthDatabase(cache.NewCacheModel(rdb), config.Config.TokenPolicy.AccessSecret, config.Config.TokenPolicy.AccessExpire),
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -50,7 +41,7 @@ func (s *authServer) UserToken(ctx context.Context, req *pbAuth.UserTokenReq) (*
|
|||||||
if _, err := s.userCheck.GetUsersInfo(ctx, req.UserID); err != nil {
|
if _, err := s.userCheck.GetUsersInfo(ctx, req.UserID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
token, err := s.CreateToken(ctx, req.UserID, constant.PlatformIDToName(int(req.PlatformID)))
|
token, err := s.authDatabase.CreateToken(ctx, req.UserID, constant.PlatformIDToName(int(req.PlatformID)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -64,7 +55,7 @@ func (s *authServer) parseToken(ctx context.Context, tokensString string) (claim
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, utils.Wrap(err, "")
|
return nil, utils.Wrap(err, "")
|
||||||
}
|
}
|
||||||
m, err := s.GetTokensWithoutError(ctx, claims.UID, claims.Platform)
|
m, err := s.authDatabase.GetTokensWithoutError(ctx, claims.UID, claims.Platform)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -108,13 +99,13 @@ func (s *authServer) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID int32, operationID string) error {
|
func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID int32, operationID string) error {
|
||||||
grpcCons, err := s.RegisterCenter.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
|
conns, err := s.RegisterCenter.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, v := range grpcCons {
|
for _, v := range conns {
|
||||||
client := msggateway.NewMsgGatewayClient(v)
|
client := msggateway.NewMsgGatewayClient(v)
|
||||||
kickReq := &msggateway.KickUserOfflineReq{OperationID: operationID, KickUserIDList: []string{userID}, PlatformID: platformID}
|
kickReq := &msggateway.KickUserOfflineReq{KickUserIDList: []string{userID}, PlatformID: platformID}
|
||||||
log.NewInfo(operationID, "KickUserOffline ", client, kickReq.String())
|
log.NewInfo(operationID, "KickUserOffline ", client, kickReq.String())
|
||||||
_, err := client.KickUserOffline(ctx, kickReq)
|
_, err := client.KickUserOffline(ctx, kickReq)
|
||||||
return utils.Wrap(err, "")
|
return utils.Wrap(err, "")
|
||||||
|
@ -9,10 +9,10 @@ import (
|
|||||||
"OpenIM/pkg/common/db/relation"
|
"OpenIM/pkg/common/db/relation"
|
||||||
tableRelation "OpenIM/pkg/common/db/table/relation"
|
tableRelation "OpenIM/pkg/common/db/table/relation"
|
||||||
"OpenIM/pkg/common/db/tx"
|
"OpenIM/pkg/common/db/tx"
|
||||||
|
"OpenIM/pkg/discoveryregistry"
|
||||||
pbConversation "OpenIM/pkg/proto/conversation"
|
pbConversation "OpenIM/pkg/proto/conversation"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
|
||||||
"github.com/dtm-labs/rockscache"
|
"github.com/dtm-labs/rockscache"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
@ -23,7 +23,7 @@ type conversationServer struct {
|
|||||||
notify *notification.Check
|
notify *notification.Check
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
db, err := relation.NewGormDB()
|
db, err := relation.NewGormDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -31,13 +31,14 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
|||||||
if err := db.AutoMigrate(&tableRelation.ConversationModel{}); err != nil {
|
if err := db.AutoMigrate(&tableRelation.ConversationModel{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
redis, err := cache.NewRedis()
|
rdb, err := cache.NewRedis()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pbConversation.RegisterConversationServer(server, &conversationServer{
|
pbConversation.RegisterConversationServer(server, &conversationServer{
|
||||||
groupChecker: check.NewGroupChecker(client),
|
groupChecker: check.NewGroupChecker(client),
|
||||||
ConversationDatabase: controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(redis.GetClient(), rockscache.Options{
|
ConversationDatabase: controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(rdb, rockscache.Options{
|
||||||
RandomExpireAdjustment: 0.2,
|
RandomExpireAdjustment: 0.2,
|
||||||
DisableCacheRead: false,
|
DisableCacheRead: false,
|
||||||
DisableCacheDelete: false,
|
DisableCacheDelete: false,
|
||||||
@ -176,11 +177,11 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p
|
|||||||
|
|
||||||
// 获取超级大群开启免打扰的用户ID
|
// 获取超级大群开启免打扰的用户ID
|
||||||
func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbConversation.GetRecvMsgNotNotifyUserIDsReq) (*pbConversation.GetRecvMsgNotNotifyUserIDsResp, error) {
|
func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbConversation.GetRecvMsgNotNotifyUserIDsReq) (*pbConversation.GetRecvMsgNotNotifyUserIDsResp, error) {
|
||||||
resp := &pbConversation.GetRecvMsgNotNotifyUserIDsResp{}
|
|
||||||
userIDs, err := c.ConversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID)
|
userIDs, err := c.ConversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
resp := &pbConversation.GetRecvMsgNotNotifyUserIDsResp{}
|
||||||
resp.UserIDs = userIDs
|
resp.UserIDs = userIDs
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
"OpenIM/pkg/common/db/unrelation"
|
"OpenIM/pkg/common/db/unrelation"
|
||||||
"OpenIM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"OpenIM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
|
"OpenIM/pkg/discoveryregistry"
|
||||||
pbConversation "OpenIM/pkg/proto/conversation"
|
pbConversation "OpenIM/pkg/proto/conversation"
|
||||||
pbGroup "OpenIM/pkg/proto/group"
|
pbGroup "OpenIM/pkg/proto/group"
|
||||||
"OpenIM/pkg/proto/sdkws"
|
"OpenIM/pkg/proto/sdkws"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
|
||||||
"github.com/dtm-labs/rockscache"
|
"github.com/dtm-labs/rockscache"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -29,7 +29,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
db, err := relation.NewGormDB()
|
db, err := relation.NewGormDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -46,17 +46,7 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
pbGroup.RegisterGroupServer(server, &groupServer{
|
pbGroup.RegisterGroupServer(server, &groupServer{
|
||||||
GroupDatabase: controller.NewGroupDatabase(
|
GroupDatabase: controller.InitGroupDatabase(db, rdb, mongo.GetDatabase()),
|
||||||
relation.NewGroupDB(db),
|
|
||||||
relation.NewGroupMemberDB(db),
|
|
||||||
relation.NewGroupRequest(db),
|
|
||||||
tx.NewGorm(db),
|
|
||||||
tx.NewMongo(mongo.GetClient()),
|
|
||||||
unrelation.NewSuperGroupMongoDriver(mongo.GetClient()),
|
|
||||||
cache.NewGroupCacheRedis(rdb, relation.NewGroupDB(db), relation.NewGroupMemberDB(db), relation.NewGroupRequest(db), unrelation.NewSuperGroupMongoDriver(mongo.GetClient()), rockscache.Options{
|
|
||||||
StrongConsistency: true,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
UserCheck: check.NewUserCheck(client),
|
UserCheck: check.NewUserCheck(client),
|
||||||
ConversationChecker: check.NewConversationChecker(client),
|
ConversationChecker: check.NewConversationChecker(client),
|
||||||
})
|
})
|
||||||
|
@ -3,16 +3,15 @@ package msg
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/tokenverify"
|
"OpenIM/pkg/common/tokenverify"
|
||||||
"OpenIM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
"OpenIM/pkg/proto/sdkws"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *msgServer) DelMsgList(ctx context.Context, req *sdkws.DelMsgListReq) (*sdkws.DelMsgListResp, error) {
|
func (m *msgServer) DelMsgs(ctx context.Context, req *msg.DelMsgsReq) (*msg.DelMsgsResp, error) {
|
||||||
resp := &sdkws.DelMsgListResp{}
|
resp := &msg.DelMsgsResp{}
|
||||||
if _, err := m.MsgDatabase.DelMsgBySeqs(ctx, req.UserID, req.SeqList); err != nil {
|
if _, err := m.MsgDatabase.DelMsgBySeqs(ctx, req.UserID, req.Seqs); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
DeleteMessageNotification(ctx, req.UserID, req.SeqList)
|
DeleteMessageNotification(ctx, req.UserID, req.Seqs)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,13 +20,6 @@ func (m *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroup
|
|||||||
if err := tokenverify.CheckAdmin(ctx); err != nil {
|
if err := tokenverify.CheckAdmin(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
//maxSeq, err := m.MsgDatabase.GetGroupMaxSeq(ctx, req.GroupID)
|
|
||||||
//if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
//}
|
|
||||||
//if err := m.MsgDatabase.SetGroupUserMinSeq(ctx, req.GroupID, maxSeq); err != nil {
|
|
||||||
// return nil, err
|
|
||||||
//}
|
|
||||||
if err := m.MsgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, req.GroupID, []string{req.UserID}, 0); err != nil {
|
if err := m.MsgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, req.GroupID, []string{req.UserID}, 0); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -42,8 +34,5 @@ func (m *msgServer) ClearMsg(ctx context.Context, req *msg.ClearMsgReq) (*msg.Cl
|
|||||||
if err := m.MsgDatabase.CleanUpUserMsg(ctx, req.UserID); err != nil {
|
if err := m.MsgDatabase.CleanUpUserMsg(ctx, req.UserID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
//if err := m.MsgDatabase.DelUserAllSeq(ctx, req.UserID); err != nil {
|
|
||||||
// return nil, err
|
|
||||||
//}
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.S
|
|||||||
notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &resp, !req.IsReact, false)
|
notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &resp, !req.IsReact, false)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
isExists, err := m.MsgDatabase.JudgeMessageReactionEXISTS(ctx, req.ClientMsgID, req.SessionType)
|
isExists, err := m.MsgDatabase.JudgeMessageReactionExist(ctx, req.ClientMsgID, req.SessionType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.S
|
|||||||
if !isExists {
|
if !isExists {
|
||||||
if !req.IsReact {
|
if !req.IsReact {
|
||||||
resp.MsgFirstModifyTime = utils.GetCurrentTimestampByMill()
|
resp.MsgFirstModifyTime = utils.GetCurrentTimestampByMill()
|
||||||
for k, v := range req.ReactionExtensionList {
|
for k, v := range req.ReactionExtensions {
|
||||||
err := m.MessageLocker.LockMessageTypeKey(ctx, req.ClientMsgID, k)
|
err := m.MessageLocker.LockMessageTypeKey(ctx, req.ClientMsgID, k)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -60,10 +60,10 @@ func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.S
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
setValue := make(map[string]*sdkws.KeyValue)
|
setValue := make(map[string]*sdkws.KeyValue)
|
||||||
for k, v := range req.ReactionExtensionList {
|
for k, v := range req.ReactionExtensions {
|
||||||
|
|
||||||
temp := new(sdkws.KeyValue)
|
temp := new(sdkws.KeyValue)
|
||||||
if vv, ok := mongoValue.ReactionExtensionList[k]; ok {
|
if vv, ok := mongoValue.ReactionExtensions[k]; ok {
|
||||||
utils.CopyStructFields(temp, &vv)
|
utils.CopyStructFields(temp, &vv)
|
||||||
if v.LatestUpdateTime != vv.LatestUpdateTime {
|
if v.LatestUpdateTime != vv.LatestUpdateTime {
|
||||||
setKeyResultInfo(&resp, 300, "message have update", req.ClientMsgID, k, temp)
|
setKeyResultInfo(&resp, 300, "message have update", req.ClientMsgID, k, temp)
|
||||||
@ -165,7 +165,7 @@ func (m *msgServer) GetMessageListReactionExtensions(ctx context.Context, req *m
|
|||||||
var oneMessage msg.SingleMessageExtensionResult
|
var oneMessage msg.SingleMessageExtensionResult
|
||||||
oneMessage.ClientMsgID = messageValue.ClientMsgID
|
oneMessage.ClientMsgID = messageValue.ClientMsgID
|
||||||
|
|
||||||
isExists, err := db.DB.JudgeMessageReactionEXISTS(messageValue.ClientMsgID, req.SessionType)
|
isExists, err := db.DB.JudgeMessageReactionExist(messageValue.ClientMsgID, req.SessionType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rResp.ErrCode = 100
|
rResp.ErrCode = 100
|
||||||
rResp.ErrMsg = err.Error()
|
rResp.ErrMsg = err.Error()
|
||||||
@ -220,7 +220,7 @@ func (m *msgServer) AddMessageReactionExtensions(ctx context.Context, req *msg.M
|
|||||||
|
|
||||||
func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) {
|
func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) {
|
||||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String())
|
log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String())
|
||||||
var rResp msg.DeleteMessageListReactionExtensionsResp
|
var rResp msg.DeleteMessagesReactionExtensionsResp
|
||||||
callbackResp := notification.callbackDeleteMessageReactionExtensions(req)
|
callbackResp := notification.callbackDeleteMessageReactionExtensions(req)
|
||||||
if callbackResp.ActionCode != constant.ActionAllow || callbackResp.ErrCode != 0 {
|
if callbackResp.ActionCode != constant.ActionAllow || callbackResp.ErrCode != 0 {
|
||||||
rResp.ErrCode = int32(callbackResp.ErrCode)
|
rResp.ErrCode = int32(callbackResp.ErrCode)
|
||||||
@ -241,7 +241,7 @@ func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *ms
|
|||||||
return &rResp, nil
|
return &rResp, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
for _, v := range callbackResp.ResultReactionExtensionList {
|
for _, v := range callbackResp.ResultReactionExtensions {
|
||||||
if v.ErrCode != 0 {
|
if v.ErrCode != 0 {
|
||||||
func(req *[]*sdkws.KeyValue, typeKey string) {
|
func(req *[]*sdkws.KeyValue, typeKey string) {
|
||||||
for i := 0; i < len(*req); i++ {
|
for i := 0; i < len(*req); i++ {
|
||||||
@ -253,7 +253,7 @@ func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *ms
|
|||||||
rResp.Result = append(rResp.Result, v)
|
rResp.Result = append(rResp.Result, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isExists, err := db.DB.JudgeMessageReactionEXISTS(req.ClientMsgID, req.SessionType)
|
isExists, err := db.DB.JudgeMessageReactionExist(req.ClientMsgID, req.SessionType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rResp.ErrCode = 100
|
rResp.ErrCode = 100
|
||||||
rResp.ErrMsg = err.Error()
|
rResp.ErrMsg = err.Error()
|
||||||
|
@ -18,9 +18,9 @@ func CallbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMe
|
|||||||
OperationID: tracelog.GetOperationID(ctx),
|
OperationID: tracelog.GetOperationID(ctx),
|
||||||
CallbackCommand: constant.CallbackBeforeSetMessageReactionExtensionCommand,
|
CallbackCommand: constant.CallbackBeforeSetMessageReactionExtensionCommand,
|
||||||
SourceID: setReq.SourceID,
|
SourceID: setReq.SourceID,
|
||||||
OpUserID: setReq.OpUserID,
|
OpUserID: tracelog.GetOpUserID(ctx),
|
||||||
SessionType: setReq.SessionType,
|
SessionType: setReq.SessionType,
|
||||||
ReactionExtensionList: setReq.ReactionExtensionList,
|
ReactionExtensionList: setReq.ReactionExtensions,
|
||||||
ClientMsgID: setReq.ClientMsgID,
|
ClientMsgID: setReq.ClientMsgID,
|
||||||
IsReact: setReq.IsReact,
|
IsReact: setReq.IsReact,
|
||||||
IsExternalExtensions: setReq.IsExternalExtensions,
|
IsExternalExtensions: setReq.IsExternalExtensions,
|
||||||
@ -34,7 +34,7 @@ func CallbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMe
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReactionExtensionsReq) error {
|
func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessagesReactionExtensionsReq) error {
|
||||||
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
|
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReacti
|
|||||||
SourceID: setReq.SourceID,
|
SourceID: setReq.SourceID,
|
||||||
OpUserID: setReq.OpUserID,
|
OpUserID: setReq.OpUserID,
|
||||||
SessionType: setReq.SessionType,
|
SessionType: setReq.SessionType,
|
||||||
ReactionExtensionList: setReq.ReactionExtensionList,
|
ReactionExtensionList: setReq.ReactionExtensions,
|
||||||
ClientMsgID: setReq.ClientMsgID,
|
ClientMsgID: setReq.ClientMsgID,
|
||||||
IsExternalExtensions: setReq.IsExternalExtensions,
|
IsExternalExtensions: setReq.IsExternalExtensions,
|
||||||
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
|
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
|
||||||
@ -53,31 +53,31 @@ func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReacti
|
|||||||
return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
|
return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CallbackGetMessageListReactionExtensions(getReq *msg.GetMessageListReactionExtensionsReq) error {
|
func CallbackGetMessageListReactionExtensions(ctx context.Context, getReq *msg.GetMessagesReactionExtensionsReq) error {
|
||||||
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
|
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := &cbapi.CallbackGetMessageListReactionExtReq{
|
req := &cbapi.CallbackGetMessageListReactionExtReq{
|
||||||
OperationID: getReq.OperationID,
|
OperationID: tracelog.GetOperationID(ctx),
|
||||||
CallbackCommand: constant.CallbackGetMessageListReactionExtensionsCommand,
|
CallbackCommand: constant.CallbackGetMessageListReactionExtensionsCommand,
|
||||||
SourceID: getReq.SourceID,
|
SourceID: getReq.SourceID,
|
||||||
OpUserID: getReq.OpUserID,
|
OpUserID: tracelog.GetOperationID(ctx),
|
||||||
SessionType: getReq.SessionType,
|
SessionType: getReq.SessionType,
|
||||||
TypeKeyList: getReq.TypeKeyList,
|
TypeKeyList: getReq.TypeKeys,
|
||||||
MessageKeyList: getReq.MessageReactionKeyList,
|
MessageKeyList: getReq.MessageReactionKeys,
|
||||||
}
|
}
|
||||||
resp := &cbapi.CallbackGetMessageListReactionExtResp{}
|
resp := &cbapi.CallbackGetMessageListReactionExtResp{}
|
||||||
return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
|
return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CallbackAddMessageReactionExtensions(setReq *msg.ModifyMessageReactionExtensionsReq) error {
|
func CallbackAddMessageReactionExtensions(ctx context.Context, setReq *msg.ModifyMessageReactionExtensionsReq) error {
|
||||||
req := &cbapi.CallbackAddMessageReactionExtReq{
|
req := &cbapi.CallbackAddMessageReactionExtReq{
|
||||||
OperationID: setReq.OperationID,
|
OperationID: tracelog.GetOperationID(ctx),
|
||||||
CallbackCommand: constant.CallbackAddMessageListReactionExtensionsCommand,
|
CallbackCommand: constant.CallbackAddMessageListReactionExtensionsCommand,
|
||||||
SourceID: setReq.SourceID,
|
SourceID: setReq.SourceID,
|
||||||
OpUserID: setReq.OpUserID,
|
OpUserID: tracelog.GetOperationID(ctx),
|
||||||
SessionType: setReq.SessionType,
|
SessionType: setReq.SessionType,
|
||||||
ReactionExtensionList: setReq.ReactionExtensionList,
|
ReactionExtensionList: setReq.ReactionExtensions,
|
||||||
ClientMsgID: setReq.ClientMsgID,
|
ClientMsgID: setReq.ClientMsgID,
|
||||||
IsReact: setReq.IsReact,
|
IsReact: setReq.IsReact,
|
||||||
IsExternalExtensions: setReq.IsExternalExtensions,
|
IsExternalExtensions: setReq.IsExternalExtensions,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package msg
|
package msg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"OpenIM/pkg/common/db/cache"
|
||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -13,14 +14,16 @@ type MessageLocker interface {
|
|||||||
LockGlobalMessage(ctx context.Context, clientMsgID string) (err error)
|
LockGlobalMessage(ctx context.Context, clientMsgID string) (err error)
|
||||||
UnLockGlobalMessage(ctx context.Context, clientMsgID string) (err error)
|
UnLockGlobalMessage(ctx context.Context, clientMsgID string) (err error)
|
||||||
}
|
}
|
||||||
type LockerMessage struct{}
|
type LockerMessage struct {
|
||||||
|
cache cache.Model
|
||||||
func NewLockerMessage() *LockerMessage {
|
|
||||||
return &LockerMessage{}
|
|
||||||
}
|
}
|
||||||
func (l *LockerMessage) LockMessageTypeKey(clientMsgID, typeKey string) (err error) {
|
|
||||||
|
func NewLockerMessage(cache cache.Model) *LockerMessage {
|
||||||
|
return &LockerMessage{cache: cache}
|
||||||
|
}
|
||||||
|
func (l *LockerMessage) LockMessageTypeKey(ctx context.Context, clientMsgID, typeKey string) (err error) {
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
err = db.DB.LockMessageTypeKey(clientMsgID, typeKey)
|
err = l.cache.LockMessageTypeKey(ctx, clientMsgID, typeKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
time.Sleep(time.Millisecond * 100)
|
time.Sleep(time.Millisecond * 100)
|
||||||
continue
|
continue
|
||||||
@ -31,9 +34,9 @@ func (l *LockerMessage) LockMessageTypeKey(clientMsgID, typeKey string) (err err
|
|||||||
return err
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
func (l *LockerMessage) LockGlobalMessage(clientMsgID string) (err error) {
|
func (l *LockerMessage) LockGlobalMessage(ctx context.Context, clientMsgID string) (err error) {
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
err = db.DB.LockMessageTypeKey(clientMsgID, GlOBLLOCK)
|
err = l.cache.LockMessageTypeKey(ctx, clientMsgID, GlOBLLOCK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
time.Sleep(time.Millisecond * 100)
|
time.Sleep(time.Millisecond * 100)
|
||||||
continue
|
continue
|
||||||
@ -44,9 +47,9 @@ func (l *LockerMessage) LockGlobalMessage(clientMsgID string) (err error) {
|
|||||||
return err
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
func (l *LockerMessage) UnLockMessageTypeKey(clientMsgID string, typeKey string) error {
|
func (l *LockerMessage) UnLockMessageTypeKey(ctx context.Context, clientMsgID string, typeKey string) error {
|
||||||
return db.DB.UnLockMessageTypeKey(clientMsgID, typeKey)
|
return l.cache.UnLockMessageTypeKey(ctx, clientMsgID, typeKey)
|
||||||
}
|
}
|
||||||
func (l *LockerMessage) UnLockGlobalMessage(clientMsgID string) error {
|
func (l *LockerMessage) UnLockGlobalMessage(ctx context.Context, clientMsgID string) error {
|
||||||
return db.DB.UnLockMessageTypeKey(clientMsgID, GlOBLLOCK)
|
return l.cache.UnLockMessageTypeKey(ctx, clientMsgID, GlOBLLOCK)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@ package msg
|
|||||||
|
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
func DeleteMessageNotification(ctx context.Context, userID string, seqs []uint32) {
|
func DeleteMessageNotification(ctx context.Context, userID string, seqs []int64) {
|
||||||
panic("todo")
|
panic("todo")
|
||||||
}
|
}
|
||||||
|
@ -285,19 +285,19 @@ func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMin
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *msgServer) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) {
|
func (m *msgServer) PullMessageBySeqs(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) {
|
||||||
resp := &sdkws.PullMessageBySeqListResp{GroupMsgDataList: make(map[string]*sdkws.MsgDataList)}
|
resp := &sdkws.PullMessageBySeqsResp{GroupMsgDataList: make(map[string]*sdkws.MsgDataList)}
|
||||||
msgs, err := m.MsgDatabase.GetMsgBySeqs(ctx, req.UserID, req.Seqs)
|
msgs, err := m.MsgDatabase.GetMsgBySeqs(ctx, req.UserID, req.Seqs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp.List = msgs
|
resp.List = msgs
|
||||||
for userID, list := range req.GroupSeqList {
|
for groupID, list := range req.GroupSeqs {
|
||||||
msgs, err := m.MsgDatabase.GetMsgBySeqs(ctx, userID, req.Seqs)
|
msgs, err := m.MsgDatabase.GetSuperGroupMsgBySeqs(ctx, groupID, list.Seqs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp.GroupMsgDataList[userID] = &sdkws.MsgDataList{
|
resp.GroupMsgDataList[groupID] = &sdkws.MsgDataList{
|
||||||
MsgDataList: msgs,
|
MsgDataList: msgs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ package msg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/internal/common/check"
|
"OpenIM/internal/common/check"
|
||||||
|
"OpenIM/pkg/common/db/cache"
|
||||||
"OpenIM/pkg/common/db/controller"
|
"OpenIM/pkg/common/db/controller"
|
||||||
"OpenIM/pkg/common/db/localcache"
|
"OpenIM/pkg/common/db/localcache"
|
||||||
"OpenIM/pkg/common/db/relation"
|
"OpenIM/pkg/common/db/relation"
|
||||||
relationTb "OpenIM/pkg/common/db/table/relation"
|
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||||
|
"OpenIM/pkg/common/db/unrelation"
|
||||||
"OpenIM/pkg/common/prome"
|
"OpenIM/pkg/common/prome"
|
||||||
"OpenIM/pkg/discoveryregistry"
|
"OpenIM/pkg/discoveryregistry"
|
||||||
"OpenIM/pkg/proto/msg"
|
"OpenIM/pkg/proto/msg"
|
||||||
@ -13,34 +15,45 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type msgServer struct {
|
type msgServer struct {
|
||||||
RegisterCenter discoveryregistry.SvcDiscoveryRegistry
|
RegisterCenter discoveryregistry.SvcDiscoveryRegistry
|
||||||
MsgDatabase controller.MsgDatabase
|
MsgDatabase controller.MsgDatabase
|
||||||
Group *check.GroupChecker
|
ExtendMsgDatabase controller.ExtendMsgDatabase
|
||||||
User *check.UserCheck
|
Group *check.GroupChecker
|
||||||
Conversation *check.ConversationChecker
|
User *check.UserCheck
|
||||||
friend *check.FriendChecker
|
Conversation *check.ConversationChecker
|
||||||
|
friend *check.FriendChecker
|
||||||
*localcache.GroupLocalCache
|
*localcache.GroupLocalCache
|
||||||
black *check.BlackChecker
|
black *check.BlackChecker
|
||||||
MessageLocker MessageLocker
|
MessageLocker MessageLocker
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
mysql, err := relation.NewGormDB()
|
rdb, err := cache.NewRedis()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := mysql.AutoMigrate(&relationTb.UserModel{}); err != nil {
|
mongo, err := unrelation.NewMongo()
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cacheModel := cache.NewCacheModel(rdb)
|
||||||
|
msgDocModel := unrelation.NewMsgMongoDriver(mongo.GetDatabase())
|
||||||
|
extendMsgModel := unrelation.NewExtendMsgSetMongoDriver(mongo.GetDatabase())
|
||||||
|
|
||||||
|
extendMsgDatabase := controller.NewExtendMsgDatabase(extendMsgModel)
|
||||||
|
msgDatabase := controller.NewMsgDatabase(msgDocModel, cacheModel)
|
||||||
|
|
||||||
s := &msgServer{
|
s := &msgServer{
|
||||||
Conversation: check.NewConversationChecker(client),
|
Conversation: check.NewConversationChecker(client),
|
||||||
User: check.NewUserCheck(client),
|
User: check.NewUserCheck(client),
|
||||||
Group: check.NewGroupChecker(client),
|
Group: check.NewGroupChecker(client),
|
||||||
//MsgDatabase: controller.MsgDatabase(),
|
MsgDatabase: msgDatabase,
|
||||||
RegisterCenter: client,
|
ExtendMsgDatabase: extendMsgDatabase,
|
||||||
GroupLocalCache: localcache.NewGroupMemberIDsLocalCache(client),
|
RegisterCenter: client,
|
||||||
black: check.NewBlackChecker(client),
|
GroupLocalCache: localcache.NewGroupLocalCache(client),
|
||||||
friend: check.NewFriendChecker(client),
|
black: check.NewBlackChecker(client),
|
||||||
|
friend: check.NewFriendChecker(client),
|
||||||
}
|
}
|
||||||
s.initPrometheus()
|
s.initPrometheus()
|
||||||
msg.RegisterMsgServer(server, s)
|
msg.RegisterMsgServer(server, s)
|
||||||
|
@ -1 +1,28 @@
|
|||||||
package third
|
package third
|
||||||
|
|
||||||
|
import (
|
||||||
|
"OpenIM/pkg/proto/third"
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t *thirdServer) GetSignalInvitationInfo(ctx context.Context, req *third.GetSignalInvitationInfoReq) (resp *third.GetSignalInvitationInfoResp, err error) {
|
||||||
|
signalReq, err := t.thirdDatabase.GetSignalInvitationInfoByClientMsgID(ctx, req.ClientMsgID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp = &third.GetSignalInvitationInfoResp{}
|
||||||
|
resp.InvitationInfo = signalReq.Invitation
|
||||||
|
resp.OfflinePushInfo = signalReq.OfflinePushInfo
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *thirdServer) GetSignalInvitationInfoStartApp(ctx context.Context, req *third.GetSignalInvitationInfoStartAppReq) (resp *third.GetSignalInvitationInfoStartAppResp, err error) {
|
||||||
|
signalReq, err := t.thirdDatabase.GetAvailableSignalInvitationInfo(ctx, req.UserID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp = &third.GetSignalInvitationInfoStartAppResp{}
|
||||||
|
resp.InvitationInfo = signalReq.Invitation
|
||||||
|
resp.OfflinePushInfo = signalReq.OfflinePushInfo
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
@ -19,7 +19,7 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
third.RegisterThirdServer(server, &thirdServer{
|
third.RegisterThirdServer(server, &thirdServer{
|
||||||
thirdDatabase: controller.NewThirdDatabase(cache.NewCache(rdb)),
|
thirdDatabase: controller.NewThirdDatabase(cache.NewCacheModel(rdb)),
|
||||||
userCheck: check.NewUserCheck(client),
|
userCheck: check.NewUserCheck(client),
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
@ -34,28 +34,6 @@ func (t *thirdServer) ApplySpace(ctx context.Context, req *third.ApplySpaceReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *thirdServer) GetSignalInvitationInfo(ctx context.Context, req *third.GetSignalInvitationInfoReq) (resp *third.GetSignalInvitationInfoResp, err error) {
|
|
||||||
signalReq, err := t.thirdDatabase.GetSignalInvitationInfoByClientMsgID(ctx, req.ClientMsgID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
resp = &third.GetSignalInvitationInfoResp{}
|
|
||||||
resp.InvitationInfo = signalReq.Invitation
|
|
||||||
resp.OfflinePushInfo = signalReq.OfflinePushInfo
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *thirdServer) GetSignalInvitationInfoStartApp(ctx context.Context, req *third.GetSignalInvitationInfoStartAppReq) (resp *third.GetSignalInvitationInfoStartAppResp, err error) {
|
|
||||||
signalReq, err := t.thirdDatabase.GetAvailableSignalInvitationInfo(ctx, req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
resp = &third.GetSignalInvitationInfoStartAppResp{}
|
|
||||||
resp.InvitationInfo = signalReq.Invitation
|
|
||||||
resp.OfflinePushInfo = signalReq.OfflinePushInfo
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *thirdServer) FcmUpdateToken(ctx context.Context, req *third.FcmUpdateTokenReq) (resp *third.FcmUpdateTokenResp, err error) {
|
func (t *thirdServer) FcmUpdateToken(ctx context.Context, req *third.FcmUpdateTokenReq) (resp *third.FcmUpdateTokenResp, err error) {
|
||||||
err = t.thirdDatabase.FcmUpdateToken(ctx, req.Account, int(req.PlatformID), req.FcmToken, req.ExpireTime)
|
err = t.thirdDatabase.FcmUpdateToken(ctx, req.Account, int(req.PlatformID), req.FcmToken, req.ExpireTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
pbuser "OpenIM/pkg/proto/user"
|
pbuser "OpenIM/pkg/proto/user"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/openKeeper"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,11 +29,11 @@ type userServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
gormDB, err := relation.NewGormDB()
|
db, err := relation.NewGormDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := gormDB.AutoMigrate(&tablerelation.UserModel{}); err != nil {
|
if err := db.AutoMigrate(&tablerelation.UserModel{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
users := make([]*tablerelation.UserModel, 0)
|
users := make([]*tablerelation.UserModel, 0)
|
||||||
@ -45,14 +44,13 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
|||||||
users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k]})
|
users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k]})
|
||||||
}
|
}
|
||||||
u := &userServer{
|
u := &userServer{
|
||||||
UserDatabase: controller.NewUserDatabase(relation.NewUserGorm(gormDB)),
|
UserDatabase: controller.NewUserDatabase(relation.NewUserGorm(db)),
|
||||||
notification: notification.NewCheck(client),
|
notification: notification.NewCheck(client),
|
||||||
userCheck: check.NewUserCheck(client),
|
userCheck: check.NewUserCheck(client),
|
||||||
RegisterCenter: client,
|
RegisterCenter: client,
|
||||||
}
|
}
|
||||||
pbuser.RegisterUserServer(server, u)
|
pbuser.RegisterUserServer(server, u)
|
||||||
u.UserDatabase.InitOnce(context.Background(), users)
|
return u.UserDatabase.InitOnce(context.Background(), users)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok
|
// ok
|
||||||
|
@ -1,178 +0,0 @@
|
|||||||
package task
|
|
||||||
|
|
||||||
import (
|
|
||||||
"OpenIM/pkg/common/config"
|
|
||||||
"OpenIM/pkg/common/constant"
|
|
||||||
"OpenIM/pkg/common/db/controller"
|
|
||||||
"OpenIM/pkg/common/log"
|
|
||||||
"OpenIM/pkg/common/tracelog"
|
|
||||||
"OpenIM/pkg/utils"
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/go-redis/redis/v8"
|
|
||||||
"math"
|
|
||||||
)
|
|
||||||
|
|
||||||
type msgTool struct {
|
|
||||||
msgInterface controller.MsgDatabase
|
|
||||||
userInterface controller.UserDatabase
|
|
||||||
groupDatabase controller.GroupDatabase
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) getCronTaskOperationID() string {
|
|
||||||
return cronTaskOperationID + utils.OperationIDGenerator()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) ClearMsgAndFixSeq() {
|
|
||||||
operationID := c.getCronTaskOperationID()
|
|
||||||
ctx := context.Background()
|
|
||||||
tracelog.SetOperationID(ctx, operationID)
|
|
||||||
log.NewInfo(operationID, "============================ start del cron task ============================")
|
|
||||||
var err error
|
|
||||||
userIDList, err := c.userInterface.GetAllUserID(ctx)
|
|
||||||
if err == nil {
|
|
||||||
c.ClearUsersMsg(ctx, userIDList)
|
|
||||||
} else {
|
|
||||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
|
||||||
}
|
|
||||||
// working group msg clear
|
|
||||||
superGroupIDList, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
|
|
||||||
if err == nil {
|
|
||||||
c.ClearSuperGroupMsg(ctx, superGroupIDList)
|
|
||||||
} else {
|
|
||||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
|
||||||
}
|
|
||||||
log.NewInfo(operationID, "============================ start del cron finished ============================")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) ClearUsersMsg(ctx context.Context, userIDs []string) {
|
|
||||||
for _, userID := range userIDs {
|
|
||||||
if err := c.msgInterface.DeleteUserMsgsAndSetMinSeq(ctx, userID, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), userID)
|
|
||||||
}
|
|
||||||
_, maxSeqMongo, minSeqCache, maxSeqCache, err := c.msgInterface.GetUserMinMaxSeqInMongoAndCache(ctx, userID)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", userID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
c.FixUserSeq(ctx, userID, minSeqCache, maxSeqCache)
|
|
||||||
c.CheckMaxSeqWithMongo(ctx, userID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) ClearSuperGroupMsg(ctx context.Context, superGroupIDs []string) {
|
|
||||||
for _, groupID := range superGroupIDs {
|
|
||||||
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), "FindGroupMemberUserID", err.Error(), groupID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if err := c.msgInterface.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, groupID, userIDs, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "DeleteUserSuperGroupMsgsAndSetMinSeq failed", groupID, userIDs, config.Config.Mongo.DBRetainChatRecords)
|
|
||||||
}
|
|
||||||
_, maxSeqMongo, maxSeqCache, err := c.msgInterface.GetSuperGroupMinMaxSeqInMongoAndCache(ctx, groupID)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", groupID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, userID := range userIDs {
|
|
||||||
minSeqCache, err := c.msgInterface.GetGroupUserMinSeq(ctx, groupID, userID)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), "GetGroupUserMinSeq failed", groupID, userID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
c.FixGroupUserSeq(ctx, userID, groupID, minSeqCache, maxSeqCache)
|
|
||||||
|
|
||||||
}
|
|
||||||
c.CheckMaxSeqWithMongo(ctx, groupID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) FixUserSeq(ctx context.Context, userID string, minSeqCache, maxSeqCache int64) {
|
|
||||||
if minSeqCache > maxSeqCache {
|
|
||||||
if err := c.msgInterface.SetUserMinSeq(ctx, userID, maxSeqCache); err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), "SetUserMinSeq failed", userID, minSeqCache, maxSeqCache)
|
|
||||||
} else {
|
|
||||||
log.NewWarn(tracelog.GetOperationID(ctx), "SetUserMinSeq success", userID, minSeqCache, maxSeqCache)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) FixGroupUserSeq(ctx context.Context, userID string, groupID string, minSeqCache, maxSeqCache int64) {
|
|
||||||
if minSeqCache > maxSeqCache {
|
|
||||||
if err := c.msgInterface.SetGroupUserMinSeq(ctx, groupID, userID, maxSeqCache); err != nil {
|
|
||||||
log.NewError(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq failed", userID, minSeqCache, maxSeqCache)
|
|
||||||
} else {
|
|
||||||
log.NewWarn(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq success", userID, minSeqCache, maxSeqCache)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) CheckMaxSeqWithMongo(ctx context.Context, sourceID string, maxSeqCache, maxSeqMongo int64, diffusionType int) {
|
|
||||||
if math.Abs(float64(maxSeqMongo-maxSeqCache)) > 10 {
|
|
||||||
log.NewWarn(tracelog.GetOperationID(ctx), "cache max seq and mongo max seq is diff > 10", sourceID, maxSeqCache, maxSeqMongo, diffusionType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) ShowUserSeqs(ctx context.Context, userID string) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) ShowSuperGroupSeqs(ctx context.Context, groupID string) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *msgTool) FixAllSeq(ctx context.Context) {
|
|
||||||
userIDs, err := c.userInterface.GetAllUserID(ctx)
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
for _, userID := range userIDs {
|
|
||||||
userCurrentMinSeq, err := c.msgInterface.GetUserMinSeq(ctx, userID)
|
|
||||||
if err != nil && err != redis.Nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
userCurrentMaxSeq, err := c.msgInterface.GetUserMaxSeq(ctx, userID)
|
|
||||||
if err != nil && err != redis.Nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if userCurrentMinSeq > userCurrentMaxSeq {
|
|
||||||
if err = c.msgInterface.SetUserMinSeq(ctx, userID, userCurrentMaxSeq); err != nil {
|
|
||||||
fmt.Println("SetUserMinSeq failed", userID, userCurrentMaxSeq)
|
|
||||||
}
|
|
||||||
fmt.Println("fix", userID, userCurrentMaxSeq)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Println("fix users seq success")
|
|
||||||
|
|
||||||
groupIDs, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
for _, groupID := range groupIDs {
|
|
||||||
maxSeq, err := c.msgInterface.GetGroupMaxSeq(ctx, groupID)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("GetGroupMaxSeq failed", groupID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("get groupID", groupID, "failed, try again later")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, userID := range userIDs {
|
|
||||||
userMinSeq, err := c.msgInterface.GetGroupUserMinSeq(ctx, groupID, userID)
|
|
||||||
if err != nil && err != redis.Nil {
|
|
||||||
fmt.Println("GetGroupUserMinSeq failed", groupID, userID)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if userMinSeq > maxSeq {
|
|
||||||
if err = c.msgInterface.SetGroupUserMinSeq(ctx, groupID, userID, maxSeq); err != nil {
|
|
||||||
fmt.Println("SetGroupUserMinSeq failed", err.Error(), groupID, userID, maxSeq)
|
|
||||||
}
|
|
||||||
fmt.Println("fix", groupID, userID, maxSeq, userMinSeq)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmt.Println("fix all seq finished")
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package task
|
|
||||||
|
|
||||||
import (
|
|
||||||
"OpenIM/pkg/common/config"
|
|
||||||
"OpenIM/pkg/common/log"
|
|
||||||
"OpenIM/pkg/common/tracelog"
|
|
||||||
"OpenIM/pkg/utils"
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
const cronTaskOperationID = "cronTaskOperationID-"
|
|
||||||
const moduleName = "cron"
|
|
||||||
|
|
||||||
func StartCronTask() error {
|
|
||||||
log.NewPrivateLog(moduleName)
|
|
||||||
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
|
|
||||||
fmt.Println("cron task start, config", config.Config.Mongo.ChatRecordsClearTime)
|
|
||||||
clearCronTask := msgTool{}
|
|
||||||
ctx := context.Background()
|
|
||||||
operationID := clearCronTask.getCronTaskOperationID()
|
|
||||||
tracelog.SetOperationID(ctx, operationID)
|
|
||||||
c := cron.New()
|
|
||||||
_, err := c.AddFunc(config.Config.Mongo.ChatRecordsClearTime, clearCronTask.ClearMsgAndFixSeq)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("start cron failed", err.Error(), config.Config.Mongo.ChatRecordsClearTime)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
c.Start()
|
|
||||||
fmt.Println("start cron task success")
|
|
||||||
for {
|
|
||||||
time.Sleep(10 * time.Second)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func FixSeq(userID, superGroupID string, fixAllSeq bool) {
|
|
||||||
log.NewPrivateLog(moduleName)
|
|
||||||
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
|
|
||||||
clearCronTask := msgTool{}
|
|
||||||
ctx := context.Background()
|
|
||||||
operationID := clearCronTask.getCronTaskOperationID()
|
|
||||||
tracelog.SetOperationID(ctx, operationID)
|
|
||||||
if userID != "" {
|
|
||||||
clearCronTask.ClearUsersMsg(ctx, []string{userID})
|
|
||||||
}
|
|
||||||
if superGroupID != "" {
|
|
||||||
clearCronTask.ClearSuperGroupMsg(ctx, []string{superGroupID})
|
|
||||||
}
|
|
||||||
if fixAllSeq {
|
|
||||||
clearCronTask.FixAllSeq(ctx)
|
|
||||||
}
|
|
||||||
fmt.Println("fix seq finished")
|
|
||||||
}
|
|
39
internal/tools/cron_task.go
Normal file
39
internal/tools/cron_task.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/log"
|
||||||
|
"OpenIM/pkg/common/tracelog"
|
||||||
|
"OpenIM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"github.com/robfig/cron/v3"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const cronTaskOperationID = "cronTaskOperationID-"
|
||||||
|
const moduleName = "cron"
|
||||||
|
|
||||||
|
func StartCronTask() error {
|
||||||
|
log.NewPrivateLog(moduleName)
|
||||||
|
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
|
||||||
|
fmt.Println("cron task start, config", config.Config.Mongo.ChatRecordsClearTime)
|
||||||
|
msgTool, err := InitMsgTool()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ctx := context.Background()
|
||||||
|
operationID := msgTool.getCronTaskOperationID()
|
||||||
|
tracelog.SetOperationID(ctx, operationID)
|
||||||
|
c := cron.New()
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
wg.Add(1)
|
||||||
|
_, err = c.AddFunc(config.Config.Mongo.ChatRecordsClearTime, msgTool.AllUserClearMsgAndFixSeq)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("start cron failed", err.Error(), config.Config.Mongo.ChatRecordsClearTime)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
c.Start()
|
||||||
|
wg.Wait()
|
||||||
|
return nil
|
||||||
|
}
|
235
internal/tools/msg.go
Normal file
235
internal/tools/msg.go
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/constant"
|
||||||
|
"OpenIM/pkg/common/db/cache"
|
||||||
|
"OpenIM/pkg/common/db/controller"
|
||||||
|
"OpenIM/pkg/common/db/relation"
|
||||||
|
"OpenIM/pkg/common/db/unrelation"
|
||||||
|
"OpenIM/pkg/common/log"
|
||||||
|
"OpenIM/pkg/common/tracelog"
|
||||||
|
"OpenIM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"github.com/go-redis/redis/v8"
|
||||||
|
"math"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MsgTool struct {
|
||||||
|
msgDatabase controller.MsgDatabase
|
||||||
|
userDatabase controller.UserDatabase
|
||||||
|
groupDatabase controller.GroupDatabase
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMsgTool(msgDatabase controller.MsgDatabase, userDatabase controller.UserDatabase, groupDatabase controller.GroupDatabase) *MsgTool {
|
||||||
|
return &MsgTool{
|
||||||
|
msgDatabase: msgDatabase,
|
||||||
|
userDatabase: userDatabase,
|
||||||
|
groupDatabase: groupDatabase,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitMsgTool() (*MsgTool, error) {
|
||||||
|
rdb, err := cache.NewRedis()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mongo, err := unrelation.NewMongo()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
db, err := relation.NewGormDB()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
msgDatabase := controller.InitMsgDatabase(rdb, mongo.GetDatabase())
|
||||||
|
userDatabase := controller.NewUserDatabase(relation.NewUserGorm(db))
|
||||||
|
groupDatabase := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase())
|
||||||
|
msgTool := NewMsgTool(msgDatabase, userDatabase, groupDatabase)
|
||||||
|
return msgTool, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) getCronTaskOperationID() string {
|
||||||
|
return cronTaskOperationID + utils.OperationIDGenerator()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) AllUserClearMsgAndFixSeq() {
|
||||||
|
operationID := c.getCronTaskOperationID()
|
||||||
|
ctx := context.Background()
|
||||||
|
tracelog.SetOperationID(ctx, operationID)
|
||||||
|
log.NewInfo(operationID, "============================ start del cron task ============================")
|
||||||
|
var err error
|
||||||
|
userIDList, err := c.userDatabase.GetAllUserID(ctx)
|
||||||
|
if err == nil {
|
||||||
|
c.ClearUsersMsg(ctx, userIDList)
|
||||||
|
} else {
|
||||||
|
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||||
|
}
|
||||||
|
// working group msg clear
|
||||||
|
superGroupIDList, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
|
||||||
|
if err == nil {
|
||||||
|
c.ClearSuperGroupMsg(ctx, superGroupIDList)
|
||||||
|
} else {
|
||||||
|
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||||
|
}
|
||||||
|
log.NewInfo(operationID, "============================ start del cron finished ============================")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) ClearUsersMsg(ctx context.Context, userIDs []string) {
|
||||||
|
for _, userID := range userIDs {
|
||||||
|
if err := c.msgDatabase.DeleteUserMsgsAndSetMinSeq(ctx, userID, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), userID)
|
||||||
|
}
|
||||||
|
maxSeqCache, maxSeqMongo, err := c.GetAndFixUserSeqs(ctx, userID)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
c.CheckMaxSeqWithMongo(ctx, userID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) ClearSuperGroupMsg(ctx context.Context, superGroupIDs []string) {
|
||||||
|
for _, groupID := range superGroupIDs {
|
||||||
|
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), "FindGroupMemberUserID", err.Error(), groupID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := c.msgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, groupID, userIDs, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "DeleteUserSuperGroupMsgsAndSetMinSeq failed", groupID, userIDs, config.Config.Mongo.DBRetainChatRecords)
|
||||||
|
}
|
||||||
|
if err := c.fixGroupSeq(ctx, groupID, userIDs); err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), groupID, userIDs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) FixGroupSeq(ctx context.Context, groupID string) error {
|
||||||
|
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return c.fixGroupSeq(ctx, groupID, userIDs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) fixGroupSeq(ctx context.Context, groupID string, userIDs []string) error {
|
||||||
|
_, maxSeqMongo, maxSeqCache, err := c.msgDatabase.GetSuperGroupMinMaxSeqInMongoAndCache(ctx, groupID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", groupID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, userID := range userIDs {
|
||||||
|
if _, err := c.GetAndFixGroupUserSeq(ctx, userID, groupID, maxSeqCache); err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), "GetAndFixGroupUserSeq failed", groupID, userID, maxSeqCache)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.CheckMaxSeqWithMongo(ctx, groupID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) GetAndFixUserSeqs(ctx context.Context, userID string) (maxSeqCache, maxSeqMongo int64, err error) {
|
||||||
|
_, maxSeqMongo, minSeqCache, maxSeqCache, err := c.msgDatabase.GetUserMinMaxSeqInMongoAndCache(ctx, userID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", userID)
|
||||||
|
return 0, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if minSeqCache > maxSeqCache {
|
||||||
|
if err := c.msgDatabase.SetUserMinSeq(ctx, userID, maxSeqCache); err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), "SetUserMinSeq failed", userID, minSeqCache, maxSeqCache)
|
||||||
|
} else {
|
||||||
|
log.NewWarn(tracelog.GetOperationID(ctx), "SetUserMinSeq success", userID, minSeqCache, maxSeqCache)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxSeqCache, maxSeqMongo, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) GetAndFixGroupUserSeq(ctx context.Context, userID string, groupID string, maxSeqCache int64) (minSeqCache int64, err error) {
|
||||||
|
minSeqCache, err = c.msgDatabase.GetGroupUserMinSeq(ctx, groupID, userID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), "GetGroupUserMinSeq failed", groupID, userID)
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if minSeqCache > maxSeqCache {
|
||||||
|
if err := c.msgDatabase.SetGroupUserMinSeq(ctx, groupID, userID, maxSeqCache); err != nil {
|
||||||
|
log.NewError(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq failed", userID, minSeqCache, maxSeqCache)
|
||||||
|
} else {
|
||||||
|
log.NewWarn(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq success", userID, minSeqCache, maxSeqCache)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return minSeqCache, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) CheckMaxSeqWithMongo(ctx context.Context, sourceID string, maxSeqCache, maxSeqMongo int64, diffusionType int) {
|
||||||
|
if math.Abs(float64(maxSeqMongo-maxSeqCache)) > 10 {
|
||||||
|
log.NewWarn(tracelog.GetOperationID(ctx), "cache max seq and mongo max seq is diff > 10", sourceID, maxSeqCache, maxSeqMongo, diffusionType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) ShowUserSeqs(ctx context.Context, userID string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) ShowSuperGroupSeqs(ctx context.Context, groupID string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) ShowSuperGroupUserSeqs(ctx context.Context, groupID, userID string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *MsgTool) FixAllSeq(ctx context.Context) {
|
||||||
|
userIDs, err := c.userDatabase.GetAllUserID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
for _, userID := range userIDs {
|
||||||
|
userCurrentMinSeq, err := c.msgDatabase.GetUserMinSeq(ctx, userID)
|
||||||
|
if err != nil && err != redis.Nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
userCurrentMaxSeq, err := c.msgDatabase.GetUserMaxSeq(ctx, userID)
|
||||||
|
if err != nil && err != redis.Nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if userCurrentMinSeq > userCurrentMaxSeq {
|
||||||
|
if err = c.msgDatabase.SetUserMinSeq(ctx, userID, userCurrentMaxSeq); err != nil {
|
||||||
|
fmt.Println("SetUserMinSeq failed", userID, userCurrentMaxSeq)
|
||||||
|
}
|
||||||
|
fmt.Println("fix", userID, userCurrentMaxSeq)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println("fix users seq success")
|
||||||
|
groupIDs, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
for _, groupID := range groupIDs {
|
||||||
|
maxSeq, err := c.msgDatabase.GetGroupMaxSeq(ctx, groupID)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("GetGroupMaxSeq failed", groupID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("get groupID", groupID, "failed, try again later")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, userID := range userIDs {
|
||||||
|
userMinSeq, err := c.msgDatabase.GetGroupUserMinSeq(ctx, groupID, userID)
|
||||||
|
if err != nil && err != redis.Nil {
|
||||||
|
fmt.Println("GetGroupUserMinSeq failed", groupID, userID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if userMinSeq > maxSeq {
|
||||||
|
if err = c.msgDatabase.SetGroupUserMinSeq(ctx, groupID, userID, maxSeq); err != nil {
|
||||||
|
fmt.Println("SetGroupUserMinSeq failed", err.Error(), groupID, userID, maxSeq)
|
||||||
|
}
|
||||||
|
fmt.Println("fix", groupID, userID, maxSeq, userMinSeq)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println("fix all seq finished")
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package task
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
@ -16,12 +16,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
func GenUserChat(startSeq, stopSeq, delSeq, index int64, userID string) *mongo2.UserChat {
|
||||||
redisClient *redis.Client
|
|
||||||
mongoClient *mongo.Collection
|
|
||||||
)
|
|
||||||
|
|
||||||
func GenUserChat(startSeq, stopSeq, delSeq, index uint32, userID string) *mongo2.UserChat {
|
|
||||||
chat := &mongo2.UserChat{UID: userID + strconv.Itoa(int(index))}
|
chat := &mongo2.UserChat{UID: userID + strconv.Itoa(int(index))}
|
||||||
for i := startSeq; i <= stopSeq; i++ {
|
for i := startSeq; i <= stopSeq; i++ {
|
||||||
msg := sdkws.MsgData{
|
msg := sdkws.MsgData{
|
||||||
@ -36,8 +31,8 @@ func GenUserChat(startSeq, stopSeq, delSeq, index uint32, userID string) *mongo2
|
|||||||
SessionType: 1,
|
SessionType: 1,
|
||||||
MsgFrom: 100,
|
MsgFrom: 100,
|
||||||
ContentType: 101,
|
ContentType: 101,
|
||||||
Content: []byte("testFaceURL"),
|
Content: []byte("testFaceURL.com"),
|
||||||
Seq: uint32(i),
|
Seq: i,
|
||||||
SendTime: time.Now().Unix(),
|
SendTime: time.Now().Unix(),
|
||||||
CreateTime: time.Now().Unix(),
|
CreateTime: time.Now().Unix(),
|
||||||
Status: 1,
|
Status: 1,
|
||||||
@ -89,15 +84,4 @@ func TestDeleteUserMsgsAndSetMinSeq(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("err is not nil", testUID1, err.Error())
|
t.Error("err is not nil", testUID1, err.Error())
|
||||||
}
|
}
|
||||||
// testWorkingGroupIDList := []string{"test_del_id1", "test_del_id2", "test_del_id3", "test_del_id4", "test_del_id5"}
|
|
||||||
// for _, groupID := range testWorkingGroupIDList {
|
|
||||||
// operationID = groupID + "-" + operationID
|
|
||||||
// log.NewDebug(operationID, utils.GetSelfFuncName(), "groupID:", groupID, "userIDList:", testUserIDList)
|
|
||||||
// if err := DeleteUserSuperGroupMsgsAndSetMinSeq(operationID, groupID, testUserIDList); err != nil {
|
|
||||||
// t.Error("checkMaxSeqWithMongo failed", groupID)
|
|
||||||
// }
|
|
||||||
// if err := checkMaxSeqWithMongo(operationID, groupID, constant.ReadDiffusion); err != nil {
|
|
||||||
// t.Error("checkMaxSeqWithMongo failed", groupID)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
@ -194,17 +194,6 @@ type config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Push struct {
|
Push struct {
|
||||||
Tpns struct {
|
|
||||||
Ios struct {
|
|
||||||
AccessID string `yaml:"accessID"`
|
|
||||||
SecretKey string `yaml:"secretKey"`
|
|
||||||
}
|
|
||||||
Android struct {
|
|
||||||
AccessID string `yaml:"accessID"`
|
|
||||||
SecretKey string `yaml:"secretKey"`
|
|
||||||
}
|
|
||||||
Enable bool `yaml:"enable"`
|
|
||||||
}
|
|
||||||
Jpns struct {
|
Jpns struct {
|
||||||
AppKey string `yaml:"appKey"`
|
AppKey string `yaml:"appKey"`
|
||||||
MasterSecret string `yaml:"masterSecret"`
|
MasterSecret string `yaml:"masterSecret"`
|
||||||
@ -215,7 +204,7 @@ type config struct {
|
|||||||
Getui struct {
|
Getui struct {
|
||||||
PushUrl string `yaml:"pushUrl"`
|
PushUrl string `yaml:"pushUrl"`
|
||||||
AppKey string `yaml:"appKey"`
|
AppKey string `yaml:"appKey"`
|
||||||
Enable *bool `yaml:"enable"`
|
Enable bool `yaml:"enable"`
|
||||||
Intent string `yaml:"intent"`
|
Intent string `yaml:"intent"`
|
||||||
MasterSecret string `yaml:"masterSecret"`
|
MasterSecret string `yaml:"masterSecret"`
|
||||||
ChannelID string `yaml:"channelID"`
|
ChannelID string `yaml:"channelID"`
|
||||||
@ -225,13 +214,6 @@ type config struct {
|
|||||||
ServiceAccount string `yaml:"serviceAccount"`
|
ServiceAccount string `yaml:"serviceAccount"`
|
||||||
Enable bool `yaml:"enable"`
|
Enable bool `yaml:"enable"`
|
||||||
}
|
}
|
||||||
Mob struct {
|
|
||||||
AppKey string `yaml:"appKey"`
|
|
||||||
PushUrl string `yaml:"pushUrl"`
|
|
||||||
Scheme string `yaml:"scheme"`
|
|
||||||
AppSecret string `yaml:"appSecret"`
|
|
||||||
Enable bool `yaml:"enable"`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Manager struct {
|
Manager struct {
|
||||||
AppManagerUid []string `yaml:"appManagerUid"`
|
AppManagerUid []string `yaml:"appManagerUid"`
|
||||||
|
@ -280,6 +280,9 @@ const (
|
|||||||
Female = 2
|
Female = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const OperationID = "operationID"
|
||||||
|
const OpUserID = "opUserID"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UnreliableNotification = 1
|
UnreliableNotification = 1
|
||||||
ReliableNotificationNoMsg = 2
|
ReliableNotificationNoMsg = 2
|
||||||
|
14
pkg/common/db/cache/redis.go
vendored
14
pkg/common/db/cache/redis.go
vendored
@ -37,7 +37,7 @@ const (
|
|||||||
uidPidToken = "UID_PID_TOKEN_STATUS:"
|
uidPidToken = "UID_PID_TOKEN_STATUS:"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cache interface {
|
type Model interface {
|
||||||
IncrUserSeq(ctx context.Context, userID string) (int64, error)
|
IncrUserSeq(ctx context.Context, userID string) (int64, error)
|
||||||
GetUserMaxSeq(ctx context.Context, userID string) (int64, error)
|
GetUserMaxSeq(ctx context.Context, userID string) (int64, error)
|
||||||
SetUserMaxSeq(ctx context.Context, userID string, maxSeq int64) error
|
SetUserMaxSeq(ctx context.Context, userID string, maxSeq int64) error
|
||||||
@ -75,7 +75,7 @@ type Cache interface {
|
|||||||
IncrUserBadgeUnreadCountSum(ctx context.Context, userID string) (int, error)
|
IncrUserBadgeUnreadCountSum(ctx context.Context, userID string) (int, error)
|
||||||
SetUserBadgeUnreadCountSum(ctx context.Context, userID string, value int) error
|
SetUserBadgeUnreadCountSum(ctx context.Context, userID string, value int) error
|
||||||
GetUserBadgeUnreadCountSum(ctx context.Context, userID string) (int, error)
|
GetUserBadgeUnreadCountSum(ctx context.Context, userID string) (int, error)
|
||||||
JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
|
JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
|
||||||
GetOneMessageAllReactionList(ctx context.Context, clientMsgID string, sessionType int32) (map[string]string, error)
|
GetOneMessageAllReactionList(ctx context.Context, clientMsgID string, sessionType int32) (map[string]string, error)
|
||||||
DeleteOneMessageKey(ctx context.Context, clientMsgID string, sessionType int32, subKey string) error
|
DeleteOneMessageKey(ctx context.Context, clientMsgID string, sessionType int32, subKey string) error
|
||||||
SetMessageReactionExpire(ctx context.Context, clientMsgID string, sessionType int32, expiration time.Duration) (bool, error)
|
SetMessageReactionExpire(ctx context.Context, clientMsgID string, sessionType int32, expiration time.Duration) (bool, error)
|
||||||
@ -85,7 +85,7 @@ type Cache interface {
|
|||||||
UnLockMessageTypeKey(ctx context.Context, clientMsgID string, TypeKey string) error
|
UnLockMessageTypeKey(ctx context.Context, clientMsgID string, TypeKey string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCache(client redis.UniversalClient) Cache {
|
func NewCacheModel(client redis.UniversalClient) Model {
|
||||||
return &cache{rdb: client}
|
return &cache{rdb: client}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ func (c *cache) GetMessagesBySeq(ctx context.Context, userID string, seqList []i
|
|||||||
|
|
||||||
func (c *cache) SetMessageToCache(ctx context.Context, userID string, msgList []*pbMsg.MsgDataToMQ) (int, error) {
|
func (c *cache) SetMessageToCache(ctx context.Context, userID string, msgList []*pbMsg.MsgDataToMQ) (int, error) {
|
||||||
pipe := c.rdb.Pipeline()
|
pipe := c.rdb.Pipeline()
|
||||||
var failedList []pbMsg.MsgDataToMQ
|
var failedMsgs []pbMsg.MsgDataToMQ
|
||||||
for _, msg := range msgList {
|
for _, msg := range msgList {
|
||||||
key := messageCache + userID + "_" + strconv.Itoa(int(msg.MsgData.Seq))
|
key := messageCache + userID + "_" + strconv.Itoa(int(msg.MsgData.Seq))
|
||||||
s, err := utils.Pb2String(msg.MsgData)
|
s, err := utils.Pb2String(msg.MsgData)
|
||||||
@ -217,8 +217,8 @@ func (c *cache) SetMessageToCache(ctx context.Context, userID string, msgList []
|
|||||||
return 0, utils.Wrap1(err)
|
return 0, utils.Wrap1(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(failedList) != 0 {
|
if len(failedMsgs) != 0 {
|
||||||
return len(failedList), errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, tracelog.GetOperationID(ctx)))
|
return len(failedMsgs), errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, tracelog.GetOperationID(ctx)))
|
||||||
}
|
}
|
||||||
_, err := pipe.Exec(ctx)
|
_, err := pipe.Exec(ctx)
|
||||||
return 0, err
|
return 0, err
|
||||||
@ -434,7 +434,7 @@ func (c *cache) getMessageReactionExPrefix(clientMsgID string, sessionType int32
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cache) JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
|
func (c *cache) JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
|
||||||
n, err := c.rdb.Exists(ctx, c.getMessageReactionExPrefix(clientMsgID, sessionType)).Result()
|
n, err := c.rdb.Exists(ctx, c.getMessageReactionExPrefix(clientMsgID, sessionType)).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, utils.Wrap(err, "")
|
return false, utils.Wrap(err, "")
|
||||||
|
@ -17,13 +17,13 @@ type AuthDatabase interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type authDatabase struct {
|
type authDatabase struct {
|
||||||
cache cache.Cache
|
cache cache.Model
|
||||||
|
|
||||||
accessSecret string
|
accessSecret string
|
||||||
accessExpire int64
|
accessExpire int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAuthDatabase(cache cache.Cache, accessSecret string, accessExpire int64) AuthDatabase {
|
func NewAuthDatabase(cache cache.Model, accessSecret string, accessExpire int64) AuthDatabase {
|
||||||
return &authDatabase{cache: cache, accessSecret: accessSecret, accessExpire: accessExpire}
|
return &authDatabase{cache: cache, accessSecret: accessSecret, accessExpire: accessExpire}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
||||||
"OpenIM/pkg/proto/sdkws"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,42 +10,42 @@ type ExtendMsgDatabase interface {
|
|||||||
GetAllExtendMsgSet(ctx context.Context, ID string, opts *unRelationTb.GetAllExtendMsgSetOpts) (sets []*unRelationTb.ExtendMsgSetModel, err error)
|
GetAllExtendMsgSet(ctx context.Context, ID string, opts *unRelationTb.GetAllExtendMsgSetOpts) (sets []*unRelationTb.ExtendMsgSetModel, err error)
|
||||||
GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*unRelationTb.ExtendMsgSetModel, error)
|
GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*unRelationTb.ExtendMsgSetModel, error)
|
||||||
InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *unRelationTb.ExtendMsgModel) error
|
InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *unRelationTb.ExtendMsgModel) error
|
||||||
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
|
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error
|
||||||
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
|
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error
|
||||||
GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error)
|
GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type extendMsgDatabase struct {
|
type extendMsgDatabase struct {
|
||||||
db unRelationTb.ExtendMsgSetModelInterface
|
database unRelationTb.ExtendMsgSetModelInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewExtendMsgDatabase() ExtendMsgDatabase {
|
func NewExtendMsgDatabase(extendMsgModel unRelationTb.ExtendMsgSetModelInterface) ExtendMsgDatabase {
|
||||||
return &extendMsgDatabase{}
|
return &extendMsgDatabase{database: extendMsgModel}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *extendMsgDatabase) CreateExtendMsgSet(ctx context.Context, set *unRelationTb.ExtendMsgSetModel) error {
|
func (e *extendMsgDatabase) CreateExtendMsgSet(ctx context.Context, set *unRelationTb.ExtendMsgSetModel) error {
|
||||||
return e.db.CreateExtendMsgSet(ctx, set)
|
return e.database.CreateExtendMsgSet(ctx, set)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *extendMsgDatabase) GetAllExtendMsgSet(ctx context.Context, sourceID string, opts *unRelationTb.GetAllExtendMsgSetOpts) (sets []*unRelationTb.ExtendMsgSetModel, err error) {
|
func (e *extendMsgDatabase) GetAllExtendMsgSet(ctx context.Context, sourceID string, opts *unRelationTb.GetAllExtendMsgSetOpts) (sets []*unRelationTb.ExtendMsgSetModel, err error) {
|
||||||
return e.db.GetAllExtendMsgSet(ctx, sourceID, opts)
|
return e.database.GetAllExtendMsgSet(ctx, sourceID, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *extendMsgDatabase) GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*unRelationTb.ExtendMsgSetModel, error) {
|
func (e *extendMsgDatabase) GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*unRelationTb.ExtendMsgSetModel, error) {
|
||||||
return e.db.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
|
return e.database.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *extendMsgDatabase) InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *unRelationTb.ExtendMsgModel) error {
|
func (e *extendMsgDatabase) InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *unRelationTb.ExtendMsgModel) error {
|
||||||
return e.db.InsertExtendMsg(ctx, sourceID, sessionType, msg)
|
return e.database.InsertExtendMsg(ctx, sourceID, sessionType, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *extendMsgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
|
func (e *extendMsgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
|
||||||
return e.db.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
|
return e.database.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
|
||||||
}
|
}
|
||||||
func (e *extendMsgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
|
func (e *extendMsgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
|
||||||
return e.db.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
|
return e.database.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *extendMsgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
|
func (e *extendMsgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
|
||||||
return e.db.TakeExtendMsg(ctx, sourceID, sessionType, clientMsgID, maxMsgUpdateTime)
|
return e.database.TakeExtendMsg(ctx, sourceID, sessionType, clientMsgID, maxMsgUpdateTime)
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,19 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
|
"OpenIM/pkg/common/db/relation"
|
||||||
relationTb "OpenIM/pkg/common/db/table/relation"
|
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||||
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
||||||
"OpenIM/pkg/common/db/tx"
|
"OpenIM/pkg/common/db/tx"
|
||||||
|
"OpenIM/pkg/common/db/unrelation"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dtm-labs/rockscache"
|
||||||
_ "github.com/dtm-labs/rockscache"
|
_ "github.com/dtm-labs/rockscache"
|
||||||
|
"github.com/go-redis/redis/v8"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GroupDatabase interface {
|
type GroupDatabase interface {
|
||||||
@ -69,6 +75,21 @@ func NewGroupDatabase(
|
|||||||
return database
|
return database
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func InitGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, database *mongo.Database) GroupDatabase {
|
||||||
|
return NewGroupDatabase(
|
||||||
|
relation.NewGroupDB(db),
|
||||||
|
relation.NewGroupMemberDB(db),
|
||||||
|
relation.NewGroupRequest(db),
|
||||||
|
tx.NewGorm(db),
|
||||||
|
tx.NewMongo(database.Client()),
|
||||||
|
unrelation.NewSuperGroupMongoDriver(database),
|
||||||
|
cache.NewGroupCacheRedis(rdb, relation.NewGroupDB(db), relation.NewGroupMemberDB(db), relation.NewGroupRequest(db), unrelation.NewSuperGroupMongoDriver(database), rockscache.Options{
|
||||||
|
StrongConsistency: true,
|
||||||
|
RandomExpireAdjustment: 2.0,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
type groupDatabase struct {
|
type groupDatabase struct {
|
||||||
groupDB relationTb.GroupModelInterface
|
groupDB relationTb.GroupModelInterface
|
||||||
groupMemberDB relationTb.GroupMemberModelInterface
|
groupMemberDB relationTb.GroupMemberModelInterface
|
||||||
|
@ -3,6 +3,8 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/constant"
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/common/db/cache"
|
"OpenIM/pkg/common/db/cache"
|
||||||
|
"OpenIM/pkg/common/db/relation"
|
||||||
|
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||||
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
||||||
"OpenIM/pkg/common/db/unrelation"
|
"OpenIM/pkg/common/db/unrelation"
|
||||||
"OpenIM/pkg/common/log"
|
"OpenIM/pkg/common/log"
|
||||||
@ -10,6 +12,7 @@ import (
|
|||||||
"OpenIM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gogo/protobuf/sortkeys"
|
"github.com/gogo/protobuf/sortkeys"
|
||||||
|
"gorm.io/gorm"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -55,7 +58,7 @@ type MsgDatabase interface {
|
|||||||
// 设置用户最小seq 直接调用cache
|
// 设置用户最小seq 直接调用cache
|
||||||
SetUserMinSeq(ctx context.Context, userID string, minSeq int64) (err error)
|
SetUserMinSeq(ctx context.Context, userID string, minSeq int64) (err error)
|
||||||
|
|
||||||
JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
|
JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
|
||||||
|
|
||||||
SetMessageTypeKeyValue(ctx context.Context, clientMsgID string, sessionType int32, typeKey, value string) error
|
SetMessageTypeKeyValue(ctx context.Context, clientMsgID string, sessionType int32, typeKey, value string) error
|
||||||
|
|
||||||
@ -75,22 +78,31 @@ type MsgDatabase interface {
|
|||||||
GetGroupMinSeq(ctx context.Context, groupID string) (int64, error)
|
GetGroupMinSeq(ctx context.Context, groupID string) (int64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMsgDatabase(mgo *mongo.Client, rdb redis.UniversalClient) MsgDatabase {
|
func NewMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheModel cache.Model) MsgDatabase {
|
||||||
return &msgDatabase{}
|
return &msgDatabase{
|
||||||
|
msgDocModel: msgDocModel,
|
||||||
|
cache: cacheModel,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitMsgDatabase(rdb redis.UniversalClient, database *mongo.Database) MsgDatabase {
|
||||||
|
cacheModel := cache.NewCacheModel(rdb)
|
||||||
|
msgDocModel := unrelation.NewMsgMongoDriver(database)
|
||||||
|
msgDatabase := NewMsgDatabase(msgDocModel, cacheModel)
|
||||||
|
return msgDatabase
|
||||||
}
|
}
|
||||||
|
|
||||||
type msgDatabase struct {
|
type msgDatabase struct {
|
||||||
mgo unRelationTb.MsgDocModelInterface
|
msgDocModel unRelationTb.MsgDocModelInterface
|
||||||
cache cache.Cache
|
cache cache.Model
|
||||||
msg unRelationTb.MsgDocModel
|
msg unRelationTb.MsgDocModel
|
||||||
ExtendMsg unRelationTb.ExtendMsgSetModelInterface
|
extendMsgModel unRelationTb.ExtendMsgSetModelInterface
|
||||||
rdb redis.Client
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) reactionExtensionList(reactionExtensionList map[string]*sdkws.KeyValue) map[string]unRelationTb.KeyValueModel {
|
func (db *msgDatabase) reactionExtensionList(reactionExtensionList map[string]*sdkws.KeyValue) map[string]*unRelationTb.KeyValueModel {
|
||||||
r := make(map[string]unRelationTb.KeyValueModel)
|
r := make(map[string]*unRelationTb.KeyValueModel)
|
||||||
for key, value := range reactionExtensionList {
|
for key, value := range reactionExtensionList {
|
||||||
r[key] = unRelationTb.KeyValueModel{
|
r[key] = &unRelationTb.KeyValueModel{
|
||||||
TypeKey: value.TypeKey,
|
TypeKey: value.TypeKey,
|
||||||
Value: value.Value,
|
Value: value.Value,
|
||||||
LatestUpdateTime: value.LatestUpdateTime,
|
LatestUpdateTime: value.LatestUpdateTime,
|
||||||
@ -99,8 +111,8 @@ func (db *msgDatabase) reactionExtensionList(reactionExtensionList map[string]*s
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
|
func (db *msgDatabase) JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
|
||||||
return db.cache.JudgeMessageReactionEXISTS(ctx, clientMsgID, sessionType)
|
return db.cache.JudgeMessageReactionExist(ctx, clientMsgID, sessionType)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) SetMessageTypeKeyValue(ctx context.Context, clientMsgID string, sessionType int32, typeKey, value string) error {
|
func (db *msgDatabase) SetMessageTypeKeyValue(ctx context.Context, clientMsgID string, sessionType int32, typeKey, value string) error {
|
||||||
@ -123,12 +135,12 @@ func (db *msgDatabase) DeleteOneMessageKey(ctx context.Context, clientMsgID stri
|
|||||||
return db.cache.DeleteOneMessageKey(ctx, clientMsgID, sessionType, subKey)
|
return db.cache.DeleteOneMessageKey(ctx, clientMsgID, sessionType, subKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
|
func (db *msgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensions map[string]*sdkws.KeyValue) error {
|
||||||
return db.ExtendMsg.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensionList))
|
return db.extendMsgModel.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensions))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (*pbMsg.ExtendMsg, error) {
|
func (db *msgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (*pbMsg.ExtendMsg, error) {
|
||||||
extendMsgSet, err := db.ExtendMsg.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
|
extendMsgSet, err := db.extendMsgModel.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -147,16 +159,16 @@ func (db *msgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &pbMsg.ExtendMsg{
|
return &pbMsg.ExtendMsg{
|
||||||
ReactionExtensionList: reactionExtensionList,
|
ReactionExtensions: reactionExtensionList,
|
||||||
ClientMsgID: extendMsg.ClientMsgID,
|
ClientMsgID: extendMsg.ClientMsgID,
|
||||||
MsgFirstModifyTime: extendMsg.MsgFirstModifyTime,
|
MsgFirstModifyTime: extendMsg.MsgFirstModifyTime,
|
||||||
AttachedInfo: extendMsg.AttachedInfo,
|
AttachedInfo: extendMsg.AttachedInfo,
|
||||||
Ex: extendMsg.Ex,
|
Ex: extendMsg.Ex,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
|
func (db *msgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensions map[string]*sdkws.KeyValue) error {
|
||||||
return db.ExtendMsg.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensionList))
|
return db.extendMsgModel.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensions))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) SetSendMsgStatus(ctx context.Context, id string, status int32) error {
|
func (db *msgDatabase) SetSendMsgStatus(ctx context.Context, id string, status int32) error {
|
||||||
@ -235,13 +247,13 @@ func (db *msgDatabase) BatchInsertChat2DB(ctx context.Context, sourceID string,
|
|||||||
//filter := bson.M{"uid": seqUid}
|
//filter := bson.M{"uid": seqUid}
|
||||||
//log.NewDebug(operationID, "filter ", seqUid, "list ", msgListToMongo, "userID: ", userID)
|
//log.NewDebug(operationID, "filter ", seqUid, "list ", msgListToMongo, "userID: ", userID)
|
||||||
//err := c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": bson.M{"$each": msgsToMongo}}}).Err()
|
//err := c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": bson.M{"$each": msgsToMongo}}}).Err()
|
||||||
err = db.mgo.PushMsgsToDoc(ctx, docID, msgsToMongo)
|
err = db.msgDocModel.PushMsgsToDoc(ctx, docID, msgsToMongo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == mongo.ErrNoDocuments {
|
if err == mongo.ErrNoDocuments {
|
||||||
doc := &unRelationTb.MsgDocModel{}
|
doc := &unRelationTb.MsgDocModel{}
|
||||||
doc.DocID = docID
|
doc.DocID = docID
|
||||||
doc.Msg = msgsToMongo
|
doc.Msg = msgsToMongo
|
||||||
if err = db.mgo.Create(ctx, doc); err != nil {
|
if err = db.msgDocModel.Create(ctx, doc); err != nil {
|
||||||
prome.Inc(prome.MsgInsertMongoFailedCounter)
|
prome.Inc(prome.MsgInsertMongoFailedCounter)
|
||||||
//log.NewError(operationID, "InsertOne failed", filter, err.Error(), sChat)
|
//log.NewError(operationID, "InsertOne failed", filter, err.Error(), sChat)
|
||||||
return utils.Wrap(err, "")
|
return utils.Wrap(err, "")
|
||||||
@ -261,7 +273,7 @@ func (db *msgDatabase) BatchInsertChat2DB(ctx context.Context, sourceID string,
|
|||||||
nextDoc.DocID = docIDNext
|
nextDoc.DocID = docIDNext
|
||||||
nextDoc.Msg = msgsToMongoNext
|
nextDoc.Msg = msgsToMongoNext
|
||||||
//log.NewDebug(operationID, "filter ", seqUidNext, "list ", msgListToMongoNext, "userID: ", userID)
|
//log.NewDebug(operationID, "filter ", seqUidNext, "list ", msgListToMongoNext, "userID: ", userID)
|
||||||
if err = db.mgo.Create(ctx, nextDoc); err != nil {
|
if err = db.msgDocModel.Create(ctx, nextDoc); err != nil {
|
||||||
prome.Inc(prome.MsgInsertMongoFailedCounter)
|
prome.Inc(prome.MsgInsertMongoFailedCounter)
|
||||||
//log.NewError(operationID, "InsertOne failed", filter, err.Error(), sChat)
|
//log.NewError(operationID, "InsertOne failed", filter, err.Error(), sChat)
|
||||||
return utils.Wrap(err, "")
|
return utils.Wrap(err, "")
|
||||||
@ -355,7 +367,7 @@ func (db *msgDatabase) DelMsgBySeqsInOneDoc(ctx context.Context, docID string, s
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for i, v := range seqMsgs {
|
for i, v := range seqMsgs {
|
||||||
if err = db.mgo.UpdateMsgStatusByIndexInOneDoc(ctx, docID, v, indexes[i], constant.MsgDeleted); err != nil {
|
if err = db.msgDocModel.UpdateMsgStatusByIndexInOneDoc(ctx, docID, v, indexes[i], constant.MsgDeleted); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +375,7 @@ func (db *msgDatabase) DelMsgBySeqsInOneDoc(ctx context.Context, docID string, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID string, seqs []int64) (seqMsgs []*sdkws.MsgData, indexes []int, unExistSeqs []int64, err error) {
|
func (db *msgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID string, seqs []int64) (seqMsgs []*sdkws.MsgData, indexes []int, unExistSeqs []int64, err error) {
|
||||||
doc, err := db.mgo.FindOneByDocID(ctx, docID)
|
doc, err := db.msgDocModel.FindOneByDocID(ctx, docID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
@ -394,7 +406,7 @@ func (db *msgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) GetNewestMsg(ctx context.Context, sourceID string) (msgPb *sdkws.MsgData, err error) {
|
func (db *msgDatabase) GetNewestMsg(ctx context.Context, sourceID string) (msgPb *sdkws.MsgData, err error) {
|
||||||
msgInfo, err := db.mgo.GetNewestMsg(ctx, sourceID)
|
msgInfo, err := db.msgDocModel.GetNewestMsg(ctx, sourceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -402,7 +414,7 @@ func (db *msgDatabase) GetNewestMsg(ctx context.Context, sourceID string) (msgPb
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) GetOldestMsg(ctx context.Context, sourceID string) (msgPb *sdkws.MsgData, err error) {
|
func (db *msgDatabase) GetOldestMsg(ctx context.Context, sourceID string) (msgPb *sdkws.MsgData, err error) {
|
||||||
msgInfo, err := db.mgo.GetOldestMsg(ctx, sourceID)
|
msgInfo, err := db.msgDocModel.GetOldestMsg(ctx, sourceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -423,7 +435,7 @@ func (db *msgDatabase) getMsgBySeqs(ctx context.Context, sourceID string, seqs [
|
|||||||
singleCount := 0
|
singleCount := 0
|
||||||
m := db.msg.GetDocIDSeqsMap(sourceID, seqs)
|
m := db.msg.GetDocIDSeqsMap(sourceID, seqs)
|
||||||
for docID, value := range m {
|
for docID, value := range m {
|
||||||
doc, err := db.mgo.FindOneByDocID(ctx, docID)
|
doc, err := db.msgDocModel.FindOneByDocID(ctx, docID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error())
|
//log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error())
|
||||||
continue
|
continue
|
||||||
@ -566,7 +578,7 @@ func (d *delMsgRecursionStruct) getSetMinSeq() int64 {
|
|||||||
// recursion 删除list并且返回设置的最小seq
|
// recursion 删除list并且返回设置的最小seq
|
||||||
func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string, index int64, delStruct *delMsgRecursionStruct, remainTime int64) (int64, error) {
|
func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string, index int64, delStruct *delMsgRecursionStruct, remainTime int64) (int64, error) {
|
||||||
// find from oldest list
|
// find from oldest list
|
||||||
msgs, err := db.mgo.GetMsgsByIndex(ctx, sourceID, index)
|
msgs, err := db.msgDocModel.GetMsgsByIndex(ctx, sourceID, index)
|
||||||
if err != nil || msgs.DocID == "" {
|
if err != nil || msgs.DocID == "" {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == unrelation.ErrMsgListNotExist {
|
if err == unrelation.ErrMsgListNotExist {
|
||||||
@ -576,7 +588,7 @@ func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 获取报错,或者获取不到了,物理删除并且返回seq delMongoMsgsPhysical(delStruct.delDocIDList)
|
// 获取报错,或者获取不到了,物理删除并且返回seq delMongoMsgsPhysical(delStruct.delDocIDList)
|
||||||
err = db.mgo.Delete(ctx, delStruct.delDocIDs)
|
err = db.msgDocModel.Delete(ctx, delStruct.delDocIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@ -611,11 +623,11 @@ func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string,
|
|||||||
msg.SendTime = 0
|
msg.SendTime = 0
|
||||||
hasMarkDelFlag = true
|
hasMarkDelFlag = true
|
||||||
} else {
|
} else {
|
||||||
if err := db.mgo.Delete(ctx, delStruct.delDocIDs); err != nil {
|
if err := db.msgDocModel.Delete(ctx, delStruct.delDocIDs); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if hasMarkDelFlag {
|
if hasMarkDelFlag {
|
||||||
if err := db.mgo.UpdateOneDoc(ctx, msgs); err != nil {
|
if err := db.msgDocModel.UpdateOneDoc(ctx, msgs); err != nil {
|
||||||
return delStruct.getSetMinSeq(), utils.Wrap(err, "")
|
return delStruct.getSetMinSeq(), utils.Wrap(err, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -659,7 +671,7 @@ func (db *msgDatabase) GetSuperGroupMinMaxSeqInMongoAndCache(ctx context.Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *msgDatabase) GetMinMaxSeqMongo(ctx context.Context, sourceID string) (minSeqMongo, maxSeqMongo int64, err error) {
|
func (db *msgDatabase) GetMinMaxSeqMongo(ctx context.Context, sourceID string) (minSeqMongo, maxSeqMongo int64, err error) {
|
||||||
oldestMsgMongo, err := db.mgo.GetOldestMsg(ctx, sourceID)
|
oldestMsgMongo, err := db.msgDocModel.GetOldestMsg(ctx, sourceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
@ -668,7 +680,7 @@ func (db *msgDatabase) GetMinMaxSeqMongo(ctx context.Context, sourceID string) (
|
|||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
minSeqMongo = msgPb.Seq
|
minSeqMongo = msgPb.Seq
|
||||||
newestMsgMongo, err := db.mgo.GetNewestMsg(ctx, sourceID)
|
newestMsgMongo, err := db.msgDocModel.GetNewestMsg(ctx, sourceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ type PushDatabase interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type pushDataBase struct {
|
type pushDataBase struct {
|
||||||
cache cache.Cache
|
cache cache.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPushDatabase(cache cache.Cache) PushDatabase {
|
func NewPushDatabase(cache cache.Model) PushDatabase {
|
||||||
return &pushDataBase{cache: cache}
|
return &pushDataBase{cache: cache}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ type ThirdDatabase interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type thirdDatabase struct {
|
type thirdDatabase struct {
|
||||||
cache cache.Cache
|
cache cache.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewThirdDatabase(cache cache.Cache) ThirdDatabase {
|
func NewThirdDatabase(cache cache.Model) ThirdDatabase {
|
||||||
return &thirdDatabase{cache: cache}
|
return &thirdDatabase{cache: cache}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ type ConversationLocalCache struct {
|
|||||||
client discoveryregistry.SvcDiscoveryRegistry
|
client discoveryregistry.SvcDiscoveryRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConversationLocalCache(client discoveryregistry.SvcDiscoveryRegistry) ConversationLocalCache {
|
func NewConversationLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *ConversationLocalCache {
|
||||||
return ConversationLocalCache{
|
return &ConversationLocalCache{
|
||||||
SuperGroupRecvMsgNotNotifyUserIDs: make(map[string][]string, 0),
|
SuperGroupRecvMsgNotNotifyUserIDs: make(map[string][]string, 0),
|
||||||
client: client,
|
client: client,
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ type GroupMemberIDsHash struct {
|
|||||||
userIDs []string
|
userIDs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGroupMemberIDsLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *GroupLocalCache {
|
func NewGroupLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *GroupLocalCache {
|
||||||
return &GroupLocalCache{
|
return &GroupLocalCache{
|
||||||
cache: make(map[string]GroupMemberIDsHash, 0),
|
cache: make(map[string]GroupMemberIDsHash, 0),
|
||||||
client: client,
|
client: client,
|
||||||
|
@ -17,7 +17,7 @@ type ChatLogGorm struct {
|
|||||||
DB *gorm.DB
|
DB *gorm.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewChatLogGorm(db *gorm.DB) *ChatLogGorm {
|
func NewChatLogGorm(db *gorm.DB) relation.ChatLogModelInterface {
|
||||||
return &ChatLogGorm{DB: db}
|
return &ChatLogGorm{DB: db}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package unrelation
|
package unrelation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/pkg/proto/sdkws"
|
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -41,8 +40,8 @@ type ExtendMsgSetModelInterface interface {
|
|||||||
GetAllExtendMsgSet(ctx context.Context, sourceID string, opts *GetAllExtendMsgSetOpts) (sets []*ExtendMsgSetModel, err error)
|
GetAllExtendMsgSet(ctx context.Context, sourceID string, opts *GetAllExtendMsgSetOpts) (sets []*ExtendMsgSetModel, err error)
|
||||||
GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*ExtendMsgSetModel, error)
|
GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*ExtendMsgSetModel, error)
|
||||||
InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *ExtendMsgModel) error
|
InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *ExtendMsgModel) error
|
||||||
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
|
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*KeyValueModel) error
|
||||||
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
|
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*KeyValueModel) error
|
||||||
TakeExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *ExtendMsgModel, err error)
|
TakeExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *ExtendMsgModel, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package unrelation
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
|
||||||
"OpenIM/pkg/proto/sdkws"
|
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
@ -18,7 +17,7 @@ type ExtendMsgSetMongoDriver struct {
|
|||||||
ExtendMsgSetCollection *mongo.Collection
|
ExtendMsgSetCollection *mongo.Collection
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewExtendMsgSetMongoDriver(mgoDB *mongo.Database) *ExtendMsgSetMongoDriver {
|
func NewExtendMsgSetMongoDriver(mgoDB *mongo.Database) unRelationTb.ExtendMsgSetModelInterface {
|
||||||
return &ExtendMsgSetMongoDriver{mgoDB: mgoDB, ExtendMsgSetCollection: mgoDB.Collection(unRelationTb.CExtendMsgSet)}
|
return &ExtendMsgSetMongoDriver{mgoDB: mgoDB, ExtendMsgSetCollection: mgoDB.Collection(unRelationTb.CExtendMsgSet)}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ func (e *ExtendMsgSetMongoDriver) InsertExtendMsg(ctx context.Context, sourceID
|
|||||||
}
|
}
|
||||||
|
|
||||||
// insert or update
|
// insert or update
|
||||||
func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
|
func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
|
||||||
var updateBson = bson.M{}
|
var updateBson = bson.M{}
|
||||||
for _, v := range reactionExtensionList {
|
for _, v := range reactionExtensionList {
|
||||||
updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = v
|
updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = v
|
||||||
@ -116,7 +115,7 @@ func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delete TypeKey
|
// delete TypeKey
|
||||||
func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
|
func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
|
||||||
var updateBson = bson.M{}
|
var updateBson = bson.M{}
|
||||||
for _, v := range reactionExtensionList {
|
for _, v := range reactionExtensionList {
|
||||||
updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = ""
|
updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = ""
|
||||||
@ -132,7 +131,7 @@ func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *ExtendMsgSetMongoDriver) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
|
func (e *ExtendMsgSetMongoDriver) TakeExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
|
||||||
findOpts := options.Find().SetLimit(1).SetSkip(0).SetSort(bson.M{"source_id": -1}).SetProjection(bson.M{fmt.Sprintf("extend_msgs.%s", clientMsgID): 1})
|
findOpts := options.Find().SetLimit(1).SetSkip(0).SetSort(bson.M{"source_id": -1}).SetProjection(bson.M{fmt.Sprintf("extend_msgs.%s", clientMsgID): 1})
|
||||||
regex := fmt.Sprintf("^%s", sourceID)
|
regex := fmt.Sprintf("^%s", sourceID)
|
||||||
result, err := e.ExtendMsgSetCollection.Find(ctx, bson.M{"source_id": primitive.Regex{Pattern: regex}, "session_type": sessionType, "max_msg_update_time": bson.M{"$lte": maxMsgUpdateTime}}, findOpts)
|
result, err := e.ExtendMsgSetCollection.Find(ctx, bson.M{"source_id": primitive.Regex{Pattern: regex}, "session_type": sessionType, "max_msg_update_time": bson.M{"$lte": maxMsgUpdateTime}}, findOpts)
|
||||||
|
@ -56,25 +56,26 @@ func (m *Mongo) GetClient() *mongo.Client {
|
|||||||
return m.db
|
return m.db
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mongo) CreateMsgIndex() {
|
func (m *Mongo) GetDatabase() *mongo.Database {
|
||||||
if err := m.createMongoIndex(unrelation.CChat, false, "uid"); err != nil {
|
return m.db.Database(config.Config.Mongo.DBDatabase)
|
||||||
fmt.Println(err.Error() + " index create failed " + unrelation.CChat + " uid, please create index by yourself in field uid")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mongo) CreateSuperGroupIndex() {
|
func (m *Mongo) CreateMsgIndex() error {
|
||||||
|
return m.createMongoIndex(unrelation.CChat, false, "uid")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mongo) CreateSuperGroupIndex() error {
|
||||||
if err := m.createMongoIndex(unrelation.CSuperGroup, true, "group_id"); err != nil {
|
if err := m.createMongoIndex(unrelation.CSuperGroup, true, "group_id"); err != nil {
|
||||||
panic(err.Error() + "index create failed " + unrelation.CSuperGroup + " group_id")
|
return err
|
||||||
}
|
}
|
||||||
if err := m.createMongoIndex(unrelation.CUserToSuperGroup, true, "user_id"); err != nil {
|
if err := m.createMongoIndex(unrelation.CUserToSuperGroup, true, "user_id"); err != nil {
|
||||||
panic(err.Error() + "index create failed " + unrelation.CUserToSuperGroup + "user_id")
|
return err
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mongo) CreateExtendMsgSetIndex() {
|
func (m *Mongo) CreateExtendMsgSetIndex() error {
|
||||||
if err := m.createMongoIndex(unrelation.CExtendMsgSet, true, "-create_time", "work_moment_id"); err != nil {
|
return m.createMongoIndex(unrelation.CExtendMsgSet, true, "-create_time", "work_moment_id")
|
||||||
panic(err.Error() + "index create failed " + unrelation.CExtendMsgSet + " -create_time, work_moment_id")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...string) error {
|
func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...string) error {
|
||||||
@ -107,26 +108,3 @@ func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...strin
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func MongoTransaction(ctx context.Context, mgo *mongo.Client, fn func(ctx mongo.SessionContext) error) error {
|
|
||||||
sess, err := mgo.StartSession()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
sCtx := mongo.NewSessionContext(ctx, sess)
|
|
||||||
defer sess.EndSession(sCtx)
|
|
||||||
if err := fn(sCtx); err != nil {
|
|
||||||
_ = sess.AbortTransaction(sCtx)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return utils.Wrap(sess.CommitTransaction(sCtx), "")
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTxCtx(ctx context.Context, tx []any) context.Context {
|
|
||||||
if len(tx) > 0 {
|
|
||||||
if ctx, ok := tx[0].(mongo.SessionContext); ok {
|
|
||||||
return ctx
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ctx
|
|
||||||
}
|
|
||||||
|
@ -18,13 +18,12 @@ var ErrMsgListNotExist = errors.New("user not have msg in mongoDB")
|
|||||||
var ErrMsgNotFound = errors.New("msg not found")
|
var ErrMsgNotFound = errors.New("msg not found")
|
||||||
|
|
||||||
type MsgMongoDriver struct {
|
type MsgMongoDriver struct {
|
||||||
mgoDB *mongo.Database
|
|
||||||
MsgCollection *mongo.Collection
|
MsgCollection *mongo.Collection
|
||||||
msg table.MsgDocModel
|
msg table.MsgDocModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMsgMongoDriver(mgoDB *mongo.Database) *MsgMongoDriver {
|
func NewMsgMongoDriver(database *mongo.Database) table.MsgDocModelInterface {
|
||||||
return &MsgMongoDriver{mgoDB: mgoDB, MsgCollection: mgoDB.Collection(table.MsgDocModel{}.TableName())}
|
return &MsgMongoDriver{MsgCollection: database.Collection(table.MsgDocModel{}.TableName())}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgMongoDriver) PushMsgsToDoc(ctx context.Context, docID string, msgsToMongo []table.MsgInfoModel) error {
|
func (m *MsgMongoDriver) PushMsgsToDoc(ctx context.Context, docID string, msgsToMongo []table.MsgInfoModel) error {
|
||||||
|
@ -11,14 +11,11 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/mongo/readconcern"
|
"go.mongodb.org/mongo-driver/mongo/readconcern"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewSuperGroupMongoDriver(mgoClient *mongo.Client) unrelation.SuperGroupModelInterface {
|
func NewSuperGroupMongoDriver(database *mongo.Database) unrelation.SuperGroupModelInterface {
|
||||||
mgoDB := mgoClient.Database(config.Config.Mongo.DBDatabase)
|
return &SuperGroupMongoDriver{superGroupCollection: database.Collection(unrelation.CSuperGroup), userToSuperGroupCollection: database.Collection(unrelation.CUserToSuperGroup)}
|
||||||
return &SuperGroupMongoDriver{MgoDB: mgoDB, MgoClient: mgoClient, superGroupCollection: mgoDB.Collection(unrelation.CSuperGroup), userToSuperGroupCollection: mgoDB.Collection(unrelation.CUserToSuperGroup)}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuperGroupMongoDriver struct {
|
type SuperGroupMongoDriver struct {
|
||||||
MgoClient *mongo.Client
|
|
||||||
MgoDB *mongo.Database
|
|
||||||
superGroupCollection *mongo.Collection
|
superGroupCollection *mongo.Collection
|
||||||
userToSuperGroupCollection *mongo.Collection
|
userToSuperGroupCollection *mongo.Collection
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
package kafka
|
package kafka
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"OpenIM/pkg/common/constant"
|
||||||
|
"OpenIM/pkg/common/tracelog"
|
||||||
"context"
|
"context"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
)
|
)
|
||||||
@ -39,6 +41,19 @@ func NewMConsumerGroup(consumerConfig *MConsumerGroupConfig, topics, addrs []str
|
|||||||
topics,
|
topics,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mc *MConsumerGroup) GetContextFromMsg(cMsg *sarama.ConsumerMessage) context.Context {
|
||||||
|
ctx := context.Background()
|
||||||
|
var operationID string
|
||||||
|
for _, v := range cMsg.Headers {
|
||||||
|
if string(v.Key) == constant.OperationID {
|
||||||
|
operationID = string(v.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tracelog.SetOperationID(ctx, operationID)
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
|
|
||||||
func (mc *MConsumerGroup) RegisterHandleAndConsumer(handler sarama.ConsumerGroupHandler) {
|
func (mc *MConsumerGroup) RegisterHandleAndConsumer(handler sarama.ConsumerGroupHandler) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
for {
|
for {
|
||||||
|
@ -2,6 +2,7 @@ package kafka
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"OpenIM/pkg/common/config"
|
"OpenIM/pkg/common/config"
|
||||||
|
"OpenIM/pkg/common/constant"
|
||||||
log "OpenIM/pkg/common/log"
|
log "OpenIM/pkg/common/log"
|
||||||
"OpenIM/pkg/common/tracelog"
|
"OpenIM/pkg/common/tracelog"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
@ -67,6 +68,7 @@ func (p *Producer) SendMessage(ctx context.Context, m proto.Message, key string)
|
|||||||
return -1, -1, errors.New("key or value == 0")
|
return -1, -1, errors.New("key or value == 0")
|
||||||
}
|
}
|
||||||
kMsg.Metadata = ctx
|
kMsg.Metadata = ctx
|
||||||
|
kMsg.Headers = []sarama.RecordHeader{{Key: []byte(constant.OperationID), Value: []byte(operationID)}}
|
||||||
partition, offset, err := p.producer.SendMessage(kMsg)
|
partition, offset, err := p.producer.SendMessage(kMsg)
|
||||||
log.Info(operationID, "ByteEncoder SendMessage end", "key ", kMsg.Key.Length(), kMsg.Value.Length(), p.producer)
|
log.Info(operationID, "ByteEncoder SendMessage end", "key ", kMsg.Key.Length(), kMsg.Value.Length(), p.producer)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"OpenIM/pkg/common/constant"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -27,7 +28,7 @@ func CorsHandler() gin.HandlerFunc {
|
|||||||
|
|
||||||
func GinParseOperationID(c *gin.Context) {
|
func GinParseOperationID(c *gin.Context) {
|
||||||
if c.Request.Method == http.MethodPost {
|
if c.Request.Method == http.MethodPost {
|
||||||
operationID := c.Request.Header.Get("operationID")
|
operationID := c.Request.Header.Get(constant.OperationID)
|
||||||
if operationID == "" {
|
if operationID == "" {
|
||||||
body, err := ioutil.ReadAll(c.Request.Body)
|
body, err := ioutil.ReadAll(c.Request.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -50,9 +51,9 @@ func GinParseOperationID(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
c.Request.Body = ioutil.NopCloser(bytes.NewReader(body))
|
c.Request.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||||
operationID = req.OperationID
|
operationID = req.OperationID
|
||||||
c.Request.Header.Set("operationID", operationID)
|
c.Request.Header.Set(constant.OperationID, operationID)
|
||||||
}
|
}
|
||||||
c.Set("operationID", operationID)
|
c.Set(constant.OperationID, operationID)
|
||||||
c.Next()
|
c.Next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func RpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, status.New(codes.InvalidArgument, "missing metadata").Err()
|
return nil, status.New(codes.InvalidArgument, "missing metadata").Err()
|
||||||
}
|
}
|
||||||
if opts := md.Get("operationID"); len(opts) != 1 || opts[0] == "" {
|
if opts := md.Get(constant.OperationID); len(opts) != 1 || opts[0] == "" {
|
||||||
return nil, status.New(codes.InvalidArgument, "operationID error").Err()
|
return nil, status.New(codes.InvalidArgument, "operationID error").Err()
|
||||||
} else {
|
} else {
|
||||||
operationID = opts[0]
|
operationID = opts[0]
|
||||||
@ -71,7 +71,7 @@ func RpcClientInterceptor(ctx context.Context, method string, req, reply interfa
|
|||||||
//if cc == nil {
|
//if cc == nil {
|
||||||
// return utils.Wrap(constant.ErrRpcConn, "")
|
// return utils.Wrap(constant.ErrRpcConn, "")
|
||||||
//}
|
//}
|
||||||
operationID, ok := ctx.Value("operationID").(string)
|
operationID, ok := ctx.Value(constant.OperationID).(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return utils.Wrap(constant.ErrArgs, "ctx missing operationID")
|
return utils.Wrap(constant.ErrArgs, "ctx missing operationID")
|
||||||
}
|
}
|
||||||
@ -79,6 +79,6 @@ func RpcClientInterceptor(ctx context.Context, method string, req, reply interfa
|
|||||||
if !ok {
|
if !ok {
|
||||||
return utils.Wrap(constant.ErrArgs, "ctx missing opUserID")
|
return utils.Wrap(constant.ErrArgs, "ctx missing opUserID")
|
||||||
}
|
}
|
||||||
md := metadata.Pairs("operationID", operationID, "opUserID", opUserID)
|
md := metadata.Pairs(constant.OperationID, operationID, "opUserID", opUserID)
|
||||||
return invoker(metadata.NewOutgoingContext(ctx, md), method, req, reply, cc, opts...)
|
return invoker(metadata.NewOutgoingContext(ctx, md), method, req, reply, cc, opts...)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package tracelog
|
package tracelog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"OpenIM/pkg/common/constant"
|
||||||
"OpenIM/pkg/utils"
|
"OpenIM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -15,7 +16,7 @@ import (
|
|||||||
const TraceLogKey = "tracelog"
|
const TraceLogKey = "tracelog"
|
||||||
|
|
||||||
func NewCtx(c *gin.Context, api string) context.Context {
|
func NewCtx(c *gin.Context, api string) context.Context {
|
||||||
req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: c.GetHeader("operationID"), Funcs: &[]FuncInfo{}}
|
req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: c.GetHeader(constant.OperationID), Funcs: &[]FuncInfo{}}
|
||||||
return context.WithValue(c, TraceLogKey, req)
|
return context.WithValue(c, TraceLogKey, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
import "Open-IM-Server/pkg/proto/sdkws/ws.proto";
|
|
||||||
package pbAuth;
|
package pbAuth;
|
||||||
option go_package = "OpenIM/pkg/proto/auth;pbAuth";
|
option go_package = "OpenIM/pkg/proto/auth;pbAuth";
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} }
|
|||||||
func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) }
|
func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgDataToMQ) ProtoMessage() {}
|
func (*MsgDataToMQ) ProtoMessage() {}
|
||||||
func (*MsgDataToMQ) Descriptor() ([]byte, []int) {
|
func (*MsgDataToMQ) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{0}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{0}
|
||||||
}
|
}
|
||||||
func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error {
|
func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b)
|
return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b)
|
||||||
@ -82,7 +82,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} }
|
|||||||
func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) }
|
func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgDataToDB) ProtoMessage() {}
|
func (*MsgDataToDB) ProtoMessage() {}
|
||||||
func (*MsgDataToDB) Descriptor() ([]byte, []int) {
|
func (*MsgDataToDB) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{1}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{1}
|
||||||
}
|
}
|
||||||
func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error {
|
func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b)
|
return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b)
|
||||||
@ -121,7 +121,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} }
|
|||||||
func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) }
|
func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PushMsgDataToMQ) ProtoMessage() {}
|
func (*PushMsgDataToMQ) ProtoMessage() {}
|
||||||
func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) {
|
func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{2}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{2}
|
||||||
}
|
}
|
||||||
func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error {
|
func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b)
|
return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b)
|
||||||
@ -169,7 +169,7 @@ func (m *MsgDataToMongoByMQ) Reset() { *m = MsgDataToMongoByMQ{} }
|
|||||||
func (m *MsgDataToMongoByMQ) String() string { return proto.CompactTextString(m) }
|
func (m *MsgDataToMongoByMQ) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgDataToMongoByMQ) ProtoMessage() {}
|
func (*MsgDataToMongoByMQ) ProtoMessage() {}
|
||||||
func (*MsgDataToMongoByMQ) Descriptor() ([]byte, []int) {
|
func (*MsgDataToMongoByMQ) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{3}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{3}
|
||||||
}
|
}
|
||||||
func (m *MsgDataToMongoByMQ) XXX_Unmarshal(b []byte) error {
|
func (m *MsgDataToMongoByMQ) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgDataToMongoByMQ.Unmarshal(m, b)
|
return xxx_messageInfo_MsgDataToMongoByMQ.Unmarshal(m, b)
|
||||||
@ -228,7 +228,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
|
|||||||
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
||||||
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{4}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{4}
|
||||||
}
|
}
|
||||||
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
||||||
@ -267,7 +267,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
|
|||||||
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
||||||
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{5}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{5}
|
||||||
}
|
}
|
||||||
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
||||||
@ -312,7 +312,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} }
|
|||||||
func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SendMsgReq) ProtoMessage() {}
|
func (*SendMsgReq) ProtoMessage() {}
|
||||||
func (*SendMsgReq) Descriptor() ([]byte, []int) {
|
func (*SendMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{6}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{6}
|
||||||
}
|
}
|
||||||
func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
|
||||||
@ -352,7 +352,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} }
|
|||||||
func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SendMsgResp) ProtoMessage() {}
|
func (*SendMsgResp) ProtoMessage() {}
|
||||||
func (*SendMsgResp) Descriptor() ([]byte, []int) {
|
func (*SendMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{7}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{7}
|
||||||
}
|
}
|
||||||
func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
|
||||||
@ -404,7 +404,7 @@ func (m *ClearMsgReq) Reset() { *m = ClearMsgReq{} }
|
|||||||
func (m *ClearMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *ClearMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ClearMsgReq) ProtoMessage() {}
|
func (*ClearMsgReq) ProtoMessage() {}
|
||||||
func (*ClearMsgReq) Descriptor() ([]byte, []int) {
|
func (*ClearMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{8}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{8}
|
||||||
}
|
}
|
||||||
func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b)
|
||||||
@ -441,7 +441,7 @@ func (m *ClearMsgResp) Reset() { *m = ClearMsgResp{} }
|
|||||||
func (m *ClearMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *ClearMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ClearMsgResp) ProtoMessage() {}
|
func (*ClearMsgResp) ProtoMessage() {}
|
||||||
func (*ClearMsgResp) Descriptor() ([]byte, []int) {
|
func (*ClearMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{9}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{9}
|
||||||
}
|
}
|
||||||
func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b)
|
||||||
@ -474,7 +474,7 @@ func (m *SetMsgMinSeqReq) Reset() { *m = SetMsgMinSeqReq{} }
|
|||||||
func (m *SetMsgMinSeqReq) String() string { return proto.CompactTextString(m) }
|
func (m *SetMsgMinSeqReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SetMsgMinSeqReq) ProtoMessage() {}
|
func (*SetMsgMinSeqReq) ProtoMessage() {}
|
||||||
func (*SetMsgMinSeqReq) Descriptor() ([]byte, []int) {
|
func (*SetMsgMinSeqReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{10}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{10}
|
||||||
}
|
}
|
||||||
func (m *SetMsgMinSeqReq) XXX_Unmarshal(b []byte) error {
|
func (m *SetMsgMinSeqReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SetMsgMinSeqReq.Unmarshal(m, b)
|
return xxx_messageInfo_SetMsgMinSeqReq.Unmarshal(m, b)
|
||||||
@ -525,7 +525,7 @@ func (m *SetMsgMinSeqResp) Reset() { *m = SetMsgMinSeqResp{} }
|
|||||||
func (m *SetMsgMinSeqResp) String() string { return proto.CompactTextString(m) }
|
func (m *SetMsgMinSeqResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SetMsgMinSeqResp) ProtoMessage() {}
|
func (*SetMsgMinSeqResp) ProtoMessage() {}
|
||||||
func (*SetMsgMinSeqResp) Descriptor() ([]byte, []int) {
|
func (*SetMsgMinSeqResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{11}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{11}
|
||||||
}
|
}
|
||||||
func (m *SetMsgMinSeqResp) XXX_Unmarshal(b []byte) error {
|
func (m *SetMsgMinSeqResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SetMsgMinSeqResp.Unmarshal(m, b)
|
return xxx_messageInfo_SetMsgMinSeqResp.Unmarshal(m, b)
|
||||||
@ -556,7 +556,7 @@ func (m *SetSendMsgStatusReq) Reset() { *m = SetSendMsgStatusReq{} }
|
|||||||
func (m *SetSendMsgStatusReq) String() string { return proto.CompactTextString(m) }
|
func (m *SetSendMsgStatusReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SetSendMsgStatusReq) ProtoMessage() {}
|
func (*SetSendMsgStatusReq) ProtoMessage() {}
|
||||||
func (*SetSendMsgStatusReq) Descriptor() ([]byte, []int) {
|
func (*SetSendMsgStatusReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{12}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{12}
|
||||||
}
|
}
|
||||||
func (m *SetSendMsgStatusReq) XXX_Unmarshal(b []byte) error {
|
func (m *SetSendMsgStatusReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SetSendMsgStatusReq.Unmarshal(m, b)
|
return xxx_messageInfo_SetSendMsgStatusReq.Unmarshal(m, b)
|
||||||
@ -593,7 +593,7 @@ func (m *SetSendMsgStatusResp) Reset() { *m = SetSendMsgStatusResp{} }
|
|||||||
func (m *SetSendMsgStatusResp) String() string { return proto.CompactTextString(m) }
|
func (m *SetSendMsgStatusResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SetSendMsgStatusResp) ProtoMessage() {}
|
func (*SetSendMsgStatusResp) ProtoMessage() {}
|
||||||
func (*SetSendMsgStatusResp) Descriptor() ([]byte, []int) {
|
func (*SetSendMsgStatusResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{13}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{13}
|
||||||
}
|
}
|
||||||
func (m *SetSendMsgStatusResp) XXX_Unmarshal(b []byte) error {
|
func (m *SetSendMsgStatusResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SetSendMsgStatusResp.Unmarshal(m, b)
|
return xxx_messageInfo_SetSendMsgStatusResp.Unmarshal(m, b)
|
||||||
@ -623,7 +623,7 @@ func (m *GetSendMsgStatusReq) Reset() { *m = GetSendMsgStatusReq{} }
|
|||||||
func (m *GetSendMsgStatusReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetSendMsgStatusReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetSendMsgStatusReq) ProtoMessage() {}
|
func (*GetSendMsgStatusReq) ProtoMessage() {}
|
||||||
func (*GetSendMsgStatusReq) Descriptor() ([]byte, []int) {
|
func (*GetSendMsgStatusReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{14}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{14}
|
||||||
}
|
}
|
||||||
func (m *GetSendMsgStatusReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetSendMsgStatusReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetSendMsgStatusReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetSendMsgStatusReq.Unmarshal(m, b)
|
||||||
@ -654,7 +654,7 @@ func (m *GetSendMsgStatusResp) Reset() { *m = GetSendMsgStatusResp{} }
|
|||||||
func (m *GetSendMsgStatusResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetSendMsgStatusResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetSendMsgStatusResp) ProtoMessage() {}
|
func (*GetSendMsgStatusResp) ProtoMessage() {}
|
||||||
func (*GetSendMsgStatusResp) Descriptor() ([]byte, []int) {
|
func (*GetSendMsgStatusResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{15}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{15}
|
||||||
}
|
}
|
||||||
func (m *GetSendMsgStatusResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetSendMsgStatusResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetSendMsgStatusResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetSendMsgStatusResp.Unmarshal(m, b)
|
||||||
@ -693,7 +693,7 @@ func (m *DelSuperGroupMsgReq) Reset() { *m = DelSuperGroupMsgReq{} }
|
|||||||
func (m *DelSuperGroupMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *DelSuperGroupMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DelSuperGroupMsgReq) ProtoMessage() {}
|
func (*DelSuperGroupMsgReq) ProtoMessage() {}
|
||||||
func (*DelSuperGroupMsgReq) Descriptor() ([]byte, []int) {
|
func (*DelSuperGroupMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{16}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{16}
|
||||||
}
|
}
|
||||||
func (m *DelSuperGroupMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *DelSuperGroupMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DelSuperGroupMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_DelSuperGroupMsgReq.Unmarshal(m, b)
|
||||||
@ -737,7 +737,7 @@ func (m *DelSuperGroupMsgResp) Reset() { *m = DelSuperGroupMsgResp{} }
|
|||||||
func (m *DelSuperGroupMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *DelSuperGroupMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DelSuperGroupMsgResp) ProtoMessage() {}
|
func (*DelSuperGroupMsgResp) ProtoMessage() {}
|
||||||
func (*DelSuperGroupMsgResp) Descriptor() ([]byte, []int) {
|
func (*DelSuperGroupMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{17}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{17}
|
||||||
}
|
}
|
||||||
func (m *DelSuperGroupMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *DelSuperGroupMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DelSuperGroupMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_DelSuperGroupMsgResp.Unmarshal(m, b)
|
||||||
@ -769,7 +769,7 @@ func (m *GetSuperGroupMsgReq) Reset() { *m = GetSuperGroupMsgReq{} }
|
|||||||
func (m *GetSuperGroupMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetSuperGroupMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetSuperGroupMsgReq) ProtoMessage() {}
|
func (*GetSuperGroupMsgReq) ProtoMessage() {}
|
||||||
func (*GetSuperGroupMsgReq) Descriptor() ([]byte, []int) {
|
func (*GetSuperGroupMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{18}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{18}
|
||||||
}
|
}
|
||||||
func (m *GetSuperGroupMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetSuperGroupMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetSuperGroupMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetSuperGroupMsgReq.Unmarshal(m, b)
|
||||||
@ -814,7 +814,7 @@ func (m *GetSuperGroupMsgResp) Reset() { *m = GetSuperGroupMsgResp{} }
|
|||||||
func (m *GetSuperGroupMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetSuperGroupMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetSuperGroupMsgResp) ProtoMessage() {}
|
func (*GetSuperGroupMsgResp) ProtoMessage() {}
|
||||||
func (*GetSuperGroupMsgResp) Descriptor() ([]byte, []int) {
|
func (*GetSuperGroupMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{19}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{19}
|
||||||
}
|
}
|
||||||
func (m *GetSuperGroupMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetSuperGroupMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetSuperGroupMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetSuperGroupMsgResp.Unmarshal(m, b)
|
||||||
@ -852,7 +852,7 @@ func (m *GetWriteDiffMsgReq) Reset() { *m = GetWriteDiffMsgReq{} }
|
|||||||
func (m *GetWriteDiffMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetWriteDiffMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetWriteDiffMsgReq) ProtoMessage() {}
|
func (*GetWriteDiffMsgReq) ProtoMessage() {}
|
||||||
func (*GetWriteDiffMsgReq) Descriptor() ([]byte, []int) {
|
func (*GetWriteDiffMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{20}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{20}
|
||||||
}
|
}
|
||||||
func (m *GetWriteDiffMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetWriteDiffMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetWriteDiffMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetWriteDiffMsgReq.Unmarshal(m, b)
|
||||||
@ -890,7 +890,7 @@ func (m *GetWriteDiffMsgResp) Reset() { *m = GetWriteDiffMsgResp{} }
|
|||||||
func (m *GetWriteDiffMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetWriteDiffMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetWriteDiffMsgResp) ProtoMessage() {}
|
func (*GetWriteDiffMsgResp) ProtoMessage() {}
|
||||||
func (*GetWriteDiffMsgResp) Descriptor() ([]byte, []int) {
|
func (*GetWriteDiffMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{21}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{21}
|
||||||
}
|
}
|
||||||
func (m *GetWriteDiffMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetWriteDiffMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetWriteDiffMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetWriteDiffMsgResp.Unmarshal(m, b)
|
||||||
@ -936,7 +936,7 @@ func (m *ModifyMessageReactionExtensionsReq) Reset() { *m = ModifyMessag
|
|||||||
func (m *ModifyMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
func (m *ModifyMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ModifyMessageReactionExtensionsReq) ProtoMessage() {}
|
func (*ModifyMessageReactionExtensionsReq) ProtoMessage() {}
|
||||||
func (*ModifyMessageReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
func (*ModifyMessageReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{22}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{22}
|
||||||
}
|
}
|
||||||
func (m *ModifyMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
func (m *ModifyMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_ModifyMessageReactionExtensionsReq.Unmarshal(m, b)
|
return xxx_messageInfo_ModifyMessageReactionExtensionsReq.Unmarshal(m, b)
|
||||||
@ -1038,7 +1038,7 @@ func (m *SetMessageReactionExtensionsReq) Reset() { *m = SetMessageReact
|
|||||||
func (m *SetMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
func (m *SetMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SetMessageReactionExtensionsReq) ProtoMessage() {}
|
func (*SetMessageReactionExtensionsReq) ProtoMessage() {}
|
||||||
func (*SetMessageReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
func (*SetMessageReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{23}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{23}
|
||||||
}
|
}
|
||||||
func (m *SetMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
func (m *SetMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SetMessageReactionExtensionsReq.Unmarshal(m, b)
|
return xxx_messageInfo_SetMessageReactionExtensionsReq.Unmarshal(m, b)
|
||||||
@ -1135,7 +1135,7 @@ func (m *SetMessageReactionExtensionsResp) Reset() { *m = SetMessageReac
|
|||||||
func (m *SetMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
func (m *SetMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SetMessageReactionExtensionsResp) ProtoMessage() {}
|
func (*SetMessageReactionExtensionsResp) ProtoMessage() {}
|
||||||
func (*SetMessageReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
func (*SetMessageReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{24}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{24}
|
||||||
}
|
}
|
||||||
func (m *SetMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
func (m *SetMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SetMessageReactionExtensionsResp.Unmarshal(m, b)
|
return xxx_messageInfo_SetMessageReactionExtensionsResp.Unmarshal(m, b)
|
||||||
@ -1197,7 +1197,7 @@ func (m *GetMessagesReactionExtensionsReq) Reset() { *m = GetMessagesRea
|
|||||||
func (m *GetMessagesReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetMessagesReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMessagesReactionExtensionsReq) ProtoMessage() {}
|
func (*GetMessagesReactionExtensionsReq) ProtoMessage() {}
|
||||||
func (*GetMessagesReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
func (*GetMessagesReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{25}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{25}
|
||||||
}
|
}
|
||||||
func (m *GetMessagesReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetMessagesReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMessagesReactionExtensionsReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetMessagesReactionExtensionsReq.Unmarshal(m, b)
|
||||||
@ -1261,7 +1261,7 @@ func (m *GetMessagesReactionExtensionsReq_MessageReactionKey) String() string {
|
|||||||
}
|
}
|
||||||
func (*GetMessagesReactionExtensionsReq_MessageReactionKey) ProtoMessage() {}
|
func (*GetMessagesReactionExtensionsReq_MessageReactionKey) ProtoMessage() {}
|
||||||
func (*GetMessagesReactionExtensionsReq_MessageReactionKey) Descriptor() ([]byte, []int) {
|
func (*GetMessagesReactionExtensionsReq_MessageReactionKey) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{25, 0}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{25, 0}
|
||||||
}
|
}
|
||||||
func (m *GetMessagesReactionExtensionsReq_MessageReactionKey) XXX_Unmarshal(b []byte) error {
|
func (m *GetMessagesReactionExtensionsReq_MessageReactionKey) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMessagesReactionExtensionsReq_MessageReactionKey.Unmarshal(m, b)
|
return xxx_messageInfo_GetMessagesReactionExtensionsReq_MessageReactionKey.Unmarshal(m, b)
|
||||||
@ -1306,7 +1306,7 @@ func (m *GetMessagesReactionExtensionsResp) Reset() { *m = GetMessagesRe
|
|||||||
func (m *GetMessagesReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetMessagesReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMessagesReactionExtensionsResp) ProtoMessage() {}
|
func (*GetMessagesReactionExtensionsResp) ProtoMessage() {}
|
||||||
func (*GetMessagesReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
func (*GetMessagesReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{26}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{26}
|
||||||
}
|
}
|
||||||
func (m *GetMessagesReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetMessagesReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMessagesReactionExtensionsResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetMessagesReactionExtensionsResp.Unmarshal(m, b)
|
||||||
@ -1345,7 +1345,7 @@ func (m *SingleMessageExtensionResult) Reset() { *m = SingleMessageExten
|
|||||||
func (m *SingleMessageExtensionResult) String() string { return proto.CompactTextString(m) }
|
func (m *SingleMessageExtensionResult) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SingleMessageExtensionResult) ProtoMessage() {}
|
func (*SingleMessageExtensionResult) ProtoMessage() {}
|
||||||
func (*SingleMessageExtensionResult) Descriptor() ([]byte, []int) {
|
func (*SingleMessageExtensionResult) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{27}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{27}
|
||||||
}
|
}
|
||||||
func (m *SingleMessageExtensionResult) XXX_Unmarshal(b []byte) error {
|
func (m *SingleMessageExtensionResult) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SingleMessageExtensionResult.Unmarshal(m, b)
|
return xxx_messageInfo_SingleMessageExtensionResult.Unmarshal(m, b)
|
||||||
@ -1391,7 +1391,7 @@ func (m *ModifyMessageReactionExtensionsResp) Reset() { *m = ModifyMessa
|
|||||||
func (m *ModifyMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
func (m *ModifyMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ModifyMessageReactionExtensionsResp) ProtoMessage() {}
|
func (*ModifyMessageReactionExtensionsResp) ProtoMessage() {}
|
||||||
func (*ModifyMessageReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
func (*ModifyMessageReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{28}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{28}
|
||||||
}
|
}
|
||||||
func (m *ModifyMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
func (m *ModifyMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_ModifyMessageReactionExtensionsResp.Unmarshal(m, b)
|
return xxx_messageInfo_ModifyMessageReactionExtensionsResp.Unmarshal(m, b)
|
||||||
@ -1443,7 +1443,7 @@ func (m *DeleteMessagesReactionExtensionsReq) Reset() { *m = DeleteMessa
|
|||||||
func (m *DeleteMessagesReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
func (m *DeleteMessagesReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DeleteMessagesReactionExtensionsReq) ProtoMessage() {}
|
func (*DeleteMessagesReactionExtensionsReq) ProtoMessage() {}
|
||||||
func (*DeleteMessagesReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
func (*DeleteMessagesReactionExtensionsReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{29}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{29}
|
||||||
}
|
}
|
||||||
func (m *DeleteMessagesReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
func (m *DeleteMessagesReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DeleteMessagesReactionExtensionsReq.Unmarshal(m, b)
|
return xxx_messageInfo_DeleteMessagesReactionExtensionsReq.Unmarshal(m, b)
|
||||||
@ -1530,7 +1530,7 @@ func (m *DeleteMessagesReactionExtensionsResp) Reset() { *m = DeleteMess
|
|||||||
func (m *DeleteMessagesReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
func (m *DeleteMessagesReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DeleteMessagesReactionExtensionsResp) ProtoMessage() {}
|
func (*DeleteMessagesReactionExtensionsResp) ProtoMessage() {}
|
||||||
func (*DeleteMessagesReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
func (*DeleteMessagesReactionExtensionsResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{30}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{30}
|
||||||
}
|
}
|
||||||
func (m *DeleteMessagesReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
func (m *DeleteMessagesReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DeleteMessagesReactionExtensionsResp.Unmarshal(m, b)
|
return xxx_messageInfo_DeleteMessagesReactionExtensionsResp.Unmarshal(m, b)
|
||||||
@ -1568,7 +1568,7 @@ func (m *ExtendMsgResp) Reset() { *m = ExtendMsgResp{} }
|
|||||||
func (m *ExtendMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *ExtendMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ExtendMsgResp) ProtoMessage() {}
|
func (*ExtendMsgResp) ProtoMessage() {}
|
||||||
func (*ExtendMsgResp) Descriptor() ([]byte, []int) {
|
func (*ExtendMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{31}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{31}
|
||||||
}
|
}
|
||||||
func (m *ExtendMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *ExtendMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_ExtendMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_ExtendMsgResp.Unmarshal(m, b)
|
||||||
@ -1610,7 +1610,7 @@ func (m *ExtendMsg) Reset() { *m = ExtendMsg{} }
|
|||||||
func (m *ExtendMsg) String() string { return proto.CompactTextString(m) }
|
func (m *ExtendMsg) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ExtendMsg) ProtoMessage() {}
|
func (*ExtendMsg) ProtoMessage() {}
|
||||||
func (*ExtendMsg) Descriptor() ([]byte, []int) {
|
func (*ExtendMsg) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{32}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{32}
|
||||||
}
|
}
|
||||||
func (m *ExtendMsg) XXX_Unmarshal(b []byte) error {
|
func (m *ExtendMsg) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_ExtendMsg.Unmarshal(m, b)
|
return xxx_messageInfo_ExtendMsg.Unmarshal(m, b)
|
||||||
@ -1667,6 +1667,8 @@ func (m *ExtendMsg) GetEx() string {
|
|||||||
|
|
||||||
type KeyValueResp struct {
|
type KeyValueResp struct {
|
||||||
KeyValue *sdkws.KeyValue `protobuf:"bytes,1,opt,name=keyValue" json:"keyValue,omitempty"`
|
KeyValue *sdkws.KeyValue `protobuf:"bytes,1,opt,name=keyValue" json:"keyValue,omitempty"`
|
||||||
|
ErrCode int32 `protobuf:"varint,2,opt,name=errCode" json:"errCode,omitempty"`
|
||||||
|
ErrMsg string `protobuf:"bytes,3,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@ -1676,7 +1678,7 @@ func (m *KeyValueResp) Reset() { *m = KeyValueResp{} }
|
|||||||
func (m *KeyValueResp) String() string { return proto.CompactTextString(m) }
|
func (m *KeyValueResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*KeyValueResp) ProtoMessage() {}
|
func (*KeyValueResp) ProtoMessage() {}
|
||||||
func (*KeyValueResp) Descriptor() ([]byte, []int) {
|
func (*KeyValueResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{33}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{33}
|
||||||
}
|
}
|
||||||
func (m *KeyValueResp) XXX_Unmarshal(b []byte) error {
|
func (m *KeyValueResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_KeyValueResp.Unmarshal(m, b)
|
return xxx_messageInfo_KeyValueResp.Unmarshal(m, b)
|
||||||
@ -1703,9 +1705,24 @@ func (m *KeyValueResp) GetKeyValue() *sdkws.KeyValue {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *KeyValueResp) GetErrCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *KeyValueResp) GetErrMsg() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrMsg
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type MsgDataToModifyByMQ struct {
|
type MsgDataToModifyByMQ struct {
|
||||||
Messages []*MsgDataToMQ `protobuf:"bytes,1,rep,name=messages" json:"messages,omitempty"`
|
Messages []*MsgDataToMQ `protobuf:"bytes,1,rep,name=messages" json:"messages,omitempty"`
|
||||||
TriggerID string `protobuf:"bytes,2,opt,name=triggerID" json:"triggerID,omitempty"`
|
TriggerID string `protobuf:"bytes,2,opt,name=triggerID" json:"triggerID,omitempty"`
|
||||||
|
AggregationID string `protobuf:"bytes,3,opt,name=aggregationID" json:"aggregationID,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@ -1715,7 +1732,7 @@ func (m *MsgDataToModifyByMQ) Reset() { *m = MsgDataToModifyByMQ{} }
|
|||||||
func (m *MsgDataToModifyByMQ) String() string { return proto.CompactTextString(m) }
|
func (m *MsgDataToModifyByMQ) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgDataToModifyByMQ) ProtoMessage() {}
|
func (*MsgDataToModifyByMQ) ProtoMessage() {}
|
||||||
func (*MsgDataToModifyByMQ) Descriptor() ([]byte, []int) {
|
func (*MsgDataToModifyByMQ) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{34}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{34}
|
||||||
}
|
}
|
||||||
func (m *MsgDataToModifyByMQ) XXX_Unmarshal(b []byte) error {
|
func (m *MsgDataToModifyByMQ) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgDataToModifyByMQ.Unmarshal(m, b)
|
return xxx_messageInfo_MsgDataToModifyByMQ.Unmarshal(m, b)
|
||||||
@ -1749,6 +1766,13 @@ func (m *MsgDataToModifyByMQ) GetTriggerID() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MsgDataToModifyByMQ) GetAggregationID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.AggregationID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type DelMsgsReq struct {
|
type DelMsgsReq struct {
|
||||||
UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"`
|
UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"`
|
||||||
Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs" json:"seqs,omitempty"`
|
Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs" json:"seqs,omitempty"`
|
||||||
@ -1761,7 +1785,7 @@ func (m *DelMsgsReq) Reset() { *m = DelMsgsReq{} }
|
|||||||
func (m *DelMsgsReq) String() string { return proto.CompactTextString(m) }
|
func (m *DelMsgsReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DelMsgsReq) ProtoMessage() {}
|
func (*DelMsgsReq) ProtoMessage() {}
|
||||||
func (*DelMsgsReq) Descriptor() ([]byte, []int) {
|
func (*DelMsgsReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{35}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{35}
|
||||||
}
|
}
|
||||||
func (m *DelMsgsReq) XXX_Unmarshal(b []byte) error {
|
func (m *DelMsgsReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DelMsgsReq.Unmarshal(m, b)
|
return xxx_messageInfo_DelMsgsReq.Unmarshal(m, b)
|
||||||
@ -1805,7 +1829,7 @@ func (m *DelMsgsResp) Reset() { *m = DelMsgsResp{} }
|
|||||||
func (m *DelMsgsResp) String() string { return proto.CompactTextString(m) }
|
func (m *DelMsgsResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DelMsgsResp) ProtoMessage() {}
|
func (*DelMsgsResp) ProtoMessage() {}
|
||||||
func (*DelMsgsResp) Descriptor() ([]byte, []int) {
|
func (*DelMsgsResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_msg_ac49bd168f1c55a0, []int{36}
|
return fileDescriptor_msg_fadfaac491b17a8b, []int{36}
|
||||||
}
|
}
|
||||||
func (m *DelMsgsResp) XXX_Unmarshal(b []byte) error {
|
func (m *DelMsgsResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DelMsgsResp.Unmarshal(m, b)
|
return xxx_messageInfo_DelMsgsResp.Unmarshal(m, b)
|
||||||
@ -2323,100 +2347,102 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
|||||||
Metadata: "msg/msg.proto",
|
Metadata: "msg/msg.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_ac49bd168f1c55a0) }
|
func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_fadfaac491b17a8b) }
|
||||||
|
|
||||||
var fileDescriptor_msg_ac49bd168f1c55a0 = []byte{
|
var fileDescriptor_msg_fadfaac491b17a8b = []byte{
|
||||||
// 1466 bytes of a gzipped FileDescriptorProto
|
// 1497 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xdd, 0x72, 0xdb, 0xc4,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xdd, 0x72, 0xdb, 0x44,
|
||||||
0x17, 0x1f, 0xd9, 0x4e, 0x62, 0x1f, 0x37, 0x4d, 0xba, 0xc9, 0xbf, 0x7f, 0x57, 0x84, 0xa9, 0xab,
|
0x14, 0x1e, 0xd9, 0xf9, 0xf3, 0x71, 0xd3, 0xa4, 0x9b, 0x50, 0x5c, 0x11, 0xa6, 0xee, 0xb6, 0x69,
|
||||||
0x36, 0xad, 0x3b, 0x24, 0xce, 0x4c, 0x60, 0xa0, 0x50, 0x98, 0xb6, 0xc1, 0xc5, 0x64, 0x8a, 0x68,
|
0xd3, 0x21, 0x71, 0x66, 0x02, 0x03, 0xe5, 0x6f, 0xda, 0xa6, 0x2e, 0x26, 0x53, 0x44, 0x5b, 0xb9,
|
||||||
0x2b, 0x97, 0x96, 0x81, 0x2b, 0x35, 0x5e, 0xab, 0x22, 0xb2, 0xb4, 0xd1, 0x91, 0xdb, 0xf8, 0x9a,
|
0xb4, 0x0c, 0x5c, 0xa9, 0xf1, 0x46, 0x15, 0x91, 0xa5, 0x8d, 0x8e, 0xdc, 0xc6, 0xd7, 0x5c, 0x70,
|
||||||
0x07, 0xe0, 0x15, 0x78, 0x09, 0x2e, 0x18, 0x2e, 0x79, 0x00, 0x78, 0x0c, 0x1e, 0x83, 0xd9, 0xd5,
|
0xc9, 0x2b, 0xf0, 0x12, 0x5c, 0x30, 0x5c, 0xf2, 0x00, 0xf0, 0x18, 0x3c, 0x06, 0xb3, 0xab, 0x95,
|
||||||
0x4a, 0x96, 0x2c, 0xc9, 0x76, 0x86, 0x66, 0x86, 0x0b, 0xee, 0x74, 0x76, 0x7f, 0xe7, 0xfb, 0x43,
|
0x2c, 0x59, 0x92, 0xed, 0x0c, 0xed, 0x0c, 0x17, 0xdc, 0xe9, 0xec, 0x7e, 0xe7, 0x67, 0xcf, 0x9f,
|
||||||
0xbb, 0x0b, 0xab, 0x43, 0xb4, 0xf6, 0x86, 0x68, 0xb5, 0x99, 0xef, 0x05, 0x1e, 0x29, 0x0f, 0xd1,
|
0x76, 0x0f, 0x2c, 0xf7, 0xd1, 0xde, 0xed, 0xa3, 0xdd, 0xe2, 0x81, 0x1f, 0xfa, 0xa4, 0xda, 0x47,
|
||||||
0x52, 0x6f, 0x3d, 0x66, 0xd4, 0xdd, 0x3d, 0xd4, 0x77, 0x7b, 0xd4, 0x7f, 0x4d, 0xfd, 0x3d, 0x76,
|
0x5b, 0xbf, 0xf1, 0x90, 0x33, 0x6f, 0xe7, 0xc0, 0xd8, 0xe9, 0xb2, 0xe0, 0x25, 0x0b, 0x76, 0xf9,
|
||||||
0x6c, 0xed, 0x89, 0xed, 0x3d, 0xec, 0x1f, 0xbf, 0xc1, 0xbd, 0x37, 0x18, 0xa2, 0xd5, 0xdd, 0x79,
|
0xb1, 0xbd, 0x2b, 0xb7, 0x77, 0xb1, 0x77, 0xfc, 0x0a, 0x77, 0x5f, 0x61, 0x84, 0xd6, 0x77, 0xa6,
|
||||||
0x40, 0xdf, 0x64, 0x8c, 0xfa, 0x12, 0xae, 0xe9, 0x50, 0xd7, 0xd1, 0xea, 0x98, 0x81, 0xf9, 0xcc,
|
0x01, 0x03, 0x8b, 0x73, 0x16, 0x28, 0x38, 0x35, 0xa0, 0x6e, 0xa0, 0xdd, 0xb6, 0x42, 0xeb, 0x89,
|
||||||
0xd3, 0x9f, 0x92, 0x4d, 0x58, 0x0a, 0xbc, 0x63, 0xea, 0x36, 0x94, 0xa6, 0xd2, 0xaa, 0x19, 0x21,
|
0x6f, 0x3c, 0x26, 0xeb, 0x30, 0x1f, 0xfa, 0xc7, 0xcc, 0x6b, 0x68, 0x4d, 0x6d, 0xab, 0x66, 0x46,
|
||||||
0x41, 0x5a, 0xb0, 0x32, 0x0c, 0x41, 0x8d, 0x52, 0x53, 0x69, 0xd5, 0xf7, 0x2f, 0xb6, 0x85, 0xb0,
|
0x04, 0xd9, 0x82, 0xc5, 0x7e, 0x04, 0x6a, 0x54, 0x9a, 0xda, 0x56, 0x7d, 0xef, 0x7c, 0x4b, 0x0a,
|
||||||
0xb6, 0x64, 0x35, 0xa2, 0x6d, 0xed, 0xa3, 0x84, 0xb8, 0xce, 0x41, 0x92, 0x51, 0x99, 0xcd, 0xf8,
|
0x6b, 0x29, 0x56, 0x33, 0xde, 0xa6, 0x1f, 0xa5, 0xc4, 0xb5, 0xf7, 0xd3, 0x8c, 0xda, 0x64, 0xc6,
|
||||||
0x02, 0xd6, 0x9e, 0x8c, 0xf0, 0x55, 0xd2, 0x96, 0x85, 0x99, 0x89, 0x0a, 0x55, 0xf4, 0x46, 0xfe,
|
0x67, 0xb0, 0xf2, 0x68, 0x80, 0x2f, 0xd2, 0xb6, 0xcc, 0xcc, 0x4c, 0x74, 0x58, 0x42, 0x7f, 0x10,
|
||||||
0x11, 0x3d, 0xec, 0x08, 0x03, 0x6b, 0x46, 0x4c, 0x6b, 0x3f, 0x2b, 0x40, 0x26, 0x52, 0x3d, 0xd7,
|
0x1c, 0xb2, 0x83, 0xb6, 0x34, 0xb0, 0x66, 0x26, 0x34, 0xfd, 0x45, 0x03, 0x32, 0x92, 0xea, 0x7b,
|
||||||
0xf2, 0x0e, 0xc6, 0xfa, 0x53, 0xd2, 0x80, 0x15, 0xc7, 0xc4, 0xa0, 0x47, 0x4f, 0x84, 0xf0, 0xb2,
|
0xb6, 0xbf, 0x3f, 0x34, 0x1e, 0x93, 0x06, 0x2c, 0xba, 0x16, 0x86, 0x5d, 0x76, 0x22, 0x85, 0x57,
|
||||||
0x11, 0x91, 0xe4, 0x06, 0xac, 0x9a, 0x96, 0xe5, 0x53, 0xcb, 0x0c, 0x6c, 0xcf, 0x8d, 0x25, 0xa6,
|
0xcd, 0x98, 0x24, 0xd7, 0x60, 0xd9, 0xb2, 0xed, 0x80, 0xd9, 0x56, 0xe8, 0xf8, 0x5e, 0x22, 0x31,
|
||||||
0x17, 0xc9, 0x0e, 0x54, 0x87, 0x14, 0xd1, 0xb4, 0x28, 0x36, 0xca, 0xcd, 0x72, 0xab, 0xbe, 0xbf,
|
0xbb, 0x48, 0xb6, 0x61, 0xa9, 0xcf, 0x10, 0x2d, 0x9b, 0x61, 0xa3, 0xda, 0xac, 0x6e, 0xd5, 0xf7,
|
||||||
0xde, 0xe6, 0x29, 0x4b, 0x38, 0x60, 0xc4, 0x08, 0xb2, 0x05, 0xb5, 0xc0, 0xb7, 0x2d, 0x8b, 0xfa,
|
0x56, 0x5b, 0x22, 0x64, 0xa9, 0x03, 0x98, 0x09, 0x82, 0x6c, 0x40, 0x2d, 0x0c, 0x1c, 0xdb, 0x66,
|
||||||
0x87, 0x9d, 0x46, 0x45, 0xc8, 0x9b, 0x2c, 0x68, 0x3b, 0x40, 0xba, 0x34, 0xd0, 0xcd, 0xd3, 0x07,
|
0xc1, 0x41, 0xbb, 0x31, 0x27, 0xe5, 0x8d, 0x16, 0xe8, 0x36, 0x90, 0x0e, 0x0b, 0x0d, 0xeb, 0xf4,
|
||||||
0x6e, 0x5f, 0xb7, 0xdd, 0x1e, 0x3d, 0x31, 0xe8, 0x09, 0xb9, 0x0c, 0xcb, 0xdf, 0xa0, 0x60, 0x08,
|
0xae, 0xd7, 0x33, 0x1c, 0xaf, 0xcb, 0x4e, 0x4c, 0x76, 0x42, 0x2e, 0xc2, 0xc2, 0x37, 0x28, 0x19,
|
||||||
0x73, 0x21, 0x29, 0xed, 0x21, 0x6c, 0x64, 0xd0, 0xc8, 0x38, 0x5c, 0x37, 0x4f, 0x27, 0xfe, 0x48,
|
0xa2, 0x58, 0x28, 0x8a, 0xde, 0x87, 0xb5, 0x1c, 0x1a, 0xb9, 0x80, 0x1b, 0xd6, 0xe9, 0xe8, 0x3c,
|
||||||
0x4a, 0xac, 0x0b, 0x94, 0xf0, 0x83, 0xaf, 0x0b, 0x4a, 0xfb, 0x10, 0xa0, 0x47, 0xdd, 0xbe, 0x8e,
|
0x8a, 0x92, 0xeb, 0x12, 0x25, 0xcf, 0x21, 0xd6, 0x25, 0x45, 0x3f, 0x04, 0xe8, 0x32, 0xaf, 0x67,
|
||||||
0x16, 0x57, 0x96, 0x88, 0x75, 0x79, 0x76, 0xa2, 0x86, 0x50, 0x8f, 0xf9, 0x90, 0x91, 0x26, 0xd4,
|
0xa0, 0x2d, 0x94, 0xa5, 0x7c, 0x5d, 0x9d, 0x1c, 0xa8, 0x3e, 0xd4, 0x13, 0x3e, 0xe4, 0xa4, 0x09,
|
||||||
0x51, 0x14, 0x9a, 0x8e, 0x56, 0x6c, 0x6a, 0x72, 0x89, 0x23, 0x8e, 0x1c, 0x9b, 0xba, 0x41, 0x88,
|
0x75, 0x94, 0x89, 0x66, 0xa0, 0x9d, 0x98, 0x9a, 0x5e, 0x12, 0x88, 0x43, 0xd7, 0x61, 0x5e, 0x18,
|
||||||
0x08, 0xa3, 0x99, 0x5c, 0x12, 0xe9, 0xa3, 0x6e, 0xff, 0x99, 0x3d, 0xa4, 0x42, 0x7b, 0xd9, 0x88,
|
0x21, 0x22, 0x6f, 0xa6, 0x97, 0x64, 0xf8, 0x98, 0xd7, 0x7b, 0xe2, 0xf4, 0x99, 0xd4, 0x5e, 0x35,
|
||||||
0x69, 0x6d, 0x1b, 0xea, 0x9f, 0x3b, 0xd4, 0xf4, 0xa5, 0x9d, 0x97, 0x61, 0x79, 0x94, 0x0a, 0x4a,
|
0x13, 0x9a, 0x6e, 0x42, 0xfd, 0x9e, 0xcb, 0xac, 0x40, 0xd9, 0x79, 0x11, 0x16, 0x06, 0x19, 0xa7,
|
||||||
0x48, 0x69, 0x17, 0xe1, 0xc2, 0x04, 0x86, 0x4c, 0xfb, 0x1e, 0xd6, 0x7a, 0x94, 0x8b, 0x4f, 0xc5,
|
0x44, 0x14, 0x3d, 0x0f, 0xe7, 0x46, 0x30, 0xe4, 0xf4, 0x7b, 0x58, 0xe9, 0x32, 0x21, 0x3e, 0xe3,
|
||||||
0x33, 0x8f, 0x95, 0x57, 0x82, 0xe5, 0x7b, 0x23, 0x16, 0xdb, 0x16, 0x91, 0x9c, 0x63, 0x18, 0x86,
|
0xcf, 0x22, 0x56, 0x91, 0x09, 0x76, 0xe0, 0x0f, 0x78, 0x62, 0x5b, 0x4c, 0x0a, 0x8e, 0x7e, 0xe4,
|
||||||
0x8e, 0x5b, 0xb5, 0x6a, 0x48, 0x4a, 0x23, 0xb0, 0x9e, 0x16, 0x8e, 0x4c, 0xdb, 0x85, 0x8d, 0x1e,
|
0x3a, 0x61, 0xd5, 0xb2, 0xa9, 0x28, 0x4a, 0x60, 0x35, 0x2b, 0x1c, 0x39, 0xdd, 0x81, 0xb5, 0x2e,
|
||||||
0x0d, 0x64, 0x64, 0x7a, 0x81, 0x19, 0x8c, 0x50, 0x2a, 0x45, 0x41, 0x08, 0xa5, 0x4b, 0x86, 0xa4,
|
0x0b, 0x95, 0x67, 0xba, 0xa1, 0x15, 0x0e, 0x50, 0x29, 0x45, 0x49, 0x48, 0xa5, 0xf3, 0xa6, 0xa2,
|
||||||
0xb4, 0xcb, 0xb0, 0x99, 0x85, 0x23, 0xd3, 0xfe, 0x27, 0x92, 0x3b, 0x2d, 0x46, 0x6b, 0xc3, 0x66,
|
0xe8, 0x45, 0x58, 0xcf, 0xc3, 0x91, 0xd3, 0xb7, 0x64, 0x70, 0xc7, 0xc5, 0xd0, 0x16, 0xac, 0x77,
|
||||||
0x37, 0x07, 0x5e, 0x28, 0xbe, 0x0b, 0x1b, 0x1d, 0xea, 0xf4, 0x46, 0x8c, 0xfa, 0x5d, 0xee, 0xcc,
|
0x0a, 0xe0, 0xa5, 0xe2, 0x3b, 0xb0, 0xd6, 0x66, 0x6e, 0x77, 0xc0, 0x59, 0xd0, 0x11, 0x87, 0x99,
|
||||||
0xec, 0xe8, 0x15, 0x87, 0x80, 0xdb, 0x99, 0x15, 0x84, 0x4c, 0x7b, 0x10, 0xda, 0x39, 0xad, 0x60,
|
0xec, 0xbd, 0x72, 0x17, 0x08, 0x3b, 0xf3, 0x82, 0x90, 0xd3, 0xbb, 0x91, 0x9d, 0xe3, 0x0a, 0x56,
|
||||||
0x1d, 0xca, 0x93, 0x0a, 0xe4, 0x9f, 0x33, 0x44, 0xdf, 0x0f, 0x7d, 0x9a, 0x16, 0x7d, 0x86, 0x99,
|
0xa1, 0x3a, 0xca, 0x40, 0xf1, 0x39, 0x41, 0xf4, 0x9d, 0xe8, 0x4c, 0xe3, 0xa2, 0xcf, 0xd0, 0x33,
|
||||||
0x71, 0x53, 0xf4, 0xcd, 0x0b, 0xdf, 0x0e, 0x68, 0xc7, 0x1e, 0x0c, 0x8a, 0x6c, 0xd0, 0xee, 0x09,
|
0xae, 0xcb, 0xba, 0x79, 0x16, 0x38, 0x21, 0x6b, 0x3b, 0x47, 0x47, 0x65, 0x36, 0xd0, 0xdb, 0xd2,
|
||||||
0x63, 0xd3, 0xb8, 0xb4, 0xa2, 0x39, 0x53, 0xed, 0xb7, 0x0a, 0x68, 0xba, 0xd7, 0xb7, 0x07, 0x63,
|
0xd8, 0x2c, 0x2e, 0xab, 0x68, 0x4a, 0x57, 0xfb, 0x7d, 0x0e, 0xa8, 0xe1, 0xf7, 0x9c, 0xa3, 0xa1,
|
||||||
0x3d, 0xec, 0x68, 0x83, 0x9a, 0x47, 0x7c, 0x10, 0x3c, 0x3c, 0x0d, 0xa8, 0x8b, 0xb6, 0xe7, 0x8a,
|
0x11, 0x55, 0xb4, 0xc9, 0xac, 0x43, 0xd1, 0x08, 0xee, 0x9f, 0x86, 0xcc, 0x43, 0xc7, 0xf7, 0x64,
|
||||||
0x64, 0x27, 0xc7, 0x90, 0x92, 0x1e, 0x43, 0x61, 0x9f, 0x20, 0x87, 0x3e, 0x1b, 0x33, 0x2a, 0x14,
|
0xb0, 0xd3, 0x6d, 0x48, 0xcb, 0xb6, 0xa1, 0xa8, 0x4e, 0x50, 0x40, 0x9f, 0x0c, 0x39, 0x93, 0x0a,
|
||||||
0x2e, 0x19, 0xc9, 0x25, 0xe2, 0x01, 0xf1, 0x33, 0x62, 0xe5, 0x6c, 0xb9, 0x17, 0xce, 0x96, 0xb9,
|
0xe7, 0xcd, 0xf4, 0x12, 0xf1, 0x81, 0x04, 0x39, 0xb1, 0xaa, 0xb7, 0xdc, 0x8e, 0x7a, 0xcb, 0x54,
|
||||||
0x26, 0xb4, 0xb3, 0xab, 0x0f, 0xdd, 0xc0, 0x1f, 0x1b, 0x39, 0xa2, 0xa7, 0x1b, 0xb3, 0x92, 0x6d,
|
0x13, 0x5a, 0xf9, 0xd5, 0xfb, 0x5e, 0x18, 0x0c, 0xcd, 0x02, 0xd1, 0xe3, 0x85, 0x39, 0x97, 0x2f,
|
||||||
0xcc, 0x1d, 0x28, 0xd1, 0xd3, 0xc6, 0x92, 0x08, 0xce, 0x56, 0xdb, 0xf2, 0x3c, 0xcb, 0xa1, 0xe1,
|
0xcc, 0x6d, 0xa8, 0xb0, 0xd3, 0xc6, 0xbc, 0x74, 0xce, 0x46, 0xcb, 0xf6, 0x7d, 0xdb, 0x65, 0xd1,
|
||||||
0x7f, 0xe3, 0xe5, 0x68, 0xd0, 0xee, 0x05, 0xbe, 0xed, 0x5a, 0xcf, 0x4d, 0x67, 0x44, 0x8d, 0x12,
|
0x7f, 0xe3, 0xf9, 0xe0, 0xa8, 0xd5, 0x0d, 0x03, 0xc7, 0xb3, 0x9f, 0x5a, 0xee, 0x80, 0x99, 0x15,
|
||||||
0x3d, 0x25, 0xf7, 0xe1, 0x82, 0x19, 0x04, 0xe6, 0xd1, 0x2b, 0xda, 0x3f, 0x74, 0x07, 0x5e, 0x63,
|
0x76, 0x4a, 0xee, 0xc0, 0x39, 0x2b, 0x0c, 0xad, 0xc3, 0x17, 0xac, 0x77, 0xe0, 0x1d, 0xf9, 0x8d,
|
||||||
0x79, 0x01, 0xbe, 0x14, 0x07, 0x2f, 0x16, 0x1b, 0x85, 0x0b, 0x8d, 0x95, 0xa6, 0xd2, 0xaa, 0x1a,
|
0x85, 0x19, 0xf8, 0x32, 0x1c, 0x22, 0x59, 0x1c, 0x94, 0x47, 0x68, 0x2c, 0x36, 0xb5, 0xad, 0x25,
|
||||||
0x11, 0x49, 0xf6, 0x61, 0xd3, 0x46, 0x6e, 0xbb, 0xef, 0x9a, 0x4e, 0x22, 0x3c, 0x55, 0x01, 0xcb,
|
0x33, 0x26, 0xc9, 0x1e, 0xac, 0x3b, 0x28, 0x6c, 0x0f, 0x3c, 0xcb, 0x4d, 0xb9, 0x67, 0x49, 0xc2,
|
||||||
0xdd, 0x23, 0x6d, 0x20, 0x43, 0xb4, 0xbe, 0xb0, 0x7d, 0x0c, 0xc2, 0xc8, 0x89, 0x01, 0x53, 0x13,
|
0x0a, 0xf7, 0x48, 0x0b, 0x48, 0x1f, 0xed, 0x2f, 0x9c, 0x00, 0xc3, 0xc8, 0x73, 0xb2, 0xc1, 0xd4,
|
||||||
0x75, 0x91, 0xb3, 0xa3, 0x3e, 0x87, 0xff, 0x17, 0x84, 0x8f, 0xd7, 0xd4, 0x31, 0x1d, 0xcb, 0xa4,
|
0x64, 0x5e, 0x14, 0xec, 0xe8, 0x4f, 0xe1, 0xed, 0x12, 0xf7, 0x89, 0x9c, 0x3a, 0x66, 0x43, 0x15,
|
||||||
0xf2, 0x4f, 0xb2, 0x0d, 0x4b, 0xaf, 0xb9, 0x07, 0xb2, 0x74, 0xd6, 0x64, 0xe9, 0x3c, 0xa2, 0xe3,
|
0x54, 0xf1, 0x49, 0x36, 0x61, 0xfe, 0xa5, 0x38, 0x81, 0x4a, 0x9d, 0x15, 0x95, 0x3a, 0x0f, 0xd8,
|
||||||
0xd0, 0xb1, 0x70, 0xf7, 0x93, 0xd2, 0x1d, 0x45, 0xfb, 0xa5, 0x02, 0x57, 0xf9, 0xbc, 0x38, 0xbf,
|
0x30, 0x3a, 0x58, 0xb4, 0xfb, 0x49, 0xe5, 0x96, 0x46, 0x7f, 0x9d, 0x83, 0xcb, 0xa2, 0x5f, 0xbc,
|
||||||
0xd2, 0x71, 0x66, 0x94, 0xce, 0xa7, 0xa2, 0x74, 0xe6, 0xe8, 0xff, 0xaf, 0x6e, 0xfe, 0x85, 0x75,
|
0xb9, 0xd4, 0x71, 0x27, 0xa4, 0xce, 0x67, 0x32, 0x75, 0xa6, 0xe8, 0xff, 0x3f, 0x6f, 0xfe, 0x83,
|
||||||
0xf3, 0xab, 0x02, 0xcd, 0xd9, 0x79, 0x0b, 0xff, 0xbf, 0xc9, 0x64, 0x28, 0xd9, 0x64, 0xe4, 0xbb,
|
0x79, 0xf3, 0x9b, 0x06, 0xcd, 0xc9, 0x71, 0x8b, 0xfe, 0xbf, 0xe9, 0x60, 0x68, 0xf9, 0x60, 0x14,
|
||||||
0x53, 0x2a, 0x72, 0x27, 0x19, 0xcc, 0x72, 0x3a, 0x98, 0xb7, 0x61, 0xd9, 0xa7, 0x38, 0x72, 0x82,
|
0x1f, 0xa7, 0x52, 0x76, 0x9c, 0xb4, 0x33, 0xab, 0x59, 0x67, 0xde, 0x84, 0x85, 0x80, 0xe1, 0xc0,
|
||||||
0x46, 0x45, 0x94, 0xd6, 0x25, 0x51, 0x5a, 0xb1, 0xe9, 0x14, 0x99, 0x21, 0x01, 0xda, 0x9f, 0x25,
|
0x0d, 0x1b, 0x73, 0x32, 0xb5, 0x2e, 0xc8, 0xd4, 0x4a, 0x4c, 0x67, 0xc8, 0x4d, 0x05, 0xa0, 0x7f,
|
||||||
0x68, 0x76, 0x63, 0xdb, 0xf1, 0x3c, 0x8a, 0xfe, 0x07, 0xd8, 0x18, 0xa6, 0x43, 0xf3, 0x88, 0x8e,
|
0x55, 0xa0, 0xd9, 0x49, 0x6c, 0xc7, 0x37, 0x91, 0xf4, 0x3f, 0xc0, 0x5a, 0x3f, 0xeb, 0x9a, 0x07,
|
||||||
0xa3, 0xaa, 0xbf, 0x23, 0x4c, 0x9b, 0x67, 0x41, 0x5b, 0xcf, 0x08, 0x30, 0xf2, 0x84, 0x72, 0x4b,
|
0x6c, 0x18, 0x67, 0xfd, 0x2d, 0x69, 0xda, 0x34, 0x0b, 0x5a, 0x46, 0x4e, 0x80, 0x59, 0x24, 0x54,
|
||||||
0xb9, 0x4e, 0xa1, 0x80, 0xfb, 0x5e, 0x33, 0x62, 0x5a, 0x1d, 0x00, 0xc9, 0x8a, 0x79, 0xfb, 0x79,
|
0x58, 0x2a, 0x74, 0x4a, 0x05, 0xe2, 0xec, 0x35, 0x33, 0xa1, 0xf5, 0x23, 0x20, 0x79, 0x31, 0xaf,
|
||||||
0xd1, 0x4e, 0xe1, 0xda, 0x1c, 0x7f, 0x90, 0x91, 0x1e, 0x6c, 0xa0, 0xed, 0x5a, 0x0e, 0x8d, 0x4d,
|
0x3f, 0x2e, 0xf4, 0x14, 0xae, 0x4c, 0x39, 0x0f, 0x72, 0xd2, 0x85, 0x35, 0x74, 0x3c, 0xdb, 0x65,
|
||||||
0x12, 0xf9, 0x52, 0x44, 0x50, 0xae, 0x85, 0xa3, 0x20, 0xb9, 0x1f, 0xb3, 0x87, 0x40, 0x23, 0x8f,
|
0x89, 0x49, 0x32, 0x5e, 0x9a, 0x74, 0xca, 0x95, 0xa8, 0x15, 0xa4, 0xf7, 0x13, 0xf6, 0x08, 0x68,
|
||||||
0x5b, 0xfb, 0xb1, 0x04, 0x5b, 0xb3, 0xb8, 0x88, 0x9d, 0x3b, 0x7f, 0x42, 0xa5, 0x1f, 0xcf, 0x55,
|
0x16, 0x71, 0xd3, 0x1f, 0x2b, 0xb0, 0x31, 0x89, 0x8b, 0x38, 0x85, 0xfd, 0x27, 0x52, 0xfa, 0xf1,
|
||||||
0xfa, 0x4f, 0x86, 0x4f, 0xf6, 0x34, 0x79, 0x6e, 0xed, 0xf8, 0x93, 0x02, 0xd7, 0xe7, 0xfe, 0x81,
|
0x54, 0xa5, 0xff, 0xa6, 0xf9, 0xe4, 0x6f, 0x93, 0x6f, 0xac, 0x1c, 0x7f, 0xd6, 0xe0, 0xea, 0xd4,
|
||||||
0x91, 0x91, 0x0f, 0xa0, 0x8e, 0xa3, 0xa3, 0x23, 0x8a, 0xf8, 0x95, 0x8d, 0x51, 0xe8, 0x89, 0x88,
|
0x3f, 0x30, 0x72, 0xf2, 0x01, 0xd4, 0x71, 0x70, 0x78, 0xc8, 0x10, 0xbf, 0x72, 0x30, 0x76, 0x3d,
|
||||||
0x82, 0x40, 0x46, 0x47, 0x67, 0x23, 0x09, 0x23, 0xfb, 0x00, 0x03, 0xd3, 0x76, 0x68, 0x5f, 0x30,
|
0x91, 0x5e, 0x90, 0xc8, 0xf8, 0xea, 0x6c, 0xa6, 0x61, 0x64, 0x0f, 0xe0, 0xc8, 0x72, 0x5c, 0xd6,
|
||||||
0x95, 0x0a, 0x99, 0x12, 0x28, 0xed, 0xaf, 0x12, 0x5c, 0xef, 0x50, 0x87, 0x06, 0x74, 0x76, 0x9f,
|
0x93, 0x4c, 0x95, 0x52, 0xa6, 0x14, 0x8a, 0xfe, 0x5d, 0x81, 0xab, 0x6d, 0xe6, 0xb2, 0x90, 0x4d,
|
||||||
0x35, 0xa1, 0xee, 0x31, 0xea, 0x47, 0xf7, 0x19, 0x59, 0x8b, 0x89, 0x25, 0x5e, 0xdf, 0x1e, 0x93,
|
0xae, 0xb3, 0x26, 0xd4, 0x7d, 0xce, 0x82, 0xf8, 0x3d, 0xa3, 0x72, 0x31, 0xb5, 0x24, 0xf2, 0xdb,
|
||||||
0xb7, 0x0d, 0x79, 0x81, 0x8a, 0xe8, 0x54, 0x97, 0x96, 0x67, 0x77, 0x69, 0x25, 0xdb, 0xa5, 0x53,
|
0xe7, 0xea, 0xb5, 0xa1, 0x1e, 0x50, 0x31, 0x9d, 0xa9, 0xd2, 0xea, 0xe4, 0x2a, 0x9d, 0xcb, 0x57,
|
||||||
0xf9, 0x5a, 0xca, 0xf6, 0x41, 0xd1, 0x88, 0x5e, 0x3e, 0xf3, 0x88, 0x5e, 0x29, 0x9c, 0x69, 0xf7,
|
0xe9, 0x58, 0xbc, 0xe6, 0xf3, 0x75, 0x50, 0xd6, 0xa2, 0x17, 0xce, 0xdc, 0xa2, 0x17, 0x4b, 0x7b,
|
||||||
0x72, 0x0b, 0xb4, 0x2a, 0xa2, 0x9c, 0xc9, 0x79, 0x0e, 0x54, 0x7b, 0x0a, 0x37, 0xe6, 0x47, 0x1a,
|
0xda, 0xed, 0xc2, 0x04, 0x5d, 0x92, 0x5e, 0xce, 0xc5, 0xbc, 0x00, 0x4a, 0x1f, 0xc3, 0xb5, 0xe9,
|
||||||
0x59, 0x62, 0x44, 0x2a, 0xf3, 0x46, 0xe4, 0x67, 0xb0, 0x9a, 0x4a, 0x2d, 0xd9, 0x81, 0x1a, 0x8d,
|
0x9e, 0x46, 0x9e, 0x6a, 0x91, 0xda, 0xb4, 0x16, 0xf9, 0x39, 0x2c, 0x67, 0x42, 0x4b, 0xb6, 0xa1,
|
||||||
0x16, 0xe2, 0xa3, 0x6f, 0xba, 0x02, 0x26, 0x00, 0xed, 0xf7, 0x12, 0xd4, 0xe2, 0x0d, 0xf2, 0x7c,
|
0xc6, 0xe2, 0x85, 0xe4, 0xea, 0x9b, 0xcd, 0x80, 0x11, 0x80, 0xfe, 0x51, 0x81, 0x5a, 0xb2, 0x41,
|
||||||
0x46, 0x07, 0xde, 0x4c, 0x0b, 0x79, 0xbb, 0xed, 0x56, 0x90, 0x8a, 0x72, 0x61, 0x2a, 0xb4, 0xa9,
|
0x9e, 0x4e, 0xa8, 0xc0, 0xeb, 0x59, 0x21, 0xaf, 0xb7, 0xdc, 0x4a, 0x42, 0x51, 0x2d, 0x0d, 0x05,
|
||||||
0xbf, 0x7d, 0x78, 0x7c, 0x48, 0xff, 0xcf, 0x2f, 0xc6, 0xe7, 0x87, 0x1a, 0x3f, 0x21, 0xa8, 0xdf,
|
0x1d, 0xfb, 0xdb, 0x47, 0xd7, 0x87, 0xec, 0xff, 0xfc, 0x7c, 0x72, 0x7f, 0xa8, 0x89, 0x1b, 0x82,
|
||||||
0x9e, 0xa5, 0xa5, 0x6f, 0xa5, 0x5b, 0x3a, 0x27, 0x03, 0x89, 0xa6, 0xbe, 0x0b, 0x17, 0x92, 0x5b,
|
0xfe, 0xed, 0x59, 0x4a, 0xfa, 0x46, 0xb6, 0xa4, 0x0b, 0x22, 0x90, 0x2a, 0xea, 0x3e, 0x9c, 0x4b,
|
||||||
0xe4, 0x3d, 0xa8, 0x1e, 0x4b, 0x5a, 0xa6, 0x20, 0x53, 0x1e, 0x31, 0x40, 0x33, 0x61, 0x23, 0xf1,
|
0x6f, 0x91, 0xf7, 0x60, 0xe9, 0x58, 0xd1, 0x2a, 0x04, 0xb9, 0xf4, 0x48, 0x00, 0xe2, 0x4f, 0xc9,
|
||||||
0xb2, 0xc0, 0x3d, 0x14, 0x4f, 0x0b, 0xc9, 0xa7, 0x01, 0xe5, 0x6c, 0x4f, 0x03, 0xa5, 0xe9, 0xa7,
|
0x82, 0xe0, 0x9e, 0xdf, 0x8b, 0xff, 0x4f, 0x31, 0x29, 0x1e, 0x5a, 0x2c, 0x10, 0x8f, 0x51, 0x55,
|
||||||
0x81, 0x3b, 0x00, 0x1d, 0xea, 0xe8, 0x68, 0x61, 0xfa, 0xfe, 0x56, 0x4a, 0xdd, 0xdf, 0x08, 0x54,
|
0x31, 0x8a, 0xa2, 0x3f, 0x69, 0xb0, 0x96, 0x1a, 0x46, 0x08, 0xa7, 0xc8, 0x69, 0x44, 0x7a, 0x9a,
|
||||||
0x90, 0x9e, 0x84, 0xff, 0xbe, 0xb2, 0x21, 0xbe, 0xb5, 0x55, 0xa8, 0xc7, 0x9c, 0xc8, 0xf6, 0xff,
|
0xa0, 0x9d, 0x6d, 0x9a, 0x50, 0x19, 0x9b, 0x26, 0xe4, 0xe7, 0x17, 0xd5, 0x82, 0xf9, 0x05, 0xbd,
|
||||||
0x58, 0x81, 0xf2, 0x10, 0x2d, 0xf2, 0x25, 0xac, 0x4d, 0xbd, 0x1e, 0x90, 0x2b, 0xd2, 0xc3, 0xec,
|
0x05, 0xd0, 0x66, 0xae, 0x81, 0x36, 0x66, 0x1f, 0x86, 0x95, 0xcc, 0xc3, 0x90, 0xc0, 0x1c, 0xb2,
|
||||||
0x1b, 0x84, 0xaa, 0x16, 0x6d, 0x21, 0x23, 0x5f, 0xc3, 0xa5, 0x27, 0x23, 0xc7, 0x91, 0x0d, 0x71,
|
0x93, 0xe8, 0xa7, 0x5a, 0x35, 0xe5, 0x37, 0x5d, 0x86, 0x7a, 0xc2, 0x89, 0x7c, 0xef, 0xcf, 0x45,
|
||||||
0x30, 0xee, 0xd1, 0x13, 0x24, 0xef, 0x48, 0x86, 0xcc, 0x0e, 0x97, 0xb6, 0x55, 0xbc, 0x29, 0xca,
|
0xa8, 0xf6, 0xd1, 0x26, 0x5f, 0xc2, 0xca, 0xd8, 0x58, 0x82, 0x5c, 0x52, 0xae, 0xcb, 0x0f, 0x37,
|
||||||
0x7f, 0x45, 0x5e, 0x70, 0xc9, 0x9a, 0x3c, 0xb3, 0x46, 0xcf, 0x13, 0xea, 0x7a, 0x7a, 0x21, 0x44,
|
0x74, 0xbd, 0x6c, 0x0b, 0x39, 0xf9, 0x1a, 0x2e, 0x3c, 0x1a, 0xb8, 0xae, 0xaa, 0xb4, 0xfd, 0x61,
|
||||||
0x4b, 0xf7, 0x24, 0x7a, 0x12, 0x26, 0x89, 0x4e, 0x78, 0x4f, 0xba, 0xb0, 0x3e, 0x7d, 0x8d, 0x25,
|
0x97, 0x9d, 0x20, 0x79, 0x47, 0x31, 0xe4, 0x76, 0x84, 0xb4, 0x8d, 0xf2, 0x4d, 0x59, 0x57, 0x8b,
|
||||||
0x8d, 0x08, 0x35, 0x7d, 0x8b, 0x55, 0xaf, 0x14, 0xec, 0x20, 0x23, 0x7b, 0x50, 0x8d, 0xde, 0x19,
|
0xea, 0xe5, 0x4c, 0x56, 0xd4, 0x65, 0x38, 0x9e, 0x7b, 0xe8, 0xab, 0xd9, 0x85, 0x08, 0xad, 0x8e,
|
||||||
0x48, 0xa8, 0x26, 0xf1, 0x3a, 0xa1, 0x5e, 0x9a, 0x5a, 0x09, 0x35, 0x4f, 0x5f, 0xf4, 0xa5, 0xe6,
|
0xa7, 0xd0, 0x23, 0x37, 0x29, 0x74, 0xea, 0xf4, 0xa4, 0x03, 0xab, 0xe3, 0xef, 0x63, 0xd2, 0x88,
|
||||||
0x9c, 0xe7, 0x02, 0xa9, 0x39, 0xef, 0x65, 0x80, 0x0b, 0xea, 0xe6, 0x0b, 0xea, 0x16, 0x0a, 0xca,
|
0x51, 0xe3, 0xcf, 0x63, 0xfd, 0x52, 0xc9, 0x0e, 0x72, 0xb2, 0x0b, 0x4b, 0xf1, 0x00, 0x83, 0x44,
|
||||||
0x7d, 0x33, 0x38, 0x86, 0xad, 0x59, 0xa7, 0x4a, 0x72, 0x63, 0x91, 0x0b, 0x83, 0xba, 0xbd, 0x00,
|
0x6a, 0x52, 0x63, 0x0f, 0xfd, 0xc2, 0xd8, 0x4a, 0xa4, 0x79, 0x7c, 0x82, 0xa0, 0x34, 0x17, 0xcc,
|
||||||
0x0a, 0x19, 0x71, 0xe1, 0xdd, 0x99, 0x87, 0x16, 0xb2, 0xbd, 0xd0, 0x41, 0x4d, 0xbd, 0xb9, 0x08,
|
0x21, 0x94, 0xe6, 0xa2, 0x91, 0x83, 0x10, 0xd4, 0x29, 0x16, 0xd4, 0x29, 0x15, 0x54, 0x38, 0x8c,
|
||||||
0x0c, 0x19, 0x39, 0x81, 0xad, 0x07, 0xfd, 0x7e, 0xb1, 0x73, 0xb7, 0x16, 0xbc, 0x48, 0xab, 0xad,
|
0x38, 0x86, 0x8d, 0x49, 0xd7, 0x55, 0x72, 0x6d, 0x96, 0x97, 0x88, 0xbe, 0x39, 0x03, 0x0a, 0x39,
|
||||||
0xc5, 0x80, 0xc8, 0xc8, 0x6b, 0xb8, 0x9a, 0xfa, 0x35, 0xe4, 0x68, 0x6d, 0x45, 0x05, 0x35, 0xef,
|
0xf1, 0xe0, 0xdd, 0x89, 0xb7, 0x21, 0xb2, 0x39, 0xd3, 0x0d, 0x50, 0xbf, 0x3e, 0x0b, 0x0c, 0x39,
|
||||||
0x57, 0xad, 0xde, 0x5e, 0x10, 0x89, 0xec, 0x40, 0xfd, 0xae, 0xf1, 0x98, 0x51, 0xf7, 0x50, 0x4f,
|
0x39, 0x81, 0x8d, 0xbb, 0xbd, 0x5e, 0xf9, 0xe1, 0x6e, 0xcc, 0xf8, 0x42, 0xd7, 0xb7, 0x66, 0x03,
|
||||||
0x3c, 0xf1, 0x0e, 0xd1, 0xba, 0x3b, 0x44, 0xeb, 0xe5, 0xb2, 0x20, 0xdf, 0xff, 0x3b, 0x00, 0x00,
|
0x22, 0x27, 0x2f, 0xe1, 0x72, 0xe6, 0x9f, 0x53, 0xa0, 0x75, 0x2b, 0x4e, 0xa8, 0x69, 0x77, 0x00,
|
||||||
0xff, 0xff, 0x17, 0x99, 0x70, 0x0d, 0x4a, 0x16, 0x00, 0x00,
|
0xfd, 0xe6, 0x8c, 0x48, 0xe4, 0xfb, 0xfa, 0x77, 0x8d, 0x87, 0x9c, 0x79, 0x07, 0x46, 0x6a, 0x76,
|
||||||
|
0xdc, 0x47, 0xfb, 0xd3, 0x3e, 0xda, 0xcf, 0x17, 0x24, 0xf9, 0xfe, 0x3f, 0x01, 0x00, 0x00, 0xff,
|
||||||
|
0xff, 0x8e, 0xd0, 0xc6, 0xc7, 0xa3, 0x16, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -182,11 +182,14 @@ message ExtendMsg {
|
|||||||
|
|
||||||
message KeyValueResp {
|
message KeyValueResp {
|
||||||
sdkws.KeyValue keyValue = 1;
|
sdkws.KeyValue keyValue = 1;
|
||||||
|
int32 errCode = 2;
|
||||||
|
string errMsg = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MsgDataToModifyByMQ{
|
message MsgDataToModifyByMQ{
|
||||||
repeated MsgDataToMQ messages = 1;
|
repeated MsgDataToMQ messages = 1;
|
||||||
string triggerID = 2;
|
string triggerID = 2;
|
||||||
|
string aggregationID = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DelMsgsReq{
|
message DelMsgsReq{
|
||||||
|
@ -42,13 +42,13 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#check=$(ps aux | grep -w ./${cron_task_name} | grep -v grep | wc -l)
|
check=$(ps aux | grep -w ./${cron_task_name} | grep -v grep | wc -l)
|
||||||
#if [ $check -ge 1 ]; then
|
if [ $check -ge 1 ]; then
|
||||||
# echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImCronTask"${COLOR_SUFFIX}
|
echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImCronTask"${COLOR_SUFFIX}
|
||||||
#else
|
else
|
||||||
# echo -e ${RED_PREFIX}"cron_task_name service does not start normally"${COLOR_SUFFIX}
|
echo -e ${RED_PREFIX}"cron_task_name service does not start normally"${COLOR_SUFFIX}
|
||||||
# echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
|
echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
|
||||||
# exit -1
|
exit -1
|
||||||
#fi
|
fi
|
||||||
#
|
|
||||||
#echo -e ${YELLOW_PREFIX}"all services launch success"${COLOR_SUFFIX}
|
echo -e ${YELLOW_PREFIX}"all services launch success"${COLOR_SUFFIX}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user