diff --git a/cmd/msggateway/main.go b/cmd/msggateway/main.go index 0eb8adb1a..86de2dcc9 100644 --- a/cmd/msggateway/main.go +++ b/cmd/msggateway/main.go @@ -1,7 +1,7 @@ package main import ( - "Open_IM/internal/msg_gateway/gate" + "Open_IM/internal/msggateway" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" @@ -22,7 +22,7 @@ func main() { var wg sync.WaitGroup wg.Add(1) fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - gate.Init(*rpcPort, *wsPort) - gate.Run(*prometheusPort) + msggateway.Init(*rpcPort, *wsPort) + msggateway.Run(*prometheusPort) wg.Wait() } diff --git a/cmd/rpc/auth/main.go b/cmd/rpc/auth/main.go index 4881e1789..a89ff6845 100644 --- a/cmd/rpc/auth/main.go +++ b/cmd/rpc/auth/main.go @@ -1,26 +1,11 @@ package main import ( - rpcAuth "Open_IM/internal/rpc/auth" + "Open_IM/internal/rpc/auth" + "Open_IM/internal/startrpc" "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/prome" - "flag" - "fmt" ) func main() { - defaultPorts := config.Config.RpcPort.OpenImAuthPort - rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800") - prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.AuthPrometheusPort[0], "authPrometheusPort default listen port") - flag.Parse() - fmt.Println("start auth rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - rpcServer := rpcAuth.NewRpcAuthServer(*rpcPort) - go func() { - err := prome.StartPromeSrv(*prometheusPort) - if err != nil { - panic(err) - } - }() - rpcServer.Run() + startrpc.Start(config.Config.RpcPort.OpenImAuthPort, config.Config.RpcRegisterName.OpenImAuthName, config.Config.Prometheus.AuthPrometheusPort, auth.Start) } diff --git a/cmd/rpc/friend/main.go b/cmd/rpc/friend/main.go index 101ffa6ff..907ee7dbd 100644 --- a/cmd/rpc/friend/main.go +++ b/cmd/rpc/friend/main.go @@ -2,25 +2,10 @@ package main import ( "Open_IM/internal/rpc/friend" + "Open_IM/internal/startrpc" "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - prome "Open_IM/pkg/common/prometheus" - "flag" - "fmt" ) func main() { - defaultPorts := config.Config.RpcPort.OpenImFriendPort - rpcPort := flag.Int("port", defaultPorts[0], "get RpcFriendPort from cmd,default 12000 as port") - prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.FriendPrometheusPort[0], "friendPrometheusPort default listen port") - flag.Parse() - fmt.Println("start friend rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - rpcServer := friend.NewFriendServer(*rpcPort) - go func() { - err := prome.StartPromeSrv(*prometheusPort) - if err != nil { - panic(err) - } - }() - rpcServer.Run() + startrpc.Start(config.Config.RpcPort.OpenImFriendPort[0], config.Config.RpcRegisterName.OpenImFriendName, config.Config.Prometheus.FriendPrometheusPort[0], friend.Start) } diff --git a/cmd/rpc/group/main.go b/cmd/rpc/group/main.go index ad431fa16..89451b6ef 100644 --- a/cmd/rpc/group/main.go +++ b/cmd/rpc/group/main.go @@ -2,25 +2,10 @@ package main import ( "Open_IM/internal/rpc/group" + "Open_IM/internal/startrpc" "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - prome "Open_IM/pkg/common/prometheus" - "flag" - "fmt" ) func main() { - defaultPorts := config.Config.RpcPort.OpenImGroupPort - rpcPort := flag.Int("port", defaultPorts[0], "get RpcGroupPort from cmd,default 16000 as port") - prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.GroupPrometheusPort[0], "groupPrometheusPort default listen port") - flag.Parse() - fmt.Println("start group rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - rpcServer := group.NewGroupServer(*rpcPort) - go func() { - err := prome.StartPromeSrv(*prometheusPort) - if err != nil { - panic(err) - } - }() - rpcServer.Run() + startrpc.Start(config.Config.RpcPort.OpenImGroupPort, config.Config.RpcRegisterName.OpenImGroupName, config.Config.Prometheus.GroupPrometheusPort, group.Start) } diff --git a/cmd/rpc/msg/main.go b/cmd/rpc/msg/main.go index 52c4c0b2c..7900b1d4e 100644 --- a/cmd/rpc/msg/main.go +++ b/cmd/rpc/msg/main.go @@ -2,25 +2,10 @@ package main import ( "Open_IM/internal/rpc/msg" + "Open_IM/internal/startrpc" "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - prome "Open_IM/pkg/common/prometheus" - "flag" - "fmt" ) func main() { - defaultPorts := config.Config.RpcPort.OpenImMessagePort - rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port") - prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessagePrometheusPort[0], "msgPrometheusPort default listen port") - flag.Parse() - fmt.Println("start msg rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - rpcServer := msg.NewRpcChatServer(*rpcPort) - go func() { - err := prome.StartPromeSrv(*prometheusPort) - if err != nil { - panic(err) - } - }() - rpcServer.Run() + startrpc.Start(config.Config.RpcPort.OpenImMessagePort, config.Config.RpcRegisterName.OpenImMsgName, config.Config.Prometheus.AuthPrometheusPort, msg.Start) } diff --git a/cmd/rpc/user/main.go b/cmd/rpc/user/main.go index 952b2fbb2..331daa8f4 100644 --- a/cmd/rpc/user/main.go +++ b/cmd/rpc/user/main.go @@ -2,25 +2,12 @@ package main import ( "Open_IM/internal/rpc/user" + "Open_IM/internal/startrpc" "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - prome "Open_IM/pkg/common/prometheus" - "flag" - "fmt" ) func main() { - defaultPorts := config.Config.RpcPort.OpenImUserPort - rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port") - prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.UserPrometheusPort[0], "userPrometheusPort default listen port") - flag.Parse() - fmt.Println("start user rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - rpcServer := user.NewUserServer(*rpcPort) - go func() { - err := prome.StartPromeSrv(*prometheusPort) - if err != nil { - panic(err) - } - }() - rpcServer.Run() + + startrpc.Start(config.Config.RpcPort.OpenImUserPort[0], config.Config.RpcRegisterName.OpenImUserName, config.Config.Prometheus.UserPrometheusPort[0], user.Start) + } diff --git a/go.mod b/go.mod index ea7280cec..238c77914 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module Open_IM -go 1.16 +go 1.18 require ( firebase.google.com/go v3.13.0+incompatible @@ -41,7 +41,7 @@ require ( github.com/stretchr/testify v1.8.1 github.com/swaggo/files v0.0.0-20220610200504-28940afbdbfe github.com/swaggo/gin-swagger v1.5.0 - github.com/swaggo/swag v1.8.3 + github.com/swaggo/swag v1.8.3 // indirect github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca go.etcd.io/etcd/client/v3 v3.5.6 // indirect go.mongodb.org/mongo-driver v1.8.3 @@ -58,19 +58,108 @@ 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/KyleBanks/depth v1.2.1 // indirect + github.com/OpenIMSDK/open_log v1.0.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/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // 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-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/spec v0.20.6 // indirect github.com/go-openapi/swag v0.21.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/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/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/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/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/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.etcd.io/etcd/api/v3 v3.5.6 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.6 // indirect + go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.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 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 diff --git a/go.sum b/go.sum index f2231afbb..436b4f460 100644 --- a/go.sum +++ b/go.sum @@ -26,7 +26,6 @@ cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+Y cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= @@ -39,7 +38,6 @@ cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= -cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9jQmorivIiWcKg= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= @@ -82,7 +80,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw= -cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= @@ -145,7 +142,6 @@ cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4c cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= @@ -167,7 +163,6 @@ cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1 cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= @@ -195,7 +190,6 @@ cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZ cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= -cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= @@ -208,7 +202,6 @@ cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+ cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g= -cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= @@ -217,13 +210,11 @@ cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiP cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= -cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -272,9 +263,6 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcdcPRnFIRI= -cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= -cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= @@ -329,7 +317,6 @@ cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5 cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU= cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= -cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= @@ -370,7 +357,6 @@ cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E= cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g= -cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= @@ -397,7 +383,6 @@ github.com/OpenIMSDK/openKeeper v0.9.7 h1:oWPAsXAHpMpZh8NPB9B8FktVfxk1Ec8tQPdxhz github.com/OpenIMSDK/openKeeper v0.9.7/go.mod h1:RvyRXEcvWbonkmHLtT8KxGSCNlXY7OfDohhu53E6INU= github.com/OpenIMSDK/open_log v1.0.0 h1:ZQ908aWgPqfHOfkQ/oFSV20AZdRwPw+sZjC/sAPd5cA= github.com/OpenIMSDK/open_log v1.0.0/go.mod h1:qWvqF4iT2qBAP1eGGbinc0aAng1Y25X8A9Si1WS3oB4= -github.com/OpenIMSDK/open_utils v1.0.1/go.mod h1:PPRayByXnfu8PR5Xv9wzUMBrm1BV3y7s29GGg8ae47s= 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/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -464,7 +449,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.16.9/go.mod h1:O1IvkYxr+39hRf960Us6j github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0= github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -472,8 +456,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= @@ -529,9 +511,7 @@ github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/gzip v0.0.5 h1:mhnVU32YnnBh2LPH2iqRqsA/eR7SAqRaD388jL2s/j0= github.com/gin-contrib/gzip v0.0.5/go.mod h1:OPIK6HR0Um2vNmBUTlayD7qle4yVVRZT0PyhdUigrKk= @@ -539,7 +519,6 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= -github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gin-gonic/gin v1.8.2 h1:UzKToD9/PoFj/V4rvlKqTRKnQYyz8Sc1MJlv4JHPtvY= github.com/gin-gonic/gin v1.8.2/go.mod h1:qw5AYuDrzRTnhvusDsrov+fDIxp9Dleuu12h8nfB398= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -576,7 +555,6 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= @@ -586,11 +564,8 @@ github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfC github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-zookeeper/zk v1.0.3 h1:7M2kwOsc//9VeeFiPtf+uSJlVpU66x9Ba5+8XK7/TDg= github.com/go-zookeeper/zk v1.0.3/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= -github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -670,12 +645,10 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -708,7 +681,6 @@ github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2I github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= @@ -733,7 +705,6 @@ github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg= -github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -751,7 +722,6 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -785,8 +755,6 @@ github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -814,29 +782,17 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olivere/elastic/v7 v7.0.23 h1:b7tjMogDMhf2CisGI+L02LXLVa0ZyE82Z15XfW1e8t8= github.com/olivere/elastic/v7 v7.0.23/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= -github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A= @@ -893,7 +849,6 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -932,10 +887,7 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM= github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ugorji/go/codec v1.2.8 h1:sgBJS6COt0b/P40VouWKdseidkDgHxYGm0SAglUHfP0= github.com/ugorji/go/codec v1.2.8/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= @@ -956,15 +908,11 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= go.etcd.io/etcd/api/v3 v3.5.6 h1:Cy2qx3npLcYqTKqGJzMypnMv2tiRyifZJ17BlWIWA7A= go.etcd.io/etcd/api/v3 v3.5.6/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= -go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ= go.etcd.io/etcd/client/pkg/v3 v3.5.6 h1:TXQWYceBKqLp4sa87rcPs11SXxUA/mHwH975v+BDvLU= go.etcd.io/etcd/client/pkg/v3 v3.5.6/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ= -go.etcd.io/etcd/client/v3 v3.5.5/go.mod h1:aApjR4WGlSumpnJ2kloS75h6aHUmAyaPLjHMxpc7E7c= go.etcd.io/etcd/client/v3 v3.5.6 h1:coLs69PWCXE9G4FKquzNaSHrRyMCAXwF+IX1tAPVO8E= go.etcd.io/etcd/client/v3 v3.5.6/go.mod h1:f6GRinRMCsFVv9Ht42EyY7nfsVGwrNO0WEoS2pRKzQk= go.mongodb.org/mongo-driver v1.8.3 h1:TDKlTkGDKm9kkJVUOAXDK5/fkqKHJVwYQSpoRfB43R4= @@ -983,7 +931,6 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= @@ -1001,7 +948,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= @@ -1018,7 +964,6 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20220902085622-e7cb96979f69/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= golang.org/x/image v0.3.0 h1:HTDXbdK9bjfSWkPzDJIw89W8CAtfFGduujWs33NLLsg= golang.org/x/image v0.3.0/go.mod h1:fXd9211C/0VTlYuAcOhW8dY/RtEJqODXOWBDpmYBf+A= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1044,12 +989,10 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1072,7 +1015,6 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -1087,11 +1029,9 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210427231257-85d9c07bbe3a/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1152,7 +1092,6 @@ golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1163,11 +1102,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1193,7 +1129,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1215,7 +1150,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1242,7 +1176,6 @@ golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXR golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1260,7 +1193,6 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1311,7 +1243,6 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= @@ -1321,7 +1252,6 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1496,10 +1426,7 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= -google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1538,7 +1465,6 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= @@ -1566,15 +1492,12 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/common/check/access.go b/internal/common/check/access.go index 4f0df2643..bdd42c8aa 100644 --- a/internal/common/check/access.go +++ b/internal/common/check/access.go @@ -5,8 +5,8 @@ import ( "context" ) -func Access(ctx context.Context, ownerUserID string) (err error) { - _, err = GetUsersInfo(ctx, ownerUserID) +func (u *UserCheck) Access(ctx context.Context, ownerUserID string) (err error) { + _, err = u.GetUsersInfo(ctx, ownerUserID) if err != nil { return err } diff --git a/internal/common/check/black.go b/internal/common/check/black.go new file mode 100644 index 000000000..3e15bec0b --- /dev/null +++ b/internal/common/check/black.go @@ -0,0 +1,21 @@ +package check + +import ( + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "context" +) + +type BlackChecker struct { + zk discoveryRegistry.SvcDiscoveryRegistry +} + +func NewBlackChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *BlackChecker { + return &BlackChecker{ + zk: zk, + } +} + +// possibleBlackUserID是否被userID拉黑,也就是是否在userID的黑名单中 +func (b *BlackChecker) IsBlocked(ctx context.Context, possibleBlackUserID, userID string) (bool, error) { + +} diff --git a/internal/common/check/conversation.go b/internal/common/check/conversation.go new file mode 100644 index 000000000..c56330c5b --- /dev/null +++ b/internal/common/check/conversation.go @@ -0,0 +1,35 @@ +package check + +import ( + "Open_IM/pkg/common/config" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "Open_IM/pkg/proto/conversation" + pbConversation "Open_IM/pkg/proto/conversation" + "context" + "google.golang.org/grpc" +) + +type ConversationChecker struct { + zk discoveryRegistry.SvcDiscoveryRegistry +} + +func NewConversationChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *ConversationChecker { + return &ConversationChecker{zk: zk} +} + +func (c *ConversationChecker) ModifyConversationField(ctx context.Context, req *pbConversation.ModifyConversationFieldReq) error { + cc, err := c.getConn() + if err != nil { + return err + } + _, err = conversation.NewConversationClient(cc).ModifyConversationField(ctx, req) + return err +} + +func (c *ConversationChecker) getConn() (*grpc.ClientConn, error) { + return c.zk.GetConn(config.Config.RpcRegisterName.OpenImConversationName) +} + +func (c *ConversationChecker) GetSingleConversationRecvMsgOpt(ctx context.Context, userID, conversationID string) (int32, error) { + +} diff --git a/internal/common/check/friend.go b/internal/common/check/friend.go index c48a42931..6c4a50a48 100644 --- a/internal/common/check/friend.go +++ b/internal/common/check/friend.go @@ -1,11 +1,41 @@ package check import ( + "Open_IM/pkg/common/config" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "Open_IM/pkg/proto/friend" sdkws "Open_IM/pkg/proto/sdkws" "context" - "errors" + "google.golang.org/grpc" ) -func GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*sdkws.FriendInfo, error) { - return nil, errors.New("TODO:GetUserInfo") +type FriendChecker struct { + zk discoveryRegistry.SvcDiscoveryRegistry +} + +func NewFriendChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *FriendChecker { + return &FriendChecker{ + zk: zk, + } +} + +func (f *FriendChecker) GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (resp *sdkws.FriendInfo, err error) { + cc, err := f.getConn() + if err != nil { + return nil, err + } + r, err := friend.NewFriendClient(cc).GetPaginationFriends(ctx, &friend.GetPaginationFriendsReq{OwnerUserID: ownerUserID, FriendUserIDs: []string{friendUserID}}) + if err != nil { + return nil, err + } + resp = r.FriendsInfo[0] + return +} +func (f *FriendChecker) getConn() (*grpc.ClientConn, error) { + return f.zk.GetConn(config.Config.RpcRegisterName.OpenImFriendName) +} + +// possibleFriendUserID是否在userID的好友中 +func (f *FriendChecker) IsFriend(ctx context.Context, possibleFriendUserID, userID string) (bool, error) { + } diff --git a/internal/common/check/group.go b/internal/common/check/group.go index 43ed85d1a..89a094e0f 100644 --- a/internal/common/check/group.go +++ b/internal/common/check/group.go @@ -1,17 +1,130 @@ package check import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "Open_IM/pkg/proto/group" sdkws "Open_IM/pkg/proto/sdkws" - "errors" + "Open_IM/pkg/utils" + "context" + "google.golang.org/grpc" + "strings" ) type GroupChecker struct { + zk discoveryRegistry.SvcDiscoveryRegistry } -func NewGroupChecker() *GroupChecker { - return &GroupChecker{} +func NewGroupChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *GroupChecker { + return &GroupChecker{ + zk: zk, + } } -func (g *GroupChecker) GetGroupInfo(groupID string) (*sdkws.GroupInfo, error) { - return nil, errors.New("TODO:GetUserInfo") +func (g *GroupChecker) getConn() (*grpc.ClientConn, error) { + return g.zk.GetConn(config.Config.RpcRegisterName.OpenImGroupName) +} + +func (g *GroupChecker) GetGroupInfos(ctx context.Context, groupIDs []string, complete bool) ([]*sdkws.GroupInfo, error) { + cc, err := g.getConn() + if err != nil { + return nil, err + } + resp, err := group.NewGroupClient(cc).GetGroupsInfo(ctx, &group.GetGroupsInfoReq{ + GroupIDs: groupIDs, + }) + if err != nil { + return nil, err + } + if complete { + if ids := utils.Single(groupIDs, utils.Slice(resp.GroupInfos, func(e *sdkws.GroupInfo) string { + return e.GroupID + })); len(ids) > 0 { + return nil, constant.ErrGroupIDNotFound.Wrap(strings.Join(ids, ",")) + } + } + return resp.GroupInfos, nil +} + +func (g *GroupChecker) GetGroupInfo(ctx context.Context, groupID string) (*sdkws.GroupInfo, error) { + groups, err := g.GetGroupInfos(ctx, []string{groupID}, true) + if err != nil { + return nil, err + } + return groups[0], nil +} + +func (g *GroupChecker) GetGroupInfoMap(ctx context.Context, groupIDs []string, complete bool) (map[string]*sdkws.GroupInfo, error) { + groups, err := g.GetGroupInfos(ctx, groupIDs, complete) + if err != nil { + return nil, err + } + return utils.SliceToMap(groups, func(e *sdkws.GroupInfo) string { + return e.GroupID + }), nil +} + +func (g *GroupChecker) GetGroupMemberInfos(ctx context.Context, groupID string, userIDs []string, complete bool) ([]*sdkws.GroupMemberFullInfo, error) { + cc, err := g.getConn() + if err != nil { + return nil, err + } + resp, err := group.NewGroupClient(cc).GetGroupMembersInfo(ctx, &group.GetGroupMembersInfoReq{ + GroupID: groupID, + Members: userIDs, + }) + if err != nil { + return nil, err + } + if complete { + if ids := utils.Single(userIDs, utils.Slice(resp.Members, func(e *sdkws.GroupMemberFullInfo) string { + return e.UserID + })); len(ids) > 0 { + return nil, constant.ErrNotInGroupYet.Wrap(strings.Join(ids, ",")) + } + } + return resp.Members, nil +} + +func (g *GroupChecker) GetGroupMemberInfo(ctx context.Context, groupID string, userID string) (*sdkws.GroupMemberFullInfo, error) { + members, err := g.GetGroupMemberInfos(ctx, groupID, []string{userID}, true) + if err != nil { + return nil, err + } + return members[0], nil +} + +func (g *GroupChecker) GetGroupMemberInfoMap(ctx context.Context, groupID string, userIDs []string, complete bool) (map[string]*sdkws.GroupMemberFullInfo, error) { + members, err := g.GetGroupMemberInfos(ctx, groupID, userIDs, true) + if err != nil { + return nil, err + } + return utils.SliceToMap(members, func(e *sdkws.GroupMemberFullInfo) string { + return e.UserID + }), nil +} + +func (g *GroupChecker) GetOwnerAndAdminInfos(ctx context.Context, groupID string) ([]*sdkws.GroupMemberFullInfo, error) { + cc, err := g.getConn() + if err != nil { + return nil, err + } + resp, err := group.NewGroupClient(cc).GetGroupMemberRoleLevel(ctx, &group.GetGroupMemberRoleLevelReq{ + GroupID: groupID, + RoleLevels: []int32{constant.GroupOwner, constant.GroupAdmin}, + }) + return resp.Members, err +} + +func (g *GroupChecker) GetOwnerInfo(ctx context.Context, groupID string) (*sdkws.GroupMemberFullInfo, error) { + cc, err := g.getConn() + if err != nil { + return nil, err + } + resp, err := group.NewGroupClient(cc).GetGroupMemberRoleLevel(ctx, &group.GetGroupMemberRoleLevelReq{ + GroupID: groupID, + RoleLevels: []int32{constant.GroupOwner}, + }) + return resp.Members[0], err } diff --git a/internal/common/check/msg.go b/internal/common/check/msg.go new file mode 100644 index 000000000..010ee1606 --- /dev/null +++ b/internal/common/check/msg.go @@ -0,0 +1,30 @@ +package check + +import ( + "Open_IM/pkg/common/config" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "Open_IM/pkg/proto/msg" + "context" + "google.golang.org/grpc" +) + +type MsgCheck struct { + zk discoveryRegistry.SvcDiscoveryRegistry +} + +func NewMsgCheck(zk discoveryRegistry.SvcDiscoveryRegistry) *MsgCheck { + return &MsgCheck{zk: zk} +} + +func (m *MsgCheck) getConn() (*grpc.ClientConn, error) { + return m.zk.GetConn(config.Config.RpcRegisterName.OpenImMsgName) +} + +func (m *MsgCheck) SendMsg(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error) { + cc, err := m.getConn() + if err != nil { + return nil, err + } + resp, err := msg.NewMsgClient(cc).SendMsg(ctx, req) + return resp, err +} diff --git a/internal/common/check/user.go b/internal/common/check/user.go index 66f75198f..5e5b38ee7 100644 --- a/internal/common/check/user.go +++ b/internal/common/check/user.go @@ -1,11 +1,108 @@ package check import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + discoveryRegistry "Open_IM/pkg/discoveryregistry" sdkws "Open_IM/pkg/proto/sdkws" + "Open_IM/pkg/proto/user" + "Open_IM/pkg/utils" "context" - "errors" + "google.golang.org/grpc" + "strings" ) -func GetUsersInfo(ctx context.Context, args ...interface{}) ([]*sdkws.UserInfo, error) { - return nil, errors.New("TODO:GetUserInfo") +//func GetUsersInfo(ctx context.Context, args ...interface{}) ([]*sdkws.UserInfo, error) { +// return nil, errors.New("TODO:GetUserInfo") +//} + +func NewUserCheck(zk discoveryRegistry.SvcDiscoveryRegistry) *UserCheck { + return &UserCheck{ + zk: zk, + } +} + +type UserCheck struct { + zk discoveryRegistry.SvcDiscoveryRegistry +} + +func (u *UserCheck) getConn() (*grpc.ClientConn, error) { + return u.zk.GetConn(config.Config.RpcRegisterName.OpenImUserName) +} + +func (u *UserCheck) GetUsersInfos(ctx context.Context, userIDs []string, complete bool) ([]*sdkws.UserInfo, error) { + cc, err := u.getConn() + if err != nil { + return nil, err + } + resp, err := user.NewUserClient(cc).GetDesignateUsers(ctx, &user.GetDesignateUsersReq{ + UserIDs: userIDs, + }) + if err != nil { + return nil, err + } + if complete { + if ids := utils.Single(userIDs, utils.Slice(resp.UsersInfo, func(e *sdkws.UserInfo) string { + return e.UserID + })); len(ids) > 0 { + return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ",")) + } + } + return resp.UsersInfo, nil +} + +func (u *UserCheck) GetUsersInfo(ctx context.Context, userID string) (*sdkws.UserInfo, error) { + users, err := u.GetUsersInfos(ctx, []string{userID}, true) + if err != nil { + return nil, err + } + return users[0], nil +} + +func (u *UserCheck) GetUsersInfoMap(ctx context.Context, userIDs []string, complete bool) (map[string]*sdkws.UserInfo, error) { + users, err := u.GetUsersInfos(ctx, userIDs, complete) + if err != nil { + return nil, err + } + return utils.SliceToMap(users, func(e *sdkws.UserInfo) string { + return e.UserID + }), nil +} + +func (u *UserCheck) GetPublicUserInfos(ctx context.Context, userIDs []string, complete bool) ([]*sdkws.PublicUserInfo, error) { + users, err := u.GetUsersInfos(ctx, userIDs, complete) + if err != nil { + return nil, err + } + return utils.Slice(users, func(e *sdkws.UserInfo) *sdkws.PublicUserInfo { + return &sdkws.PublicUserInfo{ + UserID: e.UserID, + Nickname: e.Nickname, + FaceURL: e.FaceURL, + Gender: e.Gender, + Ex: e.Ex, + } + }), nil +} + +func (u *UserCheck) GetPublicUserInfo(ctx context.Context, userID string) (*sdkws.PublicUserInfo, error) { + users, err := u.GetPublicUserInfos(ctx, []string{userID}, true) + if err != nil { + return nil, err + } + return users[0], nil +} + +func (u *UserCheck) GetPublicUserInfoMap(ctx context.Context, userIDs []string, complete bool) (map[string]*sdkws.PublicUserInfo, error) { + users, err := u.GetPublicUserInfos(ctx, userIDs, complete) + if err != nil { + return nil, err + } + return utils.SliceToMap(users, func(e *sdkws.PublicUserInfo) string { + return e.UserID + }), nil +} + +func (u *UserCheck) GetUserGlobalMsgRecvOpt(ctx context.Context, userID string) (int32, error) { + } diff --git a/internal/common/convert/convert.go b/internal/common/convert/convert.go index 9d4f31f46..861027167 100644 --- a/internal/common/convert/convert.go +++ b/internal/common/convert/convert.go @@ -1,29 +1,23 @@ package convert import ( + "Open_IM/internal/common/check" "Open_IM/pkg/common/db/table/relation" + discoveryRegistry "Open_IM/pkg/discoveryregistry" sdk "Open_IM/pkg/proto/sdkws" + utils2 "Open_IM/pkg/utils" + "context" utils "github.com/OpenIMSDK/open_utils" "time" ) -func getUsersInfo(userIDs []string) ([]*sdk.UserInfo, error) { - return nil, nil -} - -func getGroupOwnerInfo(groupID string) (*sdk.GroupMemberFullInfo, error) { - return nil, nil -} -func getNumberOfGroupMember(groupID string) (int32, error) { - return 0, nil -} - type DBFriend struct { *relation.FriendModel + userCheck *check.UserCheck } -func NewDBFriend(friend *relation.FriendModel) *DBFriend { - return &DBFriend{FriendModel: friend} +func NewDBFriend(friend *relation.FriendModel, zk discoveryRegistry.SvcDiscoveryRegistry) *DBFriend { + return &DBFriend{FriendModel: friend, userCheck: check.NewUserCheck(zk)} } type PBFriend struct { @@ -45,29 +39,34 @@ func (*PBFriend) PB2DB(friends []*sdk.FriendInfo) (DBFriends []*relation.FriendM return } -func (*DBFriend) DB2PB(friends []*relation.FriendModel) (PBFriends []*sdk.FriendInfo, err error) { +func (db *DBFriend) DB2PB(ctx context.Context, friends []*relation.FriendModel) (PBFriends []*sdk.FriendInfo, err error) { + userIDs := utils2.Slice(friends, func(e *relation.FriendModel) string { return e.FriendUserID }) + users, err := db.userCheck.GetUsersInfoMap(ctx, userIDs, true) + if err != nil { + return nil, err + } for _, v := range friends { - u, err := NewDBFriend(v).Convert() - if err != nil { - return nil, err - } - PBFriends = append(PBFriends, u) + pbfriend := &sdk.FriendInfo{FriendUser: &sdk.UserInfo{}} + utils.CopyStructFields(pbfriend, users[v.OwnerUserID]) + utils.CopyStructFields(pbfriend.FriendUser, users[v.FriendUserID]) + pbfriend.CreateTime = v.CreateTime.Unix() + pbfriend.FriendUser.CreateTime = v.CreateTime.Unix() } return } -func (db *DBFriend) Convert() (*sdk.FriendInfo, error) { - pbFriend := &sdk.FriendInfo{FriendUser: &sdk.UserInfo{}} - utils.CopyStructFields(pbFriend, db) - user, err := getUsersInfo([]string{db.FriendUserID}) +func (db *DBFriend) Convert(ctx context.Context) (*sdk.FriendInfo, error) { + pbfriend := &sdk.FriendInfo{FriendUser: &sdk.UserInfo{}} + utils.CopyStructFields(pbfriend, db) + user, err := db.userCheck.GetUsersInfo(ctx, db.FriendUserID) if err != nil { return nil, err } - utils.CopyStructFields(pbFriend.FriendUser, user[0]) - pbFriend.CreateTime = db.CreateTime.Unix() + utils.CopyStructFields(pbfriend.FriendUser, user) + pbfriend.CreateTime = db.CreateTime.Unix() - pbFriend.FriendUser.CreateTime = db.CreateTime.Unix() - return pbFriend, nil + pbfriend.FriendUser.CreateTime = db.CreateTime.Unix() + return pbfriend, nil } func (pb *PBFriend) Convert() (*relation.FriendModel, error) { @@ -80,10 +79,11 @@ func (pb *PBFriend) Convert() (*relation.FriendModel, error) { type DBFriendRequest struct { *relation.FriendRequestModel + userCheck *check.UserCheck } -func NewDBFriendRequest(friendRequest *relation.FriendRequestModel) *DBFriendRequest { - return &DBFriendRequest{FriendRequestModel: friendRequest} +func NewDBFriendRequest(friendRequest *relation.FriendRequestModel, zk discoveryRegistry.SvcDiscoveryRegistry) *DBFriendRequest { + return &DBFriendRequest{FriendRequestModel: friendRequest, userCheck: check.NewUserCheck(zk)} } type PBFriendRequest struct { @@ -105,13 +105,26 @@ func (*PBFriendRequest) PB2DB(friendRequests []*sdk.FriendRequest) (DBFriendRequ return } -func (*DBFriendRequest) DB2PB(friendRequests []*relation.FriendRequestModel) (PBFriendRequests []*sdk.FriendRequest, err error) { +func (db *DBFriendRequest) DB2PB(ctx context.Context, friendRequests []*relation.FriendRequestModel) (PBFriendRequests []*sdk.FriendRequest, err error) { + userIDs := make([]string, 0) + if len(friendRequests) > 0 { + userIDs = append(userIDs, friendRequests[0].FromUserID) + } + users, err := db.userCheck.GetUsersInfoMap(ctx, userIDs, true) + if err != nil { + return nil, err + } for _, v := range friendRequests { - u, err := NewDBFriendRequest(v).Convert() - if err != nil { - return nil, err - } - PBFriendRequests = append(PBFriendRequests, u) + pbFriendRequest := &sdk.FriendRequest{} + pbFriendRequest.FromNickname = users[v.FromUserID].Nickname + pbFriendRequest.FromFaceURL = users[v.FromUserID].FaceURL + pbFriendRequest.FromGender = users[v.FromUserID].Gender + pbFriendRequest.ToNickname = users[v.ToUserID].Nickname + pbFriendRequest.ToFaceURL = users[v.ToUserID].FaceURL + pbFriendRequest.ToGender = users[v.ToUserID].Gender + pbFriendRequest.CreateTime = db.CreateTime.Unix() + pbFriendRequest.HandleTime = db.HandleTime.Unix() + PBFriendRequests = append(PBFriendRequests, pbFriendRequest) } return } @@ -123,23 +136,23 @@ func (pb *PBFriendRequest) Convert() (*relation.FriendRequestModel, error) { dbFriendRequest.HandleTime = utils.UnixSecondToTime(int64(pb.HandleTime)) return dbFriendRequest, nil } -func (db *DBFriendRequest) Convert() (*sdk.FriendRequest, error) { +func (db *DBFriendRequest) Convert(ctx context.Context) (*sdk.FriendRequest, error) { pbFriendRequest := &sdk.FriendRequest{} utils.CopyStructFields(pbFriendRequest, db) - user, err := getUsersInfo([]string{db.FromUserID}) + user, err := db.userCheck.GetUsersInfo(ctx, db.FromUserID) if err != nil { return nil, err } - pbFriendRequest.FromNickname = user[0].Nickname - pbFriendRequest.FromFaceURL = user[0].FaceURL - pbFriendRequest.FromGender = user[0].Gender - user, err = getUsersInfo([]string{db.ToUserID}) + pbFriendRequest.FromNickname = user.Nickname + pbFriendRequest.FromFaceURL = user.FaceURL + pbFriendRequest.FromGender = user.Gender + user, err = db.userCheck.GetUsersInfo(ctx, db.ToUserID) if err != nil { return nil, err } - pbFriendRequest.ToNickname = user[0].Nickname - pbFriendRequest.ToFaceURL = user[0].FaceURL - pbFriendRequest.ToGender = user[0].Gender + pbFriendRequest.ToNickname = user.Nickname + pbFriendRequest.ToFaceURL = user.FaceURL + pbFriendRequest.ToGender = user.Gender pbFriendRequest.CreateTime = db.CreateTime.Unix() pbFriendRequest.HandleTime = db.HandleTime.Unix() return pbFriendRequest, nil @@ -147,6 +160,7 @@ func (db *DBFriendRequest) Convert() (*sdk.FriendRequest, error) { type DBBlack struct { *relation.BlackModel + userCheck *check.UserCheck } func (*PBBlack) PB2DB(blacks []*sdk.BlackInfo) (DBBlacks []*relation.BlackModel, err error) { @@ -160,19 +174,31 @@ func (*PBBlack) PB2DB(blacks []*sdk.BlackInfo) (DBBlacks []*relation.BlackModel, return } -func (*DBBlack) DB2PB(blacks []*relation.BlackModel) (PBBlacks []*sdk.BlackInfo, err error) { +func (db *DBBlack) DB2PB(ctx context.Context, blacks []*relation.BlackModel) (PBBlacks []*sdk.BlackInfo, err error) { + userIDs := make([]string, 0) for _, v := range blacks { - u, err := NewDBBlack(v).Convert() - if err != nil { - return nil, err - } - PBBlacks = append(PBBlacks, u) + userIDs = append(userIDs, v.BlockUserID) + } + if len(blacks) > 0 { + userIDs = append(userIDs, blacks[0].OwnerUserID) + } + + users, err := db.userCheck.GetUsersInfoMap(ctx, userIDs, true) + if err != nil { + return nil, err + } + + for _, v := range blacks { + pbBlack := &sdk.BlackInfo{} + utils.CopyStructFields(pbBlack, users[v.OwnerUserID]) + utils.CopyStructFields(pbBlack.BlackUserInfo, users[v.BlockUserID]) + PBBlacks = append(PBBlacks, pbBlack) } return } -func NewDBBlack(black *relation.BlackModel) *DBBlack { - return &DBBlack{BlackModel: black} +func NewDBBlack(black *relation.BlackModel, zk discoveryRegistry.SvcDiscoveryRegistry) *DBBlack { + return &DBBlack{BlackModel: black, userCheck: check.NewUserCheck(zk)} } type PBBlack struct { @@ -186,14 +212,14 @@ func NewPBBlack(blackInfo *sdk.BlackInfo) *PBBlack { func (pb *PBBlack) Convert() (*relation.BlackModel, error) { dbBlack := &relation.BlackModel{} dbBlack.BlockUserID = pb.BlackUserInfo.UserID - dbBlack.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime)) + dbBlack.CreateTime = utils.UnixSecondToTime(pb.CreateTime) return dbBlack, nil } -func (db *DBBlack) Convert() (*sdk.BlackInfo, error) { +func (db *DBBlack) Convert(ctx context.Context) (*sdk.BlackInfo, error) { pbBlack := &sdk.BlackInfo{} utils.CopyStructFields(pbBlack, db) pbBlack.CreateTime = db.CreateTime.Unix() - user, err := getUsersInfo([]string{db.BlockUserID}) + user, err := db.userCheck.GetUsersInfo(ctx, db.BlockUserID) if err != nil { return nil, err } @@ -203,6 +229,8 @@ func (db *DBBlack) Convert() (*sdk.BlackInfo, error) { type DBGroup struct { *relation.GroupModel + zk discoveryRegistry.SvcDiscoveryRegistry + groupCheck *check.GroupChecker } func (*PBGroup) PB2DB(groups []*sdk.GroupInfo) (DBGroups []*relation.GroupModel, err error) { @@ -216,19 +244,19 @@ func (*PBGroup) PB2DB(groups []*sdk.GroupInfo) (DBGroups []*relation.GroupModel, return } -func (*DBGroup) DB2PB(groups []*relation.GroupModel) (PBGroups []*sdk.GroupInfo, err error) { - for _, v := range groups { - u, err := NewDBGroup(v).Convert() - if err != nil { - return nil, err - } - PBGroups = append(PBGroups, u) - } - return -} +//func (db *DBGroup) DB2PB(ctx context.Context, zk discoveryRegistry.SvcDiscoveryRegistry, groups []*relation.GroupModel) (PBGroups []*sdk.GroupInfo, err error) { +// for _, v := range groups { +// u, err := NewDBGroup(v, zk).Convert(ctx) +// if err != nil { +// return nil, err +// } +// PBGroups = append(PBGroups, u) +// } +// return +//} -func NewDBGroup(group *relation.GroupModel) *DBGroup { - return &DBGroup{GroupModel: group} +func NewDBGroup(groupModel *relation.GroupModel, zk discoveryRegistry.SvcDiscoveryRegistry) *DBGroup { + return &DBGroup{GroupModel: groupModel, groupCheck: check.NewGroupChecker(zk)} } type PBGroup struct { @@ -244,20 +272,20 @@ func (pb *PBGroup) Convert() (*relation.GroupModel, error) { err := utils.CopyStructFields(dst, pb) return dst, err } -func (db *DBGroup) Convert() (*sdk.GroupInfo, error) { +func (db *DBGroup) Convert(ctx context.Context) (*sdk.GroupInfo, error) { dst := &sdk.GroupInfo{} utils.CopyStructFields(dst, db) - user, err := getGroupOwnerInfo(db.GroupID) + user, err := db.groupCheck.GetOwnerInfo(ctx, db.GroupID) if err != nil { return nil, err } dst.OwnerUserID = user.UserID - memberCount, err := getNumberOfGroupMember(db.GroupID) + g, err := db.groupCheck.GetGroupInfo(ctx, db.GroupID) if err != nil { return nil, err } - dst.MemberCount = uint32(memberCount) + dst.MemberCount = g.MemberCount dst.CreateTime = db.CreateTime.Unix() dst.NotificationUpdateTime = db.NotificationUpdateTime.Unix() if db.NotificationUpdateTime.Unix() < 0 { @@ -268,6 +296,7 @@ func (db *DBGroup) Convert() (*sdk.GroupInfo, error) { type DBGroupMember struct { *relation.GroupMemberModel + userCheck *check.UserCheck } func (*PBGroupMember) PB2DB(groupMembers []*sdk.GroupMemberFullInfo) (DBGroupMembers []*relation.GroupMemberModel, err error) { @@ -281,16 +310,16 @@ func (*PBGroupMember) PB2DB(groupMembers []*sdk.GroupMemberFullInfo) (DBGroupMem return } -func (*DBGroupMember) DB2PB(groupMembers []*relation.GroupMemberModel) (PBGroupMembers []*sdk.GroupMemberFullInfo, err error) { - for _, v := range groupMembers { - u, err := NewDBGroupMember(v).Convert() - if err != nil { - return nil, err - } - PBGroupMembers = append(PBGroupMembers, u) - } - return -} +//func (*DBGroupMember) DB2PB(ctx context.Context, groupMembers []*relation.GroupMemberModel) (PBGroupMembers []*sdk.GroupMemberFullInfo, err error) { +// for _, v := range groupMembers { +// u, err := NewDBGroupMember(v).Convert(ctx) +// if err != nil { +// return nil, err +// } +// PBGroupMembers = append(PBGroupMembers, u) +// } +// return +//} func NewDBGroupMember(groupMember *relation.GroupMemberModel) *DBGroupMember { return &DBGroupMember{GroupMemberModel: groupMember} @@ -311,15 +340,15 @@ func (pb *PBGroupMember) Convert() (*relation.GroupMemberModel, error) { dst.MuteEndTime = utils.UnixSecondToTime(int64(pb.MuteEndTime)) return dst, nil } -func (db *DBGroupMember) Convert() (*sdk.GroupMemberFullInfo, error) { +func (db *DBGroupMember) Convert(ctx context.Context) (*sdk.GroupMemberFullInfo, error) { dst := &sdk.GroupMemberFullInfo{} utils.CopyStructFields(dst, db) - user, err := getUsersInfo([]string{db.UserID}) + user, err := db.userCheck.GetUsersInfo(ctx, db.UserID) if err != nil { return nil, err } - dst.AppMangerLevel = user[0].AppMangerLevel + dst.AppMangerLevel = user.AppMangerLevel dst.JoinTime = db.JoinTime.Unix() if db.JoinTime.Unix() < 0 { @@ -347,16 +376,16 @@ func (*PBGroupRequest) PB2DB(groupRequests []*sdk.GroupRequest) (DBGroupRequests return } -func (*DBGroupRequest) DB2PB(groupRequests []*relation.GroupRequestModel) (PBGroupRequests []*sdk.GroupRequest, err error) { - for _, v := range groupRequests { - u, err := NewDBGroupRequest(v).Convert() - if err != nil { - return nil, err - } - PBGroupRequests = append(PBGroupRequests, u) - } - return -} +//func (*DBGroupRequest) DB2PB(groupRequests []*relation.GroupRequestModel) (PBGroupRequests []*sdk.GroupRequest, err error) { +// for _, v := range groupRequests { +// u, err := NewDBGroupRequest(v).Convert() +// if err != nil { +// return nil, err +// } +// PBGroupRequests = append(PBGroupRequests, u) +// } +// return +//} func NewDBGroupRequest(groupRequest *relation.GroupRequestModel) *DBGroupRequest { return &DBGroupRequest{GroupRequestModel: groupRequest} diff --git a/internal/common/notification/c.go b/internal/common/notification/c.go new file mode 100644 index 000000000..52f6853b2 --- /dev/null +++ b/internal/common/notification/c.go @@ -0,0 +1,305 @@ +package notification + +import ( + "Open_IM/internal/common/check" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/tracelog" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "Open_IM/pkg/proto/msg" + "Open_IM/pkg/proto/sdkws" + utils2 "Open_IM/pkg/utils" + "context" + utils "github.com/OpenIMSDK/open_utils" +) + +type Check struct { + user *check.UserCheck + group *check.GroupChecker + msg *check.MsgCheck + friend *check.FriendChecker + conversation *check.ConversationChecker +} + +func NewCheck(zk discoveryRegistry.SvcDiscoveryRegistry) *Check { + return &Check{ + user: check.NewUserCheck(zk), + group: check.NewGroupChecker(zk), + msg: check.NewMsgCheck(zk), + friend: check.NewFriendChecker(zk), + conversation: check.NewConversationChecker(zk), + } +} + +type NotificationMsg struct { + SendID string + RecvID string + Content []byte // sdkws.TipsComm + MsgFrom int32 + ContentType int32 + SessionType int32 + SenderNickname string + SenderFaceURL string +} + +func (c *Check) Notification(ctx context.Context, notificationMsg *NotificationMsg) { + var err error + defer func() { + tracelog.SetCtxDebug(ctx, utils2.GetFuncName(1), err, "notificationMsg", notificationMsg) + }() + + var req msg.SendMsgReq + var msg sdkws.MsgData + var offlineInfo sdkws.OfflinePushInfo + var title, desc, ex string + var pushSwitch, unReadCount bool + var reliabilityLevel int + msg.SendID = notificationMsg.SendID + msg.RecvID = notificationMsg.RecvID + msg.Content = notificationMsg.Content + msg.MsgFrom = notificationMsg.MsgFrom + msg.ContentType = notificationMsg.ContentType + msg.SessionType = notificationMsg.SessionType + msg.CreateTime = utils.GetCurrentTimestampByMill() + msg.ClientMsgID = utils.GetMsgID(notificationMsg.SendID) + msg.Options = make(map[string]bool, 7) + msg.SenderNickname = notificationMsg.SenderNickname + msg.SenderFaceURL = notificationMsg.SenderFaceURL + switch notificationMsg.SessionType { + case constant.GroupChatType, constant.SuperGroupChatType: + msg.RecvID = "" + msg.GroupID = notificationMsg.RecvID + } + offlineInfo.IOSBadgeCount = config.Config.IOSPush.BadgeCount + offlineInfo.IOSPushSound = config.Config.IOSPush.PushSound + switch msg.ContentType { + case constant.GroupCreatedNotification: + pushSwitch = config.Config.Notification.GroupCreated.OfflinePush.PushSwitch + title = config.Config.Notification.GroupCreated.OfflinePush.Title + desc = config.Config.Notification.GroupCreated.OfflinePush.Desc + ex = config.Config.Notification.GroupCreated.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupCreated.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupCreated.Conversation.UnreadCount + case constant.GroupInfoSetNotification: + pushSwitch = config.Config.Notification.GroupInfoSet.OfflinePush.PushSwitch + title = config.Config.Notification.GroupInfoSet.OfflinePush.Title + desc = config.Config.Notification.GroupInfoSet.OfflinePush.Desc + ex = config.Config.Notification.GroupInfoSet.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupInfoSet.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupInfoSet.Conversation.UnreadCount + case constant.JoinGroupApplicationNotification: + pushSwitch = config.Config.Notification.JoinGroupApplication.OfflinePush.PushSwitch + title = config.Config.Notification.JoinGroupApplication.OfflinePush.Title + desc = config.Config.Notification.JoinGroupApplication.OfflinePush.Desc + ex = config.Config.Notification.JoinGroupApplication.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.JoinGroupApplication.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.JoinGroupApplication.Conversation.UnreadCount + case constant.MemberQuitNotification: + pushSwitch = config.Config.Notification.MemberQuit.OfflinePush.PushSwitch + title = config.Config.Notification.MemberQuit.OfflinePush.Title + desc = config.Config.Notification.MemberQuit.OfflinePush.Desc + ex = config.Config.Notification.MemberQuit.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.MemberQuit.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.MemberQuit.Conversation.UnreadCount + case constant.GroupApplicationAcceptedNotification: + pushSwitch = config.Config.Notification.GroupApplicationAccepted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Title + desc = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Desc + ex = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupApplicationAccepted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupApplicationAccepted.Conversation.UnreadCount + case constant.GroupApplicationRejectedNotification: + pushSwitch = config.Config.Notification.GroupApplicationRejected.OfflinePush.PushSwitch + title = config.Config.Notification.GroupApplicationRejected.OfflinePush.Title + desc = config.Config.Notification.GroupApplicationRejected.OfflinePush.Desc + ex = config.Config.Notification.GroupApplicationRejected.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupApplicationRejected.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupApplicationRejected.Conversation.UnreadCount + case constant.GroupOwnerTransferredNotification: + pushSwitch = config.Config.Notification.GroupOwnerTransferred.OfflinePush.PushSwitch + title = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Title + desc = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Desc + ex = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupOwnerTransferred.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupOwnerTransferred.Conversation.UnreadCount + case constant.MemberKickedNotification: + pushSwitch = config.Config.Notification.MemberKicked.OfflinePush.PushSwitch + title = config.Config.Notification.MemberKicked.OfflinePush.Title + desc = config.Config.Notification.MemberKicked.OfflinePush.Desc + ex = config.Config.Notification.MemberKicked.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.MemberKicked.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.MemberKicked.Conversation.UnreadCount + case constant.MemberInvitedNotification: + pushSwitch = config.Config.Notification.MemberInvited.OfflinePush.PushSwitch + title = config.Config.Notification.MemberInvited.OfflinePush.Title + desc = config.Config.Notification.MemberInvited.OfflinePush.Desc + ex = config.Config.Notification.MemberInvited.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.MemberInvited.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.MemberInvited.Conversation.UnreadCount + case constant.MemberEnterNotification: + pushSwitch = config.Config.Notification.MemberEnter.OfflinePush.PushSwitch + title = config.Config.Notification.MemberEnter.OfflinePush.Title + desc = config.Config.Notification.MemberEnter.OfflinePush.Desc + ex = config.Config.Notification.MemberEnter.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.MemberEnter.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.MemberEnter.Conversation.UnreadCount + case constant.UserInfoUpdatedNotification: + pushSwitch = config.Config.Notification.UserInfoUpdated.OfflinePush.PushSwitch + title = config.Config.Notification.UserInfoUpdated.OfflinePush.Title + desc = config.Config.Notification.UserInfoUpdated.OfflinePush.Desc + ex = config.Config.Notification.UserInfoUpdated.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.UserInfoUpdated.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.UserInfoUpdated.Conversation.UnreadCount + case constant.FriendApplicationNotification: + pushSwitch = config.Config.Notification.FriendApplication.OfflinePush.PushSwitch + title = config.Config.Notification.FriendApplication.OfflinePush.Title + desc = config.Config.Notification.FriendApplication.OfflinePush.Desc + ex = config.Config.Notification.FriendApplication.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendApplication.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendApplication.Conversation.UnreadCount + case constant.FriendApplicationApprovedNotification: + pushSwitch = config.Config.Notification.FriendApplicationApproved.OfflinePush.PushSwitch + title = config.Config.Notification.FriendApplicationApproved.OfflinePush.Title + desc = config.Config.Notification.FriendApplicationApproved.OfflinePush.Desc + ex = config.Config.Notification.FriendApplicationApproved.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendApplicationApproved.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendApplicationApproved.Conversation.UnreadCount + case constant.FriendApplicationRejectedNotification: + pushSwitch = config.Config.Notification.FriendApplicationRejected.OfflinePush.PushSwitch + title = config.Config.Notification.FriendApplicationRejected.OfflinePush.Title + desc = config.Config.Notification.FriendApplicationRejected.OfflinePush.Desc + ex = config.Config.Notification.FriendApplicationRejected.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendApplicationRejected.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendApplicationRejected.Conversation.UnreadCount + case constant.FriendAddedNotification: + pushSwitch = config.Config.Notification.FriendAdded.OfflinePush.PushSwitch + title = config.Config.Notification.FriendAdded.OfflinePush.Title + desc = config.Config.Notification.FriendAdded.OfflinePush.Desc + ex = config.Config.Notification.FriendAdded.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendAdded.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendAdded.Conversation.UnreadCount + case constant.FriendDeletedNotification: + pushSwitch = config.Config.Notification.FriendDeleted.OfflinePush.PushSwitch + title = config.Config.Notification.FriendDeleted.OfflinePush.Title + desc = config.Config.Notification.FriendDeleted.OfflinePush.Desc + ex = config.Config.Notification.FriendDeleted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendDeleted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendDeleted.Conversation.UnreadCount + case constant.FriendRemarkSetNotification: + pushSwitch = config.Config.Notification.FriendRemarkSet.OfflinePush.PushSwitch + title = config.Config.Notification.FriendRemarkSet.OfflinePush.Title + desc = config.Config.Notification.FriendRemarkSet.OfflinePush.Desc + ex = config.Config.Notification.FriendRemarkSet.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendRemarkSet.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendRemarkSet.Conversation.UnreadCount + case constant.BlackAddedNotification: + pushSwitch = config.Config.Notification.BlackAdded.OfflinePush.PushSwitch + title = config.Config.Notification.BlackAdded.OfflinePush.Title + desc = config.Config.Notification.BlackAdded.OfflinePush.Desc + ex = config.Config.Notification.BlackAdded.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.BlackAdded.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.BlackAdded.Conversation.UnreadCount + case constant.BlackDeletedNotification: + pushSwitch = config.Config.Notification.BlackDeleted.OfflinePush.PushSwitch + title = config.Config.Notification.BlackDeleted.OfflinePush.Title + desc = config.Config.Notification.BlackDeleted.OfflinePush.Desc + ex = config.Config.Notification.BlackDeleted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.BlackDeleted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.BlackDeleted.Conversation.UnreadCount + case constant.ConversationOptChangeNotification: + pushSwitch = config.Config.Notification.ConversationOptUpdate.OfflinePush.PushSwitch + title = config.Config.Notification.ConversationOptUpdate.OfflinePush.Title + desc = config.Config.Notification.ConversationOptUpdate.OfflinePush.Desc + ex = config.Config.Notification.ConversationOptUpdate.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.ConversationOptUpdate.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.ConversationOptUpdate.Conversation.UnreadCount + + case constant.GroupDismissedNotification: + pushSwitch = config.Config.Notification.GroupDismissed.OfflinePush.PushSwitch + title = config.Config.Notification.GroupDismissed.OfflinePush.Title + desc = config.Config.Notification.GroupDismissed.OfflinePush.Desc + ex = config.Config.Notification.GroupDismissed.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupDismissed.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupDismissed.Conversation.UnreadCount + + case constant.GroupMutedNotification: + pushSwitch = config.Config.Notification.GroupMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMuted.OfflinePush.Title + desc = config.Config.Notification.GroupMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMuted.Conversation.UnreadCount + + case constant.GroupCancelMutedNotification: + pushSwitch = config.Config.Notification.GroupCancelMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupCancelMuted.OfflinePush.Title + desc = config.Config.Notification.GroupCancelMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupCancelMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupCancelMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupCancelMuted.Conversation.UnreadCount + + case constant.GroupMemberMutedNotification: + pushSwitch = config.Config.Notification.GroupMemberMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMemberMuted.OfflinePush.Title + desc = config.Config.Notification.GroupMemberMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupMemberMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMemberMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMemberMuted.Conversation.UnreadCount + + case constant.GroupMemberCancelMutedNotification: + pushSwitch = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Title + desc = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMemberCancelMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMemberCancelMuted.Conversation.UnreadCount + + case constant.GroupMemberInfoSetNotification: + pushSwitch = config.Config.Notification.GroupMemberInfoSet.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Title + desc = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Desc + ex = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMemberInfoSet.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMemberInfoSet.Conversation.UnreadCount + + case constant.ConversationPrivateChatNotification: + pushSwitch = config.Config.Notification.ConversationSetPrivate.OfflinePush.PushSwitch + title = config.Config.Notification.ConversationSetPrivate.OfflinePush.Title + desc = config.Config.Notification.ConversationSetPrivate.OfflinePush.Desc + ex = config.Config.Notification.ConversationSetPrivate.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.ConversationSetPrivate.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount + case constant.FriendInfoUpdatedNotification: + pushSwitch = config.Config.Notification.FriendInfoUpdated.OfflinePush.PushSwitch + title = config.Config.Notification.FriendInfoUpdated.OfflinePush.Title + desc = config.Config.Notification.FriendInfoUpdated.OfflinePush.Desc + ex = config.Config.Notification.FriendInfoUpdated.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.FriendInfoUpdated.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.FriendInfoUpdated.Conversation.UnreadCount + case constant.DeleteMessageNotification: + reliabilityLevel = constant.ReliableNotificationNoMsg + case constant.ConversationUnreadNotification, constant.SuperGroupUpdateNotification: + reliabilityLevel = constant.UnreliableNotification + } + switch reliabilityLevel { + case constant.UnreliableNotification: + utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) + case constant.ReliableNotificationNoMsg: + utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) + case constant.ReliableNotificationMsg: + + } + utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, unReadCount) + utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, pushSwitch) + offlineInfo.Title = title + offlineInfo.Desc = desc + offlineInfo.Ex = ex + msg.OfflinePushInfo = &offlineInfo + req.MsgData = &msg + + _, err = c.msg.SendMsg(ctx, &req) +} diff --git a/internal/rpc/msg/conversation_notification.go b/internal/common/notification/conversation.go similarity index 54% rename from internal/rpc/msg/conversation_notification.go rename to internal/common/notification/conversation.go index 647f28297..a7506779a 100644 --- a/internal/rpc/msg/conversation_notification.go +++ b/internal/common/notification/conversation.go @@ -1,22 +1,18 @@ -package msg +package notification import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" sdkws "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" "context" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" ) -func SetConversationNotification(operationID, sendID, recvID string, contentType int, m proto.Message, tips sdkws.TipsComm) { - log.NewInfo(operationID, "args: ", sendID, recvID, contentType, m.String(), tips.String()) +func (c *Check) SetConversationNotification(ctx context.Context, sendID, recvID string, contentType int, m proto.Message, tips sdkws.TipsComm) { var err error tips.Detail, err = proto.Marshal(m) if err != nil { - log.NewError(operationID, "Marshal failed ", err.Error(), m.String()) return } marshaler := jsonpb.Marshaler{ @@ -31,18 +27,16 @@ func SetConversationNotification(operationID, sendID, recvID string, contentType n.ContentType = int32(contentType) n.SessionType = constant.SingleChatType n.MsgFrom = constant.SysMsgType - n.OperationID = operationID n.Content, err = proto.Marshal(&tips) if err != nil { - log.Error(operationID, utils.GetSelfFuncName(), "Marshal failed ", err.Error(), tips.String()) return } - Notification(&n) + c.Notification(ctx, &n) } // SetPrivate调用 -func ConversationSetPrivateNotification(operationID, sendID, recvID string, isPrivateChat bool) { - log.NewInfo(operationID, utils.GetSelfFuncName()) +func (c *Check) ConversationSetPrivateNotification(ctx context.Context, sendID, recvID string, isPrivateChat bool) { + conversationSetPrivateTips := &sdkws.ConversationSetPrivateTips{ RecvID: recvID, SendID: sendID, @@ -56,23 +50,23 @@ func ConversationSetPrivateNotification(operationID, sendID, recvID string, isPr tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.CloseTips } tips.DefaultTips = tipsMsg - SetConversationNotification(operationID, sendID, recvID, constant.ConversationPrivateChatNotification, conversationSetPrivateTips, tips) + c.SetConversationNotification(ctx, sendID, recvID, constant.ConversationPrivateChatNotification, conversationSetPrivateTips, tips) } // 会话改变 -func ConversationChangeNotification(ctx context.Context, userID string) { - log.NewInfo(operationID, utils.GetSelfFuncName()) +func (c *Check) ConversationChangeNotification(ctx context.Context, userID string) { + ConversationChangedTips := &sdkws.ConversationUpdateTips{ UserID: userID, } var tips sdkws.TipsComm tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips - SetConversationNotification(operationID, userID, userID, constant.ConversationOptChangeNotification, ConversationChangedTips, tips) + c.SetConversationNotification(ctx, userID, userID, constant.ConversationOptChangeNotification, ConversationChangedTips, tips) } -//会话未读数同步 -func ConversationUnreadChangeNotification(operationID, userID, conversationID string, updateUnreadCountTime int64) { - log.NewInfo(operationID, utils.GetSelfFuncName()) +// 会话未读数同步 +func (c *Check) ConversationUnreadChangeNotification(ctx context.Context, userID, conversationID string, updateUnreadCountTime int64) { + ConversationChangedTips := &sdkws.ConversationUpdateTips{ UserID: userID, ConversationIDList: []string{conversationID}, @@ -80,5 +74,5 @@ func ConversationUnreadChangeNotification(operationID, userID, conversationID st } var tips sdkws.TipsComm tips.DefaultTips = config.Config.Notification.ConversationOptUpdate.DefaultTips.Tips - SetConversationNotification(operationID, userID, userID, constant.ConversationUnreadNotification, ConversationChangedTips, tips) + c.SetConversationNotification(ctx, userID, userID, constant.ConversationUnreadNotification, ConversationChangedTips, tips) } diff --git a/internal/rpc/msg/extend_msg.notification.go b/internal/common/notification/extend_msg.go similarity index 61% rename from internal/rpc/msg/extend_msg.notification.go rename to internal/common/notification/extend_msg.go index ef1845fdd..18f0d7b91 100644 --- a/internal/rpc/msg/extend_msg.notification.go +++ b/internal/common/notification/extend_msg.go @@ -1,18 +1,16 @@ -package msg +package notification import ( - "Open_IM/pkg/api_struct" - "Open_IM/pkg/common/config" + "Open_IM/pkg/apistruct" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - "Open_IM/pkg/getcdv3" + "Open_IM/pkg/common/tracelog" "Open_IM/pkg/proto/msg" sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" ) -func ExtendMessageUpdatedNotification(operationID, sendID string, sourceID string, sessionType int32, +func (c *Check) ExtendMessageUpdatedNotification(ctx context.Context, sendID string, sourceID string, sessionType int32, req *msg.SetMessageReactionExtensionsReq, resp *msg.SetMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) { var m apistruct.ReactionMessageModifierNotification m.SourceID = req.SourceID @@ -25,7 +23,6 @@ func ExtendMessageUpdatedNotification(operationID, sendID string, sourceID strin } } if len(keyMap) == 0 { - log.NewWarn(operationID, "all key set failed can not send notification", *req) return } m.SuccessReactionExtensionList = keyMap @@ -33,9 +30,9 @@ func ExtendMessageUpdatedNotification(operationID, sendID string, sourceID strin m.IsReact = resp.IsReact m.IsExternalExtensions = req.IsExternalExtensions m.MsgFirstModifyTime = resp.MsgFirstModifyTime - messageReactionSender(operationID, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache) + c.messageReactionSender(ctx, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache) } -func ExtendMessageDeleteNotification(operationID, 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) { var m apistruct.ReactionMessageDeleteNotification m.SourceID = req.SourceID @@ -48,16 +45,20 @@ func ExtendMessageDeleteNotification(operationID, sendID string, sourceID string } } if len(keyMap) == 0 { - log.NewWarn(operationID, "all key set failed can not send notification", *req) return } m.SuccessReactionExtensionList = keyMap m.ClientMsgID = req.ClientMsgID m.MsgFirstModifyTime = req.MsgFirstModifyTime - messageReactionSender(operationID, sendID, sourceID, sessionType, constant.ReactionMessageDeleter, utils.StructToJsonString(m), isHistory, isReactionFromCache) + c.messageReactionSender(ctx, sendID, sourceID, sessionType, constant.ReactionMessageDeleter, utils.StructToJsonString(m), isHistory, isReactionFromCache) } -func messageReactionSender(operationID, sendID string, sourceID string, sessionType, contentType int32, content string, isHistory bool, isReactionFromCache bool) { +func (c *Check) messageReactionSender(ctx context.Context, sendID string, sourceID string, sessionType, contentType int32, content string, isHistory bool, isReactionFromCache bool) { + var err error + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "sendID", sendID, "sourceID", sourceID, "sessionType", sessionType) + }() + options := make(map[string]bool, 5) utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false) utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false) @@ -69,7 +70,6 @@ func messageReactionSender(operationID, sendID string, sourceID string, sessionT utils.SetSwitchFromOptions(options, constant.IsPersistent, false) } pbData := msg.SendMsgReq{ - OperationID: operationID, MsgData: &sdkws.MsgData{ SendID: sendID, ClientMsgID: utils.GetMsgID(sendID), @@ -77,9 +77,8 @@ func messageReactionSender(operationID, sendID string, sourceID string, sessionT MsgFrom: constant.SysMsgType, ContentType: contentType, Content: []byte(content), - // ForceList: params.ForceList, - CreateTime: utils.GetCurrentTimestampByMill(), - Options: options, + CreateTime: utils.GetCurrentTimestampByMill(), + Options: options, }, } switch sessionType { @@ -88,15 +87,5 @@ func messageReactionSender(operationID, sendID string, sourceID string, sessionT case constant.GroupChatType, constant.SuperGroupChatType: pbData.MsgData.GroupID = sourceID } - etcdConn, err := rpc.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName) - if err != nil { - return - } - client := msg.NewMsgClient(etcdConn) - reply, err := client.SendMsg(context.Background(), &pbData) - if err != nil { - log.NewError(operationID, "SendMsg rpc failed, ", pbData.String(), err.Error()) - } else if reply.ErrCode != 0 { - log.NewError(operationID, "SendMsg rpc failed, ", pbData.String(), reply.ErrCode, reply.ErrMsg) - } + _, err = c.msg.SendMsg(ctx, &pbData) } diff --git a/internal/rpc/msg/friend_notification.go b/internal/common/notification/friend.go similarity index 53% rename from internal/rpc/msg/friend_notification.go rename to internal/common/notification/friend.go index 4dddc5adf..e4d2568cf 100644 --- a/internal/rpc/msg/friend_notification.go +++ b/internal/common/notification/friend.go @@ -1,38 +1,28 @@ -package msg +package notification import ( - "Open_IM/internal/common/check" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/tracelog" pbFriend "Open_IM/pkg/proto/friend" - sdkws "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" + "Open_IM/pkg/proto/sdkws" "context" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" ) -func getFromToUserNickname(fromUserID, toUserID string) (string, string, error) { - users, err := check.GetUsersInfo(context.Background(), fromUserID, toUserID) +func (c *Check) getFromToUserNickname(ctx context.Context, fromUserID, toUserID string) (string, string, error) { + users, err := c.user.GetUsersInfoMap(ctx, []string{fromUserID, toUserID}, true) if err != nil { return "", "", nil } - if users[0].UserID == fromUserID { - return users[0].Nickname, users[1].Nickname, nil - } - return users[1].Nickname, users[0].Nickname, nil - + return users[fromUserID].Nickname, users[toUserID].Nickname, nil } -func friendNotification(operationID, fromUserID, toUserID string, contentType int32, m proto.Message) { - log.Info(operationID, utils.GetSelfFuncName(), "args: ", contentType) +func (c *Check) friendNotification(ctx context.Context, fromUserID, toUserID string, contentType int32, m proto.Message) { var err error var tips sdkws.TipsComm tips.Detail, err = proto.Marshal(m) if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), m.String()) return } @@ -44,9 +34,8 @@ func friendNotification(operationID, fromUserID, toUserID string, contentType in tips.JsonDetail, _ = marshaler.MarshalToString(m) - fromUserNickname, toUserNickname, err := getFromToUserNickname(fromUserID, toUserID) + fromUserNickname, toUserNickname, err := c.getFromToUserNickname(ctx, fromUserID, toUserID) if err != nil { - log.Error(operationID, "getFromToUserNickname failed ", err.Error(), fromUserID, toUserID) return } cn := config.Config.Notification @@ -72,7 +61,6 @@ func friendNotification(operationID, fromUserID, toUserID string, contentType in case constant.FriendInfoUpdatedNotification: tips.DefaultTips = cn.FriendInfoUpdated.DefaultTips.Tips + toUserNickname default: - log.Error(operationID, "contentType failed ", contentType) return } @@ -82,41 +70,39 @@ func friendNotification(operationID, fromUserID, toUserID string, contentType in n.ContentType = contentType n.SessionType = constant.SingleChatType n.MsgFrom = constant.SysMsgType - n.OperationID = operationID n.Content, err = proto.Marshal(&tips) if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), tips.String()) return } - Notification(&n) + c.Notification(ctx, &n) } -func FriendApplicationAddNotification(ctx context.Context, req *pbFriend.AddFriendReq) { +func (c *Check) FriendApplicationAddNotification(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) { FriendApplicationTips := sdkws.FriendApplicationTips{FromToUserID: &sdkws.FromToUserID{}} FriendApplicationTips.FromToUserID.FromUserID = req.FromUserID FriendApplicationTips.FromToUserID.ToUserID = req.ToUserID - friendNotification(tracelog.GetOperationID(ctx), req.FromUserID, req.ToUserID, constant.FriendApplicationNotification, &FriendApplicationTips) + c.friendNotification(ctx, req.FromUserID, req.ToUserID, constant.FriendApplicationNotification, &FriendApplicationTips) } -func FriendApplicationAgreedNotification(ctx context.Context, req *pbFriend.RespondFriendApplyReq) { +func (c *Check) FriendApplicationAgreedNotification(ctx context.Context, req *pbFriend.RespondFriendApplyReq) { FriendApplicationApprovedTips := sdkws.FriendApplicationApprovedTips{FromToUserID: &sdkws.FromToUserID{}} FriendApplicationApprovedTips.FromToUserID.FromUserID = req.FromUserID FriendApplicationApprovedTips.FromToUserID.ToUserID = req.ToUserID FriendApplicationApprovedTips.HandleMsg = req.HandleMsg - friendNotification(tracelog.GetOperationID(ctx), req.ToUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &FriendApplicationApprovedTips) + c.friendNotification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationApprovedNotification, &FriendApplicationApprovedTips) } -func FriendApplicationRefusedNotification(ctx context.Context, req *pbFriend.RespondFriendApplyReq) { +func (c *Check) FriendApplicationRefusedNotification(ctx context.Context, req *pbFriend.RespondFriendApplyReq) { FriendApplicationApprovedTips := sdkws.FriendApplicationApprovedTips{FromToUserID: &sdkws.FromToUserID{}} FriendApplicationApprovedTips.FromToUserID.FromUserID = req.FromUserID FriendApplicationApprovedTips.FromToUserID.ToUserID = req.ToUserID FriendApplicationApprovedTips.HandleMsg = req.HandleMsg - friendNotification(tracelog.GetOperationID(ctx), req.ToUserID, req.FromUserID, constant.FriendApplicationRejectedNotification, &FriendApplicationApprovedTips) + c.friendNotification(ctx, req.ToUserID, req.FromUserID, constant.FriendApplicationRejectedNotification, &FriendApplicationApprovedTips) } -func FriendAddedNotification(ctx context.Context, operationID, opUserID, fromUserID, toUserID string) { +func (c *Check) FriendAddedNotification(ctx context.Context, operationID, opUserID, fromUserID, toUserID string) { friendAddedTips := sdkws.FriendAddedTips{Friend: &sdkws.FriendInfo{}, OpUser: &sdkws.PublicUserInfo{}} - user, err := check.GetUsersInfo(context.Background(), opUserID) + user, err := c.user.GetUsersInfos(ctx, []string{opUserID}, true) if err != nil { return } @@ -125,49 +111,43 @@ func FriendAddedNotification(ctx context.Context, operationID, opUserID, fromUse friendAddedTips.OpUser.Nickname = user[0].Nickname friendAddedTips.OpUser.FaceURL = user[0].FaceURL - friend, err := check.GetFriendsInfo(ctx, fromUserID, toUserID) + friend, err := c.friend.GetFriendsInfo(ctx, fromUserID, toUserID) if err != nil { return } friendAddedTips.Friend = friend - friendNotification(operationID, fromUserID, toUserID, constant.FriendAddedNotification, &friendAddedTips) + c.friendNotification(ctx, fromUserID, toUserID, constant.FriendAddedNotification, &friendAddedTips) } -func FriendDeletedNotification(ctx context.Context, req *pbFriend.DeleteFriendReq) { +func (c *Check) FriendDeletedNotification(ctx context.Context, req *pbFriend.DeleteFriendReq) { friendDeletedTips := sdkws.FriendDeletedTips{FromToUserID: &sdkws.FromToUserID{}} friendDeletedTips.FromToUserID.FromUserID = req.OwnerUserID friendDeletedTips.FromToUserID.ToUserID = req.FriendUserID - friendNotification(tracelog.GetOperationID(ctx), req.OwnerUserID, req.FriendUserID, constant.FriendDeletedNotification, &friendDeletedTips) + c.friendNotification(ctx, req.OwnerUserID, req.FriendUserID, constant.FriendDeletedNotification, &friendDeletedTips) } -func FriendRemarkSetNotification(ctx context.Context, fromUserID, toUserID string) { +func (c *Check) FriendRemarkSetNotification(ctx context.Context, fromUserID, toUserID string) { friendInfoChangedTips := sdkws.FriendInfoChangedTips{FromToUserID: &sdkws.FromToUserID{}} friendInfoChangedTips.FromToUserID.FromUserID = fromUserID friendInfoChangedTips.FromToUserID.ToUserID = toUserID - friendNotification(tracelog.GetOperationID(ctx), fromUserID, toUserID, constant.FriendRemarkSetNotification, &friendInfoChangedTips) + c.friendNotification(ctx, fromUserID, toUserID, constant.FriendRemarkSetNotification, &friendInfoChangedTips) } -func BlackAddedNotification(ctx context.Context, req *pbFriend.AddBlackReq) { +func (c *Check) BlackAddedNotification(ctx context.Context, req *pbFriend.AddBlackReq) { blackAddedTips := sdkws.BlackAddedTips{FromToUserID: &sdkws.FromToUserID{}} blackAddedTips.FromToUserID.FromUserID = req.OwnerUserID blackAddedTips.FromToUserID.ToUserID = req.BlackUserID - friendNotification(tracelog.GetOperationID(ctx), req.OwnerUserID, req.BlackUserID, constant.BlackAddedNotification, &blackAddedTips) + c.friendNotification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackAddedNotification, &blackAddedTips) } -func BlackDeletedNotification(ctx context.Context, req *pbFriend.RemoveBlackReq) { +func (c *Check) BlackDeletedNotification(ctx context.Context, req *pbFriend.RemoveBlackReq) { blackDeletedTips := sdkws.BlackDeletedTips{FromToUserID: &sdkws.FromToUserID{}} blackDeletedTips.FromToUserID.FromUserID = req.OwnerUserID blackDeletedTips.FromToUserID.ToUserID = req.BlackUserID - friendNotification(tracelog.GetOperationID(ctx), req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips) + c.friendNotification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips) } -// send to myself -func UserInfoUpdatedNotification(ctx context.Context, opUserID string, changedUserID string) { +func (c *Check) FriendInfoUpdatedNotification(ctx context.Context, changedUserID string, needNotifiedUserID string, opUserID string) { selfInfoUpdatedTips := sdkws.UserInfoUpdatedTips{UserID: changedUserID} - friendNotification(tracelog.GetOperationID(ctx), opUserID, changedUserID, constant.UserInfoUpdatedNotification, &selfInfoUpdatedTips) -} - -func FriendInfoUpdatedNotification(ctx context.Context, changedUserID string, needNotifiedUserID string, opUserID string) { - selfInfoUpdatedTips := sdkws.UserInfoUpdatedTips{UserID: changedUserID} - friendNotification(tracelog.GetOperationID(ctx), opUserID, needNotifiedUserID, constant.FriendInfoUpdatedNotification, &selfInfoUpdatedTips) + c.friendNotification(ctx, opUserID, needNotifiedUserID, constant.FriendInfoUpdatedNotification, &selfInfoUpdatedTips) } diff --git a/internal/common/notification/group.go b/internal/common/notification/group.go new file mode 100644 index 000000000..e340ed3b7 --- /dev/null +++ b/internal/common/notification/group.go @@ -0,0 +1,548 @@ +package notification + +import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/tokenverify" + "Open_IM/pkg/common/tracelog" + pbGroup "Open_IM/pkg/proto/group" + "Open_IM/pkg/proto/sdkws" + "Open_IM/pkg/utils" + "context" + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +func (c *Check) setOpUserInfo(ctx context.Context, groupID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error { + opUserID := tracelog.GetOpUserID(ctx) + if tokenverify.IsManagerUserID(opUserID) { + user, err := c.user.GetUsersInfos(ctx, []string{opUserID}, true) + if err != nil { + return err + } + groupMemberInfo.GroupID = groupID + groupMemberInfo.UserID = user[0].UserID + groupMemberInfo.Nickname = user[0].Nickname + groupMemberInfo.AppMangerLevel = user[0].AppMangerLevel + groupMemberInfo.FaceURL = user[0].FaceURL + return nil + } + u, err := c.group.GetGroupMemberInfo(ctx, groupID, opUserID) + if err == nil { + *groupMemberInfo = *u + return nil + } + user, err := c.user.GetUsersInfos(ctx, []string{opUserID}, true) + if err != nil { + return err + } + groupMemberInfo.GroupID = groupID + groupMemberInfo.UserID = user[0].UserID + groupMemberInfo.Nickname = user[0].Nickname + groupMemberInfo.AppMangerLevel = user[0].AppMangerLevel + groupMemberInfo.FaceURL = user[0].FaceURL + + return nil +} + +func (c *Check) setGroupInfo(ctx context.Context, groupID string, groupInfo *sdkws.GroupInfo) error { + group, err := c.group.GetGroupInfos(ctx, []string{groupID}, true) + if err != nil { + return err + } + *groupInfo = *group[0] + return nil +} + +func (c *Check) setGroupMemberInfo(ctx context.Context, groupID, userID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error { + groupMember, err := c.group.GetGroupMemberInfo(ctx, groupID, userID) + if err == nil { + *groupMemberInfo = *groupMember + return nil + } + user, err := c.user.GetUsersInfos(ctx, []string{userID}, true) + if err != nil { + return err + } + groupMemberInfo.GroupID = groupID + groupMemberInfo.UserID = user[0].UserID + groupMemberInfo.Nickname = user[0].Nickname + groupMemberInfo.AppMangerLevel = user[0].AppMangerLevel + groupMemberInfo.FaceURL = user[0].FaceURL + return nil +} + +func (c *Check) setGroupOwnerInfo(ctx context.Context, groupID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error { + group, err := c.group.GetGroupInfo(ctx, groupID) + if err != nil { + return err + } + groupMember, err := c.group.GetGroupMemberInfo(ctx, groupID, group.OwnerUserID) + if err != nil { + return err + } + *groupMemberInfo = *groupMember + return nil +} + +func (c *Check) setPublicUserInfo(ctx context.Context, userID string, publicUserInfo *sdkws.PublicUserInfo) error { + user, err := c.user.GetPublicUserInfos(ctx, []string{userID}, true) + if err != nil { + return err + } + *publicUserInfo = *user[0] + return nil +} + +func (c *Check) groupNotification(ctx context.Context, contentType int32, m proto.Message, sendID, groupID, recvUserID string) { + var err error + var tips sdkws.TipsComm + tips.Detail, err = proto.Marshal(m) + if err != nil { + return + } + marshaler := jsonpb.Marshaler{ + OrigName: true, + EnumsAsInts: false, + EmitDefaults: false, + } + tips.JsonDetail, _ = marshaler.MarshalToString(m) + var nickname, toNickname string + if sendID != "" { + + from, err := c.user.GetUsersInfos(ctx, []string{sendID}, true) + if err != nil { + return + } + nickname = from[0].Nickname + } + if recvUserID != "" { + to, err := c.user.GetUsersInfos(ctx, []string{recvUserID}, true) + if err != nil { + return + } + toNickname = to[0].Nickname + } + + cn := config.Config.Notification + switch contentType { + case constant.GroupCreatedNotification: + tips.DefaultTips = nickname + " " + cn.GroupCreated.DefaultTips.Tips + case constant.GroupInfoSetNotification: + tips.DefaultTips = nickname + " " + cn.GroupInfoSet.DefaultTips.Tips + case constant.JoinGroupApplicationNotification: + tips.DefaultTips = nickname + " " + cn.JoinGroupApplication.DefaultTips.Tips + case constant.MemberQuitNotification: + tips.DefaultTips = nickname + " " + cn.MemberQuit.DefaultTips.Tips + case constant.GroupApplicationAcceptedNotification: // + tips.DefaultTips = toNickname + " " + cn.GroupApplicationAccepted.DefaultTips.Tips + case constant.GroupApplicationRejectedNotification: // + tips.DefaultTips = toNickname + " " + cn.GroupApplicationRejected.DefaultTips.Tips + case constant.GroupOwnerTransferredNotification: // + tips.DefaultTips = toNickname + " " + cn.GroupOwnerTransferred.DefaultTips.Tips + case constant.MemberKickedNotification: // + tips.DefaultTips = toNickname + " " + cn.MemberKicked.DefaultTips.Tips + case constant.MemberInvitedNotification: // + tips.DefaultTips = toNickname + " " + cn.MemberInvited.DefaultTips.Tips + case constant.MemberEnterNotification: + tips.DefaultTips = toNickname + " " + cn.MemberEnter.DefaultTips.Tips + case constant.GroupDismissedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupDismissed.DefaultTips.Tips + case constant.GroupMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMuted.DefaultTips.Tips + case constant.GroupCancelMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupCancelMuted.DefaultTips.Tips + case constant.GroupMemberMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberMuted.DefaultTips.Tips + case constant.GroupMemberCancelMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberCancelMuted.DefaultTips.Tips + case constant.GroupMemberInfoSetNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberInfoSet.DefaultTips.Tips + case constant.GroupMemberSetToAdminNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberSetToAdmin.DefaultTips.Tips + case constant.GroupMemberSetToOrdinaryUserNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberSetToOrdinary.DefaultTips.Tips + default: + return + } + + var n NotificationMsg + n.SendID = sendID + if groupID != "" { + n.RecvID = groupID + + group, err := c.group.GetGroupInfo(ctx, groupID) + if err != nil { + return + } + switch group.GroupType { + case constant.NormalGroup: + n.SessionType = constant.GroupChatType + default: + n.SessionType = constant.SuperGroupChatType + } + } else { + n.RecvID = recvUserID + n.SessionType = constant.SingleChatType + } + n.ContentType = contentType + n.Content, err = proto.Marshal(&tips) + if err != nil { + return + } + c.Notification(ctx, &n) +} + +// 创建群后调用 +func (c *Check) GroupCreatedNotification(ctx context.Context, groupID string, initMemberList []string) { + GroupCreatedTips := sdkws.GroupCreatedTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}, GroupOwnerUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setOpUserInfo(ctx, groupID, GroupCreatedTips.OpUser); err != nil { + return + } + err := c.setGroupInfo(ctx, groupID, GroupCreatedTips.Group) + if err != nil { + return + } + + if err := c.setGroupOwnerInfo(ctx, groupID, GroupCreatedTips.GroupOwnerUser); err != nil { + return + } + for _, v := range initMemberList { + var groupMemberInfo sdkws.GroupMemberFullInfo + if err := c.setGroupMemberInfo(ctx, groupID, v, &groupMemberInfo); err != nil { + continue + } + GroupCreatedTips.MemberList = append(GroupCreatedTips.MemberList, &groupMemberInfo) + if len(GroupCreatedTips.MemberList) == constant.MaxNotificationNum { + break + } + } + + c.groupNotification(ctx, constant.GroupCreatedNotification, &GroupCreatedTips, tracelog.GetOpUserID(ctx), groupID, "") +} + +// 群信息改变后掉用 +// groupName := "" +// +// notification := "" +// introduction := "" +// faceURL := "" +func (c *Check) GroupInfoSetNotification(ctx context.Context, groupID string, groupName, notification, introduction, faceURL string, needVerification *wrapperspb.Int32Value) { + GroupInfoChangedTips := sdkws.GroupInfoSetTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, GroupInfoChangedTips.Group); err != nil { + return + } + GroupInfoChangedTips.Group.GroupName = groupName + GroupInfoChangedTips.Group.Notification = notification + GroupInfoChangedTips.Group.Introduction = introduction + GroupInfoChangedTips.Group.FaceURL = faceURL + if needVerification != nil { + GroupInfoChangedTips.Group.NeedVerification = needVerification.Value + } + + if err := c.setOpUserInfo(ctx, groupID, GroupInfoChangedTips.OpUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupInfoSetNotification, &GroupInfoChangedTips, tracelog.GetOpUserID(ctx), groupID, "") +} + +func (c *Check) GroupMutedNotification(ctx context.Context, groupID string) { + tips := sdkws.GroupMutedTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, tips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, groupID, tips.OpUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupMutedNotification, &tips, tracelog.GetOpUserID(ctx), groupID, "") +} + +func (c *Check) GroupCancelMutedNotification(ctx context.Context, groupID string) { + tips := sdkws.GroupCancelMutedTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, tips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, groupID, tips.OpUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupCancelMutedNotification, &tips, tracelog.GetOpUserID(ctx), groupID, "") +} + +func (c *Check) GroupMemberMutedNotification(ctx context.Context, groupID, groupMemberUserID string, mutedSeconds uint32) { + tips := sdkws.GroupMemberMutedTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}, MutedUser: &sdkws.GroupMemberFullInfo{}} + tips.MutedSeconds = mutedSeconds + if err := c.setGroupInfo(ctx, groupID, tips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, groupID, tips.OpUser); err != nil { + return + } + if err := c.setGroupMemberInfo(ctx, groupID, groupMemberUserID, tips.MutedUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupMemberMutedNotification, &tips, tracelog.GetOpUserID(ctx), groupID, "") +} + +func (c *Check) GroupMemberInfoSetNotification(ctx context.Context, groupID, groupMemberUserID string) { + tips := sdkws.GroupMemberInfoSetTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}, ChangedUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, tips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, groupID, tips.OpUser); err != nil { + return + } + if err := c.setGroupMemberInfo(ctx, groupID, groupMemberUserID, tips.ChangedUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupMemberInfoSetNotification, &tips, tracelog.GetOpUserID(ctx), groupID, "") +} + +func (c *Check) GroupMemberRoleLevelChangeNotification(ctx context.Context, operationID, opUserID, groupID, groupMemberUserID string, notificationType int32) { + if notificationType != constant.GroupMemberSetToAdminNotification && notificationType != constant.GroupMemberSetToOrdinaryUserNotification { + log.NewError(operationID, utils.GetSelfFuncName(), "invalid notificationType: ", notificationType) + return + } + tips := sdkws.GroupMemberInfoSetTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}, ChangedUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, tips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := c.setOpUserInfo(ctx, groupID, tips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + if err := c.setGroupMemberInfo(ctx, groupID, groupMemberUserID, tips.ChangedUser); err != nil { + log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) + return + } + c.groupNotification(ctx, notificationType, &tips, tracelog.GetOpUserID(ctx), groupID, "") +} + +func (c *Check) GroupMemberCancelMutedNotification(ctx context.Context, groupID, groupMemberUserID string) { + tips := sdkws.GroupMemberCancelMutedTips{Group: &sdkws.GroupInfo{}, + OpUser: &sdkws.GroupMemberFullInfo{}, MutedUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, tips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, groupID, tips.OpUser); err != nil { + return + } + if err := c.setGroupMemberInfo(ctx, groupID, groupMemberUserID, tips.MutedUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupMemberCancelMutedNotification, &tips, tracelog.GetOpUserID(ctx), groupID, "") +} + +// message ReceiveJoinApplicationTips{ +// GroupInfo Group = 1; +// PublicUserInfo Applicant = 2; +// string Reason = 3; +// } apply->all managers GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` +// +// ReqMessage string `protobuf:"bytes,2,opt,name=ReqMessage" json:"ReqMessage,omitempty"` +// OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,omitempty"` +// OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` +// +// 申请进群后调用 +func (c *Check) JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) { + JoinGroupApplicationTips := sdkws.JoinGroupApplicationTips{Group: &sdkws.GroupInfo{}, Applicant: &sdkws.PublicUserInfo{}} + err := c.setGroupInfo(ctx, req.GroupID, JoinGroupApplicationTips.Group) + if err != nil { + + return + } + if err = c.setPublicUserInfo(ctx, tracelog.GetOpUserID(ctx), JoinGroupApplicationTips.Applicant); err != nil { + + return + } + JoinGroupApplicationTips.ReqMsg = req.ReqMessage + managerList, err := c.group.GetOwnerAndAdminInfos(ctx, req.GroupID) + if err != nil { + return + } + for _, v := range managerList { + c.groupNotification(ctx, constant.JoinGroupApplicationNotification, &JoinGroupApplicationTips, tracelog.GetOpUserID(ctx), "", v.UserID) + } +} + +func (c *Check) MemberQuitNotification(ctx context.Context, req *pbGroup.QuitGroupReq) { + MemberQuitTips := sdkws.MemberQuitTips{Group: &sdkws.GroupInfo{}, QuitUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, req.GroupID, MemberQuitTips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, req.GroupID, MemberQuitTips.QuitUser); err != nil { + return + } + + c.groupNotification(ctx, constant.MemberQuitNotification, &MemberQuitTips, tracelog.GetOpUserID(ctx), req.GroupID, "") +} + +// message ApplicationProcessedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo OpUser = 2; +// int32 Result = 3; +// string Reason = 4; +// } +// +// 处理进群请求后调用 +func (c *Check) GroupApplicationAcceptedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) { + GroupApplicationAcceptedTips := sdkws.GroupApplicationAcceptedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg} + if err := c.setGroupInfo(ctx, req.GroupID, GroupApplicationAcceptedTips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, req.GroupID, GroupApplicationAcceptedTips.OpUser); err != nil { + return + } + + c.groupNotification(ctx, constant.GroupApplicationAcceptedNotification, &GroupApplicationAcceptedTips, tracelog.GetOpUserID(ctx), "", req.FromUserID) + adminList, err := c.group.GetOwnerAndAdminInfos(ctx, req.GroupID) + if err != nil { + return + } + for _, v := range adminList { + if v.UserID == tracelog.GetOpUserID(ctx) { + continue + } + GroupApplicationAcceptedTips.ReceiverAs = 1 + c.groupNotification(ctx, constant.GroupApplicationAcceptedNotification, &GroupApplicationAcceptedTips, tracelog.GetOpUserID(ctx), "", v.UserID) + } +} + +func (c *Check) GroupApplicationRejectedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) { + GroupApplicationRejectedTips := sdkws.GroupApplicationRejectedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg} + if err := c.setGroupInfo(ctx, req.GroupID, GroupApplicationRejectedTips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, req.GroupID, GroupApplicationRejectedTips.OpUser); err != nil { + return + } + c.groupNotification(ctx, constant.GroupApplicationRejectedNotification, &GroupApplicationRejectedTips, tracelog.GetOpUserID(ctx), "", req.FromUserID) + adminList, err := c.group.GetOwnerAndAdminInfos(ctx, req.GroupID) + if err != nil { + return + } + for _, v := range adminList { + if v.UserID == tracelog.GetOpUserID(ctx) { + continue + } + GroupApplicationRejectedTips.ReceiverAs = 1 + c.groupNotification(ctx, constant.GroupApplicationRejectedNotification, &GroupApplicationRejectedTips, tracelog.GetOpUserID(ctx), "", v.UserID) + } +} + +func (c *Check) GroupOwnerTransferredNotification(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) { + GroupOwnerTransferredTips := sdkws.GroupOwnerTransferredTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, NewGroupOwner: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, req.GroupID, GroupOwnerTransferredTips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, req.GroupID, GroupOwnerTransferredTips.OpUser); err != nil { + return + } + if err := c.setGroupMemberInfo(ctx, req.GroupID, req.NewOwnerUserID, GroupOwnerTransferredTips.NewGroupOwner); err != nil { + return + } + c.groupNotification(ctx, constant.GroupOwnerTransferredNotification, &GroupOwnerTransferredTips, tracelog.GetOpUserID(ctx), req.GroupID, "") +} + +func (c *Check) GroupDismissedNotification(ctx context.Context, req *pbGroup.DismissGroupReq) { + tips := sdkws.GroupDismissedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, req.GroupID, tips.Group); err != nil { + + return + } + if err := c.setOpUserInfo(ctx, req.GroupID, tips.OpUser); err != nil { + + return + } + c.groupNotification(ctx, constant.GroupDismissedNotification, &tips, tracelog.GetOpUserID(ctx), req.GroupID, "") +} + +// message MemberKickedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo OpUser = 2; +// GroupMemberFullInfo KickedUser = 3; +// uint64 OperationTime = 4; +// } +// +// 被踢后调用 +func (c *Check) MemberKickedNotification(ctx context.Context, req *pbGroup.KickGroupMemberReq, kickedUserIDList []string) { + MemberKickedTips := sdkws.MemberKickedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, req.GroupID, MemberKickedTips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, req.GroupID, MemberKickedTips.OpUser); err != nil { + return + } + for _, v := range kickedUserIDList { + var groupMemberInfo sdkws.GroupMemberFullInfo + if err := c.setGroupMemberInfo(ctx, req.GroupID, v, &groupMemberInfo); err != nil { + continue + } + MemberKickedTips.KickedUserList = append(MemberKickedTips.KickedUserList, &groupMemberInfo) + } + c.groupNotification(ctx, constant.MemberKickedNotification, &MemberKickedTips, tracelog.GetOpUserID(ctx), req.GroupID, "") + // + //for _, v := range kickedUserIDList { + // groupNotification(constant.MemberKickedNotification, &MemberKickedTips, req.OpUserID, "", v, req.OperationID) + //} +} + +// message MemberInvitedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo OpUser = 2; +// GroupMemberFullInfo InvitedUser = 3; +// uint64 OperationTime = 4; +// } +// +// 被邀请进群后调用 +func (c *Check) MemberInvitedNotification(ctx context.Context, groupID, reason string, invitedUserIDList []string) { + MemberInvitedTips := sdkws.MemberInvitedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, MemberInvitedTips.Group); err != nil { + return + } + if err := c.setOpUserInfo(ctx, groupID, MemberInvitedTips.OpUser); err != nil { + + return + } + for _, v := range invitedUserIDList { + var groupMemberInfo sdkws.GroupMemberFullInfo + if err := c.setGroupMemberInfo(ctx, groupID, v, &groupMemberInfo); err != nil { + continue + } + MemberInvitedTips.InvitedUserList = append(MemberInvitedTips.InvitedUserList, &groupMemberInfo) + } + c.groupNotification(ctx, constant.MemberInvitedNotification, &MemberInvitedTips, tracelog.GetOpUserID(ctx), groupID, "") +} + +// 群成员主动申请进群,管理员同意后调用, +func (c *Check) MemberEnterNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) { + MemberEnterTips := sdkws.MemberEnterTips{Group: &sdkws.GroupInfo{}, EntrantUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, req.GroupID, MemberEnterTips.Group); err != nil { + return + } + if err := c.setGroupMemberInfo(ctx, req.GroupID, req.FromUserID, MemberEnterTips.EntrantUser); err != nil { + return + } + c.groupNotification(ctx, constant.MemberEnterNotification, &MemberEnterTips, tracelog.GetOpUserID(ctx), req.GroupID, "") +} + +func (c *Check) MemberEnterDirectlyNotification(ctx context.Context, groupID string, entrantUserID string, operationID string) { + MemberEnterTips := sdkws.MemberEnterTips{Group: &sdkws.GroupInfo{}, EntrantUser: &sdkws.GroupMemberFullInfo{}} + if err := c.setGroupInfo(ctx, groupID, MemberEnterTips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID, MemberEnterTips.Group) + return + } + if err := c.setGroupMemberInfo(ctx, groupID, entrantUserID, MemberEnterTips.EntrantUser); err != nil { + log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, entrantUserID, MemberEnterTips.EntrantUser) + return + } + c.groupNotification(ctx, constant.MemberEnterNotification, &MemberEnterTips, entrantUserID, groupID, "") +} diff --git a/internal/common/notification/msg.go b/internal/common/notification/msg.go new file mode 100644 index 000000000..137faf02f --- /dev/null +++ b/internal/common/notification/msg.go @@ -0,0 +1,42 @@ +package notification + +import ( + "Open_IM/pkg/common/constant" + "Open_IM/pkg/proto/sdkws" + "context" + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +func (c *Check) DeleteMessageNotification(ctx context.Context, userID string, seqList []uint32, operationID string) { + DeleteMessageTips := sdkws.DeleteMessageTips{UserID: userID, SeqList: seqList} + c.MessageNotification(ctx, userID, userID, constant.DeleteMessageNotification, &DeleteMessageTips) +} + +func (c *Check) MessageNotification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message) { + var err error + var tips sdkws.TipsComm + tips.Detail, err = proto.Marshal(m) + if err != nil { + return + } + + marshaler := jsonpb.Marshaler{ + OrigName: true, + EnumsAsInts: false, + EmitDefaults: false, + } + + tips.JsonDetail, _ = marshaler.MarshalToString(m) + var n NotificationMsg + n.SendID = sendID + n.RecvID = recvID + n.ContentType = contentType + n.SessionType = constant.SingleChatType + n.MsgFrom = constant.SysMsgType + n.Content, err = proto.Marshal(&tips) + if err != nil { + return + } + c.Notification(ctx, &n) +} diff --git a/internal/rpc/msg/super_group_notification.go b/internal/common/notification/super_group.go similarity index 54% rename from internal/rpc/msg/super_group_notification.go rename to internal/common/notification/super_group.go index 062b44e47..1e9f18a90 100644 --- a/internal/rpc/msg/super_group_notification.go +++ b/internal/common/notification/super_group.go @@ -1,23 +1,19 @@ -package msg +package notification import ( "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - //sdk "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" + "context" //"github.com/golang/protobuf/jsonpb" //"github.com/golang/protobuf/proto" ) -func SuperGroupNotification(operationID, sendID, recvID string) { +func (c *Check) SuperGroupNotification(ctx context.Context, sendID, recvID string) { n := &NotificationMsg{ SendID: sendID, RecvID: recvID, MsgFrom: constant.SysMsgType, ContentType: constant.SuperGroupUpdateNotification, SessionType: constant.SingleChatType, - OperationID: operationID, } - log.NewInfo(operationID, utils.GetSelfFuncName(), string(n.Content)) - Notification(n) + c.Notification(ctx, n) } diff --git a/internal/common/notification/user.go b/internal/common/notification/user.go new file mode 100644 index 000000000..01d5fcee8 --- /dev/null +++ b/internal/common/notification/user.go @@ -0,0 +1,13 @@ +package notification + +import ( + "Open_IM/pkg/common/constant" + "Open_IM/pkg/proto/sdkws" + "context" +) + +// send to myself +func (c *Check) UserInfoUpdatedNotification(ctx context.Context, opUserID string, changedUserID string) { + selfInfoUpdatedTips := sdkws.UserInfoUpdatedTips{UserID: changedUserID} + c.friendNotification(ctx, opUserID, changedUserID, constant.UserInfoUpdatedNotification, &selfInfoUpdatedTips) +} diff --git a/internal/msggateway/callback.go b/internal/msggateway/callback.go index 6c709514b..f284835a8 100644 --- a/internal/msggateway/callback.go +++ b/internal/msggateway/callback.go @@ -1,89 +1,155 @@ package msggateway import ( - cbApi "Open_IM/pkg/callback_struct" + cbapi "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" - http2 "net/http" + "Open_IM/pkg/common/tracelog" + "context" "time" ) -func callbackUserOnline(operationID, userID string, platformID int, token string, isAppBackground bool, connID string) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +func url() string { + return config.Config.Callback.CallbackUrl +} + +func CallbackUserOnline(ctx context.Context, userID string, platformID int, isAppBackground bool, connID string) error { if !config.Config.Callback.CallbackUserOnline.Enable { - return callbackResp + return nil } - callbackUserOnlineReq := cbApi.CallbackUserOnlineReq{ - Token: token, - UserStatusCallbackReq: cbApi.UserStatusCallbackReq{ - UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ + req := cbapi.CallbackUserOnlineReq{ + UserStatusCallbackReq: cbapi.UserStatusCallbackReq{ + UserStatusBaseCallback: cbapi.UserStatusBaseCallback{ CallbackCommand: constant.CallbackUserOnlineCommand, - OperationID: operationID, - PlatformID: int32(platformID), + OperationID: tracelog.GetOperationID(ctx), + PlatformID: platformID, Platform: constant.PlatformIDToName(platformID), }, UserID: userID, }, - Seq: int(time.Now().UnixNano() / 1e6), + Seq: time.Now().UnixMilli(), IsAppBackground: isAppBackground, ConnID: connID, } - callbackUserOnlineResp := &cbApi.CallbackUserOnlineResp{CommonCallbackResp: &callbackResp} - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackUserOnlineCommand, callbackUserOnlineReq, callbackUserOnlineResp, config.Config.Callback.CallbackUserOnline.CallbackTimeOut); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - } - return callbackResp + resp := cbapi.CommonCallbackResp{} + return http.CallBackPostReturn(url(), &req, &resp, config.Config.Callback.CallbackUserOnline) } -func callbackUserOffline(operationID, userID string, platformID int, connID string) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +func CallbackUserOffline(ctx context.Context, userID string, platformID int, connID string) error { if !config.Config.Callback.CallbackUserOffline.Enable { - return callbackResp + return nil } - callbackOfflineReq := cbApi.CallbackUserOfflineReq{ - UserStatusCallbackReq: cbApi.UserStatusCallbackReq{ - UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ + req := &cbapi.CallbackUserOfflineReq{ + UserStatusCallbackReq: cbapi.UserStatusCallbackReq{ + UserStatusBaseCallback: cbapi.UserStatusBaseCallback{ CallbackCommand: constant.CallbackUserOfflineCommand, - OperationID: operationID, - PlatformID: int32(platformID), + OperationID: tracelog.GetOperationID(ctx), + PlatformID: platformID, Platform: constant.PlatformIDToName(platformID), }, UserID: userID, }, - Seq: int(time.Now().UnixNano() / 1e6), + Seq: time.Now().UnixMilli(), ConnID: connID, } - callbackUserOfflineResp := &cbApi.CallbackUserOfflineResp{CommonCallbackResp: &callbackResp} - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackUserOfflineCommand, callbackOfflineReq, callbackUserOfflineResp, config.Config.Callback.CallbackUserOffline.CallbackTimeOut); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - } - return callbackResp + resp := &cbapi.CallbackUserOfflineResp{} + return http.CallBackPostReturn(url(), req, resp, config.Config.Callback.CallbackUserOffline) } -func callbackUserKickOff(operationID string, userID string, platformID int) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +func CallbackUserKickOff(ctx context.Context, userID string, platformID int) error { if !config.Config.Callback.CallbackUserKickOff.Enable { - return callbackResp + return nil } - callbackUserKickOffReq := cbApi.CallbackUserKickOffReq{ - UserStatusCallbackReq: cbApi.UserStatusCallbackReq{ - UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ + req := &cbapi.CallbackUserKickOffReq{ + UserStatusCallbackReq: cbapi.UserStatusCallbackReq{ + UserStatusBaseCallback: cbapi.UserStatusBaseCallback{ CallbackCommand: constant.CallbackUserKickOffCommand, - OperationID: operationID, - PlatformID: int32(platformID), + OperationID: tracelog.GetOperationID(ctx), + PlatformID: platformID, Platform: constant.PlatformIDToName(platformID), }, UserID: userID, }, - Seq: int(time.Now().UnixNano() / 1e6), + Seq: time.Now().UnixMilli(), } - callbackUserKickOffResp := &cbApi.CallbackUserKickOffResp{CommonCallbackResp: &callbackResp} - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackUserKickOffCommand, callbackUserKickOffReq, callbackUserKickOffResp, config.Config.Callback.CallbackUserOffline.CallbackTimeOut); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - } - return callbackResp + resp := &cbapi.CommonCallbackResp{} + return http.CallBackPostReturn(url(), req, resp, config.Config.Callback.CallbackUserOffline) } + +//func callbackUserOnline(operationID, userID string, platformID int, token string, isAppBackground bool, connID string) cbApi.CommonCallbackResp { +// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +// if !config.Config.Callback.CallbackUserOnline.Enable { +// return callbackResp +// } +// callbackUserOnlineReq := cbApi.CallbackUserOnlineReq{ +// Token: token, +// UserStatusCallbackReq: cbApi.UserStatusCallbackReq{ +// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ +// CallbackCommand: constant.CallbackUserOnlineCommand, +// OperationID: operationID, +// PlatformID: int32(platformID), +// Platform: constant.PlatformIDToName(platformID), +// }, +// UserID: userID, +// }, +// Seq: int(time.Now().UnixNano() / 1e6), +// IsAppBackground: isAppBackground, +// ConnID: connID, +// } +// callbackUserOnlineResp := &cbApi.CallbackUserOnlineResp{CommonCallbackResp: &callbackResp} +// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackUserOnlineCommand, callbackUserOnlineReq, callbackUserOnlineResp, config.Config.Callback.CallbackUserOnline.CallbackTimeOut); err != nil { +// callbackResp.ErrCode = http2.StatusInternalServerError +// callbackResp.ErrMsg = err.Error() +// } +// return callbackResp +//} +//func callbackUserOffline(operationID, userID string, platformID int, connID string) cbApi.CommonCallbackResp { +// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +// if !config.Config.Callback.CallbackUserOffline.Enable { +// return callbackResp +// } +// callbackOfflineReq := cbApi.CallbackUserOfflineReq{ +// UserStatusCallbackReq: cbApi.UserStatusCallbackReq{ +// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ +// CallbackCommand: constant.CallbackUserOfflineCommand, +// OperationID: operationID, +// PlatformID: int32(platformID), +// Platform: constant.PlatformIDToName(platformID), +// }, +// UserID: userID, +// }, +// Seq: int(time.Now().UnixNano() / 1e6), +// ConnID: connID, +// } +// callbackUserOfflineResp := &cbApi.CallbackUserOfflineResp{CommonCallbackResp: &callbackResp} +// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackUserOfflineCommand, callbackOfflineReq, callbackUserOfflineResp, config.Config.Callback.CallbackUserOffline.CallbackTimeOut); err != nil { +// callbackResp.ErrCode = http2.StatusInternalServerError +// callbackResp.ErrMsg = err.Error() +// } +// return callbackResp +//} +//func callbackUserKickOff(operationID string, userID string, platformID int) cbApi.CommonCallbackResp { +// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +// if !config.Config.Callback.CallbackUserKickOff.Enable { +// return callbackResp +// } +// callbackUserKickOffReq := cbApi.CallbackUserKickOffReq{ +// UserStatusCallbackReq: cbApi.UserStatusCallbackReq{ +// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ +// CallbackCommand: constant.CallbackUserKickOffCommand, +// OperationID: operationID, +// PlatformID: int32(platformID), +// Platform: constant.PlatformIDToName(platformID), +// }, +// UserID: userID, +// }, +// Seq: int(time.Now().UnixNano() / 1e6), +// } +// callbackUserKickOffResp := &cbApi.CallbackUserKickOffResp{CommonCallbackResp: &callbackResp} +// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackUserKickOffCommand, callbackUserKickOffReq, callbackUserKickOffResp, config.Config.Callback.CallbackUserOffline.CallbackTimeOut); err != nil { +// callbackResp.ErrCode = http2.StatusInternalServerError +// callbackResp.ErrMsg = err.Error() +// } +// return callbackResp +//} diff --git a/internal/msggateway/new/client.go b/internal/msggateway/new/client.go new file mode 100644 index 000000000..3feca66af --- /dev/null +++ b/internal/msggateway/new/client.go @@ -0,0 +1,148 @@ +package new + +import ( + "Open_IM/pkg/common/constant" + promePkg "Open_IM/pkg/common/prometheus" + "context" + "errors" + "fmt" + "github.com/envoyproxy/protoc-gen-validate/validate" + "github.com/go-playground/validator/v10" + "open_im_sdk/pkg/log" + "open_im_sdk/pkg/utils" + "runtime/debug" + "sync" +) + +const ( + // MessageText is for UTF-8 encoded text messages like JSON. + MessageText = iota + 1 + // MessageBinary is for binary messages like protobufs. + MessageBinary + // CloseMessage denotes a close control message. The optional message + // payload contains a numeric code and text. Use the FormatCloseMessage + // function to format a close message payload. + CloseMessage = 8 + + // PingMessage denotes a ping control message. The optional message payload + // is UTF-8 encoded text. + PingMessage = 9 + + // PongMessage denotes a pong control message. The optional message payload + // is UTF-8 encoded text. + PongMessage = 10 +) + +type Client struct { + w *sync.Mutex + conn LongConn + PlatformID int32 + PushedMaxSeq uint32 + IsCompress bool + userID string + IsBackground bool + token string + connID string + onlineAt int64 // 上线时间戳(毫秒) + handler MessageHandler + unregisterChan chan *Client + compressor Compressor + encoder Encoder + userContext UserConnContext + validate *validator.Validate +} + +func newClient( conn LongConn,isCompress bool, userID string, isBackground bool, token string, + connID string, onlineAt int64, handler MessageHandler,unregisterChan chan *Client) *Client { + return &Client{ + conn: conn, + IsCompress: isCompress, + userID: userID, IsBackground: + isBackground, token: token, + connID: connID, + onlineAt: onlineAt, + handler: handler, + unregisterChan: unregisterChan, + } +} +func(c *Client) readMessage(){ + defer func() { + if r:=recover(); r != nil { + fmt.Println("socket have panic err:", r, string(debug.Stack())) + } + //c.close() + }() + var returnErr error + for { + messageType, message, returnErr := c.conn.ReadMessage() + if returnErr!=nil{ + break + } + switch messageType { + case PingMessage: + case PongMessage: + case CloseMessage: + return + case MessageText: + case MessageBinary: + if len(message) == 0 { + continue + } + returnErr = c.handleMessage(message) + if returnErr!=nil{ + break + } + + } + } + +} +func (c *Client) handleMessage(message []byte)error { + if c.IsCompress { + var decompressErr error + message,decompressErr = c.compressor.DeCompress(message) + if decompressErr != nil { + return utils.Wrap(decompressErr,"") + } + } + var binaryReq Req + err := c.encoder.Decode(message, &binaryReq) + if err != nil { + return utils.Wrap(err,"") + } + if err := c.validate.Struct(binaryReq); err != nil { + return utils.Wrap(err,"") + } + if binaryReq.SendID != c.userID { + return errors.New("exception conn userID not same to req userID") + } + ctx:=context.Background() + ctx =context.WithValue(ctx,"operationID",binaryReq.OperationID) + ctx = context.WithValue(ctx,"userID",binaryReq.SendID) + var messageErr error + var resp []byte + switch binaryReq.ReqIdentifier { + case constant.WSGetNewestSeq: + resp,messageErr=c.handler.GetSeq(ctx,binaryReq) + case constant.WSSendMsg: + resp,messageErr=c.handler.SendMessage(ctx,binaryReq) + case constant.WSSendSignalMsg: + resp,messageErr=c.handler.SendSignalMessage(ctx,binaryReq) + case constant.WSPullMsgBySeqList: + resp,messageErr=c.handler.PullMessageBySeqList(ctx,binaryReq) + case constant.WsLogoutMsg: + resp,messageErr=c.handler.UserLogout(ctx,binaryReq) + case constant.WsSetBackgroundStatus: + resp,messageErr=c.handler.SetUserDeviceBackground(ctx,binaryReq) + default: + return errors.New(fmt.Sprintf("ReqIdentifier failed,sendID:%d,msgIncr:%s,reqIdentifier:%s",binaryReq.SendID,binaryReq.MsgIncr,binaryReq.ReqIdentifier)) + } + + +} +func (c *Client) close() { + +} +func () { + +} diff --git a/internal/msggateway/new/compressor.go b/internal/msggateway/new/compressor.go new file mode 100644 index 000000000..42abcccd1 --- /dev/null +++ b/internal/msggateway/new/compressor.go @@ -0,0 +1,44 @@ +package new + +import ( + "bytes" + "compress/gzip" + "io/ioutil" + "open_im_sdk/pkg/utils" +) + +type Compressor interface { + Compress(rawData []byte) ([]byte, error) + DeCompress(compressedData []byte) ([]byte, error) +} +type GzipCompressor struct { + compressProtocol string +} + +func NewGzipCompressor() *GzipCompressor { + return &GzipCompressor{compressProtocol: "gzip"} +} +func (g *GzipCompressor) Compress(rawData []byte) ([]byte, error) { + gzipBuffer := bytes.Buffer{} + gz := gzip.NewWriter(&gzipBuffer) + if _, err := gz.Write(rawData); err != nil { + return nil, utils.Wrap(err, "") + } + if err := gz.Close(); err != nil { + return nil, utils.Wrap(err, "") + } + return gzipBuffer.Bytes(), nil +} +func (g *GzipCompressor) DeCompress(compressedData []byte) ([]byte, error) { + buff := bytes.NewBuffer(compressedData) + reader, err := gzip.NewReader(buff) + if err != nil { + return nil, utils.Wrap(err, "NewReader failed") + } + compressedData, err = ioutil.ReadAll(reader) + if err != nil { + return nil, utils.Wrap(err, "ReadAll failed") + } + _ = reader.Close() + return compressedData, nil +} diff --git a/internal/msggateway/new/context.go b/internal/msggateway/new/context.go new file mode 100644 index 000000000..9ab353351 --- /dev/null +++ b/internal/msggateway/new/context.go @@ -0,0 +1,27 @@ +package new + +import "net/http" + +type UserConnContext struct { + RespWriter http.ResponseWriter + Req *http.Request + Path string + Method string + RemoteAddr string +} + +func newContext(respWriter http.ResponseWriter, req *http.Request) *UserConnContext { + return &UserConnContext{ + RespWriter: respWriter, + Req: req, + Path: req.URL.Path, + Method: req.Method, + RemoteAddr: req.RemoteAddr, + } +} +func (c *UserConnContext) Query(key string) string { + return c.Req.URL.Query().Get(key) +} +func (c *UserConnContext) GetHeader(key string) string { + return c.Req.Header.Get(key) +} diff --git a/internal/msggateway/new/encoder.go b/internal/msggateway/new/encoder.go new file mode 100644 index 000000000..10f369d2b --- /dev/null +++ b/internal/msggateway/new/encoder.go @@ -0,0 +1,37 @@ +package new + +import ( + "bytes" + "encoding/gob" + "open_im_sdk/pkg/utils" +) + +type Encoder interface { + Encode(data interface{}) ([]byte, error) + Decode(encodeData []byte, decodeData interface{}) error +} + +type GobEncoder struct { +} + +func NewGobEncoder() *GobEncoder { + return &GobEncoder{} +} +func (g *GobEncoder) Encode(data interface{}) ([]byte, error) { + buff := bytes.Buffer{} + enc := gob.NewEncoder(&buff) + err := enc.Encode(data) + if err != nil { + return nil, err + } + return buff.Bytes(), nil +} +func (g *GobEncoder) Decode(encodeData []byte, decodeData interface{}) error { + buff := bytes.NewBuffer(encodeData) + dec := gob.NewDecoder(buff) + err := dec.Decode(decodeData) + if err != nil { + return utils.Wrap(err, "") + } + return nil +} diff --git a/internal/msggateway/new/long_conn.go b/internal/msggateway/new/long_conn.go new file mode 100644 index 000000000..823964e40 --- /dev/null +++ b/internal/msggateway/new/long_conn.go @@ -0,0 +1,83 @@ +package new + +import ( + "github.com/gorilla/websocket" + "net/http" + "time" +) + +type LongConn interface { + //Close this connection + Close() error + //Write message to connection,messageType means data type,can be set binary(2) and text(1). + WriteMessage(messageType int, message []byte) error + //Read message from connection. + ReadMessage() (int, []byte, error) + //SetReadTimeout sets the read deadline on the underlying network connection, + //after a read has timed out, will return an error. + SetReadTimeout(timeout int) error + //SetWriteTimeout sets the write deadline when send message,when read has timed out,will return error. + SetWriteTimeout(timeout int) error + //Try to dial a connection,url must set auth args,header can control compress data + Dial(urlStr string, requestHeader http.Header) (*http.Response, error) + //Whether the connection of the current long connection is nil + IsNil() bool + //Set the connection of the current long connection to nil + SetConnNil() + //Check the connection of the current and when it was sent are the same + CheckSendConnDiffNow() bool +} +type GWebSocket struct { + protocolType int + conn *websocket.Conn +} + +func NewDefault(protocolType int) *GWebSocket { + return &GWebSocket{protocolType: protocolType} +} +func (d *GWebSocket) Close() error { + return d.conn.Close() +} + +func (d *GWebSocket) WriteMessage(messageType int, message []byte) error { + d.setSendConn(d.conn) + return d.conn.WriteMessage(messageType, message) +} + +func (d *GWebSocket) setSendConn(sendConn *websocket.Conn) { + d.sendConn = sendConn +} + +func (d *GWebSocket) ReadMessage() (int, []byte, error) { + return d.conn.ReadMessage() +} +func (d *GWebSocket) SetReadTimeout(timeout int) error { + return d.conn.SetReadDeadline(time.Now().Add(time.Duration(timeout) * time.Second)) +} + +func (d *GWebSocket) SetWriteTimeout(timeout int) error { + return d.conn.SetWriteDeadline(time.Now().Add(time.Duration(timeout) * time.Second)) +} + +func (d *GWebSocket) Dial(urlStr string, requestHeader http.Header) (*http.Response, error) { + conn, httpResp, err := websocket.DefaultDialer.Dial(urlStr, requestHeader) + if err == nil { + d.conn = conn + } + return httpResp, err + +} + +func (d *GWebSocket) IsNil() bool { + if d.conn != nil { + return false + } + return true +} + +func (d *GWebSocket) SetConnNil() { + d.conn = nil +} +func (d *GWebSocket) CheckSendConnDiffNow() bool { + return d.conn == d.sendConn +} diff --git a/internal/msggateway/new/message_handler.go b/internal/msggateway/new/message_handler.go new file mode 100644 index 000000000..f280992a9 --- /dev/null +++ b/internal/msggateway/new/message_handler.go @@ -0,0 +1,49 @@ +package new + +import "context" + +type Req struct { + ReqIdentifier int32 `json:"reqIdentifier" validate:"required"` + Token string `json:"token" ` + SendID string `json:"sendID" validate:"required"` + OperationID string `json:"operationID" validate:"required"` + MsgIncr string `json:"msgIncr" validate:"required"` + Data []byte `json:"data"` +} +type MessageHandler interface { + GetSeq(context context.Context, data Req) ([]byte, error) + SendMessage(context context.Context, data Req) ([]byte, error) + SendSignalMessage(context context.Context, data Req) ([]byte, error) + PullMessageBySeqList(context context.Context, data Req) ([]byte, error) + UserLogout(context context.Context, data Req) ([]byte, error) + SetUserDeviceBackground(context context.Context, data Req) ([]byte, error) +} + +var _ MessageHandler = (*GrpcHandler)(nil) + +type GrpcHandler struct { +} + +func (g GrpcHandler) GetSeq(context context.Context, data Req) ([]byte, error) { + panic("implement me") +} + +func (g GrpcHandler) SendMessage(context context.Context, data Req) ([]byte, error) { + panic("implement me") +} + +func (g GrpcHandler) SendSignalMessage(context context.Context, data Req) ([]byte, error) { + panic("implement me") +} + +func (g GrpcHandler) PullMessageBySeqList(context context.Context, data Req) ([]byte, error) { + panic("implement me") +} + +func (g GrpcHandler) UserLogout(context context.Context, data Req) ([]byte, error) { + panic("implement me") +} + +func (g GrpcHandler) SetUserDeviceBackground(context context.Context, data Req) ([]byte, error) { + panic("implement me") +} diff --git a/internal/msggateway/new/n_ws_server.go b/internal/msggateway/new/n_ws_server.go new file mode 100644 index 000000000..3c08385cd --- /dev/null +++ b/internal/msggateway/new/n_ws_server.go @@ -0,0 +1,81 @@ +package new + +import ( + "errors" + "github.com/gorilla/websocket" + "net/http" + "open_im_sdk/pkg/utils" + "sync" + "time" +) + +type LongConnServer interface { + Run() error +} + +type Server struct { + rpcPort int + wsMaxConnNum int + longConnServer *LongConnServer + rpcServer *RpcServer +} +type WsServer struct { + port int + wsMaxConnNum int + wsUpGrader *websocket.Upgrader + registerChan chan *Client + unregisterChan chan *Client + clients *UserMap + clientPool sync.Pool + onlineUserNum int64 + onlineUserConnNum int64 + compressor Compressor + handler MessageHandler +} + +func newWsServer(opts ...Option) (*WsServer, error) { + var config configs + for _, o := range opts { + o(&config) + } + if config.port < 1024 { + return nil, errors.New("port not allow to listen") + + } + return &WsServer{ + port: config.port, + wsMaxConnNum: config.maxConnNum, + wsUpGrader: &websocket.Upgrader{ + HandshakeTimeout: config.handshakeTimeout, + ReadBufferSize: config.messageMaxMsgLength, + CheckOrigin: func(r *http.Request) bool { return true }, + }, + clientPool: sync.Pool{ + New: func() interface{} { + return new(Client) + }, + }, + }, nil +} +func (ws *WsServer) Run() error { + http.HandleFunc("/", ws.wsHandler) //Get request from client to handle by wsHandler + return http.ListenAndServe(":"+utils.IntToString(ws.port), nil) //Start listening + +} +func (ws *WsServer) wsHandler(w http.ResponseWriter, r *http.Request) { + context := newContext(w, r) + if isPass, compression := ws.headerCheck(w, r, operationID); isPass { + conn, err := ws.wsUpGrader.Upgrade(w, r, nil) //Conn is obtained through the upgraded escalator + if err != nil { + log.Error(operationID, "upgrade http conn err", err.Error(), query) + return + } else { + newConn := &UserConn{conn, new(sync.Mutex), utils.StringToInt32(query["platformID"][0]), 0, compression, query["sendID"][0], false, query["token"][0], conn.RemoteAddr().String() + "_" + strconv.Itoa(int(utils.GetCurrentTimestampByMill()))} + userCount++ + ws.addUserConn(query["sendID"][0], utils.StringToInt(query["platformID"][0]), newConn, query["token"][0], newConn.connID, operationID) + go ws.readMsg(newConn) + } + } else { + log.Error(operationID, "headerCheck failed ") + } +} diff --git a/internal/msggateway/new/options.go b/internal/msggateway/new/options.go new file mode 100644 index 000000000..71a732751 --- /dev/null +++ b/internal/msggateway/new/options.go @@ -0,0 +1,36 @@ +package new + +import "time" + +type Option func(opt *configs) +type configs struct { + //长连接监听端口 + port int + //长连接允许最大链接数 + maxConnNum int + //连接握手超时时间 + handshakeTimeout time.Duration + //允许消息最大长度 + messageMaxMsgLength int +} + +func WithPort(port int) Option { + return func(opt *configs) { + opt.port = port + } +} +func WithMaxConnNum(num int) Option { + return func(opt *configs) { + opt.maxConnNum = num + } +} +func WithHandshakeTimeout(t time.Duration) Option { + return func(opt *configs) { + opt.handshakeTimeout = t + } +} +func WithMessageMaxMsgLength(length int) Option { + return func(opt *configs) { + opt.messageMaxMsgLength = length + } +} diff --git a/internal/msggateway/new/user_map.go b/internal/msggateway/new/user_map.go new file mode 100644 index 000000000..82615e827 --- /dev/null +++ b/internal/msggateway/new/user_map.go @@ -0,0 +1,64 @@ +package new + +import "sync" + +type UserMap struct { + m sync.Map +} + +func newUserMap() *UserMap { + return &UserMap{} +} +func (u *UserMap) GetAll(key string) []*Client { + allClients, ok := u.m.Load(key) + if ok { + return allClients.([]*Client) + } + return nil +} +func (u *UserMap) Get(key string, platformID int32) (*Client, bool) { + allClients, existed := u.m.Load(key) + if existed { + for _, client := range allClients.([]*Client) { + if client.PlatformID == platformID { + return client, existed + } + } + return nil, false + } + return nil, existed +} +func (u *UserMap) Set(key string, v *Client) { + allClients, existed := u.m.Load(key) + if existed { + oldClients := allClients.([]*Client) + oldClients = append(oldClients, v) + u.m.Store(key, oldClients) + } else { + clients := make([]*Client, 3) + clients = append(clients, v) + u.m.Store(key, clients) + } +} +func (u *UserMap) delete(key string, platformID int32) { + allClients, existed := u.m.Load(key) + if existed { + oldClients := allClients.([]*Client) + + a := make([]*Client, len(oldClients)) + for _, client := range oldClients { + if client.PlatformID != platformID { + a = append(a, client) + } + } + if len(a) == 0 { + u.m.Delete(key) + } else { + u.m.Store(key, a) + + } + } +} +func (u *UserMap) DeleteAll(key string) { + u.m.Delete(key) +} diff --git a/internal/push/logic/callback.go b/internal/push/logic/callback.go index 6dcc1cbc3..68f99ea5b 100644 --- a/internal/push/logic/callback.go +++ b/internal/push/logic/callback.go @@ -1,28 +1,30 @@ package logic import ( - cbApi "Open_IM/pkg/callback_struct" - "Open_IM/pkg/common/callback" + cbapi "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" - "Open_IM/pkg/common/log" + "Open_IM/pkg/common/tracelog" common "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" - http2 "net/http" + "context" ) -func callbackOfflinePush(operationID string, userIDList []string, msg *common.MsgData, offlinePushUserIDList *[]string) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +func url() string { + return config.Config.Callback.CallbackUrl +} + +func CallbackOfflinePush(ctx context.Context, userIDList []string, msg *common.MsgData, offlinePushUserIDList *[]string) error { if !config.Config.Callback.CallbackOfflinePush.Enable { - return callbackResp + return nil } - req := cbApi.CallbackBeforePushReq{ - UserStatusBatchCallbackReq: cbApi.UserStatusBatchCallbackReq{ - UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ + req := &cbapi.CallbackBeforePushReq{ + UserStatusBatchCallbackReq: cbapi.UserStatusBatchCallbackReq{ + UserStatusBaseCallback: cbapi.UserStatusBaseCallback{ CallbackCommand: constant.CallbackOfflinePushCommand, - OperationID: operationID, - PlatformID: msg.SenderPlatformID, + OperationID: tracelog.GetOperationID(ctx), + PlatformID: int(msg.SenderPlatformID), Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)), }, UserIDList: userIDList, @@ -34,120 +36,214 @@ func callbackOfflinePush(operationID string, userIDList []string, msg *common.Ms ContentType: msg.ContentType, SessionType: msg.SessionType, AtUserIDList: msg.AtUserIDList, - Content: callback.GetContent(msg), + Content: utils.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 - } + resp := &cbapi.CallbackBeforePushResp{} + err := http.CallBackPostReturn(url(), req, resp, config.Config.Callback.CallbackOfflinePush) + if err != nil { + return err } - 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 - } + if len(resp.UserIDList) != 0 { + *offlinePushUserIDList = resp.UserIDList } - log.NewDebug(operationID, utils.GetSelfFuncName(), offlinePushUserIDList, resp.UserIDList) - return callbackResp + if resp.OfflinePushInfo != nil { + msg.OfflinePushInfo = resp.OfflinePushInfo + } + return nil } -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 +func CallbackOnlinePush(operationID string, userIDList []string, msg *common.MsgData) error { + if !config.Config.Callback.CallbackOnlinePush.Enable || utils.Contain(msg.SendID, userIDList...) { + return nil } - req := cbApi.CallbackBeforePushReq{ - UserStatusBatchCallbackReq: cbApi.UserStatusBatchCallbackReq{ - UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ + req := cbapi.CallbackBeforePushReq{ + UserStatusBatchCallbackReq: cbapi.UserStatusBatchCallbackReq{ + UserStatusBaseCallback: cbapi.UserStatusBaseCallback{ CallbackCommand: constant.CallbackOnlinePushCommand, OperationID: operationID, - PlatformID: msg.SenderPlatformID, + PlatformID: int(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), + Content: utils.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 + resp := &cbapi.CallbackBeforePushResp{} + return http.CallBackPostReturn(url(), req, resp, config.Config.Callback.CallbackOnlinePush) } -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} +func CallbackBeforeSuperGroupOnlinePush(ctx context.Context, groupID string, msg *common.MsgData, pushToUserList *[]string) error { if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable { - return callbackResp + return nil } - req := cbApi.CallbackBeforeSuperGroupOnlinePushReq{ - UserStatusBaseCallback: cbApi.UserStatusBaseCallback{ + req := cbapi.CallbackBeforeSuperGroupOnlinePushReq{ + UserStatusBaseCallback: cbapi.UserStatusBaseCallback{ CallbackCommand: constant.CallbackSuperGroupOnlinePushCommand, - OperationID: operationID, - PlatformID: msg.SenderPlatformID, + OperationID: tracelog.GetOperationID(ctx), + PlatformID: int(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), + Content: utils.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 - } + resp := &cbapi.CallbackBeforeSuperGroupOnlinePushResp{} + if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackBeforeSuperGroupOnlinePush); err != nil { + return err } - 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 - //} + if len(resp.UserIDList) != 0 { + *pushToUserList = resp.UserIDList } - log.NewDebug(operationID, utils.GetSelfFuncName(), pushToUserList, resp.UserIDList) - return callbackResp - + 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 +// +//} diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index d55922465..e3a3bea04 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -2,70 +2,47 @@ package auth import ( "Open_IM/internal/common/check" - "Open_IM/internal/common/rpc_server" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/controller" + "Open_IM/pkg/common/db/relation" + relationTb "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/log" - prome "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" + discoveryRegistry "Open_IM/pkg/discoveryregistry" pbAuth "Open_IM/pkg/proto/auth" pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" "context" - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/OpenIMSDK/openKeeper" "google.golang.org/grpc" ) -func NewRpcAuthServer(port int) *rpcAuth { - r, err := rpcserver.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImAuthName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema) +func Start(client *openKeeper.ZkClient, server *grpc.Server) error { + mysql, err := relation.NewGormDB() if err != nil { - panic(err) + return err } - var redis cache.RedisClient - redis.InitRedis() - return &rpcAuth{ - RpcServer: r, - AuthInterface: controller.NewAuthController(redis.GetClient(), config.Config.TokenPolicy.AccessSecret, config.Config.TokenPolicy.AccessExpire), + if err := mysql.AutoMigrate(&relationTb.FriendModel{}, &relationTb.FriendRequestModel{}, &relationTb.BlackModel{}); err != nil { + return err } + redis, err := cache.NewRedis() + if err != nil { + return err + } + pbAuth.RegisterAuthServer(server, &authServer{ + userCheck: check.NewUserCheck(client), + RegisterCenter: client, + AuthInterface: controller.NewAuthController(redis.GetClient(), config.Config.TokenPolicy.AccessSecret, config.Config.TokenPolicy.AccessExpire), + }) + return nil } -func (s *rpcAuth) Run() { - operationID := utils.OperationIDGenerator() - log.NewInfo(operationID, "rpc auth start...") - listener, address, err := rpcserver.GetTcpListen(config.Config.ListenIP, s.Port) - if err != nil { - panic(err) - } - log.NewInfo(operationID, "listen network success ", listener, address) - var grpcOpts []grpc.ServerOption - if config.Config.Prometheus.Enable { - prome.NewGrpcRequestCounter() - prome.NewGrpcRequestFailedCounter() - prome.NewGrpcRequestSuccessCounter() - prome.NewUserRegisterCounter() - prome.NewUserLoginCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(prome.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - pbAuth.RegisterAuthServer(srv, s) - err = srv.Serve(listener) - if err != nil { - panic(err) - } - log.NewInfo(operationID, "rpc auth ok") -} - -func (s *rpcAuth) UserToken(ctx context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) { +func (s *authServer) UserToken(ctx context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) { resp := pbAuth.UserTokenResp{} - if _, err := check.GetUsersInfo(ctx, req.UserID); err != nil { + if _, err := s.userCheck.GetUsersInfo(ctx, req.UserID); err != nil { return nil, err } token, err := s.CreateToken(ctx, req.UserID, constant.PlatformIDToName(int(req.PlatformID))) @@ -77,7 +54,7 @@ func (s *rpcAuth) UserToken(ctx context.Context, req *pbAuth.UserTokenReq) (*pbA return &resp, nil } -func (s *rpcAuth) parseToken(ctx context.Context, tokensString string) (claims *tokenverify.Claims, err error) { +func (s *authServer) parseToken(ctx context.Context, tokensString string) (claims *tokenverify.Claims, err error) { claims, err = tokenverify.GetClaimFromToken(tokensString) if err != nil { return nil, utils.Wrap(err, "") @@ -102,7 +79,7 @@ func (s *rpcAuth) parseToken(ctx context.Context, tokensString string) (claims * return nil, constant.ErrTokenNotExist.Wrap() } -func (s *rpcAuth) ParseToken(ctx context.Context, req *pbAuth.ParseTokenReq) (resp *pbAuth.ParseTokenResp, err error) { +func (s *authServer) ParseToken(ctx context.Context, req *pbAuth.ParseTokenReq) (resp *pbAuth.ParseTokenResp, err error) { resp = &pbAuth.ParseTokenResp{} claims, err := s.parseToken(ctx, req.Token) if err != nil { @@ -114,7 +91,7 @@ func (s *rpcAuth) ParseToken(ctx context.Context, req *pbAuth.ParseTokenReq) (re return resp, nil } -func (s *rpcAuth) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) { +func (s *authServer) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) { resp := pbAuth.ForceLogoutResp{} if err := tokenverify.CheckAdmin(ctx); err != nil { return nil, err @@ -125,7 +102,7 @@ func (s *rpcAuth) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq) ( return &resp, nil } -func (s *rpcAuth) 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.OpenImRelayName) if err != nil { return err @@ -140,7 +117,8 @@ func (s *rpcAuth) forceKickOff(ctx context.Context, userID string, platformID in return constant.ErrInternalServer.Wrap() } -type rpcAuth struct { - *rpcserver.RpcServer +type authServer struct { controller.AuthInterface + userCheck *check.UserCheck + RegisterCenter discoveryRegistry.SvcDiscoveryRegistry } diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index e76b3901f..4cfb99cbe 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -6,11 +6,14 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/controller" - relationTb "Open_IM/pkg/common/db/relation" - unrealationTb "Open_IM/pkg/common/db/unrelation" + "Open_IM/pkg/common/db/relation" + tableRelation "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/common/db/unrelation" "Open_IM/pkg/common/log" - "Open_IM/pkg/common/prome" + promePkg "Open_IM/pkg/common/prometheus" + "Open_IM/pkg/getcdv3" pbConversation "Open_IM/pkg/proto/conversation" + pbUser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" "github.com/dtm-labs/rockscache" @@ -47,7 +50,7 @@ func NewConversationServer(port int) *conversationServer { var cCache cache.ConversationCache //mysql init var mysql relation.Mysql - err := mysql.InitConn().AutoMigrateModel(&table.ConversationModel{}) + err := mysql.InitConn().AutoMigrateModel(&tableRelation.ConversationModel{}) if err != nil { panic("db init err:" + err.Error()) } @@ -92,11 +95,11 @@ func (c *conversationServer) Run() { //grpc server var grpcOpts []grpc.ServerOption if config.Config.Prometheus.Enable { - prome.NewGrpcRequestCounter() - prome.NewGrpcRequestFailedCounter() - prome.NewGrpcRequestSuccessCounter() + promePkg.NewGrpcRequestCounter() + promePkg.NewGrpcRequestFailedCounter() + promePkg.NewGrpcRequestSuccessCounter() grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(prome.UnaryServerInterceptorProme), + // grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme), grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), }...) @@ -170,7 +173,7 @@ func (c *conversationServer) GetConversations(ctx context.Context, req *pbConver func (c *conversationServer) BatchSetConversations(ctx context.Context, req *pbConversation.BatchSetConversationsReq) (*pbConversation.BatchSetConversationsResp, error) { resp := &pbConversation.BatchSetConversationsResp{} - var conversations []*table.ConversationModel + var conversations []*tableRelation.ConversationModel if err := utils.CopyStructFields(&conversations, req.Conversations); err != nil { return nil, err } @@ -203,16 +206,16 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p return nil, err } } - var conversation table.ConversationModel + var conversation tableRelation.ConversationModel if err := utils.CopyStructFields(&conversation, req.Conversation); err != nil { return nil, err } if req.FieldType == constant.FieldIsPrivateChat { - err := c.ConversationInterface.SyncPeerUserPrivateConversationTx(ctx, req.Conversation) + err := c.ConversationInterface.SyncPeerUserPrivateConversationTx(ctx, &conversation) if err != nil { return nil, err } - chat.ConversationSetPrivateNotification(req.OperationID, req.Conversation.OwnerUserID, req.Conversation.UserID, req.Conversation.IsPrivateChat) + chat.ConversationSetPrivateNotification(ctx, req.Conversation.OwnerUserID, req.Conversation.UserID, req.Conversation.IsPrivateChat) return resp, nil } //haveUserID, err := c.ConversationInterface.GetUserIDExistConversation(ctx, req.UserIDList, req.Conversation.ConversationID) @@ -239,29 +242,18 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p case constant.FieldBurnDuration: filedMap["burn_duration"] = req.Conversation.BurnDuration } - c.ConversationInterface.SetUsersConversationFiledTx(ctx, req.UserIDList, &conversation, filedMap) - err = c.ConversationInterface.UpdateUsersConversationFiled(ctx, haveUserID, req.Conversation.ConversationID, filedMap) - if err != nil { - return nil, err - } - var conversations []*pbConversation.Conversation - for _, v := range utils.DifferenceString(haveUserID, req.UserIDList) { - temp := new(pbConversation.Conversation) - _ = utils.CopyStructFields(temp, req.Conversation) - temp.OwnerUserID = v - conversations = append(conversations, temp) - } - err = c.ConversationInterface.CreateConversation(ctx, conversations) + err = c.ConversationInterface.SetUsersConversationFiledTx(ctx, req.UserIDList, &conversation, filedMap) if err != nil { return nil, err } + if isSyncConversation { for _, v := range req.UserIDList { - chat.ConversationChangeNotification(req.OperationID, v) + chat.ConversationChangeNotification(ctx, v) } } else { for _, v := range req.UserIDList { - chat.ConversationUnreadChangeNotification(req.OperationID, v, req.Conversation.ConversationID, req.Conversation.UpdateUnreadCountTime) + chat.ConversationUnreadChangeNotification(ctx, v, req.Conversation.ConversationID, req.Conversation.UpdateUnreadCountTime) } } return resp, nil diff --git a/internal/rpc/friend/black.go b/internal/rpc/friend/black.go index 5d99b8f71..8b01b7fbd 100644 --- a/internal/rpc/friend/black.go +++ b/internal/rpc/friend/black.go @@ -1,9 +1,7 @@ package friend import ( - "Open_IM/internal/common/check" "Open_IM/internal/common/convert" - chat "Open_IM/internal/rpc/msg" "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" @@ -13,14 +11,14 @@ import ( func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *pbFriend.GetPaginationBlacksReq) (resp *pbFriend.GetPaginationBlacksResp, err error) { resp = &pbFriend.GetPaginationBlacksResp{} - if err := check.Access(ctx, req.UserID); err != nil { + if err := s.userCheck.Access(ctx, req.UserID); err != nil { return nil, err } blacks, total, err := s.BlackInterface.FindOwnerBlacks(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } - resp.Blacks, err = (*convert.DBBlack)(nil).DB2PB(blacks) + resp.Blacks, err = (*convert.NewDBBlack(nil, s.RegisterCenter)).DB2PB(ctx, blacks) if err != nil { return nil, err } @@ -41,13 +39,13 @@ func (s *friendServer) IsBlack(ctx context.Context, req *pbFriend.IsBlackReq) (* func (s *friendServer) RemoveBlack(ctx context.Context, req *pbFriend.RemoveBlackReq) (*pbFriend.RemoveBlackResp, error) { resp := &pbFriend.RemoveBlackResp{} - if err := check.Access(ctx, req.OwnerUserID); err != nil { + if err := s.userCheck.Access(ctx, req.OwnerUserID); err != nil { return nil, err } if err := s.BlackInterface.Delete(ctx, []*relation.BlackModel{{OwnerUserID: req.OwnerUserID, BlockUserID: req.BlackUserID}}); err != nil { return nil, err } - chat.BlackDeletedNotification(ctx, req) + s.notification.BlackDeletedNotification(ctx, req) return resp, nil } @@ -60,6 +58,6 @@ func (s *friendServer) AddBlack(ctx context.Context, req *pbFriend.AddBlackReq) if err := s.BlackInterface.Create(ctx, []*relation.BlackModel{&black}); err != nil { return nil, err } - chat.BlackAddedNotification(ctx, req) + s.notification.BlackAddedNotification(ctx, req) return resp, nil } diff --git a/internal/rpc/friend/callback.go b/internal/rpc/friend/callback.go index 983a5da54..14df737a1 100644 --- a/internal/rpc/friend/callback.go +++ b/internal/rpc/friend/callback.go @@ -1,59 +1,26 @@ package friend import ( - cbApi "Open_IM/pkg/callback_struct" + cbapi "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" - "Open_IM/pkg/common/log" "Open_IM/pkg/common/tracelog" - pbFriend "Open_IM/pkg/proto/friend" + pbfriend "Open_IM/pkg/proto/friend" "context" - - //"Open_IM/pkg/proto/msg" - "Open_IM/pkg/utils" - http2 "net/http" ) -func callbackBeforeAddFriendV1(ctx context.Context, req *pbFriend.AddFriendReq) error { - resp := callbackBeforeAddFriend(ctx, req) - if resp.ErrCode != 0 { - return (&constant.ErrInfo{ - ErrCode: resp.ErrCode, - ErrMsg: resp.ErrMsg, - }).Wrap() - } - return nil -} - -func callbackBeforeAddFriend(ctx context.Context, req *pbFriend.AddFriendReq) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: tracelog.GetOperationID(ctx)} +func CallbackBeforeAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) error { if !config.Config.Callback.CallbackBeforeAddFriend.Enable { - return callbackResp + return nil } - - commonCallbackReq := &cbApi.CallbackBeforeAddFriendReq{ + cbReq := &cbapi.CallbackBeforeAddFriendReq{ CallbackCommand: constant.CallbackBeforeAddFriendCommand, FromUserID: req.FromUserID, ToUserID: req.ToUserID, ReqMsg: req.ReqMsg, OperationID: tracelog.GetOperationID(ctx), } - resp := &cbApi.CallbackBeforeAddFriendResp{ - CommonCallbackResp: &callbackResp, - } - //utils.CopyStructFields(req, msg.MsgData) - defer log.NewDebug(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), commonCallbackReq, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeAddFriendCommand, commonCallbackReq, resp, config.Config.Callback.CallbackBeforeAddFriend); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - if !*config.Config.Callback.CallbackBeforeAddFriend.CallbackFailedContinue { - callbackResp.ActionCode = constant.ActionForbidden - return callbackResp - } else { - callbackResp.ActionCode = constant.ActionAllow - return callbackResp - } - } - return callbackResp + resp := &cbapi.CallbackBeforeAddFriendResp{} + return http.CallBackPostReturn(config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddFriend) } diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 777246485..b0ad94ece 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -3,110 +3,60 @@ package friend import ( "Open_IM/internal/common/check" "Open_IM/internal/common/convert" - "Open_IM/internal/common/rpc_server" - chat "Open_IM/internal/rpc/msg" - "Open_IM/pkg/common/config" + "Open_IM/internal/common/notification" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/controller" "Open_IM/pkg/common/db/relation" relationTb "Open_IM/pkg/common/db/table/relation" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/middleware" - prome "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" - pbFriend "Open_IM/pkg/proto/friend" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + pbfriend "Open_IM/pkg/proto/friend" "Open_IM/pkg/utils" "context" - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "github.com/OpenIMSDK/openKeeper" "google.golang.org/grpc" ) type friendServer struct { - *rpcserver.RpcServer - controller.FriendInterface controller.BlackInterface + notification *notification.Check + userCheck *check.UserCheck + RegisterCenter discoveryRegistry.SvcDiscoveryRegistry } -func NewFriendServer(port int) *friendServer { - r, err := rpcserver.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImFriendName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema) +func Start(client *openKeeper.ZkClient, server *grpc.Server) error { + mysql, err := relation.NewGormDB() if err != nil { - panic(err) + return err } - //mysql init - var mysql relation.Mysql - var model relation.FriendGorm - err = mysql.InitConn().AutoMigrateModel(&relationTb.FriendModel{}) - if err != nil { - panic("db init err:" + err.Error()) - } - err = mysql.InitConn().AutoMigrateModel(&relationTb.FriendRequestModel{}) - if err != nil { - panic("db init err:" + err.Error()) - } - err = mysql.InitConn().AutoMigrateModel(&relationTb.BlackModel{}) - if err != nil { - panic("db init err:" + err.Error()) - } - if mysql.GormConn() != nil { - model.DB = mysql.GormConn() - } else { - panic("db init err:" + "conn is nil") - } - return &friendServer{ - RpcServer: r, - FriendInterface: controller.NewFriendController(model.DB), - BlackInterface: controller.NewBlackController(model.DB), - } -} - -func (s *friendServer) Run() { - operationID := utils.OperationIDGenerator() - log.NewInfo(operationID, "friendServer run...") - listener, address, err := rpcserver.GetTcpListen(config.Config.ListenIP, s.Port) - if err != nil { - panic(err) - } - - log.NewInfo(operationID, "listen ok ", address) - defer listener.Close() - //grpc server - var grpcOpts []grpc.ServerOption - grpcOpts = append(grpcOpts, grpc.UnaryInterceptor(middleware.RpcServerInterceptor)) - if config.Config.Prometheus.Enable { - prome.NewGrpcRequestCounter() - prome.NewGrpcRequestFailedCounter() - prome.NewGrpcRequestSuccessCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(prome.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - pbFriend.RegisterFriendServer(srv, s) - err = srv.Serve(listener) - if err != nil { - log.NewError(operationID, "Serve failed ", err.Error(), listener) - return + if err := mysql.AutoMigrate(&relationTb.FriendModel{}, &relationTb.FriendRequestModel{}, &relationTb.BlackModel{}); err != nil { + return err } + pbfriend.RegisterFriendServer(server, &friendServer{ + FriendInterface: controller.NewFriendController(mysql), + BlackInterface: controller.NewBlackController(mysql), + notification: notification.NewCheck(client), + userCheck: check.NewUserCheck(client), + RegisterCenter: client, + }) + return nil } // ok -func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbFriend.ApplyToAddFriendReq) (resp *pbFriend.ApplyToAddFriendResp, err error) { - resp = &pbFriend.ApplyToAddFriendResp{} +func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) (resp *pbfriend.ApplyToAddFriendResp, err error) { + resp = &pbfriend.ApplyToAddFriendResp{} if err := tokenverify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - if err := callbackBeforeAddFriendV1(ctx, req); err != nil { + if err := CallbackBeforeAddFriend(ctx, req); err != nil { return nil, err } if req.ToUserID == req.FromUserID { return nil, constant.ErrCanNotAddYourself.Wrap() } - if _, err := check.GetUsersInfo(ctx, req.ToUserID, req.FromUserID); err != nil { + if _, err := s.userCheck.GetUsersInfoMap(ctx, []string{req.ToUserID, req.FromUserID}, true); err != nil { return nil, err } in1, in2, err := s.FriendInterface.CheckIn(ctx, req.FromUserID, req.ToUserID) @@ -119,17 +69,17 @@ func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbFriend.Apply if err = s.FriendInterface.AddFriendRequest(ctx, req.FromUserID, req.ToUserID, req.ReqMsg, req.Ex); err != nil { return nil, err } - chat.FriendApplicationAddNotification(ctx, req) + s.notification.FriendApplicationAddNotification(ctx, req) return resp, nil } // ok -func (s *friendServer) ImportFriends(ctx context.Context, req *pbFriend.ImportFriendReq) (resp *pbFriend.ImportFriendResp, err error) { - resp = &pbFriend.ImportFriendResp{} +func (s *friendServer) ImportFriends(ctx context.Context, req *pbfriend.ImportFriendReq) (resp *pbfriend.ImportFriendResp, err error) { + resp = &pbfriend.ImportFriendResp{} if err := tokenverify.CheckAdmin(ctx); err != nil { return nil, err } - if _, err := check.GetUsersInfo(ctx, req.OwnerUserID, req.FriendUserIDs); err != nil { + if _, err := s.userCheck.GetUsersInfos(ctx, append([]string{req.OwnerUserID}, req.FriendUserIDs...), true); err != nil { return nil, err } @@ -147,9 +97,9 @@ func (s *friendServer) ImportFriends(ctx context.Context, req *pbFriend.ImportFr } // ok -func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbFriend.RespondFriendApplyReq) (resp *pbFriend.RespondFriendApplyResp, err error) { - resp = &pbFriend.RespondFriendApplyResp{} - if err := check.Access(ctx, req.ToUserID); err != nil { +func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbfriend.RespondFriendApplyReq) (resp *pbfriend.RespondFriendApplyResp, err error) { + resp = &pbfriend.RespondFriendApplyResp{} + if err := s.userCheck.Access(ctx, req.ToUserID); err != nil { return nil, err } friendRequest := relationTb.FriendRequestModel{FromUserID: req.FromUserID, ToUserID: req.ToUserID, HandleMsg: req.HandleMsg, HandleResult: req.HandleResult} @@ -158,7 +108,7 @@ func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbFriend.Res if err != nil { return nil, err } - chat.FriendApplicationAgreedNotification(ctx, req) + s.notification.FriendApplicationAgreedNotification(ctx, req) return resp, nil } if req.HandleResult == constant.FriendResponseRefuse { @@ -166,16 +116,16 @@ func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbFriend.Res if err != nil { return nil, err } - chat.FriendApplicationRefusedNotification(ctx, req) + s.notification.FriendApplicationRefusedNotification(ctx, req) return resp, nil } return nil, constant.ErrArgs.Wrap("req.HandleResult != -1/1") } // ok -func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (resp *pbFriend.DeleteFriendResp, err error) { - resp = &pbFriend.DeleteFriendResp{} - if err := check.Access(ctx, req.OwnerUserID); err != nil { +func (s *friendServer) DeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendReq) (resp *pbfriend.DeleteFriendResp, err error) { + resp = &pbfriend.DeleteFriendResp{} + if err := s.userCheck.Access(ctx, req.OwnerUserID); err != nil { return nil, err } _, err = s.FindFriendsWithError(ctx, req.OwnerUserID, []string{req.FriendUserID}) @@ -185,14 +135,14 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFri if err := s.FriendInterface.Delete(ctx, req.OwnerUserID, []string{req.FriendUserID}); err != nil { return nil, err } - chat.FriendDeletedNotification(ctx, req) + s.notification.FriendDeletedNotification(ctx, req) return resp, nil } // ok -func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbFriend.SetFriendRemarkReq) (resp *pbFriend.SetFriendRemarkResp, err error) { - resp = &pbFriend.SetFriendRemarkResp{} - if err := check.Access(ctx, req.OwnerUserID); err != nil { +func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbfriend.SetFriendRemarkReq) (resp *pbfriend.SetFriendRemarkResp, err error) { + resp = &pbfriend.SetFriendRemarkResp{} + if err := s.userCheck.Access(ctx, req.OwnerUserID); err != nil { return nil, err } _, err = s.FindFriendsWithError(ctx, req.OwnerUserID, []string{req.FriendUserID}) @@ -202,21 +152,21 @@ func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbFriend.SetFri if err := s.FriendInterface.UpdateRemark(ctx, req.OwnerUserID, req.FriendUserID, req.Remark); err != nil { return nil, err } - chat.FriendRemarkSetNotification(ctx, req.OwnerUserID, req.FriendUserID) + s.notification.FriendRemarkSetNotification(ctx, req.OwnerUserID, req.FriendUserID) return resp, nil } // ok -func (s *friendServer) GetDesignatedFriends(ctx context.Context, req *pbFriend.GetDesignatedFriendsReq) (resp *pbFriend.GetDesignatedFriendsResp, err error) { - resp = &pbFriend.GetDesignatedFriendsResp{} - if err := check.Access(ctx, req.UserID); err != nil { +func (s *friendServer) GetDesignatedFriends(ctx context.Context, req *pbfriend.GetDesignatedFriendsReq) (resp *pbfriend.GetDesignatedFriendsResp, err error) { + resp = &pbfriend.GetDesignatedFriendsResp{} + if err := s.userCheck.Access(ctx, req.UserID); err != nil { return nil, err } friends, total, err := s.FriendInterface.PageOwnerFriends(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } - resp.FriendsInfo, err = (*convert.DBFriend)(nil).DB2PB(friends) + resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends) if err != nil { return nil, err } @@ -225,16 +175,16 @@ func (s *friendServer) GetDesignatedFriends(ctx context.Context, req *pbFriend.G } // ok 获取接收到的好友申请(即别人主动申请的) -func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbFriend.GetPaginationFriendsApplyToReq) (resp *pbFriend.GetPaginationFriendsApplyToResp, err error) { - resp = &pbFriend.GetPaginationFriendsApplyToResp{} - if err := check.Access(ctx, req.UserID); err != nil { +func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbfriend.GetPaginationFriendsApplyToReq) (resp *pbfriend.GetPaginationFriendsApplyToResp, err error) { + resp = &pbfriend.GetPaginationFriendsApplyToResp{} + if err := s.userCheck.Access(ctx, req.UserID); err != nil { return nil, err } friendRequests, total, err := s.FriendInterface.PageFriendRequestToMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } - resp.FriendRequests, err = (*convert.DBFriendRequest)(nil).DB2PB(friendRequests) + resp.FriendRequests, err = (*convert.NewDBFriendRequest(nil, s.RegisterCenter)).DB2PB(ctx, friendRequests) if err != nil { return nil, err } @@ -243,16 +193,16 @@ func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbF } // ok 获取主动发出去的好友申请列表 -func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *pbFriend.GetPaginationFriendsApplyFromReq) (resp *pbFriend.GetPaginationFriendsApplyFromResp, err error) { - resp = &pbFriend.GetPaginationFriendsApplyFromResp{} - if err := check.Access(ctx, req.UserID); err != nil { +func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *pbfriend.GetPaginationFriendsApplyFromReq) (resp *pbfriend.GetPaginationFriendsApplyFromResp, err error) { + resp = &pbfriend.GetPaginationFriendsApplyFromResp{} + if err := s.userCheck.Access(ctx, req.UserID); err != nil { return nil, err } friendRequests, total, err := s.FriendInterface.PageFriendRequestFromMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } - resp.FriendRequests, err = (*convert.DBFriendRequest)(nil).DB2PB(friendRequests) + resp.FriendRequests, err = (*convert.NewDBFriendRequest(nil, s.RegisterCenter)).DB2PB(ctx, friendRequests) if err != nil { return nil, err } @@ -261,8 +211,8 @@ func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *p } // ok -func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (resp *pbFriend.IsFriendResp, err error) { - resp = &pbFriend.IsFriendResp{} +func (s *friendServer) IsFriend(ctx context.Context, req *pbfriend.IsFriendReq) (resp *pbfriend.IsFriendResp, err error) { + resp = &pbfriend.IsFriendResp{} resp.InUser1Friends, resp.InUser2Friends, err = s.FriendInterface.CheckIn(ctx, req.UserID1, req.UserID2) if err != nil { return nil, err @@ -271,8 +221,8 @@ func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) } // ok -func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbFriend.GetPaginationFriendsReq) (resp *pbFriend.GetPaginationFriendsResp, err error) { - resp = &pbFriend.GetPaginationFriendsResp{} +func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.GetPaginationFriendsReq) (resp *pbfriend.GetPaginationFriendsResp, err error) { + resp = &pbfriend.GetPaginationFriendsResp{} if utils.Duplicate(req.FriendUserIDs) { return nil, constant.ErrArgs.Wrap("friend userID repeated") } @@ -280,7 +230,7 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbFriend.G if err != nil { return nil, err } - if resp.FriendsInfo, err = (*convert.DBFriend)(nil).DB2PB(friends); err != nil { + if resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends); err != nil { return nil, err } return resp, nil diff --git a/internal/rpc/group/callback.go b/internal/rpc/group/callback.go index 72bf4e423..1ffe44193 100644 --- a/internal/rpc/group/callback.go +++ b/internal/rpc/group/callback.go @@ -1,167 +1,139 @@ package group import ( + "Open_IM/pkg/apistruct" "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/http" - "Open_IM/pkg/common/log" "Open_IM/pkg/common/tracelog" - pbGroup "Open_IM/pkg/proto/group" + "Open_IM/pkg/proto/group" "Open_IM/pkg/utils" "context" "google.golang.org/protobuf/types/known/wrapperspb" + "time" ) -func callbackBeforeCreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (err error) { - defer func() { - tracelog.SetCtxInfo(ctx, utils.GetFuncName(1), err, "req", req) - }() +func CallbackBeforeCreateGroup(ctx context.Context, req *group.CreateGroupReq) (err error) { if !config.Config.Callback.CallbackBeforeCreateGroup.Enable { return nil } - commonCallbackReq := &cbApi.CallbackBeforeCreateGroupReq{ + defer func() { + tracelog.SetCtxInfo(ctx, utils.GetFuncName(1), err, "req", req) + }() + cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{ CallbackCommand: constant.CallbackBeforeCreateGroupCommand, - OperationID: req.OperationID, + OperationID: tracelog.GetOperationID(ctx), GroupInfo: *req.GroupInfo, - InitMemberList: req.InitMemberList, } - callbackResp := cbApi.CommonCallbackResp{OperationID: req.OperationID} - resp := &cbApi.CallbackBeforeCreateGroupResp{ - CommonCallbackResp: &callbackResp, + cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{ + UserID: req.OwnerUserID, + RoleLevel: constant.GroupOwner, + }) + for _, userID := range req.AdminUserIDs { + cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{ + UserID: userID, + RoleLevel: constant.GroupAdmin, + }) } - //utils.CopyStructFields(req, msg.MsgData) - defer log.NewDebug(req.OperationID, utils.GetSelfFuncName(), commonCallbackReq, *resp) - err = http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeCreateGroupCommand, commonCallbackReq, - resp, config.Config.Callback.CallbackBeforeCreateGroup) - if err == nil { - if resp.GroupID != nil { - req.GroupInfo.GroupID = *resp.GroupID - } - if resp.GroupName != nil { - req.GroupInfo.GroupName = *resp.GroupName - } - if resp.Notification != nil { - req.GroupInfo.Notification = *resp.Notification - } - if resp.Introduction != nil { - req.GroupInfo.Introduction = *resp.Introduction - } - if resp.FaceURL != nil { - req.GroupInfo.FaceURL = *resp.FaceURL - } - if resp.OwnerUserID != nil { - req.GroupInfo.OwnerUserID = *resp.OwnerUserID - } - if resp.Ex != nil { - req.GroupInfo.Ex = *resp.Ex - } - if resp.Status != nil { - req.GroupInfo.Status = *resp.Status - } - if resp.CreatorUserID != nil { - req.GroupInfo.CreatorUserID = *resp.CreatorUserID - } - if resp.GroupType != nil { - req.GroupInfo.GroupType = *resp.GroupType - } - if resp.NeedVerification != nil { - req.GroupInfo.NeedVerification = *resp.NeedVerification - } - if resp.LookMemberInfo != nil { - req.GroupInfo.LookMemberInfo = *resp.LookMemberInfo - } + for _, userID := range req.AdminUserIDs { + cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{ + UserID: userID, + RoleLevel: constant.GroupOrdinaryUsers, + }) } - return err + resp := &callbackstruct.CallbackBeforeCreateGroupResp{} + err = http.CallBackPostReturn(config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeCreateGroup) + if err != nil { + return err + } + utils.NotNilReplace(&req.GroupInfo.GroupID, resp.GroupID) + utils.NotNilReplace(&req.GroupInfo.GroupName, resp.GroupName) + utils.NotNilReplace(&req.GroupInfo.Notification, resp.Notification) + utils.NotNilReplace(&req.GroupInfo.Introduction, resp.Introduction) + utils.NotNilReplace(&req.GroupInfo.FaceURL, resp.FaceURL) + utils.NotNilReplace(&req.GroupInfo.OwnerUserID, resp.OwnerUserID) + utils.NotNilReplace(&req.GroupInfo.Ex, resp.Ex) + utils.NotNilReplace(&req.GroupInfo.Status, resp.Status) + utils.NotNilReplace(&req.GroupInfo.CreatorUserID, resp.CreatorUserID) + utils.NotNilReplace(&req.GroupInfo.GroupType, resp.GroupType) + utils.NotNilReplace(&req.GroupInfo.NeedVerification, resp.NeedVerification) + utils.NotNilReplace(&req.GroupInfo.LookMemberInfo, resp.LookMemberInfo) + return nil } -func CallbackBeforeMemberJoinGroup(ctx context.Context, operationID string, groupMember *relation.GroupMemberModel, groupEx string) (err error) { - defer func() { - tracelog.SetCtxInfo(ctx, utils.GetFuncName(1), err, "groupMember", *groupMember, "groupEx", groupEx) - }() - callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} +func CallbackBeforeMemberJoinGroup(ctx context.Context, groupMember *relation.GroupMemberModel, groupEx string) (err error) { if !config.Config.Callback.CallbackBeforeMemberJoinGroup.Enable { return nil } - log.NewDebug(operationID, "args: ", *groupMember) - callbackReq := cbApi.CallbackBeforeMemberJoinGroupReq{ + defer func() { + tracelog.SetCtxInfo(ctx, utils.GetFuncName(1), err, "groupMember", *groupMember, "groupEx", groupEx) + }() + callbackReq := &callbackstruct.CallbackBeforeMemberJoinGroupReq{ CallbackCommand: constant.CallbackBeforeMemberJoinGroupCommand, - OperationID: operationID, + OperationID: tracelog.GetOperationID(ctx), GroupID: groupMember.GroupID, UserID: groupMember.UserID, Ex: groupMember.Ex, GroupEx: groupEx, } - resp := &cbApi.CallbackBeforeMemberJoinGroupResp{ - CommonCallbackResp: &callbackResp, + resp := &callbackstruct.CallbackBeforeMemberJoinGroupResp{} + err = http.CallBackPostReturn(config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackBeforeMemberJoinGroup) + if err != nil { + return err } - err = http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeMemberJoinGroupCommand, callbackReq, - resp, config.Config.Callback.CallbackBeforeMemberJoinGroup) - if err == nil { - if resp.MuteEndTime != nil { - groupMember.MuteEndTime = utils.UnixSecondToTime(*resp.MuteEndTime) - } - if resp.FaceURL != nil { - groupMember.FaceURL = *resp.FaceURL - } - if resp.Ex != nil { - groupMember.Ex = *resp.Ex - } - if resp.NickName != nil { - groupMember.Nickname = *resp.NickName - } - if resp.RoleLevel != nil { - groupMember.RoleLevel = *resp.RoleLevel - } + if resp.MuteEndTime != nil { + groupMember.MuteEndTime = time.UnixMilli(*resp.MuteEndTime) } - return err + utils.NotNilReplace(&groupMember.FaceURL, resp.FaceURL) + utils.NotNilReplace(&groupMember.Ex, resp.Ex) + utils.NotNilReplace(&groupMember.Nickname, resp.Nickname) + utils.NotNilReplace(&groupMember.RoleLevel, resp.RoleLevel) + return nil } -func CallbackBeforeSetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGroupMemberInfo) (err error) { - defer func() { - tracelog.SetCtxInfo(ctx, utils.GetFuncName(1), err, "req", *req) - }() - callbackResp := cbApi.CommonCallbackResp{OperationID: req.OperationID} +func CallbackBeforeSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMemberInfo) (err error) { if !config.Config.Callback.CallbackBeforeSetGroupMemberInfo.Enable { return nil } - callbackReq := cbApi.CallbackBeforeSetGroupMemberInfoReq{ + defer func() { + tracelog.SetCtxInfo(ctx, utils.GetFuncName(1), err, "req", *req) + }() + callbackReq := callbackstruct.CallbackBeforeSetGroupMemberInfoReq{ CallbackCommand: constant.CallbackBeforeSetGroupMemberInfoCommand, - OperationID: req.OperationID, + OperationID: tracelog.GetOperationID(ctx), GroupID: req.GroupID, UserID: req.UserID, } if req.Nickname != nil { - callbackReq.Nickname = req.Nickname.Value + callbackReq.Nickname = &req.Nickname.Value } if req.FaceURL != nil { - callbackReq.FaceURL = req.FaceURL.Value + callbackReq.FaceURL = &req.FaceURL.Value } if req.RoleLevel != nil { - callbackReq.RoleLevel = req.RoleLevel.Value + callbackReq.RoleLevel = &req.RoleLevel.Value } if req.Ex != nil { - callbackReq.Ex = req.Ex.Value + callbackReq.Ex = &req.Ex.Value } - resp := &cbApi.CallbackBeforeSetGroupMemberInfoResp{ - CommonCallbackResp: &callbackResp, + resp := &callbackstruct.CallbackBeforeSetGroupMemberInfoResp{} + err = http.CallBackPostReturn(config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackBeforeSetGroupMemberInfo) + if err != nil { + return err } - err = http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeSetGroupMemberInfoCommand, callbackReq, - resp, config.Config.Callback.CallbackBeforeSetGroupMemberInfo.CallbackTimeOut, &config.Config.Callback.CallbackBeforeSetGroupMemberInfo.CallbackFailedContinue) - if err == nil { - if resp.FaceURL != nil { - req.FaceURL = &wrapperspb.StringValue{Value: *resp.FaceURL} - } - if resp.Nickname != nil { - req.Nickname = &wrapperspb.StringValue{Value: *resp.Nickname} - } - if resp.RoleLevel != nil { - req.RoleLevel = &wrapperspb.Int32Value{Value: *resp.RoleLevel} - } - if resp.Ex != nil { - req.Ex = &wrapperspb.StringValue{Value: *resp.Ex} - } + if resp.FaceURL != nil { + req.FaceURL = wrapperspb.String(*resp.FaceURL) } - return err + if resp.Nickname != nil { + req.Nickname = wrapperspb.String(*resp.Nickname) + } + if resp.RoleLevel != nil { + req.RoleLevel = wrapperspb.Int32(*resp.RoleLevel) + } + if resp.Ex != nil { + req.Ex = wrapperspb.String(*resp.Ex) + } + return nil } diff --git a/internal/rpc/group/db_map.go b/internal/rpc/group/db_map.go index ad9ea4e75..29bfd0de4 100644 --- a/internal/rpc/group/db_map.go +++ b/internal/rpc/group/db_map.go @@ -12,7 +12,7 @@ func UpdateGroupInfoMap(group *sdkws.GroupInfoForSet) map[string]any { m["group_name"] = group.GroupName } if group.Notification != "" { - m["notification"] = group.Notification + m["Notification"] = group.Notification } if group.Introduction != "" { m["introduction"] = group.Introduction diff --git a/internal/rpc/group/g.go b/internal/rpc/group/g.go deleted file mode 100644 index 3bbbb4afa..000000000 --- a/internal/rpc/group/g.go +++ /dev/null @@ -1,94 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/tracelog" - pbConversation "Open_IM/pkg/proto/conversation" - sdkws "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" - "context" - "errors" - "math/big" - "strconv" - "strings" - "time" -) - -func GetPublicUserInfoOne(ctx context.Context, userID string) (*sdkws.PublicUserInfo, error) { - return nil, errors.New("todo") -} - -func GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error) { - return nil, errors.New("todo") -} - -func GetUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) { - users, err := GetUsersInfo(ctx, userIDs) - if err != nil { - return nil, err - } - return utils.SliceToMap(users, func(e *sdkws.UserInfo) string { - return e.UserID - }), nil -} - -func GetPublicUserInfo(ctx context.Context, userIDs []string) ([]*sdkws.PublicUserInfo, error) { - return nil, errors.New("todo") -} - -func GetPublicUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.PublicUserInfo, error) { - users, err := GetPublicUserInfo(ctx, userIDs) - if err != nil { - return nil, err - } - return utils.SliceToMap(users, func(e *sdkws.PublicUserInfo) string { - return e.UserID - }), nil -} - -func GetUsername(ctx context.Context, userIDs []string) (map[string]string, error) { - if len(userIDs) == 0 { - return map[string]string{}, nil - } - users, err := GetPublicUserInfo(ctx, userIDs) - if err != nil { - return nil, err - } - if ids := utils.Single(userIDs, utils.Slice(users, func(e *sdkws.PublicUserInfo) string { - return e.UserID - })); len(ids) > 0 { - return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ",")) - } - return utils.SliceToMapAny(users, func(e *sdkws.PublicUserInfo) (string, string) { - return e.UserID, e.Nickname - }), nil -} - -func GroupNotification(ctx context.Context, groupID string) { - var conversationReq pbConversation.ModifyConversationFieldReq - conversation := pbConversation.Conversation{ - OwnerUserID: tracelog.GetOpUserID(ctx), - ConversationID: utils.GetConversationIDBySessionType(groupID, constant.GroupChatType), - ConversationType: constant.GroupChatType, - GroupID: groupID, - } - conversationReq.Conversation = &conversation - conversationReq.OperationID = tracelog.GetOperationID(ctx) - conversationReq.FieldType = constant.FieldGroupAtType - conversation.GroupAtType = constant.GroupNotification - conversationReq.UserIDList = cacheResp.UserIDList - - _, err = pbConversation.NewConversationClient(s.etcdConn.GetConn("", config.Config.RpcRegisterName.OpenImConversationName)).ModifyConversationField(ctx, &conversationReq) - tracelog.SetCtxInfo(ctx, "ModifyConversationField", err, "req", &conversationReq, "resp", conversationReply) -} - -func genGroupID(ctx context.Context, groupID string) string { - if groupID != "" { - return groupID - } - groupID = utils.Md5(tracelog.GetOperationID(ctx) + strconv.FormatInt(time.Now().UnixNano(), 10)) - bi := big.NewInt(0) - bi.SetString(groupID[0:8], 16) - groupID = bi.String() - return groupID -} diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 5e2eb7d12..dfa58f7ef 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -1,120 +1,61 @@ package group import ( - "Open_IM/internal/common/network" - chat "Open_IM/internal/rpc/msg" - "Open_IM/pkg/common/config" + "Open_IM/internal/common/check" + "Open_IM/internal/common/notification" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/controller" "Open_IM/pkg/common/db/relation" relationTb "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/db/unrelation" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/middleware" - prome "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" - discoveryRegistry "Open_IM/pkg/discoveryregistry" + pbConversation "Open_IM/pkg/proto/conversation" pbGroup "Open_IM/pkg/proto/group" "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" "fmt" - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "net" + "github.com/OpenIMSDK/openKeeper" + "google.golang.org/grpc" + "gorm.io/gorm" + "math/big" + "math/rand" "strconv" "strings" "time" - - "github.com/OpenIMSDK/openKeeper" - "google.golang.org/grpc" ) +func Start(client *openKeeper.ZkClient, server *grpc.Server) error { + db, err := relation.NewGormDB() + if err != nil { + return err + } + if err := db.AutoMigrate(&relationTb.GroupModel{}, &relationTb.GroupMemberModel{}, &relationTb.GroupRequestModel{}); err != nil { + return err + } + redis, err := cache.NewRedis() + if err != nil { + return err + } + mongo, err := unrelation.NewMongo() + if err != nil { + return err + } + pbGroup.RegisterGroupServer(server, &groupServer{ + GroupInterface: controller.NewGroupInterface(controller.NewGroupDatabase(db, redis.GetClient(), mongo.GetClient())), + UserCheck: check.NewUserCheck(client), + ConversationChecker: check.NewConversationChecker(client), + }) + return nil +} + type groupServer struct { - rpcPort int - rpcRegisterName string - schema string - zkAddr []string - GroupInterface controller.GroupInterface - registerCenter discoveryRegistry.SvcDiscoveryRegistry -} - -func NewGroupServer(port int) *groupServer { - log.NewPrivateLog(constant.LogFileName) - g := groupServer{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName, - schema: config.Config.Zookeeper.Schema, - zkAddr: config.Config.Zookeeper.ZkAddr, - } - //mysql init - var mysql relation.Mysql - var mongo unrelation.Mongo - var groupModel relationTb.GroupModel - var redis cache.RedisClient - err := mysql.InitConn().AutoMigrateModel(&groupModel) - if err != nil { - panic("db init err:" + err.Error()) - } - mongo.InitMongo() - redis.InitRedis() - mongo.CreateSuperGroupIndex() - zkClient, err := openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema, 10, "", "") - if err != nil { - panic(err.Error()) - } - registerIP, err := network.GetRpcRegisterIP(config.Config.RpcRegisterIP) - g.registerCenter = zkClient - err = g.registerCenter.Register(config.Config.RpcRegisterName.OpenImGroupName, registerIP, port) - if err != nil { - panic(err.Error()) - } - //conns, err := g.registerCenter.GetConns(config.Config.RpcRegisterName.OpenImConversationName) - g.GroupInterface = controller.NewGroupInterface(mysql.GormConn(), redis.GetClient(), mongo.GetClient()) - return &g -} - -func (s *groupServer) Run() { - operationID := utils.OperationIDGenerator() - log.NewInfo(operationID, "group rpc start ") - address := network.GetListenIP(config.Config.ListenIP) + ":" + strconv.Itoa(s.rpcPort) - //listener network - listener, err := net.Listen("tcp", address) - if err != nil { - panic("listening err:" + err.Error() + s.rpcRegisterName) - } - log.NewInfo(operationID, "listen network success, ", address, listener) - - defer listener.Close() - //grpc server - recvSize := 1024 * 1024 * constant.GroupRPCRecvSize - sendSize := 1024 * 1024 * constant.GroupRPCSendSize - var grpcOpts = []grpc.ServerOption{ - grpc.MaxRecvMsgSize(recvSize), - grpc.MaxSendMsgSize(sendSize), - grpc.UnaryInterceptor(middleware.RpcServerInterceptor), - } - if config.Config.Prometheus.Enable { - prome.NewGrpcRequestCounter() - prome.NewGrpcRequestFailedCounter() - prome.NewGrpcRequestSuccessCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(prome.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - //Service registers with etcd - pbGroup.RegisterGroupServer(srv, s) - err = srv.Serve(listener) - if err != nil { - log.NewError(operationID, "Serve failed ", err.Error()) - return - } - log.NewInfo(operationID, "group rpc success") + GroupInterface controller.GroupInterface + UserCheck *check.UserCheck + Notification *notification.Check + ConversationChecker *check.ConversationChecker } func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error { @@ -130,6 +71,52 @@ func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error return nil } +func (s *groupServer) GetUsernameMap(ctx context.Context, userIDs []string, complete bool) (map[string]string, error) { + if len(userIDs) == 0 { + return map[string]string{}, nil + } + users, err := s.UserCheck.GetPublicUserInfos(ctx, userIDs, complete) + if err != nil { + return nil, err + } + return utils.SliceToMapAny(users, func(e *sdkws.PublicUserInfo) (string, string) { + return e.UserID, e.Nickname + }), nil +} + +func (s *groupServer) IsNotFound(err error) bool { + return utils.Unwrap(err) == gorm.ErrRecordNotFound +} + +func (s *groupServer) GenGroupID(ctx context.Context, groupID *string) error { + if *groupID != "" { + _, err := s.GroupInterface.TakeGroup(ctx, *groupID) + if err == nil { + return constant.ErrGroupIDExisted.Wrap("group id existed " + *groupID) + } else if s.IsNotFound(err) { + return nil + } else { + return err + } + } + for i := 0; i < 10; i++ { + id := utils.Md5(strings.Join([]string{tracelog.GetOperationID(ctx), strconv.FormatInt(time.Now().UnixNano(), 10), strconv.Itoa(rand.Int())}, ",;,")) + bi := big.NewInt(0) + bi.SetString(id[0:8], 16) + id = bi.String() + _, err := s.GroupInterface.TakeGroup(ctx, id) + if err == nil { + continue + } else if s.IsNotFound(err) { + *groupID = id + return nil + } else { + return err + } + } + return constant.ErrData.Wrap("group id gen error") +} + func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) { resp := &pbGroup.CreateGroupResp{GroupInfo: &sdkws.GroupInfo{}} if err := tokenverify.CheckAccessV3(ctx, req.OwnerUserID); err != nil { @@ -142,19 +129,18 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if utils.Duplicate(userIDs) { return nil, constant.ErrArgs.Wrap("group member repeated") } - userMap, err := GetUserInfoMap(ctx, userIDs) + userMap, err := s.UserCheck.GetUsersInfoMap(ctx, userIDs, true) if err != nil { return nil, err } - if ids := utils.Single(userIDs, utils.Keys(userMap)); len(ids) > 0 { - return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ",")) - } - if err := callbackBeforeCreateGroup(ctx, req); err != nil { + if err := CallbackBeforeCreateGroup(ctx, req); err != nil { return nil, err } var groupMembers []*relationTb.GroupMemberModel group := PbToDBGroupInfo(req.GroupInfo) - group.GroupID = genGroupID(ctx, req.GroupInfo.GroupID) + if err := s.GenGroupID(ctx, &group.GroupID); err != nil { + return nil, err + } joinGroup := func(userID string, roleLevel int32) error { groupMember := PbToDbGroupMember(userMap[userID]) groupMember.Nickname = "" @@ -163,7 +149,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR groupMember.OperatorUserID = tracelog.GetOpUserID(ctx) groupMember.JoinSource = constant.JoinByInvitation groupMember.InviterUserID = tracelog.GetOpUserID(ctx) - if err := CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), groupMember, group.Ex); err != nil { + if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil { return err } groupMembers = append(groupMembers, groupMember) @@ -196,11 +182,11 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if req.GroupInfo.GroupType == constant.SuperGroup { go func() { for _, userID := range userIDs { - chat.SuperGroupNotification(tracelog.GetOperationID(ctx), userID, userID) + s.Notification.SuperGroupNotification(ctx, userID, userID) } }() } else { - chat.GroupCreatedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), group.GroupID, userIDs) + s.Notification.GroupCreatedNotification(ctx, group.GroupID, userIDs) } return resp, nil } @@ -269,13 +255,10 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite if ids := utils.Single(req.InvitedUserIDs, utils.Keys(memberMap)); len(ids) > 0 { return nil, constant.ErrArgs.Wrap("user in group " + strings.Join(ids, ",")) } - userMap, err := GetUserInfoMap(ctx, req.InvitedUserIDs) + userMap, err := s.UserCheck.GetUsersInfoMap(ctx, req.InvitedUserIDs, true) if err != nil { return nil, err } - if ids := utils.Single(req.InvitedUserIDs, utils.Keys(userMap)); len(ids) > 0 { - return nil, constant.ErrArgs.Wrap("user not found " + strings.Join(ids, ",")) - } if group.NeedVerification == constant.AllNeedVerification { if !tokenverify.IsAppManagerUid(ctx) { opUserID := tracelog.GetOpUserID(ctx) @@ -297,7 +280,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite return nil, err } for _, request := range requests { - chat.JoinGroupApplicationNotification(ctx, &pbGroup.JoinGroupReq{ + s.Notification.JoinGroupApplicationNotification(ctx, &pbGroup.JoinGroupReq{ GroupID: request.GroupID, ReqMessage: request.ReqMsg, JoinSource: request.JoinSource, @@ -313,7 +296,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite return nil, err } for _, userID := range req.InvitedUserIDs { - chat.SuperGroupNotification(tracelog.GetOperationID(ctx), userID, userID) + s.Notification.SuperGroupNotification(ctx, userID, userID) } } else { opUserID := tracelog.GetOpUserID(ctx) @@ -326,7 +309,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite member.OperatorUserID = opUserID member.InviterUserID = opUserID member.JoinSource = constant.JoinByInvitation - if err := CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), member, group.Ex); err != nil { + if err := CallbackBeforeMemberJoinGroup(ctx, member, group.Ex); err != nil { return nil, err } groupMembers = append(groupMembers, member) @@ -334,7 +317,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite if err := s.GroupInterface.CreateGroup(ctx, nil, groupMembers); err != nil { return nil, err } - chat.MemberInvitedNotification(tracelog.GetOperationID(ctx), req.GroupID, tracelog.GetOpUserID(ctx), req.Reason, req.InvitedUserIDs) + s.Notification.MemberInvitedNotification(ctx, req.GroupID, req.Reason, req.InvitedUserIDs) } return resp, nil } @@ -352,9 +335,9 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro if err != nil { return nil, err } - nameMap, err := GetUsername(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { + nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { return e.UserID, e.Nickname == "" - })) + }), true) if err != nil { return nil, err } @@ -374,9 +357,9 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr return nil, err } resp.Total = total - nameMap, err := GetUsername(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { + nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { return e.UserID, e.Nickname == "" - })) + }), true) if err != nil { return nil, err } @@ -411,7 +394,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } go func() { for _, userID := range req.KickedUserIDs { - chat.SuperGroupNotification(tracelog.GetOperationID(ctx), userID, userID) + s.Notification.SuperGroupNotification(ctx, userID, userID) } }() } else { @@ -451,7 +434,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou if err := s.GroupInterface.DeleteGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil { return nil, err } - chat.MemberKickedNotification(req, req.KickedUserIDs) + s.Notification.MemberKickedNotification(ctx, req, req.KickedUserIDs) } return resp, nil } @@ -468,9 +451,9 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG if err != nil { return nil, err } - nameMap, err := GetUsername(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { + nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { return e.UserID, e.Nickname == "" - })) + }), true) if err != nil { return nil, err } @@ -503,13 +486,10 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. } userIDs = utils.Distinct(userIDs) groupIDs = utils.Distinct(groupIDs) - userMap, err := GetPublicUserInfoMap(ctx, userIDs) + userMap, err := s.UserCheck.GetPublicUserInfoMap(ctx, userIDs, true) if err != nil { return nil, err } - if ids := utils.Single(utils.Keys(userMap), userIDs); len(ids) > 0 { - return nil, constant.ErrUserIDNotFound.Wrap(strings.Join(ids, ",")) - } groups, err := s.GroupInterface.FindGroup(ctx, utils.Distinct(groupIDs)) if err != nil { return nil, err @@ -588,19 +568,18 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup if groupRequest.HandleResult != 0 { return nil, constant.ErrArgs.Wrap("group request already processed") } - if _, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.FromUserID); err != nil { - if !IsNotFound(err) { - return nil, err - } - } else { - return nil, constant.ErrArgs.Wrap("already in group") + var join bool + if _, err = s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.FromUserID); err == nil { + join = true // 已经在群里了 + } else if !s.IsNotFound(err) { + return nil, err } - user, err := GetPublicUserInfoOne(ctx, req.FromUserID) + user, err := s.UserCheck.GetPublicUserInfo(ctx, req.FromUserID) if err != nil { return nil, err } var member *relationTb.GroupMemberModel - if req.HandleResult == constant.GroupResponseAgree { + if (!join) && req.HandleResult == constant.GroupResponseAgree { member = &relationTb.GroupMemberModel{ GroupID: req.GroupID, UserID: user.UserID, @@ -613,25 +592,27 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup OperatorUserID: tracelog.GetOpUserID(ctx), Ex: groupRequest.Ex, } - if err = CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), member, group.Ex); err != nil { + if err = CallbackBeforeMemberJoinGroup(ctx, member, group.Ex); err != nil { return nil, err } } if err := s.GroupInterface.HandlerGroupRequest(ctx, req.GroupID, req.FromUserID, req.HandledMsg, req.HandleResult, member); err != nil { return nil, err } - if req.HandleResult == constant.GroupResponseAgree { - chat.GroupApplicationAcceptedNotification(req) - chat.MemberEnterNotification(req) - } else if req.HandleResult == constant.GroupResponseRefuse { - chat.GroupApplicationRejectedNotification(req) + if !join { + if req.HandleResult == constant.GroupResponseAgree { + s.Notification.GroupApplicationAcceptedNotification(ctx, req) + s.Notification.MemberEnterNotification(ctx, req) + } else if req.HandleResult == constant.GroupResponseRefuse { + s.Notification.GroupApplicationRejectedNotification(ctx, req) + } } return resp, nil } func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.JoinGroupResp, error) { resp := &pbGroup.JoinGroupResp{} - if _, err := GetPublicUserInfoOne(ctx, tracelog.GetOpUserID(ctx)); err != nil { + if _, err := s.UserCheck.GetPublicUserInfo(ctx, tracelog.GetOpUserID(ctx)); err != nil { return nil, err } group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) @@ -655,13 +636,13 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) groupMember.OperatorUserID = tracelog.GetOpUserID(ctx) groupMember.JoinSource = constant.JoinByInvitation groupMember.InviterUserID = tracelog.GetOpUserID(ctx) - if err := CallbackBeforeMemberJoinGroup(ctx, tracelog.GetOperationID(ctx), groupMember, group.Ex); err != nil { + if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil { return nil, err } if err := s.GroupInterface.CreateGroup(ctx, nil, []*relationTb.GroupMemberModel{groupMember}); err != nil { return nil, err } - chat.MemberEnterDirectlyNotification(req.GroupID, tracelog.GetOpUserID(ctx), tracelog.GetOperationID(ctx)) + s.Notification.MemberEnterDirectlyNotification(ctx, req.GroupID, tracelog.GetOpUserID(ctx), tracelog.GetOperationID(ctx)) return resp, nil } groupRequest := relationTb.GroupRequestModel{ @@ -674,7 +655,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) if err := s.GroupInterface.CreateGroupRequest(ctx, []*relationTb.GroupRequestModel{&groupRequest}); err != nil { return nil, err } - chat.JoinGroupApplicationNotification(ctx, req) + s.Notification.JoinGroupApplicationNotification(ctx, req) return resp, nil } @@ -688,13 +669,13 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) if err := s.GroupInterface.DeleteSuperGroupMember(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil { return nil, err } - chat.SuperGroupNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), tracelog.GetOpUserID(ctx)) + s.Notification.SuperGroupNotification(ctx, tracelog.GetOpUserID(ctx), tracelog.GetOpUserID(ctx)) } else { _, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } - chat.MemberQuitNotification(req) + s.Notification.MemberQuitNotification(ctx, req) } return resp, nil } @@ -717,6 +698,10 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf if group.Status == constant.GroupStatusDismissed { return nil, utils.Wrap(constant.ErrDismissedAlready, "") } + userIDs, err := s.GroupInterface.FindGroupMemberUserID(ctx, group.GroupID) + if err != nil { + return nil, err + } data := UpdateGroupInfoMap(req.GroupInfoForSet) if len(data) > 0 { return resp, nil @@ -728,9 +713,21 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf if err != nil { return nil, err } - chat.GroupInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupInfoForSet.GroupID, group.GroupName, group.Notification, group.Introduction, group.FaceURL, req.GroupInfoForSet.NeedVerification) + s.Notification.GroupInfoSetNotification(ctx, req.GroupInfoForSet.GroupID, group.GroupName, group.Notification, group.Introduction, group.FaceURL, req.GroupInfoForSet.NeedVerification) if req.GroupInfoForSet.Notification != "" { - GroupNotification(ctx, group.GroupID) + args := pbConversation.ModifyConversationFieldReq{ + Conversation: &pbConversation.Conversation{ + OwnerUserID: tracelog.GetOpUserID(ctx), + ConversationID: utils.GetConversationIDBySessionType(group.GroupID, constant.GroupChatType), + ConversationType: constant.GroupChatType, + GroupID: group.GroupID, + }, + FieldType: constant.FieldGroupAtType, + UserIDList: userIDs, + } + if err := s.ConversationChecker.ModifyConversationField(ctx, &args); err != nil { + tracelog.SetCtxWarn(ctx, "ModifyConversationField", err, args) + } } return resp, nil } @@ -778,7 +775,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans if err := s.GroupInterface.TransferGroupOwner(ctx, req.GroupID, req.OldOwnerUserID, req.NewOwnerUserID, newOwner.RoleLevel); err != nil { return nil, err } - chat.GroupOwnerTransferredNotification(req) + s.Notification.GroupOwnerTransferredNotification(ctx, req) return resp, nil } @@ -828,9 +825,9 @@ func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGr return nil, err } resp.Total = total - nameMap, err := GetUsername(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { + nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { return e.UserID, e.Nickname == "" - })) + }), true) if err != nil { return nil, err } @@ -845,7 +842,7 @@ func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGr func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGroup.GetUserReqApplicationListReq) (*pbGroup.GetUserReqApplicationListResp, error) { resp := &pbGroup.GetUserReqApplicationListResp{} - user, err := GetPublicUserInfoOne(ctx, req.UserID) + user, err := s.UserCheck.GetPublicUserInfo(ctx, req.UserID) if err != nil { return nil, err } @@ -910,7 +907,7 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou return nil, err } } else { - chat.GroupDismissedNotification(req) + s.Notification.GroupDismissedNotification(ctx, req) } return resp, nil } @@ -934,7 +931,7 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou if err := s.GroupInterface.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil { return nil, err } - chat.GroupMemberMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID, req.MutedSeconds) + s.Notification.GroupMemberMutedNotification(ctx, req.GroupID, req.UserID, req.MutedSeconds) return resp, nil } @@ -957,7 +954,7 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca if err := s.GroupInterface.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil { return nil, err } - chat.GroupMemberCancelMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID, req.UserID) + s.Notification.GroupMemberCancelMutedNotification(ctx, req.GroupID, req.UserID) return resp, nil } @@ -969,7 +966,7 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) if err := s.GroupInterface.UpdateGroup(ctx, req.GroupID, UpdateGroupStatusMap(constant.GroupStatusMuted)); err != nil { return nil, err } - chat.GroupMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID) + s.Notification.GroupMutedNotification(ctx, req.GroupID) return resp, nil } @@ -981,7 +978,7 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu if err := s.GroupInterface.UpdateGroup(ctx, req.GroupID, UpdateGroupStatusMap(constant.GroupOk)); err != nil { return nil, err } - chat.GroupCancelMutedNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), req.GroupID) + s.Notification.GroupCancelMutedNotification(ctx, req.GroupID) return resp, nil } @@ -1058,7 +1055,7 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr return nil, err } for _, member := range req.Members { - chat.GroupMemberInfoSetNotification(tracelog.GetOperationID(ctx), tracelog.GetOpUserID(ctx), member.GroupID, member.UserID) + s.Notification.GroupMemberInfoSetNotification(ctx, member.GroupID, member.UserID) } return resp, nil } @@ -1103,9 +1100,9 @@ func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbGroup.Ge if err != nil { return nil, err } - nameMap, err := GetUsername(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { + nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { return e.UserID, e.Nickname == "" - })) + }), true) if err != nil { return nil, err } @@ -1127,3 +1124,27 @@ func (s *groupServer) GetGroupMemberUserID(ctx context.Context, req *pbGroup.Get } return resp, nil } + +func (s *groupServer) GetGroupMemberRoleLevel(ctx context.Context, req *pbGroup.GetGroupMemberRoleLevelReq) (*pbGroup.GetGroupMemberRoleLevelResp, error) { + resp := &pbGroup.GetGroupMemberRoleLevelResp{} + if len(req.RoleLevels) == 0 { + return nil, constant.ErrArgs.Wrap("RoleLevels empty") + } + members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.GroupID}, nil, req.RoleLevels) + if err != nil { + return nil, err + } + nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationTb.GroupMemberModel) (string, bool) { + return e.UserID, e.Nickname == "" + }), true) + if err != nil { + return nil, err + } + resp.Members = utils.Slice(members, func(e *relationTb.GroupMemberModel) *sdkws.GroupMemberFullInfo { + if e.Nickname == "" { + e.Nickname = nameMap[e.UserID] + } + return DbToPbGroupMembersCMSResp(e) + }) + return resp, nil +} diff --git a/internal/rpc/group/utils.go b/internal/rpc/group/utils.go deleted file mode 100644 index 51a774c04..000000000 --- a/internal/rpc/group/utils.go +++ /dev/null @@ -1,13 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/tracelog" - "gorm.io/gorm" -) - -func IsNotFound(err error) bool { - if err == nil { - return false - } - return tracelog.Unwrap(err) == gorm.ErrRecordNotFound -} diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go index ea742e189..f8660e7e1 100644 --- a/internal/rpc/msg/callback.go +++ b/internal/rpc/msg/callback.go @@ -1,23 +1,27 @@ package msg import ( - cbApi "Open_IM/pkg/callback_struct" - "Open_IM/pkg/common/callback" + cbapi "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" - "Open_IM/pkg/common/log" + "Open_IM/pkg/common/tracelog" pbChat "Open_IM/pkg/proto/msg" "Open_IM/pkg/utils" - http2 "net/http" + "context" ) -func copyCallbackCommonReqStruct(msg *pbChat.SendMsgReq) cbApi.CommonCallbackReq { - req := cbApi.CommonCallbackReq{ +func cbURL() string { + return config.Config.Callback.CallbackUrl +} + +func toCommonCallback(ctx context.Context, msg *pbChat.SendMsgReq, command string) cbapi.CommonCallbackReq { + return cbapi.CommonCallbackReq{ SendID: msg.MsgData.SendID, ServerMsgID: msg.MsgData.ServerMsgID, + CallbackCommand: command, ClientMsgID: msg.MsgData.ClientMsgID, - OperationID: msg.OperationID, + OperationID: tracelog.GetOperationID(ctx), SenderPlatformID: msg.MsgData.SenderPlatformID, SenderNickname: msg.MsgData.SenderNickname, SessionType: msg.MsgData.SessionType, @@ -27,202 +31,90 @@ func copyCallbackCommonReqStruct(msg *pbChat.SendMsgReq) cbApi.CommonCallbackReq CreateTime: msg.MsgData.CreateTime, AtUserIDList: msg.MsgData.AtUserIDList, SenderFaceURL: msg.MsgData.SenderFaceURL, - Content: callback.GetContent(msg.MsgData), + Content: utils.GetContent(msg.MsgData), Seq: msg.MsgData.Seq, Ex: msg.MsgData.Ex, } - return req } -func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID} +func CallbackBeforeSendSingleMsg(ctx context.Context, msg *pbChat.SendMsgReq) error { if !config.Config.Callback.CallbackBeforeSendSingleMsg.Enable { - return callbackResp + return nil } - log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) - commonCallbackReq := copyCallbackCommonReqStruct(msg) - commonCallbackReq.CallbackCommand = constant.CallbackBeforeSendSingleMsgCommand - req := cbApi.CallbackBeforeSendSingleMsgReq{ - CommonCallbackReq: commonCallbackReq, + req := &cbapi.CallbackBeforeSendSingleMsgReq{ + CommonCallbackReq: toCommonCallback(ctx, msg, constant.CallbackBeforeSendSingleMsgCommand), RecvID: msg.MsgData.RecvID, } - resp := &cbApi.CallbackBeforeSendSingleMsgResp{ - CommonCallbackResp: &callbackResp, - } - //utils.CopyStructFields(req, msg.MsgData) - defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeSendSingleMsgCommand, - req, resp, config.Config.Callback.CallbackBeforeSendSingleMsg.CallbackTimeOut, &config.Config.Callback.CallbackBeforeSendSingleMsg.CallbackFailedContinue); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - if !config.Config.Callback.CallbackBeforeSendSingleMsg.CallbackFailedContinue { - callbackResp.ActionCode = constant.ActionForbidden - return callbackResp - } else { - callbackResp.ActionCode = constant.ActionAllow - return callbackResp - } - } - return callbackResp + resp := &cbapi.CallbackBeforeSendSingleMsgResp{} + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackBeforeSendSingleMsg) } -func callbackAfterSendSingleMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID} +func CallbackAfterSendSingleMsg(ctx context.Context, msg *pbChat.SendMsgReq) error { if !config.Config.Callback.CallbackAfterSendSingleMsg.Enable { - return callbackResp + return nil } - log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) - commonCallbackReq := copyCallbackCommonReqStruct(msg) - commonCallbackReq.CallbackCommand = constant.CallbackAfterSendSingleMsgCommand - req := cbApi.CallbackAfterSendSingleMsgReq{ - CommonCallbackReq: commonCallbackReq, + req := &cbapi.CallbackAfterSendSingleMsgReq{ + CommonCallbackReq: toCommonCallback(ctx, msg, constant.CallbackBeforeSendSingleMsgCommand), RecvID: msg.MsgData.RecvID, } - resp := &cbApi.CallbackAfterSendSingleMsgResp{CommonCallbackResp: &callbackResp} - defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackAfterSendSingleMsgCommand, - req, resp, config.Config.Callback.CallbackAfterSendSingleMsg.CallbackTimeOut, &config.Config.Callback.CallbackAfterSendSingleMsg.CallbackFailedContinue); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - return callbackResp - } - return callbackResp + resp := &cbapi.CallbackAfterSendSingleMsgResp{} + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendSingleMsg) } -func callbackBeforeSendGroupMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID} - if !config.Config.Callback.CallbackBeforeSendGroupMsg.Enable { - return callbackResp +func CallbackBeforeSendGroupMsg(ctx context.Context, msg *pbChat.SendMsgReq) error { + if !config.Config.Callback.CallbackAfterSendSingleMsg.Enable { + return nil } - log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) - commonCallbackReq := copyCallbackCommonReqStruct(msg) - commonCallbackReq.CallbackCommand = constant.CallbackBeforeSendGroupMsgCommand - req := cbApi.CallbackAfterSendGroupMsgReq{ - CommonCallbackReq: commonCallbackReq, + req := &cbapi.CallbackAfterSendGroupMsgReq{ + CommonCallbackReq: toCommonCallback(ctx, msg, constant.CallbackBeforeSendSingleMsgCommand), GroupID: msg.MsgData.GroupID, } - resp := &cbApi.CallbackBeforeSendGroupMsgResp{CommonCallbackResp: &callbackResp} - defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeSendGroupMsgCommand, - req, resp, config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackTimeOut, &config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackFailedContinue); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - if !config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackFailedContinue { - callbackResp.ActionCode = constant.ActionForbidden - return callbackResp - } else { - callbackResp.ActionCode = constant.ActionAllow - return callbackResp - } - } - return callbackResp + resp := &cbapi.CallbackBeforeSendGroupMsgResp{} + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendSingleMsg) } -func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID} +func CallbackAfterSendGroupMsg(ctx context.Context, msg *pbChat.SendMsgReq) error { if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable { - return callbackResp + return nil } - log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) - commonCallbackReq := copyCallbackCommonReqStruct(msg) - commonCallbackReq.CallbackCommand = constant.CallbackAfterSendGroupMsgCommand - req := cbApi.CallbackAfterSendGroupMsgReq{ - CommonCallbackReq: commonCallbackReq, + req := &cbapi.CallbackAfterSendGroupMsgReq{ + CommonCallbackReq: toCommonCallback(ctx, msg, constant.CallbackAfterSendGroupMsgCommand), GroupID: msg.MsgData.GroupID, } - resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: &callbackResp} - defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackAfterSendGroupMsgCommand, req, resp, - config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut, nil); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - return callbackResp - } - return callbackResp + resp := &cbapi.CallbackAfterSendGroupMsgResp{} + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) } -func callbackMsgModify(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp { - log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) - callbackResp := cbApi.CommonCallbackResp{OperationID: msg.OperationID} +func CallbackMsgModify(ctx context.Context, msg *pbChat.SendMsgReq) error { if !config.Config.Callback.CallbackMsgModify.Enable || msg.MsgData.ContentType != constant.Text { - return callbackResp + return nil } - commonCallbackReq := copyCallbackCommonReqStruct(msg) - commonCallbackReq.CallbackCommand = constant.CallbackMsgModifyCommand - req := cbApi.CallbackMsgModifyCommandReq{ - CommonCallbackReq: commonCallbackReq, + req := &cbapi.CallbackMsgModifyCommandReq{ + CommonCallbackReq: toCommonCallback(ctx, msg, constant.CallbackMsgModifyCommand), } - resp := &cbApi.CallbackMsgModifyCommandResp{CommonCallbackResp: &callbackResp} - defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackMsgModifyCommand, req, resp, - config.Config.Callback.CallbackMsgModify.CallbackTimeOut, &config.Config.Callback.CallbackMsgModify.CallbackFailedContinue); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - if !config.Config.Callback.CallbackMsgModify.CallbackFailedContinue { - callbackResp.ActionCode = constant.ActionForbidden - return callbackResp - } else { - callbackResp.ActionCode = constant.ActionAllow - return callbackResp - } + resp := &cbapi.CallbackMsgModifyCommandResp{} + if err := http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg); err != nil { + return err } - if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow { - if resp.Content != nil { - msg.MsgData.Content = []byte(*resp.Content) - } - if resp.RecvID != nil { - msg.MsgData.RecvID = *resp.RecvID - } - if resp.GroupID != nil { - msg.MsgData.GroupID = *resp.GroupID - } - if resp.ClientMsgID != nil { - msg.MsgData.ClientMsgID = *resp.ClientMsgID - } - if resp.ServerMsgID != nil { - msg.MsgData.ServerMsgID = *resp.ServerMsgID - } - if resp.SenderPlatformID != nil { - msg.MsgData.SenderPlatformID = *resp.SenderPlatformID - } - if resp.SenderNickname != nil { - msg.MsgData.SenderNickname = *resp.SenderNickname - } - if resp.SenderFaceURL != nil { - msg.MsgData.SenderFaceURL = *resp.SenderFaceURL - } - if resp.SessionType != nil { - msg.MsgData.SessionType = *resp.SessionType - } - if resp.MsgFrom != nil { - msg.MsgData.MsgFrom = *resp.MsgFrom - } - if resp.ContentType != nil { - msg.MsgData.ContentType = *resp.ContentType - } - if resp.Status != nil { - msg.MsgData.Status = *resp.Status - } - if resp.Options != nil { - msg.MsgData.Options = *resp.Options - } - if resp.OfflinePushInfo != nil { - msg.MsgData.OfflinePushInfo = resp.OfflinePushInfo - } - if resp.AtUserIDList != nil { - msg.MsgData.AtUserIDList = *resp.AtUserIDList - } - if resp.MsgDataList != nil { - msg.MsgData.MsgDataList = *resp.MsgDataList - } - if resp.AttachedInfo != nil { - msg.MsgData.AttachedInfo = *resp.AttachedInfo - } - if resp.Ex != nil { - msg.MsgData.Ex = *resp.Ex - } - + if resp.Content != nil { + msg.MsgData.Content = []byte(*resp.Content) } - log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), string(msg.MsgData.Content)) - return callbackResp + utils.NotNilReplace(msg.MsgData.OfflinePushInfo, resp.OfflinePushInfo) + utils.NotNilReplace(&msg.MsgData.RecvID, resp.RecvID) + utils.NotNilReplace(&msg.MsgData.GroupID, resp.GroupID) + utils.NotNilReplace(&msg.MsgData.ClientMsgID, resp.ClientMsgID) + utils.NotNilReplace(&msg.MsgData.ServerMsgID, resp.ServerMsgID) + utils.NotNilReplace(&msg.MsgData.SenderPlatformID, resp.SenderPlatformID) + utils.NotNilReplace(&msg.MsgData.SenderNickname, resp.SenderNickname) + utils.NotNilReplace(&msg.MsgData.SenderFaceURL, resp.SenderFaceURL) + utils.NotNilReplace(&msg.MsgData.SessionType, resp.SessionType) + utils.NotNilReplace(&msg.MsgData.MsgFrom, resp.MsgFrom) + utils.NotNilReplace(&msg.MsgData.ContentType, resp.ContentType) + utils.NotNilReplace(&msg.MsgData.Status, resp.Status) + utils.NotNilReplace(&msg.MsgData.Options, resp.Options) + utils.NotNilReplace(&msg.MsgData.AtUserIDList, resp.AtUserIDList) + utils.NotNilReplace(&msg.MsgData.MsgDataList, resp.MsgDataList) + utils.NotNilReplace(&msg.MsgData.AttachedInfo, resp.AttachedInfo) + utils.NotNilReplace(&msg.MsgData.Ex, resp.Ex) + return nil } diff --git a/internal/rpc/msg/chat.go b/internal/rpc/msg/chat.go deleted file mode 100644 index ff2debcb8..000000000 --- a/internal/rpc/msg/chat.go +++ /dev/null @@ -1,63 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/tokenverify" - pbChat "Open_IM/pkg/proto/msg" - "Open_IM/pkg/utils" - "context" -) - -func (rpc *rpcChat) ClearMsg(_ context.Context, req *pbChat.ClearMsgReq) (*pbChat.ClearMsgResp, error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc req: ", req.String()) - if req.OpUserID != req.UserID && !tokenverify.IsManagerUserID(req.UserID) { - errMsg := "No permission" + req.OpUserID + req.UserID - log.Error(req.OperationID, errMsg) - return &pbChat.ClearMsgResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: errMsg}, nil - } - log.Debug(req.OperationID, "CleanUpOneUserAllMsgFromRedis args", req.UserID) - err := db.DB.CleanUpOneUserAllMsgFromRedis(req.UserID, req.OperationID) - if err != nil { - errMsg := "CleanUpOneUserAllMsgFromRedis failed " + err.Error() + req.OperationID + req.UserID - log.Error(req.OperationID, errMsg) - return &pbChat.ClearMsgResp{ErrCode: constant.ErrDatabase.ErrCode, ErrMsg: errMsg}, nil - } - log.Debug(req.OperationID, "CleanUpUserMsgFromMongo args", req.UserID) - err = db.DB.CleanUpUserMsgFromMongo(req.UserID, req.OperationID) - if err != nil { - errMsg := "CleanUpUserMsgFromMongo failed " + err.Error() + req.OperationID + req.UserID - log.Error(req.OperationID, errMsg) - return &pbChat.ClearMsgResp{ErrCode: constant.ErrDatabase.ErrCode, ErrMsg: errMsg}, nil - } - - resp := pbChat.ClearMsgResp{ErrCode: 0} - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) - return &resp, nil -} - -func (rpc *rpcChat) SetMsgMinSeq(_ context.Context, req *pbChat.SetMsgMinSeqReq) (*pbChat.SetMsgMinSeqResp, error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc req: ", req.String()) - if req.OpUserID != req.UserID && !tokenverify.IsManagerUserID(req.UserID) { - errMsg := "No permission" + req.OpUserID + req.UserID - log.Error(req.OperationID, errMsg) - return &pbChat.SetMsgMinSeqResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: errMsg}, nil - } - if req.GroupID == "" { - err := db.DB.SetUserMinSeq(req.UserID, req.MinSeq) - if err != nil { - errMsg := "SetUserMinSeq failed " + err.Error() + req.OperationID + req.UserID + utils.Uint32ToString(req.MinSeq) - log.Error(req.OperationID, errMsg) - return &pbChat.SetMsgMinSeqResp{ErrCode: constant.ErrDatabase.ErrCode, ErrMsg: errMsg}, nil - } - return &pbChat.SetMsgMinSeqResp{}, nil - } - err := db.DB.SetGroupUserMinSeq(req.GroupID, req.UserID, uint64(req.MinSeq)) - if err != nil { - errMsg := "SetGroupUserMinSeq failed " + err.Error() + req.OperationID + req.GroupID + req.UserID + utils.Uint32ToString(req.MinSeq) - log.Error(req.OperationID, errMsg) - return &pbChat.SetMsgMinSeqResp{ErrCode: constant.ErrDatabase.ErrCode, ErrMsg: errMsg}, nil - } - return &pbChat.SetMsgMinSeqResp{}, nil -} diff --git a/internal/rpc/msg/del_msg.go b/internal/rpc/msg/del_msg.go deleted file mode 100644 index 39559d00b..000000000 --- a/internal/rpc/msg/del_msg.go +++ /dev/null @@ -1,56 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/proto/msg" - common "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" - "context" - "time" -) - -func (rpc *rpcChat) DelMsgList(_ context.Context, req *common.DelMsgListReq) (*common.DelMsgListResp, error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp := &common.DelMsgListResp{} - select { - case rpc.delMsgCh <- deleteMsg{ - UserID: req.UserID, - OpUserID: req.OpUserID, - SeqList: req.SeqList, - OperationID: req.OperationID, - }: - case <-time.After(1 * time.Second): - resp.ErrCode = constant.ErrSendLimit.ErrCode - resp.ErrMsg = constant.ErrSendLimit.ErrMsg - return resp, nil - } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) - return resp, nil -} -func (rpc *rpcChat) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroupMsgReq) (*msg.DelSuperGroupMsgResp, error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - if !tokenverify.CheckAccess(ctx, req.OpUserID, req.UserID) { - log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.UserID) - return &msg.DelSuperGroupMsgResp{ErrCode: constant.ErrNoPermission.ErrCode, ErrMsg: constant.ErrNoPermission.ErrMsg}, nil - } - resp := &msg.DelSuperGroupMsgResp{} - groupMaxSeq, err := db.DB.GetGroupMaxSeq(req.GroupID) - if err != nil { - log.NewError(req.OperationID, "GetGroupMaxSeq false ", req.OpUserID, req.UserID, req.GroupID) - resp.ErrCode = constant.ErrDB.ErrCode - resp.ErrMsg = err.Error() - return resp, nil - } - err = db.DB.SetGroupUserMinSeq(req.GroupID, req.UserID, groupMaxSeq) - if err != nil { - log.NewError(req.OperationID, "SetGroupUserMinSeq false ", req.OpUserID, req.UserID, req.GroupID) - resp.ErrCode = constant.ErrDB.ErrCode - resp.ErrMsg = err.Error() - return resp, nil - } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) - return resp, nil -} diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go new file mode 100644 index 000000000..d2e5e7b84 --- /dev/null +++ b/internal/rpc/msg/delete.go @@ -0,0 +1,43 @@ +package msg + +import ( + "Open_IM/pkg/common/tokenverify" + "Open_IM/pkg/proto/msg" + common "Open_IM/pkg/proto/sdkws" + "context" +) + +func (m *msgServer) DelMsgList(ctx context.Context, req *common.DelMsgListReq) (*common.DelMsgListResp, error) { + resp := &common.DelMsgListResp{} + if err := m.MsgInterface.DelMsgFromCache(ctx, req.UserID, req.SeqList); err != nil { + return nil, err + } + DeleteMessageNotification(ctx, req.UserID, req.SeqList) + return resp, nil +} + +func (m *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroupMsgReq) (*msg.DelSuperGroupMsgResp, error) { + resp := &msg.DelSuperGroupMsgResp{} + if err := tokenverify.CheckAdmin(ctx); err != nil { + return nil, err + } + maxSeq, err := m.MsgInterface.GetGroupMaxSeq(ctx, req.GroupID) + if err != nil { + return nil, err + } + if err := m.MsgInterface.SetGroupUserMinSeq(ctx, req.GroupID, maxSeq); err != nil { + return nil, err + } + return resp, nil +} + +func (m *msgServer) ClearMsg(ctx context.Context, req *msg.ClearMsgReq) (*msg.ClearMsgResp, error) { + resp := &msg.ClearMsgResp{} + if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { + return nil, err + } + if err := m.MsgInterface.DelUserAllSeq(ctx, req.UserID); err != nil { + return nil, err + } + return resp, nil +} diff --git a/internal/rpc/msg/extend_msg.go b/internal/rpc/msg/extend_msg.go index 2bb249650..5d32729f2 100644 --- a/internal/rpc/msg/extend_msg.go +++ b/internal/rpc/msg/extend_msg.go @@ -1,6 +1,7 @@ package msg import ( + "Open_IM/internal/common/notification" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" @@ -13,12 +14,12 @@ import ( "time" ) -func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.SetMessageReactionExtensionsReq) (resp *msg.SetMessageReactionExtensionsResp, err error) { - log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String()) +func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.SetMessageReactionExtensionsReq) (resp *msg.SetMessageReactionExtensionsResp, err error) { + log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String()) var rResp msg.SetMessageReactionExtensionsResp rResp.ClientMsgID = req.ClientMsgID rResp.MsgFirstModifyTime = req.MsgFirstModifyTime - callbackResp := callbackSetMessageReactionExtensions(req) + callbackResp := notification.callbackSetMessageReactionExtensions(req) if callbackResp.ActionCode != constant.ActionAllow || callbackResp.ErrCode != 0 { rResp.ErrCode = int32(callbackResp.ErrCode) rResp.ErrMsg = callbackResp.ErrMsg @@ -41,7 +42,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S } rResp.MsgFirstModifyTime = callbackResp.MsgFirstModifyTime rResp.Result = callbackResp.ResultReactionExtensionList - ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, isHistory, false) + notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, isHistory, false) return &rResp, nil } for _, v := range callbackResp.ResultReactionExtensionList { @@ -71,7 +72,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S log.Debug(req.OperationID, "redis handle firstly", req.String()) rResp.MsgFirstModifyTime = utils.GetCurrentTimestampByMill() for k, v := range req.ReactionExtensionList { - err := rpc.dMessageLocker.LockMessageTypeKey(req.ClientMsgID, k) + err := m.dMessageLocker.LockMessageTypeKey(req.ClientMsgID, k) if err != nil { setKeyResultInfo(&rResp, 100, err.Error(), req.ClientMsgID, k, v) continue @@ -90,7 +91,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S log.Error(req.OperationID, "SetMessageReactionExpire err:", err.Error(), req.String()) } } else { - err := rpc.dMessageLocker.LockGlobalMessage(req.ClientMsgID) + err := m.dMessageLocker.LockGlobalMessage(req.ClientMsgID) if err != nil { rResp.ErrCode = 100 rResp.ErrMsg = err.Error() @@ -148,7 +149,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S rResp.Result = append(rResp.Result, temp) } } - lockErr := rpc.dMessageLocker.UnLockGlobalMessage(req.ClientMsgID) + lockErr := m.dMessageLocker.UnLockGlobalMessage(req.ClientMsgID) if lockErr != nil { log.Error(req.OperationID, "UnLockGlobalMessage err:", lockErr.Error()) } @@ -158,7 +159,7 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S log.Debug(req.OperationID, "redis handle secondly", req.String()) for k, v := range req.ReactionExtensionList { - err := rpc.dMessageLocker.LockMessageTypeKey(req.ClientMsgID, k) + err := m.dMessageLocker.LockMessageTypeKey(req.ClientMsgID, k) if err != nil { setKeyResultInfo(&rResp, 100, err.Error(), req.ClientMsgID, k, v) continue @@ -187,14 +188,14 @@ func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.S } if !isExists { if !req.IsReact { - ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, true, true) + notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, true, true) } else { - ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, false) + notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, false) } } else { - ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, true) + notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, true) } - log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc return is:", rResp.String()) + log.Debug(req.OperationID, utils.GetSelfFuncName(), "m return is:", rResp.String()) return &rResp, nil } @@ -215,8 +216,8 @@ func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errC _ = db.DB.UnLockMessageTypeKey(clientMsgID, typeKey) } -func (rpc *rpcChat) GetMessageListReactionExtensions(ctx context.Context, req *msg.GetMessageListReactionExtensionsReq) (resp *msg.GetMessageListReactionExtensionsResp, err error) { - log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String()) +func (m *msgServer) GetMessageListReactionExtensions(ctx context.Context, req *msg.GetMessageListReactionExtensionsReq) (resp *msg.GetMessageListReactionExtensionsResp, err error) { + log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String()) var rResp msg.GetMessageListReactionExtensionsResp for _, messageValue := range req.MessageReactionKeyList { var oneMessage msg.SingleMessageExtensionResult @@ -266,19 +267,19 @@ func (rpc *rpcChat) GetMessageListReactionExtensions(ctx context.Context, req *m } rResp.SingleMessageResult = append(rResp.SingleMessageResult, &oneMessage) } - log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc return is:", rResp.String()) + log.Debug(req.OperationID, utils.GetSelfFuncName(), "m return is:", rResp.String()) return &rResp, nil } -func (rpc *rpcChat) AddMessageReactionExtensions(ctx context.Context, req *msg.ModifyMessageReactionExtensionsReq) (resp *msg.ModifyMessageReactionExtensionsResp, err error) { +func (m *msgServer) AddMessageReactionExtensions(ctx context.Context, req *msg.ModifyMessageReactionExtensionsReq) (resp *msg.ModifyMessageReactionExtensionsResp, err error) { return } -func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) { - log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String()) +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()) var rResp msg.DeleteMessageListReactionExtensionsResp - callbackResp := callbackDeleteMessageReactionExtensions(req) + callbackResp := notification.callbackDeleteMessageReactionExtensions(req) if callbackResp.ActionCode != constant.ActionAllow || callbackResp.ErrCode != 0 { rResp.ErrCode = int32(callbackResp.ErrCode) rResp.ErrMsg = callbackResp.ErrMsg @@ -294,7 +295,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms //if ExternalExtension if req.IsExternalExtensions { rResp.Result = callbackResp.ResultReactionExtensionList - ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, false) + notification.ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, false) return &rResp, nil } @@ -327,7 +328,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms if isExists { log.Debug(req.OperationID, "redis handle this delete", req.String()) for _, v := range req.ReactionExtensionList { - err := rpc.dMessageLocker.LockMessageTypeKey(req.ClientMsgID, v.TypeKey) + err := m.dMessageLocker.LockMessageTypeKey(req.ClientMsgID, v.TypeKey) if err != nil { setDeleteKeyResultInfo(&rResp, 100, err.Error(), req.ClientMsgID, v.TypeKey, v) continue @@ -353,7 +354,7 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms } } } else { - err := rpc.dMessageLocker.LockGlobalMessage(req.ClientMsgID) + err := m.dMessageLocker.LockGlobalMessage(req.ClientMsgID) if err != nil { rResp.ErrCode = 100 rResp.ErrMsg = err.Error() @@ -412,13 +413,13 @@ func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *ms rResp.Result = append(rResp.Result, temp) } } - lockErr := rpc.dMessageLocker.UnLockGlobalMessage(req.ClientMsgID) + lockErr := m.dMessageLocker.UnLockGlobalMessage(req.ClientMsgID) if lockErr != nil { log.Error(req.OperationID, "UnLockGlobalMessage err:", lockErr.Error()) } } - ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, isExists) - log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc return is:", rResp.String()) + notification.ExtendMessageDeleteNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &rResp, false, isExists) + log.Debug(req.OperationID, utils.GetSelfFuncName(), "m return is:", rResp.String()) return &rResp, nil } diff --git a/internal/rpc/msg/extend_msg_callback.go b/internal/rpc/msg/extend_msg_callback.go index ceb65c3fc..f9876ee1d 100644 --- a/internal/rpc/msg/extend_msg_callback.go +++ b/internal/rpc/msg/extend_msg_callback.go @@ -1,21 +1,23 @@ package msg import ( - cbApi "Open_IM/pkg/callback_struct" + cbapi "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" "Open_IM/pkg/common/log" + "Open_IM/pkg/common/tracelog" "Open_IM/pkg/proto/msg" "Open_IM/pkg/utils" - http2 "net/http" + "context" ) -func callbackSetMessageReactionExtensions(setReq *msg.SetMessageReactionExtensionsReq) *cbApi.CallbackBeforeSetMessageReactionExtResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: setReq.OperationID} - log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), setReq.String()) - req := cbApi.CallbackBeforeSetMessageReactionExtReq{ - OperationID: setReq.OperationID, +func CallbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMessageReactionExtensionsReq) error { + if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable { + return nil + } + req := &cbapi.CallbackBeforeSetMessageReactionExtReq{ + OperationID: tracelog.GetOperationID(ctx), CallbackCommand: constant.CallbackBeforeSetMessageReactionExtensionCommand, SourceID: setReq.SourceID, OpUserID: setReq.OpUserID, @@ -26,21 +28,15 @@ func callbackSetMessageReactionExtensions(setReq *msg.SetMessageReactionExtensio IsExternalExtensions: setReq.IsExternalExtensions, MsgFirstModifyTime: setReq.MsgFirstModifyTime, } - resp := &cbApi.CallbackBeforeSetMessageReactionExtResp{CommonCallbackResp: &callbackResp} - defer log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeSetMessageReactionExtensionCommand, - req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut, nil); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - } - return resp - + resp := &cbapi.CallbackBeforeSetMessageReactionExtResp{} + return http.CallBackPostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) } -func callbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReactionExtensionsReq) *cbApi.CallbackDeleteMessageReactionExtResp { - callbackResp := cbApi.CommonCallbackResp{OperationID: setReq.OperationID} - log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), setReq.String()) - req := cbApi.CallbackDeleteMessageReactionExtReq{ +func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReactionExtensionsReq) error { + if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable { + return nil + } + req := &cbapi.CallbackDeleteMessageReactionExtReq{ OperationID: setReq.OperationID, CallbackCommand: constant.CallbackBeforeDeleteMessageReactionExtensionsCommand, SourceID: setReq.SourceID, @@ -51,12 +47,53 @@ func callbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReacti IsExternalExtensions: setReq.IsExternalExtensions, MsgFirstModifyTime: setReq.MsgFirstModifyTime, } - resp := &cbApi.CallbackDeleteMessageReactionExtResp{CommonCallbackResp: &callbackResp} + resp := &cbapi.CallbackDeleteMessageReactionExtResp{} defer log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), req, *resp) - if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackBeforeDeleteMessageReactionExtensionsCommand, - req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut, nil); err != nil { - callbackResp.ErrCode = http2.StatusInternalServerError - callbackResp.ErrMsg = err.Error() - } - return resp + return http.CallBackPostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) } + +//func CallbackGetMessageListReactionExtensions(getReq *msg.GetMessageListReactionExtensionsReq) error { +// if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable { +// return nil +// } +// req := cbapi.CallbackGetMessageListReactionExtReq{ +// OperationID: getReq.OperationID, +// CallbackCommand: constant.CallbackGetMessageListReactionExtensionsCommand, +// SourceID: getReq.SourceID, +// OpUserID: getReq.OpUserID, +// SessionType: getReq.SessionType, +// TypeKeyList: getReq.TypeKeyList, +// MessageKeyList: getReq.MessageReactionKeyList, +// } +// resp := &cbApi.CallbackGetMessageListReactionExtResp{CommonCallbackResp: &callbackResp} +// defer log.NewDebug(getReq.OperationID, utils.GetSelfFuncName(), req, *resp) +// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackGetMessageListReactionExtensionsCommand, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut); err != nil { +// callbackResp.ErrCode = http2.StatusInternalServerError +// callbackResp.ErrMsg = err.Error() +// } +// return resp +//} +//func callbackAddMessageReactionExtensions(setReq *msg.AddMessageReactionExtensionsReq) *cb.CallbackAddMessageReactionExtResp { +// callbackResp := cbapi.CommonCallbackResp{OperationID: setReq.OperationID} +// log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), setReq.String()) +// req := cbapi.CallbackAddMessageReactionExtReq{ +// OperationID: setReq.OperationID, +// CallbackCommand: constant.CallbackAddMessageListReactionExtensionsCommand, +// SourceID: setReq.SourceID, +// OpUserID: setReq.OpUserID, +// SessionType: setReq.SessionType, +// ReactionExtensionList: setReq.ReactionExtensionList, +// ClientMsgID: setReq.ClientMsgID, +// IsReact: setReq.IsReact, +// IsExternalExtensions: setReq.IsExternalExtensions, +// MsgFirstModifyTime: setReq.MsgFirstModifyTime, +// } +// resp := &cbapi.CallbackAddMessageReactionExtResp{CommonCallbackResp: &callbackResp} +// defer log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), req, *resp, *resp.CommonCallbackResp, resp.IsReact, resp.MsgFirstModifyTime) +// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackAddMessageListReactionExtensionsCommand, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut); err != nil { +// callbackResp.ErrCode = http2.StatusInternalServerError +// callbackResp.ErrMsg = err.Error() +// } +// return resp +// +//} diff --git a/internal/rpc/msg/group_notification.go b/internal/rpc/msg/group_notification.go deleted file mode 100644 index 19b40c682..000000000 --- a/internal/rpc/msg/group_notification.go +++ /dev/null @@ -1,621 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/tokenverify" - utils2 "Open_IM/pkg/common/utils" - pbGroup "Open_IM/pkg/proto/group" - "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" - "context" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" - "google.golang.org/protobuf/types/known/wrapperspb" -) - -//message GroupCreatedTips{ -// GroupInfo Group = 1; -// GroupMemberFullInfo Creator = 2; -// repeated GroupMemberFullInfo MemberList = 3; -// uint64 OperationTime = 4; -//} creator->group - -func setOpUserInfo(opUserID, groupID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error { - if tokenverify.IsManagerUserID(opUserID) { - u, err := imdb.GetUserByUserID(opUserID) - if err != nil { - return utils.Wrap(err, "GetUserByUserID failed") - } - utils.CopyStructFields(groupMemberInfo, u) - groupMemberInfo.GroupID = groupID - } else { - u, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, opUserID) - if err == nil { - if err = utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, u); err != nil { - return utils.Wrap(err, "") - } - } - user, err := imdb.GetUserByUserID(opUserID) - if err != nil { - return utils.Wrap(err, "") - } - groupMemberInfo.GroupID = groupID - groupMemberInfo.UserID = user.UserID - groupMemberInfo.Nickname = user.Nickname - groupMemberInfo.AppMangerLevel = user.AppMangerLevel - groupMemberInfo.FaceURL = user.FaceURL - } - return nil -} - -func setGroupInfo(groupID string, groupInfo *sdkws.GroupInfo) error { - group, err := imdb.GetGroupInfoByGroupID(groupID) - if err != nil { - return utils.Wrap(err, "GetGroupInfoByGroupID failed") - } - err = utils2.GroupDBCopyOpenIM(groupInfo, group) - if err != nil { - log.NewWarn("", "GroupDBCopyOpenIM failed ", groupID, err.Error()) - return nil - } - return nil -} - -func setGroupMemberInfo(groupID, userID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error { - groupMember, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) - if err == nil { - return utils.Wrap(utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember), "") - } - - user, err := imdb.GetUserByUserID(userID) - if err != nil { - return utils.Wrap(err, "") - } - groupMemberInfo.GroupID = groupID - groupMemberInfo.UserID = user.UserID - groupMemberInfo.Nickname = user.Nickname - groupMemberInfo.AppMangerLevel = user.AppMangerLevel - groupMemberInfo.FaceURL = user.FaceURL - return nil -} - -func setGroupOwnerInfo(groupID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error { - groupMember, err := imdb.GetGroupOwnerInfoByGroupID(groupID) - if err != nil { - return utils.Wrap(err, "") - } - if err = utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember); err != nil { - return utils.Wrap(err, "") - } - return nil -} - -func setPublicUserInfo(userID string, publicUserInfo *sdkws.PublicUserInfo) error { - user, err := imdb.GetUserByUserID(userID) - if err != nil { - return utils.Wrap(err, "") - } - utils2.UserDBCopyOpenIMPublicUser(publicUserInfo, user) - return nil -} - -func groupNotification(contentType int32, m proto.Message, sendID, groupID, recvUserID, operationID string) { - log.Info(operationID, utils.GetSelfFuncName(), "args: ", contentType, sendID, groupID, recvUserID) - - var err error - var tips sdkws.TipsComm - tips.Detail, err = proto.Marshal(m) - if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), m.String()) - return - } - marshaler := jsonpb.Marshaler{ - OrigName: true, - EnumsAsInts: false, - EmitDefaults: false, - } - - tips.JsonDetail, _ = marshaler.MarshalToString(m) - var nickname string - - from, err := imdb.GetUserByUserID(sendID) - if err != nil { - log.Error(operationID, "GetUserByUserID failed ", err.Error(), sendID) - } - if from != nil { - nickname = from.Nickname - } - - to, err := imdb.GetUserByUserID(recvUserID) - if err != nil { - log.NewWarn(operationID, "GetUserByUserID failed ", err.Error(), recvUserID) - } - toNickname := "" - if to != nil { - toNickname = to.Nickname - } - - cn := config.Config.Notification - switch contentType { - case constant.GroupCreatedNotification: - tips.DefaultTips = nickname + " " + cn.GroupCreated.DefaultTips.Tips - case constant.GroupInfoSetNotification: - tips.DefaultTips = nickname + " " + cn.GroupInfoSet.DefaultTips.Tips - case constant.JoinGroupApplicationNotification: - tips.DefaultTips = nickname + " " + cn.JoinGroupApplication.DefaultTips.Tips - case constant.MemberQuitNotification: - tips.DefaultTips = nickname + " " + cn.MemberQuit.DefaultTips.Tips - case constant.GroupApplicationAcceptedNotification: // - tips.DefaultTips = toNickname + " " + cn.GroupApplicationAccepted.DefaultTips.Tips - case constant.GroupApplicationRejectedNotification: // - tips.DefaultTips = toNickname + " " + cn.GroupApplicationRejected.DefaultTips.Tips - case constant.GroupOwnerTransferredNotification: // - tips.DefaultTips = toNickname + " " + cn.GroupOwnerTransferred.DefaultTips.Tips - case constant.MemberKickedNotification: // - tips.DefaultTips = toNickname + " " + cn.MemberKicked.DefaultTips.Tips - case constant.MemberInvitedNotification: // - tips.DefaultTips = toNickname + " " + cn.MemberInvited.DefaultTips.Tips - case constant.MemberEnterNotification: - tips.DefaultTips = toNickname + " " + cn.MemberEnter.DefaultTips.Tips - case constant.GroupDismissedNotification: - tips.DefaultTips = toNickname + "" + cn.GroupDismissed.DefaultTips.Tips - case constant.GroupMutedNotification: - tips.DefaultTips = toNickname + "" + cn.GroupMuted.DefaultTips.Tips - case constant.GroupCancelMutedNotification: - tips.DefaultTips = toNickname + "" + cn.GroupCancelMuted.DefaultTips.Tips - case constant.GroupMemberMutedNotification: - tips.DefaultTips = toNickname + "" + cn.GroupMemberMuted.DefaultTips.Tips - case constant.GroupMemberCancelMutedNotification: - tips.DefaultTips = toNickname + "" + cn.GroupMemberCancelMuted.DefaultTips.Tips - case constant.GroupMemberInfoSetNotification: - tips.DefaultTips = toNickname + "" + cn.GroupMemberInfoSet.DefaultTips.Tips - case constant.GroupMemberSetToAdminNotification: - tips.DefaultTips = toNickname + "" + cn.GroupMemberSetToAdmin.DefaultTips.Tips - case constant.GroupMemberSetToOrdinaryUserNotification: - tips.DefaultTips = toNickname + "" + cn.GroupMemberSetToOrdinary.DefaultTips.Tips - default: - log.Error(operationID, "contentType failed ", contentType) - return - } - - var n NotificationMsg - n.SendID = sendID - if groupID != "" { - n.RecvID = groupID - group, err := imdb.GetGroupInfoByGroupID(groupID) - if err != nil { - log.NewError(operationID, "GetGroupInfoByGroupID failed ", err.Error(), groupID) - } - switch group.GroupType { - case constant.NormalGroup: - n.SessionType = constant.GroupChatType - default: - n.SessionType = constant.SuperGroupChatType - } - } else { - n.RecvID = recvUserID - n.SessionType = constant.SingleChatType - } - n.ContentType = contentType - n.OperationID = operationID - n.Content, err = proto.Marshal(&tips) - if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), tips.String()) - return - } - Notification(&n) -} - -// 创建群后调用 -func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberList []string) { - GroupCreatedTips := sdkws.GroupCreatedTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}, GroupOwnerUser: &sdkws.GroupMemberFullInfo{}} - if err := setOpUserInfo(opUserID, groupID, GroupCreatedTips.OpUser); err != nil { - log.NewError(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID, GroupCreatedTips.OpUser) - return - } - err := setGroupInfo(groupID, GroupCreatedTips.Group) - if err != nil { - log.Error(operationID, "setGroupInfo failed ", groupID, GroupCreatedTips.Group) - return - } - imdb.GetGroupOwnerInfoByGroupID(groupID) - if err := setGroupOwnerInfo(groupID, GroupCreatedTips.GroupOwnerUser); err != nil { - log.Error(operationID, "setGroupOwnerInfo failed", err.Error(), groupID) - return - } - for _, v := range initMemberList { - var groupMemberInfo sdkws.GroupMemberFullInfo - if err := setGroupMemberInfo(groupID, v, &groupMemberInfo); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, v) - continue - } - GroupCreatedTips.MemberList = append(GroupCreatedTips.MemberList, &groupMemberInfo) - if len(GroupCreatedTips.MemberList) == constant.MaxNotificationNum { - break - } - } - groupNotification(constant.GroupCreatedNotification, &GroupCreatedTips, opUserID, groupID, "", operationID) -} - -// 群信息改变后掉用 -// groupName := "" -// -// notification := "" -// introduction := "" -// faceURL := "" -func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName, notification, introduction, faceURL string, needVerification *wrapperspb.Int32Value) { - GroupInfoChangedTips := sdkws.GroupInfoSetTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - GroupInfoChangedTips.Group.GroupName = groupName - GroupInfoChangedTips.Group.Notification = notification - GroupInfoChangedTips.Group.Introduction = introduction - GroupInfoChangedTips.Group.FaceURL = faceURL - if needVerification != nil { - GroupInfoChangedTips.Group.NeedVerification = needVerification.Value - } - - if err := setOpUserInfo(opUserID, groupID, GroupInfoChangedTips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - groupNotification(constant.GroupInfoSetNotification, &GroupInfoChangedTips, opUserID, groupID, "", operationID) -} - -func GroupMutedNotification(operationID, opUserID, groupID string) { - tips := sdkws.GroupMutedTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, tips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - groupNotification(constant.GroupMutedNotification, &tips, opUserID, groupID, "", operationID) -} - -func GroupCancelMutedNotification(operationID, opUserID, groupID string) { - tips := sdkws.GroupCancelMutedTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, tips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - groupNotification(constant.GroupCancelMutedNotification, &tips, opUserID, groupID, "", operationID) -} - -func GroupMemberMutedNotification(operationID, opUserID, groupID, groupMemberUserID string, mutedSeconds uint32) { - tips := sdkws.GroupMemberMutedTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}, MutedUser: &sdkws.GroupMemberFullInfo{}} - tips.MutedSeconds = mutedSeconds - if err := setGroupInfo(groupID, tips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.MutedUser); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) - return - } - groupNotification(constant.GroupMemberMutedNotification, &tips, opUserID, groupID, "", operationID) -} - -func GroupMemberInfoSetNotification(operationID, opUserID, groupID, groupMemberUserID string) { - tips := sdkws.GroupMemberInfoSetTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}, ChangedUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, tips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.ChangedUser); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) - return - } - groupNotification(constant.GroupMemberInfoSetNotification, &tips, opUserID, groupID, "", operationID) -} - -func GroupMemberRoleLevelChangeNotification(operationID, opUserID, groupID, groupMemberUserID string, notificationType int32) { - if notificationType != constant.GroupMemberSetToAdminNotification && notificationType != constant.GroupMemberSetToOrdinaryUserNotification { - log.NewError(operationID, utils.GetSelfFuncName(), "invalid notificationType: ", notificationType) - return - } - tips := sdkws.GroupMemberInfoSetTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}, ChangedUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, tips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.ChangedUser); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) - return - } - groupNotification(notificationType, &tips, opUserID, groupID, "", operationID) -} - -func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMemberUserID string) { - tips := sdkws.GroupMemberCancelMutedTips{Group: &sdkws.GroupInfo{}, - OpUser: &sdkws.GroupMemberFullInfo{}, MutedUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, tips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.MutedUser); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) - return - } - groupNotification(constant.GroupMemberCancelMutedNotification, &tips, opUserID, groupID, "", operationID) -} - -// message ReceiveJoinApplicationTips{ -// GroupInfo Group = 1; -// PublicUserInfo Applicant = 2; -// string Reason = 3; -// } apply->all managers GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` -// -// ReqMessage string `protobuf:"bytes,2,opt,name=ReqMessage" json:"ReqMessage,omitempty"` -// OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,omitempty"` -// OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` -// -// 申请进群后调用 -func JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) { - JoinGroupApplicationTips := sdkws.JoinGroupApplicationTips{Group: &sdkws.GroupInfo{}, Applicant: &sdkws.PublicUserInfo{}} - err := setGroupInfo(req.GroupID, JoinGroupApplicationTips.Group) - if err != nil { - log.Error(utils.OperationID(ctx), "setGroupInfo failed ", err.Error(), req.GroupID) - return - } - if err = setPublicUserInfo(utils.OpUserID(ctx), JoinGroupApplicationTips.Applicant); err != nil { - log.Error(utils.OperationID(ctx), "setPublicUserInfo failed ", err.Error(), utils.OpUserID(ctx)) - return - } - JoinGroupApplicationTips.ReqMsg = req.ReqMessage - - managerList, err := imdb.GetOwnerManagerByGroupID(req.GroupID) - if err != nil { - log.NewError(utils.OperationID(ctx), "GetOwnerManagerByGroupId failed ", err.Error(), req.GroupID) - return - } - for _, v := range managerList { - groupNotification(constant.JoinGroupApplicationNotification, &JoinGroupApplicationTips, utils.OpUserID(ctx), "", v.UserID, utils.OperationID(ctx)) - log.NewInfo(utils.OperationID(ctx), "Notification ", v) - } -} - -func MemberQuitNotification(req *pbGroup.QuitGroupReq) { - MemberQuitTips := sdkws.MemberQuitTips{Group: &sdkws.GroupInfo{}, QuitUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(req.GroupID, MemberQuitTips.Group); err != nil { - log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) - return - } - if err := setOpUserInfo(req.OpUserID, req.GroupID, MemberQuitTips.QuitUser); err != nil { - log.Error(req.OperationID, "setOpUserInfo failed ", err.Error(), req.OpUserID, req.GroupID) - return - } - - groupNotification(constant.MemberQuitNotification, &MemberQuitTips, req.OpUserID, req.GroupID, "", req.OperationID) -} - -// message ApplicationProcessedTips{ -// GroupInfo Group = 1; -// GroupMemberFullInfo OpUser = 2; -// int32 Result = 3; -// string Reason = 4; -// } -// -// 处理进群请求后调用 -func GroupApplicationAcceptedNotification(req *pbGroup.GroupApplicationResponseReq) { - GroupApplicationAcceptedTips := sdkws.GroupApplicationAcceptedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg} - if err := setGroupInfo(req.GroupID, GroupApplicationAcceptedTips.Group); err != nil { - log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, GroupApplicationAcceptedTips.Group) - return - } - if err := setOpUserInfo(req.OpUserID, req.GroupID, GroupApplicationAcceptedTips.OpUser); err != nil { - log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID, GroupApplicationAcceptedTips.OpUser) - return - } - - groupNotification(constant.GroupApplicationAcceptedNotification, &GroupApplicationAcceptedTips, req.OpUserID, "", req.FromUserID, req.OperationID) - adminList, err := imdb.GetOwnerManagerByGroupID(req.GroupID) - if err != nil { - log.Error(req.OperationID, "GetOwnerManagerByGroupID failed", req.GroupID) - return - } - for _, v := range adminList { - if v.UserID == req.OpUserID { - continue - } - GroupApplicationAcceptedTips.ReceiverAs = 1 - groupNotification(constant.GroupApplicationAcceptedNotification, &GroupApplicationAcceptedTips, req.OpUserID, "", v.UserID, req.OperationID) - } -} - -func GroupApplicationRejectedNotification(req *pbGroup.GroupApplicationResponseReq) { - GroupApplicationRejectedTips := sdkws.GroupApplicationRejectedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg} - if err := setGroupInfo(req.GroupID, GroupApplicationRejectedTips.Group); err != nil { - log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, GroupApplicationRejectedTips.Group) - return - } - if err := setOpUserInfo(req.OpUserID, req.GroupID, GroupApplicationRejectedTips.OpUser); err != nil { - log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID, GroupApplicationRejectedTips.OpUser) - return - } - groupNotification(constant.GroupApplicationRejectedNotification, &GroupApplicationRejectedTips, req.OpUserID, "", req.FromUserID, req.OperationID) - adminList, err := imdb.GetOwnerManagerByGroupID(req.GroupID) - if err != nil { - log.Error(req.OperationID, "GetOwnerManagerByGroupID failed", req.GroupID) - return - } - for _, v := range adminList { - if v.UserID == req.OpUserID { - continue - } - GroupApplicationRejectedTips.ReceiverAs = 1 - groupNotification(constant.GroupApplicationRejectedNotification, &GroupApplicationRejectedTips, req.OpUserID, "", v.UserID, req.OperationID) - } -} - -func GroupOwnerTransferredNotification(req *pbGroup.TransferGroupOwnerReq) { - GroupOwnerTransferredTips := sdkws.GroupOwnerTransferredTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, NewGroupOwner: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(req.GroupID, GroupOwnerTransferredTips.Group); err != nil { - log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) - return - } - if err := setOpUserInfo(req.OpUserID, req.GroupID, GroupOwnerTransferredTips.OpUser); err != nil { - log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID) - return - } - if err := setGroupMemberInfo(req.GroupID, req.NewOwnerUserID, GroupOwnerTransferredTips.NewGroupOwner); err != nil { - log.Error(req.OperationID, "setGroupMemberInfo failed", req.GroupID, req.NewOwnerUserID) - return - } - groupNotification(constant.GroupOwnerTransferredNotification, &GroupOwnerTransferredTips, req.OpUserID, req.GroupID, "", req.OperationID) -} - -func GroupDismissedNotification(req *pbGroup.DismissGroupReq) { - tips := sdkws.GroupDismissedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(req.GroupID, tips.Group); err != nil { - log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) - return - } - if err := setOpUserInfo(req.OpUserID, req.GroupID, tips.OpUser); err != nil { - log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID) - return - } - groupNotification(constant.GroupDismissedNotification, &tips, req.OpUserID, req.GroupID, "", req.OperationID) -} - -// message MemberKickedTips{ -// GroupInfo Group = 1; -// GroupMemberFullInfo OpUser = 2; -// GroupMemberFullInfo KickedUser = 3; -// uint64 OperationTime = 4; -// } -// -// 被踢后调用 -func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList []string) { - MemberKickedTips := sdkws.MemberKickedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(req.GroupID, MemberKickedTips.Group); err != nil { - log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) - return - } - if err := setOpUserInfo(req.OpUserID, req.GroupID, MemberKickedTips.OpUser); err != nil { - log.Error(req.OperationID, "setOpUserInfo failed ", err.Error(), req.OpUserID) - return - } - for _, v := range kickedUserIDList { - var groupMemberInfo sdkws.GroupMemberFullInfo - if err := setGroupMemberInfo(req.GroupID, v, &groupMemberInfo); err != nil { - log.Error(req.OperationID, "setGroupMemberInfo failed ", err.Error(), req.GroupID, v) - continue - } - MemberKickedTips.KickedUserList = append(MemberKickedTips.KickedUserList, &groupMemberInfo) - } - groupNotification(constant.MemberKickedNotification, &MemberKickedTips, req.OpUserID, req.GroupID, "", req.OperationID) - // - //for _, v := range kickedUserIDList { - // groupNotification(constant.MemberKickedNotification, &MemberKickedTips, req.OpUserID, "", v, req.OperationID) - //} -} - -// message MemberInvitedTips{ -// GroupInfo Group = 1; -// GroupMemberFullInfo OpUser = 2; -// GroupMemberFullInfo InvitedUser = 3; -// uint64 OperationTime = 4; -// } -// -// 被邀请进群后调用 -func MemberInvitedNotification(operationID, groupID, opUserID, reason string, invitedUserIDList []string) { - MemberInvitedTips := sdkws.MemberInvitedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, MemberInvitedTips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) - return - } - if err := setOpUserInfo(opUserID, groupID, MemberInvitedTips.OpUser); err != nil { - log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) - return - } - for _, v := range invitedUserIDList { - var groupMemberInfo sdkws.GroupMemberFullInfo - if err := setGroupMemberInfo(groupID, v, &groupMemberInfo); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID) - continue - } - MemberInvitedTips.InvitedUserList = append(MemberInvitedTips.InvitedUserList, &groupMemberInfo) - } - groupNotification(constant.MemberInvitedNotification, &MemberInvitedTips, opUserID, groupID, "", operationID) -} - -//message GroupInfoChangedTips{ -// int32 ChangedType = 1; //bitwise operators: 1:groupName; 10:Notification 100:Introduction; 1000:FaceUrl -// GroupInfo Group = 2; -// GroupMemberFullInfo OpUser = 3; -//} - -//message MemberLeaveTips{ -// GroupInfo Group = 1; -// GroupMemberFullInfo LeaverUser = 2; -// uint64 OperationTime = 3; -//} - -//群成员退群后调用 - -// message MemberEnterTips{ -// GroupInfo Group = 1; -// GroupMemberFullInfo EntrantUser = 2; -// uint64 OperationTime = 3; -// } -// -// 群成员主动申请进群,管理员同意后调用, -func MemberEnterNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) { - MemberEnterTips := sdkws.MemberEnterTips{Group: &sdkws.GroupInfo{}, EntrantUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(req.GroupID, MemberEnterTips.Group); err != nil { - log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, MemberEnterTips.Group) - return - } - if err := setGroupMemberInfo(req.GroupID, req.FromUserID, MemberEnterTips.EntrantUser); err != nil { - log.Error(req.OperationID, "setGroupMemberInfo failed ", err.Error(), req.OpUserID, req.GroupID, MemberEnterTips.EntrantUser) - return - } - groupNotification(constant.MemberEnterNotification, &MemberEnterTips, req.OpUserID, req.GroupID, "", req.OperationID) -} - -func MemberEnterDirectlyNotification(groupID string, entrantUserID string, operationID string) { - MemberEnterTips := sdkws.MemberEnterTips{Group: &sdkws.GroupInfo{}, EntrantUser: &sdkws.GroupMemberFullInfo{}} - if err := setGroupInfo(groupID, MemberEnterTips.Group); err != nil { - log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID, MemberEnterTips.Group) - return - } - if err := setGroupMemberInfo(groupID, entrantUserID, MemberEnterTips.EntrantUser); err != nil { - log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, entrantUserID, MemberEnterTips.EntrantUser) - return - } - groupNotification(constant.MemberEnterNotification, &MemberEnterTips, entrantUserID, groupID, "", operationID) -} diff --git a/internal/rpc/msg/msg_notification.go b/internal/rpc/msg/msg_notification.go deleted file mode 100644 index a17eaecaa..000000000 --- a/internal/rpc/msg/msg_notification.go +++ /dev/null @@ -1,47 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - sdkws "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" -) - -func DeleteMessageNotification(opUserID, userID string, seqList []uint32, operationID string) { - DeleteMessageTips := sdkws.DeleteMessageTips{OpUserID: opUserID, UserID: userID, SeqList: seqList} - MessageNotification(operationID, userID, userID, constant.DeleteMessageNotification, &DeleteMessageTips) -} - -func MessageNotification(operationID, sendID, recvID string, contentType int32, m proto.Message) { - log.Debug(operationID, utils.GetSelfFuncName(), "args: ", m.String(), contentType) - var err error - var tips sdkws.TipsComm - tips.Detail, err = proto.Marshal(m) - if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), m.String()) - return - } - - marshaler := jsonpb.Marshaler{ - OrigName: true, - EnumsAsInts: false, - EmitDefaults: false, - } - - tips.JsonDetail, _ = marshaler.MarshalToString(m) - var n NotificationMsg - n.SendID = sendID - n.RecvID = recvID - n.ContentType = contentType - n.SessionType = constant.SingleChatType - n.MsgFrom = constant.SysMsgType - n.OperationID = operationID - n.Content, err = proto.Marshal(&tips) - if err != nil { - log.Error(operationID, "Marshal failed ", err.Error(), tips.String()) - return - } - Notification(&n) -} diff --git a/internal/rpc/msg/msg_status.go b/internal/rpc/msg/msg_status.go index 698e98a3d..b3a469f37 100644 --- a/internal/rpc/msg/msg_status.go +++ b/internal/rpc/msg/msg_status.go @@ -2,45 +2,28 @@ package msg import ( "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" + "Open_IM/pkg/common/tracelog" pbMsg "Open_IM/pkg/proto/msg" - "Open_IM/pkg/utils" "context" - - goRedis "github.com/go-redis/redis/v8" ) -func (rpc *rpcChat) SetSendMsgStatus(_ context.Context, req *pbMsg.SetSendMsgStatusReq) (resp *pbMsg.SetSendMsgStatusResp, err error) { - resp = &pbMsg.SetSendMsgStatusResp{} - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String()) - if err := db.DB.SetSendMsgStatus(req.Status, req.OperationID); err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) - resp.ErrCode = constant.ErrDatabase.ErrCode - resp.ErrMsg = err.Error() - return resp, nil +func (m *msgServer) SetSendMsgStatus(ctx context.Context, req *pbMsg.SetSendMsgStatusReq) (*pbMsg.SetSendMsgStatusResp, error) { + resp := &pbMsg.SetSendMsgStatusResp{} + if err := m.MsgInterface.SetSendMsgStatus(ctx, tracelog.GetOperationID(ctx), req.Status); err != nil { + return nil, err } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp.String()) return resp, nil } -func (rpc *rpcChat) GetSendMsgStatus(_ context.Context, req *pbMsg.GetSendMsgStatusReq) (resp *pbMsg.GetSendMsgStatusResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String()) - resp = &pbMsg.GetSendMsgStatusResp{} - status, err := db.DB.GetSendMsgStatus(req.OperationID) - if err != nil { +func (m *msgServer) GetSendMsgStatus(ctx context.Context, req *pbMsg.GetSendMsgStatusReq) (*pbMsg.GetSendMsgStatusResp, error) { + resp := &pbMsg.GetSendMsgStatusResp{} + status, err := m.MsgInterface.GetSendMsgStatus(ctx, tracelog.GetOperationID(ctx)) + if IsNotFound(err) { resp.Status = constant.MsgStatusNotExist - if err == goRedis.Nil { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.OperationID, "not exist") - return resp, nil - } else { - log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) - resp.ErrMsg = err.Error() - resp.ErrCode = constant.ErrDB.ErrCode - return resp, nil - } + return resp, nil + } else if err != nil { + return nil, err } - resp.Status = int32(status) - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp.String()) + resp.Status = status return resp, nil } diff --git a/internal/rpc/msg/notification.go b/internal/rpc/msg/notification.go new file mode 100644 index 000000000..439c2e3b2 --- /dev/null +++ b/internal/rpc/msg/notification.go @@ -0,0 +1,7 @@ +package msg + +import "context" + +func DeleteMessageNotification(ctx context.Context, userID string, seqs []uint32) { + panic("todo") +} diff --git a/internal/rpc/msg/pull_message.go b/internal/rpc/msg/pull_message.go deleted file mode 100644 index 9de78e2ca..000000000 --- a/internal/rpc/msg/pull_message.go +++ /dev/null @@ -1,126 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/utils" - "context" - go_redis "github.com/go-redis/redis/v8" - - commonDB "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - sdkws "Open_IM/pkg/proto/sdkws" - - prome "Open_IM/pkg/common/prometheus" -) - -func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *sdkws.GetMaxAndMinSeqReq) (*sdkws.GetMaxAndMinSeqResp, error) { - log.NewInfo(in.OperationID, "rpc getMaxAndMinSeq is arriving", in.String()) - resp := new(sdkws.GetMaxAndMinSeqResp) - m := make(map[string]*sdkws.MaxAndMinSeq) - var maxSeq, minSeq uint64 - var err1, err2 error - maxSeq, err1 = commonDB.DB.GetUserMaxSeq(in.UserID) - minSeq, err2 = commonDB.DB.GetUserMinSeq(in.UserID) - if (err1 != nil && err1 != go_redis.Nil) || (err2 != nil && err2 != go_redis.Nil) { - log.NewError(in.OperationID, "getMaxSeq from redis error", in.String()) - if err1 != nil { - log.NewError(in.OperationID, utils.GetSelfFuncName(), err1.Error()) - } - if err2 != nil { - log.NewError(in.OperationID, utils.GetSelfFuncName(), err2.Error()) - } - resp.ErrCode = 200 - resp.ErrMsg = "redis get err" - return resp, nil - } - resp.MaxSeq = uint32(maxSeq) - resp.MinSeq = uint32(minSeq) - for _, groupID := range in.GroupIDList { - x := new(sdkws.MaxAndMinSeq) - maxSeq, _ := commonDB.DB.GetGroupMaxSeq(groupID) - minSeq, _ := commonDB.DB.GetGroupUserMinSeq(groupID, in.UserID) - x.MaxSeq = uint32(maxSeq) - x.MinSeq = uint32(minSeq) - m[groupID] = x - } - resp.GroupMaxAndMinSeq = m - return resp, nil -} - -func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) { - log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String()) - resp := new(sdkws.PullMessageBySeqListResp) - m := make(map[string]*sdkws.MsgDataList) - redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(in.UserID, in.SeqList, in.OperationID) - if err != nil { - if err != go_redis.Nil { - prome.PromeAdd(prome.MsgPullFromRedisFailedCounter, len(failedSeqList)) - log.Error(in.OperationID, "get message from redis exception", err.Error(), failedSeqList) - } else { - log.Debug(in.OperationID, "get message from redis is nil", failedSeqList) - } - msgList, err1 := commonDB.DB.GetMsgBySeqs(in.UserID, failedSeqList, in.OperationID) - if err1 != nil { - prome.PromeAdd(prome.MsgPullFromMongoFailedCounter, len(failedSeqList)) - log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err1.Error()) - resp.ErrCode = 201 - resp.ErrMsg = err1.Error() - return resp, nil - } else { - prome.PromeAdd(prome.MsgPullFromMongoSuccessCounter, len(msgList)) - redisMsgList = append(redisMsgList, msgList...) - resp.List = redisMsgList - } - } else { - prome.PromeAdd(prome.MsgPullFromRedisSuccessCounter, len(redisMsgList)) - resp.List = redisMsgList - } - - for k, v := range in.GroupSeqList { - x := new(sdkws.MsgDataList) - redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(k, v.SeqList, in.OperationID) - if err != nil { - if err != go_redis.Nil { - prome.PromeAdd(prome.MsgPullFromRedisFailedCounter, len(failedSeqList)) - log.Error(in.OperationID, "get message from redis exception", err.Error(), failedSeqList) - } else { - log.Debug(in.OperationID, "get message from redis is nil", failedSeqList) - } - msgList, err1 := commonDB.DB.GetSuperGroupMsgBySeqs(k, failedSeqList, in.OperationID) - if err1 != nil { - prome.PromeAdd(prome.MsgPullFromMongoFailedCounter, len(failedSeqList)) - log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err1.Error()) - resp.ErrCode = 201 - resp.ErrMsg = err1.Error() - return resp, nil - } else { - prome.PromeAdd(prome.MsgPullFromMongoSuccessCounter, len(msgList)) - redisMsgList = append(redisMsgList, msgList...) - x.MsgDataList = redisMsgList - m[k] = x - } - } else { - prome.PromeAdd(prome.MsgPullFromRedisSuccessCounter, len(redisMsgList)) - x.MsgDataList = redisMsgList - m[k] = x - } - } - resp.GroupMsgDataList = m - return resp, nil -} - -type MsgFormats []*sdkws.MsgData - -// Implement the sort.Interface interface to get the number of elements method -func (s MsgFormats) Len() int { - return len(s) -} - -//Implement the sort.Interface interface comparison element method -func (s MsgFormats) Less(i, j int) bool { - return s[i].SendTime < s[j].SendTime -} - -//Implement the sort.Interface interface exchange element method -func (s MsgFormats) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} diff --git a/internal/rpc/msg/query_msg.go b/internal/rpc/msg/query_msg.go deleted file mode 100644 index 3c8d3ef50..000000000 --- a/internal/rpc/msg/query_msg.go +++ /dev/null @@ -1,51 +0,0 @@ -package msg - -import ( - commonDB "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - prome "Open_IM/pkg/common/prometheus" - "Open_IM/pkg/proto/msg" - "Open_IM/pkg/utils" - "context" - go_redis "github.com/go-redis/redis/v8" -) - -func (rpc *rpcChat) GetSuperGroupMsg(context context.Context, req *msg.GetSuperGroupMsgReq) (*msg.GetSuperGroupMsgResp, error) { - log.Debug(req.OperationID, utils.GetSelfFuncName(), req.String()) - resp := new(msg.GetSuperGroupMsgResp) - redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(req.GroupID, []uint32{req.Seq}, req.OperationID) - if err != nil { - if err != go_redis.Nil { - prome.PromeAdd(prome.MsgPullFromRedisFailedCounter, len(failedSeqList)) - log.Error(req.OperationID, "get message from redis exception", err.Error(), failedSeqList) - } else { - log.Debug(req.OperationID, "get message from redis is nil", failedSeqList) - } - msgList, err1 := commonDB.DB.GetSuperGroupMsgBySeqs(req.GroupID, failedSeqList, req.OperationID) - if err1 != nil { - prome.PromeAdd(prome.MsgPullFromMongoFailedCounter, len(failedSeqList)) - log.Error(req.OperationID, "GetSuperGroupMsg data error", req.String(), err.Error()) - resp.ErrCode = 201 - resp.ErrMsg = err.Error() - return resp, nil - } else { - prome.PromeAdd(prome.MsgPullFromMongoSuccessCounter, len(msgList)) - redisMsgList = append(redisMsgList, msgList...) - for _, m := range msgList { - resp.MsgData = m - } - - } - } else { - prome.PromeAdd(prome.MsgPullFromRedisSuccessCounter, len(redisMsgList)) - for _, m := range redisMsgList { - resp.MsgData = m - } - } - log.Debug(req.OperationID, utils.GetSelfFuncName(), resp.String()) - return resp, nil -} - -func (rpc *rpcChat) GetWriteDiffMsg(context context.Context, req *msg.GetWriteDiffMsgReq) (*msg.GetWriteDiffMsgResp, error) { - panic("implement me") -} diff --git a/internal/rpc/msg/rpc_chat.go b/internal/rpc/msg/rpc_chat.go deleted file mode 100644 index dec4db5cc..000000000 --- a/internal/rpc/msg/rpc_chat.go +++ /dev/null @@ -1,159 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/kafka" - "Open_IM/pkg/common/log" - prome "Open_IM/pkg/common/prometheus" - "Open_IM/pkg/proto/msg" - "Open_IM/pkg/utils" - "github.com/OpenIMSDK/getcdv3" - "net" - "strconv" - "strings" - - "github.com/golang/protobuf/proto" - - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - - "google.golang.org/grpc" -) - -type MessageWriter interface { - SendMessage(m proto.Message, key string, operationID string) (int32, int64, error) -} -type rpcChat struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string - messageWriter MessageWriter - //offlineProducer *kafka.Producer - delMsgCh chan deleteMsg - dMessageLocker MessageLocker -} - -type deleteMsg struct { - UserID string - OpUserID string - SeqList []uint32 - OperationID string -} - -func NewRpcChatServer(port int) *rpcChat { - log.NewPrivateLog(constant.LogFileName) - rc := rpcChat{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImMsgName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - dMessageLocker: NewLockerMessage(), - } - rc.messageWriter = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic) - //rc.offlineProducer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschatOffline.Addr, config.Config.Kafka.Ws2mschatOffline.Topic) - rc.delMsgCh = make(chan deleteMsg, 1000) - return &rc -} - -func (rpc *rpcChat) initPrometheus() { - //sendMsgSuccessCounter = promauto.NewCounter(prometheus.CounterOpts{ - // Name: "send_msg_success", - // Help: "The number of send msg success", - //}) - //sendMsgFailedCounter = promauto.NewCounter(prometheus.CounterOpts{ - // Name: "send_msg_failed", - // Help: "The number of send msg failed", - //}) - prome.NewMsgPullFromRedisSuccessCounter() - prome.NewMsgPullFromRedisFailedCounter() - prome.NewMsgPullFromMongoSuccessCounter() - prome.NewMsgPullFromMongoFailedCounter() - - prome.NewSingleChatMsgRecvSuccessCounter() - prome.NewGroupChatMsgRecvSuccessCounter() - prome.NewWorkSuperGroupChatMsgRecvSuccessCounter() - - prome.NewSingleChatMsgProcessSuccessCounter() - prome.NewSingleChatMsgProcessFailedCounter() - prome.NewGroupChatMsgProcessSuccessCounter() - prome.NewGroupChatMsgProcessFailedCounter() - prome.NewWorkSuperGroupChatMsgProcessSuccessCounter() - prome.NewWorkSuperGroupChatMsgProcessFailedCounter() -} - -func (rpc *rpcChat) Run() { - log.Info("", "rpcChat init...") - listenIP := "" - if config.Config.ListenIP == "" { - listenIP = "0.0.0.0" - } else { - listenIP = config.Config.ListenIP - } - address := listenIP + ":" + strconv.Itoa(rpc.rpcPort) - listener, err := net.Listen("tcp", address) - if err != nil { - panic("listening err:" + err.Error() + rpc.rpcRegisterName) - } - log.Info("", "listen network success, address ", address) - recvSize := 1024 * 1024 * 30 - sendSize := 1024 * 1024 * 30 - var grpcOpts = []grpc.ServerOption{ - grpc.MaxRecvMsgSize(recvSize), - grpc.MaxSendMsgSize(sendSize), - } - if config.Config.Prometheus.Enable { - prome.NewGrpcRequestCounter() - prome.NewGrpcRequestFailedCounter() - prome.NewGrpcRequestSuccessCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(prome.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - - rpcRegisterIP := config.Config.RpcRegisterIP - msg.RegisterMsgServer(srv, rpc) - if config.Config.RpcRegisterIP == "" { - rpcRegisterIP, err = utils.GetLocalIP() - if err != nil { - log.Error("", "GetLocalIP failed ", err.Error()) - } - } - err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), rpcRegisterIP, rpc.rpcPort, rpc.rpcRegisterName, 10, "") - if err != nil { - log.Error("", "register rpcChat to etcd failed ", err.Error()) - panic(utils.Wrap(err, "register chat module rpc to etcd err")) - } - go rpc.runCh() - rpc.initPrometheus() - err = srv.Serve(listener) - if err != nil { - log.Error("", "rpc rpcChat failed ", err.Error()) - return - } - log.Info("", "rpc rpcChat init success") -} - -func (rpc *rpcChat) runCh() { - log.NewInfo("", "start del msg chan ") - for { - select { - case msg := <-rpc.delMsgCh: - log.NewInfo(msg.OperationID, utils.GetSelfFuncName(), "delmsgch recv new: ", msg) - db.DB.DelMsgFromCache(msg.UserID, msg.SeqList, msg.OperationID) - unexistSeqList, err := db.DB.DelMsgBySeqs(msg.UserID, msg.SeqList, msg.OperationID) - if err != nil { - log.NewError(msg.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqs args: ", msg.UserID, msg.SeqList, msg.OperationID, err.Error()) - continue - } - if len(unexistSeqList) > 0 { - DeleteMessageNotification(msg.OpUserID, msg.UserID, unexistSeqList, msg.OperationID) - } - } - } -} diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 92d556a25..150da4ae1 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -3,46 +3,25 @@ package msg import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - rocksCache "Open_IM/pkg/common/db/rocks_cache" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" - cacheRpc "Open_IM/pkg/proto/cache" - pbConversation "Open_IM/pkg/proto/conversation" - pbChat "Open_IM/pkg/proto/msg" - pbPush "Open_IM/pkg/proto/push" - pbRelay "Open_IM/pkg/proto/relay" - sdkws "Open_IM/pkg/proto/sdkws" + "Open_IM/pkg/common/tracelog" + "Open_IM/pkg/proto/msg" + "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" "context" - "errors" "math/rand" "strconv" - "strings" "sync" "time" - - prome "Open_IM/pkg/common/prometheus" - go_redis "github.com/go-redis/redis/v8" - "github.com/golang/protobuf/proto" ) -//When the number of group members is greater than this value,Online users will be sent first,Guaranteed service availability -const GroupMemberNum = 500 - var ( ExcludeContentType = []int{constant.HasReadReceipt, constant.GroupHasReadReceipt} ) type Validator interface { - validate(pb *pbChat.SendMsgReq) (bool, int32, string) + validate(pb *msg.SendMsgReq) (bool, int32, string) } -//type MessageValidator struct { -// -//} - type MessageRevoked struct { RevokerID string `json:"revokerID"` RevokerRole int32 `json:"revokerRole"` @@ -77,223 +56,172 @@ type MsgCallBackResp struct { } } -func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) { - switch pb.MsgData.ContentType { - case constant.HasReadReceipt: - if config.Config.SingleMessageHasReadReceiptEnable { - return true, 0, "" - } else { - return false, constant.ErrMessageHasReadDisable.ErrCode, constant.ErrMessageHasReadDisable.ErrMsg - } - case constant.GroupHasReadReceipt: - if config.Config.GroupMessageHasReadReceiptEnable { - return true, 0, "" - } else { - return false, constant.ErrMessageHasReadDisable.ErrCode, constant.ErrMessageHasReadDisable.ErrMsg - } - } - return true, 0, "" -} - -func userIsMuteAndIsAdminInGroup(ctx context.Context, groupID, userID string) (isMute bool, isAdmin bool, err error) { - groupMemberInfo, err := rocksCache.GetGroupMemberInfoFromCache(ctx, groupID, userID) +func (m *msgServer) userIsMuteAndIsAdminInGroup(ctx context.Context, groupID, userID string) (isMute bool, err error) { + groupMemberInfo, err := m.Group.GetGroupMemberInfo(ctx, groupID, userID) if err != nil { - return false, false, utils.Wrap(err, "") + return false, err } - - if groupMemberInfo.MuteEndTime.Unix() >= time.Now().Unix() { - return true, groupMemberInfo.RoleLevel > constant.GroupOrdinaryUsers, nil - } - return false, groupMemberInfo.RoleLevel > constant.GroupOrdinaryUsers, nil -} - -func groupIsMuted(ctx context.Context, groupID string) (bool, error) { - groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, groupID) - if err != nil { - return false, utils.Wrap(err, "GetGroupInfoFromCache failed") - } - if groupInfo.Status == constant.GroupStatusMuted { + if groupMemberInfo.MuteEndTime >= time.Now().Unix() { return true, nil } return false, nil } -func (rpc *rpcChat) messageVerification(ctx context.Context, data *pbChat.SendMsgReq) (bool, int32, string, []string) { +// 如果禁言了,再看下是否群管理员 +func (m *msgServer) groupIsMuted(ctx context.Context, groupID string, userID string) (bool, bool, error) { + groupInfo, err := m.Group.GetGroupInfo(ctx, groupID) + if err != nil { + return false, false, err + } + + if groupInfo.Status == constant.GroupStatusMuted { + groupMemberInfo, err := m.Group.GetGroupMemberInfo(ctx, groupID, userID) + if err != nil { + return false, false, err + } + return true, groupMemberInfo.RoleLevel > constant.GroupOrdinaryUsers, nil + } + return false, false, nil +} + +func (m *msgServer) GetGroupMemberIDs(ctx context.Context, groupID string) (groupMemberIDs []string, err error) { + return m.GroupLocalCache.GetGroupMemberIDs(ctx, groupID) +} + +func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgReq) ([]string, error) { switch data.MsgData.SessionType { case constant.SingleChatType: if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) { - return true, 0, "", nil + return nil, nil } if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin { - return true, 0, "", nil + return nil, nil } - log.NewDebug(data.OperationID, *config.Config.MessageVerify.FriendVerify) - reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} - etcdConn, err := rpc.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImCacheName) + black, err := m.black.IsBlocked(ctx, data.MsgData.SendID, data.MsgData.RecvID) if err != nil { - errMsg := data.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(data.OperationID, errMsg) - return true, 0, "", nil + return nil, err } - - cacheClient := cacheRpc.NewCacheClient(etcdConn) - cacheResp, err := cacheClient.GetBlackIDListFromCache(context.Background(), reqGetBlackIDListFromCache) - if err != nil { - log.NewError(data.OperationID, "GetBlackIDListFromCache rpc call failed ", err.Error()) - } else { - if cacheResp.CommonResp.ErrCode != 0 { - log.NewError(data.OperationID, "GetBlackIDListFromCache rpc logic call failed ", cacheResp.String()) - } else { - if utils.IsContain(data.MsgData.SendID, cacheResp.UserIDList) { - return false, 600, "in black list", nil - } - } + if black { + return nil, constant.ErrBlockedByPeer.Wrap() } - log.NewDebug(data.OperationID, *config.Config.MessageVerify.FriendVerify) if *config.Config.MessageVerify.FriendVerify { - reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} - etcdConn, err := rpc.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImCacheName) + friend, err := m.friend.IsFriend(ctx, data.MsgData.SendID, data.MsgData.RecvID) if err != nil { - errMsg := data.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(data.OperationID, errMsg) - return true, 0, "", nil + return nil, err } - cacheClient := cacheRpc.NewCacheClient(etcdConn) - cacheResp, err := cacheClient.GetFriendIDListFromCache(context.Background(), reqGetFriendIDListFromCache) - if err != nil { - log.NewError(data.OperationID, "GetFriendIDListFromCache rpc call failed ", err.Error()) - } else { - if cacheResp.CommonResp.ErrCode != 0 { - log.NewError(data.OperationID, "GetFriendIDListFromCache rpc logic call failed ", cacheResp.String()) - } else { - if !utils.IsContain(data.MsgData.SendID, cacheResp.UserIDList) { - return false, 601, "not friend", nil - } - } + if !friend { + return nil, constant.ErrNotPeersFriend.Wrap() } - return true, 0, "", nil - } else { - return true, 0, "", nil + return nil, nil } + return nil, nil case constant.GroupChatType: - userIDList, err := utils.GetGroupMemberUserIDList(ctx, data.MsgData.GroupID, data.OperationID) - if err != nil { - errMsg := data.OperationID + err.Error() - log.NewError(data.OperationID, errMsg) - return false, 201, errMsg, nil + if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) { + return nil, nil } - if tokenverify.IsManagerUserID(data.MsgData.SendID) { - return true, 0, "", userIDList + userIDList, err := m.GetGroupMemberIDs(ctx, data.MsgData.GroupID) + if err != nil { + return nil, err + } + if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) { + return userIDList, nil } if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin { - return true, 0, "", userIDList - } else { - if !utils.IsContain(data.MsgData.SendID, userIDList) { - //return returnMsg(&replay, pb, 202, "you are not in group", "", 0) - return false, 202, "you are not in group", nil - } + return userIDList, nil } - isMute, isAdmin, err := userIsMuteAndIsAdminInGroup(ctx, data.MsgData.GroupID, data.MsgData.SendID) + if !utils.IsContain(data.MsgData.SendID, userIDList) { + return nil, constant.ErrNotInGroupYet.Wrap() + } + isMute, err := m.userIsMuteAndIsAdminInGroup(ctx, data.MsgData.GroupID, data.MsgData.SendID) if err != nil { - errMsg := data.OperationID + err.Error() - return false, 223, errMsg, nil + return nil, err } if isMute { - return false, 224, "you are muted", nil + return nil, constant.ErrMutedInGroup.Wrap() + } + + isMute, isAdmin, err := m.groupIsMuted(ctx, data.MsgData.GroupID, data.MsgData.SendID) + if err != nil { + return nil, err } if isAdmin { - return true, 0, "", userIDList - } - isMute, err = groupIsMuted(ctx, data.MsgData.GroupID) - if err != nil { - errMsg := data.OperationID + err.Error() - return false, 223, errMsg, nil - } - if isMute { - return false, 225, "group id muted", nil - } - return true, 0, "", userIDList - case constant.SuperGroupChatType: - groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, data.MsgData.GroupID) - if err != nil { - return false, 201, err.Error(), nil + return userIDList, nil } + if isMute { + return nil, constant.ErrMutedGroup.Wrap() + } + return userIDList, nil + case constant.SuperGroupChatType: + groupInfo, err := m.Group.GetGroupInfo(ctx, data.MsgData.GroupID) + if err != nil { + return nil, err + } if data.MsgData.ContentType == constant.AdvancedRevoke { revokeMessage := new(MessageRevoked) err := utils.JsonStringToStruct(string(data.MsgData.Content), revokeMessage) if err != nil { - log.Error(data.OperationID, "json unmarshal err:", err.Error()) - return false, 201, err.Error(), nil + return nil, constant.ErrArgs.Wrap() } - log.Debug(data.OperationID, "revoke message is", *revokeMessage) + if revokeMessage.RevokerID != revokeMessage.SourceMessageSendID { - req := pbChat.GetSuperGroupMsgReq{OperationID: data.OperationID, Seq: revokeMessage.Seq, GroupID: data.MsgData.GroupID} - resp, err := rpc.GetSuperGroupMsg(context.Background(), &req) + resp, err := m.MsgInterface.GetSuperGroupMsg(ctx, data.MsgData.GroupID, revokeMessage.Seq) if err != nil { - log.Error(data.OperationID, "GetSuperGroupMsgReq err:", err.Error()) - } else if resp.ErrCode != 0 { - log.Error(data.OperationID, "GetSuperGroupMsgReq err:", resp.ErrCode, resp.ErrMsg) + return nil, err + } + if resp.ClientMsgID == revokeMessage.ClientMsgID && resp.Seq == revokeMessage.Seq { + revokeMessage.SourceMessageSendTime = resp.SendTime + revokeMessage.SourceMessageSenderNickname = resp.SenderNickname + revokeMessage.SourceMessageSendID = resp.SendID + data.MsgData.Content = []byte(utils.StructToJsonString(revokeMessage)) } else { - if resp.MsgData != nil && resp.MsgData.ClientMsgID == revokeMessage.ClientMsgID && resp.MsgData.Seq == revokeMessage.Seq { - revokeMessage.SourceMessageSendTime = resp.MsgData.SendTime - revokeMessage.SourceMessageSenderNickname = resp.MsgData.SenderNickname - revokeMessage.SourceMessageSendID = resp.MsgData.SendID - log.Debug(data.OperationID, "new revoke message is ", revokeMessage) - data.MsgData.Content = []byte(utils.StructToJsonString(revokeMessage)) - } else { - return false, 201, errors.New("msg err").Error(), nil - } + return nil, constant.ErrData.Wrap("MsgData") } } } if groupInfo.GroupType == constant.SuperGroup { - return true, 0, "", nil - } else { - userIDList, err := utils.GetGroupMemberUserIDList(ctx, data.MsgData.GroupID, data.OperationID) - if err != nil { - errMsg := data.OperationID + err.Error() - log.NewError(data.OperationID, errMsg) - return false, 201, errMsg, nil - } - if tokenverify.IsManagerUserID(data.MsgData.SendID) { - return true, 0, "", userIDList - } - if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin { - return true, 0, "", userIDList - } else { - if !utils.IsContain(data.MsgData.SendID, userIDList) { - //return returnMsg(&replay, pb, 202, "you are not in group", "", 0) - return false, 202, "you are not in group", nil - } - } - isMute, isAdmin, err := userIsMuteAndIsAdminInGroup(ctx, data.MsgData.GroupID, data.MsgData.SendID) - if err != nil { - errMsg := data.OperationID + err.Error() - return false, 223, errMsg, nil - } - if isMute { - return false, 224, "you are muted", nil - } - if isAdmin { - return true, 0, "", userIDList - } - isMute, err = groupIsMuted(ctx, data.MsgData.GroupID) - if err != nil { - errMsg := data.OperationID + err.Error() - return false, 223, errMsg, nil - } - if isMute { - return false, 225, "group id muted", nil - } - return true, 0, "", userIDList + return nil, nil } - default: - return true, 0, "", nil - } + userIDList, err := m.GetGroupMemberIDs(ctx, data.MsgData.GroupID) + if err != nil { + return nil, err + } + if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) { + return nil, nil + } + if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin { + return userIDList, nil + } else { + if !utils.IsContain(data.MsgData.SendID, userIDList) { + return nil, constant.ErrNotInGroupYet.Wrap() + } + } + isMute, err := m.userIsMuteAndIsAdminInGroup(ctx, data.MsgData.GroupID, data.MsgData.SendID) + if err != nil { + return nil, err + } + if isMute { + return nil, constant.ErrMutedInGroup.Wrap() + } + + isMute, isAdmin, err := m.groupIsMuted(ctx, data.MsgData.GroupID, data.MsgData.SendID) + if err != nil { + return nil, err + } + if isAdmin { + return userIDList, nil + } + if isMute { + return nil, constant.ErrMutedGroup.Wrap() + } + return userIDList, nil + + default: + return nil, nil + } } -func (rpc *rpcChat) encapsulateMsgData(msg *sdkws.MsgData) { +func (m *msgServer) encapsulateMsgData(msg *sdkws.MsgData) { msg.ServerMsgID = GetMsgID(msg.SendID) msg.SendTime = utils.GetCurrentTimestampByMill() switch msg.ContentType { @@ -325,12 +253,10 @@ func (rpc *rpcChat) encapsulateMsgData(msg *sdkws.MsgData) { utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) case constant.HasReadReceipt: - log.Info("", "this is a test start", msg, msg.Options) utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) - log.Info("", "this is a test end", msg, msg.Options) case constant.Typing: utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false) utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) @@ -341,736 +267,53 @@ func (rpc *rpcChat) encapsulateMsgData(msg *sdkws.MsgData) { utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) } } -func (rpc *rpcChat) SendMsg(ctx context.Context, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, error) { - replay := pbChat.SendMsgResp{} - log.Info(pb.OperationID, "rpc sendMsg come here ", pb.String()) - flag, errCode, errMsg := isMessageHasReadEnabled(pb) - if !flag { - return returnMsg(&replay, pb, errCode, errMsg, "", 0) - } - t1 := time.Now() - rpc.encapsulateMsgData(pb.MsgData) - log.Debug(pb.OperationID, "encapsulateMsgData ", " cost time: ", time.Since(t1)) - msgToMQSingle := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData} - // callback - t1 = time.Now() - callbackResp := callbackMsgModify(pb) - log.Debug(pb.OperationID, "callbackMsgModify ", callbackResp, "cost time: ", time.Since(t1)) - if callbackResp.ErrCode != 0 { - log.Error(pb.OperationID, utils.GetSelfFuncName(), "callbackMsgModify resp: ", callbackResp) - } - log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackResp: ", callbackResp) - if callbackResp.ActionCode != constant.ActionAllow { - if callbackResp.ErrCode == 0 { - callbackResp.ErrCode = 201 - } - log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackMsgModify result", "end rpc and return", pb.MsgData) - return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0) - } - switch pb.MsgData.SessionType { - case constant.SingleChatType: - prome.PromeInc(prome.SingleChatMsgRecvSuccessCounter) - // callback - t1 = time.Now() - callbackResp := callbackBeforeSendSingleMsg(pb) - log.Debug(pb.OperationID, "callbackBeforeSendSingleMsg ", " cost time: ", time.Since(t1)) - if callbackResp.ErrCode != 0 { - log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSingleMsg resp: ", callbackResp) - } - if callbackResp.ActionCode != constant.ActionAllow { - if callbackResp.ErrCode == 0 { - callbackResp.ErrCode = 201 - } - log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSingleMsg result", "end rpc and return", callbackResp) - prome.PromeInc(prome.SingleChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0) - } - t1 = time.Now() - flag, errCode, errMsg, _ = rpc.messageVerification(ctx, pb) - log.Debug(pb.OperationID, "messageVerification ", flag, " cost time: ", time.Since(t1)) - if !flag { - return returnMsg(&replay, pb, errCode, errMsg, "", 0) - } - t1 = time.Now() - isSend := modifyMessageByUserMessageReceiveOpt(pb.MsgData.RecvID, pb.MsgData.SendID, constant.SingleChatType, pb) - log.Info(pb.OperationID, "modifyMessageByUserMessageReceiveOpt ", " cost time: ", time.Since(t1)) - if isSend { - msgToMQSingle.MsgData = pb.MsgData - log.NewInfo(msgToMQSingle.OperationID, msgToMQSingle) - t1 = time.Now() - err1 := rpc.sendMsgToWriter(ctx, &msgToMQSingle, msgToMQSingle.MsgData.RecvID, constant.OnlineStatus) - log.Info(pb.OperationID, "sendMsgToWriter ", " cost time: ", time.Since(t1)) - if err1 != nil { - log.NewError(msgToMQSingle.OperationID, "kafka send msg err :RecvID", msgToMQSingle.MsgData.RecvID, msgToMQSingle.String(), err1.Error()) - prome.PromeInc(prome.SingleChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - } - if msgToMQSingle.MsgData.SendID != msgToMQSingle.MsgData.RecvID { //Filter messages sent to yourself - t1 = time.Now() - err2 := rpc.sendMsgToWriter(ctx, &msgToMQSingle, msgToMQSingle.MsgData.SendID, constant.OnlineStatus) - log.Info(pb.OperationID, "sendMsgToWriter ", " cost time: ", time.Since(t1)) - if err2 != nil { - log.NewError(msgToMQSingle.OperationID, "kafka send msg err:SendID", msgToMQSingle.MsgData.SendID, msgToMQSingle.String()) - prome.PromeInc(prome.SingleChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - } - // callback - t1 = time.Now() - callbackResp = callbackAfterSendSingleMsg(pb) - log.Info(pb.OperationID, "callbackAfterSendSingleMsg ", " cost time: ", time.Since(t1)) - if callbackResp.ErrCode != 0 { - log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendSingleMsg resp: ", callbackResp) - } - prome.PromeInc(prome.SingleChatMsgProcessSuccessCounter) - return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime) - case constant.GroupChatType: - // callback - prome.PromeInc(prome.GroupChatMsgRecvSuccessCounter) - callbackResp := callbackBeforeSendGroupMsg(pb) - if callbackResp.ErrCode != 0 { - log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendGroupMsg resp:", callbackResp) - } - if callbackResp.ActionCode != constant.ActionAllow { - if callbackResp.ErrCode == 0 { - callbackResp.ErrCode = 201 - } - log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSingleMsg result", "end rpc and return", callbackResp) - prome.PromeInc(prome.GroupChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0) - } - var memberUserIDList []string - if flag, errCode, errMsg, memberUserIDList = rpc.messageVerification(ctx, pb); !flag { - prome.PromeInc(prome.GroupChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, errCode, errMsg, "", 0) - } - log.Debug(pb.OperationID, "GetGroupAllMember userID list", memberUserIDList, "len: ", len(memberUserIDList)) - var addUidList []string - switch pb.MsgData.ContentType { - case constant.MemberKickedNotification: - var tips sdkws.TipsComm - var memberKickedTips sdkws.MemberKickedTips - err := proto.Unmarshal(pb.MsgData.Content, &tips) - if err != nil { - log.Error(pb.OperationID, "Unmarshal err", err.Error()) - } - err = proto.Unmarshal(tips.Detail, &memberKickedTips) - if err != nil { - log.Error(pb.OperationID, "Unmarshal err", err.Error()) - } - log.Info(pb.OperationID, "data is ", memberKickedTips) - for _, v := range memberKickedTips.KickedUserList { - addUidList = append(addUidList, v.UserID) - } - case constant.MemberQuitNotification: - addUidList = append(addUidList, pb.MsgData.SendID) - default: - } - if len(addUidList) > 0 { - memberUserIDList = append(memberUserIDList, addUidList...) - } - m := make(map[string][]string, 2) - m[constant.OnlineStatus] = memberUserIDList - t1 = time.Now() - - //split parallel send - var wg sync.WaitGroup - var sendTag bool - var split = 20 - for k, v := range m { - remain := len(v) % split - for i := 0; i < len(v)/split; i++ { - wg.Add(1) - tmp := valueCopy(pb) - // go rpc.sendMsgToGroup(v[i*split:(i+1)*split], *pb, k, &sendTag, &wg) - go rpc.sendMsgToGroupOptimization(ctx, v[i*split:(i+1)*split], tmp, k, &sendTag, &wg) - } - if remain > 0 { - wg.Add(1) - tmp := valueCopy(pb) - // go rpc.sendMsgToGroup(v[split*(len(v)/split):], *pb, k, &sendTag, &wg) - go rpc.sendMsgToGroupOptimization(ctx, v[split*(len(v)/split):], tmp, k, &sendTag, &wg) - } - } - log.Debug(pb.OperationID, "send msg cost time22 ", time.Since(t1), pb.MsgData.ClientMsgID, "uidList : ", len(addUidList)) - //wg.Add(1) - //go rpc.sendMsgToGroup(addUidList, *pb, constant.OnlineStatus, &sendTag, &wg) - wg.Wait() - t1 = time.Now() - // callback - callbackResp = callbackAfterSendGroupMsg(pb) - if callbackResp.ErrCode != 0 { - log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendGroupMsg resp: ", callbackResp) - } - if !sendTag { - log.NewWarn(pb.OperationID, "send tag is ", sendTag) - prome.PromeInc(prome.GroupChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } else { - if pb.MsgData.ContentType == constant.AtText { - go func() { - var conversationReq pbConversation.ModifyConversationFieldReq - var tag bool - var atUserID []string - conversation := pbConversation.Conversation{ - OwnerUserID: pb.MsgData.SendID, - ConversationID: utils.GetConversationIDBySessionType(pb.MsgData.GroupID, constant.GroupChatType), - ConversationType: constant.GroupChatType, - GroupID: pb.MsgData.GroupID, - } - conversationReq.Conversation = &conversation - conversationReq.OperationID = pb.OperationID - conversationReq.FieldType = constant.FieldGroupAtType - tagAll := utils.IsContain(constant.AtAllString, pb.MsgData.AtUserIDList) - if tagAll { - atUserID = utils.DifferenceString([]string{constant.AtAllString}, pb.MsgData.AtUserIDList) - if len(atUserID) == 0 { //just @everyone - conversationReq.UserIDList = memberUserIDList - conversation.GroupAtType = constant.AtAll - } else { //@Everyone and @other people - conversationReq.UserIDList = atUserID - conversation.GroupAtType = constant.AtAllAtMe - tag = true - } - } else { - conversationReq.UserIDList = pb.MsgData.AtUserIDList - conversation.GroupAtType = constant.AtMe - } - etcdConn, err := rpc.GetConn(ctx, config.Config.RpcRegisterName.OpenImConversationName) - if err != nil { - errMsg := pb.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(pb.OperationID, errMsg) - return - } - client := pbConversation.NewConversationClient(etcdConn) - conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq) - if err != nil { - log.NewError(conversationReq.OperationID, "ModifyConversationField rpc failed, ", conversationReq.String(), err.Error()) - } else if conversationReply.CommonResp.ErrCode != 0 { - log.NewError(conversationReq.OperationID, "ModifyConversationField rpc failed, ", conversationReq.String(), conversationReply.String()) - } - if tag { - conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList) - conversation.GroupAtType = constant.AtAll - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID) - if etcdConn == nil { - errMsg := pb.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(pb.OperationID, errMsg) - return - } - client := pbConversation.NewConversationClient(etcdConn) - conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq) - if err != nil { - log.NewError(conversationReq.OperationID, "ModifyConversationField rpc failed, ", conversationReq.String(), err.Error()) - } else if conversationReply.CommonResp.ErrCode != 0 { - log.NewError(conversationReq.OperationID, "ModifyConversationField rpc failed, ", conversationReq.String(), conversationReply.String()) - } - } - }() - } - log.Debug(pb.OperationID, "send msg cost time3 ", time.Since(t1), pb.MsgData.ClientMsgID) - prome.PromeInc(prome.GroupChatMsgProcessSuccessCounter) - return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime) - } - case constant.NotificationChatType: - t1 = time.Now() - msgToMQSingle.MsgData = pb.MsgData - log.NewInfo(msgToMQSingle.OperationID, msgToMQSingle) - err1 := rpc.sendMsgToWriter(ctx, &msgToMQSingle, msgToMQSingle.MsgData.RecvID, constant.OnlineStatus) - if err1 != nil { - log.NewError(msgToMQSingle.OperationID, "kafka send msg err:RecvID", msgToMQSingle.MsgData.RecvID, msgToMQSingle.String()) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - - if msgToMQSingle.MsgData.SendID != msgToMQSingle.MsgData.RecvID { //Filter messages sent to yourself - err2 := rpc.sendMsgToWriter(ctx, &msgToMQSingle, msgToMQSingle.MsgData.SendID, constant.OnlineStatus) - if err2 != nil { - log.NewError(msgToMQSingle.OperationID, "kafka send msg err:SendID", msgToMQSingle.MsgData.SendID, msgToMQSingle.String()) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - } - - log.Debug(pb.OperationID, "send msg cost time ", time.Since(t1), pb.MsgData.ClientMsgID) - return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime) - case constant.SuperGroupChatType: - prome.PromeInc(prome.WorkSuperGroupChatMsgRecvSuccessCounter) - // callback - callbackResp := callbackBeforeSendGroupMsg(pb) - if callbackResp.ErrCode != 0 { - log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSuperGroupMsg resp: ", callbackResp) - } - if callbackResp.ActionCode != constant.ActionAllow { - if callbackResp.ErrCode == 0 { - callbackResp.ErrCode = 201 - } - prome.PromeInc(prome.WorkSuperGroupChatMsgProcessFailedCounter) - log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSuperGroupMsg result", "end rpc and return", callbackResp) - return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0) - } - if flag, errCode, errMsg, _ = rpc.messageVerification(ctx, pb); !flag { - prome.PromeInc(prome.WorkSuperGroupChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, errCode, errMsg, "", 0) - } - msgToMQSingle.MsgData = pb.MsgData - log.NewInfo(msgToMQSingle.OperationID, msgToMQSingle) - err1 := rpc.sendMsgToWriter(ctx, &msgToMQSingle, msgToMQSingle.MsgData.GroupID, constant.OnlineStatus) - if err1 != nil { - log.NewError(msgToMQSingle.OperationID, "kafka send msg err:RecvID", msgToMQSingle.MsgData.RecvID, msgToMQSingle.String()) - prome.PromeInc(prome.WorkSuperGroupChatMsgProcessFailedCounter) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - // callback - callbackResp = callbackAfterSendGroupMsg(pb) - if callbackResp.ErrCode != 0 { - log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendSuperGroupMsg resp: ", callbackResp) - } - prome.PromeInc(prome.WorkSuperGroupChatMsgProcessSuccessCounter) - return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime) - - default: - return returnMsg(&replay, pb, 203, "unknown sessionType", "", 0) - } -} - -func (rpc *rpcChat) sendMsgToWriter(ctx context.Context, m *pbChat.MsgDataToMQ, key string, status string) error { - switch status { - case constant.OnlineStatus: - if m.MsgData.ContentType == constant.SignalingNotification { - rpcPushMsg := pbPush.PushMsgReq{OperationID: m.OperationID, MsgData: m.MsgData, PushToUserID: key} - grpcConn, err := rpc.GetConn(ctx, config.Config.RpcRegisterName.OpenImPushName) - if err != nil { - return err - } - msgClient := pbPush.NewPushMsgServiceClient(grpcConn) - _, err = msgClient.PushMsg(context.Background(), &rpcPushMsg) - if err != nil { - log.Error(rpcPushMsg.OperationID, "rpc send failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String(), "err", err.Error()) - return err - } else { - return nil - } - } - pid, offset, err := rpc.messageWriter.SendMessage(m, key, m.OperationID) - if err != nil { - log.Error(m.OperationID, "kafka send failed", "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), "key", key, status) - } else { - // log.NewWarn(m.OperationID, "sendMsgToWriter client msgID ", m.MsgData.ClientMsgID) - } - return err - case constant.OfflineStatus: - pid, offset, err := rpc.messageWriter.SendMessage(m, key, m.OperationID) - if err != nil { - log.Error(m.OperationID, "kafka send failed", "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), "key", key, status) - } - return err - } - return errors.New("status error") -} func GetMsgID(sendID string) string { t := time.Now().Format("2006-01-02 15:04:05") return utils.Md5(t + "-" + sendID + "-" + strconv.Itoa(rand.Int())) } -func returnMsg(replay *pbChat.SendMsgResp, pb *pbChat.SendMsgReq, errCode int32, errMsg, serverMsgID string, sendTime int64) (*pbChat.SendMsgResp, error) { - replay.ErrCode = errCode - replay.ErrMsg = errMsg - replay.ServerMsgID = serverMsgID - replay.ClientMsgID = pb.MsgData.ClientMsgID - replay.SendTime = sendTime - return replay, nil -} - -func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, pb *pbChat.SendMsgReq) bool { - opt, err := db.DB.GetUserGlobalMsgRecvOpt(userID) +func (m *msgServer) modifyMessageByUserMessageReceiveOpt(ctx context.Context, userID, sourceID string, sessionType int, pb *msg.SendMsgReq) (bool, error) { + opt, err := m.User.GetUserGlobalMsgRecvOpt(ctx, userID) if err != nil { - log.NewError(pb.OperationID, "GetUserGlobalMsgRecvOpt from redis err", userID, pb.String(), err.Error()) - + return false, err } switch opt { case constant.ReceiveMessage: case constant.NotReceiveMessage: - return false + return false, nil case constant.ReceiveNotNotifyMessage: if pb.MsgData.Options == nil { pb.MsgData.Options = make(map[string]bool, 10) } utils.SetSwitchFromOptions(pb.MsgData.Options, constant.IsOfflinePush, false) - return true + return true, nil } conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) - singleOpt, sErr := db.DB.GetSingleConversationRecvMsgOpt(userID, conversationID) - if sErr != nil && sErr != go_redis.Nil { - log.NewError(pb.OperationID, "GetSingleConversationMsgOpt from redis err", conversationID, pb.String(), sErr.Error()) - return true + singleOpt, err := m.Conversation.GetSingleConversationRecvMsgOpt(ctx, userID, conversationID) + if err != nil { + return false, err } switch singleOpt { case constant.ReceiveMessage: - return true + return true, nil case constant.NotReceiveMessage: if utils.IsContainInt(int(pb.MsgData.ContentType), ExcludeContentType) { - return true + return true, nil } - return false + return false, nil case constant.ReceiveNotNotifyMessage: if pb.MsgData.Options == nil { pb.MsgData.Options = make(map[string]bool, 10) } utils.SetSwitchFromOptions(pb.MsgData.Options, constant.IsOfflinePush, false) - return true + return true, nil } - return true + return true, nil } -func modifyMessageByUserMessageReceiveOptoptimization(userID, sourceID string, sessionType int, operationID string, options *map[string]bool) bool { - conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) - opt, err := db.DB.GetSingleConversationRecvMsgOpt(userID, conversationID) - if err != nil && err != go_redis.Nil { - log.NewError(operationID, "GetSingleConversationMsgOpt from redis err", userID, conversationID, err.Error()) - return true - } - - switch opt { - case constant.ReceiveMessage: - return true - case constant.NotReceiveMessage: - return false - case constant.ReceiveNotNotifyMessage: - if *options == nil { - *options = make(map[string]bool, 10) - } - utils.SetSwitchFromOptions(*options, constant.IsOfflinePush, false) - return true - } - return true -} - -type NotificationMsg struct { - SendID string - RecvID string - Content []byte // sdkws.TipsComm - MsgFrom int32 - ContentType int32 - SessionType int32 - OperationID string - SenderNickname string - SenderFaceURL string -} - -func Notification(n *NotificationMsg) { - var req pbChat.SendMsgReq - var msg sdkws.MsgData - var offlineInfo sdkws.OfflinePushInfo - var title, desc, ex string - var pushSwitch, unReadCount bool - var reliabilityLevel int - req.OperationID = n.OperationID - msg.SendID = n.SendID - msg.RecvID = n.RecvID - msg.Content = n.Content - msg.MsgFrom = n.MsgFrom - msg.ContentType = n.ContentType - msg.SessionType = n.SessionType - msg.CreateTime = utils.GetCurrentTimestampByMill() - msg.ClientMsgID = utils.GetMsgID(n.SendID) - msg.Options = make(map[string]bool, 7) - msg.SenderNickname = n.SenderNickname - msg.SenderFaceURL = n.SenderFaceURL - switch n.SessionType { - case constant.GroupChatType, constant.SuperGroupChatType: - msg.RecvID = "" - msg.GroupID = n.RecvID - } - offlineInfo.IOSBadgeCount = config.Config.IOSPush.BadgeCount - offlineInfo.IOSPushSound = config.Config.IOSPush.PushSound - switch msg.ContentType { - case constant.GroupCreatedNotification: - pushSwitch = config.Config.Notification.GroupCreated.OfflinePush.PushSwitch - title = config.Config.Notification.GroupCreated.OfflinePush.Title - desc = config.Config.Notification.GroupCreated.OfflinePush.Desc - ex = config.Config.Notification.GroupCreated.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupCreated.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupCreated.Conversation.UnreadCount - case constant.GroupInfoSetNotification: - pushSwitch = config.Config.Notification.GroupInfoSet.OfflinePush.PushSwitch - title = config.Config.Notification.GroupInfoSet.OfflinePush.Title - desc = config.Config.Notification.GroupInfoSet.OfflinePush.Desc - ex = config.Config.Notification.GroupInfoSet.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupInfoSet.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupInfoSet.Conversation.UnreadCount - case constant.JoinGroupApplicationNotification: - pushSwitch = config.Config.Notification.JoinGroupApplication.OfflinePush.PushSwitch - title = config.Config.Notification.JoinGroupApplication.OfflinePush.Title - desc = config.Config.Notification.JoinGroupApplication.OfflinePush.Desc - ex = config.Config.Notification.JoinGroupApplication.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.JoinGroupApplication.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.JoinGroupApplication.Conversation.UnreadCount - case constant.MemberQuitNotification: - pushSwitch = config.Config.Notification.MemberQuit.OfflinePush.PushSwitch - title = config.Config.Notification.MemberQuit.OfflinePush.Title - desc = config.Config.Notification.MemberQuit.OfflinePush.Desc - ex = config.Config.Notification.MemberQuit.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.MemberQuit.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.MemberQuit.Conversation.UnreadCount - case constant.GroupApplicationAcceptedNotification: - pushSwitch = config.Config.Notification.GroupApplicationAccepted.OfflinePush.PushSwitch - title = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Title - desc = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Desc - ex = config.Config.Notification.GroupApplicationAccepted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupApplicationAccepted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupApplicationAccepted.Conversation.UnreadCount - case constant.GroupApplicationRejectedNotification: - pushSwitch = config.Config.Notification.GroupApplicationRejected.OfflinePush.PushSwitch - title = config.Config.Notification.GroupApplicationRejected.OfflinePush.Title - desc = config.Config.Notification.GroupApplicationRejected.OfflinePush.Desc - ex = config.Config.Notification.GroupApplicationRejected.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupApplicationRejected.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupApplicationRejected.Conversation.UnreadCount - case constant.GroupOwnerTransferredNotification: - pushSwitch = config.Config.Notification.GroupOwnerTransferred.OfflinePush.PushSwitch - title = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Title - desc = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Desc - ex = config.Config.Notification.GroupOwnerTransferred.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupOwnerTransferred.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupOwnerTransferred.Conversation.UnreadCount - case constant.MemberKickedNotification: - pushSwitch = config.Config.Notification.MemberKicked.OfflinePush.PushSwitch - title = config.Config.Notification.MemberKicked.OfflinePush.Title - desc = config.Config.Notification.MemberKicked.OfflinePush.Desc - ex = config.Config.Notification.MemberKicked.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.MemberKicked.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.MemberKicked.Conversation.UnreadCount - case constant.MemberInvitedNotification: - pushSwitch = config.Config.Notification.MemberInvited.OfflinePush.PushSwitch - title = config.Config.Notification.MemberInvited.OfflinePush.Title - desc = config.Config.Notification.MemberInvited.OfflinePush.Desc - ex = config.Config.Notification.MemberInvited.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.MemberInvited.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.MemberInvited.Conversation.UnreadCount - case constant.MemberEnterNotification: - pushSwitch = config.Config.Notification.MemberEnter.OfflinePush.PushSwitch - title = config.Config.Notification.MemberEnter.OfflinePush.Title - desc = config.Config.Notification.MemberEnter.OfflinePush.Desc - ex = config.Config.Notification.MemberEnter.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.MemberEnter.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.MemberEnter.Conversation.UnreadCount - case constant.UserInfoUpdatedNotification: - pushSwitch = config.Config.Notification.UserInfoUpdated.OfflinePush.PushSwitch - title = config.Config.Notification.UserInfoUpdated.OfflinePush.Title - desc = config.Config.Notification.UserInfoUpdated.OfflinePush.Desc - ex = config.Config.Notification.UserInfoUpdated.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.UserInfoUpdated.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.UserInfoUpdated.Conversation.UnreadCount - case constant.FriendApplicationNotification: - pushSwitch = config.Config.Notification.FriendApplication.OfflinePush.PushSwitch - title = config.Config.Notification.FriendApplication.OfflinePush.Title - desc = config.Config.Notification.FriendApplication.OfflinePush.Desc - ex = config.Config.Notification.FriendApplication.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendApplication.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendApplication.Conversation.UnreadCount - case constant.FriendApplicationApprovedNotification: - pushSwitch = config.Config.Notification.FriendApplicationApproved.OfflinePush.PushSwitch - title = config.Config.Notification.FriendApplicationApproved.OfflinePush.Title - desc = config.Config.Notification.FriendApplicationApproved.OfflinePush.Desc - ex = config.Config.Notification.FriendApplicationApproved.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendApplicationApproved.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendApplicationApproved.Conversation.UnreadCount - case constant.FriendApplicationRejectedNotification: - pushSwitch = config.Config.Notification.FriendApplicationRejected.OfflinePush.PushSwitch - title = config.Config.Notification.FriendApplicationRejected.OfflinePush.Title - desc = config.Config.Notification.FriendApplicationRejected.OfflinePush.Desc - ex = config.Config.Notification.FriendApplicationRejected.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendApplicationRejected.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendApplicationRejected.Conversation.UnreadCount - case constant.FriendAddedNotification: - pushSwitch = config.Config.Notification.FriendAdded.OfflinePush.PushSwitch - title = config.Config.Notification.FriendAdded.OfflinePush.Title - desc = config.Config.Notification.FriendAdded.OfflinePush.Desc - ex = config.Config.Notification.FriendAdded.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendAdded.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendAdded.Conversation.UnreadCount - case constant.FriendDeletedNotification: - pushSwitch = config.Config.Notification.FriendDeleted.OfflinePush.PushSwitch - title = config.Config.Notification.FriendDeleted.OfflinePush.Title - desc = config.Config.Notification.FriendDeleted.OfflinePush.Desc - ex = config.Config.Notification.FriendDeleted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendDeleted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendDeleted.Conversation.UnreadCount - case constant.FriendRemarkSetNotification: - pushSwitch = config.Config.Notification.FriendRemarkSet.OfflinePush.PushSwitch - title = config.Config.Notification.FriendRemarkSet.OfflinePush.Title - desc = config.Config.Notification.FriendRemarkSet.OfflinePush.Desc - ex = config.Config.Notification.FriendRemarkSet.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendRemarkSet.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendRemarkSet.Conversation.UnreadCount - case constant.BlackAddedNotification: - pushSwitch = config.Config.Notification.BlackAdded.OfflinePush.PushSwitch - title = config.Config.Notification.BlackAdded.OfflinePush.Title - desc = config.Config.Notification.BlackAdded.OfflinePush.Desc - ex = config.Config.Notification.BlackAdded.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.BlackAdded.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.BlackAdded.Conversation.UnreadCount - case constant.BlackDeletedNotification: - pushSwitch = config.Config.Notification.BlackDeleted.OfflinePush.PushSwitch - title = config.Config.Notification.BlackDeleted.OfflinePush.Title - desc = config.Config.Notification.BlackDeleted.OfflinePush.Desc - ex = config.Config.Notification.BlackDeleted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.BlackDeleted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.BlackDeleted.Conversation.UnreadCount - case constant.ConversationOptChangeNotification: - pushSwitch = config.Config.Notification.ConversationOptUpdate.OfflinePush.PushSwitch - title = config.Config.Notification.ConversationOptUpdate.OfflinePush.Title - desc = config.Config.Notification.ConversationOptUpdate.OfflinePush.Desc - ex = config.Config.Notification.ConversationOptUpdate.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.ConversationOptUpdate.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.ConversationOptUpdate.Conversation.UnreadCount - - case constant.GroupDismissedNotification: - pushSwitch = config.Config.Notification.GroupDismissed.OfflinePush.PushSwitch - title = config.Config.Notification.GroupDismissed.OfflinePush.Title - desc = config.Config.Notification.GroupDismissed.OfflinePush.Desc - ex = config.Config.Notification.GroupDismissed.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupDismissed.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupDismissed.Conversation.UnreadCount - - case constant.GroupMutedNotification: - pushSwitch = config.Config.Notification.GroupMuted.OfflinePush.PushSwitch - title = config.Config.Notification.GroupMuted.OfflinePush.Title - desc = config.Config.Notification.GroupMuted.OfflinePush.Desc - ex = config.Config.Notification.GroupMuted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupMuted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupMuted.Conversation.UnreadCount - - case constant.GroupCancelMutedNotification: - pushSwitch = config.Config.Notification.GroupCancelMuted.OfflinePush.PushSwitch - title = config.Config.Notification.GroupCancelMuted.OfflinePush.Title - desc = config.Config.Notification.GroupCancelMuted.OfflinePush.Desc - ex = config.Config.Notification.GroupCancelMuted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupCancelMuted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupCancelMuted.Conversation.UnreadCount - - case constant.GroupMemberMutedNotification: - pushSwitch = config.Config.Notification.GroupMemberMuted.OfflinePush.PushSwitch - title = config.Config.Notification.GroupMemberMuted.OfflinePush.Title - desc = config.Config.Notification.GroupMemberMuted.OfflinePush.Desc - ex = config.Config.Notification.GroupMemberMuted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupMemberMuted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupMemberMuted.Conversation.UnreadCount - - case constant.GroupMemberCancelMutedNotification: - pushSwitch = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.PushSwitch - title = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Title - desc = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Desc - ex = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupMemberCancelMuted.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupMemberCancelMuted.Conversation.UnreadCount - - case constant.GroupMemberInfoSetNotification: - pushSwitch = config.Config.Notification.GroupMemberInfoSet.OfflinePush.PushSwitch - title = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Title - desc = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Desc - ex = config.Config.Notification.GroupMemberInfoSet.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.GroupMemberInfoSet.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.GroupMemberInfoSet.Conversation.UnreadCount - - case constant.ConversationPrivateChatNotification: - pushSwitch = config.Config.Notification.ConversationSetPrivate.OfflinePush.PushSwitch - title = config.Config.Notification.ConversationSetPrivate.OfflinePush.Title - desc = config.Config.Notification.ConversationSetPrivate.OfflinePush.Desc - ex = config.Config.Notification.ConversationSetPrivate.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.ConversationSetPrivate.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount - case constant.FriendInfoUpdatedNotification: - pushSwitch = config.Config.Notification.FriendInfoUpdated.OfflinePush.PushSwitch - title = config.Config.Notification.FriendInfoUpdated.OfflinePush.Title - desc = config.Config.Notification.FriendInfoUpdated.OfflinePush.Desc - ex = config.Config.Notification.FriendInfoUpdated.OfflinePush.Ext - reliabilityLevel = config.Config.Notification.FriendInfoUpdated.Conversation.ReliabilityLevel - unReadCount = config.Config.Notification.FriendInfoUpdated.Conversation.UnreadCount - case constant.DeleteMessageNotification: - reliabilityLevel = constant.ReliableNotificationNoMsg - case constant.ConversationUnreadNotification, constant.SuperGroupUpdateNotification: - reliabilityLevel = constant.UnreliableNotification - } - switch reliabilityLevel { - case constant.UnreliableNotification: - utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false) - utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) - utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) - utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) - case constant.ReliableNotificationNoMsg: - utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) - utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) - case constant.ReliableNotificationMsg: - - } - utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, unReadCount) - utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, pushSwitch) - offlineInfo.Title = title - offlineInfo.Desc = desc - offlineInfo.Ex = ex - msg.OfflinePushInfo = &offlineInfo - req.MsgData = &msg - etcdConn := rpc.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) - if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" - log.NewError(req.OperationID, errMsg) - return - } - - client := pbChat.NewMsgClient(etcdConn) - reply, err := client.SendMsg(context.Background(), &req) - if err != nil { - log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String(), err.Error()) - } else if reply.ErrCode != 0 { - log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String(), reply.ErrCode, reply.ErrMsg) - } -} - -func getOnlineAndOfflineUserIDList(memberList []string, m map[string][]string, operationID string) { - var onllUserIDList, offlUserIDList []string - var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult - req := &pbRelay.GetUsersOnlineStatusReq{} - req.UserIDList = memberList - req.OperationID = operationID - req.OpUserID = config.Config.Manager.AppManagerUid[0] - flag := false - grpcCons := rpc.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), operationID) - for _, v := range grpcCons { - client := pbRelay.NewRelayClient(v) - reply, err := client.GetUsersOnlineStatus(context.Background(), req) - if err != nil { - log.NewError(operationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error()) - continue - } else { - if reply.ErrCode == 0 { - wsResult = append(wsResult, reply.SuccessResult...) - } - } - } - log.NewInfo(operationID, "call GetUsersOnlineStatus rpc server is success", wsResult) - //Online data merge of each node - for _, v1 := range memberList { - flag = false - - for _, v2 := range wsResult { - if v2.UserID == v1 { - flag = true - onllUserIDList = append(onllUserIDList, v1) - } - - } - if !flag { - offlUserIDList = append(offlUserIDList, v1) - } - } - m[constant.OnlineStatus] = onllUserIDList - m[constant.OfflineStatus] = offlUserIDList -} - -func valueCopy(pb *pbChat.SendMsgReq) *pbChat.SendMsgReq { +func valueCopy(pb *msg.SendMsgReq) *msg.SendMsgReq { offlinePushInfo := sdkws.OfflinePushInfo{} if pb.MsgData.OfflinePushInfo != nil { offlinePushInfo = *pb.MsgData.OfflinePushInfo @@ -1084,47 +327,11 @@ func valueCopy(pb *pbChat.SendMsgReq) *pbChat.SendMsgReq { options[key] = value } msgData.Options = options - return &pbChat.SendMsgReq{Token: pb.Token, OperationID: pb.OperationID, MsgData: &msgData} + return &msg.SendMsgReq{MsgData: &msgData} } -func (rpc *rpcChat) sendMsgToGroup(ctx context.Context, list []string, pb pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { - // log.Debug(pb.OperationID, "split userID ", list) - offlinePushInfo := sdkws.OfflinePushInfo{} - if pb.MsgData.OfflinePushInfo != nil { - offlinePushInfo = *pb.MsgData.OfflinePushInfo - } - msgData := sdkws.MsgData{} - msgData = *pb.MsgData - msgData.OfflinePushInfo = &offlinePushInfo - - groupPB := pbChat.SendMsgReq{Token: pb.Token, OperationID: pb.OperationID, MsgData: &msgData} - msgToMQGroup := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: &msgData} - for _, v := range list { - options := make(map[string]bool, 10) - for key, value := range pb.MsgData.Options { - options[key] = value - } - groupPB.MsgData.RecvID = v - groupPB.MsgData.Options = options - isSend := modifyMessageByUserMessageReceiveOpt(v, msgData.GroupID, constant.GroupChatType, &groupPB) - if isSend { - msgToMQGroup.MsgData = groupPB.MsgData - // log.Debug(groupPB.OperationID, "sendMsgToWriter, ", v, groupID, msgToMQGroup.String()) - err := rpc.sendMsgToWriter(ctx, &msgToMQGroup, v, status) - if err != nil { - log.NewError(msgToMQGroup.OperationID, "kafka send msg err:UserId", v, msgToMQGroup.String()) - } else { - *sendTag = true - } - } else { - log.Debug(groupPB.OperationID, "not sendMsgToWriter, ", v) - } - } - wg.Done() -} - -func (rpc *rpcChat) sendMsgToGroupOptimization(ctx context.Context, list []string, groupPB *pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { - msgToMQGroup := pbChat.MsgDataToMQ{Token: groupPB.Token, OperationID: groupPB.OperationID, MsgData: groupPB.MsgData} +func (m *msgServer) sendMsgToGroupOptimization(ctx context.Context, list []string, groupPB *msg.SendMsgReq, wg *sync.WaitGroup) error { + msgToMQGroup := msg.MsgDataToMQ{OperationID: tracelog.GetOperationID(ctx), MsgData: groupPB.MsgData} tempOptions := make(map[string]bool, 1) for k, v := range groupPB.MsgData.Options { tempOptions[k] = v @@ -1136,21 +343,22 @@ func (rpc *rpcChat) sendMsgToGroupOptimization(ctx context.Context, list []strin options[k] = v } groupPB.MsgData.Options = options - isSend := modifyMessageByUserMessageReceiveOpt(v, groupPB.MsgData.GroupID, constant.GroupChatType, groupPB) + isSend, err := m.modifyMessageByUserMessageReceiveOpt(ctx, v, groupPB.MsgData.GroupID, constant.GroupChatType, groupPB) + if err != nil { + wg.Done() + return err + } if isSend { if v == "" || groupPB.MsgData.SendID == "" { - log.Error(msgToMQGroup.OperationID, "sendMsgToGroupOptimization userID nil ", msgToMQGroup.String()) - continue + return constant.ErrArgs.Wrap("userID or groupPB.MsgData.SendID is empty") } - err := rpc.sendMsgToWriter(ctx, &msgToMQGroup, v, status) + err := m.MsgInterface.MsgToMQ(ctx, v, &msgToMQGroup) if err != nil { - log.NewError(msgToMQGroup.OperationID, "kafka send msg err:UserId", v, msgToMQGroup.String()) - } else { - *sendTag = true + wg.Done() + return err } - } else { - log.Debug(groupPB.OperationID, "not sendMsgToWriter, ", v) } } wg.Done() + return nil } diff --git a/internal/rpc/msg/send_pull.go b/internal/rpc/msg/send_pull.go new file mode 100644 index 000000000..904e4f402 --- /dev/null +++ b/internal/rpc/msg/send_pull.go @@ -0,0 +1,304 @@ +package msg + +import ( + "Open_IM/pkg/common/constant" + promePkg "Open_IM/pkg/common/prometheus" + pbConversation "Open_IM/pkg/proto/conversation" + "Open_IM/pkg/proto/msg" + "Open_IM/pkg/proto/sdkws" + "Open_IM/pkg/utils" + "context" + "github.com/golang/protobuf/proto" + "sync" +) + +func (m *msgServer) sendMsgSuperGroupChat(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) { + promePkg.PromeInc(promePkg.WorkSuperGroupChatMsgRecvSuccessCounter) + // callback + if err = CallbackBeforeSendGroupMsg(ctx, req); err != nil { + return nil, err + } + + if _, err = m.messageVerification(ctx, req); err != nil { + promePkg.PromeInc(promePkg.WorkSuperGroupChatMsgProcessFailedCounter) + return nil, err + } + msgToMQSingle := msg.MsgDataToMQ{MsgData: req.MsgData} + err = m.MsgInterface.MsgToMQ(ctx, msgToMQSingle.MsgData.GroupID, &msgToMQSingle) + if err != nil { + return nil, err + } + // callback + if err = CallbackAfterSendGroupMsg(ctx, req); err != nil { + return nil, err + } + + promePkg.PromeInc(promePkg.WorkSuperGroupChatMsgProcessSuccessCounter) + resp.SendTime = msgToMQSingle.MsgData.SendTime + resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID + resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID + return resp, nil +} +func (m *msgServer) sendMsgNotification(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) { + msgToMQSingle := msg.MsgDataToMQ{MsgData: req.MsgData} + err = m.MsgInterface.MsgToMQ(ctx, msgToMQSingle.MsgData.RecvID, &msgToMQSingle) + if err != nil { + return nil, err + } + if msgToMQSingle.MsgData.SendID != msgToMQSingle.MsgData.RecvID { //Filter messages sent to yourself + err = m.MsgInterface.MsgToMQ(ctx, msgToMQSingle.MsgData.SendID, &msgToMQSingle) + if err != nil { + return nil, err + } + } + + resp.SendTime = msgToMQSingle.MsgData.SendTime + resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID + resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID + return resp, nil +} + +func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) { + promePkg.PromeInc(promePkg.SingleChatMsgRecvSuccessCounter) + if err = CallbackBeforeSendSingleMsg(ctx, req); err != nil { + return nil, err + } + _, err = m.messageVerification(ctx, req) + if err != nil { + return nil, err + } + isSend, err := modifyMessageByUserMessageReceiveOpt(req.MsgData.RecvID, req.MsgData.SendID, constant.SingleChatType, req) + if err != nil { + return nil, err + } + msgToMQSingle := msg.MsgDataToMQ{MsgData: req.MsgData} + if isSend { + err = m.MsgInterface.MsgToMQ(ctx, req.MsgData.RecvID, &msgToMQSingle) + if err != nil { + return nil, constant.ErrInternalServer.Wrap("insert to mq") + } + } + if msgToMQSingle.MsgData.SendID != msgToMQSingle.MsgData.RecvID { //Filter messages sent to yourself + err = m.MsgInterface.MsgToMQ(ctx, req.MsgData.SendID, &msgToMQSingle) + if err != nil { + return nil, constant.ErrInternalServer.Wrap("insert to mq") + } + } + err = CallbackAfterSendSingleMsg(ctx, req) + if err != nil { + return nil, err + } + promePkg.PromeInc(promePkg.SingleChatMsgProcessSuccessCounter) + resp.SendTime = msgToMQSingle.MsgData.SendTime + resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID + resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID + return resp, nil +} + +func (m *msgServer) sendMsgGroupChat(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, err error) { + // callback + promePkg.PromeInc(promePkg.GroupChatMsgRecvSuccessCounter) + err = CallbackBeforeSendGroupMsg(ctx, req) + if err != nil { + return nil, err + } + + var memberUserIDList []string + if memberUserIDList, err = m.messageVerification(ctx, req); err != nil { + promePkg.PromeInc(promePkg.GroupChatMsgProcessFailedCounter) + return nil, err + } + + var addUidList []string + switch req.MsgData.ContentType { + case constant.MemberKickedNotification: + var tips sdkws.TipsComm + var memberKickedTips sdkws.MemberKickedTips + err := proto.Unmarshal(req.MsgData.Content, &tips) + if err != nil { + return nil, err + } + err = proto.Unmarshal(tips.Detail, &memberKickedTips) + if err != nil { + return nil, err + } + for _, v := range memberKickedTips.KickedUserList { + addUidList = append(addUidList, v.UserID) + } + case constant.MemberQuitNotification: + addUidList = append(addUidList, req.MsgData.SendID) + + default: + } + if len(addUidList) > 0 { + memberUserIDList = append(memberUserIDList, addUidList...) + } + + //split parallel send + var wg sync.WaitGroup + var split = 20 + msgToMQSingle := msg.MsgDataToMQ{MsgData: req.MsgData} + mErr := make([]error, 0) + var mutex sync.RWMutex + remain := len(memberUserIDList) % split + for i := 0; i < len(memberUserIDList)/split; i++ { + wg.Add(1) + tmp := valueCopy(req) + go func() { + err := m.sendMsgToGroupOptimization(ctx, memberUserIDList[i*split:(i+1)*split], tmp, &wg) + if err != nil { + mutex.Lock() + mErr = append(mErr, err) + mutex.Unlock() + } + + }() + } + if remain > 0 { + wg.Add(1) + tmp := valueCopy(req) + go m.sendMsgToGroupOptimization(ctx, memberUserIDList[split*(len(memberUserIDList)/split):], tmp, &wg) + } + + wg.Wait() + + // callback + err = CallbackAfterSendGroupMsg(ctx, req) + if err != nil { + return nil, err + } + + for _, v := range mErr { + if v != nil { + return nil, v + } + } + + if req.MsgData.ContentType == constant.AtText { + go func() { + var conversationReq pbConversation.ModifyConversationFieldReq + var tag bool + var atUserID []string + conversation := pbConversation.Conversation{ + OwnerUserID: req.MsgData.SendID, + ConversationID: utils.GetConversationIDBySessionType(req.MsgData.GroupID, constant.GroupChatType), + ConversationType: constant.GroupChatType, + GroupID: req.MsgData.GroupID, + } + conversationReq.Conversation = &conversation + conversationReq.FieldType = constant.FieldGroupAtType + tagAll := utils.IsContain(constant.AtAllString, req.MsgData.AtUserIDList) + if tagAll { + atUserID = utils.DifferenceString([]string{constant.AtAllString}, req.MsgData.AtUserIDList) + if len(atUserID) == 0 { //just @everyone + conversationReq.UserIDList = memberUserIDList + conversation.GroupAtType = constant.AtAll + } else { //@Everyone and @other people + conversationReq.UserIDList = atUserID + conversation.GroupAtType = constant.AtAllAtMe + tag = true + } + } else { + conversationReq.UserIDList = req.MsgData.AtUserIDList + conversation.GroupAtType = constant.AtMe + } + + err := m.Conversation.ModifyConversationField(ctx, &conversationReq) + if err != nil { + return + } + + if tag { + conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList) + conversation.GroupAtType = constant.AtAll + err := m.Conversation.ModifyConversationField(ctx, &conversationReq) + if err != nil { + return + } + } + }() + } + // + + promePkg.PromeInc(promePkg.GroupChatMsgProcessSuccessCounter) + resp.SendTime = msgToMQSingle.MsgData.SendTime + resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID + resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID + return resp, nil +} + +func (m *msgServer) SendMsg(ctx context.Context, req *msg.SendMsgReq) (resp *msg.SendMsgResp, error error) { + resp = &msg.SendMsgResp{} + flag := isMessageHasReadEnabled(req.MsgData) + if !flag { + return nil, constant.ErrMessageHasReadDisable.Wrap() + } + m.encapsulateMsgData(req.MsgData) + if err := CallbackMsgModify(ctx, req); err != nil { + return nil, err + } + switch req.MsgData.SessionType { + case constant.SingleChatType: + return m.sendMsgSingleChat(ctx, req) + case constant.GroupChatType: + return m.sendMsgGroupChat(ctx, req) + case constant.NotificationChatType: + return m.sendMsgNotification(ctx, req) + case constant.SuperGroupChatType: + return m.sendMsgSuperGroupChat(ctx, req) + default: + return nil, constant.ErrArgs.Wrap("unknown sessionType") + } +} + +func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMinSeqReq) (*sdkws.GetMaxAndMinSeqResp, error) { + resp := new(sdkws.GetMaxAndMinSeqResp) + m2 := make(map[string]*sdkws.MaxAndMinSeq) + maxSeq, err := m.MsgInterface.GetUserMaxSeq(ctx, req.UserID) + if err != nil { + return nil, err + } + minSeq, err := m.MsgInterface.GetUserMinSeq(ctx, req.UserID) + if err != nil { + return nil, err + } + resp.MaxSeq = maxSeq + resp.MinSeq = minSeq + if len(req.GroupIDList) > 0 { + resp.GroupMaxAndMinSeq = make(map[string]*sdkws.MaxAndMinSeq) + for _, groupID := range req.GroupIDList { + maxSeq, err := m.MsgInterface.GetGroupMaxSeq(ctx, groupID) + if err != nil { + return nil, err + } + minSeq, err := m.MsgInterface.GetGroupMinSeq(ctx, groupID) + if err != nil { + return nil, err + } + m2[groupID] = &sdkws.MaxAndMinSeq{ + MaxSeq: maxSeq, + MinSeq: minSeq, + } + } + } + return resp, nil +} + +func (m *msgServer) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) { + resp := &sdkws.PullMessageBySeqListResp{GroupMsgDataList: make(map[string]*sdkws.MsgDataList)} + msgs, err := m.MsgInterface.GetMessageListBySeq(ctx, req.UserID, req.SeqList) + if err != nil { + return nil, err + } + resp.List = msgs + for userID, list := range req.GroupSeqList { + msgs, err := m.MsgInterface.GetMessageListBySeq(ctx, userID, list.SeqList) + if err != nil { + return nil, err + } + resp.GroupMsgDataList[userID] = &sdkws.MsgDataList{ + MsgDataList: msgs, + } + } + return resp, nil +} diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go new file mode 100644 index 000000000..1700d4e72 --- /dev/null +++ b/internal/rpc/msg/server.go @@ -0,0 +1,72 @@ +package msg + +import ( + "Open_IM/internal/common/check" + "Open_IM/pkg/common/db/controller" + "Open_IM/pkg/common/db/localcache" + "Open_IM/pkg/common/db/relation" + tablerelation "Open_IM/pkg/common/db/table/relation" + discoveryRegistry "Open_IM/pkg/discoveryregistry" + "github.com/OpenIMSDK/openKeeper" + + promePkg "Open_IM/pkg/common/prometheus" + "Open_IM/pkg/proto/msg" + "google.golang.org/grpc" +) + +type msgServer struct { + RegisterCenter discoveryRegistry.SvcDiscoveryRegistry + MsgInterface controller.MsgInterface + Group *check.GroupChecker + User *check.UserCheck + Conversation *check.ConversationChecker + friend *check.FriendChecker + *localcache.GroupLocalCache + black *check.BlackChecker +} + +type deleteMsg struct { + UserID string + OpUserID string + SeqList []uint32 + OperationID string +} + +func Start(client *openKeeper.ZkClient, server *grpc.Server) error { + mysql, err := relation.NewGormDB() + if err != nil { + return err + } + if err := mysql.AutoMigrate(&tablerelation.UserModel{}); err != nil { + return err + } + s := &msgServer{ + Conversation: check.NewConversationChecker(client), + User: check.NewUserCheck(client), + Group: check.NewGroupChecker(client), + //MsgInterface: controller.MsgInterface(), + RegisterCenter: client, + GroupLocalCache: localcache.NewGroupMemberIDsLocalCache(client), + black: check.NewBlackChecker(client), + friend: check.NewFriendChecker(client), + } + s.initPrometheus() + msg.RegisterMsgServer(server, s) + return nil +} + +func (m *msgServer) initPrometheus() { + promePkg.NewMsgPullFromRedisSuccessCounter() + promePkg.NewMsgPullFromRedisFailedCounter() + promePkg.NewMsgPullFromMongoSuccessCounter() + promePkg.NewMsgPullFromMongoFailedCounter() + promePkg.NewSingleChatMsgRecvSuccessCounter() + promePkg.NewGroupChatMsgRecvSuccessCounter() + promePkg.NewWorkSuperGroupChatMsgRecvSuccessCounter() + promePkg.NewSingleChatMsgProcessSuccessCounter() + promePkg.NewSingleChatMsgProcessFailedCounter() + promePkg.NewGroupChatMsgProcessSuccessCounter() + promePkg.NewGroupChatMsgProcessFailedCounter() + promePkg.NewWorkSuperGroupChatMsgProcessSuccessCounter() + promePkg.NewWorkSuperGroupChatMsgProcessFailedCounter() +} diff --git a/internal/rpc/msg/utils.go b/internal/rpc/msg/utils.go new file mode 100644 index 000000000..3582bd8f5 --- /dev/null +++ b/internal/rpc/msg/utils.go @@ -0,0 +1,37 @@ +package msg + +import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/proto/sdkws" + "Open_IM/pkg/utils" + "github.com/go-redis/redis/v8" + "gorm.io/gorm" +) + +func isMessageHasReadEnabled(msgData *sdkws.MsgData) bool { + switch msgData.ContentType { + case constant.HasReadReceipt: + if config.Config.SingleMessageHasReadReceiptEnable { + return true + } else { + return false + } + case constant.GroupHasReadReceipt: + if config.Config.GroupMessageHasReadReceiptEnable { + return true + } else { + return false + } + } + return true +} + +func IsNotFound(err error) bool { + switch utils.Unwrap(err) { + case redis.Nil, gorm.ErrRecordNotFound: + return true + default: + return false + } +} diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index ae76f30bd..72ed92759 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -1,187 +1,49 @@ package user import ( + "Open_IM/internal/common/check" "Open_IM/internal/common/convert" - "Open_IM/internal/common/rpc_server" - "Open_IM/internal/common/rpcserver" - chat "Open_IM/internal/rpc/msg" - "Open_IM/pkg/common/config" + "Open_IM/internal/common/notification" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/controller" "Open_IM/pkg/common/db/relation" tablerelation "Open_IM/pkg/common/db/table/relation" - "Open_IM/pkg/common/log" - prome "Open_IM/pkg/common/prometheus" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" + discoveryRegistry "Open_IM/pkg/discoveryregistry" "Open_IM/pkg/proto/sdkws" pbuser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - + "github.com/OpenIMSDK/openKeeper" "google.golang.org/grpc" ) type userServer struct { - rpcPort int - rpcRegisterName string - *rpcserver.RpcServer controller.UserInterface + notification *notification.Check + userCheck *check.UserCheck + ConversationChecker *check.ConversationChecker + RegisterCenter discoveryRegistry.SvcDiscoveryRegistry } -func NewUserServer(port int) *userServer { - r, err := rpcserver.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImUserName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema) +func Start(client *openKeeper.ZkClient, server *grpc.Server) error { + mysql, err := relation.NewGormDB() if err != nil { - panic(err) + return err } - //mysql init - var mysql relation.Mysql - var model relation.UserGorm - err = mysql.InitConn().AutoMigrateModel(&model) - if err != nil { - panic("db init err:" + err.Error()) + if err := mysql.AutoMigrate(&tablerelation.UserModel{}); err != nil { + return err } - if mysql.GormConn() != nil { - model.DB = mysql.GormConn() - } else { - panic("db init err:" + "conn is nil") - } - return &userServer{RpcServer: r, UserInterface: controller.NewUserController(model.DB)} + pbuser.RegisterUserServer(server, &userServer{ + UserInterface: controller.NewUserController(mysql), + notification: notification.NewCheck(client), + userCheck: check.NewUserCheck(client), + RegisterCenter: client, + }) + return nil } -func (s *userServer) Run() { - operationID := utils.OperationIDGenerator() - log.NewInfo(operationID, "rpc user start...") - listener, address, err := rpcserver.GetTcpListen(config.Config.ListenIP, s.Port) - if err != nil { - panic(err) - } - log.NewInfo(operationID, "listen ok ", address) - defer listener.Close() - //grpc server - var grpcOpts []grpc.ServerOption - if config.Config.Prometheus.Enable { - prome.NewGrpcRequestCounter() - prome.NewGrpcRequestFailedCounter() - prome.NewGrpcRequestSuccessCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(prome.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - //Service registers with etcd - pbuser.RegisterUserServer(srv, s) - - err = srv.Serve(listener) - if err != nil { - panic(err) - } - log.NewInfo(operationID, "rpc user success") -} - -// ok -//func (s *userServer) SyncJoinedGroupMemberFaceURL(ctx context.Context, userID string, faceURL string, operationID string, opUserID string) { -// members, err := s.GetJoinedGroupMembers(ctx, userID) -// if err != nil { -// return -// } -// groupIDs := make([]string, 0) -// for _, v := range members { -// groupIDs = append(groupIDs, v.GroupID) -// } -// if s.SetGroupMemberInfo(ctx, "", faceURL, "", 0, groupIDs, userID) != nil { -// return -// } -// for _, v := range groupIDs { -// chat.GroupMemberInfoSetNotification(operationID, opUserID, v, userID) -// } -//} - -// ok -//func (s *userServer) SyncJoinedGroupMemberNickname(ctx context.Context, userID string, newNickname, oldNickname string, operationID string, opUserID string) { -// members, err := s.GetJoinedGroupMembers(ctx, userID) -// if err != nil { -// return -// } -// groupIDs := make([]string, 0) -// for _, v := range members { -// if v.Nickname == oldNickname { -// groupIDs = append(groupIDs, v.GroupID) -// } -// } -// s.SetGroupMemberInfo(ctx, newNickname, "", "", 0, groupIDs, userID) -// for _, v := range groupIDs { -// chat.GroupMemberInfoSetNotification(operationID, opUserID, v, userID) -// } -//} - -// 设置群头像 -//func (s *userServer) SetGroupMemberInfo(ctx context.Context, nickname, faceURL, ex string, roleLevel int32, groupIDs []string, userID string) (err error) { -// -// req := pbgroup.SetGroupMemberInfo{UserID: userID} -// if nickname != "" { -// req.Nickname = &wrappers.StringValue{Value: nickname} -// } -// if faceURL != "" { -// req.FaceURL = &wrappers.StringValue{Value: faceURL} -// } -// if ex != "" { -// req.Ex = &wrappers.StringValue{Value: ex} -// } -// if roleLevel != 0 { -// req.RoleLevel = &wrappers.Int32Value{Value: roleLevel} -// } -// -// setGroupMemberInfoReq := &pbgroup.SetGroupMemberInfoReq{} -// for _, v := range groupIDs { -// req.GroupID = v -// setGroupMemberInfoReq.Members = append(setGroupMemberInfoReq.Members, &req) -// } -// conn, err := s.RegisterCenter.GetConn(config.Config.RpcRegisterName.OpenImGroupName) -// if err != nil { -// return err -// } -// client := group.NewGroupClient(conn) -// _, err = client.SetGroupMemberInfo(ctx, setGroupMemberInfoReq) -// return -//} - -// 获取加入的群成员信息 -//func (s *userServer) GetJoinedGroupMembers(ctx context.Context, userID string) (members []*sdkws.GroupMemberFullInfo, err error) { -// conn, err := s.RegisterCenter.GetConn(config.Config.RpcRegisterName.OpenImGroupName) -// if err != nil { -// return nil, err -// } -// -// client := group.NewGroupClient(conn) -// for { -// idx := int32(0) -// req := pbgroup.GetJoinedGroupListReq{FromUserID: userID, Pagination: &sdkws.RequestPagination{PageNumber: idx, ShowNumber: constant.ShowNumber}} -// resp, err := client.GetJoinedGroupList(ctx, &req) -// if err != nil { -// return nil, err -// } -// groupIDs := make([]string, 0) -// -// for _, v := range resp.Groups { -// groupIDs = append(groupIDs, v.GroupID) -// } -// -// client.GetGroupMembersInfo() -// -// if len(resp.Groups) < constant.ShowNumber { -// break -// } -// idx++ -// } -// -// return -//} - // ok func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbuser.GetDesignateUsersReq) (resp *pbuser.GetDesignateUsersResp, err error) { resp = &pbuser.GetDesignateUsersResp{} @@ -229,11 +91,11 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI } go func() { for _, v := range friends { - chat.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, v.FriendUser.UserID, tracelog.GetOpUserID(ctx)) + s.notification.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, v.FriendUser.UserID, tracelog.GetOpUserID(ctx)) } }() - chat.UserInfoUpdatedNotification(ctx, tracelog.GetOpUserID(ctx), req.UserInfo.UserID) + s.notification.UserInfoUpdatedNotification(ctx, tracelog.GetOpUserID(ctx), req.UserInfo.UserID) return resp, nil } @@ -249,7 +111,7 @@ func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.Se if err := s.UpdateByMap(ctx, req.UserID, m); err != nil { return nil, err } - chat.UserInfoUpdatedNotification(ctx, req.UserID, req.UserID) + s.notification.UserInfoUpdatedNotification(ctx, req.UserID, req.UserID) return resp, nil } diff --git a/internal/startrpc/start.go b/internal/startrpc/start.go new file mode 100644 index 000000000..1a487d2b7 --- /dev/null +++ b/internal/startrpc/start.go @@ -0,0 +1,67 @@ +package startrpc + +import ( + "Open_IM/internal/common/network" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/middleware" + promePkg "Open_IM/pkg/common/prometheus" + "flag" + "fmt" + "github.com/OpenIMSDK/openKeeper" + grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "google.golang.org/grpc" + "net" +) + +func start(rpcPorts []int, rpcRegisterName string, prometheusPorts []int, rpcFn func(client *openKeeper.ZkClient, server *grpc.Server) error, options []grpc.ServerOption) error { + flagRpcPort := flag.Int("port", rpcPorts[0], "get RpcGroupPort from cmd,default 16000 as port") + flagPrometheusPort := flag.Int("prometheus_port", prometheusPorts[0], "groupPrometheusPort default listen port") + flag.Parse() + fmt.Println("start group rpc server, port: ", *flagRpcPort, ", OpenIM version: ", constant.CurrentVersion) + log.NewPrivateLog(constant.LogFileName) + listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", config.Config.ListenIP, *flagRpcPort)) + if err != nil { + return err + } + defer listener.Close() + zkClient, err := openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema, 10, "", "") + if err != nil { + return err + } + defer zkClient.Close() + registerIP, err := network.GetRpcRegisterIP(config.Config.RpcRegisterIP) + if err != nil { + return err + } + options = append(options, grpc.UnaryInterceptor(middleware.RpcServerInterceptor)) // ctx 中间件 + if config.Config.Prometheus.Enable { + promePkg.NewGrpcRequestCounter() + promePkg.NewGrpcRequestFailedCounter() + promePkg.NewGrpcRequestSuccessCounter() + options = append(options, []grpc.ServerOption{ + // grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme), + grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), + grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), + }...) + } + srv := grpc.NewServer(options...) + defer srv.GracefulStop() + err = zkClient.Register(rpcRegisterName, registerIP, *flagRpcPort) + if err != nil { + return err + } + if config.Config.Prometheus.Enable { + err := promePkg.StartPromeSrv(*flagPrometheusPort) + if err != nil { + return err + } + } + return rpcFn(zkClient, srv) +} + +func Start(rpcPorts []int, rpcRegisterName string, prometheusPorts []int, rpcFn func(client *openKeeper.ZkClient, server *grpc.Server) error, options ...grpc.ServerOption) { + err := start(rpcPorts, rpcRegisterName, prometheusPorts, rpcFn, options) + fmt.Println("end", err) +} diff --git a/pkg/callbackstruct/common.go b/pkg/callbackstruct/common.go index 8c96a132d..d7d590bd1 100644 --- a/pkg/callbackstruct/common.go +++ b/pkg/callbackstruct/common.go @@ -25,35 +25,45 @@ type CommonCallbackReq struct { Ex string `json:"ex"` } +func (c *CommonCallbackReq) GetCallbackCommand() string { + return c.CallbackCommand +} + +type CallbackReq interface { + GetCallbackCommand() string +} + type CallbackResp interface { Parse() (err error) } type CommonCallbackResp struct { - ActionCode int `json:"actionCode"` - ErrCode int32 `json:"errCode"` - ErrMsg string `json:"errMsg"` - OperationID string `json:"operationID"` + ActionCode int `json:"actionCode"` + ErrCode int32 `json:"errCode"` + ErrMsg string `json:"errMsg"` } -func (c *CommonCallbackResp) Parse() (err error) { +func (c CommonCallbackResp) Parse() error { if c.ActionCode != constant.NoError || c.ErrCode != constant.NoError { newErr := constant.ErrCallback newErr.ErrCode = c.ErrCode newErr.DetailErrMsg = fmt.Sprintf("callback response error actionCode is %d, errCode is %d, errMsg is %s", c.ActionCode, c.ErrCode, c.ErrMsg) - err = newErr - return + return newErr.Wrap() } - return + return nil } type UserStatusBaseCallback struct { CallbackCommand string `json:"callbackCommand"` OperationID string `json:"operationID"` - PlatformID int32 `json:"platformID"` + PlatformID int `json:"platformID"` Platform string `json:"platform"` } +func (c UserStatusBaseCallback) GetCallbackCommand() string { + return c.CallbackCommand +} + type UserStatusCallbackReq struct { UserStatusBaseCallback UserID string `json:"userID"` diff --git a/pkg/callbackstruct/friend.go b/pkg/callbackstruct/friend.go index fa1cffe28..ebb661a18 100644 --- a/pkg/callbackstruct/friend.go +++ b/pkg/callbackstruct/friend.go @@ -1,7 +1,7 @@ package callbackstruct type CallbackBeforeAddFriendReq struct { - CallbackCommand string `json:"callbackCommand"` + CallbackCommand `json:"callbackCommand"` FromUserID string `json:"fromUserID" ` ToUserID string `json:"toUserID"` ReqMsg string `json:"reqMsg"` @@ -9,5 +9,5 @@ type CallbackBeforeAddFriendReq struct { } type CallbackBeforeAddFriendResp struct { - *CommonCallbackResp + CommonCallbackResp } diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go index e504151c1..136386297 100644 --- a/pkg/callbackstruct/group.go +++ b/pkg/callbackstruct/group.go @@ -1,19 +1,25 @@ package callbackstruct import ( - "Open_IM/pkg/proto/group" + "Open_IM/pkg/apistruct" common "Open_IM/pkg/proto/sdkws" ) +type CallbackCommand string + +func (c CallbackCommand) GetCallbackCommand() string { + return string(c) +} + type CallbackBeforeCreateGroupReq struct { - CallbackCommand string `json:"callbackCommand"` OperationID string `json:"operationID"` + CallbackCommand `json:"callbackCommand"` common.GroupInfo - InitMemberList []*group.GroupAddMemberInfo `json:"initMemberList"` + InitMemberList []*apistruct.GroupAddMemberInfo `json:"initMemberList"` } type CallbackBeforeCreateGroupResp struct { - *CommonCallbackResp + CommonCallbackResp GroupID *string `json:"groupID"` GroupName *string `json:"groupName"` Notification *string `json:"notification"` @@ -30,7 +36,7 @@ type CallbackBeforeCreateGroupResp struct { } type CallbackBeforeMemberJoinGroupReq struct { - CallbackCommand string `json:"callbackCommand"` + CallbackCommand `json:"callbackCommand"` OperationID string `json:"operationID"` GroupID string `json:"groupID"` UserID string `json:"userID"` @@ -39,8 +45,8 @@ type CallbackBeforeMemberJoinGroupReq struct { } type CallbackBeforeMemberJoinGroupResp struct { - *CommonCallbackResp - NickName *string `json:"nickName"` + CommonCallbackResp + Nickname *string `json:"nickname"` FaceURL *string `json:"faceURL"` RoleLevel *int32 `json:"roleLevel"` MuteEndTime *int64 `json:"muteEndTime"` @@ -48,18 +54,18 @@ type CallbackBeforeMemberJoinGroupResp struct { } type CallbackBeforeSetGroupMemberInfoReq struct { - CallbackCommand string `json:"callbackCommand"` - OperationID string `json:"operationID"` - GroupID string `json:"groupID"` - UserID string `json:"userID"` - Nickname string `json:"nickName"` - FaceURL string `json:"faceURL"` - RoleLevel int32 `json:"roleLevel"` - Ex string `json:"ex"` + CallbackCommand `json:"callbackCommand"` + OperationID string `json:"operationID"` + GroupID string `json:"groupID"` + UserID string `json:"userID"` + Nickname *string `json:"nickName"` + FaceURL *string `json:"faceURL"` + RoleLevel *int32 `json:"roleLevel"` + Ex *string `json:"ex"` } type CallbackBeforeSetGroupMemberInfoResp struct { - *CommonCallbackResp + CommonCallbackResp Ex *string `json:"ex"` Nickname *string `json:"nickName"` FaceURL *string `json:"faceURL"` diff --git a/pkg/callbackstruct/message.go b/pkg/callbackstruct/message.go index efb26f4a3..ce8d72629 100644 --- a/pkg/callbackstruct/message.go +++ b/pkg/callbackstruct/message.go @@ -11,7 +11,7 @@ type CallbackBeforeSendSingleMsgReq struct { } type CallbackBeforeSendSingleMsgResp struct { - *CommonCallbackResp + CommonCallbackResp } type CallbackAfterSendSingleMsgReq struct { @@ -20,7 +20,7 @@ type CallbackAfterSendSingleMsgReq struct { } type CallbackAfterSendSingleMsgResp struct { - *CommonCallbackResp + CommonCallbackResp } type CallbackBeforeSendGroupMsgReq struct { @@ -29,7 +29,7 @@ type CallbackBeforeSendGroupMsgReq struct { } type CallbackBeforeSendGroupMsgResp struct { - *CommonCallbackResp + CommonCallbackResp } type CallbackAfterSendGroupMsgReq struct { @@ -38,7 +38,7 @@ type CallbackAfterSendGroupMsgReq struct { } type CallbackAfterSendGroupMsgResp struct { - *CommonCallbackResp + CommonCallbackResp } type CallbackMsgModifyCommandReq struct { @@ -46,7 +46,7 @@ type CallbackMsgModifyCommandReq struct { } type CallbackMsgModifyCommandResp struct { - *CommonCallbackResp + CommonCallbackResp Content *string `json:"content"` RecvID *string `json:"recvID"` GroupID *string `json:"groupID"` @@ -67,8 +67,8 @@ type CallbackMsgModifyCommandResp struct { Ex *string `json:"ex"` } type CallbackBeforeSetMessageReactionExtReq struct { - OperationID string `json:"operationID"` - CallbackCommand string `json:"callbackCommand"` + OperationID string `json:"operationID"` + CallbackCommand `json:"callbackCommand"` SourceID string `json:"sourceID"` OpUserID string `json:"opUserID"` SessionType int32 `json:"sessionType"` @@ -79,13 +79,13 @@ type CallbackBeforeSetMessageReactionExtReq struct { MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type CallbackBeforeSetMessageReactionExtResp struct { - *CommonCallbackResp + CommonCallbackResp ResultReactionExtensionList []*msg.KeyValueResp `json:"resultReactionExtensionList"` MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type CallbackDeleteMessageReactionExtReq struct { + CallbackCommand `json:"callbackCommand"` OperationID string `json:"operationID"` - CallbackCommand string `json:"callbackCommand"` SourceID string `json:"sourceID"` OpUserID string `json:"opUserID"` SessionType int32 `json:"sessionType"` @@ -95,7 +95,7 @@ type CallbackDeleteMessageReactionExtReq struct { MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } type CallbackDeleteMessageReactionExtResp struct { - *CommonCallbackResp + CommonCallbackResp ResultReactionExtensionList []*msg.KeyValueResp `json:"resultReactionExtensionList"` MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } diff --git a/pkg/callbackstruct/msg_gateway.go b/pkg/callbackstruct/msg_gateway.go index 02509ac3f..48605e791 100644 --- a/pkg/callbackstruct/msg_gateway.go +++ b/pkg/callbackstruct/msg_gateway.go @@ -2,31 +2,31 @@ package callbackstruct type CallbackUserOnlineReq struct { UserStatusCallbackReq - Token string `json:"token"` - Seq int `json:"seq"` + //Token string `json:"token"` + Seq int64 `json:"seq"` IsAppBackground bool `json:"isAppBackground"` ConnID string `json:"connID"` } type CallbackUserOnlineResp struct { - *CommonCallbackResp + CommonCallbackResp } type CallbackUserOfflineReq struct { UserStatusCallbackReq - Seq int `json:"seq"` + Seq int64 `json:"seq"` ConnID string `json:"connID"` } type CallbackUserOfflineResp struct { - *CommonCallbackResp + CommonCallbackResp } type CallbackUserKickOffReq struct { UserStatusCallbackReq - Seq int `json:"seq"` + Seq int64 `json:"seq"` } type CallbackUserKickOffResp struct { - *CommonCallbackResp + CommonCallbackResp } diff --git a/pkg/callbackstruct/push.go b/pkg/callbackstruct/push.go index 483a2dffb..9a686b011 100644 --- a/pkg/callbackstruct/push.go +++ b/pkg/callbackstruct/push.go @@ -15,7 +15,7 @@ type CallbackBeforePushReq struct { } type CallbackBeforePushResp struct { - *CommonCallbackResp + CommonCallbackResp UserIDList []string `json:"userIDList"` OfflinePushInfo *common.OfflinePushInfo `json:"offlinePushInfo"` } @@ -34,7 +34,7 @@ type CallbackBeforeSuperGroupOnlinePushReq struct { } type CallbackBeforeSuperGroupOnlinePushResp struct { - *CommonCallbackResp + CommonCallbackResp UserIDList []string `json:"userIDList"` OfflinePushInfo *common.OfflinePushInfo `json:"offlinePushInfo"` } diff --git a/pkg/common/constant/errors.go b/pkg/common/constant/errors.go index 8dc933b22..b998fc71d 100644 --- a/pkg/common/constant/errors.go +++ b/pkg/common/constant/errors.go @@ -13,6 +13,8 @@ var ( ErrUserIDNotFound = &ErrInfo{UserIDNotFoundError, "UserIDNotFoundError", ""} ErrGroupIDNotFound = &ErrInfo{GroupIDNotFoundError, "GroupIDNotFoundError", ""} + ErrGroupIDExisted = &ErrInfo{GroupIDNotFoundError, "GroupIDExisted", ""} // todo group id 已存在 + ErrGroupIDExisted = &ErrInfo{GroupIDNotFoundError, "GroupIDExisted", ""} // todo group id 已存在 ErrRecordNotFound = &ErrInfo{RecordNotFoundError, "RecordNotFoundError", ""} @@ -45,6 +47,13 @@ var ( ErrDB = ErrDatabase ErrSendLimit = ErrInternalServer + + ErrBlockedByPeer = &ErrInfo{BlockedByPeer, "BlockedByPeer", ""} + //不是对方的好友 + ErrNotPeersFriend = &ErrInfo{NotPeersFriend, "NotPeersFriend", ""} + // + ErrMutedInGroup = &ErrInfo{MutedInGroup, "MutedInGroup", ""} + ErrMutedGroup = &ErrInfo{MutedGroup, "MutedGroup", ""} ) const ( @@ -92,6 +101,8 @@ const ( RelationshipAlreadyError = 92001 //已经是好友关系(或者黑名单) NotRelationshipYetError = 92002 //不是好友关系(或者黑名单) CanNotAddYourselfError = 92003 //不能添加自己为好友 + BlockedByPeer = 92004 //被对方拉黑 + NotPeersFriend = 92005 //不是对方的好友 ) // 群组错误码 @@ -103,6 +114,9 @@ const ( OwnerNotAllowedQuitError = 93004 //群主不能退群 GroupTypeNotSupport = 93005 GroupNoOwner = 93006 + + MutedInGroup = 93007 //群成员被禁言 + MutedGroup = 93008 //群被禁言 ) // 用户错误码 diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index b75a0aca4..0491d36c7 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -20,21 +20,25 @@ const ( superGroupRecvMsgNotNotifyUserIDsKey = "SUPER_GROUP_RECV_MSG_NOT_NOTIFY_USER_IDS:" conversationExpireTime = time.Second * 60 * 60 * 12 ) +type FuncDB func() (string, error) // arg fn will exec when no data in cache type ConversationCache interface { // get user's conversationIDs from cache - GetUserConversationIDs(ctx context.Context, userID string, fn func(ctx context.Context, userID string) ([]string, error)) ([]string, error) + GetUserConversationIDs(ctx context.Context, userID string, fn FuncDB) ([]string, error) // del user's conversationIDs from cache, call when a user add or reduce a conversation DelUserConversationIDs(ctx context.Context, userID string) error + DelUsersConversationIDs(ctx context.Context,userIDList []string)error // get one conversation from cache - GetConversation(ctx context.Context, ownerUserID, conversationID string, fn func(ctx context.Context, ownerUserID, conversationID string) (*relationTb.ConversationModel, error)) (*relationTb.ConversationModel, error) + GetConversation(ctx context.Context, ownerUserID, conversationID string, fn FuncDB) (*relationTb.ConversationModel, error) // get one conversation from cache - GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string, fn func(ctx context.Context, ownerUserID, conversationIDs []string) ([]*relationTb.ConversationModel, error)) ([]*relationTb.ConversationModel, error) + GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string, fn FuncDB)([]*relationTb.ConversationModel, error) // get one user's all conversations from cache - GetUserAllConversations(ctx context.Context, ownerUserID string, fn func(ctx context.Context, ownerUserIDs string) ([]*relationTb.ConversationModel, error)) ([]*relationTb.ConversationModel, error) + GetUserAllConversations(ctx context.Context, ownerUserID string, fn FuncDB ) ([]*relationTb.ConversationModel, error) // del one conversation from cache, call when one user's conversation Info changed DelConversation(ctx context.Context, ownerUserID, conversationID string) error + DelUserConversations(ctx context.Context, ownerUserID string, conversationIDList []string) error + DelUsersConversation(ctx context.Context, ownerUserIDList []string, conversationID string) error // get user conversation recv msg from cache GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string, fn func(ctx context.Context, ownerUserID, conversationID string) (opt int, err error)) (opt int, err error) // del user recv msg opt from cache, call when user's conversation recv msg opt changed @@ -51,6 +55,38 @@ type ConversationRedis struct { rcClient *rockscache.Client } +func (c *ConversationRedis) GetUserConversationIDs(ctx context.Context, userID string, fn func(ctx context.Context, userID string) ([]string, error)) ([]string, error) { + panic("implement me") +} + +func (c *ConversationRedis) DelUsersConversationIDs(ctx context.Context, userIDList []string) error { + panic("implement me") +} + +func (c *ConversationRedis) GetConversation(ctx context.Context, ownerUserID, conversationID string, fn func(ctx context.Context, ownerUserID string, conversationID string) (*relationTb.ConversationModel, error)) (*relationTb.ConversationModel, error) { + panic("implement me") +} + +func (c *ConversationRedis) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string, fn FuncDB) ([]*relationTb.ConversationModel, error) { + panic("implement me") +} + +func (c *ConversationRedis) GetUserAllConversations(ctx context.Context, ownerUserID string, fn FuncDB) ([]*relationTb.ConversationModel, error) { + panic("implement me") +} + +func (c *ConversationRedis) DelUsersConversation(ctx context.Context, ownerUserIDList []string, conversationID string) error { + panic("implement me") +} + +func (c *ConversationRedis) GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string, fn func(ctx context.Context, ownerUserID string, conversationID string) (opt int, err error)) (opt int, err error) { + panic("implement me") +} + +func (c *ConversationRedis) GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string, fn func(ctx context.Context, groupID string) (userIDs []string, err error)) (userIDs []string, err error) { + panic("implement me") +} + func NewConversationRedis(rcClient *rockscache.Client) *ConversationRedis { return &ConversationRedis{rcClient: rcClient} } diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index 8376a1d56..0e8322f0d 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -1,17 +1,14 @@ package cache import ( - "Open_IM/pkg/common/db/relation" relationTb "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/db/unrelation" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" - "encoding/json" "github.com/dtm-labs/rockscache" "github.com/go-redis/redis/v8" "math/big" - "strconv" "strings" "time" ) @@ -157,6 +154,27 @@ func (g *GroupCacheRedis) GetGroupMembersHash(ctx context.Context, groupID strin }) } +func (g *GroupCacheRedis) GetGroupMemberHash1(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) { + // todo + mapGroupUserIDs, err := g.groupMember.FindJoinUserID(ctx, groupIDs) + if err != nil { + return nil, err + } + res := make(map[string]*relationTb.GroupSimpleUserID) + for _, groupID := range groupIDs { + userIDs := mapGroupUserIDs[groupID] + users := &relationTb.GroupSimpleUserID{} + if len(userIDs) > 0 { + utils.Sort(userIDs, true) + bi := big.NewInt(0) + bi.SetString(utils.Md5(strings.Join(userIDs, ";"))[0:8], 16) + users.Hash = bi.Uint64() + } + res[groupID] = users + } + return res, nil +} + func (g *GroupCacheRedis) DelGroupMembersHash(ctx context.Context, groupID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) @@ -178,111 +196,104 @@ func (g *GroupCacheRedis) DelGroupMemberIDs(ctx context.Context, groupID string) return g.rcClient.TagAsDeleted(g.getGroupMemberIDsKey(groupID)) } -// JoinedGroups -func (g *GroupCacheRedis) GetJoinedGroupIDs(ctx context.Context, userID string) (joinedGroupIDs []string, err error) { - getJoinedGroupIDList := func() (string, error) { - joinedGroupList, err := relation.GetJoinedGroupIDListByUserID(userID) - if err != nil { - return "", err - } - bytes, err := json.Marshal(joinedGroupList) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedGroupIDs", joinedGroupIDs) - }() - joinedGroupIDListStr, err := g.rcClient.Fetch(g.getJoinedGroupsKey(userID), time.Second*30*60, getJoinedGroupIDList) - if err != nil { - return nil, err - } - err = json.Unmarshal([]byte(joinedGroupIDListStr), &joinedGroupIDs) - return joinedGroupIDs, utils.Wrap(err, "") -} +//// JoinedGroups +//func (g *GroupCacheRedis) GetJoinedGroupIDs(ctx context.Context, userID string) (joinedGroupIDs []string, err error) { +// getJoinedGroupIDList := func() (string, error) { +// joinedGroupList, err := relation.GetJoinedGroupIDListByUserID(userID) +// if err != nil { +// return "", err +// } +// bytes, err := json.Marshal(joinedGroupList) +// if err != nil { +// return "", utils.Wrap(err, "") +// } +// return string(bytes), nil +// } +// defer func() { +// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedGroupIDs", joinedGroupIDs) +// }() +// joinedGroupIDListStr, err := g.rcClient.Fetch(g.getJoinedGroupsKey(userID), time.Second*30*60, getJoinedGroupIDList) +// if err != nil { +// return nil, err +// } +// err = json.Unmarshal([]byte(joinedGroupIDListStr), &joinedGroupIDs) +// return joinedGroupIDs, utils.Wrap(err, "") +//} -func (g *GroupCacheRedis) DelJoinedGroupIDs(ctx context.Context, userID string) (err error) { +func (g *GroupCacheRedis) DelJoinedGroupID(ctx context.Context, userID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) }() return g.rcClient.TagAsDeleted(g.getJoinedGroupsKey(userID)) } -// GetGroupMemberInfo -func (g *GroupCacheRedis) GetGroupMemberInfo(ctx context.Context, groupID, userID string) (groupMember *relation.GroupMember, err error) { - getGroupMemberInfo := func() (string, error) { - groupMemberInfo, err := relation.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) - if err != nil { - return "", err - } - bytes, err := json.Marshal(groupMemberInfo) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember) - }() - groupMemberInfoStr, err := g.rcClient.Fetch(g.getGroupMemberInfoKey(groupID, userID), time.Second*30*60, getGroupMemberInfo) - if err != nil { - return nil, err - } - groupMember = &relation.GroupMember{} - err = json.Unmarshal([]byte(groupMemberInfoStr), groupMember) - return groupMember, utils.Wrap(err, "") +//func (g *GroupCacheRedis) DelJoinedGroupIDs(ctx context.Context, userIDs []string) (err error) { +// defer func() { +// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) +// }() +// for _, userID := range userIDs { +// if err := g.DelJoinedGroupID(ctx, userID); err != nil { +// return err +// } +// } +// return nil +//} + +func (g *GroupCacheRedis) GetGroupMemberInfo(ctx context.Context, groupID, userID string) (groupMember *relationTb.GroupMemberModel, err error) { + return GetCache(ctx, g.rcClient, g.getGroupMemberInfoKey(groupID, userID), g.expireTime, func(ctx context.Context) (*relationTb.GroupMemberModel, error) { + return g.groupMember.Take(ctx, groupID, userID) + }) } -func (g *GroupCacheRedis) GetGroupMembersInfo(ctx context.Context, groupID, userIDs []string) (groupMember *relationTb.GroupMemberModel, err error) { +//func (g *GroupCacheRedis) GetGroupMembersInfo(ctx context.Context, groupID, userIDs []string) (groupMember *relationTb.GroupMemberModel, err error) { +// +// return nil, err +//} - return nil, err -} - -func (g *GroupCacheRedis) GetGroupMembersInfo(ctx context.Context, count, offset int32, groupID string) (groupMembers []*relation.GroupMember, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "count", count, "offset", offset, "groupID", groupID, "groupMember", groupMembers) - }() - groupMemberIDList, err := g.GetGroupMemberIDs(ctx, groupID) - if err != nil { - return nil, err - } - if count < 0 || offset < 0 { - return nil, nil - } - var groupMemberList []*relation.GroupMember - var start, stop int32 - start = offset - stop = offset + count - l := int32(len(groupMemberIDList)) - if start > stop { - return nil, nil - } - if start >= l { - return nil, nil - } - if count != 0 { - if stop >= l { - stop = l - } - groupMemberIDList = groupMemberIDList[start:stop] - } else { - if l < 1000 { - stop = l - } else { - stop = 1000 - } - groupMemberIDList = groupMemberIDList[start:stop] - } - for _, userID := range groupMemberIDList { - groupMember, err := g.GetGroupMemberInfo(ctx, groupID, userID) - if err != nil { - return - } - groupMembers = append(groupMembers, groupMember) - } - return groupMemberList, nil -} +//func (g *GroupCacheRedis) GetGroupMembersInfo(ctx context.Context, count, offset int32, groupID string) (groupMembers []*relation.GroupMember, err error) { +// defer func() { +// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "count", count, "offset", offset, "groupID", groupID, "groupMember", groupMembers) +// }() +// groupMemberIDList, err := g.GetGroupMemberIDs(ctx, groupID) +// if err != nil { +// return nil, err +// } +// if count < 0 || offset < 0 { +// return nil, nil +// } +// var groupMemberList []*relation.GroupMember +// var start, stop int32 +// start = offset +// stop = offset + count +// l := int32(len(groupMemberIDList)) +// if start > stop { +// return nil, nil +// } +// if start >= l { +// return nil, nil +// } +// if count != 0 { +// if stop >= l { +// stop = l +// } +// groupMemberIDList = groupMemberIDList[start:stop] +// } else { +// if l < 1000 { +// stop = l +// } else { +// stop = 1000 +// } +// groupMemberIDList = groupMemberIDList[start:stop] +// } +// for _, userID := range groupMemberIDList { +// groupMember, err := g.GetGroupMemberInfo(ctx, groupID, userID) +// if err != nil { +// return +// } +// groupMembers = append(groupMembers, groupMember) +// } +// return groupMemberList, nil +//} func (g *GroupCacheRedis) DelGroupMemberInfo(ctx context.Context, groupID, userID string) (err error) { defer func() { @@ -292,23 +303,23 @@ func (g *GroupCacheRedis) DelGroupMemberInfo(ctx context.Context, groupID, userI } // groupMemberNum -func (g *GroupCacheRedis) GetGroupMemberNum(ctx context.Context, groupID string) (num int, err error) { - getGroupMemberNum := func() (string, error) { - num, err := relation.GetGroupMemberNumByGroupID(groupID) - if err != nil { - return "", err - } - return strconv.Itoa(int(num)), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "num", num) - }() - groupMember, err := g.rcClient.Fetch(g.getGroupMemberNumKey(groupID), time.Second*30*60, getGroupMemberNum) - if err != nil { - return 0, err - } - return strconv.Atoi(groupMember) -} +//func (g *GroupCacheRedis) GetGroupMemberNum(ctx context.Context, groupID string) (num int, err error) { +// getGroupMemberNum := func() (string, error) { +// num, err := relation.GetGroupMemberNumByGroupID(groupID) +// if err != nil { +// return "", err +// } +// return strconv.Itoa(int(num)), nil +// } +// defer func() { +// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "num", num) +// }() +// groupMember, err := g.rcClient.Fetch(g.getGroupMemberNumKey(groupID), time.Second*30*60, getGroupMemberNum) +// if err != nil { +// return 0, err +// } +// return strconv.Atoi(groupMember) +//} func (g *GroupCacheRedis) DelGroupMemberNum(ctx context.Context, groupID string) (err error) { defer func() { diff --git a/pkg/common/db/cache/redis.go b/pkg/common/db/cache/redis.go index 2108701f0..7ad55371b 100644 --- a/pkg/common/db/cache/redis.go +++ b/pkg/common/db/cache/redis.go @@ -88,14 +88,14 @@ type Cache interface { // native redis operate -type RedisClient struct { - rdb redis.UniversalClient -} +//func NewRedis() *RedisClient { +// o := &RedisClient{} +// o.InitRedis() +// return o +//} -func (r *RedisClient) InitRedis() error { +func NewRedis() (*RedisClient, error) { var rdb redis.UniversalClient - var err error - ctx := context.Background() if config.Config.Redis.EnableCluster { rdb = redis.NewClusterClient(&redis.ClusterOptions{ Addrs: config.Config.Redis.DBAddress, @@ -103,11 +103,10 @@ func (r *RedisClient) InitRedis() error { Password: config.Config.Redis.DBPassWord, // no password set PoolSize: 50, }) - _, err = rdb.Ping(ctx).Result() - if err != nil { - fmt.Println("redis cluster failed address ", config.Config.Redis.DBAddress, config.Config.Redis.DBUserName, config.Config.Redis.DBPassWord) - return err - } + //if err := rdb.Ping(ctx).Err();err != nil { + // return nil, fmt.Errorf("redis ping %w", err) + //} + //return &RedisClient{rdb: rdb}, nil } else { rdb = redis.NewClient(&redis.Options{ Addr: config.Config.Redis.DBAddress[0], @@ -116,18 +115,22 @@ func (r *RedisClient) InitRedis() error { DB: 0, // use default DB PoolSize: 100, // 连接池大小 }) - _, err = rdb.Ping(ctx).Result() - if err != nil { - fmt.Println(" redis " + config.Config.Redis.DBAddress[0] + config.Config.Redis.DBUserName + config.Config.Redis.DBPassWord) - return err - } + //err := rdb.Ping(ctx).Err() + //if err != nil { + // panic(err.Error() + " redis " + config.Config.Redis.DBAddress[0] + config.Config.Redis.DBUserName + config.Config.Redis.DBPassWord) + //} } - r.rdb = rdb - return nil + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() + err := rdb.Ping(ctx).Err() + if err != nil { + return nil, fmt.Errorf("redis ping %w", err) + } + return &RedisClient{rdb: rdb}, nil } -func (r *RedisClient) GetClient() redis.UniversalClient { - return r.rdb +type RedisClient struct { + rdb redis.UniversalClient } func NewRedisClient(rdb redis.UniversalClient) *RedisClient { diff --git a/pkg/common/db/controller/auth.go b/pkg/common/db/controller/auth.go index eba88fd7d..ad485f117 100644 --- a/pkg/common/db/controller/auth.go +++ b/pkg/common/db/controller/auth.go @@ -19,7 +19,6 @@ type AuthController struct { } func NewAuthController(rdb redis.UniversalClient, accessSecret string, accessExpire int64) *AuthController { - cache.NewRedisClient(rdb) return &AuthController{database: cache.NewTokenRedis(cache.NewRedisClient(rdb), accessSecret, accessExpire)} } diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go index c5fe8bc3b..863026909 100644 --- a/pkg/common/db/controller/conversation.go +++ b/pkg/common/db/controller/conversation.go @@ -1,32 +1,42 @@ package controller import ( + "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/relation" relationTb "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/utils" "context" + "encoding/json" + "gorm.io/gorm" ) type ConversationInterface interface { //GetUserIDExistConversation 获取拥有该会话的的用户ID列表 GetUserIDExistConversation(ctx context.Context, userIDList []string, conversationID string) ([]string, error) //UpdateUserConversationFiled 更新用户该会话的属性信息 - UpdateUsersConversationFiled(ctx context.Context, UserIDList []string, conversationID string, args map[string]interface{}) error + UpdateUsersConversationFiled(ctx context.Context, userIDList []string, conversationID string, args map[string]interface{}) error //CreateConversation 创建一批新的会话 CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error //SyncPeerUserPrivateConversation 同步对端私聊会话内部保证事务操作 SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error //FindConversations 根据会话ID获取某个用户的多个会话 - FindConversations(ctx context.Context, ownerUserID string, conversationID []string) ([]*relationTb.ConversationModel, error) + FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) //GetUserAllConversation 获取一个用户在服务器上所有的会话 GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) //SetUserConversations 设置用户多个会话属性,如果会话不存在则创建,否则更新,内部保证原子性 SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error + //SetUsersConversationFiledTx 设置多个用户会话关于某个字段的更新操作,如果会话不存在则创建,否则更新,内部保证事务操作 + SetUsersConversationFiledTx(ctx context.Context, userIDList []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error } type ConversationController struct { database ConversationDataBaseInterface } +func (c *ConversationController) SetUsersConversationFiledTx(ctx context.Context, userIDList []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error { + return c.database.SetUsersConversationFiledTx(ctx, userIDList, conversation, filedMap) +} + func NewConversationController(database ConversationDataBaseInterface) *ConversationController { return &ConversationController{database: database} } @@ -36,26 +46,26 @@ func (c *ConversationController) GetUserIDExistConversation(ctx context.Context, } func (c ConversationController) UpdateUsersConversationFiled(ctx context.Context, UserIDList []string, conversationID string, args map[string]interface{}) error { - panic("implement me") + return c.database.UpdateUsersConversationFiled(ctx, UserIDList, conversationID, args) } func (c ConversationController) CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error { - panic("implement me") + return c.database.CreateConversation(ctx, conversations) } func (c ConversationController) SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error { - panic("implement me") + return c.database.SyncPeerUserPrivateConversationTx(ctx, conversation) } -func (c ConversationController) FindConversations(ctx context.Context, ownerUserID string, conversationID []string) ([]*relationTb.ConversationModel, error) { - panic("implement me") +func (c ConversationController) FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) { + return c.database.FindConversations(ctx, ownerUserID, conversationIDs) } func (c ConversationController) GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) { - panic("implement me") + return c.database.GetUserAllConversation(ctx, ownerUserID) } func (c ConversationController) SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error { - panic("implement me") + return c.database.SetUserConversations(ctx, ownerUserID, conversations) } var _ ConversationInterface = (*ConversationController)(nil) @@ -70,15 +80,65 @@ type ConversationDataBaseInterface interface { //SyncPeerUserPrivateConversation 同步对端私聊会话内部保证事务操作 SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error //FindConversations 根据会话ID获取某个用户的多个会话 - FindConversations(ctx context.Context, ownerUserID string, conversationID []string) ([]*relationTb.ConversationModel, error) + FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) //GetUserAllConversation 获取一个用户在服务器上所有的会话 GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) //SetUserConversations 设置用户多个会话属性,如果会话不存在则创建,否则更新,内部保证原子性 SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error + //SetUsersConversationFiledTx 设置多个用户会话关于某个字段的更新操作,如果会话不存在则创建,否则更新,内部保证事务操作 + SetUsersConversationFiledTx(ctx context.Context, userIDList []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error } + +var _ ConversationDataBaseInterface = (*ConversationDataBase)(nil) + type ConversationDataBase struct { - db relation.Conversation - cache cache.ConversationCache + conversationDB relation.Conversation + cache cache.ConversationCache + db *gorm.DB +} + +func (c ConversationDataBase) SetUsersConversationFiledTx(ctx context.Context, userIDList []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error { + return c.db.Transaction(func(tx *gorm.DB) error { + haveUserID, err := c.conversationDB.FindUserID(ctx, userIDList, conversation.ConversationID, tx) + if err != nil { + return err + } + if len(haveUserID) > 0 { + err = c.conversationDB.UpdateByMap(ctx, haveUserID, conversation.ConversationID, filedMap, tx) + if err != nil { + return err + } + } + NotUserID := utils.DifferenceString(haveUserID, userIDList) + var cList []*relationTb.ConversationModel + for _, v := range NotUserID { + temp := new(relationTb.ConversationModel) + if err := utils.CopyStructFields(temp, conversation); err != nil { + return err + } + temp.OwnerUserID = v + cList = append(cList, temp) + } + err = c.conversationDB.Create(ctx, cList) + if err != nil { + return err + } + if len(NotUserID) > 0 { + err = c.cache.DelUsersConversationIDs(ctx, NotUserID) + if err != nil { + return err + } + } + err = c.cache.DelUsersConversation(ctx, haveUserID, conversation.ConversationID) + if err != nil { + return err + } + return nil + }) +} + +func NewConversationDataBase(db relation.Conversation, cache cache.ConversationCache) *ConversationDataBase { + return &ConversationDataBase{conversationDB: db, cache: cache} } func (c ConversationDataBase) GetUserIDExistConversation(ctx context.Context, userIDList []string, conversationID string) ([]string, error) { @@ -94,26 +154,155 @@ func (c ConversationDataBase) CreateConversation(ctx context.Context, conversati } func (c ConversationDataBase) SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error { - panic("implement me") + return c.db.Transaction(func(tx *gorm.DB) error { + userIDList := []string{conversation.OwnerUserID, conversation.UserID} + haveUserID, err := c.conversationDB.FindUserID(ctx, userIDList, conversation.ConversationID, tx) + if err != nil { + return err + } + filedMap := map[string]interface{}{"is_private_chat": conversation.IsPrivateChat} + if len(haveUserID) > 0 { + err = c.conversationDB.UpdateByMap(ctx, haveUserID, conversation.ConversationID, filedMap, tx) + if err != nil { + return err + } + } + + NotUserID := utils.DifferenceString(haveUserID, userIDList) + var cList []*relationTb.ConversationModel + for _, v := range NotUserID { + temp := new(relationTb.ConversationModel) + if v == conversation.UserID { + temp.OwnerUserID = conversation.UserID + temp.ConversationID = utils.GetConversationIDBySessionType(conversation.OwnerUserID, constant.SingleChatType) + temp.ConversationType = constant.SingleChatType + temp.UserID = conversation.OwnerUserID + temp.IsPrivateChat = conversation.IsPrivateChat + } else { + if err := utils.CopyStructFields(temp, conversation); err != nil { + return err + } + temp.OwnerUserID = v + } + cList = append(cList, temp) + } + if len(NotUserID) > 0 { + err = c.conversationDB.Create(ctx, cList) + if err != nil { + return err + } + } + err = c.cache.DelUsersConversationIDs(ctx, NotUserID) + if err != nil { + return err + } + err = c.cache.DelUsersConversation(ctx, haveUserID, conversation.ConversationID) + if err != nil { + return err + } + return nil + }) } -func (c ConversationDataBase) FindConversations(ctx context.Context, ownerUserID string, conversationID []string) ([]*relationTb.ConversationModel, error) { - panic("implement me") +func (c ConversationDataBase) FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) { + getConversation := func() (string, error) { + conversationList, err := c.conversationDB.Find(ctx, ownerUserID, conversationIDs) + if err != nil { + return "", utils.Wrap(err, "get failed") + } + bytes, err := json.Marshal(conversationList) + if err != nil { + return "", utils.Wrap(err, "Marshal failed") + } + return string(bytes), nil + } + return c.cache.GetConversations(ctx, ownerUserID, conversationIDs, getConversation) +} + +func (c ConversationDataBase) GetConversation(ctx context.Context, ownerUserID string, conversationID string) (*relationTb.ConversationModel, error) { + getConversation := func() (string, error) { + conversationList, err := c.conversationDB.Take(ctx, ownerUserID, conversationID) + if err != nil { + return "", utils.Wrap(err, "get failed") + } + bytes, err := json.Marshal(conversationList) + if err != nil { + return "", utils.Wrap(err, "Marshal failed") + } + return string(bytes), nil + } + return c.cache.GetConversation(ctx, ownerUserID, conversationID, getConversation) } func (c ConversationDataBase) GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) { - panic("implement me") + getConversationIDList := func() (string, error) { + conversationIDList, err := c.conversationDB.FindUserIDAllConversationID(ctx, ownerUserID) + if err != nil { + return "", utils.Wrap(err, "getConversationIDList failed") + } + bytes, err := json.Marshal(conversationIDList) + if err != nil { + return "", utils.Wrap(err, "") + } + return string(bytes), nil + } + conversationIDList, err := c.cache.GetUserConversationIDs(ctx, ownerUserID, getConversationIDList) + if err != nil { + return nil, err + } + var conversations []*relationTb.ConversationModel + for _, conversationID := range conversationIDList { + conversation, tErr := c.GetConversation(ctx, ownerUserID, conversationID) + if tErr != nil { + return nil, utils.Wrap(tErr, "GetConversation failed") + } + conversations = append(conversations, conversation) + } + return conversations, nil } func (c ConversationDataBase) SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error { - panic("implement me") -} + return c.db.Transaction(func(tx *gorm.DB) error { + var conversationIDList []string + for _, conversation := range conversations { + conversationIDList = append(conversationIDList, conversation.ConversationID) + } + haveConversations, err := c.conversationDB.Find(ctx, ownerUserID, conversationIDList, tx) + if err != nil { + return err + } + if len(haveConversations) > 0 { + err = c.conversationDB.Update(ctx, conversations, tx) + if err != nil { + return err + } + } + var haveConversationID []string + for _, conversation := range haveConversations { + haveConversationID = append(haveConversationID, conversation.ConversationID) + } -func NewConversationDataBase(db relation.Conversation, cache cache.ConversationCache) *ConversationDataBase { - return &ConversationDataBase{db: db, cache: cache} + NotConversationID := utils.DifferenceString(haveConversationID, conversationIDList) + var NotConversations []*relationTb.ConversationModel + for _, conversation := range conversations { + if !utils.IsContain(conversation.ConversationID, haveConversationID) { + NotConversations = append(NotConversations, conversation) + } + } + if len(NotConversations) > 0 { + err = c.conversationDB.Create(ctx, NotConversations) + if err != nil { + return err + } + } + err = c.cache.DelUsersConversationIDs(ctx, NotConversationID) + if err != nil { + return err + } + err = c.cache.DelUserConversations(ctx, ownerUserID, haveConversationID) + if err != nil { + return err + } + return nil + }) } - -//func NewConversationController(db *gorm.DB, rdb redis.UniversalClient) ConversationInterface { -// groupController := &ConversationController{database: newGroupDatabase(db, rdb, mgoClient)} -// return groupController -//} diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index 75f765ad2..ce40c10f2 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -15,8 +15,6 @@ import ( "github.com/go-redis/redis/v8" "go.mongodb.org/mongo-driver/mongo" "gorm.io/gorm" - "math/big" - "strings" ) //type GroupInterface GroupDataBaseInterface @@ -57,8 +55,8 @@ type GroupInterface interface { var _ GroupInterface = (*GroupController)(nil) -func NewGroupInterface(db *gorm.DB, rdb redis.UniversalClient, mgoClient *mongo.Client) GroupInterface { - return &GroupController{database: NewGroupDatabase(db, rdb, mgoClient)} +func NewGroupInterface(database GroupDataBaseInterface) GroupInterface { + return &GroupController{database: database} } type GroupController struct { @@ -74,7 +72,7 @@ func (g *GroupController) CreateGroup(ctx context.Context, groups []*relationTb. } func (g *GroupController) TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) { - return g.TakeGroup(ctx, groupID) + return g.database.TakeGroup(ctx, groupID) } func (g *GroupController) FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) { @@ -177,6 +175,53 @@ func (g *GroupController) CreateSuperGroupMember(ctx context.Context, groupID st return g.database.CreateSuperGroupMember(ctx, groupID, userIDs) } +type Group interface { + CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error + TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) + FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) + SearchGroup(ctx context.Context, keyword string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupModel, error) + UpdateGroup(ctx context.Context, groupID string, data map[string]any) error + DismissGroup(ctx context.Context, groupID string) error // 解散群,并删除群成员 +} + +type GroupMember interface { + TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationTb.GroupMemberModel, err error) + TakeGroupOwner(ctx context.Context, groupID string) (*relationTb.GroupMemberModel, error) + FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationTb.GroupMemberModel, error) + FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error) + PageGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) + SearchGroupMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) + HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relationTb.GroupMemberModel) error + DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error + MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) + MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) + TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error // 转让群 + UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error + UpdateGroupMembers(ctx context.Context, data []*relationTb.BatchUpdateGroupMember) error +} + +type GroupRequest interface { + CreateGroupRequest(ctx context.Context, requests []*relationTb.GroupRequestModel) error + TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationTb.GroupRequestModel, error) + PageGroupRequestUser(ctx context.Context, userID string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupRequestModel, error) +} + +type SuperGroup interface { + FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unrelationTb.SuperGroupModel, error) + FindJoinSuperGroup(ctx context.Context, userID string) (*unrelationTb.UserToSuperGroupModel, error) + CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error + DeleteSuperGroup(ctx context.Context, groupID string) error + DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error + CreateSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error +} + +type GroupDataBase1 interface { + Group + GroupMember + GroupRequest + SuperGroup +} + type GroupDataBaseInterface interface { CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) @@ -248,7 +293,7 @@ type GroupDataBase struct { func (g *GroupDataBase) delGroupMemberCache(ctx context.Context, groupID string, userIDs []string) error { for _, userID := range userIDs { - if err := g.cache.DelJoinedGroupIDs(ctx, userID); err != nil { + if err := g.cache.DelJoinedGroupID(ctx, userID); err != nil { return err } if err := g.cache.DelJoinedSuperGroupIDs(ctx, userID); err != nil { @@ -272,25 +317,31 @@ func (g *GroupDataBase) FindGroupMemberUserID(ctx context.Context, groupID strin } func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error { - if len(groups) > 0 && len(groupMembers) > 0 { - return g.db.Transaction(func(tx *gorm.DB) error { + return g.db.Transaction(func(tx *gorm.DB) error { + if len(groups) > 0 { if err := g.groupDB.Create(ctx, groups, tx); err != nil { return err } - return g.groupMemberDB.Create(ctx, groupMembers, tx) - }) - } - if len(groups) > 0 { - return g.groupDB.Create(ctx, groups) - } - if len(groupMembers) > 0 { - return g.groupMemberDB.Create(ctx, groupMembers) - } - return nil + } + if len(groupMembers) > 0 { + if err := g.groupMemberDB.Create(ctx, groupMembers, tx); err != nil { + return err + } + //if err := g.cache.DelJoinedGroupIDs(ctx, utils.Slice(groupMembers, func(e *relationTb.GroupMemberModel) string { + // return e.UserID + //})); err != nil { + // return err + //} + } + return nil + }) } func (g *GroupDataBase) TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) { - return g.cache.GetGroupInfo(ctx, groupID) + //return g.cache.GetGroupInfo(ctx, groupID) + return cache.GetCache(ctx, g.rcClient, g.getGroupInfoKey(groupID), g.expireTime, func(ctx context.Context) (*relationTb.GroupModel, error) { + return g.group.Take(ctx, groupID) + }) } func (g *GroupDataBase) FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) { @@ -337,12 +388,11 @@ func (g *GroupDataBase) TakeGroupMember(ctx context.Context, groupID string, use } func (g *GroupDataBase) TakeGroupOwner(ctx context.Context, groupID string) (*relationTb.GroupMemberModel, error) { - return g.groupMemberDB.TakeOwner(ctx, groupID) + return g.groupMemberDB.TakeOwner(ctx, groupID) // todo cache group owner } func (g *GroupDataBase) FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationTb.GroupMemberModel, error) { - //g.cache.GetGroupMembersInfo() - return g.groupMemberDB.Find(ctx, groupIDs, userIDs, roleLevels) + return g.groupMemberDB.Find(ctx, groupIDs, userIDs, roleLevels) // todo cache group find } func (g *GroupDataBase) PageGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) { @@ -383,23 +433,7 @@ func (g *GroupDataBase) DeleteGroupMember(ctx context.Context, groupID string, u } func (g *GroupDataBase) MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) { - mapGroupUserIDs, err := g.groupMemberDB.FindJoinUserID(ctx, groupIDs) - if err != nil { - return nil, err - } - res := make(map[string]*relationTb.GroupSimpleUserID) - for _, groupID := range groupIDs { - userIDs := mapGroupUserIDs[groupID] - users := &relationTb.GroupSimpleUserID{} - if len(userIDs) > 0 { - utils.Sort(userIDs, true) - bi := big.NewInt(0) - bi.SetString(utils.Md5(strings.Join(userIDs, ";"))[0:8], 16) - users.Hash = bi.Uint64() - } - res[groupID] = users - } - return res, nil + return g.cache.GetGroupMemberHash1(ctx, groupIDs) } func (g *GroupDataBase) MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) { diff --git a/pkg/common/db/localcache/group.go b/pkg/common/db/localcache/group.go index e41c10456..fda1e2d48 100644 --- a/pkg/common/db/localcache/group.go +++ b/pkg/common/db/localcache/group.go @@ -24,8 +24,8 @@ type GroupMemberIDsHash struct { userIDs []string } -func NewGroupMemberIDsLocalCache(client discoveryRegistry.SvcDiscoveryRegistry) GroupLocalCache { - return GroupLocalCache{ +func NewGroupMemberIDsLocalCache(client discoveryRegistry.SvcDiscoveryRegistry) *GroupLocalCache { + return &GroupLocalCache{ cache: make(map[string]GroupMemberIDsHash, 0), client: client, } diff --git a/pkg/common/db/relation/conversation_model_g.go b/pkg/common/db/relation/conversation_model_g.go index 37882940d..e45af0154 100644 --- a/pkg/common/db/relation/conversation_model_g.go +++ b/pkg/common/db/relation/conversation_model_g.go @@ -1,7 +1,7 @@ package relation import ( - "Open_IM/pkg/common/db/table" + "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" @@ -10,12 +10,15 @@ import ( type Conversation interface { TableName() string - Create(ctx context.Context, conversations []*table.ConversationModel) (err error) + Create(ctx context.Context, conversations []*relation.ConversationModel, tx ...any) (err error) Delete(ctx context.Context, groupIDs []string) (err error) - UpdateByMap(ctx context.Context, groupID string, args map[string]interface{}) (err error) - Update(ctx context.Context, groups []*table.ConversationModel) (err error) - Find(ctx context.Context, groupIDs []string) (groups []*table.ConversationModel, err error) - Take(ctx context.Context, groupID string) (group *table.ConversationModel, err error) + UpdateByMap(ctx context.Context, userIDList []string, conversationID string, args map[string]interface{}, tx ...any) (err error) + Update(ctx context.Context, conversations []*relation.ConversationModel, tx ...any) (err error) + Find(ctx context.Context, ownerUserID string, conversationIDs []string, tx ...any) (conversations []*relation.ConversationModel, err error) + FindUserID(ctx context.Context, userIDList []string, conversationID string, tx ...any) ([]string, error) + FindUserIDAllConversationID(ctx context.Context, userID string, tx ...any) ([]string, error) + Take(ctx context.Context, userID, conversationID string, tx ...any) (conversation *relation.ConversationModel, err error) + FindConversationID(ctx context.Context, userID string, conversationIDList []string, tx ...any) (existConversationID []string, err error) } type ConversationGorm struct { DB *gorm.DB @@ -29,45 +32,69 @@ func NewConversationGorm(DB *gorm.DB) Conversation { return &ConversationGorm{DB: DB} } -func (c *ConversationGorm) Create(ctx context.Context, conversations []*table.ConversationModel) (err error) { +func (c *ConversationGorm) Create(ctx context.Context, conversations []*relation.ConversationModel, tx ...any) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "conversations", conversations) }() - return utils.Wrap(getDBConn(g.DB, tx).Create(&conversations).Error, "") + return utils.Wrap(getDBConn(c.DB, tx).Create(&conversations).Error, "") } func (c *ConversationGorm) Delete(ctx context.Context, groupIDs []string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs) }() - return utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Delete(&table.ConversationModel{}).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Delete(&relation.ConversationModel{}).Error, "") } -func (c *ConversationGorm) UpdateByMap(ctx context.Context, groupID string, args map[string]interface{}) (err error) { +func (c *ConversationGorm) UpdateByMap(ctx context.Context, userIDList []string, conversationID string, args map[string]interface{}, tx ...any) (err error) { defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "args", args) + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDList", userIDList, "conversationID", conversationID) }() - return utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Model(g).Updates(args).Error, "") + return utils.Wrap(getDBConn(c.DB, tx).Model(&relation.ConversationModel{}).Where("owner_user_id IN (?) and conversation_id=?", userIDList, conversationID).Updates(args).Error, "") } -func (c *ConversationGorm) Update(ctx context.Context, groups []*table.ConversationModel) (err error) { +func (c *ConversationGorm) Update(ctx context.Context, conversations []*relation.ConversationModel, tx ...any) (err error) { defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups) + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "conversations", conversations) }() - return utils.Wrap(getDBConn(g.DB, tx).Updates(&groups).Error, "") + return utils.Wrap(getDBConn(c.DB, tx).Updates(&conversations).Error, "") } -func (c *ConversationGorm) Find(ctx context.Context, groupIDs []string) (groups []*table.ConversationModel, err error) { +func (c *ConversationGorm) Find(ctx context.Context, ownerUserID string, conversationIDs []string, tx ...any) (conversations []*relation.ConversationModel, err error) { + var newConversations []relation.ConversationModel defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "groups", groups) + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "groups", conversations) }() - return groups, utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Find(&groups).Error, "") + err = utils.Wrap(getDBConn(c.DB, tx).Where("owner_user_id=? and conversation_id IN (?)", ownerUserID, conversationIDs).Find(&newConversations).Error, "") + for _, v := range newConversations { + v1 := v + conversations = append(conversations, &v1) + } + return conversations, err } -func (c *ConversationGorm) Take(ctx context.Context, groupID string) (group *table.ConversationModel, err error) { - group = &Group{} +func (c *ConversationGorm) Take(ctx context.Context, userID, conversationID string, tx ...any) (conversation *relation.ConversationModel, err error) { + cc := &relation.ConversationModel{} defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", *group) + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversation", *conversation) }() - return group, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Take(group).Error, "") + return cc, utils.Wrap(getDBConn(c.DB, tx).Where("conversation_id = ? And owner_user_id = ?", conversationID, userID).Take(cc).Error, "") +} +func (c *ConversationGorm) FindUserID(ctx context.Context, userIDList []string, conversationID string, tx ...any) (existUserID []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userIDList, "existUserID", existUserID) + }() + return existUserID, utils.Wrap(getDBConn(c.DB, tx).Where(" owner_user_id IN (?) and conversation_id=?", userIDList, conversationID).Pluck("owner_user_id", &existUserID).Error, "") +} +func (c *ConversationGorm) FindConversationID(ctx context.Context, userID string, conversationIDList []string, tx ...any) (existConversationID []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "existConversationIDList", existConversationID) + }() + return existConversationID, utils.Wrap(getDBConn(c.DB, tx).Where(" conversation_id IN (?) and owner_user_id=?", conversationIDList, userID).Pluck("conversation_id", &existConversationID).Error, "") +} +func (c *ConversationGorm) FindUserIDAllConversationID(ctx context.Context, userID string, tx ...any) (conversationIDList []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversationIDList", conversationIDList) + }() + return conversationIDList, utils.Wrap(getDBConn(c.DB, tx).Model(&relation.ConversationModel{}).Where("owner_user_id=?", userID).Pluck("conversation_id", &conversationIDList).Error, "") } diff --git a/pkg/common/db/relation/group_member_model.go b/pkg/common/db/relation/group_member_model.go index 14373119a..06b41b43a 100644 --- a/pkg/common/db/relation/group_member_model.go +++ b/pkg/common/db/relation/group_member_model.go @@ -130,5 +130,5 @@ func (g *GroupMemberGorm) FindMemberUserID(ctx context.Context, groupID string, defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userIDs", userIDs) }() - return userIDs, utils.Wrap(getDBConn(g.DB, tx).Model(&relation.GroupMemberModel{}).Where("group_id = ?", groupID).Pluck("user_id", &userIDs), "") + return userIDs, utils.Wrap(getDBConn(g.DB, tx).Model(&relation.GroupMemberModel{}).Where("group_id = ?", groupID).Pluck("user_id", &userIDs).Error, "") } diff --git a/pkg/common/db/relation/mysql_init.go b/pkg/common/db/relation/mysql_init.go new file mode 100644 index 000000000..d4461c294 --- /dev/null +++ b/pkg/common/db/relation/mysql_init.go @@ -0,0 +1,148 @@ +package relation + +import ( + "Open_IM/pkg/common/config" + "fmt" + "time" + + "gorm.io/driver/mysql" + "gorm.io/gorm" + "gorm.io/gorm/logger" +) + +func NewGormDB() (*gorm.DB, error) { + dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local", + config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], "mysql") + db, err := gorm.Open(mysql.Open(dsn), nil) + if err != nil { + time.Sleep(time.Duration(30) * time.Second) + db, err = gorm.Open(mysql.Open(dsn), nil) + if err != nil { + panic(err.Error() + " open failed " + dsn) + } + } + sqlDB, err := db.DB() + if err != nil { + return nil, err + } + defer sqlDB.Close() + sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s default charset utf8 COLLATE utf8_general_ci;", config.Config.Mysql.DBDatabaseName) + err = db.Exec(sql).Error + if err != nil { + return nil, fmt.Errorf("init db %w", err) + } + dsn = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local", + config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], config.Config.Mysql.DBDatabaseName) + newLogger := logger.New( + Writer{}, + logger.Config{ + SlowThreshold: time.Duration(config.Config.Mysql.SlowThreshold) * time.Millisecond, // Slow SQL threshold + LogLevel: logger.LogLevel(config.Config.Mysql.LogLevel), // Log level + IgnoreRecordNotFoundError: true, // Ignore ErrRecordNotFound error for logger + Colorful: true, // Disable color + }, + ) + db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{ + Logger: newLogger, + }) + if err != nil { + return nil, err + } + sqlDB, err = db.DB() + if err != nil { + return nil, err + } + sqlDB.SetConnMaxLifetime(time.Second * time.Duration(config.Config.Mysql.DBMaxLifeTime)) + sqlDB.SetMaxOpenConns(config.Config.Mysql.DBMaxOpenConns) + sqlDB.SetMaxIdleConns(config.Config.Mysql.DBMaxIdleConns) + return db, nil +} + +type Mysql struct { + gormConn *gorm.DB +} + +func (m *Mysql) GormConn() *gorm.DB { + return m.gormConn +} + +//func (m *Mysql) SetGormConn(gormConn *gorm.DB) { +// m.gormConn = gormConn +//} +// +//func (m *Mysql) InitConn() *Mysql { +// dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local", +// config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], "mysql") +// var db *gorm.DB +// db, err := gorm.Open(mysql.Open(dsn), nil) +// if err != nil { +// time.Sleep(time.Duration(30) * time.Second) +// db, err = gorm.Open(mysql.Open(dsn), nil) +// if err != nil { +// panic(err.Error() + " open failed " + dsn) +// } +// } +// sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s default charset utf8 COLLATE utf8_general_ci;", config.Config.Mysql.DBDatabaseName) +// err = db.Exec(sql).Error +// if err != nil { +// panic(err.Error() + " Exec failed:" + sql) +// } +// dsn = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local", +// config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], config.Config.Mysql.DBDatabaseName) +// newLogger := logger.New( +// Writer{}, +// logger.Config{ +// SlowThreshold: time.Duration(config.Config.Mysql.SlowThreshold) * time.Millisecond, // Slow SQL threshold +// LogLevel: logger.LogLevel(config.Config.Mysql.LogLevel), // Log level +// IgnoreRecordNotFoundError: true, // Ignore ErrRecordNotFound error for logger +// Colorful: true, // Disable color +// }, +// ) +// db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{ +// Logger: newLogger, +// }) +// if err != nil { +// panic(err.Error() + " Open failed " + dsn) +// } +// sqlDB, err := db.DB() +// if err != nil { +// panic(err.Error() + " DB.DB() failed ") +// } +// sqlDB.SetConnMaxLifetime(time.Second * time.Duration(config.Config.Mysql.DBMaxLifeTime)) +// sqlDB.SetMaxOpenConns(config.Config.Mysql.DBMaxOpenConns) +// sqlDB.SetMaxIdleConns(config.Config.Mysql.DBMaxIdleConns) +// if db == nil { +// panic("db is nil") +// } +// m.SetGormConn(db) +// return m +//} + +//models := []interface{}{&Friend{}, &FriendRequest{}, &Group{}, &GroupMember{}, &GroupRequest{}, +// &User{}, &Black{}, &ChatLog{}, &Conversation{}, &AppVersion{}} + +//func (m *Mysql) AutoMigrateModel(model interface{}) error { +// err := m.gormConn.AutoMigrate(model) +// if err != nil { +// return err +// } +// m.gormConn.Set("gorm:table_options", "CHARSET=utf8") +// m.gormConn.Set("gorm:table_options", "collation=utf8_unicode_ci") +// _ = m.gormConn.Migrator().CreateTable(model) +// return nil +//} + +type Writer struct{} + +func (w Writer) Printf(format string, args ...interface{}) { + fmt.Printf(format, args...) +} + +func getDBConn(db *gorm.DB, tx []any) *gorm.DB { + if len(tx) > 0 { + if txDB, ok := tx[0].(*gorm.DB); ok { + return txDB + } + } + return db +} diff --git a/pkg/common/db/unrelation/mongo.go b/pkg/common/db/unrelation/mongo.go index 85e87b54f..1c0058f94 100644 --- a/pkg/common/db/unrelation/mongo.go +++ b/pkg/common/db/unrelation/mongo.go @@ -13,6 +13,47 @@ import ( "time" ) +//func NewMongo() *Mongo { +// mgo := &Mongo{} +// mgo.InitMongo() +// return mgo +//} + +func NewMongo() (*Mongo, error) { + uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" + if config.Config.Mongo.DBUri != "" { + // example: mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize + uri = config.Config.Mongo.DBUri + } else { + //mongodb://mongodb1.example.com:27317,mongodb2.example.com:27017/?replicaSet=mySet&authSource=authDB + mongodbHosts := "" + for i, v := range config.Config.Mongo.DBAddress { + if i == len(config.Config.Mongo.DBAddress)-1 { + mongodbHosts += v + } else { + mongodbHosts += v + "," + } + } + if config.Config.Mongo.DBPassword != "" && config.Config.Mongo.DBUserName != "" { + uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", + config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, mongodbHosts, + config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize) + } else { + uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&authSource=admin", + mongodbHosts, config.Config.Mongo.DBDatabase, + config.Config.Mongo.DBMaxPoolSize) + } + } + fmt.Println("mongo:", uri) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) + defer cancel() + mongoClient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri)) + if err != nil { + return nil, err + } + return &Mongo{db: mongoClient}, nil +} + type Mongo struct { db *mongo.Client } diff --git a/pkg/common/http/http_client.go b/pkg/common/http/http_client.go index 319ca8c6d..16e93a328 100644 --- a/pkg/common/http/http_client.go +++ b/pkg/common/http/http_client.go @@ -7,7 +7,7 @@ package http import ( - cbApi "Open_IM/pkg/callbackstruct" + cbapi "Open_IM/pkg/callbackstruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "bytes" @@ -59,7 +59,7 @@ func Post(url string, data interface{}, timeOutSecond int) (content []byte, err return result, nil } -func CallBackPostReturn(url, callbackCommand string, input interface{}, output cbApi.CallbackResp, callbackConfig config.CallBackConfig) error { +func callBackPostReturn(url, callbackCommand string, input interface{}, output cbapi.CallbackResp, callbackConfig config.CallBackConfig) error { v := urlLib.Values{} v.Set("callbackCommand", callbackCommand) url = url + "?" + v.Encode() @@ -78,3 +78,7 @@ func CallBackPostReturn(url, callbackCommand string, input interface{}, output c } return output.Parse() } + +func CallBackPostReturn(url string, req cbapi.CallbackReq, resp cbapi.CallbackResp, callbackConfig config.CallBackConfig) error { + return callBackPostReturn(url, req.GetCallbackCommand(), req, resp, callbackConfig) +} diff --git a/pkg/common/tokenverify/jwt_token.go b/pkg/common/tokenverify/jwt_token.go index ca428229d..9722830a7 100644 --- a/pkg/common/tokenverify/jwt_token.go +++ b/pkg/common/tokenverify/jwt_token.go @@ -87,3 +87,6 @@ func CheckAdmin(ctx context.Context) error { func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) { return GetClaimFromToken(string(redisToken.([]uint8))) } +func IsManagerUserID(opUserID string) bool { + return utils.IsContain(opUserID, config.Config.Manager.AppManagerUid) +} diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index 0597a871a..86bb1a00d 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -39,7 +39,7 @@ func (m *CreateGroupReq) Reset() { *m = CreateGroupReq{} } func (m *CreateGroupReq) String() string { return proto.CompactTextString(m) } func (*CreateGroupReq) ProtoMessage() {} func (*CreateGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{0} + return fileDescriptor_group_4a94cf46004e5ca3, []int{0} } func (m *CreateGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupReq.Unmarshal(m, b) @@ -98,7 +98,7 @@ func (m *CreateGroupResp) Reset() { *m = CreateGroupResp{} } func (m *CreateGroupResp) String() string { return proto.CompactTextString(m) } func (*CreateGroupResp) ProtoMessage() {} func (*CreateGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{1} + return fileDescriptor_group_4a94cf46004e5ca3, []int{1} } func (m *CreateGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupResp.Unmarshal(m, b) @@ -136,7 +136,7 @@ func (m *GetGroupsInfoReq) Reset() { *m = GetGroupsInfoReq{} } func (m *GetGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoReq) ProtoMessage() {} func (*GetGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{2} + return fileDescriptor_group_4a94cf46004e5ca3, []int{2} } func (m *GetGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoReq.Unmarshal(m, b) @@ -174,7 +174,7 @@ func (m *GetGroupsInfoResp) Reset() { *m = GetGroupsInfoResp{} } func (m *GetGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoResp) ProtoMessage() {} func (*GetGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{3} + return fileDescriptor_group_4a94cf46004e5ca3, []int{3} } func (m *GetGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoResp.Unmarshal(m, b) @@ -212,7 +212,7 @@ func (m *SetGroupInfoReq) Reset() { *m = SetGroupInfoReq{} } func (m *SetGroupInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoReq) ProtoMessage() {} func (*SetGroupInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{4} + return fileDescriptor_group_4a94cf46004e5ca3, []int{4} } func (m *SetGroupInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoReq.Unmarshal(m, b) @@ -249,7 +249,7 @@ func (m *SetGroupInfoResp) Reset() { *m = SetGroupInfoResp{} } func (m *SetGroupInfoResp) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoResp) ProtoMessage() {} func (*SetGroupInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{5} + return fileDescriptor_group_4a94cf46004e5ca3, []int{5} } func (m *SetGroupInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoResp.Unmarshal(m, b) @@ -281,7 +281,7 @@ func (m *GetGroupApplicationListReq) Reset() { *m = GetGroupApplicationL func (m *GetGroupApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListReq) ProtoMessage() {} func (*GetGroupApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{6} + return fileDescriptor_group_4a94cf46004e5ca3, []int{6} } func (m *GetGroupApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListReq.Unmarshal(m, b) @@ -327,7 +327,7 @@ func (m *GetGroupApplicationListResp) Reset() { *m = GetGroupApplication func (m *GetGroupApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListResp) ProtoMessage() {} func (*GetGroupApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{7} + return fileDescriptor_group_4a94cf46004e5ca3, []int{7} } func (m *GetGroupApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListResp.Unmarshal(m, b) @@ -373,7 +373,7 @@ func (m *GetUserReqApplicationListReq) Reset() { *m = GetUserReqApplicat func (m *GetUserReqApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetUserReqApplicationListReq) ProtoMessage() {} func (*GetUserReqApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{8} + return fileDescriptor_group_4a94cf46004e5ca3, []int{8} } func (m *GetUserReqApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserReqApplicationListReq.Unmarshal(m, b) @@ -419,7 +419,7 @@ func (m *GetUserReqApplicationListResp) Reset() { *m = GetUserReqApplica func (m *GetUserReqApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetUserReqApplicationListResp) ProtoMessage() {} func (*GetUserReqApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{9} + return fileDescriptor_group_4a94cf46004e5ca3, []int{9} } func (m *GetUserReqApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserReqApplicationListResp.Unmarshal(m, b) @@ -466,7 +466,7 @@ func (m *TransferGroupOwnerReq) Reset() { *m = TransferGroupOwnerReq{} } func (m *TransferGroupOwnerReq) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerReq) ProtoMessage() {} func (*TransferGroupOwnerReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{10} + return fileDescriptor_group_4a94cf46004e5ca3, []int{10} } func (m *TransferGroupOwnerReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerReq.Unmarshal(m, b) @@ -517,7 +517,7 @@ func (m *TransferGroupOwnerResp) Reset() { *m = TransferGroupOwnerResp{} func (m *TransferGroupOwnerResp) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerResp) ProtoMessage() {} func (*TransferGroupOwnerResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{11} + return fileDescriptor_group_4a94cf46004e5ca3, []int{11} } func (m *TransferGroupOwnerResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerResp.Unmarshal(m, b) @@ -551,7 +551,7 @@ func (m *JoinGroupReq) Reset() { *m = JoinGroupReq{} } func (m *JoinGroupReq) String() string { return proto.CompactTextString(m) } func (*JoinGroupReq) ProtoMessage() {} func (*JoinGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{12} + return fileDescriptor_group_4a94cf46004e5ca3, []int{12} } func (m *JoinGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupReq.Unmarshal(m, b) @@ -609,7 +609,7 @@ func (m *JoinGroupResp) Reset() { *m = JoinGroupResp{} } func (m *JoinGroupResp) String() string { return proto.CompactTextString(m) } func (*JoinGroupResp) ProtoMessage() {} func (*JoinGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{13} + return fileDescriptor_group_4a94cf46004e5ca3, []int{13} } func (m *JoinGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupResp.Unmarshal(m, b) @@ -643,7 +643,7 @@ func (m *GroupApplicationResponseReq) Reset() { *m = GroupApplicationRes func (m *GroupApplicationResponseReq) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseReq) ProtoMessage() {} func (*GroupApplicationResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{14} + return fileDescriptor_group_4a94cf46004e5ca3, []int{14} } func (m *GroupApplicationResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseReq.Unmarshal(m, b) @@ -701,7 +701,7 @@ func (m *GroupApplicationResponseResp) Reset() { *m = GroupApplicationRe func (m *GroupApplicationResponseResp) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseResp) ProtoMessage() {} func (*GroupApplicationResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{15} + return fileDescriptor_group_4a94cf46004e5ca3, []int{15} } func (m *GroupApplicationResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseResp.Unmarshal(m, b) @@ -732,7 +732,7 @@ func (m *QuitGroupReq) Reset() { *m = QuitGroupReq{} } func (m *QuitGroupReq) String() string { return proto.CompactTextString(m) } func (*QuitGroupReq) ProtoMessage() {} func (*QuitGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{16} + return fileDescriptor_group_4a94cf46004e5ca3, []int{16} } func (m *QuitGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupReq.Unmarshal(m, b) @@ -769,7 +769,7 @@ func (m *QuitGroupResp) Reset() { *m = QuitGroupResp{} } func (m *QuitGroupResp) String() string { return proto.CompactTextString(m) } func (*QuitGroupResp) ProtoMessage() {} func (*QuitGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{17} + return fileDescriptor_group_4a94cf46004e5ca3, []int{17} } func (m *QuitGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupResp.Unmarshal(m, b) @@ -802,7 +802,7 @@ func (m *GetGroupMemberListReq) Reset() { *m = GetGroupMemberListReq{} } func (m *GetGroupMemberListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListReq) ProtoMessage() {} func (*GetGroupMemberListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{18} + return fileDescriptor_group_4a94cf46004e5ca3, []int{18} } func (m *GetGroupMemberListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListReq.Unmarshal(m, b) @@ -855,7 +855,7 @@ func (m *GetGroupMemberListResp) Reset() { *m = GetGroupMemberListResp{} func (m *GetGroupMemberListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListResp) ProtoMessage() {} func (*GetGroupMemberListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{19} + return fileDescriptor_group_4a94cf46004e5ca3, []int{19} } func (m *GetGroupMemberListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListResp.Unmarshal(m, b) @@ -901,7 +901,7 @@ func (m *GetGroupMembersInfoReq) Reset() { *m = GetGroupMembersInfoReq{} func (m *GetGroupMembersInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoReq) ProtoMessage() {} func (*GetGroupMembersInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{20} + return fileDescriptor_group_4a94cf46004e5ca3, []int{20} } func (m *GetGroupMembersInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoReq.Unmarshal(m, b) @@ -946,7 +946,7 @@ func (m *GetGroupMembersInfoResp) Reset() { *m = GetGroupMembersInfoResp func (m *GetGroupMembersInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoResp) ProtoMessage() {} func (*GetGroupMembersInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{21} + return fileDescriptor_group_4a94cf46004e5ca3, []int{21} } func (m *GetGroupMembersInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoResp.Unmarshal(m, b) @@ -986,7 +986,7 @@ func (m *KickGroupMemberReq) Reset() { *m = KickGroupMemberReq{} } func (m *KickGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberReq) ProtoMessage() {} func (*KickGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{22} + return fileDescriptor_group_4a94cf46004e5ca3, []int{22} } func (m *KickGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberReq.Unmarshal(m, b) @@ -1037,7 +1037,7 @@ func (m *KickGroupMemberResp) Reset() { *m = KickGroupMemberResp{} } func (m *KickGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberResp) ProtoMessage() {} func (*KickGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{23} + return fileDescriptor_group_4a94cf46004e5ca3, []int{23} } func (m *KickGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberResp.Unmarshal(m, b) @@ -1069,7 +1069,7 @@ func (m *GetJoinedGroupListReq) Reset() { *m = GetJoinedGroupListReq{} } func (m *GetJoinedGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListReq) ProtoMessage() {} func (*GetJoinedGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{24} + return fileDescriptor_group_4a94cf46004e5ca3, []int{24} } func (m *GetJoinedGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListReq.Unmarshal(m, b) @@ -1115,7 +1115,7 @@ func (m *GetJoinedGroupListResp) Reset() { *m = GetJoinedGroupListResp{} func (m *GetJoinedGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListResp) ProtoMessage() {} func (*GetJoinedGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{25} + return fileDescriptor_group_4a94cf46004e5ca3, []int{25} } func (m *GetJoinedGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListResp.Unmarshal(m, b) @@ -1162,7 +1162,7 @@ func (m *InviteUserToGroupReq) Reset() { *m = InviteUserToGroupReq{} } func (m *InviteUserToGroupReq) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupReq) ProtoMessage() {} func (*InviteUserToGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{26} + return fileDescriptor_group_4a94cf46004e5ca3, []int{26} } func (m *InviteUserToGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupReq.Unmarshal(m, b) @@ -1213,7 +1213,7 @@ func (m *InviteUserToGroupResp) Reset() { *m = InviteUserToGroupResp{} } func (m *InviteUserToGroupResp) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupResp) ProtoMessage() {} func (*InviteUserToGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{27} + return fileDescriptor_group_4a94cf46004e5ca3, []int{27} } func (m *InviteUserToGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupResp.Unmarshal(m, b) @@ -1245,7 +1245,7 @@ func (m *GetGroupAllMemberReq) Reset() { *m = GetGroupAllMemberReq{} } func (m *GetGroupAllMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberReq) ProtoMessage() {} func (*GetGroupAllMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{28} + return fileDescriptor_group_4a94cf46004e5ca3, []int{28} } func (m *GetGroupAllMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberReq.Unmarshal(m, b) @@ -1290,7 +1290,7 @@ func (m *GetGroupAllMemberResp) Reset() { *m = GetGroupAllMemberResp{} } func (m *GetGroupAllMemberResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberResp) ProtoMessage() {} func (*GetGroupAllMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{29} + return fileDescriptor_group_4a94cf46004e5ca3, []int{29} } func (m *GetGroupAllMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberResp.Unmarshal(m, b) @@ -1330,7 +1330,7 @@ func (m *CMSGroup) Reset() { *m = CMSGroup{} } func (m *CMSGroup) String() string { return proto.CompactTextString(m) } func (*CMSGroup) ProtoMessage() {} func (*CMSGroup) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{30} + return fileDescriptor_group_4a94cf46004e5ca3, []int{30} } func (m *CMSGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CMSGroup.Unmarshal(m, b) @@ -1384,7 +1384,7 @@ func (m *GetGroupsReq) Reset() { *m = GetGroupsReq{} } func (m *GetGroupsReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsReq) ProtoMessage() {} func (*GetGroupsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{31} + return fileDescriptor_group_4a94cf46004e5ca3, []int{31} } func (m *GetGroupsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsReq.Unmarshal(m, b) @@ -1437,7 +1437,7 @@ func (m *GetGroupsResp) Reset() { *m = GetGroupsResp{} } func (m *GetGroupsResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsResp) ProtoMessage() {} func (*GetGroupsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{32} + return fileDescriptor_group_4a94cf46004e5ca3, []int{32} } func (m *GetGroupsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsResp.Unmarshal(m, b) @@ -1482,7 +1482,7 @@ func (m *GetGroupMemberReq) Reset() { *m = GetGroupMemberReq{} } func (m *GetGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberReq) ProtoMessage() {} func (*GetGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{33} + return fileDescriptor_group_4a94cf46004e5ca3, []int{33} } func (m *GetGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberReq.Unmarshal(m, b) @@ -1522,7 +1522,7 @@ func (m *GetGroupMembersCMSReq) Reset() { *m = GetGroupMembersCMSReq{} } func (m *GetGroupMembersCMSReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersCMSReq) ProtoMessage() {} func (*GetGroupMembersCMSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{34} + return fileDescriptor_group_4a94cf46004e5ca3, []int{34} } func (m *GetGroupMembersCMSReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersCMSReq.Unmarshal(m, b) @@ -1575,7 +1575,7 @@ func (m *GetGroupMembersCMSResp) Reset() { *m = GetGroupMembersCMSResp{} func (m *GetGroupMembersCMSResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersCMSResp) ProtoMessage() {} func (*GetGroupMembersCMSResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{35} + return fileDescriptor_group_4a94cf46004e5ca3, []int{35} } func (m *GetGroupMembersCMSResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersCMSResp.Unmarshal(m, b) @@ -1620,7 +1620,7 @@ func (m *DismissGroupReq) Reset() { *m = DismissGroupReq{} } func (m *DismissGroupReq) String() string { return proto.CompactTextString(m) } func (*DismissGroupReq) ProtoMessage() {} func (*DismissGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{36} + return fileDescriptor_group_4a94cf46004e5ca3, []int{36} } func (m *DismissGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DismissGroupReq.Unmarshal(m, b) @@ -1657,7 +1657,7 @@ func (m *DismissGroupResp) Reset() { *m = DismissGroupResp{} } func (m *DismissGroupResp) String() string { return proto.CompactTextString(m) } func (*DismissGroupResp) ProtoMessage() {} func (*DismissGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{37} + return fileDescriptor_group_4a94cf46004e5ca3, []int{37} } func (m *DismissGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DismissGroupResp.Unmarshal(m, b) @@ -1690,7 +1690,7 @@ func (m *MuteGroupMemberReq) Reset() { *m = MuteGroupMemberReq{} } func (m *MuteGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*MuteGroupMemberReq) ProtoMessage() {} func (*MuteGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{38} + return fileDescriptor_group_4a94cf46004e5ca3, []int{38} } func (m *MuteGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupMemberReq.Unmarshal(m, b) @@ -1741,7 +1741,7 @@ func (m *MuteGroupMemberResp) Reset() { *m = MuteGroupMemberResp{} } func (m *MuteGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*MuteGroupMemberResp) ProtoMessage() {} func (*MuteGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{39} + return fileDescriptor_group_4a94cf46004e5ca3, []int{39} } func (m *MuteGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupMemberResp.Unmarshal(m, b) @@ -1773,7 +1773,7 @@ func (m *CancelMuteGroupMemberReq) Reset() { *m = CancelMuteGroupMemberR func (m *CancelMuteGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupMemberReq) ProtoMessage() {} func (*CancelMuteGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{40} + return fileDescriptor_group_4a94cf46004e5ca3, []int{40} } func (m *CancelMuteGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupMemberReq.Unmarshal(m, b) @@ -1817,7 +1817,7 @@ func (m *CancelMuteGroupMemberResp) Reset() { *m = CancelMuteGroupMember func (m *CancelMuteGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupMemberResp) ProtoMessage() {} func (*CancelMuteGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{41} + return fileDescriptor_group_4a94cf46004e5ca3, []int{41} } func (m *CancelMuteGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupMemberResp.Unmarshal(m, b) @@ -1848,7 +1848,7 @@ func (m *MuteGroupReq) Reset() { *m = MuteGroupReq{} } func (m *MuteGroupReq) String() string { return proto.CompactTextString(m) } func (*MuteGroupReq) ProtoMessage() {} func (*MuteGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{42} + return fileDescriptor_group_4a94cf46004e5ca3, []int{42} } func (m *MuteGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupReq.Unmarshal(m, b) @@ -1885,7 +1885,7 @@ func (m *MuteGroupResp) Reset() { *m = MuteGroupResp{} } func (m *MuteGroupResp) String() string { return proto.CompactTextString(m) } func (*MuteGroupResp) ProtoMessage() {} func (*MuteGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{43} + return fileDescriptor_group_4a94cf46004e5ca3, []int{43} } func (m *MuteGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MuteGroupResp.Unmarshal(m, b) @@ -1916,7 +1916,7 @@ func (m *CancelMuteGroupReq) Reset() { *m = CancelMuteGroupReq{} } func (m *CancelMuteGroupReq) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupReq) ProtoMessage() {} func (*CancelMuteGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{44} + return fileDescriptor_group_4a94cf46004e5ca3, []int{44} } func (m *CancelMuteGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupReq.Unmarshal(m, b) @@ -1953,7 +1953,7 @@ func (m *CancelMuteGroupResp) Reset() { *m = CancelMuteGroupResp{} } func (m *CancelMuteGroupResp) String() string { return proto.CompactTextString(m) } func (*CancelMuteGroupResp) ProtoMessage() {} func (*CancelMuteGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{45} + return fileDescriptor_group_4a94cf46004e5ca3, []int{45} } func (m *CancelMuteGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CancelMuteGroupResp.Unmarshal(m, b) @@ -1984,7 +1984,7 @@ func (m *GetJoinedSuperGroupListReq) Reset() { *m = GetJoinedSuperGroupL func (m *GetJoinedSuperGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedSuperGroupListReq) ProtoMessage() {} func (*GetJoinedSuperGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{46} + return fileDescriptor_group_4a94cf46004e5ca3, []int{46} } func (m *GetJoinedSuperGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedSuperGroupListReq.Unmarshal(m, b) @@ -2022,7 +2022,7 @@ func (m *GetJoinedSuperGroupListResp) Reset() { *m = GetJoinedSuperGroup func (m *GetJoinedSuperGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedSuperGroupListResp) ProtoMessage() {} func (*GetJoinedSuperGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{47} + return fileDescriptor_group_4a94cf46004e5ca3, []int{47} } func (m *GetJoinedSuperGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedSuperGroupListResp.Unmarshal(m, b) @@ -2060,7 +2060,7 @@ func (m *GetSuperGroupsInfoReq) Reset() { *m = GetSuperGroupsInfoReq{} } func (m *GetSuperGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupsInfoReq) ProtoMessage() {} func (*GetSuperGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{48} + return fileDescriptor_group_4a94cf46004e5ca3, []int{48} } func (m *GetSuperGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupsInfoReq.Unmarshal(m, b) @@ -2098,7 +2098,7 @@ func (m *GetSuperGroupsInfoResp) Reset() { *m = GetSuperGroupsInfoResp{} func (m *GetSuperGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupsInfoResp) ProtoMessage() {} func (*GetSuperGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{49} + return fileDescriptor_group_4a94cf46004e5ca3, []int{49} } func (m *GetSuperGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupsInfoResp.Unmarshal(m, b) @@ -2141,7 +2141,7 @@ func (m *SetGroupMemberInfo) Reset() { *m = SetGroupMemberInfo{} } func (m *SetGroupMemberInfo) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfo) ProtoMessage() {} func (*SetGroupMemberInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{50} + return fileDescriptor_group_4a94cf46004e5ca3, []int{50} } func (m *SetGroupMemberInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfo.Unmarshal(m, b) @@ -2214,7 +2214,7 @@ func (m *SetGroupMemberInfoReq) Reset() { *m = SetGroupMemberInfoReq{} } func (m *SetGroupMemberInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfoReq) ProtoMessage() {} func (*SetGroupMemberInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{51} + return fileDescriptor_group_4a94cf46004e5ca3, []int{51} } func (m *SetGroupMemberInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfoReq.Unmarshal(m, b) @@ -2251,7 +2251,7 @@ func (m *SetGroupMemberInfoResp) Reset() { *m = SetGroupMemberInfoResp{} func (m *SetGroupMemberInfoResp) String() string { return proto.CompactTextString(m) } func (*SetGroupMemberInfoResp) ProtoMessage() {} func (*SetGroupMemberInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{52} + return fileDescriptor_group_4a94cf46004e5ca3, []int{52} } func (m *SetGroupMemberInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupMemberInfoResp.Unmarshal(m, b) @@ -2282,7 +2282,7 @@ func (m *GetGroupAbstractInfoReq) Reset() { *m = GetGroupAbstractInfoReq func (m *GetGroupAbstractInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAbstractInfoReq) ProtoMessage() {} func (*GetGroupAbstractInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{53} + return fileDescriptor_group_4a94cf46004e5ca3, []int{53} } func (m *GetGroupAbstractInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAbstractInfoReq.Unmarshal(m, b) @@ -2322,7 +2322,7 @@ func (m *GroupAbstractInfo) Reset() { *m = GroupAbstractInfo{} } func (m *GroupAbstractInfo) String() string { return proto.CompactTextString(m) } func (*GroupAbstractInfo) ProtoMessage() {} func (*GroupAbstractInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{54} + return fileDescriptor_group_4a94cf46004e5ca3, []int{54} } func (m *GroupAbstractInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupAbstractInfo.Unmarshal(m, b) @@ -2374,7 +2374,7 @@ func (m *GetGroupAbstractInfoResp) Reset() { *m = GetGroupAbstractInfoRe func (m *GetGroupAbstractInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAbstractInfoResp) ProtoMessage() {} func (*GetGroupAbstractInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{55} + return fileDescriptor_group_4a94cf46004e5ca3, []int{55} } func (m *GetGroupAbstractInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAbstractInfoResp.Unmarshal(m, b) @@ -2413,7 +2413,7 @@ func (m *GetUserInGroupMembersReq) Reset() { *m = GetUserInGroupMembersR func (m *GetUserInGroupMembersReq) String() string { return proto.CompactTextString(m) } func (*GetUserInGroupMembersReq) ProtoMessage() {} func (*GetUserInGroupMembersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{56} + return fileDescriptor_group_4a94cf46004e5ca3, []int{56} } func (m *GetUserInGroupMembersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInGroupMembersReq.Unmarshal(m, b) @@ -2458,7 +2458,7 @@ func (m *GetUserInGroupMembersResp) Reset() { *m = GetUserInGroupMembers func (m *GetUserInGroupMembersResp) String() string { return proto.CompactTextString(m) } func (*GetUserInGroupMembersResp) ProtoMessage() {} func (*GetUserInGroupMembersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{57} + return fileDescriptor_group_4a94cf46004e5ca3, []int{57} } func (m *GetUserInGroupMembersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInGroupMembersResp.Unmarshal(m, b) @@ -2496,7 +2496,7 @@ func (m *GetGroupMemberUserIDReq) Reset() { *m = GetGroupMemberUserIDReq func (m *GetGroupMemberUserIDReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberUserIDReq) ProtoMessage() {} func (*GetGroupMemberUserIDReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{58} + return fileDescriptor_group_4a94cf46004e5ca3, []int{58} } func (m *GetGroupMemberUserIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberUserIDReq.Unmarshal(m, b) @@ -2534,7 +2534,7 @@ func (m *GetGroupMemberUserIDResp) Reset() { *m = GetGroupMemberUserIDRe func (m *GetGroupMemberUserIDResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberUserIDResp) ProtoMessage() {} func (*GetGroupMemberUserIDResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_b971ad66a8171801, []int{59} + return fileDescriptor_group_4a94cf46004e5ca3, []int{59} } func (m *GetGroupMemberUserIDResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberUserIDResp.Unmarshal(m, b) @@ -2561,6 +2561,90 @@ func (m *GetGroupMemberUserIDResp) GetUserIDs() []string { return nil } +type GetGroupMemberRoleLevelReq struct { + GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` + RoleLevels []int32 `protobuf:"varint,2,rep,packed,name=roleLevels" json:"roleLevels,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetGroupMemberRoleLevelReq) Reset() { *m = GetGroupMemberRoleLevelReq{} } +func (m *GetGroupMemberRoleLevelReq) String() string { return proto.CompactTextString(m) } +func (*GetGroupMemberRoleLevelReq) ProtoMessage() {} +func (*GetGroupMemberRoleLevelReq) Descriptor() ([]byte, []int) { + return fileDescriptor_group_4a94cf46004e5ca3, []int{60} +} +func (m *GetGroupMemberRoleLevelReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetGroupMemberRoleLevelReq.Unmarshal(m, b) +} +func (m *GetGroupMemberRoleLevelReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetGroupMemberRoleLevelReq.Marshal(b, m, deterministic) +} +func (dst *GetGroupMemberRoleLevelReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetGroupMemberRoleLevelReq.Merge(dst, src) +} +func (m *GetGroupMemberRoleLevelReq) XXX_Size() int { + return xxx_messageInfo_GetGroupMemberRoleLevelReq.Size(m) +} +func (m *GetGroupMemberRoleLevelReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetGroupMemberRoleLevelReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetGroupMemberRoleLevelReq proto.InternalMessageInfo + +func (m *GetGroupMemberRoleLevelReq) GetGroupID() string { + if m != nil { + return m.GroupID + } + return "" +} + +func (m *GetGroupMemberRoleLevelReq) GetRoleLevels() []int32 { + if m != nil { + return m.RoleLevels + } + return nil +} + +type GetGroupMemberRoleLevelResp struct { + Members []*sdkws.GroupMemberFullInfo `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetGroupMemberRoleLevelResp) Reset() { *m = GetGroupMemberRoleLevelResp{} } +func (m *GetGroupMemberRoleLevelResp) String() string { return proto.CompactTextString(m) } +func (*GetGroupMemberRoleLevelResp) ProtoMessage() {} +func (*GetGroupMemberRoleLevelResp) Descriptor() ([]byte, []int) { + return fileDescriptor_group_4a94cf46004e5ca3, []int{61} +} +func (m *GetGroupMemberRoleLevelResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetGroupMemberRoleLevelResp.Unmarshal(m, b) +} +func (m *GetGroupMemberRoleLevelResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetGroupMemberRoleLevelResp.Marshal(b, m, deterministic) +} +func (dst *GetGroupMemberRoleLevelResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetGroupMemberRoleLevelResp.Merge(dst, src) +} +func (m *GetGroupMemberRoleLevelResp) XXX_Size() int { + return xxx_messageInfo_GetGroupMemberRoleLevelResp.Size(m) +} +func (m *GetGroupMemberRoleLevelResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetGroupMemberRoleLevelResp.DiscardUnknown(m) +} + +var xxx_messageInfo_GetGroupMemberRoleLevelResp proto.InternalMessageInfo + +func (m *GetGroupMemberRoleLevelResp) GetMembers() []*sdkws.GroupMemberFullInfo { + if m != nil { + return m.Members + } + return nil +} + func init() { proto.RegisterType((*CreateGroupReq)(nil), "group.CreateGroupReq") proto.RegisterType((*CreateGroupResp)(nil), "group.CreateGroupResp") @@ -2622,6 +2706,8 @@ func init() { proto.RegisterType((*GetUserInGroupMembersResp)(nil), "group.GetUserInGroupMembersResp") proto.RegisterType((*GetGroupMemberUserIDReq)(nil), "group.GetGroupMemberUserIDReq") proto.RegisterType((*GetGroupMemberUserIDResp)(nil), "group.GetGroupMemberUserIDResp") + proto.RegisterType((*GetGroupMemberRoleLevelReq)(nil), "group.GetGroupMemberRoleLevelReq") + proto.RegisterType((*GetGroupMemberRoleLevelResp)(nil), "group.GetGroupMemberRoleLevelResp") } // Reference imports to suppress errors if they are not otherwise used. @@ -2688,6 +2774,8 @@ type GroupClient interface { GetUserInGroupMembers(ctx context.Context, in *GetUserInGroupMembersReq, opts ...grpc.CallOption) (*GetUserInGroupMembersResp, error) // 获取群成员用户ID GetGroupMemberUserID(ctx context.Context, in *GetGroupMemberUserIDReq, opts ...grpc.CallOption) (*GetGroupMemberUserIDResp, error) + // 查询群组中对应级别的成员 + GetGroupMemberRoleLevel(ctx context.Context, in *GetGroupMemberRoleLevelReq, opts ...grpc.CallOption) (*GetGroupMemberRoleLevelResp, error) } type groupClient struct { @@ -2941,6 +3029,15 @@ func (c *groupClient) GetGroupMemberUserID(ctx context.Context, in *GetGroupMemb return out, nil } +func (c *groupClient) GetGroupMemberRoleLevel(ctx context.Context, in *GetGroupMemberRoleLevelReq, opts ...grpc.CallOption) (*GetGroupMemberRoleLevelResp, error) { + out := new(GetGroupMemberRoleLevelResp) + err := grpc.Invoke(ctx, "/group.group/GetGroupMemberRoleLevel", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for Group service type GroupServer interface { @@ -2997,6 +3094,8 @@ type GroupServer interface { GetUserInGroupMembers(context.Context, *GetUserInGroupMembersReq) (*GetUserInGroupMembersResp, error) // 获取群成员用户ID GetGroupMemberUserID(context.Context, *GetGroupMemberUserIDReq) (*GetGroupMemberUserIDResp, error) + // 查询群组中对应级别的成员 + GetGroupMemberRoleLevel(context.Context, *GetGroupMemberRoleLevelReq) (*GetGroupMemberRoleLevelResp, error) } func RegisterGroupServer(s *grpc.Server, srv GroupServer) { @@ -3489,6 +3588,24 @@ func _Group_GetGroupMemberUserID_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _Group_GetGroupMemberRoleLevel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGroupMemberRoleLevelReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GroupServer).GetGroupMemberRoleLevel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/group.group/GetGroupMemberRoleLevel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GroupServer).GetGroupMemberRoleLevel(ctx, req.(*GetGroupMemberRoleLevelReq)) + } + return interceptor(ctx, in, info, handler) +} + var _Group_serviceDesc = grpc.ServiceDesc{ ServiceName: "group.group", HandlerType: (*GroupServer)(nil), @@ -3601,126 +3718,132 @@ var _Group_serviceDesc = grpc.ServiceDesc{ MethodName: "getGroupMemberUserID", Handler: _Group_GetGroupMemberUserID_Handler, }, + { + MethodName: "GetGroupMemberRoleLevel", + Handler: _Group_GetGroupMemberRoleLevel_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "group/group.proto", } -func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_b971ad66a8171801) } +func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_4a94cf46004e5ca3) } -var fileDescriptor_group_b971ad66a8171801 = []byte{ - // 1808 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0x5f, 0x53, 0xdc, 0xc8, - 0x11, 0x2f, 0x2d, 0x06, 0x43, 0x9b, 0x35, 0x30, 0xb0, 0x20, 0x04, 0x06, 0x32, 0xa6, 0x1c, 0x2a, - 0xb1, 0x97, 0x94,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a4, 0xc5, 0xe9, 0x14, - 0x98, 0x39, 0xa9, 0x85, 0x2a, 0xf4, 0x2b, 0xd7, 0xc2, 0x12, 0x4c, 0x2d, 0xd7, 0xc2, 0x52, 0x00, - 0x1d, 0x47, 0x47, 0x0e, 0xd5, 0xca, 0xd1, 0x51, 0x44, 0xc9, 0x72, 0x74, 0xa8, 0xe0, 0xf0, 0x01, - 0x20, 0x56, 0xc4, 0xb3, 0x8b, 0xe5, 0xc0, 0x4c, 0xda, 0x52, 0x8d, 0xcb, 0xd0, 0xbf, 0x61, 0xc6, - 0x56, 0x00, 0x1a, 0x94, 0x2f, 0x10, 0x39, 0xd0, 0x66, 0x2c, 0xf7, 0x5d, 0x8f, 0xc3, 0xc7, 0x56, - 0x61, 0x0e, 0xb4, 0x9c, 0xad, 0xf0, 0x05, 0x84, 0x23, 0xc2, 0xa7, 0x1c, 0xb2, 0x48, 0x46, 0xcb, - 0xd8, 0x01, 0xa9, 0xab, 0x9a, 0x40, 0x23, 0x05, 0xa3, 0xf3, 0xc0, 0xe3, 0xe9, 0xf2, 0xeb, 0x5b, - 0xfb, 0x94, 0x78, 0x87, 0x3b, 0x0d, 0xe9, 0xbf, 0x48, 0x2e, 0xf3, 0x57, 0xfe, 0x7b, 0x34, 0xc2, - 0x49, 0x1b, 0xbf, 0x04, 0x00, 0x00, 0xff, 0xff, 0x19, 0x28, 0x60, 0x4b, 0xfe, 0x1c, 0x00, 0x00, +var fileDescriptor_group_4a94cf46004e5ca3 = []byte{ + // 1833 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x51, 0x53, 0xe4, 0xc6, + 0x11, 0xae, 0xdd, 0x33, 0xdc, 0xd1, 0xc7, 0x1a, 0x18, 0xd8, 0x45, 0x27, 0xb8, 0x83, 0x8c, 0xaf, + 0x62, 0x2a, 0x31, 0x8b, 0x0b, 0x2e, 0x2e, 0xbb, 0x92,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xf4, 0xf2, 0x74, 0x06, 0xf0, 0x9e, 0xd5, 0x42, 0x13, 0x0c, 0x57, + 0x6b, 0x61, 0x0d, 0xb8, 0x57, 0x6b, 0x61, 0x2d, 0x92, 0x17, 0xd1, 0x51, 0x81, 0xda, 0x6a, 0x74, + 0xe8, 0xd0, 0x5d, 0x8d, 0x0e, 0x13, 0x46, 0x3f, 0x07, 0xc4, 0x74, 0xc0, 0xbd, 0x59, 0x8f, 0x1c, + 0x95, 0x2d, 0xcd, 0xc0, 0x11, 0xfd, 0x11, 0xd6, 0x3c, 0x03, 0xe2, 0x42, 0xd5, 0x02, 0x51, 0x41, + 0x95, 0xf6, 0xd6, 0x44, 0xbe, 0x08, 0x1f, 0xcf, 0x04, 0x8a, 0xd0, 0x56, 0xb9, 0xc2, 0x6b, 0x10, + 0x4c, 0x86, 0x4f, 0x3d, 0xa6, 0x52, 0x8c, 0x56, 0x81, 0x0e, 0x32, 0x57, 0x35, 0x09, 0x9d, 0x34, + 0xa3, 0x35, 0x94, 0xf4, 0x7d, 0x15, 0x76, 0x49, 0xcc, 0xa2, 0xbd, 0x90, 0x3a, 0x56, 0xd2, 0x5e, + 0x48, 0x03, 0xec, 0xf9, 0x62, 0xeb, 0xbb, 0xa7, 0x67, 0x94, 0x84, 0x7f, 0x3e, 0xee, 0x29, 0x7f, + 0x48, 0xf2, 0x65, 0xbf, 0xe6, 0xbf, 0x17, 0xf3, 0x9c, 0x74, 0xf0, 0xff, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x9c, 0xc0, 0xab, 0xba, 0x02, 0x1d, 0x00, 0x00, } diff --git a/pkg/proto/group/group.proto b/pkg/proto/group/group.proto index 39a84d00a..d5cb23324 100644 --- a/pkg/proto/group/group.proto +++ b/pkg/proto/group/group.proto @@ -279,7 +279,7 @@ message GetUserInGroupMembersReq { repeated string groupIDs = 2; } -message getUserInGroupMembersResp{ +message GetUserInGroupMembersResp{ repeated sdkws.GroupMemberFullInfo members = 1; } @@ -291,7 +291,14 @@ message GetGroupMemberUserIDResp{ repeated string userIDs = 1; } +message GetGroupMemberRoleLevelReq{ + string groupID = 1; + repeated int32 roleLevels = 2; +} +message GetGroupMemberRoleLevelResp { + repeated sdkws.GroupMemberFullInfo members = 1; +} service group{ //创建群 @@ -350,6 +357,8 @@ service group{ rpc getUserInGroupMembers(GetUserInGroupMembersReq) returns (GetUserInGroupMembersResp); //获取群成员用户ID rpc getGroupMemberUserID(GetGroupMemberUserIDReq) returns (GetGroupMemberUserIDResp); + //查询群组中对应级别的成员 + rpc GetGroupMemberRoleLevel(GetGroupMemberRoleLevelReq)returns (GetGroupMemberRoleLevelResp); } diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index 60eb493e3..08cdde4fc 100644 --- a/pkg/proto/msg/msg.pb.go +++ b/pkg/proto/msg/msg.pb.go @@ -38,7 +38,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} } func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) } func (*MsgDataToMQ) ProtoMessage() {} func (*MsgDataToMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{0} + return fileDescriptor_msg_9bd9d9abca588885, []int{0} } func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b) @@ -91,7 +91,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} } func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) } func (*MsgDataToDB) ProtoMessage() {} func (*MsgDataToDB) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{1} + return fileDescriptor_msg_9bd9d9abca588885, []int{1} } func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b) @@ -138,7 +138,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} } func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) } func (*PushMsgDataToMQ) ProtoMessage() {} func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{2} + return fileDescriptor_msg_9bd9d9abca588885, []int{2} } func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b) @@ -193,7 +193,7 @@ func (m *MsgDataToMongoByMQ) Reset() { *m = MsgDataToMongoByMQ{} } func (m *MsgDataToMongoByMQ) String() string { return proto.CompactTextString(m) } func (*MsgDataToMongoByMQ) ProtoMessage() {} func (*MsgDataToMongoByMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{3} + return fileDescriptor_msg_9bd9d9abca588885, []int{3} } func (m *MsgDataToMongoByMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToMongoByMQ.Unmarshal(m, b) @@ -241,26 +241,6 @@ func (m *MsgDataToMongoByMQ) GetTriggerID() string { return "" } -// message PullMessageReq { -// string UserID = 1; -// int64 SeqBegin = 2; -// int64 SeqEnd = 3; -// string OperationID = 4; -// } -// -// message PullMessageResp { -// int32 ErrCode = 1; -// string ErrMsg = 2; -// int64 MaxSeq = 3; -// int64 MinSeq = 4; -// repeated GatherFormat SingleUserMsg = 5; -// repeated GatherFormat GroupUserMsg = 6; -// } -// message PullMessageBySeqListReq{ -// string UserID = 1; -// string OperationID = 2; -// repeated int64 seqList =3; -// } type GetMaxAndMinSeqReq struct { UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` @@ -273,7 +253,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{4} + return fileDescriptor_msg_9bd9d9abca588885, []int{4} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -321,7 +301,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{5} + return fileDescriptor_msg_9bd9d9abca588885, []int{5} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -370,8 +350,6 @@ func (m *GetMaxAndMinSeqResp) GetMinSeq() uint32 { } type SendMsgReq struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` MsgData *sdkws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -382,7 +360,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} } func (m *SendMsgReq) String() string { return proto.CompactTextString(m) } func (*SendMsgReq) ProtoMessage() {} func (*SendMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{6} + return fileDescriptor_msg_9bd9d9abca588885, []int{6} } func (m *SendMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsgReq.Unmarshal(m, b) @@ -402,20 +380,6 @@ func (m *SendMsgReq) XXX_DiscardUnknown() { var xxx_messageInfo_SendMsgReq proto.InternalMessageInfo -func (m *SendMsgReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -func (m *SendMsgReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - func (m *SendMsgReq) GetMsgData() *sdkws.MsgData { if m != nil { return m.MsgData @@ -424,8 +388,6 @@ func (m *SendMsgReq) GetMsgData() *sdkws.MsgData { } type SendMsgResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` ServerMsgID string `protobuf:"bytes,4,opt,name=serverMsgID" json:"serverMsgID,omitempty"` ClientMsgID string `protobuf:"bytes,5,opt,name=clientMsgID" json:"clientMsgID,omitempty"` SendTime int64 `protobuf:"varint,6,opt,name=sendTime" json:"sendTime,omitempty"` @@ -438,7 +400,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} } func (m *SendMsgResp) String() string { return proto.CompactTextString(m) } func (*SendMsgResp) ProtoMessage() {} func (*SendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{7} + return fileDescriptor_msg_9bd9d9abca588885, []int{7} } func (m *SendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsgResp.Unmarshal(m, b) @@ -458,20 +420,6 @@ func (m *SendMsgResp) XXX_DiscardUnknown() { var xxx_messageInfo_SendMsgResp proto.InternalMessageInfo -func (m *SendMsgResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *SendMsgResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - func (m *SendMsgResp) GetServerMsgID() string { if m != nil { return m.ServerMsgID @@ -495,8 +443,6 @@ func (m *SendMsgResp) GetSendTime() int64 { type ClearMsgReq struct { UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - OpUserID string `protobuf:"bytes,2,opt,name=opUserID" json:"opUserID,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -506,7 +452,7 @@ func (m *ClearMsgReq) Reset() { *m = ClearMsgReq{} } func (m *ClearMsgReq) String() string { return proto.CompactTextString(m) } func (*ClearMsgReq) ProtoMessage() {} func (*ClearMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{8} + return fileDescriptor_msg_9bd9d9abca588885, []int{8} } func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b) @@ -533,23 +479,7 @@ func (m *ClearMsgReq) GetUserID() string { return "" } -func (m *ClearMsgReq) GetOpUserID() string { - if m != nil { - return m.OpUserID - } - return "" -} - -func (m *ClearMsgReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - type ClearMsgResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -559,7 +489,7 @@ func (m *ClearMsgResp) Reset() { *m = ClearMsgResp{} } func (m *ClearMsgResp) String() string { return proto.CompactTextString(m) } func (*ClearMsgResp) ProtoMessage() {} func (*ClearMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{9} + return fileDescriptor_msg_9bd9d9abca588885, []int{9} } func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b) @@ -579,26 +509,10 @@ func (m *ClearMsgResp) XXX_DiscardUnknown() { var xxx_messageInfo_ClearMsgResp proto.InternalMessageInfo -func (m *ClearMsgResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *ClearMsgResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - type SetMsgMinSeqReq struct { UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` MinSeq uint32 `protobuf:"varint,3,opt,name=minSeq" json:"minSeq,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=operationID" json:"operationID,omitempty"` - OpUserID string `protobuf:"bytes,5,opt,name=opUserID" json:"opUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -608,7 +522,7 @@ func (m *SetMsgMinSeqReq) Reset() { *m = SetMsgMinSeqReq{} } func (m *SetMsgMinSeqReq) String() string { return proto.CompactTextString(m) } func (*SetMsgMinSeqReq) ProtoMessage() {} func (*SetMsgMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{10} + return fileDescriptor_msg_9bd9d9abca588885, []int{10} } func (m *SetMsgMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMsgMinSeqReq.Unmarshal(m, b) @@ -649,23 +563,7 @@ func (m *SetMsgMinSeqReq) GetMinSeq() uint32 { return 0 } -func (m *SetMsgMinSeqReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *SetMsgMinSeqReq) GetOpUserID() string { - if m != nil { - return m.OpUserID - } - return "" -} - type SetMsgMinSeqResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -675,7 +573,7 @@ func (m *SetMsgMinSeqResp) Reset() { *m = SetMsgMinSeqResp{} } func (m *SetMsgMinSeqResp) String() string { return proto.CompactTextString(m) } func (*SetMsgMinSeqResp) ProtoMessage() {} func (*SetMsgMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{11} + return fileDescriptor_msg_9bd9d9abca588885, []int{11} } func (m *SetMsgMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMsgMinSeqResp.Unmarshal(m, b) @@ -695,22 +593,7 @@ func (m *SetMsgMinSeqResp) XXX_DiscardUnknown() { var xxx_messageInfo_SetMsgMinSeqResp proto.InternalMessageInfo -func (m *SetMsgMinSeqResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *SetMsgMinSeqResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - type SetSendMsgStatusReq struct { - OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` Status int32 `protobuf:"varint,2,opt,name=status" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -721,7 +604,7 @@ func (m *SetSendMsgStatusReq) Reset() { *m = SetSendMsgStatusReq{} } func (m *SetSendMsgStatusReq) String() string { return proto.CompactTextString(m) } func (*SetSendMsgStatusReq) ProtoMessage() {} func (*SetSendMsgStatusReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{12} + return fileDescriptor_msg_9bd9d9abca588885, []int{12} } func (m *SetSendMsgStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetSendMsgStatusReq.Unmarshal(m, b) @@ -741,13 +624,6 @@ func (m *SetSendMsgStatusReq) XXX_DiscardUnknown() { var xxx_messageInfo_SetSendMsgStatusReq proto.InternalMessageInfo -func (m *SetSendMsgStatusReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - func (m *SetSendMsgStatusReq) GetStatus() int32 { if m != nil { return m.Status @@ -756,8 +632,6 @@ func (m *SetSendMsgStatusReq) GetStatus() int32 { } type SetSendMsgStatusResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -767,7 +641,7 @@ func (m *SetSendMsgStatusResp) Reset() { *m = SetSendMsgStatusResp{} } func (m *SetSendMsgStatusResp) String() string { return proto.CompactTextString(m) } func (*SetSendMsgStatusResp) ProtoMessage() {} func (*SetSendMsgStatusResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{13} + return fileDescriptor_msg_9bd9d9abca588885, []int{13} } func (m *SetSendMsgStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetSendMsgStatusResp.Unmarshal(m, b) @@ -787,20 +661,6 @@ func (m *SetSendMsgStatusResp) XXX_DiscardUnknown() { var xxx_messageInfo_SetSendMsgStatusResp proto.InternalMessageInfo -func (m *SetSendMsgStatusResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *SetSendMsgStatusResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - type GetSendMsgStatusReq struct { OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -812,7 +672,7 @@ func (m *GetSendMsgStatusReq) Reset() { *m = GetSendMsgStatusReq{} } func (m *GetSendMsgStatusReq) String() string { return proto.CompactTextString(m) } func (*GetSendMsgStatusReq) ProtoMessage() {} func (*GetSendMsgStatusReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{14} + return fileDescriptor_msg_9bd9d9abca588885, []int{14} } func (m *GetSendMsgStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSendMsgStatusReq.Unmarshal(m, b) @@ -852,7 +712,7 @@ func (m *GetSendMsgStatusResp) Reset() { *m = GetSendMsgStatusResp{} } func (m *GetSendMsgStatusResp) String() string { return proto.CompactTextString(m) } func (*GetSendMsgStatusResp) ProtoMessage() {} func (*GetSendMsgStatusResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{15} + return fileDescriptor_msg_9bd9d9abca588885, []int{15} } func (m *GetSendMsgStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSendMsgStatusResp.Unmarshal(m, b) @@ -894,10 +754,8 @@ func (m *GetSendMsgStatusResp) GetStatus() int32 { } type DelSuperGroupMsgReq struct { - OpUserID string `protobuf:"bytes,1,opt,name=opUserID" json:"opUserID,omitempty"` UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` GroupID string `protobuf:"bytes,3,opt,name=groupID" json:"groupID,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -907,7 +765,7 @@ func (m *DelSuperGroupMsgReq) Reset() { *m = DelSuperGroupMsgReq{} } func (m *DelSuperGroupMsgReq) String() string { return proto.CompactTextString(m) } func (*DelSuperGroupMsgReq) ProtoMessage() {} func (*DelSuperGroupMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{16} + return fileDescriptor_msg_9bd9d9abca588885, []int{16} } func (m *DelSuperGroupMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DelSuperGroupMsgReq.Unmarshal(m, b) @@ -927,13 +785,6 @@ func (m *DelSuperGroupMsgReq) XXX_DiscardUnknown() { var xxx_messageInfo_DelSuperGroupMsgReq proto.InternalMessageInfo -func (m *DelSuperGroupMsgReq) GetOpUserID() string { - if m != nil { - return m.OpUserID - } - return "" -} - func (m *DelSuperGroupMsgReq) GetUserID() string { if m != nil { return m.UserID @@ -948,16 +799,7 @@ func (m *DelSuperGroupMsgReq) GetGroupID() string { return "" } -func (m *DelSuperGroupMsgReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - type DelSuperGroupMsgResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -967,7 +809,7 @@ func (m *DelSuperGroupMsgResp) Reset() { *m = DelSuperGroupMsgResp{} } func (m *DelSuperGroupMsgResp) String() string { return proto.CompactTextString(m) } func (*DelSuperGroupMsgResp) ProtoMessage() {} func (*DelSuperGroupMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{17} + return fileDescriptor_msg_9bd9d9abca588885, []int{17} } func (m *DelSuperGroupMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DelSuperGroupMsgResp.Unmarshal(m, b) @@ -987,20 +829,6 @@ func (m *DelSuperGroupMsgResp) XXX_DiscardUnknown() { var xxx_messageInfo_DelSuperGroupMsgResp proto.InternalMessageInfo -func (m *DelSuperGroupMsgResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *DelSuperGroupMsgResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - type GetSuperGroupMsgReq struct { OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` Seq uint32 `protobuf:"varint,2,opt,name=Seq" json:"Seq,omitempty"` @@ -1014,7 +842,7 @@ func (m *GetSuperGroupMsgReq) Reset() { *m = GetSuperGroupMsgReq{} } func (m *GetSuperGroupMsgReq) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupMsgReq) ProtoMessage() {} func (*GetSuperGroupMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{18} + return fileDescriptor_msg_9bd9d9abca588885, []int{18} } func (m *GetSuperGroupMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupMsgReq.Unmarshal(m, b) @@ -1068,7 +896,7 @@ func (m *GetSuperGroupMsgResp) Reset() { *m = GetSuperGroupMsgResp{} } func (m *GetSuperGroupMsgResp) String() string { return proto.CompactTextString(m) } func (*GetSuperGroupMsgResp) ProtoMessage() {} func (*GetSuperGroupMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{19} + return fileDescriptor_msg_9bd9d9abca588885, []int{19} } func (m *GetSuperGroupMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupMsgResp.Unmarshal(m, b) @@ -1121,7 +949,7 @@ func (m *GetWriteDiffMsgReq) Reset() { *m = GetWriteDiffMsgReq{} } func (m *GetWriteDiffMsgReq) String() string { return proto.CompactTextString(m) } func (*GetWriteDiffMsgReq) ProtoMessage() {} func (*GetWriteDiffMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{20} + return fileDescriptor_msg_9bd9d9abca588885, []int{20} } func (m *GetWriteDiffMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetWriteDiffMsgReq.Unmarshal(m, b) @@ -1168,7 +996,7 @@ func (m *GetWriteDiffMsgResp) Reset() { *m = GetWriteDiffMsgResp{} } func (m *GetWriteDiffMsgResp) String() string { return proto.CompactTextString(m) } func (*GetWriteDiffMsgResp) ProtoMessage() {} func (*GetWriteDiffMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{21} + return fileDescriptor_msg_9bd9d9abca588885, []int{21} } func (m *GetWriteDiffMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetWriteDiffMsgResp.Unmarshal(m, b) @@ -1230,7 +1058,7 @@ func (m *ModifyMessageReactionExtensionsReq) Reset() { *m = ModifyMessag func (m *ModifyMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) } func (*ModifyMessageReactionExtensionsReq) ProtoMessage() {} func (*ModifyMessageReactionExtensionsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{22} + return fileDescriptor_msg_9bd9d9abca588885, []int{22} } func (m *ModifyMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ModifyMessageReactionExtensionsReq.Unmarshal(m, b) @@ -1348,7 +1176,7 @@ func (m *SetMessageReactionExtensionsReq) Reset() { *m = SetMessageReact func (m *SetMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) } func (*SetMessageReactionExtensionsReq) ProtoMessage() {} func (*SetMessageReactionExtensionsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{23} + return fileDescriptor_msg_9bd9d9abca588885, []int{23} } func (m *SetMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMessageReactionExtensionsReq.Unmarshal(m, b) @@ -1461,7 +1289,7 @@ func (m *SetMessageReactionExtensionsResp) Reset() { *m = SetMessageReac func (m *SetMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) } func (*SetMessageReactionExtensionsResp) ProtoMessage() {} func (*SetMessageReactionExtensionsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{24} + return fileDescriptor_msg_9bd9d9abca588885, []int{24} } func (m *SetMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMessageReactionExtensionsResp.Unmarshal(m, b) @@ -1538,7 +1366,7 @@ func (m *GetMessageListReactionExtensionsReq) Reset() { *m = GetMessageL func (m *GetMessageListReactionExtensionsReq) String() string { return proto.CompactTextString(m) } func (*GetMessageListReactionExtensionsReq) ProtoMessage() {} func (*GetMessageListReactionExtensionsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{25} + return fileDescriptor_msg_9bd9d9abca588885, []int{25} } func (m *GetMessageListReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMessageListReactionExtensionsReq.Unmarshal(m, b) @@ -1609,7 +1437,7 @@ func (m *GetMessageListReactionExtensionsReq_MessageReactionKey) String() string } func (*GetMessageListReactionExtensionsReq_MessageReactionKey) ProtoMessage() {} func (*GetMessageListReactionExtensionsReq_MessageReactionKey) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{25, 0} + return fileDescriptor_msg_9bd9d9abca588885, []int{25, 0} } func (m *GetMessageListReactionExtensionsReq_MessageReactionKey) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMessageListReactionExtensionsReq_MessageReactionKey.Unmarshal(m, b) @@ -1656,7 +1484,7 @@ func (m *GetMessageListReactionExtensionsResp) Reset() { *m = GetMessage func (m *GetMessageListReactionExtensionsResp) String() string { return proto.CompactTextString(m) } func (*GetMessageListReactionExtensionsResp) ProtoMessage() {} func (*GetMessageListReactionExtensionsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{26} + return fileDescriptor_msg_9bd9d9abca588885, []int{26} } func (m *GetMessageListReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMessageListReactionExtensionsResp.Unmarshal(m, b) @@ -1711,7 +1539,7 @@ func (m *SingleMessageExtensionResult) Reset() { *m = SingleMessageExten func (m *SingleMessageExtensionResult) String() string { return proto.CompactTextString(m) } func (*SingleMessageExtensionResult) ProtoMessage() {} func (*SingleMessageExtensionResult) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{27} + return fileDescriptor_msg_9bd9d9abca588885, []int{27} } func (m *SingleMessageExtensionResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingleMessageExtensionResult.Unmarshal(m, b) @@ -1773,7 +1601,7 @@ func (m *ModifyMessageReactionExtensionsResp) Reset() { *m = ModifyMessa func (m *ModifyMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) } func (*ModifyMessageReactionExtensionsResp) ProtoMessage() {} func (*ModifyMessageReactionExtensionsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{28} + return fileDescriptor_msg_9bd9d9abca588885, []int{28} } func (m *ModifyMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ModifyMessageReactionExtensionsResp.Unmarshal(m, b) @@ -1841,7 +1669,7 @@ func (m *DeleteMessageListReactionExtensionsReq) Reset() { func (m *DeleteMessageListReactionExtensionsReq) String() string { return proto.CompactTextString(m) } func (*DeleteMessageListReactionExtensionsReq) ProtoMessage() {} func (*DeleteMessageListReactionExtensionsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{29} + return fileDescriptor_msg_9bd9d9abca588885, []int{29} } func (m *DeleteMessageListReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteMessageListReactionExtensionsReq.Unmarshal(m, b) @@ -1932,7 +1760,7 @@ func (m *DeleteMessageListReactionExtensionsResp) Reset() { func (m *DeleteMessageListReactionExtensionsResp) String() string { return proto.CompactTextString(m) } func (*DeleteMessageListReactionExtensionsResp) ProtoMessage() {} func (*DeleteMessageListReactionExtensionsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{30} + return fileDescriptor_msg_9bd9d9abca588885, []int{30} } func (m *DeleteMessageListReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteMessageListReactionExtensionsResp.Unmarshal(m, b) @@ -1986,7 +1814,7 @@ func (m *ExtendMsgResp) Reset() { *m = ExtendMsgResp{} } func (m *ExtendMsgResp) String() string { return proto.CompactTextString(m) } func (*ExtendMsgResp) ProtoMessage() {} func (*ExtendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{31} + return fileDescriptor_msg_9bd9d9abca588885, []int{31} } func (m *ExtendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsgResp.Unmarshal(m, b) @@ -2042,7 +1870,7 @@ func (m *ExtendMsg) Reset() { *m = ExtendMsg{} } func (m *ExtendMsg) String() string { return proto.CompactTextString(m) } func (*ExtendMsg) ProtoMessage() {} func (*ExtendMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{32} + return fileDescriptor_msg_9bd9d9abca588885, []int{32} } func (m *ExtendMsg) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsg.Unmarshal(m, b) @@ -2110,7 +1938,7 @@ func (m *KeyValueResp) Reset() { *m = KeyValueResp{} } func (m *KeyValueResp) String() string { return proto.CompactTextString(m) } func (*KeyValueResp) ProtoMessage() {} func (*KeyValueResp) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{33} + return fileDescriptor_msg_9bd9d9abca588885, []int{33} } func (m *KeyValueResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KeyValueResp.Unmarshal(m, b) @@ -2164,7 +1992,7 @@ func (m *MsgDataToModifyByMQ) Reset() { *m = MsgDataToModifyByMQ{} } func (m *MsgDataToModifyByMQ) String() string { return proto.CompactTextString(m) } func (*MsgDataToModifyByMQ) ProtoMessage() {} func (*MsgDataToModifyByMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_4f5a59ae8be91efc, []int{34} + return fileDescriptor_msg_9bd9d9abca588885, []int{34} } func (m *MsgDataToModifyByMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToModifyByMQ.Unmarshal(m, b) @@ -2259,18 +2087,23 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Msg service type MsgClient interface { + // 获取最小最大seq(包括用户的,以及指定群组的) GetMaxAndMinSeq(ctx context.Context, in *sdkws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdkws.GetMaxAndMinSeqResp, error) + // 拉取历史消息(包括用户的,以及指定群组的) PullMessageBySeqList(ctx context.Context, in *sdkws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdkws.PullMessageBySeqListResp, error) + // 发送消息 SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) + // 删除某人消息 DelMsgList(ctx context.Context, in *sdkws.DelMsgListReq, opts ...grpc.CallOption) (*sdkws.DelMsgListResp, error) + // 删除某个用户某个大群消息 DelSuperGroupMsg(ctx context.Context, in *DelSuperGroupMsgReq, opts ...grpc.CallOption) (*DelSuperGroupMsgResp, error) + // 清空某人所有消息 ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc.CallOption) (*ClearMsgResp, error) - SetMsgMinSeq(ctx context.Context, in *SetMsgMinSeqReq, opts ...grpc.CallOption) (*SetMsgMinSeqResp, error) + // 设置消息是否发送成功-针对api发送的消息 SetSendMsgStatus(ctx context.Context, in *SetSendMsgStatusReq, opts ...grpc.CallOption) (*SetSendMsgStatusResp, error) + // 获取消息发送状态 GetSendMsgStatus(ctx context.Context, in *GetSendMsgStatusReq, opts ...grpc.CallOption) (*GetSendMsgStatusResp, error) - GetSuperGroupMsg(ctx context.Context, in *GetSuperGroupMsgReq, opts ...grpc.CallOption) (*GetSuperGroupMsgResp, error) - GetWriteDiffMsg(ctx context.Context, in *GetWriteDiffMsgReq, opts ...grpc.CallOption) (*GetWriteDiffMsgResp, error) - // modify msg + // 修改消息 SetMessageReactionExtensions(ctx context.Context, in *SetMessageReactionExtensionsReq, opts ...grpc.CallOption) (*SetMessageReactionExtensionsResp, error) GetMessageListReactionExtensions(ctx context.Context, in *GetMessageListReactionExtensionsReq, opts ...grpc.CallOption) (*GetMessageListReactionExtensionsResp, error) AddMessageReactionExtensions(ctx context.Context, in *ModifyMessageReactionExtensionsReq, opts ...grpc.CallOption) (*ModifyMessageReactionExtensionsResp, error) @@ -2339,15 +2172,6 @@ func (c *msgClient) ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc. return out, nil } -func (c *msgClient) SetMsgMinSeq(ctx context.Context, in *SetMsgMinSeqReq, opts ...grpc.CallOption) (*SetMsgMinSeqResp, error) { - out := new(SetMsgMinSeqResp) - err := grpc.Invoke(ctx, "/msg.msg/SetMsgMinSeq", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) SetSendMsgStatus(ctx context.Context, in *SetSendMsgStatusReq, opts ...grpc.CallOption) (*SetSendMsgStatusResp, error) { out := new(SetSendMsgStatusResp) err := grpc.Invoke(ctx, "/msg.msg/SetSendMsgStatus", in, out, c.cc, opts...) @@ -2366,24 +2190,6 @@ func (c *msgClient) GetSendMsgStatus(ctx context.Context, in *GetSendMsgStatusRe return out, nil } -func (c *msgClient) GetSuperGroupMsg(ctx context.Context, in *GetSuperGroupMsgReq, opts ...grpc.CallOption) (*GetSuperGroupMsgResp, error) { - out := new(GetSuperGroupMsgResp) - err := grpc.Invoke(ctx, "/msg.msg/GetSuperGroupMsg", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) GetWriteDiffMsg(ctx context.Context, in *GetWriteDiffMsgReq, opts ...grpc.CallOption) (*GetWriteDiffMsgResp, error) { - out := new(GetWriteDiffMsgResp) - err := grpc.Invoke(ctx, "/msg.msg/GetWriteDiffMsg", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) SetMessageReactionExtensions(ctx context.Context, in *SetMessageReactionExtensionsReq, opts ...grpc.CallOption) (*SetMessageReactionExtensionsResp, error) { out := new(SetMessageReactionExtensionsResp) err := grpc.Invoke(ctx, "/msg.msg/SetMessageReactionExtensions", in, out, c.cc, opts...) @@ -2423,18 +2229,23 @@ func (c *msgClient) DeleteMessageReactionExtensions(ctx context.Context, in *Del // Server API for Msg service type MsgServer interface { + // 获取最小最大seq(包括用户的,以及指定群组的) GetMaxAndMinSeq(context.Context, *sdkws.GetMaxAndMinSeqReq) (*sdkws.GetMaxAndMinSeqResp, error) + // 拉取历史消息(包括用户的,以及指定群组的) PullMessageBySeqList(context.Context, *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) + // 发送消息 SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) + // 删除某人消息 DelMsgList(context.Context, *sdkws.DelMsgListReq) (*sdkws.DelMsgListResp, error) + // 删除某个用户某个大群消息 DelSuperGroupMsg(context.Context, *DelSuperGroupMsgReq) (*DelSuperGroupMsgResp, error) + // 清空某人所有消息 ClearMsg(context.Context, *ClearMsgReq) (*ClearMsgResp, error) - SetMsgMinSeq(context.Context, *SetMsgMinSeqReq) (*SetMsgMinSeqResp, error) + // 设置消息是否发送成功-针对api发送的消息 SetSendMsgStatus(context.Context, *SetSendMsgStatusReq) (*SetSendMsgStatusResp, error) + // 获取消息发送状态 GetSendMsgStatus(context.Context, *GetSendMsgStatusReq) (*GetSendMsgStatusResp, error) - GetSuperGroupMsg(context.Context, *GetSuperGroupMsgReq) (*GetSuperGroupMsgResp, error) - GetWriteDiffMsg(context.Context, *GetWriteDiffMsgReq) (*GetWriteDiffMsgResp, error) - // modify msg + // 修改消息 SetMessageReactionExtensions(context.Context, *SetMessageReactionExtensionsReq) (*SetMessageReactionExtensionsResp, error) GetMessageListReactionExtensions(context.Context, *GetMessageListReactionExtensionsReq) (*GetMessageListReactionExtensionsResp, error) AddMessageReactionExtensions(context.Context, *ModifyMessageReactionExtensionsReq) (*ModifyMessageReactionExtensionsResp, error) @@ -2553,24 +2364,6 @@ func _Msg_ClearMsg_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Msg_SetMsgMinSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetMsgMinSeqReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SetMsgMinSeq(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/msg.msg/SetMsgMinSeq", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SetMsgMinSeq(ctx, req.(*SetMsgMinSeqReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_SetSendMsgStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetSendMsgStatusReq) if err := dec(in); err != nil { @@ -2607,42 +2400,6 @@ func _Msg_GetSendMsgStatus_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Msg_GetSuperGroupMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetSuperGroupMsgReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).GetSuperGroupMsg(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/msg.msg/GetSuperGroupMsg", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).GetSuperGroupMsg(ctx, req.(*GetSuperGroupMsgReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_GetWriteDiffMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetWriteDiffMsgReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).GetWriteDiffMsg(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/msg.msg/GetWriteDiffMsg", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).GetWriteDiffMsg(ctx, req.(*GetWriteDiffMsgReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_SetMessageReactionExtensions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SetMessageReactionExtensionsReq) if err := dec(in); err != nil { @@ -2743,10 +2500,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ClearMsg", Handler: _Msg_ClearMsg_Handler, }, - { - MethodName: "SetMsgMinSeq", - Handler: _Msg_SetMsgMinSeq_Handler, - }, { MethodName: "SetSendMsgStatus", Handler: _Msg_SetSendMsgStatus_Handler, @@ -2755,14 +2508,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "GetSendMsgStatus", Handler: _Msg_GetSendMsgStatus_Handler, }, - { - MethodName: "GetSuperGroupMsg", - Handler: _Msg_GetSuperGroupMsg_Handler, - }, - { - MethodName: "GetWriteDiffMsg", - Handler: _Msg_GetWriteDiffMsg_Handler, - }, { MethodName: "SetMessageReactionExtensions", Handler: _Msg_SetMessageReactionExtensions_Handler, @@ -2784,113 +2529,107 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "msg/msg.proto", } -func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_4f5a59ae8be91efc) } +func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_9bd9d9abca588885) } -var fileDescriptor_msg_4f5a59ae8be91efc = []byte{ - // 1672 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x6e, 0xdb, 0xc6, - 0x16, 0x06, 0x49, 0x4b, 0xb6, 0x8f, 0xec, 0xd8, 0x19, 0x3b, 0xbe, 0x0a, 0x63, 0x20, 0x0a, 0xf3, - 0xa7, 0xdc, 0x24, 0x32, 0xae, 0xef, 0x05, 0x72, 0xd1, 0x14, 0x68, 0xe2, 0xc8, 0x55, 0x8c, 0x94, - 0x75, 0x4c, 0xb9, 0x2d, 0xd0, 0x2e, 0x1c, 0x46, 0x1a, 0x33, 0x84, 0x25, 0x92, 0xe6, 0x50, 0xb1, - 0xd5, 0xbf, 0x5d, 0x8b, 0x02, 0x45, 0x16, 0x5d, 0x76, 0xd5, 0x5d, 0x77, 0x7d, 0x88, 0x3e, 0x40, - 0xd1, 0x07, 0xe9, 0x33, 0xb4, 0x28, 0x66, 0x86, 0x92, 0x86, 0x7f, 0x16, 0x2d, 0x17, 0x41, 0x0a, - 0x74, 0xa7, 0x99, 0x39, 0x73, 0xe6, 0xfb, 0xce, 0xf9, 0xe6, 0x87, 0x47, 0x30, 0xdf, 0x25, 0xd6, - 0x5a, 0x97, 0x58, 0x35, 0xcf, 0x77, 0x03, 0x17, 0x29, 0x5d, 0x62, 0xa9, 0xd5, 0x6d, 0x0f, 0x3b, - 0x77, 0xb7, 0xf4, 0xbb, 0x4d, 0xec, 0xbf, 0xc4, 0xfe, 0x9a, 0x77, 0x60, 0xad, 0xb1, 0xe1, 0x35, - 0xd2, 0x3e, 0xd8, 0x3b, 0x22, 0x6b, 0x47, 0x84, 0x9b, 0xab, 0xb5, 0xb1, 0x96, 0xbe, 0xe9, 0x79, - 0xd8, 0x0f, 0xed, 0xb5, 0xcf, 0xa0, 0xa4, 0x13, 0xab, 0x6e, 0x06, 0xe6, 0xae, 0xab, 0xef, 0xa0, - 0x65, 0x28, 0x04, 0xee, 0x01, 0x76, 0xca, 0x52, 0x45, 0xaa, 0xce, 0x1a, 0xbc, 0x81, 0x2a, 0x50, - 0x72, 0x3d, 0xec, 0x9b, 0x81, 0xed, 0x3a, 0x5b, 0xf5, 0xb2, 0xcc, 0xc6, 0xc4, 0x2e, 0xf4, 0x3f, - 0x98, 0xee, 0x72, 0x37, 0x65, 0xa5, 0x22, 0x55, 0x4b, 0xeb, 0x6a, 0x8d, 0x30, 0x00, 0x7b, 0xa6, - 0x67, 0xef, 0x79, 0xa6, 0x6f, 0x76, 0x49, 0x2d, 0x5c, 0xc8, 0x18, 0x98, 0x6a, 0x58, 0x58, 0xbc, - 0xbe, 0x21, 0x3a, 0x91, 0x72, 0x3b, 0x19, 0x0f, 0x4e, 0x7b, 0x25, 0xc1, 0xc2, 0xd3, 0x1e, 0x79, - 0x21, 0x12, 0xad, 0x40, 0x69, 0x5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25, 0x90, 0x29, 0x55, 0x39, 0xc1, 0x51, 0x22, 0x90, 0x75, 0xa6, 0x72, 0xb1, 0x30, - 0x85, 0xfe, 0x35, 0xb0, 0x8e, 0x15, 0xbe, 0xd4, 0x72, 0xfa, 0x00, 0xf1, 0xd0, 0x01, 0xac, 0x9e, - 0xf4, 0xf1, 0x84, 0xae, 0xe5, 0xf9, 0x58, 0x56, 0xaf, 0xe7, 0xb0, 0x22, 0x1e, 0x3a, 0x82, 0xca, - 0xb8, 0xa7, 0x33, 0xaa, 0xe6, 0xfd, 0x38, 0x50, 0x6f, 0xe5, 0xb4, 0x24, 0x1e, 0x3a, 0x84, 0xd5, - 0x87, 0xed, 0x76, 0x36, 0xcb, 0x9b, 0x39, 0x6b, 0x54, 0x6a, 0x35, 0x9f, 0x21, 0xf1, 0xd0, 0xe7, - 0x70, 0x39, 0x72, 0xc5, 0xa7, 0xac, 0x7a, 0x7b, 0xb0, 0x4b, 0x72, 0x3c, 0xc4, 0xd4, 0x3b, 0xf9, - 0x8d, 0x89, 0xb7, 0x71, 0xe9, 0xe3, 0x8b, 0xdb, 0x1e, 0x76, 0xf6, 0xb6, 0x74, 0xe1, 0x4f, 0xda, - 0x2e, 0xb1, 0xee, 0x77, 0x89, 0xf5, 0xbc, 0xc8, 0x9a, 0xff, 0xfd, 0x33, 0x00, 0x00, 0xff, 0xff, - 0xd4, 0xae, 0xa9, 0xee, 0x0d, 0x1e, 0x00, 0x00, +var fileDescriptor_msg_9bd9d9abca588885 = []byte{ + // 1569 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x06, 0x49, 0x4b, 0xb6, 0x47, 0x76, 0xec, 0xac, 0x1d, 0x43, 0x61, 0x8d, 0x46, 0x65, 0x92, + 0x5a, 0x41, 0x62, 0x19, 0x70, 0x8b, 0xfe, 0xa5, 0x40, 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xb8, 0x36, 0x4e, 0x51, 0xbe, 0xaa, 0x0f, 0x68, 0xa6, 0x68, + 0x7e, 0x97, 0x35, 0x4e, 0x31, 0x3e, 0xd3, 0xcb, 0x62, 0xa1, 0x7c, 0x46, 0x29, 0x1f, 0x01, 0x74, + 0xb1, 0xd3, 0x53, 0x89, 0x41, 0x03, 0x28, 0x0f, 0x44, 0x1b, 0x6a, 0xd1, 0x3d, 0xe2, 0xd1, 0x08, + 0x09, 0xeb, 0x18, 0x95, 0x18, 0x51, 0xbe, 0xe2, 0x2c, 0x2a, 0x71, 0x64, 0x99, 0xd8, 0x09, 0x42, + 0x89, 0x4a, 0x28, 0x11, 0x63, 0x21, 0x19, 0x16, 0x08, 0x76, 0x7a, 0x87, 0xa6, 0x8d, 0xeb, 0xd5, + 0x86, 0xd0, 0x94, 0xb4, 0x88, 0x56, 0xae, 0x43, 0xed, 0xae, 0x85, 0x75, 0x9f, 0xfb, 0xb9, 0x01, + 0xd5, 0x7e, 0x22, 0xd1, 0x21, 0xa5, 0x5c, 0x80, 0xa5, 0xb1, 0x18, 0xf1, 0x94, 0xa7, 0xb0, 0xd2, + 0xc5, 0x54, 0x7d, 0xa2, 0x46, 0x79, 0x57, 0x69, 0xaa, 0x0d, 0xdf, 0xed, 0x7b, 0x51, 0x7d, 0x46, + 0x24, 0xbd, 0x61, 0x87, 0xa9, 0xe3, 0x29, 0x0d, 0x29, 0x05, 0xc1, 0x6a, 0x52, 0x39, 0xf1, 0x94, + 0x6d, 0x58, 0xeb, 0xe2, 0x80, 0x67, 0xa6, 0x1b, 0xe8, 0x41, 0x9f, 0x70, 0xa3, 0x84, 0x11, 0x4c, + 0x77, 0x45, 0xe3, 0x94, 0xb2, 0x01, 0xeb, 0x59, 0x71, 0xe2, 0x29, 0x1f, 0x33, 0x38, 0x64, 0xd4, + 0xa4, 0x9a, 0x58, 0xc8, 0x36, 0xf1, 0x0f, 0xb0, 0xde, 0xc9, 0x51, 0x48, 0xa3, 0xc3, 0x49,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x2a, 0xb9, + 0x53, 0x91, 0x9b, 0xe5, 0x04, 0x89, 0x87, 0x7e, 0x84, 0x2b, 0x89, 0x9f, 0xb0, 0x1c, 0xab, 0x37, + 0x47, 0xc8, 0x2a, 0xf1, 0xb8, 0x90, 0x6f, 0x95, 0x17, 0x26, 0xde, 0xde, 0x3b, 0xdf, 0x5f, 0x7e, + 0xe0, 0x61, 0xe7, 0xd9, 0x81, 0x1a, 0xfb, 0xd7, 0x8f, 0x4d, 0x8c, 0xdb, 0x36, 0x31, 0x9e, 0x57, + 0x19, 0xf9, 0xc1, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x5e, 0x2e, 0xb4, 0x62, 0x1a, 0x00, + 0x00, } diff --git a/pkg/proto/msg/msg.proto b/pkg/proto/msg/msg.proto index c6952d2a8..45962720a 100644 --- a/pkg/proto/msg/msg.proto +++ b/pkg/proto/msg/msg.proto @@ -30,26 +30,6 @@ message MsgDataToMongoByMQ{ } -//message PullMessageReq { -// string UserID = 1; -// int64 SeqBegin = 2; -// int64 SeqEnd = 3; -// string OperationID = 4; -//} -// -//message PullMessageResp { -// int32 ErrCode = 1; -// string ErrMsg = 2; -// int64 MaxSeq = 3; -// int64 MinSeq = 4; -// repeated GatherFormat SingleUserMsg = 5; -// repeated GatherFormat GroupUserMsg = 6; -//} -//message PullMessageBySeqListReq{ -// string UserID = 1; -// string OperationID = 2; -// repeated int64 seqList =3; -//} message GetMaxAndMinSeqReq { string UserID = 1; string OperationID = 2; @@ -62,17 +42,10 @@ message GetMaxAndMinSeqResp { } message SendMsgReq { - -string token =1; -string operationID = 2; -sdkws.MsgData msgData = 3; - - + sdkws.MsgData msgData = 3; } message SendMsgResp { - int32 errCode = 1; - string errMsg = 2; string serverMsgID = 4; string clientMsgID = 5; int64 sendTime = 6; @@ -80,37 +53,26 @@ message SendMsgResp { message ClearMsgReq{ - string userID = 1; - string opUserID = 2; - string operationID = 3; + string userID = 1; } message ClearMsgResp{ - int32 errCode = 1; - string errMsg = 2; } message SetMsgMinSeqReq{ string userID = 1; string groupID = 2; uint32 minSeq = 3; - string operationID = 4; - string opUserID = 5; } message SetMsgMinSeqResp{ - int32 errCode = 1; - string errMsg = 2; } message SetSendMsgStatusReq{ - string operationID = 1; int32 status = 2; } message SetSendMsgStatusResp{ - int32 errCode = 1; - string errMsg = 2; } message GetSendMsgStatusReq{ @@ -123,14 +85,10 @@ message GetSendMsgStatusResp{ int32 status = 3; } message DelSuperGroupMsgReq{ - string opUserID = 1; string userID = 2; string groupID = 3; - string operationID = 4; } message DelSuperGroupMsgResp{ - int32 errCode = 1; - string errMsg = 2; } message GetSuperGroupMsgReq{ string operationID = 1; @@ -267,19 +225,27 @@ message MsgDataToModifyByMQ{ service msg { + //获取最小最大seq(包括用户的,以及指定群组的) rpc GetMaxAndMinSeq(sdkws.GetMaxAndMinSeqReq) returns(sdkws.GetMaxAndMinSeqResp); + //拉取历史消息(包括用户的,以及指定群组的) rpc PullMessageBySeqList(sdkws.PullMessageBySeqListReq) returns(sdkws.PullMessageBySeqListResp); + //发送消息 rpc SendMsg(SendMsgReq) returns(SendMsgResp); + //删除某人消息 rpc DelMsgList(sdkws.DelMsgListReq) returns(sdkws.DelMsgListResp); + //删除某个用户某个大群消息 rpc DelSuperGroupMsg(DelSuperGroupMsgReq) returns(DelSuperGroupMsgResp); + //清空某人所有消息 rpc ClearMsg(ClearMsgReq) returns(ClearMsgResp); - rpc SetMsgMinSeq(SetMsgMinSeqReq) returns(SetMsgMinSeqResp); - rpc SetSendMsgStatus(SetSendMsgStatusReq) returns(SetSendMsgStatusResp); - rpc GetSendMsgStatus(GetSendMsgStatusReq) returns(GetSendMsgStatusResp); - rpc GetSuperGroupMsg(GetSuperGroupMsgReq) returns(GetSuperGroupMsgResp); - rpc GetWriteDiffMsg(GetWriteDiffMsgReq) returns(GetWriteDiffMsgResp); - // modify msg + //设置消息是否发送成功-针对api发送的消息 + rpc SetSendMsgStatus(SetSendMsgStatusReq) returns(SetSendMsgStatusResp); + //获取消息发送状态 + rpc GetSendMsgStatus(GetSendMsgStatusReq) returns(GetSendMsgStatusResp); + + + + // 修改消息 rpc SetMessageReactionExtensions(SetMessageReactionExtensionsReq) returns(SetMessageReactionExtensionsResp); rpc GetMessageListReactionExtensions(GetMessageListReactionExtensionsReq) returns(GetMessageListReactionExtensionsResp); rpc AddMessageReactionExtensions(ModifyMessageReactionExtensionsReq) returns(ModifyMessageReactionExtensionsResp); diff --git a/pkg/proto/sdkws/ws.pb.go b/pkg/proto/sdkws/ws.pb.go index 2bba6281c..265075a49 100644 --- a/pkg/proto/sdkws/ws.pb.go +++ b/pkg/proto/sdkws/ws.pb.go @@ -46,7 +46,7 @@ func (m *GroupInfo) Reset() { *m = GroupInfo{} } func (m *GroupInfo) String() string { return proto.CompactTextString(m) } func (*GroupInfo) ProtoMessage() {} func (*GroupInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{0} + return fileDescriptor_ws_a0747f665ef3b307, []int{0} } func (m *GroupInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfo.Unmarshal(m, b) @@ -204,7 +204,7 @@ func (m *GroupInfoForSet) Reset() { *m = GroupInfoForSet{} } func (m *GroupInfoForSet) String() string { return proto.CompactTextString(m) } func (*GroupInfoForSet) ProtoMessage() {} func (*GroupInfoForSet) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{1} + return fileDescriptor_ws_a0747f665ef3b307, []int{1} } func (m *GroupInfoForSet) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfoForSet.Unmarshal(m, b) @@ -309,7 +309,7 @@ func (m *GroupMemberFullInfo) Reset() { *m = GroupMemberFullInfo{} } func (m *GroupMemberFullInfo) String() string { return proto.CompactTextString(m) } func (*GroupMemberFullInfo) ProtoMessage() {} func (*GroupMemberFullInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{2} + return fileDescriptor_ws_a0747f665ef3b307, []int{2} } func (m *GroupMemberFullInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberFullInfo.Unmarshal(m, b) @@ -428,7 +428,7 @@ func (m *PublicUserInfo) Reset() { *m = PublicUserInfo{} } func (m *PublicUserInfo) String() string { return proto.CompactTextString(m) } func (*PublicUserInfo) ProtoMessage() {} func (*PublicUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{3} + return fileDescriptor_ws_a0747f665ef3b307, []int{3} } func (m *PublicUserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PublicUserInfo.Unmarshal(m, b) @@ -505,7 +505,7 @@ func (m *UserInfo) Reset() { *m = UserInfo{} } func (m *UserInfo) String() string { return proto.CompactTextString(m) } func (*UserInfo) ProtoMessage() {} func (*UserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{4} + return fileDescriptor_ws_a0747f665ef3b307, []int{4} } func (m *UserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserInfo.Unmarshal(m, b) @@ -626,7 +626,7 @@ func (m *FriendInfo) Reset() { *m = FriendInfo{} } func (m *FriendInfo) String() string { return proto.CompactTextString(m) } func (*FriendInfo) ProtoMessage() {} func (*FriendInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{5} + return fileDescriptor_ws_a0747f665ef3b307, []int{5} } func (m *FriendInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfo.Unmarshal(m, b) @@ -711,7 +711,7 @@ func (m *BlackInfo) Reset() { *m = BlackInfo{} } func (m *BlackInfo) String() string { return proto.CompactTextString(m) } func (*BlackInfo) ProtoMessage() {} func (*BlackInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{6} + return fileDescriptor_ws_a0747f665ef3b307, []int{6} } func (m *BlackInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackInfo.Unmarshal(m, b) @@ -794,7 +794,7 @@ func (m *GroupRequest) Reset() { *m = GroupRequest{} } func (m *GroupRequest) String() string { return proto.CompactTextString(m) } func (*GroupRequest) ProtoMessage() {} func (*GroupRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{7} + return fileDescriptor_ws_a0747f665ef3b307, []int{7} } func (m *GroupRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupRequest.Unmarshal(m, b) @@ -916,7 +916,7 @@ func (m *FriendRequest) Reset() { *m = FriendRequest{} } func (m *FriendRequest) String() string { return proto.CompactTextString(m) } func (*FriendRequest) ProtoMessage() {} func (*FriendRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{8} + return fileDescriptor_ws_a0747f665ef3b307, []int{8} } func (m *FriendRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendRequest.Unmarshal(m, b) @@ -1041,424 +1041,9 @@ func (m *FriendRequest) GetEx() string { return "" } -type Department struct { - DepartmentID string `protobuf:"bytes,1,opt,name=departmentID" json:"departmentID,omitempty"` - FaceURL string `protobuf:"bytes,2,opt,name=faceURL" json:"faceURL,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` - ParentID string `protobuf:"bytes,4,opt,name=parentID" json:"parentID,omitempty"` - Order int32 `protobuf:"varint,5,opt,name=order" json:"order,omitempty"` - DepartmentType int32 `protobuf:"varint,6,opt,name=departmentType" json:"departmentType,omitempty"` - CreateTime int64 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"` - SubDepartmentNum uint32 `protobuf:"varint,8,opt,name=subDepartmentNum" json:"subDepartmentNum,omitempty"` - MemberNum uint32 `protobuf:"varint,9,opt,name=memberNum" json:"memberNum,omitempty"` - Ex string `protobuf:"bytes,10,opt,name=ex" json:"ex,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Department) Reset() { *m = Department{} } -func (m *Department) String() string { return proto.CompactTextString(m) } -func (*Department) ProtoMessage() {} -func (*Department) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{9} -} -func (m *Department) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Department.Unmarshal(m, b) -} -func (m *Department) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Department.Marshal(b, m, deterministic) -} -func (dst *Department) XXX_Merge(src proto.Message) { - xxx_messageInfo_Department.Merge(dst, src) -} -func (m *Department) XXX_Size() int { - return xxx_messageInfo_Department.Size(m) -} -func (m *Department) XXX_DiscardUnknown() { - xxx_messageInfo_Department.DiscardUnknown(m) -} - -var xxx_messageInfo_Department proto.InternalMessageInfo - -func (m *Department) GetDepartmentID() string { - if m != nil { - return m.DepartmentID - } - return "" -} - -func (m *Department) GetFaceURL() string { - if m != nil { - return m.FaceURL - } - return "" -} - -func (m *Department) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Department) GetParentID() string { - if m != nil { - return m.ParentID - } - return "" -} - -func (m *Department) GetOrder() int32 { - if m != nil { - return m.Order - } - return 0 -} - -func (m *Department) GetDepartmentType() int32 { - if m != nil { - return m.DepartmentType - } - return 0 -} - -func (m *Department) GetCreateTime() int64 { - if m != nil { - return m.CreateTime - } - return 0 -} - -func (m *Department) GetSubDepartmentNum() uint32 { - if m != nil { - return m.SubDepartmentNum - } - return 0 -} - -func (m *Department) GetMemberNum() uint32 { - if m != nil { - return m.MemberNum - } - return 0 -} - -func (m *Department) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -type OrganizationUser struct { - UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - Nickname string `protobuf:"bytes,2,opt,name=nickname" json:"nickname,omitempty"` - EnglishName string `protobuf:"bytes,3,opt,name=englishName" json:"englishName,omitempty"` - FaceURL string `protobuf:"bytes,4,opt,name=faceURL" json:"faceURL,omitempty"` - Gender int32 `protobuf:"varint,5,opt,name=gender" json:"gender,omitempty"` - Mobile string `protobuf:"bytes,6,opt,name=mobile" json:"mobile,omitempty"` - Telephone string `protobuf:"bytes,7,opt,name=telephone" json:"telephone,omitempty"` - Birth uint32 `protobuf:"varint,8,opt,name=birth" json:"birth,omitempty"` - Email string `protobuf:"bytes,9,opt,name=email" json:"email,omitempty"` - CreateTime int64 `protobuf:"varint,10,opt,name=createTime" json:"createTime,omitempty"` - Ex string `protobuf:"bytes,11,opt,name=ex" json:"ex,omitempty"` - BirthStr string `protobuf:"bytes,12,opt,name=birthStr" json:"birthStr,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrganizationUser) Reset() { *m = OrganizationUser{} } -func (m *OrganizationUser) String() string { return proto.CompactTextString(m) } -func (*OrganizationUser) ProtoMessage() {} -func (*OrganizationUser) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{10} -} -func (m *OrganizationUser) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrganizationUser.Unmarshal(m, b) -} -func (m *OrganizationUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrganizationUser.Marshal(b, m, deterministic) -} -func (dst *OrganizationUser) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrganizationUser.Merge(dst, src) -} -func (m *OrganizationUser) XXX_Size() int { - return xxx_messageInfo_OrganizationUser.Size(m) -} -func (m *OrganizationUser) XXX_DiscardUnknown() { - xxx_messageInfo_OrganizationUser.DiscardUnknown(m) -} - -var xxx_messageInfo_OrganizationUser proto.InternalMessageInfo - -func (m *OrganizationUser) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *OrganizationUser) GetNickname() string { - if m != nil { - return m.Nickname - } - return "" -} - -func (m *OrganizationUser) GetEnglishName() string { - if m != nil { - return m.EnglishName - } - return "" -} - -func (m *OrganizationUser) GetFaceURL() string { - if m != nil { - return m.FaceURL - } - return "" -} - -func (m *OrganizationUser) GetGender() int32 { - if m != nil { - return m.Gender - } - return 0 -} - -func (m *OrganizationUser) GetMobile() string { - if m != nil { - return m.Mobile - } - return "" -} - -func (m *OrganizationUser) GetTelephone() string { - if m != nil { - return m.Telephone - } - return "" -} - -func (m *OrganizationUser) GetBirth() uint32 { - if m != nil { - return m.Birth - } - return 0 -} - -func (m *OrganizationUser) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *OrganizationUser) GetCreateTime() int64 { - if m != nil { - return m.CreateTime - } - return 0 -} - -func (m *OrganizationUser) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -func (m *OrganizationUser) GetBirthStr() string { - if m != nil { - return m.BirthStr - } - return "" -} - -type DepartmentMember struct { - UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - DepartmentID string `protobuf:"bytes,2,opt,name=departmentID" json:"departmentID,omitempty"` - Order int32 `protobuf:"varint,3,opt,name=order" json:"order,omitempty"` - Position string `protobuf:"bytes,4,opt,name=position" json:"position,omitempty"` - Leader int32 `protobuf:"varint,5,opt,name=leader" json:"leader,omitempty"` - Status int32 `protobuf:"varint,6,opt,name=status" json:"status,omitempty"` - Ex string `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DepartmentMember) Reset() { *m = DepartmentMember{} } -func (m *DepartmentMember) String() string { return proto.CompactTextString(m) } -func (*DepartmentMember) ProtoMessage() {} -func (*DepartmentMember) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{11} -} -func (m *DepartmentMember) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DepartmentMember.Unmarshal(m, b) -} -func (m *DepartmentMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DepartmentMember.Marshal(b, m, deterministic) -} -func (dst *DepartmentMember) XXX_Merge(src proto.Message) { - xxx_messageInfo_DepartmentMember.Merge(dst, src) -} -func (m *DepartmentMember) XXX_Size() int { - return xxx_messageInfo_DepartmentMember.Size(m) -} -func (m *DepartmentMember) XXX_DiscardUnknown() { - xxx_messageInfo_DepartmentMember.DiscardUnknown(m) -} - -var xxx_messageInfo_DepartmentMember proto.InternalMessageInfo - -func (m *DepartmentMember) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *DepartmentMember) GetDepartmentID() string { - if m != nil { - return m.DepartmentID - } - return "" -} - -func (m *DepartmentMember) GetOrder() int32 { - if m != nil { - return m.Order - } - return 0 -} - -func (m *DepartmentMember) GetPosition() string { - if m != nil { - return m.Position - } - return "" -} - -func (m *DepartmentMember) GetLeader() int32 { - if m != nil { - return m.Leader - } - return 0 -} - -func (m *DepartmentMember) GetStatus() int32 { - if m != nil { - return m.Status - } - return 0 -} - -func (m *DepartmentMember) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -type UserDepartmentMember struct { - OrganizationUser *OrganizationUser `protobuf:"bytes,1,opt,name=organizationUser" json:"organizationUser,omitempty"` - DepartmentMember *DepartmentMember `protobuf:"bytes,2,opt,name=departmentMember" json:"departmentMember,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserDepartmentMember) Reset() { *m = UserDepartmentMember{} } -func (m *UserDepartmentMember) String() string { return proto.CompactTextString(m) } -func (*UserDepartmentMember) ProtoMessage() {} -func (*UserDepartmentMember) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{12} -} -func (m *UserDepartmentMember) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserDepartmentMember.Unmarshal(m, b) -} -func (m *UserDepartmentMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserDepartmentMember.Marshal(b, m, deterministic) -} -func (dst *UserDepartmentMember) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserDepartmentMember.Merge(dst, src) -} -func (m *UserDepartmentMember) XXX_Size() int { - return xxx_messageInfo_UserDepartmentMember.Size(m) -} -func (m *UserDepartmentMember) XXX_DiscardUnknown() { - xxx_messageInfo_UserDepartmentMember.DiscardUnknown(m) -} - -var xxx_messageInfo_UserDepartmentMember proto.InternalMessageInfo - -func (m *UserDepartmentMember) GetOrganizationUser() *OrganizationUser { - if m != nil { - return m.OrganizationUser - } - return nil -} - -func (m *UserDepartmentMember) GetDepartmentMember() *DepartmentMember { - if m != nil { - return m.DepartmentMember - } - return nil -} - -type UserInDepartment struct { - OrganizationUser *OrganizationUser `protobuf:"bytes,1,opt,name=organizationUser" json:"organizationUser,omitempty"` - DepartmentMemberList []*DepartmentMember `protobuf:"bytes,2,rep,name=departmentMemberList" json:"departmentMemberList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserInDepartment) Reset() { *m = UserInDepartment{} } -func (m *UserInDepartment) String() string { return proto.CompactTextString(m) } -func (*UserInDepartment) ProtoMessage() {} -func (*UserInDepartment) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{13} -} -func (m *UserInDepartment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserInDepartment.Unmarshal(m, b) -} -func (m *UserInDepartment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserInDepartment.Marshal(b, m, deterministic) -} -func (dst *UserInDepartment) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserInDepartment.Merge(dst, src) -} -func (m *UserInDepartment) XXX_Size() int { - return xxx_messageInfo_UserInDepartment.Size(m) -} -func (m *UserInDepartment) XXX_DiscardUnknown() { - xxx_messageInfo_UserInDepartment.DiscardUnknown(m) -} - -var xxx_messageInfo_UserInDepartment proto.InternalMessageInfo - -func (m *UserInDepartment) GetOrganizationUser() *OrganizationUser { - if m != nil { - return m.OrganizationUser - } - return nil -} - -func (m *UserInDepartment) GetDepartmentMemberList() []*DepartmentMember { - if m != nil { - return m.DepartmentMemberList - } - return nil -} - // /////////////////////////////////base end///////////////////////////////////// type PullMessageBySeqListReq struct { UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` SeqList []uint32 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"` GroupSeqList map[string]*SeqList `protobuf:"bytes,4,rep,name=groupSeqList" json:"groupSeqList,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1470,7 +1055,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } func (*PullMessageBySeqListReq) ProtoMessage() {} func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{14} + return fileDescriptor_ws_a0747f665ef3b307, []int{9} } func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) @@ -1497,13 +1082,6 @@ func (m *PullMessageBySeqListReq) GetUserID() string { return "" } -func (m *PullMessageBySeqListReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - func (m *PullMessageBySeqListReq) GetSeqList() []uint32 { if m != nil { return m.SeqList @@ -1529,7 +1107,7 @@ func (m *SeqList) Reset() { *m = SeqList{} } func (m *SeqList) String() string { return proto.CompactTextString(m) } func (*SeqList) ProtoMessage() {} func (*SeqList) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{15} + return fileDescriptor_ws_a0747f665ef3b307, []int{10} } func (m *SeqList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SeqList.Unmarshal(m, b) @@ -1567,7 +1145,7 @@ func (m *MsgDataList) Reset() { *m = MsgDataList{} } func (m *MsgDataList) String() string { return proto.CompactTextString(m) } func (*MsgDataList) ProtoMessage() {} func (*MsgDataList) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{16} + return fileDescriptor_ws_a0747f665ef3b307, []int{11} } func (m *MsgDataList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataList.Unmarshal(m, b) @@ -1608,7 +1186,7 @@ func (m *PullMessageBySeqListResp) Reset() { *m = PullMessageBySeqListRe func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) } func (*PullMessageBySeqListResp) ProtoMessage() {} func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{17} + return fileDescriptor_ws_a0747f665ef3b307, []int{12} } func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b) @@ -1659,7 +1237,6 @@ func (m *PullMessageBySeqListResp) GetGroupMsgDataList() map[string]*MsgDataList type GetMaxAndMinSeqReq struct { GroupIDList []string `protobuf:"bytes,1,rep,name=groupIDList" json:"groupIDList,omitempty"` UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1669,7 +1246,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{18} + return fileDescriptor_ws_a0747f665ef3b307, []int{13} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -1703,13 +1280,6 @@ func (m *GetMaxAndMinSeqReq) GetUserID() string { return "" } -func (m *GetMaxAndMinSeqReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - type MaxAndMinSeq struct { MaxSeq uint32 `protobuf:"varint,1,opt,name=maxSeq" json:"maxSeq,omitempty"` MinSeq uint32 `protobuf:"varint,2,opt,name=minSeq" json:"minSeq,omitempty"` @@ -1722,7 +1292,7 @@ func (m *MaxAndMinSeq) Reset() { *m = MaxAndMinSeq{} } func (m *MaxAndMinSeq) String() string { return proto.CompactTextString(m) } func (*MaxAndMinSeq) ProtoMessage() {} func (*MaxAndMinSeq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{19} + return fileDescriptor_ws_a0747f665ef3b307, []int{14} } func (m *MaxAndMinSeq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MaxAndMinSeq.Unmarshal(m, b) @@ -1759,8 +1329,6 @@ func (m *MaxAndMinSeq) GetMinSeq() uint32 { type GetMaxAndMinSeqResp struct { MaxSeq uint32 `protobuf:"varint,1,opt,name=maxSeq" json:"maxSeq,omitempty"` MinSeq uint32 `protobuf:"varint,2,opt,name=minSeq" json:"minSeq,omitempty"` - ErrCode int32 `protobuf:"varint,3,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,4,opt,name=errMsg" json:"errMsg,omitempty"` GroupMaxAndMinSeq map[string]*MaxAndMinSeq `protobuf:"bytes,5,rep,name=groupMaxAndMinSeq" json:"groupMaxAndMinSeq,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1771,7 +1339,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{20} + return fileDescriptor_ws_a0747f665ef3b307, []int{15} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -1805,20 +1373,6 @@ func (m *GetMaxAndMinSeqResp) GetMinSeq() uint32 { return 0 } -func (m *GetMaxAndMinSeqResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *GetMaxAndMinSeqResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - func (m *GetMaxAndMinSeqResp) GetGroupMaxAndMinSeq() map[string]*MaxAndMinSeq { if m != nil { return m.GroupMaxAndMinSeq @@ -1839,7 +1393,7 @@ func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} } func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } func (*UserSendMsgResp) ProtoMessage() {} func (*UserSendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{21} + return fileDescriptor_ws_a0747f665ef3b307, []int{16} } func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) @@ -1912,7 +1466,7 @@ func (m *MsgData) Reset() { *m = MsgData{} } func (m *MsgData) String() string { return proto.CompactTextString(m) } func (*MsgData) ProtoMessage() {} func (*MsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{22} + return fileDescriptor_ws_a0747f665ef3b307, []int{17} } func (m *MsgData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgData.Unmarshal(m, b) @@ -2101,7 +1655,7 @@ func (m *OfflinePushInfo) Reset() { *m = OfflinePushInfo{} } func (m *OfflinePushInfo) String() string { return proto.CompactTextString(m) } func (*OfflinePushInfo) ProtoMessage() {} func (*OfflinePushInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{23} + return fileDescriptor_ws_a0747f665ef3b307, []int{18} } func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b) @@ -2169,7 +1723,7 @@ func (m *TipsComm) Reset() { *m = TipsComm{} } func (m *TipsComm) String() string { return proto.CompactTextString(m) } func (*TipsComm) ProtoMessage() {} func (*TipsComm) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{24} + return fileDescriptor_ws_a0747f665ef3b307, []int{19} } func (m *TipsComm) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TipsComm.Unmarshal(m, b) @@ -2226,7 +1780,7 @@ func (m *GroupCreatedTips) Reset() { *m = GroupCreatedTips{} } func (m *GroupCreatedTips) String() string { return proto.CompactTextString(m) } func (*GroupCreatedTips) ProtoMessage() {} func (*GroupCreatedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{25} + return fileDescriptor_ws_a0747f665ef3b307, []int{20} } func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b) @@ -2295,7 +1849,7 @@ func (m *GroupInfoSetTips) Reset() { *m = GroupInfoSetTips{} } func (m *GroupInfoSetTips) String() string { return proto.CompactTextString(m) } func (*GroupInfoSetTips) ProtoMessage() {} func (*GroupInfoSetTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{26} + return fileDescriptor_ws_a0747f665ef3b307, []int{21} } func (m *GroupInfoSetTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfoSetTips.Unmarshal(m, b) @@ -2350,7 +1904,7 @@ func (m *JoinGroupApplicationTips) Reset() { *m = JoinGroupApplicationTi func (m *JoinGroupApplicationTips) String() string { return proto.CompactTextString(m) } func (*JoinGroupApplicationTips) ProtoMessage() {} func (*JoinGroupApplicationTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{27} + return fileDescriptor_ws_a0747f665ef3b307, []int{22} } func (m *JoinGroupApplicationTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupApplicationTips.Unmarshal(m, b) @@ -2407,7 +1961,7 @@ func (m *MemberQuitTips) Reset() { *m = MemberQuitTips{} } func (m *MemberQuitTips) String() string { return proto.CompactTextString(m) } func (*MemberQuitTips) ProtoMessage() {} func (*MemberQuitTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{28} + return fileDescriptor_ws_a0747f665ef3b307, []int{23} } func (m *MemberQuitTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberQuitTips.Unmarshal(m, b) @@ -2463,7 +2017,7 @@ func (m *GroupApplicationAcceptedTips) Reset() { *m = GroupApplicationAc func (m *GroupApplicationAcceptedTips) String() string { return proto.CompactTextString(m) } func (*GroupApplicationAcceptedTips) ProtoMessage() {} func (*GroupApplicationAcceptedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{29} + return fileDescriptor_ws_a0747f665ef3b307, []int{24} } func (m *GroupApplicationAcceptedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationAcceptedTips.Unmarshal(m, b) @@ -2526,7 +2080,7 @@ func (m *GroupApplicationRejectedTips) Reset() { *m = GroupApplicationRe func (m *GroupApplicationRejectedTips) String() string { return proto.CompactTextString(m) } func (*GroupApplicationRejectedTips) ProtoMessage() {} func (*GroupApplicationRejectedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{30} + return fileDescriptor_ws_a0747f665ef3b307, []int{25} } func (m *GroupApplicationRejectedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationRejectedTips.Unmarshal(m, b) @@ -2589,7 +2143,7 @@ func (m *GroupOwnerTransferredTips) Reset() { *m = GroupOwnerTransferred func (m *GroupOwnerTransferredTips) String() string { return proto.CompactTextString(m) } func (*GroupOwnerTransferredTips) ProtoMessage() {} func (*GroupOwnerTransferredTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{31} + return fileDescriptor_ws_a0747f665ef3b307, []int{26} } func (m *GroupOwnerTransferredTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupOwnerTransferredTips.Unmarshal(m, b) @@ -2652,7 +2206,7 @@ func (m *MemberKickedTips) Reset() { *m = MemberKickedTips{} } func (m *MemberKickedTips) String() string { return proto.CompactTextString(m) } func (*MemberKickedTips) ProtoMessage() {} func (*MemberKickedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{32} + return fileDescriptor_ws_a0747f665ef3b307, []int{27} } func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b) @@ -2715,7 +2269,7 @@ func (m *MemberInvitedTips) Reset() { *m = MemberInvitedTips{} } func (m *MemberInvitedTips) String() string { return proto.CompactTextString(m) } func (*MemberInvitedTips) ProtoMessage() {} func (*MemberInvitedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{33} + return fileDescriptor_ws_a0747f665ef3b307, []int{28} } func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b) @@ -2777,7 +2331,7 @@ func (m *MemberEnterTips) Reset() { *m = MemberEnterTips{} } func (m *MemberEnterTips) String() string { return proto.CompactTextString(m) } func (*MemberEnterTips) ProtoMessage() {} func (*MemberEnterTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{34} + return fileDescriptor_ws_a0747f665ef3b307, []int{29} } func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b) @@ -2831,7 +2385,7 @@ func (m *GroupDismissedTips) Reset() { *m = GroupDismissedTips{} } func (m *GroupDismissedTips) String() string { return proto.CompactTextString(m) } func (*GroupDismissedTips) ProtoMessage() {} func (*GroupDismissedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{35} + return fileDescriptor_ws_a0747f665ef3b307, []int{30} } func (m *GroupDismissedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupDismissedTips.Unmarshal(m, b) @@ -2887,7 +2441,7 @@ func (m *GroupMemberMutedTips) Reset() { *m = GroupMemberMutedTips{} } func (m *GroupMemberMutedTips) String() string { return proto.CompactTextString(m) } func (*GroupMemberMutedTips) ProtoMessage() {} func (*GroupMemberMutedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{36} + return fileDescriptor_ws_a0747f665ef3b307, []int{31} } func (m *GroupMemberMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberMutedTips.Unmarshal(m, b) @@ -2956,7 +2510,7 @@ func (m *GroupMemberCancelMutedTips) Reset() { *m = GroupMemberCancelMut func (m *GroupMemberCancelMutedTips) String() string { return proto.CompactTextString(m) } func (*GroupMemberCancelMutedTips) ProtoMessage() {} func (*GroupMemberCancelMutedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{37} + return fileDescriptor_ws_a0747f665ef3b307, []int{32} } func (m *GroupMemberCancelMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberCancelMutedTips.Unmarshal(m, b) @@ -3017,7 +2571,7 @@ func (m *GroupMutedTips) Reset() { *m = GroupMutedTips{} } func (m *GroupMutedTips) String() string { return proto.CompactTextString(m) } func (*GroupMutedTips) ProtoMessage() {} func (*GroupMutedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{38} + return fileDescriptor_ws_a0747f665ef3b307, []int{33} } func (m *GroupMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMutedTips.Unmarshal(m, b) @@ -3071,7 +2625,7 @@ func (m *GroupCancelMutedTips) Reset() { *m = GroupCancelMutedTips{} } func (m *GroupCancelMutedTips) String() string { return proto.CompactTextString(m) } func (*GroupCancelMutedTips) ProtoMessage() {} func (*GroupCancelMutedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{39} + return fileDescriptor_ws_a0747f665ef3b307, []int{34} } func (m *GroupCancelMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupCancelMutedTips.Unmarshal(m, b) @@ -3126,7 +2680,7 @@ func (m *GroupMemberInfoSetTips) Reset() { *m = GroupMemberInfoSetTips{} func (m *GroupMemberInfoSetTips) String() string { return proto.CompactTextString(m) } func (*GroupMemberInfoSetTips) ProtoMessage() {} func (*GroupMemberInfoSetTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{40} + return fileDescriptor_ws_a0747f665ef3b307, []int{35} } func (m *GroupMemberInfoSetTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberInfoSetTips.Unmarshal(m, b) @@ -3186,7 +2740,7 @@ func (m *OrganizationChangedTips) Reset() { *m = OrganizationChangedTips func (m *OrganizationChangedTips) String() string { return proto.CompactTextString(m) } func (*OrganizationChangedTips) ProtoMessage() {} func (*OrganizationChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{41} + return fileDescriptor_ws_a0747f665ef3b307, []int{36} } func (m *OrganizationChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OrganizationChangedTips.Unmarshal(m, b) @@ -3233,7 +2787,7 @@ func (m *FriendApplication) Reset() { *m = FriendApplication{} } func (m *FriendApplication) String() string { return proto.CompactTextString(m) } func (*FriendApplication) ProtoMessage() {} func (*FriendApplication) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{42} + return fileDescriptor_ws_a0747f665ef3b307, []int{37} } func (m *FriendApplication) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplication.Unmarshal(m, b) @@ -3286,7 +2840,7 @@ func (m *FromToUserID) Reset() { *m = FromToUserID{} } func (m *FromToUserID) String() string { return proto.CompactTextString(m) } func (*FromToUserID) ProtoMessage() {} func (*FromToUserID) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{43} + return fileDescriptor_ws_a0747f665ef3b307, []int{38} } func (m *FromToUserID) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FromToUserID.Unmarshal(m, b) @@ -3332,7 +2886,7 @@ func (m *FriendApplicationTips) Reset() { *m = FriendApplicationTips{} } func (m *FriendApplicationTips) String() string { return proto.CompactTextString(m) } func (*FriendApplicationTips) ProtoMessage() {} func (*FriendApplicationTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{44} + return fileDescriptor_ws_a0747f665ef3b307, []int{39} } func (m *FriendApplicationTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationTips.Unmarshal(m, b) @@ -3372,7 +2926,7 @@ func (m *FriendApplicationApprovedTips) Reset() { *m = FriendApplication func (m *FriendApplicationApprovedTips) String() string { return proto.CompactTextString(m) } func (*FriendApplicationApprovedTips) ProtoMessage() {} func (*FriendApplicationApprovedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{45} + return fileDescriptor_ws_a0747f665ef3b307, []int{40} } func (m *FriendApplicationApprovedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationApprovedTips.Unmarshal(m, b) @@ -3419,7 +2973,7 @@ func (m *FriendApplicationRejectedTips) Reset() { *m = FriendApplication func (m *FriendApplicationRejectedTips) String() string { return proto.CompactTextString(m) } func (*FriendApplicationRejectedTips) ProtoMessage() {} func (*FriendApplicationRejectedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{46} + return fileDescriptor_ws_a0747f665ef3b307, []int{41} } func (m *FriendApplicationRejectedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationRejectedTips.Unmarshal(m, b) @@ -3467,7 +3021,7 @@ func (m *FriendAddedTips) Reset() { *m = FriendAddedTips{} } func (m *FriendAddedTips) String() string { return proto.CompactTextString(m) } func (*FriendAddedTips) ProtoMessage() {} func (*FriendAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{47} + return fileDescriptor_ws_a0747f665ef3b307, []int{42} } func (m *FriendAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendAddedTips.Unmarshal(m, b) @@ -3520,7 +3074,7 @@ func (m *FriendDeletedTips) Reset() { *m = FriendDeletedTips{} } func (m *FriendDeletedTips) String() string { return proto.CompactTextString(m) } func (*FriendDeletedTips) ProtoMessage() {} func (*FriendDeletedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{48} + return fileDescriptor_ws_a0747f665ef3b307, []int{43} } func (m *FriendDeletedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendDeletedTips.Unmarshal(m, b) @@ -3558,7 +3112,7 @@ func (m *BlackAddedTips) Reset() { *m = BlackAddedTips{} } func (m *BlackAddedTips) String() string { return proto.CompactTextString(m) } func (*BlackAddedTips) ProtoMessage() {} func (*BlackAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{49} + return fileDescriptor_ws_a0747f665ef3b307, []int{44} } func (m *BlackAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackAddedTips.Unmarshal(m, b) @@ -3596,7 +3150,7 @@ func (m *BlackDeletedTips) Reset() { *m = BlackDeletedTips{} } func (m *BlackDeletedTips) String() string { return proto.CompactTextString(m) } func (*BlackDeletedTips) ProtoMessage() {} func (*BlackDeletedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{50} + return fileDescriptor_ws_a0747f665ef3b307, []int{45} } func (m *BlackDeletedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackDeletedTips.Unmarshal(m, b) @@ -3634,7 +3188,7 @@ func (m *FriendInfoChangedTips) Reset() { *m = FriendInfoChangedTips{} } func (m *FriendInfoChangedTips) String() string { return proto.CompactTextString(m) } func (*FriendInfoChangedTips) ProtoMessage() {} func (*FriendInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{51} + return fileDescriptor_ws_a0747f665ef3b307, []int{46} } func (m *FriendInfoChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfoChangedTips.Unmarshal(m, b) @@ -3673,7 +3227,7 @@ func (m *UserInfoUpdatedTips) Reset() { *m = UserInfoUpdatedTips{} } func (m *UserInfoUpdatedTips) String() string { return proto.CompactTextString(m) } func (*UserInfoUpdatedTips) ProtoMessage() {} func (*UserInfoUpdatedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{52} + return fileDescriptor_ws_a0747f665ef3b307, []int{47} } func (m *UserInfoUpdatedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserInfoUpdatedTips.Unmarshal(m, b) @@ -3714,7 +3268,7 @@ func (m *ConversationUpdateTips) Reset() { *m = ConversationUpdateTips{} func (m *ConversationUpdateTips) String() string { return proto.CompactTextString(m) } func (*ConversationUpdateTips) ProtoMessage() {} func (*ConversationUpdateTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{53} + return fileDescriptor_ws_a0747f665ef3b307, []int{48} } func (m *ConversationUpdateTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ConversationUpdateTips.Unmarshal(m, b) @@ -3768,7 +3322,7 @@ func (m *ConversationSetPrivateTips) Reset() { *m = ConversationSetPriva func (m *ConversationSetPrivateTips) String() string { return proto.CompactTextString(m) } func (*ConversationSetPrivateTips) ProtoMessage() {} func (*ConversationSetPrivateTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{54} + return fileDescriptor_ws_a0747f665ef3b307, []int{49} } func (m *ConversationSetPrivateTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ConversationSetPrivateTips.Unmarshal(m, b) @@ -3823,7 +3377,7 @@ func (m *DeleteMessageTips) Reset() { *m = DeleteMessageTips{} } func (m *DeleteMessageTips) String() string { return proto.CompactTextString(m) } func (*DeleteMessageTips) ProtoMessage() {} func (*DeleteMessageTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{55} + return fileDescriptor_ws_a0747f665ef3b307, []int{50} } func (m *DeleteMessageTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteMessageTips.Unmarshal(m, b) @@ -3877,7 +3431,7 @@ func (m *RequestPagination) Reset() { *m = RequestPagination{} } func (m *RequestPagination) String() string { return proto.CompactTextString(m) } func (*RequestPagination) ProtoMessage() {} func (*RequestPagination) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{56} + return fileDescriptor_ws_a0747f665ef3b307, []int{51} } func (m *RequestPagination) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestPagination.Unmarshal(m, b) @@ -3934,7 +3488,7 @@ func (m *SignalReq) Reset() { *m = SignalReq{} } func (m *SignalReq) String() string { return proto.CompactTextString(m) } func (*SignalReq) ProtoMessage() {} func (*SignalReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{57} + return fileDescriptor_ws_a0747f665ef3b307, []int{52} } func (m *SignalReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalReq.Unmarshal(m, b) @@ -4323,7 +3877,7 @@ func (m *SignalResp) Reset() { *m = SignalResp{} } func (m *SignalResp) String() string { return proto.CompactTextString(m) } func (*SignalResp) ProtoMessage() {} func (*SignalResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{58} + return fileDescriptor_ws_a0747f665ef3b307, []int{53} } func (m *SignalResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalResp.Unmarshal(m, b) @@ -4653,7 +4207,7 @@ func (m *InvitationInfo) Reset() { *m = InvitationInfo{} } func (m *InvitationInfo) String() string { return proto.CompactTextString(m) } func (*InvitationInfo) ProtoMessage() {} func (*InvitationInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{59} + return fileDescriptor_ws_a0747f665ef3b307, []int{54} } func (m *InvitationInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InvitationInfo.Unmarshal(m, b) @@ -4763,7 +4317,7 @@ func (m *ParticipantMetaData) Reset() { *m = ParticipantMetaData{} } func (m *ParticipantMetaData) String() string { return proto.CompactTextString(m) } func (*ParticipantMetaData) ProtoMessage() {} func (*ParticipantMetaData) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{60} + return fileDescriptor_ws_a0747f665ef3b307, []int{55} } func (m *ParticipantMetaData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ParticipantMetaData.Unmarshal(m, b) @@ -4818,7 +4372,7 @@ func (m *SignalInviteReq) Reset() { *m = SignalInviteReq{} } func (m *SignalInviteReq) String() string { return proto.CompactTextString(m) } func (*SignalInviteReq) ProtoMessage() {} func (*SignalInviteReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{61} + return fileDescriptor_ws_a0747f665ef3b307, []int{56} } func (m *SignalInviteReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteReq.Unmarshal(m, b) @@ -4880,7 +4434,7 @@ func (m *SignalInviteReply) Reset() { *m = SignalInviteReply{} } func (m *SignalInviteReply) String() string { return proto.CompactTextString(m) } func (*SignalInviteReply) ProtoMessage() {} func (*SignalInviteReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{62} + return fileDescriptor_ws_a0747f665ef3b307, []int{57} } func (m *SignalInviteReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteReply.Unmarshal(m, b) @@ -4942,7 +4496,7 @@ func (m *SignalInviteInGroupReq) Reset() { *m = SignalInviteInGroupReq{} func (m *SignalInviteInGroupReq) String() string { return proto.CompactTextString(m) } func (*SignalInviteInGroupReq) ProtoMessage() {} func (*SignalInviteInGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{63} + return fileDescriptor_ws_a0747f665ef3b307, []int{58} } func (m *SignalInviteInGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteInGroupReq.Unmarshal(m, b) @@ -5004,7 +4558,7 @@ func (m *SignalInviteInGroupReply) Reset() { *m = SignalInviteInGroupRep func (m *SignalInviteInGroupReply) String() string { return proto.CompactTextString(m) } func (*SignalInviteInGroupReply) ProtoMessage() {} func (*SignalInviteInGroupReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{64} + return fileDescriptor_ws_a0747f665ef3b307, []int{59} } func (m *SignalInviteInGroupReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteInGroupReply.Unmarshal(m, b) @@ -5066,7 +4620,7 @@ func (m *SignalCancelReq) Reset() { *m = SignalCancelReq{} } func (m *SignalCancelReq) String() string { return proto.CompactTextString(m) } func (*SignalCancelReq) ProtoMessage() {} func (*SignalCancelReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{65} + return fileDescriptor_ws_a0747f665ef3b307, []int{60} } func (m *SignalCancelReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalCancelReq.Unmarshal(m, b) @@ -5124,7 +4678,7 @@ func (m *SignalCancelReply) Reset() { *m = SignalCancelReply{} } func (m *SignalCancelReply) String() string { return proto.CompactTextString(m) } func (*SignalCancelReply) ProtoMessage() {} func (*SignalCancelReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{66} + return fileDescriptor_ws_a0747f665ef3b307, []int{61} } func (m *SignalCancelReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalCancelReply.Unmarshal(m, b) @@ -5159,7 +4713,7 @@ func (m *SignalAcceptReq) Reset() { *m = SignalAcceptReq{} } func (m *SignalAcceptReq) String() string { return proto.CompactTextString(m) } func (*SignalAcceptReq) ProtoMessage() {} func (*SignalAcceptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{67} + return fileDescriptor_ws_a0747f665ef3b307, []int{62} } func (m *SignalAcceptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalAcceptReq.Unmarshal(m, b) @@ -5227,7 +4781,7 @@ func (m *SignalAcceptReply) Reset() { *m = SignalAcceptReply{} } func (m *SignalAcceptReply) String() string { return proto.CompactTextString(m) } func (*SignalAcceptReply) ProtoMessage() {} func (*SignalAcceptReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{68} + return fileDescriptor_ws_a0747f665ef3b307, []int{63} } func (m *SignalAcceptReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalAcceptReply.Unmarshal(m, b) @@ -5281,7 +4835,7 @@ func (m *SignalHungUpReq) Reset() { *m = SignalHungUpReq{} } func (m *SignalHungUpReq) String() string { return proto.CompactTextString(m) } func (*SignalHungUpReq) ProtoMessage() {} func (*SignalHungUpReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{69} + return fileDescriptor_ws_a0747f665ef3b307, []int{64} } func (m *SignalHungUpReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalHungUpReq.Unmarshal(m, b) @@ -5332,7 +4886,7 @@ func (m *SignalHungUpReply) Reset() { *m = SignalHungUpReply{} } func (m *SignalHungUpReply) String() string { return proto.CompactTextString(m) } func (*SignalHungUpReply) ProtoMessage() {} func (*SignalHungUpReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{70} + return fileDescriptor_ws_a0747f665ef3b307, []int{65} } func (m *SignalHungUpReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalHungUpReply.Unmarshal(m, b) @@ -5367,7 +4921,7 @@ func (m *SignalRejectReq) Reset() { *m = SignalRejectReq{} } func (m *SignalRejectReq) String() string { return proto.CompactTextString(m) } func (*SignalRejectReq) ProtoMessage() {} func (*SignalRejectReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{71} + return fileDescriptor_ws_a0747f665ef3b307, []int{66} } func (m *SignalRejectReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalRejectReq.Unmarshal(m, b) @@ -5432,7 +4986,7 @@ func (m *SignalRejectReply) Reset() { *m = SignalRejectReply{} } func (m *SignalRejectReply) String() string { return proto.CompactTextString(m) } func (*SignalRejectReply) ProtoMessage() {} func (*SignalRejectReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{72} + return fileDescriptor_ws_a0747f665ef3b307, []int{67} } func (m *SignalRejectReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalRejectReply.Unmarshal(m, b) @@ -5465,7 +5019,7 @@ func (m *SignalGetRoomByGroupIDReq) Reset() { *m = SignalGetRoomByGroupI func (m *SignalGetRoomByGroupIDReq) String() string { return proto.CompactTextString(m) } func (*SignalGetRoomByGroupIDReq) ProtoMessage() {} func (*SignalGetRoomByGroupIDReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{73} + return fileDescriptor_ws_a0747f665ef3b307, []int{68} } func (m *SignalGetRoomByGroupIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetRoomByGroupIDReq.Unmarshal(m, b) @@ -5519,7 +5073,7 @@ func (m *SignalGetRoomByGroupIDReply) Reset() { *m = SignalGetRoomByGrou func (m *SignalGetRoomByGroupIDReply) String() string { return proto.CompactTextString(m) } func (*SignalGetRoomByGroupIDReply) ProtoMessage() {} func (*SignalGetRoomByGroupIDReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{74} + return fileDescriptor_ws_a0747f665ef3b307, []int{69} } func (m *SignalGetRoomByGroupIDReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetRoomByGroupIDReply.Unmarshal(m, b) @@ -5573,7 +5127,7 @@ func (m *SignalOnRoomParticipantConnectedReq) Reset() { *m = SignalOnRoo func (m *SignalOnRoomParticipantConnectedReq) String() string { return proto.CompactTextString(m) } func (*SignalOnRoomParticipantConnectedReq) ProtoMessage() {} func (*SignalOnRoomParticipantConnectedReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{75} + return fileDescriptor_ws_a0747f665ef3b307, []int{70} } func (m *SignalOnRoomParticipantConnectedReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalOnRoomParticipantConnectedReq.Unmarshal(m, b) @@ -5629,7 +5183,7 @@ func (m *SignalOnRoomParticipantDisconnectedReq) Reset() { func (m *SignalOnRoomParticipantDisconnectedReq) String() string { return proto.CompactTextString(m) } func (*SignalOnRoomParticipantDisconnectedReq) ProtoMessage() {} func (*SignalOnRoomParticipantDisconnectedReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{76} + return fileDescriptor_ws_a0747f665ef3b307, []int{71} } func (m *SignalOnRoomParticipantDisconnectedReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalOnRoomParticipantDisconnectedReq.Unmarshal(m, b) @@ -5684,7 +5238,7 @@ func (m *SignalGetTokenByRoomIDReq) Reset() { *m = SignalGetTokenByRoomI func (m *SignalGetTokenByRoomIDReq) String() string { return proto.CompactTextString(m) } func (*SignalGetTokenByRoomIDReq) ProtoMessage() {} func (*SignalGetTokenByRoomIDReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{77} + return fileDescriptor_ws_a0747f665ef3b307, []int{72} } func (m *SignalGetTokenByRoomIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetTokenByRoomIDReq.Unmarshal(m, b) @@ -5744,7 +5298,7 @@ func (m *SignalGetTokenByRoomIDReply) Reset() { *m = SignalGetTokenByRoo func (m *SignalGetTokenByRoomIDReply) String() string { return proto.CompactTextString(m) } func (*SignalGetTokenByRoomIDReply) ProtoMessage() {} func (*SignalGetTokenByRoomIDReply) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{78} + return fileDescriptor_ws_a0747f665ef3b307, []int{73} } func (m *SignalGetTokenByRoomIDReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetTokenByRoomIDReply.Unmarshal(m, b) @@ -5779,10 +5333,8 @@ func (m *SignalGetTokenByRoomIDReply) GetLiveURL() string { } type DelMsgListReq struct { - OpUserID string `protobuf:"bytes,1,opt,name=opUserID" json:"opUserID,omitempty"` UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` SeqList []uint32 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -5792,7 +5344,7 @@ func (m *DelMsgListReq) Reset() { *m = DelMsgListReq{} } func (m *DelMsgListReq) String() string { return proto.CompactTextString(m) } func (*DelMsgListReq) ProtoMessage() {} func (*DelMsgListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{79} + return fileDescriptor_ws_a0747f665ef3b307, []int{74} } func (m *DelMsgListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DelMsgListReq.Unmarshal(m, b) @@ -5812,13 +5364,6 @@ func (m *DelMsgListReq) XXX_DiscardUnknown() { var xxx_messageInfo_DelMsgListReq proto.InternalMessageInfo -func (m *DelMsgListReq) GetOpUserID() string { - if m != nil { - return m.OpUserID - } - return "" -} - func (m *DelMsgListReq) GetUserID() string { if m != nil { return m.UserID @@ -5833,16 +5378,7 @@ func (m *DelMsgListReq) GetSeqList() []uint32 { return nil } -func (m *DelMsgListReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - type DelMsgListResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -5852,7 +5388,7 @@ func (m *DelMsgListResp) Reset() { *m = DelMsgListResp{} } func (m *DelMsgListResp) String() string { return proto.CompactTextString(m) } func (*DelMsgListResp) ProtoMessage() {} func (*DelMsgListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{80} + return fileDescriptor_ws_a0747f665ef3b307, []int{75} } func (m *DelMsgListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DelMsgListResp.Unmarshal(m, b) @@ -5872,20 +5408,6 @@ func (m *DelMsgListResp) XXX_DiscardUnknown() { var xxx_messageInfo_DelMsgListResp proto.InternalMessageInfo -func (m *DelMsgListResp) GetErrCode() int32 { - if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *DelMsgListResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - type SetAppBackgroundStatusReq struct { UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` IsBackground bool `protobuf:"varint,2,opt,name=isBackground" json:"isBackground,omitempty"` @@ -5898,7 +5420,7 @@ func (m *SetAppBackgroundStatusReq) Reset() { *m = SetAppBackgroundStatu func (m *SetAppBackgroundStatusReq) String() string { return proto.CompactTextString(m) } func (*SetAppBackgroundStatusReq) ProtoMessage() {} func (*SetAppBackgroundStatusReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{81} + return fileDescriptor_ws_a0747f665ef3b307, []int{76} } func (m *SetAppBackgroundStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetAppBackgroundStatusReq.Unmarshal(m, b) @@ -5944,7 +5466,7 @@ func (m *SetAppBackgroundStatusResp) Reset() { *m = SetAppBackgroundStat func (m *SetAppBackgroundStatusResp) String() string { return proto.CompactTextString(m) } func (*SetAppBackgroundStatusResp) ProtoMessage() {} func (*SetAppBackgroundStatusResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{82} + return fileDescriptor_ws_a0747f665ef3b307, []int{77} } func (m *SetAppBackgroundStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetAppBackgroundStatusResp.Unmarshal(m, b) @@ -5994,7 +5516,7 @@ func (m *ExtendMsgSet) Reset() { *m = ExtendMsgSet{} } func (m *ExtendMsgSet) String() string { return proto.CompactTextString(m) } func (*ExtendMsgSet) ProtoMessage() {} func (*ExtendMsgSet) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{83} + return fileDescriptor_ws_a0747f665ef3b307, []int{78} } func (m *ExtendMsgSet) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsgSet.Unmarshal(m, b) @@ -6071,7 +5593,7 @@ func (m *ExtendMsg) Reset() { *m = ExtendMsg{} } func (m *ExtendMsg) String() string { return proto.CompactTextString(m) } func (*ExtendMsg) ProtoMessage() {} func (*ExtendMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{84} + return fileDescriptor_ws_a0747f665ef3b307, []int{79} } func (m *ExtendMsg) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsg.Unmarshal(m, b) @@ -6139,7 +5661,7 @@ func (m *KeyValue) Reset() { *m = KeyValue{} } func (m *KeyValue) String() string { return proto.CompactTextString(m) } func (*KeyValue) ProtoMessage() {} func (*KeyValue) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{85} + return fileDescriptor_ws_a0747f665ef3b307, []int{80} } func (m *KeyValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KeyValue.Unmarshal(m, b) @@ -6192,7 +5714,7 @@ func (m *ResponsePagination) Reset() { *m = ResponsePagination{} } func (m *ResponsePagination) String() string { return proto.CompactTextString(m) } func (*ResponsePagination) ProtoMessage() {} func (*ResponsePagination) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e08a07288a333e78, []int{86} + return fileDescriptor_ws_a0747f665ef3b307, []int{81} } func (m *ResponsePagination) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResponsePagination.Unmarshal(m, b) @@ -6236,11 +5758,6 @@ func init() { proto.RegisterType((*BlackInfo)(nil), "sdkws.BlackInfo") proto.RegisterType((*GroupRequest)(nil), "sdkws.GroupRequest") proto.RegisterType((*FriendRequest)(nil), "sdkws.FriendRequest") - proto.RegisterType((*Department)(nil), "sdkws.Department") - proto.RegisterType((*OrganizationUser)(nil), "sdkws.OrganizationUser") - proto.RegisterType((*DepartmentMember)(nil), "sdkws.DepartmentMember") - proto.RegisterType((*UserDepartmentMember)(nil), "sdkws.UserDepartmentMember") - proto.RegisterType((*UserInDepartment)(nil), "sdkws.UserInDepartment") proto.RegisterType((*PullMessageBySeqListReq)(nil), "sdkws.PullMessageBySeqListReq") proto.RegisterMapType((map[string]*SeqList)(nil), "sdkws.PullMessageBySeqListReq.GroupSeqListEntry") proto.RegisterType((*SeqList)(nil), "sdkws.seqList") @@ -6322,266 +5839,244 @@ func init() { proto.RegisterType((*ResponsePagination)(nil), "sdkws.ResponsePagination") } -func init() { proto.RegisterFile("sdkws/ws.proto", fileDescriptor_ws_e08a07288a333e78) } +func init() { proto.RegisterFile("sdkws/ws.proto", fileDescriptor_ws_a0747f665ef3b307) } -var fileDescriptor_ws_e08a07288a333e78 = []byte{ - // 4125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x3c, 0x5b, 0x6f, 0x1c, 0x59, - 0x5a, 0x53, 0xd5, 0x17, 0x77, 0x7f, 0xed, 0x4b, 0xbb, 0x92, 0x78, 0x7a, 0xbc, 0x99, 0x60, 0x6a, - 0xa2, 0x10, 0x42, 0xc6, 0x81, 0xcc, 0xee, 0xc2, 0xce, 0xce, 0x06, 0xf9, 0x92, 0x38, 0xde, 0xa4, - 0x6d, 0x6f, 0x75, 0x32, 0x41, 0x3b, 0x23, 0x85, 0x72, 0xd7, 0x71, 0xbb, 0xc6, 0xd5, 0x55, 0xe5, - 0xba, 0x38, 0x31, 0x0f, 0x20, 0x01, 0x02, 0x24, 0x1e, 0x90, 0x10, 0x17, 0x09, 0xde, 0x78, 0x41, - 0x20, 0x34, 0x42, 0x08, 0x10, 0x12, 0x08, 0x21, 0xc4, 0x03, 0x12, 0x48, 0xcc, 0x3b, 0x12, 0x08, - 0x5e, 0x40, 0x88, 0x3f, 0x80, 0x84, 0x34, 0xe8, 0x9c, 0xef, 0x54, 0xd5, 0x39, 0x55, 0xd5, 0x97, - 0x58, 0xd6, 0x24, 0x51, 0x78, 0xf3, 0xf7, 0xd5, 0xf9, 0xbe, 0xf3, 0xdd, 0xcf, 0x77, 0x2e, 0x6d, - 0x58, 0x08, 0xad, 0xa3, 0xa7, 0xcf, 0xc2, 0x5b, 0xcf, 0xc2, 0x55, 0x3f, 0xf0, 0x22, 0x4f, 0x5b, - 0x0c, 0x49, 0x70, 0x42, 0x82, 0xa7, 0xa6, 0x6f, 0x3f, 0xf5, 0xcd, 0xc0, 0x1c, 0x86, 0xcb, 0xab, - 0xbb, 0x3e, 0x71, 0xdf, 0xdf, 0xee, 0xbe, 0xdf, 0x63, 0x9f, 0x6e, 0xf9, 0x47, 0x83, 0x5b, 0x6c, - 0xf0, 0xad, 0x84, 0x38, 0x30, 0x7d, 0x9f, 0x04, 0x9c, 0x85, 0xfe, 0xaf, 0x55, 0x68, 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, 0xd0, 0xf8, 0xcc, - 0xb3, 0x5d, 0x16, 0x58, 0x55, 0x16, 0x58, 0x29, 0x4c, 0xbf, 0xb9, 0x76, 0xff, 0xc8, 0xa5, 0xbe, - 0x46, 0x3f, 0xa4, 0xb0, 0xe8, 0xa2, 0xba, 0xec, 0xa2, 0x6b, 0x30, 0x6f, 0xfa, 0x7e, 0xd7, 0x74, - 0x07, 0x24, 0xc0, 0x49, 0x67, 0x30, 0x1d, 0x64, 0x2c, 0x2d, 0x08, 0x74, 0xa6, 0x9e, 0x17, 0x07, - 0x7d, 0xc2, 0xac, 0x5d, 0x33, 0x04, 0x0c, 0xe5, 0xe3, 0xf9, 0x24, 0x10, 0xf2, 0x18, 0x53, 0x3f, - 0x87, 0xe5, 0x21, 0x01, 0x69, 0x48, 0xd0, 0x42, 0x12, 0x47, 0xe4, 0xae, 0x6b, 0x31, 0xa5, 0x5a, - 0x4c, 0x29, 0x11, 0x45, 0x0b, 0x84, 0xed, 0x9e, 0xd8, 0x51, 0x5a, 0xae, 0x66, 0xb1, 0x40, 0x48, - 0x48, 0xfd, 0x97, 0x14, 0x98, 0xdf, 0x8b, 0xf7, 0x1d, 0xbb, 0xcf, 0x10, 0xd4, 0xf8, 0x99, 0x89, - 0x15, 0xc9, 0xc4, 0xa2, 0xa1, 0xd4, 0xd1, 0x86, 0xaa, 0xc8, 0x86, 0x5a, 0x82, 0xfa, 0x80, 0xb8, - 0x16, 0x09, 0x98, 0xe1, 0x6b, 0x06, 0x87, 0xb8, 0x42, 0xb5, 0x44, 0x21, 0xfd, 0x5f, 0x54, 0x68, - 0x7c, 0xc5, 0x22, 0xac, 0x40, 0xcb, 0x3f, 0xf4, 0x5c, 0xb2, 0x13, 0xd3, 0xe0, 0xe3, 0xb2, 0x88, - 0x28, 0xed, 0x22, 0xd4, 0xf6, 0xed, 0x20, 0x3a, 0x64, 0xde, 0x9f, 0x33, 0x10, 0xa0, 0x58, 0x32, - 0x34, 0x6d, 0x74, 0x79, 0xd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x23, 0x22, 0x58, 0xfa, 0x00, 0x1a, 0x09, 0x9a, 0x1d, 0x15, 0x9d, 0xfa, 0xe4, 0x41, 0xca, - 0x38, 0x01, 0xe5, 0x37, 0xe5, 0x4d, 0x4e, 0x4f, 0x43, 0xce, 0x31, 0x23, 0x12, 0x46, 0x42, 0xc8, - 0xa1, 0x11, 0x0a, 0x78, 0xfd, 0x63, 0xd0, 0x68, 0xe2, 0x79, 0x6e, 0x48, 0x84, 0x4b, 0x96, 0x15, - 0x68, 0x6d, 0xc4, 0x41, 0x40, 0xdc, 0x68, 0xcf, 0x1c, 0x24, 0xff, 0xad, 0x40, 0x44, 0xd1, 0x30, - 0xec, 0x65, 0xd7, 0x2c, 0x78, 0x82, 0x25, 0x60, 0xd6, 0x6f, 0x7e, 0xff, 0xc6, 0xae, 0x4f, 0xdc, - 0xa7, 0xdb, 0xdd, 0xc2, 0xff, 0x48, 0xfa, 0x76, 0xc1, 0x02, 0xfb, 0x75, 0xf6, 0xfd, 0x83, 0xff, - 0x0b, 0x00, 0x00, 0xff, 0xff, 0x32, 0x8b, 0x4b, 0xf5, 0x83, 0x49, 0x00, 0x00, +var fileDescriptor_ws_a0747f665ef3b307 = []byte{ + // 3765 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5b, 0xcf, 0x6f, 0x1b, 0xd7, + 0xf1, 0xcf, 0x92, 0x22, 0x45, 0x0e, 0x25, 0x8a, 0x5a, 0xdb, 0x0a, 0xc3, 0xc4, 0x8e, 0xb0, 0xc9, + 0xd7, 0x5f, 0xc7, 0x8d, 0xe5, 0x44, 0x69, 0xd2, 0x20, 0x09, 0xda, 0x58, 0x92, 0x2d, 0x2b, 0x36, + 0x2d, 0x75, 0x69, 0x27, 0x48, 0x7b, 0x08, 0x56, 0xdc, 0x27, 0x6a, 0xa3, 0xe5, 0xee, 0x6a, 0x7f, + 0xc8, 0x66, 0x7b, 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0x58, 0xc4, + 0x10, 0x14, 0x7c, 0xd1, 0x3e, 0x2a, 0xc3, 0x42, 0x82, 0xb0, 0x6b, 0xae, 0xdf, 0x23, 0xe1, 0x43, + 0x8c, 0x33, 0x86, 0x81, 0x6a, 0x82, 0x81, 0xcd, 0x82, 0x3c, 0x51, 0x6c, 0x35, 0x56, 0x9f, 0x5c, + 0x19, 0xb8, 0xee, 0xc0, 0x26, 0x6c, 0x20, 0xed, 0x46, 0x7b, 0x2b, 0x5b, 0x4e, 0xf8, 0xd2, 0xea, + 0xdb, 0x86, 0x1d, 0x91, 0x82, 0x24, 0xae, 0xe7, 0x92, 0x58, 0x3b, 0xde, 0x4c, 0x36, 0xc3, 0x5b, + 0x45, 0x19, 0xae, 0x1f, 0x6f, 0x27, 0xaf, 0xa5, 0xfd, 0xbb, 0x04, 0xa7, 0x30, 0x2d, 0x9c, 0x1b, + 0xd9, 0xf6, 0x31, 0x25, 0x60, 0x09, 0xaa, 0x11, 0x4b, 0x36, 0xcb, 0x0b, 0xa7, 0x68, 0xca, 0x7c, + 0xd7, 0x26, 0x37, 0xc9, 0x11, 0xb1, 0x31, 0x23, 0x15, 0x3d, 0x65, 0xa8, 0x1d, 0xa8, 0xbd, 0xef, + 0x5a, 0x0e, 0x02, 0x6b, 0x06, 0x81, 0x95, 0xd0, 0xf4, 0x9b, 0x63, 0xf5, 0x0f, 0x1c, 0x9a, 0x6b, + 0x96, 0x87, 0x84, 0x16, 0x53, 0x54, 0x95, 0x53, 0x74, 0x1e, 0x9a, 0x86, 0xe7, 0x75, 0x0d, 0x67, + 0x40, 0x7c, 0xd6, 0xe8, 0x2c, 0x1b, 0x0e, 0x32, 0x97, 0x16, 0x04, 0xda, 0x52, 0xcf, 0x8d, 0xfc, + 0x3e, 0xc1, 0x68, 0x57, 0x74, 0x81, 0x43, 0xed, 0xb8, 0x1e, 0xf1, 0x85, 0x71, 0xcc, 0x86, 0x7e, + 0x86, 0xcb, 0x21, 0x01, 0x09, 0x24, 0x68, 0x21, 0x89, 0x42, 0x72, 0xd5, 0x31, 0xd1, 0xa9, 0x06, + 0x3a, 0x25, 0xb2, 0x68, 0x81, 0xb0, 0x9c, 0x23, 0x2b, 0x4c, 0xca, 0xd5, 0x1c, 0x2b, 0x10, 0x12, + 0x53, 0xfb, 0x9e, 0x02, 0xcd, 0x9d, 0x68, 0xd7, 0xb6, 0xfa, 0xc8, 0xa0, 0xc1, 0x4f, 0x43, 0xac, + 0x48, 0x21, 0x16, 0x03, 0x55, 0x1a, 0x1f, 0xa8, 0xb2, 0x1c, 0xa8, 0x25, 0xa8, 0x0e, 0x88, 0x63, + 0x12, 0x1f, 0x03, 0x5f, 0xd1, 0x39, 0xc5, 0x1d, 0xaa, 0xc4, 0x0e, 0x69, 0x7f, 0x2e, 0x41, 0xed, + 0x01, 0x77, 0x61, 0x19, 0x1a, 0xde, 0xbe, 0xeb, 0x90, 0x5b, 0x11, 0x05, 0x1f, 0xef, 0x8b, 0xc8, + 0x52, 0x4f, 0x43, 0x65, 0xd7, 0xf2, 0xc3, 0x7d, 0xcc, 0xfe, 0xbc, 0xce, 0x08, 0xca, 0x25, 0x43, + 0xc3, 0x62, 0x29, 0xaf, 0xeb, 0x8c, 0xe0, 0x0e, 0xd5, 0x92, 0x0c, 0xc9, 0x53, 0x41, 0x3d, 0x37, + 0x15, 0xe4, 0x11, 0x04, 0x85, 0x08, 0xba, 0x08, 0xad, 0x81, 0xed, 0xee, 0x1a, 0xb6, 0x4e, 0xfa, + 0x47, 0xdd, 0x60, 0xb0, 0xed, 0x85, 0x98, 0xee, 0x8a, 0x9e, 0xe3, 0xd3, 0xf8, 0x60, 0x17, 0x4d, + 0x63, 0x84, 0x85, 0xbc, 0xac, 0x27, 0xb4, 0xf6, 0x0f, 0x05, 0x80, 0x0d, 0x3b, 0x0c, 0x71, 0x66, + 0x2e, 0x53, 0xf2, 0x73, 0xd9, 0x12, 0x54, 0x7d, 0x32, 0x34, 0xfc, 0x83, 0x78, 0xa8, 0x31, 0x2a, + 0xe3, 0x58, 0x39, 0xe7, 0xd8, 0x65, 0x80, 0x3d, 0x6c, 0x87, 0xda, 0xc1, 0x90, 0x37, 0x56, 0x17, + 0x56, 0x70, 0xe2, 0x5f, 0x89, 0x33, 0xac, 0x0b, 0x22, 0x74, 0xec, 0x1a, 0xa6, 0xc9, 0x87, 0x48, + 0x85, 0x8d, 0xdd, 0x84, 0x51, 0x30, 0x42, 0xaa, 0x13, 0x46, 0xc8, 0x6c, 0x02, 0xa8, 0xbf, 0x28, + 0x50, 0x5f, 0xb3, 0x8d, 0xfe, 0xc1, 0x94, 0xee, 0xca, 0x6e, 0x95, 0x72, 0x6e, 0xbd, 0x0e, 0xf3, + 0xbb, 0xd4, 0x5c, 0xec, 0x02, 0x7a, 0xde, 0x58, 0x3d, 0xc3, 0x3d, 0x93, 0x07, 0x91, 0x2e, 0xcb, + 0xca, 0x2e, 0xce, 0x1c, 0xef, 0x62, 0x65, 0x82, 0x8b, 0xc9, 0xbc, 0x40, 0xcb, 0xe7, 0x1c, 0x96, + 0x4f, 0x9d, 0x1c, 0x46, 0x24, 0x08, 0xd5, 0x17, 0xa1, 0x16, 0xc5, 0xdd, 0x53, 0x26, 0x75, 0x2f, + 0x11, 0x53, 0x57, 0xf8, 0x5c, 0x87, 0x3a, 0x25, 0xd4, 0x69, 0x71, 0x9d, 0x64, 0xc2, 0xd4, 0x53, + 0x11, 0x3a, 0xb3, 0xed, 0x1b, 0x8e, 0x69, 0x13, 0x9d, 0x04, 0x91, 0x1d, 0xf2, 0x5a, 0x2b, 0xf1, + 0x18, 0x72, 0x0e, 0xbb, 0xc1, 0x80, 0xcf, 0x7b, 0x9c, 0xa2, 0x51, 0x60, 0x72, 0xf4, 0x13, 0x73, + 0x31, 0x65, 0xd0, 0x01, 0xec, 0x93, 0x43, 0x8c, 0x7e, 0x15, 0xa3, 0x1f, 0x93, 0x69, 0x9b, 0x3c, + 0x3a, 0x2c, 0xc9, 0x12, 0x8f, 0xa6, 0x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d, 0x12, 0x59, 0x14, 0x62, 0xbd, 0xf4, 0x74, 0x9a, 0x9d, 0x68, 0x08, + 0x9c, 0xb5, 0xa7, 0xbf, 0x71, 0x76, 0xdb, 0x23, 0xce, 0x7b, 0x5b, 0xdd, 0xec, 0x8f, 0xc4, 0x5f, + 0xc7, 0xbf, 0xbb, 0x55, 0x64, 0xbd, 0xf4, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x54, 0x95, + 0x23, 0x6a, 0x3e, 0x00, 0x00, } diff --git a/pkg/proto/sdkws/ws.proto b/pkg/proto/sdkws/ws.proto index 5aaf07b08..cc369a3c0 100644 --- a/pkg/proto/sdkws/ws.proto +++ b/pkg/proto/sdkws/ws.proto @@ -132,7 +132,6 @@ message FriendRequest{ ///////////////////////////////////base end///////////////////////////////////// message PullMessageBySeqListReq{ string userID = 1; - string operationID = 2; repeated uint32 seqList = 3; map groupSeqList = 4; } @@ -158,7 +157,6 @@ message PullMessageBySeqListResp { message GetMaxAndMinSeqReq { repeated string groupIDList = 1; string userID = 2; - string operationID = 3; } message MaxAndMinSeq{ uint32 maxSeq = 1; @@ -167,8 +165,6 @@ message MaxAndMinSeq{ message GetMaxAndMinSeqResp { uint32 maxSeq = 1; uint32 minSeq = 2; - int32 errCode = 3; - string errMsg = 4; map groupMaxAndMinSeq = 5; } @@ -606,15 +602,11 @@ message SignalGetTokenByRoomIDReply { message DelMsgListReq{ - string opUserID = 1; string userID = 2; repeated uint32 seqList = 3; - string operationID = 4; } message DelMsgListResp{ - int32 errCode = 1; - string errMsg = 2; } message SetAppBackgroundStatusReq { diff --git a/pkg/proto/user/user.proto b/pkg/proto/user/user.proto index 3fb70a6a2..085cdafb7 100644 --- a/pkg/proto/user/user.proto +++ b/pkg/proto/user/user.proto @@ -128,7 +128,13 @@ message userRegisterResp { } +message getGlobalRecvMessageOptReq{ + string userID = 1; +} +message getGlobalRecvMessageOptResp{ + int32 globalRecvMsgOpt = 1; +} service user { //获取指定的用户信息 全字段 @@ -137,8 +143,10 @@ service user { rpc updateUserInfo(updateUserInfoReq) returns(updateUserInfoResp); //设置用户消息接收选项 rpc setGlobalRecvMessageOpt(setGlobalRecvMessageOptReq) returns(setGlobalRecvMessageOptResp); + //获取用户消息接收选项 没找到不返回错误 + rpc getGlobalRecvMessageOpt(getGlobalRecvMessageOptReq) returns(getGlobalRecvMessageOptResp); //检查userID是否存在 - rpc accountCheck(accountCheckReq)returns(accountCheckResp); + rpc accountCheck(accountCheckReq) returns (accountCheckResp); //翻页(或指定userID,昵称)拉取用户信息 全字段 rpc getPaginationUsers(getPaginationUsersReq) returns (getPaginationUsersResp); //用户注册 diff --git a/pkg/utils/utils_v2.go b/pkg/utils/utils_v2.go index 91c8fecd9..f32a7b73a 100644 --- a/pkg/utils/utils_v2.go +++ b/pkg/utils/utils_v2.go @@ -412,3 +412,24 @@ func (o *sortSlice[E]) Swap(i, j int) { type Ordered interface { ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string } + +func Unwrap(err error) error { + for err != nil { + unwrap, ok := err.(interface { + Unwrap() error + }) + if !ok { + break + } + err = unwrap.Unwrap() + } + return err +} + +// NotNilReplace 当new_不为空时, 将old设置为new_ +func NotNilReplace[T any](old, new_ *T) { + if old == nil || new_ == nil { + return + } + *old = *new_ +}