diff --git a/cmd/api/main.go b/cmd/api/main.go index 1e3f6d918..1e590de68 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -23,9 +23,10 @@ import ( swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/prome" "github.com/gin-gonic/gin" + //"syscall" + "Open_IM/pkg/common/constant" + prome "Open_IM/pkg/common/prome" ) // @title open-IM-Server API diff --git a/cmd/rpc/conversation/main.go b/cmd/rpc/conversation/main.go index e9ef7d201..9f030c801 100644 --- a/cmd/rpc/conversation/main.go +++ b/cmd/rpc/conversation/main.go @@ -1,27 +1,11 @@ package main import ( - rpcConversation "Open_IM/internal/rpc/conversation" + "Open_IM/internal/rpc/conversation" + "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.OpenImConversationPort - rpcPort := flag.Int("port", defaultPorts[0], "RpcConversation default listen port 11300") - prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.ConversationPrometheusPort[0], "conversationPrometheusPort default listen port") - flag.Parse() - fmt.Println("start conversation rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n") - rpcServer := rpcConversation.NewRpcConversationServer(*rpcPort) - go func() { - err := prome.StartPromeSrv(*prometheusPort) - if err != nil { - panic(err) - } - }() - rpcServer.Run() - + startrpc.Start(config.Config.RpcPort.OpenImConversationPort, config.Config.RpcRegisterName.OpenImConversationName, config.Config.Prometheus.ConversationPrometheusPort, conversation.Start) } diff --git a/go.mod b/go.mod index ccc587ea4..621d8a694 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 @@ -49,23 +49,111 @@ require ( google.golang.org/api v0.103.0 google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 + gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/mysql v1.3.5 gorm.io/gorm v1.23.8 ) +require github.com/minio/minio-go v6.0.14+incompatible + 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/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect + github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect + github.com/alibabacloud-go/openapi-util v0.0.9 // indirect + github.com/alibabacloud-go/tea-utils v1.3.9 // indirect + github.com/aliyun/credentials-go v1.1.2 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 // indirect + github.com/aws/smithy-go v1.12.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/eapache/go-resiliency v1.2.0 // indirect + github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect + github.com/eapache/queue v1.1.0 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect + github.com/go-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/jonboulle/clockwork v0.3.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/cpuid v1.3.1 // indirect + github.com/leodido/go-urn v1.2.1 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect + github.com/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.opencensus.io v0.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 805ab32e1..6061629ad 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= @@ -465,8 +451,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= @@ -517,9 +501,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= @@ -527,12 +509,13 @@ 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= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -564,7 +547,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= @@ -574,11 +556,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/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -657,12 +636,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= @@ -695,7 +672,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= @@ -738,7 +714,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= @@ -772,14 +747,14 @@ 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= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= +github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o= +github.com/minio/minio-go v6.0.14+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8= github.com/minio/minio-go/v7 v7.0.22 h1:iXhsiRyYh1ozm/+jN2qGgEIahYjEkvcpuu6NcdpSxcA= github.com/minio/minio-go/v7 v7.0.22/go.mod h1:ei5JjmxwHaMrgsMrn4U/+Nmg+d8MKS1U2DAn1ou4+Do= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= @@ -801,29 +776,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= @@ -879,7 +842,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= @@ -918,10 +880,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= @@ -942,7 +901,6 @@ 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.mongodb.org/mongo-driver v1.8.3 h1:TDKlTkGDKm9kkJVUOAXDK5/fkqKHJVwYQSpoRfB43R4= go.mongodb.org/mongo-driver v1.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= @@ -967,7 +925,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= @@ -984,7 +941,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= @@ -1010,12 +966,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= @@ -1038,7 +992,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= @@ -1053,11 +1006,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= @@ -1118,7 +1069,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= @@ -1129,11 +1079,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= @@ -1159,7 +1106,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= @@ -1180,7 +1126,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= @@ -1207,7 +1152,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= @@ -1225,7 +1169,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= @@ -1276,7 +1219,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= @@ -1286,7 +1228,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= @@ -1461,10 +1402,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= @@ -1502,7 +1440,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= @@ -1530,15 +1467,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/api/auth/auth.go b/internal/api/auth/auth.go index bfb43cf23..94c805b48 100644 --- a/internal/api/auth/auth.go +++ b/internal/api/auth/auth.go @@ -1,7 +1,7 @@ package apiAuth import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" diff --git a/internal/api/conversation/conversation.go b/internal/api/conversation/conversation.go index 687c95ffd..251de1994 100644 --- a/internal/api/conversation/conversation.go +++ b/internal/api/conversation/conversation.go @@ -1,10 +1,9 @@ package conversation import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" - "Open_IM/pkg/getcdv3" pbConversation "Open_IM/pkg/proto/conversation" pbUser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go index 14306cdc2..953ab9574 100644 --- a/internal/api/friend/friend.go +++ b/internal/api/friend/friend.go @@ -2,7 +2,7 @@ package friend //import ( // jsonData "Open_IM/internal/utils" -// api "Open_IM/pkg/api_struct" +// api "Open_IM/pkg/apistruct" // "Open_IM/pkg/common/config" // "Open_IM/pkg/common/log" // "Open_IM/pkg/common/tokenverify" diff --git a/internal/api/friend/friend1.go b/internal/api/friend/friend1.go index a3469245c..dc94aa210 100644 --- a/internal/api/friend/friend1.go +++ b/internal/api/friend/friend1.go @@ -1,8 +1,8 @@ package friend import ( - common "Open_IM/internal/api_to_rpc" - api "Open_IM/pkg/api_struct" + common "Open_IM/internal/api2rpc" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" rpc "Open_IM/pkg/proto/friend" "github.com/gin-gonic/gin" diff --git a/internal/api/group/group.go b/internal/api/group/group.go index 2682374e8..5cc57e2c1 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -2,7 +2,7 @@ package group //import ( // common "Open_IM/internal/api_to_rpc" -// api "Open_IM/pkg/api_struct" +// api "Open_IM/pkg/apistruct" // "Open_IM/pkg/common/config" // "Open_IM/pkg/common/constant" // "Open_IM/pkg/common/log" diff --git a/internal/api/group/group_test.go b/internal/api/group/group_test.go index fc9595270..24da7cb2d 100644 --- a/internal/api/group/group_test.go +++ b/internal/api/group/group_test.go @@ -1,7 +1,7 @@ package group import ( - "Open_IM/pkg/api_struct" + "Open_IM/pkg/apistruct" "Open_IM/pkg/proto/group" "context" "errors" @@ -69,10 +69,10 @@ func KickGroupMember(c *gin.Context) { // 默认 全部自动 NewRpc(NewApiBind[apistruct.KickGroupMemberReq, apistruct.KickGroupMemberResp](c), "", group.NewGroupClient, group.GroupClient.KickGroupMember).Execute() // 可以自定义编辑请求和响应 - a := NewRpc(NewApiBind[api_struct.KickGroupMemberReq, api_struct.KickGroupMemberResp](c), "", group.NewGroupClient, group.GroupClient.KickGroupMember) - a.Before(func(apiReq *api_struct.KickGroupMemberReq, rpcReq *group.KickGroupMemberReq, bind func() error) error { + a := NewRpc(NewApiBind[apistruct.KickGroupMemberReq, apistruct.KickGroupMemberResp](c), "", group.NewGroupClient, group.GroupClient.KickGroupMember) + a.Before(func(apiReq *apistruct.KickGroupMemberReq, rpcReq *group.KickGroupMemberReq, bind func() error) error { return bind() - }).After(func(rpcResp *group.KickGroupMemberResp, apiResp *api_struct.KickGroupMemberResp, bind func() error) error { + }).After(func(rpcResp *group.KickGroupMemberResp, apiResp *apistruct.KickGroupMemberResp, bind func() error) error { return bind() }).Execute() } diff --git a/internal/api/group/super_group.go b/internal/api/group/super_group.go index 10858d706..0dd19abd0 100644 --- a/internal/api/group/super_group.go +++ b/internal/api/group/super_group.go @@ -2,7 +2,7 @@ package group //import ( // jsonData "Open_IM/internal/utils" -// api "Open_IM/pkg/api_struct" +// api "Open_IM/pkg/apistruct" // "Open_IM/pkg/common/config" // "Open_IM/pkg/common/log" // "Open_IM/pkg/common/token_verify" diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index 3df2d0c5c..d1160fd0f 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -7,10 +7,9 @@ package manage import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" pbChat "Open_IM/pkg/proto/msg" diff --git a/internal/api/manage/management_user.go b/internal/api/manage/management_user.go index e2c5a1721..7e1829e48 100644 --- a/internal/api/manage/management_user.go +++ b/internal/api/manage/management_user.go @@ -7,12 +7,11 @@ package manage import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" pbRelay "Open_IM/pkg/proto/relay" rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" diff --git a/internal/api/msg/del_msg.go b/internal/api/msg/del_msg.go index 877062404..e3031faf9 100644 --- a/internal/api/msg/del_msg.go +++ b/internal/api/msg/del_msg.go @@ -1,12 +1,11 @@ package msg import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" rpc "Open_IM/pkg/proto/msg" pbCommon "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" diff --git a/internal/api/msg/extend_msg.go b/internal/api/msg/extend_msg.go index 44db54920..a1e4130d3 100644 --- a/internal/api/msg/extend_msg.go +++ b/internal/api/msg/extend_msg.go @@ -1,12 +1,11 @@ package msg import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" rpc "Open_IM/pkg/proto/msg" "Open_IM/pkg/utils" "context" diff --git a/internal/api/msg/get_max_min_seq.go b/internal/api/msg/get_max_min_seq.go index b6cecdfe3..444f82d04 100644 --- a/internal/api/msg/get_max_min_seq.go +++ b/internal/api/msg/get_max_min_seq.go @@ -4,7 +4,6 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" pbChat "Open_IM/pkg/proto/msg" sdkws "Open_IM/pkg/proto/sdkws" "context" diff --git a/internal/api/msg/pull_msg.go b/internal/api/msg/pull_msg.go index 5bd2c175f..254e9b781 100644 --- a/internal/api/msg/pull_msg.go +++ b/internal/api/msg/pull_msg.go @@ -4,7 +4,6 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" - "Open_IM/pkg/getcdv3" "Open_IM/pkg/proto/msg" sdkws "Open_IM/pkg/proto/sdkws" "Open_IM/pkg/utils" diff --git a/internal/api/msg/send_msg.go b/internal/api/msg/send_msg.go index 36f7e2d1d..a9b826c5f 100644 --- a/internal/api/msg/send_msg.go +++ b/internal/api/msg/send_msg.go @@ -7,7 +7,6 @@ import ( sdkws "Open_IM/pkg/proto/sdkws" "context" - "Open_IM/pkg/getcdv3" "github.com/gin-gonic/gin" "net/http" "strings" diff --git a/internal/api/third/ali_oss_credential.go b/internal/api/third/ali_oss_credential.go index ce3d34be7..0dce20690 100644 --- a/internal/api/third/ali_oss_credential.go +++ b/internal/api/third/ali_oss_credential.go @@ -1,7 +1,7 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" diff --git a/internal/api/third/aws_storage_credential.go b/internal/api/third/aws_storage_credential.go index 9a7b9268d..5e4127155 100644 --- a/internal/api/third/aws_storage_credential.go +++ b/internal/api/third/aws_storage_credential.go @@ -1,7 +1,7 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" diff --git a/internal/api/third/fcm_update_token.go b/internal/api/third/fcm_update_token.go index 2b7a2da20..b6a31b96a 100644 --- a/internal/api/third/fcm_update_token.go +++ b/internal/api/third/fcm_update_token.go @@ -1,8 +1,7 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" - "Open_IM/pkg/common/db" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/utils" diff --git a/internal/api/third/minio_storage_credential.go b/internal/api/third/minio_storage_credential.go index c57e8b1e9..b8f610b5c 100644 --- a/internal/api/third/minio_storage_credential.go +++ b/internal/api/third/minio_storage_credential.go @@ -1,10 +1,9 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "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" _ "Open_IM/pkg/common/tokenverify" diff --git a/internal/api/third/rtc.go b/internal/api/third/rtc.go index 60a37856c..1a4656197 100644 --- a/internal/api/third/rtc.go +++ b/internal/api/third/rtc.go @@ -1,8 +1,7 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" - "Open_IM/pkg/common/db" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/utils" diff --git a/internal/api/third/set_app_badge.go b/internal/api/third/set_app_badge.go index e93b38a80..a6349173c 100644 --- a/internal/api/third/set_app_badge.go +++ b/internal/api/third/set_app_badge.go @@ -1,8 +1,7 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" - "Open_IM/pkg/common/db" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/utils" diff --git a/internal/api/third/tencent_cloud_storage_credential.go b/internal/api/third/tencent_cloud_storage_credential.go index e36b49d5c..c008f8590 100644 --- a/internal/api/third/tencent_cloud_storage_credential.go +++ b/internal/api/third/tencent_cloud_storage_credential.go @@ -1,7 +1,7 @@ package apiThird import ( - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" diff --git a/internal/api/user/user.go b/internal/api/user/user.go index 3927acbaa..e8d3a157c 100644 --- a/internal/api/user/user.go +++ b/internal/api/user/user.go @@ -1,17 +1,16 @@ package user import ( - jsonData "Open_IM/internal/utils" - api "Open_IM/pkg/api_struct" + api "Open_IM/pkg/apistruct" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/tokenverify" - cacheRpc "Open_IM/pkg/proto/cache" pbRelay "Open_IM/pkg/proto/relay" sdkws "Open_IM/pkg/proto/sdkws" rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" + jsonData "Open_IM/pkg/utils" "context" "net/http" "strings" diff --git a/internal/common/check/black.go b/internal/common/check/black.go index 3e15bec0b..429aa80f6 100644 --- a/internal/common/check/black.go +++ b/internal/common/check/black.go @@ -17,5 +17,5 @@ func NewBlackChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *BlackChecker { // possibleBlackUserID是否被userID拉黑,也就是是否在userID的黑名单中 func (b *BlackChecker) IsBlocked(ctx context.Context, possibleBlackUserID, userID string) (bool, error) { - + return false, nil } diff --git a/internal/common/check/conversation.go b/internal/common/check/conversation.go index c56330c5b..a5413d1e2 100644 --- a/internal/common/check/conversation.go +++ b/internal/common/check/conversation.go @@ -31,5 +31,5 @@ func (c *ConversationChecker) getConn() (*grpc.ClientConn, error) { } func (c *ConversationChecker) GetSingleConversationRecvMsgOpt(ctx context.Context, userID, conversationID string) (int32, error) { - + panic("implement me") } diff --git a/internal/common/check/friend.go b/internal/common/check/friend.go index 6c4a50a48..622b4fd9d 100644 --- a/internal/common/check/friend.go +++ b/internal/common/check/friend.go @@ -2,6 +2,7 @@ package check import ( "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" discoveryRegistry "Open_IM/pkg/discoveryregistry" "Open_IM/pkg/proto/friend" sdkws "Open_IM/pkg/proto/sdkws" @@ -24,7 +25,7 @@ func (f *FriendChecker) GetFriendsInfo(ctx context.Context, ownerUserID, friendU if err != nil { return nil, err } - r, err := friend.NewFriendClient(cc).GetPaginationFriends(ctx, &friend.GetPaginationFriendsReq{OwnerUserID: ownerUserID, FriendUserIDs: []string{friendUserID}}) + r, err := friend.NewFriendClient(cc).GetDesignatedFriends(ctx, &friend.GetDesignatedFriendsReq{OwnerUserID: ownerUserID, FriendUserIDs: []string{friendUserID}}) if err != nil { return nil, err } @@ -37,5 +38,38 @@ func (f *FriendChecker) getConn() (*grpc.ClientConn, error) { // possibleFriendUserID是否在userID的好友中 func (f *FriendChecker) IsFriend(ctx context.Context, possibleFriendUserID, userID string) (bool, error) { + cc, err := f.getConn() + if err != nil { + return false, err + } + resp, err := friend.NewFriendClient(cc).IsFriend(ctx, &friend.IsFriendReq{UserID1: userID, UserID2: possibleFriendUserID}) + if err != nil { + return false, err + } + return resp.InUser1Friends, nil } + +func (f *FriendChecker) GetAllPageFriends(ctx context.Context, ownerUserID string) (resp []*sdkws.FriendInfo, err error) { + cc, err := f.getConn() + if err != nil { + return nil, err + } + page := int32(0) + req := friend.GetPaginationFriendsReq{UserID: ownerUserID} + for { + req.Pagination = &sdkws.RequestPagination{PageNumber: page, ShowNumber: constant.ShowNumber} + tmp, err := friend.NewFriendClient(cc).GetPaginationFriends(ctx, &req) + if err != nil { + return nil, err + } + if len(tmp.FriendsInfo) == 0 { + if tmp.Total == int32(len(resp)) { + return resp, nil + } + return nil, constant.ErrData.Wrap("The total number of results and expectations are different, but result is nil") + } + resp = append(resp, tmp.FriendsInfo...) + page++ + } +} diff --git a/internal/common/check/user.go b/internal/common/check/user.go index 5e5b38ee7..66b2a8ce9 100644 --- a/internal/common/check/user.go +++ b/internal/common/check/user.go @@ -12,10 +12,6 @@ import ( "strings" ) -//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, @@ -104,5 +100,12 @@ func (u *UserCheck) GetPublicUserInfoMap(ctx context.Context, userIDs []string, } func (u *UserCheck) GetUserGlobalMsgRecvOpt(ctx context.Context, userID string) (int32, error) { - + cc, err := u.getConn() + if err != nil { + return 0, err + } + resp, err := user.NewUserClient(cc).GetGlobalRecvMessageOpt(ctx, &user.GetGlobalRecvMessageOptReq{ + UserID: userID, + }) + return resp.GlobalRecvMsgOpt, err } diff --git a/internal/common/notification/msg.go b/internal/common/notification/msg.go index 137faf02f..8eb6c0213 100644 --- a/internal/common/notification/msg.go +++ b/internal/common/notification/msg.go @@ -8,8 +8,8 @@ import ( "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} +func (c *Check) DeleteMessageNotification(ctx context.Context, userID string, seqs []int64, operationID string) { + DeleteMessageTips := sdkws.DeleteMessageTips{UserID: userID, Seqs: seqs} c.MessageNotification(ctx, userID, userID, constant.DeleteMessageNotification, &DeleteMessageTips) } diff --git a/internal/msggateway/batch_push.go b/internal/msggateway/batch_push.go index a215ddd0a..fb8fc89fe 100644 --- a/internal/msggateway/batch_push.go +++ b/internal/msggateway/batch_push.go @@ -2,7 +2,6 @@ package msggateway import ( "Open_IM/pkg/common/config" - "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/msg" sdkws "Open_IM/pkg/proto/sdkws" diff --git a/internal/msggateway/init.go b/internal/msggateway/init.go index b345ccaca..61bdee08b 100644 --- a/internal/msggateway/init.go +++ b/internal/msggateway/init.go @@ -8,7 +8,7 @@ import ( "fmt" "sync" - prome "Open_IM/pkg/common/prometheus" + prome "Open_IM/pkg/common/prome" "github.com/go-playground/validator/v10" ) diff --git a/internal/msggateway/logic.go b/internal/msggateway/logic.go index 54ac0bf7d..0ca3ab439 100644 --- a/internal/msggateway/logic.go +++ b/internal/msggateway/logic.go @@ -3,7 +3,6 @@ package msggateway import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" "Open_IM/pkg/common/prome" pbChat "Open_IM/pkg/proto/msg" diff --git a/internal/msggateway/new/client.go b/internal/msggateway/new/client.go index 68178a1da..61ade23fe 100644 --- a/internal/msggateway/new/client.go +++ b/internal/msggateway/new/client.go @@ -3,14 +3,12 @@ package new import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/utils" - "bytes" "context" "errors" "fmt" "github.com/go-playground/validator/v10" "runtime/debug" "sync" - "time" ) const ( @@ -35,35 +33,52 @@ const ( type Client struct { w *sync.Mutex conn LongConn - PlatformID int32 - PushedMaxSeq uint32 - IsCompress bool + platformID int + isCompress bool userID string - IsBackground bool - token string + isBackground bool connID string onlineAt int64 // 上线时间戳(毫秒) handler MessageHandler unregisterChan chan *Client compressor Compressor encoder Encoder - userContext UserConnContext validate *validator.Validate closed bool } -func newClient(conn LongConn, isCompress bool, userID string, isBackground bool, token string, - connID string, onlineAt int64, handler MessageHandler, unregisterChan chan *Client) *Client { +func newClient(ctx *UserConnContext, conn LongConn, isCompress bool, compressor Compressor, encoder Encoder, + handler MessageHandler, unregisterChan chan *Client, validate *validator.Validate) *Client { return &Client{ - conn: conn, - IsCompress: isCompress, - userID: userID, IsBackground: isBackground, token: token, - connID: connID, - onlineAt: onlineAt, + w: new(sync.Mutex), + conn: conn, + platformID: utils.StringToInt(ctx.GetPlatformID()), + isCompress: isCompress, + userID: ctx.GetUserID(), + compressor: compressor, + encoder: encoder, + connID: ctx.GetConnID(), + onlineAt: utils.GetCurrentTimestampByMill(), handler: handler, unregisterChan: unregisterChan, + validate: validate, } } +func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isCompress bool, compressor Compressor, encoder Encoder, + handler MessageHandler, unregisterChan chan *Client, validate *validator.Validate) { + c.w = new(sync.Mutex) + c.conn = conn + c.platformID = utils.StringToInt(ctx.GetPlatformID()) + c.isCompress = isCompress + c.userID = ctx.GetUserID() + c.compressor = compressor + c.encoder = encoder + c.connID = ctx.GetConnID() + c.onlineAt = utils.GetCurrentTimestampByMill() + c.handler = handler + c.unregisterChan = unregisterChan + c.validate = validate +} func (c *Client) readMessage() { defer func() { if r := recover(); r != nil { @@ -77,7 +92,7 @@ func (c *Client) readMessage() { if returnErr != nil { break } - if c.closed == true { + if c.closed == true { //连接刚置位已经关闭,但是协程还没退出的场景 break } switch messageType { @@ -119,7 +134,8 @@ func (c *Client) handleMessage(message []byte) error { 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, c.connID, binaryReq.OperationID) + ctx = context.WithValue(ctx, OPERATION_ID, binaryReq.OperationID) ctx = context.WithValue(ctx, "userID", binaryReq.SendID) var messageErr error var resp []byte @@ -173,7 +189,7 @@ func (c *Client) writeMsg(resp Resp) error { return utils.Wrap(err, "") } _ = c.conn.SetWriteTimeout(60) - if c.IsCompress { + if c.isCompress { var compressErr error resultBuf, compressErr = c.compressor.Compress(encodeBuf) if compressErr != nil { diff --git a/internal/msggateway/new/compressor.go b/internal/msggateway/new/compressor.go index 42abcccd1..fbc9ea7bf 100644 --- a/internal/msggateway/new/compressor.go +++ b/internal/msggateway/new/compressor.go @@ -4,7 +4,6 @@ import ( "bytes" "compress/gzip" "io/ioutil" - "open_im_sdk/pkg/utils" ) type Compressor interface { diff --git a/internal/msggateway/new/constant.go b/internal/msggateway/new/constant.go new file mode 100644 index 000000000..b9e5c6aea --- /dev/null +++ b/internal/msggateway/new/constant.go @@ -0,0 +1,10 @@ +package new + +const ( + USERID = "sendID" + PLATFORM_ID = "platformID" + TOKEN = "token" + OPERATION_ID = "operationID" + COMPRESSION = "compression" + GZIP_COMPRESSION_PROTOCAL = "gzip" +) diff --git a/internal/msggateway/new/context.go b/internal/msggateway/new/context.go index 9ab353351..45e923a34 100644 --- a/internal/msggateway/new/context.go +++ b/internal/msggateway/new/context.go @@ -1,6 +1,10 @@ package new -import "net/http" +import ( + "Open_IM/pkg/utils" + "net/http" + "strconv" +) type UserConnContext struct { RespWriter http.ResponseWriter @@ -19,9 +23,32 @@ func newContext(respWriter http.ResponseWriter, req *http.Request) *UserConnCont RemoteAddr: req.RemoteAddr, } } -func (c *UserConnContext) Query(key string) string { - return c.Req.URL.Query().Get(key) +func (c *UserConnContext) Query(key string) (string, bool) { + var value string + if value = c.Req.URL.Query().Get(key); value == "" { + return value, false + } + return value, true } -func (c *UserConnContext) GetHeader(key string) string { - return c.Req.Header.Get(key) +func (c *UserConnContext) GetHeader(key string) (string, bool) { + var value string + if value = c.Req.Header.Get(key); value == "" { + return value, false + } + return value, true +} +func (c *UserConnContext) SetHeader(key, value string) { + c.RespWriter.Header().Set(key, value) +} +func (c *UserConnContext) ErrReturn(error string, code int) { + http.Error(c.RespWriter, error, code) +} +func (c *UserConnContext) GetConnID() string { + return c.RemoteAddr + "_" + strconv.Itoa(int(utils.GetCurrentTimestampByMill())) +} +func (c *UserConnContext) GetUserID() string { + return c.Req.URL.Query().Get(USERID) +} +func (c *UserConnContext) GetPlatformID() string { + return c.Req.URL.Query().Get(PLATFORM_ID) } diff --git a/internal/msggateway/new/encoder.go b/internal/msggateway/new/encoder.go index 10f369d2b..522d40c6a 100644 --- a/internal/msggateway/new/encoder.go +++ b/internal/msggateway/new/encoder.go @@ -3,7 +3,6 @@ package new import ( "bytes" "encoding/gob" - "open_im_sdk/pkg/utils" ) type Encoder interface { diff --git a/internal/msggateway/new/http_error.go b/internal/msggateway/new/http_error.go new file mode 100644 index 000000000..8686d78d7 --- /dev/null +++ b/internal/msggateway/new/http_error.go @@ -0,0 +1,44 @@ +package new + +import ( + "Open_IM/pkg/common/constant" + "errors" + "net/http" +) + +func httpError(ctx *UserConnContext, err error) { + code := http.StatusUnauthorized + ctx.SetHeader("Sec-Websocket-Version", "13") + ctx.SetHeader("ws_err_msg", err.Error()) + if errors.Is(err, constant.ErrTokenExpired) { + code = int(constant.ErrTokenExpired.ErrCode) + } + if errors.Is(err, constant.ErrTokenInvalid) { + code = int(constant.ErrTokenInvalid.ErrCode) + } + if errors.Is(err, constant.ErrTokenMalformed) { + code = int(constant.ErrTokenMalformed.ErrCode) + } + if errors.Is(err, constant.ErrTokenNotValidYet) { + code = int(constant.ErrTokenNotValidYet.ErrCode) + } + if errors.Is(err, constant.ErrTokenUnknown) { + code = int(constant.ErrTokenUnknown.ErrCode) + } + if errors.Is(err, constant.ErrTokenKicked) { + code = int(constant.ErrTokenKicked.ErrCode) + } + if errors.Is(err, constant.ErrTokenDifferentPlatformID) { + code = int(constant.ErrTokenDifferentPlatformID.ErrCode) + } + if errors.Is(err, constant.ErrTokenDifferentUserID) { + code = int(constant.ErrTokenDifferentUserID.ErrCode) + } + if errors.Is(err, constant.ErrConnOverMaxNumLimit) { + code = int(constant.ErrConnOverMaxNumLimit.ErrCode) + } + if errors.Is(err, constant.ErrConnArgsErr) { + code = int(constant.ErrConnArgsErr.ErrCode) + } + ctx.ErrReturn(err.Error(), code) +} diff --git a/internal/msggateway/new/long_conn.go b/internal/msggateway/new/long_conn.go index 823964e40..fd33ea615 100644 --- a/internal/msggateway/new/long_conn.go +++ b/internal/msggateway/new/long_conn.go @@ -26,19 +26,37 @@ type LongConn interface { SetConnNil() //Check the connection of the current and when it was sent are the same CheckSendConnDiffNow() bool + // + GenerateLongConn(w http.ResponseWriter, r *http.Request) error } type GWebSocket struct { - protocolType int - conn *websocket.Conn + protocolType int + conn *websocket.Conn + handshakeTimeout time.Duration + readBufferSize, WriteBufferSize int } -func NewDefault(protocolType int) *GWebSocket { - return &GWebSocket{protocolType: protocolType} +func newGWebSocket(protocolType int, handshakeTimeout time.Duration, readBufferSize int) *GWebSocket { + return &GWebSocket{protocolType: protocolType, handshakeTimeout: handshakeTimeout, readBufferSize: readBufferSize} } + func (d *GWebSocket) Close() error { return d.conn.Close() } +func (d *GWebSocket) GenerateLongConn(w http.ResponseWriter, r *http.Request) error { + upgrader := &websocket.Upgrader{ + HandshakeTimeout: d.handshakeTimeout, + ReadBufferSize: d.readBufferSize, + CheckOrigin: func(r *http.Request) bool { return true }, + } + conn, err := upgrader.Upgrade(w, r, nil) + if err != nil { + return err + } + d.conn = conn + return nil +} func (d *GWebSocket) WriteMessage(messageType int, message []byte) error { d.setSendConn(d.conn) return d.conn.WriteMessage(messageType, message) diff --git a/internal/msggateway/new/message_handler.go b/internal/msggateway/new/message_handler.go index e9285c5d3..52e36414d 100644 --- a/internal/msggateway/new/message_handler.go +++ b/internal/msggateway/new/message_handler.go @@ -1,6 +1,9 @@ package new -import "context" +import ( + "Open_IM/internal/common/check" + "context" +) type Req struct { ReqIdentifier int32 `json:"reqIdentifier" validate:"required"` @@ -30,6 +33,11 @@ type MessageHandler interface { var _ MessageHandler = (*GrpcHandler)(nil) type GrpcHandler struct { + msg *check.MsgCheck +} + +func NewGrpcHandler(msg *check.MsgCheck) *GrpcHandler { + return &GrpcHandler{msg: msg} } func (g GrpcHandler) GetSeq(context context.Context, data Req) ([]byte, error) { diff --git a/internal/msggateway/new/n_ws_server.go b/internal/msggateway/new/n_ws_server.go index 7f8f1b131..65ef48460 100644 --- a/internal/msggateway/new/n_ws_server.go +++ b/internal/msggateway/new/n_ws_server.go @@ -1,22 +1,24 @@ package new import ( - "bytes" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/utils" "errors" + "fmt" + "github.com/go-playground/validator/v10" "github.com/gorilla/websocket" "net/http" - "open_im_sdk/pkg/utils" "sync" "sync/atomic" "time" ) - var bufferPool = sync.Pool{ New: func() interface{} { return make([]byte, 1000) }, } + type LongConnServer interface { Run() error } @@ -28,17 +30,21 @@ type Server struct { 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 + port int + wsMaxConnNum int64 + wsUpGrader *websocket.Upgrader + registerChan chan *Client + unregisterChan chan *Client + clients *UserMap + clientPool sync.Pool + onlineUserNum int64 + onlineUserConnNum int64 + gzipCompressor Compressor + encoder Encoder + handler MessageHandler + handshakeTimeout time.Duration + readBufferSize, WriteBufferSize int + validate *validator.Validate } func newWsServer(opts ...Option) (*WsServer, error) { @@ -51,18 +57,18 @@ func newWsServer(opts ...Option) (*WsServer, error) { } 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 }, - }, + port: config.port, + wsMaxConnNum: config.maxConnNum, + handshakeTimeout: config.handshakeTimeout, + readBufferSize: config.messageMaxMsgLength, clientPool: sync.Pool{ New: func() interface{} { return new(Client) }, }, + validate: validator.New(), + clients: newUserMap(), + handler: NewGrpcHandler(), }, nil } func (ws *WsServer) Run() error { @@ -72,53 +78,115 @@ func (ws *WsServer) Run() error { select { case client = <-ws.registerChan: ws.registerClient(client) - case client = <-h.unregisterChan: - h.unregisterClient(client) - case msg = <-h.readChan: - h.messageHandler(msg) + case client = <-ws.unregisterChan: + ws.unregisterClient(client) } } }() + 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) registerClient(client *Client) { var ( - ok bool + userOK bool + clientOK bool cli *Client ) - - if cli, ok = h.clients.Get(client.key); ok == false { - h.clients.Set(client.key, client) - atomic.AddInt64(&h.onlineConnections, 1) - fmt.Println("R在线用户数量:", h.onlineConnections) - return + cli, userOK,clientOK = ws.clients.Get(client.userID,client.platformID) + if !userOK { + ws.clients.Set(client.userID,client) + atomic.AddInt64(&ws.onlineUserNum, 1) + atomic.AddInt64(&ws.onlineUserConnNum, 1) + fmt.Println("R在线用户数量:", ws.onlineUserNum) + fmt.Println("R在线用户连接数量:", ws.onlineUserConnNum) + }else{ + if clientOK {//已经有同平台的连接存在 + ws.clients.Set(client.userID,client) + ws.multiTerminalLoginChecker(cli) + }else{ + ws.clients.Set(client.userID,client) + atomic.AddInt64(&ws.onlineUserConnNum, 1) + fmt.Println("R在线用户数量:", ws.onlineUserNum) + fmt.Println("R在线用户连接数量:", ws.onlineUserConnNum) + } } - if client.onlineAt > cli.onlineAt { - h.clients.Set(client.key, client) - h.close(cli) - return - } - h.close(client) } - 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) multiTerminalLoginChecker(client *Client) { + +} +func (ws *WsServer) unregisterClient(client *Client) { + isDeleteUser:=ws.clients.delete(client.userID,client.platformID) + if isDeleteUser { + atomic.AddInt64(&ws.onlineUserNum, -1) + } + atomic.AddInt64(&ws.onlineUserConnNum, -1) + fmt.Println("R在线用户数量:", ws.onlineUserNum) + fmt.Println("R在线用户连接数量:", ws.onlineUserConnNum) +} + } 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 ") + if ws.onlineUserConnNum >= ws.wsMaxConnNum { + httpError(context, constant.ErrConnOverMaxNumLimit) + return } + var ( + token string + userID string + platformID string + exists bool + compression bool + compressor Compressor + + ) + + token, exists = context.Query(TOKEN) + if !exists { + httpError(context, constant.ErrConnArgsErr) + return + } + userID, exists = context.Query(USERID) + if !exists { + httpError(context, constant.ErrConnArgsErr) + return + } + platformID, exists = context.Query(PLATFORM_ID) + if !exists { + httpError(context, constant.ErrConnArgsErr) + return + } + err := tokenverify.WsVerifyToken(token, userID, platformID) + if err != nil { + httpError(context, err) + return + } + wsLongConn:=newGWebSocket(constant.WebSocket,ws.handshakeTimeout,ws.readBufferSize) + err = wsLongConn.GenerateLongConn(w, r) + if err != nil { + httpError(context, err) + return + } + compressProtoc, exists := context.Query(COMPRESSION) + if exists { + if compressProtoc==GZIP_COMPRESSION_PROTOCAL{ + compression = true + compressor = ws.gzipCompressor + } + } + compressProtoc, exists = context.GetHeader(COMPRESSION) + if exists { + if compressProtoc==GZIP_COMPRESSION_PROTOCAL { + compression = true + compressor = ws.gzipCompressor + } + } + client:=ws.clientPool.Get().(*Client) + client.ResetClient(context,wsLongConn,compression,compressor,ws.encoder,ws.handler,ws.unregisterChan,ws.validate) + ws.registerChan <- client + go client.readMessage() } diff --git a/internal/msggateway/new/options.go b/internal/msggateway/new/options.go index 71a732751..0fb575fc1 100644 --- a/internal/msggateway/new/options.go +++ b/internal/msggateway/new/options.go @@ -7,7 +7,7 @@ type configs struct { //长连接监听端口 port int //长连接允许最大链接数 - maxConnNum int + maxConnNum int64 //连接握手超时时间 handshakeTimeout time.Duration //允许消息最大长度 @@ -19,7 +19,7 @@ func WithPort(port int) Option { opt.port = port } } -func WithMaxConnNum(num int) Option { +func WithMaxConnNum(num int64) Option { return func(opt *configs) { opt.maxConnNum = num } diff --git a/internal/msggateway/new/user_map.go b/internal/msggateway/new/user_map.go index 82615e827..0f45aa018 100644 --- a/internal/msggateway/new/user_map.go +++ b/internal/msggateway/new/user_map.go @@ -9,24 +9,24 @@ type UserMap struct { func newUserMap() *UserMap { return &UserMap{} } -func (u *UserMap) GetAll(key string) []*Client { +func (u *UserMap) GetAll(key string) ([]*Client, bool) { allClients, ok := u.m.Load(key) if ok { - return allClients.([]*Client) + return allClients.([]*Client), ok } - return nil + return nil, ok } -func (u *UserMap) Get(key string, platformID int32) (*Client, bool) { - allClients, existed := u.m.Load(key) - if existed { +func (u *UserMap) Get(key string, platformID int) (*Client, bool, bool) { + allClients, userExisted := u.m.Load(key) + if userExisted { for _, client := range allClients.([]*Client) { - if client.PlatformID == platformID { - return client, existed + if client.platformID == platformID { + return client, userExisted, true } } - return nil, false + return nil, userExisted, false } - return nil, existed + return nil, userExisted, false } func (u *UserMap) Set(key string, v *Client) { allClients, existed := u.m.Load(key) @@ -40,24 +40,25 @@ func (u *UserMap) Set(key string, v *Client) { u.m.Store(key, clients) } } -func (u *UserMap) delete(key string, platformID int32) { +func (u *UserMap) delete(key string, platformID int) (isDeleteUser bool) { allClients, existed := u.m.Load(key) if existed { oldClients := allClients.([]*Client) - - a := make([]*Client, len(oldClients)) + a := make([]*Client, 3) for _, client := range oldClients { - if client.PlatformID != platformID { + if client.platformID != platformID { a = append(a, client) } } if len(a) == 0 { u.m.Delete(key) + return true } else { u.m.Store(key, a) - + return false } } + return existed } func (u *UserMap) DeleteAll(key string) { u.m.Delete(key) diff --git a/internal/msggateway/relay_rpc_server.go b/internal/msggateway/relay_rpc_server.go index 8a95c1292..6dbaf90a6 100644 --- a/internal/msggateway/relay_rpc_server.go +++ b/internal/msggateway/relay_rpc_server.go @@ -12,15 +12,13 @@ import ( "bytes" "context" "encoding/gob" + "github.com/golang/protobuf/proto" + "github.com/gorilla/websocket" + grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" + "google.golang.org/grpc" "net" "strconv" "strings" - - "github.com/golang/protobuf/proto" - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - - "github.com/gorilla/websocket" - "google.golang.org/grpc" ) type RPCServer struct { diff --git a/internal/msggateway/ws_server.go b/internal/msggateway/ws_server.go index 6e4630a5f..003a3b0e1 100644 --- a/internal/msggateway/ws_server.go +++ b/internal/msggateway/ws_server.go @@ -3,9 +3,8 @@ package msggateway import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" - prome "Open_IM/pkg/common/prometheus" + prome "Open_IM/pkg/common/prome" "Open_IM/pkg/common/tokenverify" pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" diff --git a/internal/objstorage/controller.go b/internal/objstorage/controller.go new file mode 100644 index 000000000..cb8ed08ae --- /dev/null +++ b/internal/objstorage/controller.go @@ -0,0 +1,235 @@ +package objstorage + +import ( + "bytes" + "context" + "crypto/md5" + "encoding/hex" + "encoding/json" + "fmt" + "log" + "math/rand" + "path" + "strconv" + "time" +) + +func NewController(i Interface, kv KV) (*Controller, error) { + if err := i.Init(); err != nil { + return nil, err + } + return &Controller{ + i: i, + kv: kv, + }, nil +} + +type Controller struct { + i Interface + //i *minioImpl + kv KV +} + +func (c *Controller) key(v string) string { + return "OBJECT_STORAGE:" + c.i.Name() + ":" + v +} + +func (c *Controller) putKey(v string) string { + return c.key("put:" + v) +} + +func (c *Controller) pathKey(v string) string { + return c.key("path:" + v) +} + +func (c *Controller) ApplyPut(ctx context.Context, args *FragmentPutArgs) (*PutAddr, error) { + if data, err := c.kv.Get(ctx, c.pathKey(args.Hash)); err == nil { + // 服务器已存在 + var src BucketFile + if err := json.Unmarshal([]byte(data), &src); err != nil { + return nil, err + } + var bucket string + if args.ClearTime <= 0 { + bucket = c.i.PermanentBucket() + } else { + bucket = c.i.ClearBucket() + } + dst := &BucketFile{ + Bucket: bucket, + Name: args.Name, + } + // 直接拷贝一份 + err := c.i.CopyObjetInfo(ctx, &src, dst) + if err == nil { + info, err := c.i.GetObjectInfo(ctx, dst) + if err != nil { + return nil, err + } + return &PutAddr{ + ResourceURL: info.URL, + }, nil + } else if !c.i.IsNotFound(err) { + return nil, err + } + } else if !c.kv.IsNotFound(err) { + return nil, err + } + // 上传逻辑 + name := args.Name + effective := time.Now().Add(args.EffectiveTime) + prefix := c.Prefix(&args.PutArgs) + if minSize := c.i.MinMultipartSize(); args.FragmentSize > 0 && args.FragmentSize < minSize { + args.FragmentSize = minSize + } + var pack int64 + if args.FragmentSize <= 0 || args.Size <= args.FragmentSize { + pack = 1 + } else { + pack = args.Size / args.FragmentSize + if args.Size%args.FragmentSize > 0 { + pack++ + } + } + p := path.Join(path.Dir(args.Name), time.Now().Format("20060102")) + info := putInfo{ + Bucket: c.i.UploadBucket(), + Fragments: make([]string, 0, pack), + FragmentSize: args.FragmentSize, + Name: name, + Hash: args.Hash, + Size: args.Size, + } + if args.ClearTime > 0 { + t := time.Now().Add(args.ClearTime).UnixMilli() + info.ClearTime = &t + } + putURLs := make([]string, 0, pack) + for i := int64(1); i <= pack; i++ { + name := prefix + "_" + strconv.FormatInt(i, 10) + path.Ext(args.Name) + name = path.Join(p, name) + info.Fragments = append(info.Fragments, name) + args.Name = name + put, err := c.i.ApplyPut(ctx, &ApplyPutArgs{ + Bucket: info.Bucket, + Name: name, + Effective: args.EffectiveTime, + Header: args.Header, + }) + if err != nil { + return nil, err + } + putURLs = append(putURLs, put.URL) + } + data, err := json.Marshal(&info) + if err != nil { + return nil, err + } + if err := c.kv.Set(ctx, c.putKey(prefix), string(data), args.EffectiveTime); err != nil { + return nil, err + } + var fragmentSize int64 + if pack == 1 { + fragmentSize = args.Size + } else { + fragmentSize = args.FragmentSize + } + return &PutAddr{ + PutURLs: putURLs, + FragmentSize: fragmentSize, + PutID: prefix, + EffectiveTime: effective, + }, nil +} + +func (c *Controller) ConfirmPut(ctx context.Context, putID string) (*ObjectInfo, error) { + data, err := c.kv.Get(ctx, c.putKey(putID)) + if err != nil { + return nil, err + } + var info putInfo + if err := json.Unmarshal([]byte(data), &info); err != nil { + return nil, err + } + var total int64 + src := make([]BucketFile, len(info.Fragments)) + for i, fragment := range info.Fragments { + state, err := c.i.GetObjectInfo(ctx, &BucketFile{ + Bucket: info.Bucket, + Name: fragment, + }) + if err != nil { + return nil, err + } + total += state.Size + src[i] = BucketFile{ + Bucket: info.Bucket, + Name: fragment, + } + } + if total != info.Size { + return nil, fmt.Errorf("incomplete upload %d/%d", total, info.Size) + } + var dst *BucketFile + if info.ClearTime == nil { + dst = &BucketFile{ + Bucket: c.i.PermanentBucket(), + Name: info.Name, + } + } else { + dst = &BucketFile{ + Bucket: c.i.ClearBucket(), + Name: info.Name, + } + } + if err := c.i.MergeObjectInfo(ctx, src, dst); err != nil { // SourceInfo 0 is too small (2) and it is not the last part + return nil, err + } + obj, err := c.i.GetObjectInfo(ctx, dst) + if err != nil { + return nil, err + } + go func() { + err := c.kv.Del(ctx, c.putKey(putID)) + if err != nil { + log.Println("del key:", err) + } + for _, b := range src { + err = c.i.DeleteObjetInfo(ctx, &b) + if err != nil { + log.Println("del obj:", err) + } + } + }() + return obj, nil +} + +func (c *Controller) Prefix(args *PutArgs) string { + buf := bytes.NewBuffer(nil) + buf.WriteString(args.Name) + buf.WriteString("~~~@~@~~~") + buf.WriteString(strconv.FormatInt(args.Size, 10)) + buf.WriteString(",") + buf.WriteString(args.Hash) + buf.WriteString(",") + buf.WriteString(strconv.FormatInt(int64(args.ClearTime), 10)) + buf.WriteString(",") + buf.WriteString(strconv.FormatInt(int64(args.EffectiveTime), 10)) + buf.WriteString(",") + buf.WriteString(c.i.Name()) + r := make([]byte, 16) + rand.Read(r) + buf.Write(r) + md5v := md5.Sum(buf.Bytes()) + return hex.EncodeToString(md5v[:]) +} + +type putInfo struct { + Bucket string + Fragments []string + FragmentSize int64 + Size int64 + Name string + Hash string + ClearTime *int64 +} diff --git a/internal/objstorage/kv.go b/internal/objstorage/kv.go new file mode 100644 index 000000000..75c4eafec --- /dev/null +++ b/internal/objstorage/kv.go @@ -0,0 +1,49 @@ +package objstorage + +import ( + "context" + "github.com/go-redis/redis/v8" + "log" + "time" +) + +type KV interface { + Get(ctx context.Context, key string) (string, error) + Set(ctx context.Context, key string, val string, expiration time.Duration) error + Del(ctx context.Context, key string) error + IsNotFound(err error) bool +} + +func NewKV() KV { + rdb := redis.NewClient(&redis.Options{ + Addr: "", + Username: "", + Password: "", + }) + return &redisImpl{ + rdb: rdb, + } +} + +type redisImpl struct { + rdb *redis.Client +} + +func (r *redisImpl) Del(ctx context.Context, key string) error { + log.Println("redis del", key) + return r.rdb.Del(ctx, key).Err() +} + +func (r *redisImpl) Get(ctx context.Context, key string) (string, error) { + log.Println("redis get", key) + return r.rdb.Get(ctx, key).Result() +} + +func (r *redisImpl) Set(ctx context.Context, key string, val string, expiration time.Duration) error { + log.Println("redis set", key, val, expiration.String()) + return r.rdb.Set(ctx, key, val, expiration).Err() +} + +func (r *redisImpl) IsNotFound(err error) bool { + return err == redis.Nil +} diff --git a/internal/objstorage/main.go b/internal/objstorage/main.go new file mode 100644 index 000000000..c6ba219e8 --- /dev/null +++ b/internal/objstorage/main.go @@ -0,0 +1,112 @@ +package objstorage + +import ( + "bytes" + "context" + "crypto/md5" + "encoding/hex" + "fmt" + "io" + "log" + "net/http" + "path" + "time" +) + +func HttpPut(url string, body io.Reader) error { + req, err := http.NewRequest(http.MethodPut, url, body) + if err != nil { + return err + } + client := http.Client{} + resp, err := client.Do(req) + if err != nil { + return err + } + data, err := io.ReadAll(resp.Body) + if err != nil { + return err + } + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("http [%s] %s", resp.Status, data) + } + if len(data) > 0 { + log.Println("[http body]", string(data)) + } + return nil +} + +func Md5(p []byte) string { + t := md5.Sum(p) + return hex.EncodeToString(t[:]) +} + +func Main() { + ctx := context.Background() + c, err := NewController(&minioImpl{}, NewKV()) + if err != nil { + log.Fatalln(err) + } + + name := "hello.txt" + data := []byte("hello world") + + userID := "10000" + + name = path.Join("user_"+userID, name) + + addr, err := c.ApplyPut(ctx, &FragmentPutArgs{ + PutArgs: PutArgs{ + Name: name, + Size: int64(len(data)), + Hash: Md5(data), + EffectiveTime: time.Second * 60 * 60, + }, + FragmentSize: 2, + }) + if err != nil { + log.Fatalln(err) + } + fmt.Println() + fmt.Println() + + if addr.ResourceURL != "" { + log.Println("服务器已经存在") + return + } + var ( + start int + end = int(addr.FragmentSize) + ) + + for _, u := range addr.PutURLs { + if start >= len(data) { + break + } + if end > len(data) { + end = len(data) + } + _ = u + page := data[start:end] + fmt.Print(string(page)) + start += int(addr.FragmentSize) + end += int(addr.FragmentSize) + err = HttpPut(u, bytes.NewReader(page)) + if err != nil { + log.Fatalln(err) + } + } + fmt.Println() + fmt.Println() + + fmt.Println("[PUT_ID]", addr.PutID) + + info, err := c.ConfirmPut(ctx, addr.PutID) + if err != nil { + log.Fatalln(err) + } + + log.Printf("%+v\n", info) + + log.Println("success") +} diff --git a/internal/objstorage/minio.go b/internal/objstorage/minio.go new file mode 100644 index 000000000..cbe6a699f --- /dev/null +++ b/internal/objstorage/minio.go @@ -0,0 +1,147 @@ +package objstorage + +import ( + "context" + "errors" + "fmt" + "github.com/minio/minio-go" + "net/url" + "time" +) + +func NewMinio() Interface { + return &minioImpl{} +} + +type minioImpl struct { + uploadBucket string // 上传桶 + permanentBucket string // 永久桶 + clearBucket string // 自动清理桶 + client *minio.Client +} + +func (m *minioImpl) Init() error { + client, err := minio.New("127.0.0.1:9000", "minioadmin", "minioadmin", false) + if err != nil { + return fmt.Errorf("minio client error: %w", err) + } + m.client = client + m.uploadBucket = "upload" + m.permanentBucket = "permanent" + m.clearBucket = "clear" + return nil +} + +func (m *minioImpl) Name() string { + return "minio" +} + +func (m *minioImpl) MinMultipartSize() int64 { + return 1024 * 1024 * 5 // minio.absMinPartSize +} + +func (m *minioImpl) UploadBucket() string { + return m.uploadBucket +} + +func (m *minioImpl) PermanentBucket() string { + return m.permanentBucket +} + +func (m *minioImpl) ClearBucket() string { + return m.clearBucket +} + +func (m *minioImpl) urlReplace(u *url.URL) { + +} + +func (m *minioImpl) ApplyPut(ctx context.Context, args *ApplyPutArgs) (*PutRes, error) { + if args.Effective <= 0 { + return nil, errors.New("EffectiveTime <= 0") + } + _, err := m.GetObjectInfo(ctx, &BucketFile{ + Bucket: m.uploadBucket, + Name: args.Name, + }) + if err == nil { + return nil, fmt.Errorf("minio bucket %s name %s already exists", args.Bucket, args.Name) + } else if !m.IsNotFound(err) { + return nil, err + } + effective := time.Now().Add(args.Effective) + u, err := m.client.PresignedPutObject(m.uploadBucket, args.Name, args.Effective) + if err != nil { + return nil, fmt.Errorf("minio apply error: %w", err) + } + m.urlReplace(u) + return &PutRes{ + URL: u.String(), + Bucket: m.uploadBucket, + Name: args.Name, + EffectiveTime: effective, + }, nil +} + +func (m *minioImpl) GetObjectInfo(ctx context.Context, args *BucketFile) (*ObjectInfo, error) { + info, err := m.client.StatObject(args.Bucket, args.Name, minio.StatObjectOptions{}) + if err != nil { + return nil, err + } + return &ObjectInfo{ + URL: "", // todo + Size: info.Size, + Hash: info.ETag, + }, nil +} + +func (m *minioImpl) CopyObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error { + destination, err := minio.NewDestinationInfo(dst.Bucket, dst.Name, nil, nil) + if err != nil { + return err + } + return m.client.CopyObject(destination, minio.NewSourceInfo(src.Bucket, src.Name, nil)) +} + +func (m *minioImpl) DeleteObjetInfo(ctx context.Context, info *BucketFile) error { + return m.client.RemoveObject(info.Bucket, info.Name) +} + +func (m *minioImpl) MoveObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error { + if err := m.CopyObjetInfo(ctx, src, dst); err != nil { + return err + } + return m.DeleteObjetInfo(ctx, src) +} + +func (m *minioImpl) MergeObjectInfo(ctx context.Context, src []BucketFile, dst *BucketFile) error { + switch len(src) { + case 0: + return errors.New("src empty") + case 1: + return m.CopyObjetInfo(ctx, &src[0], dst) + } + destination, err := minio.NewDestinationInfo(dst.Bucket, dst.Name, nil, nil) + if err != nil { + return err + } + sources := make([]minio.SourceInfo, len(src)) + for i, s := range src { + sources[i] = minio.NewSourceInfo(s.Bucket, s.Name, nil) + } + return m.client.ComposeObject(destination, sources) // todo +} + +func (m *minioImpl) IsNotFound(err error) bool { + if err == nil { + return false + } + switch e := err.(type) { + case minio.ErrorResponse: + return e.StatusCode == 404 && e.Code == "NoSuchKey" + case *minio.ErrorResponse: + return e.StatusCode == 404 && e.Code == "NoSuchKey" + default: + return false + } +} diff --git a/internal/objstorage/oo.go b/internal/objstorage/oo.go new file mode 100644 index 000000000..b9b365ccb --- /dev/null +++ b/internal/objstorage/oo.go @@ -0,0 +1,19 @@ +package objstorage + +import "context" + +type Interface interface { + Init() error + Name() string + MinMultipartSize() int64 + UploadBucket() string + PermanentBucket() string + ClearBucket() string + ApplyPut(ctx context.Context, args *ApplyPutArgs) (*PutRes, error) + GetObjectInfo(ctx context.Context, args *BucketFile) (*ObjectInfo, error) + CopyObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error + DeleteObjetInfo(ctx context.Context, info *BucketFile) error + MoveObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error + MergeObjectInfo(ctx context.Context, src []BucketFile, dst *BucketFile) error + IsNotFound(err error) bool +} diff --git a/internal/objstorage/pub.go b/internal/objstorage/pub.go new file mode 100644 index 000000000..b98dfc94d --- /dev/null +++ b/internal/objstorage/pub.go @@ -0,0 +1,69 @@ +package objstorage + +import ( + "net/http" + "time" +) + +type PutRes struct { + URL string + Bucket string + Name string + EffectiveTime time.Time +} + +type FragmentPutArgs struct { + PutArgs + FragmentSize int64 // 分片大小 +} + +type PutArgs struct { + Name string // 文件名 + Size int64 // 大小 + Hash string // md5 + Prefix string // 前缀 + ClearTime time.Duration // 自动清理时间 + EffectiveTime time.Duration // 申请有效时间 + Header http.Header // header +} + +type BucketFile struct { + Bucket string `json:"bucket"` + Name string `json:"name"` +} + +type ObjectInfo struct { + URL string + Size int64 + Hash string +} + +//type PutSpace struct { +// URL string +// EffectiveTime time.Time +//} + +type PutAddr struct { + ResourceURL string + PutID string + FragmentSize int64 + EffectiveTime time.Time + PutURLs []string +} + +type KVData struct { + Bucket string `json:"bucket"` + Name string `json:"name"` +} + +type PutResp struct { + URL string + Time *time.Time +} + +type ApplyPutArgs struct { + Bucket string + Name string + Effective time.Duration // 申请有效时间 + Header http.Header // header +} diff --git a/internal/push/tpns.go b/internal/push/tpns.go index 0c0b5c422..de8665781 100644 --- a/internal/push/tpns.go +++ b/internal/push/tpns.go @@ -1,10 +1,7 @@ package push import ( - tpns "Open_IM/internal/push/sdk/tpns-server-sdk-go/go" "Open_IM/internal/push/sdk/tpns-server-sdk-go/go/auth" - "Open_IM/internal/push/sdk/tpns-server-sdk-go/go/common" - "Open_IM/internal/push/sdk/tpns-server-sdk-go/go/req" "Open_IM/pkg/common/config" ) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 5478df36f..0441dc5ed 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -2,137 +2,54 @@ package conversation import ( "Open_IM/internal/common/check" - chat "Open_IM/internal/rpc/msg" + "Open_IM/internal/common/notification" + "Open_IM/internal/tx" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "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" - "Open_IM/pkg/common/prome" pbConversation "Open_IM/pkg/proto/conversation" - pbUser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" + "github.com/OpenIMSDK/openKeeper" "github.com/dtm-labs/rockscache" - "net" - "strconv" - "strings" - - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - - "Open_IM/pkg/common/config" - "google.golang.org/grpc" ) type conversationServer struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string - groupChecker *check.GroupChecker - controller.ConversationInterface + groupChecker *check.GroupChecker + controller.ConversationDataBaseInterface + notify *notification.Check } -func NewConversationServer(port int) *conversationServer { - log.NewPrivateLog(constant.LogFileName) - c := conversationServer{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImConversationName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - groupChecker: check.NewGroupChecker(), - } - var cDB relation.Conversation - var cCache cache.ConversationCache - //mysql init - var mysql relation.Mysql - err := mysql.InitConn().AutoMigrateModel(&tableRelation.ConversationModel{}) +func Start(client *openKeeper.ZkClient, server *grpc.Server) error { + db, err := relation.NewGormDB() if err != nil { - panic("db init err:" + err.Error()) + return err } - if mysql.GormConn() != nil { - //get gorm model - cDB = relation.NewConversationGorm(mysql.GormConn()) - } else { - panic("db init err:" + "conn is nil") + if err := db.AutoMigrate(&tableRelation.ConversationModel{}); err != nil { + return err } - //redis init - var redis cache.RedisClient - redis.InitRedis() - rcClient := rockscache.NewClient(redis.GetClient(), rockscache.Options{ - RandomExpireAdjustment: 0.2, - DisableCacheRead: false, - DisableCacheDelete: false, - StrongConsistency: true, + redis, err := cache.NewRedis() + if err != nil { + return err + } + pbConversation.RegisterConversationServer(server, &conversationServer{ + groupChecker: check.NewGroupChecker(client), + ConversationDataBaseInterface: controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(redis.GetClient(), rockscache.Options{ + RandomExpireAdjustment: 0.2, + DisableCacheRead: false, + DisableCacheDelete: false, + StrongConsistency: true, + }), tx.NewGorm(db)), }) - cCache = cache.NewConversationRedis(rcClient) - - database := controller.NewConversationDataBase(cDB, cCache) - c.ConversationInterface = controller.NewConversationController(database) - return &c -} - -func (c *conversationServer) Run() { - log.NewInfo("0", "rpc conversation start...") - - listenIP := "" - if config.Config.ListenIP == "" { - listenIP = "0.0.0.0" - } else { - listenIP = config.Config.ListenIP - } - address := listenIP + ":" + strconv.Itoa(c.rpcPort) - - listener, err := net.Listen("tcp", address) - if err != nil { - panic("listening err:" + err.Error() + c.rpcRegisterName) - } - log.NewInfo("0", "listen network success, ", address, listener) - //grpc server - var grpcOpts []grpc.ServerOption - if config.Config.Prometheus.Enable { - promePkg.NewGrpcRequestCounter() - promePkg.NewGrpcRequestFailedCounter() - promePkg.NewGrpcRequestSuccessCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - - //service registers with etcd - pbConversation.RegisterConversationServer(srv, c) - rpcRegisterIP := config.Config.RpcRegisterIP - if config.Config.RpcRegisterIP == "" { - rpcRegisterIP, err = utils.GetLocalIP() - if err != nil { - log.Error("", "GetLocalIP failed ", err.Error()) - } - } - log.NewInfo("", "rpcRegisterIP", rpcRegisterIP) - err = rpc.RegisterEtcd(c.etcdSchema, strings.Join(c.etcdAddr, ","), rpcRegisterIP, c.rpcPort, c.rpcRegisterName, 10, "") - if err != nil { - log.NewError("0", "RegisterEtcd failed ", err.Error(), - c.etcdSchema, strings.Join(c.etcdAddr, ","), rpcRegisterIP, c.rpcPort, c.rpcRegisterName) - panic(utils.Wrap(err, "register conversation module rpc to etcd err")) - } - log.NewInfo("0", "RegisterConversationServer ok ", c.etcdSchema, strings.Join(c.etcdAddr, ","), rpcRegisterIP, c.rpcPort, c.rpcRegisterName) - err = srv.Serve(listener) - if err != nil { - log.NewError("0", "Serve failed ", err.Error()) - return - } - log.NewInfo("0", "rpc conversation ok") + return nil } func (c *conversationServer) GetConversation(ctx context.Context, req *pbConversation.GetConversationReq) (*pbConversation.GetConversationResp, error) { resp := &pbConversation.GetConversationResp{Conversation: &pbConversation.Conversation{}} - conversations, err := c.ConversationInterface.FindConversations(ctx, req.OwnerUserID, []string{req.ConversationID}) + conversations, err := c.ConversationDataBaseInterface.FindConversations(ctx, req.OwnerUserID, []string{req.ConversationID}) if err != nil { return nil, err } @@ -147,7 +64,7 @@ func (c *conversationServer) GetConversation(ctx context.Context, req *pbConvers func (c *conversationServer) GetAllConversations(ctx context.Context, req *pbConversation.GetAllConversationsReq) (*pbConversation.GetAllConversationsResp, error) { resp := &pbConversation.GetAllConversationsResp{Conversations: []*pbConversation.Conversation{}} - conversations, err := c.ConversationInterface.GetUserAllConversation(ctx, req.OwnerUserID) + conversations, err := c.ConversationDataBaseInterface.GetUserAllConversation(ctx, req.OwnerUserID) if err != nil { return nil, err } @@ -159,7 +76,7 @@ func (c *conversationServer) GetAllConversations(ctx context.Context, req *pbCon func (c *conversationServer) GetConversations(ctx context.Context, req *pbConversation.GetConversationsReq) (*pbConversation.GetConversationsResp, error) { resp := &pbConversation.GetConversationsResp{Conversations: []*pbConversation.Conversation{}} - conversations, err := c.ConversationInterface.FindConversations(ctx, req.OwnerUserID, req.ConversationIDs) + conversations, err := c.ConversationDataBaseInterface.FindConversations(ctx, req.OwnerUserID, req.ConversationIDs) if err != nil { return nil, err } @@ -175,11 +92,11 @@ func (c *conversationServer) BatchSetConversations(ctx context.Context, req *pbC if err := utils.CopyStructFields(&conversations, req.Conversations); err != nil { return nil, err } - err := c.ConversationInterface.SetUserConversations(ctx, req.OwnerUserID, conversations) + err := c.ConversationDataBaseInterface.SetUserConversations(ctx, req.OwnerUserID, conversations) if err != nil { return nil, err } - chat.ConversationChangeNotification(ctx, req.OwnerUserID) + c.notify.ConversationChangeNotification(ctx, req.OwnerUserID) return resp, nil } @@ -196,7 +113,7 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p var err error isSyncConversation := true if req.Conversation.ConversationType == constant.GroupChatType { - groupInfo, err := c.groupChecker.GetGroupInfo(req.Conversation.GroupID) + groupInfo, err := c.groupChecker.GetGroupInfo(ctx, req.Conversation.GroupID) if err != nil { return nil, err } @@ -209,14 +126,14 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p return nil, err } if req.FieldType == constant.FieldIsPrivateChat { - err := c.ConversationInterface.SyncPeerUserPrivateConversationTx(ctx, &conversation) + err := c.ConversationDataBaseInterface.SyncPeerUserPrivateConversationTx(ctx, &conversation) if err != nil { return nil, err } - chat.ConversationSetPrivateNotification(ctx, req.Conversation.OwnerUserID, req.Conversation.UserID, req.Conversation.IsPrivateChat) + c.notify.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) + //haveUserID, err := c.ConversationDataBaseInterface.GetUserIDExistConversation(ctx, req.UserIDList, req.Conversation.ConversationID) //if err != nil { // return nil, err //} @@ -240,18 +157,18 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p case constant.FieldBurnDuration: filedMap["burn_duration"] = req.Conversation.BurnDuration } - err = c.ConversationInterface.SetUsersConversationFiledTx(ctx, req.UserIDList, &conversation, filedMap) + err = c.ConversationDataBaseInterface.SetUsersConversationFiledTx(ctx, req.UserIDList, &conversation, filedMap) if err != nil { return nil, err } if isSyncConversation { for _, v := range req.UserIDList { - chat.ConversationChangeNotification(ctx, v) + c.notify.ConversationChangeNotification(ctx, v) } } else { for _, v := range req.UserIDList { - chat.ConversationUnreadChangeNotification(ctx, v, req.Conversation.ConversationID, req.Conversation.UpdateUnreadCountTime) + c.notify.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 8b01b7fbd..0c832ad5e 100644 --- a/internal/rpc/friend/black.go +++ b/internal/rpc/friend/black.go @@ -14,7 +14,7 @@ func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *pbFriend.Ge 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) + blacks, total, err := s.BlackDatabase.FindOwnerBlacks(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -28,7 +28,7 @@ func (s *friendServer) GetPaginationBlacks(ctx context.Context, req *pbFriend.Ge func (s *friendServer) IsBlack(ctx context.Context, req *pbFriend.IsBlackReq) (*pbFriend.IsBlackResp, error) { resp := &pbFriend.IsBlackResp{} - in1, in2, err := s.BlackInterface.CheckIn(ctx, req.UserID1, req.UserID2) + in1, in2, err := s.BlackDatabase.CheckIn(ctx, req.UserID1, req.UserID2) if err != nil { return nil, err } @@ -42,7 +42,7 @@ func (s *friendServer) RemoveBlack(ctx context.Context, req *pbFriend.RemoveBlac 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 { + if err := s.BlackDatabase.Delete(ctx, []*relation.BlackModel{{OwnerUserID: req.OwnerUserID, BlockUserID: req.BlackUserID}}); err != nil { return nil, err } s.notification.BlackDeletedNotification(ctx, req) @@ -55,7 +55,7 @@ func (s *friendServer) AddBlack(ctx context.Context, req *pbFriend.AddBlackReq) return nil, err } black := relation.BlackModel{OwnerUserID: req.OwnerUserID, BlockUserID: req.BlackUserID, OperatorUserID: tracelog.GetOpUserID(ctx)} - if err := s.BlackInterface.Create(ctx, []*relation.BlackModel{&black}); err != nil { + if err := s.BlackDatabase.Create(ctx, []*relation.BlackModel{&black}); err != nil { return nil, err } s.notification.BlackAddedNotification(ctx, req) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index b0ad94ece..3767dd076 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -4,13 +4,14 @@ import ( "Open_IM/internal/common/check" "Open_IM/internal/common/convert" "Open_IM/internal/common/notification" + "Open_IM/internal/tx" "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" + tablerelation "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/common/tracelog" - discoveryRegistry "Open_IM/pkg/discoveryregistry" + registry "Open_IM/pkg/discoveryregistry" pbfriend "Open_IM/pkg/proto/friend" "Open_IM/pkg/utils" "context" @@ -19,27 +20,27 @@ import ( ) type friendServer struct { - controller.FriendInterface - controller.BlackInterface + controller.FriendDatabase + controller.BlackDatabase notification *notification.Check userCheck *check.UserCheck - RegisterCenter discoveryRegistry.SvcDiscoveryRegistry + RegisterCenter registry.SvcDiscoveryRegistry } func Start(client *openKeeper.ZkClient, server *grpc.Server) error { - mysql, err := relation.NewGormDB() + db, err := relation.NewGormDB() if err != nil { return err } - if err := mysql.AutoMigrate(&relationTb.FriendModel{}, &relationTb.FriendRequestModel{}, &relationTb.BlackModel{}); err != nil { + if err := db.AutoMigrate(&tablerelation.FriendModel{}, &tablerelation.FriendRequestModel{}, &tablerelation.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, + FriendDatabase: controller.NewFriendDatabase(relation.NewFriendGorm(db), relation.NewFriendRequestGorm(db), tx.NewGorm(db)), + BlackDatabase: controller.NewBlackDatabase(relation.NewBlackGorm(db)), + notification: notification.NewCheck(client), + userCheck: check.NewUserCheck(client), + RegisterCenter: client, }) return nil } @@ -59,14 +60,14 @@ func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.Apply 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) + in1, in2, err := s.FriendDatabase.CheckIn(ctx, req.FromUserID, req.ToUserID) if err != nil { return nil, err } if in1 && in2 { return nil, constant.ErrRelationshipAlready.Wrap() } - if err = s.FriendInterface.AddFriendRequest(ctx, req.FromUserID, req.ToUserID, req.ReqMsg, req.Ex); err != nil { + if err = s.FriendDatabase.AddFriendRequest(ctx, req.FromUserID, req.ToUserID, req.ReqMsg, req.Ex); err != nil { return nil, err } s.notification.FriendApplicationAddNotification(ctx, req) @@ -90,7 +91,7 @@ func (s *friendServer) ImportFriends(ctx context.Context, req *pbfriend.ImportFr return nil, constant.ErrArgs.Wrap("friend userID repeated") } - if err := s.FriendInterface.BecomeFriends(ctx, req.OwnerUserID, req.FriendUserIDs, constant.BecomeFriendByImport, tracelog.GetOpUserID(ctx)); err != nil { + if err := s.FriendDatabase.BecomeFriends(ctx, req.OwnerUserID, req.FriendUserIDs, constant.BecomeFriendByImport, tracelog.GetOpUserID(ctx)); err != nil { return nil, err } return resp, nil @@ -102,7 +103,7 @@ func (s *friendServer) RespondFriendApply(ctx context.Context, req *pbfriend.Res 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} + friendRequest := tablerelation.FriendRequestModel{FromUserID: req.FromUserID, ToUserID: req.ToUserID, HandleMsg: req.HandleMsg, HandleResult: req.HandleResult} if req.HandleResult == constant.FriendResponseAgree { err := s.AgreeFriendRequest(ctx, &friendRequest) if err != nil { @@ -132,7 +133,7 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbfriend.DeleteFri if err != nil { return nil, err } - if err := s.FriendInterface.Delete(ctx, req.OwnerUserID, []string{req.FriendUserID}); err != nil { + if err := s.FriendDatabase.Delete(ctx, req.OwnerUserID, []string{req.FriendUserID}); err != nil { return nil, err } s.notification.FriendDeletedNotification(ctx, req) @@ -149,7 +150,7 @@ func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbfriend.SetFri if err != nil { return nil, err } - if err := s.FriendInterface.UpdateRemark(ctx, req.OwnerUserID, req.FriendUserID, req.Remark); err != nil { + if err := s.FriendDatabase.UpdateRemark(ctx, req.OwnerUserID, req.FriendUserID, req.Remark); err != nil { return nil, err } s.notification.FriendRemarkSetNotification(ctx, req.OwnerUserID, req.FriendUserID) @@ -158,20 +159,21 @@ func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbfriend.SetFri // ok 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 + + if utils.Duplicate(req.FriendUserIDs) { + return nil, constant.ErrArgs.Wrap("friend userID repeated") } - friends, total, err := s.FriendInterface.PageOwnerFriends(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) + friends, err := s.FriendDatabase.FindFriendsWithError(ctx, req.OwnerUserID, req.FriendUserIDs) if err != nil { return nil, err } - resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends) - if err != nil { + if resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends); err != nil { return nil, err } - resp.Total = int32(total) return resp, nil + } // ok 获取接收到的好友申请(即别人主动申请的) @@ -180,7 +182,7 @@ func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbf 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) + friendRequests, total, err := s.FriendDatabase.PageFriendRequestToMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -198,7 +200,7 @@ func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *p 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) + friendRequests, total, err := s.FriendDatabase.PageFriendRequestFromMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -213,7 +215,7 @@ 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{} - resp.InUser1Friends, resp.InUser2Friends, err = s.FriendInterface.CheckIn(ctx, req.UserID1, req.UserID2) + resp.InUser1Friends, resp.InUser2Friends, err = s.FriendDatabase.CheckIn(ctx, req.UserID1, req.UserID2) if err != nil { return nil, err } @@ -223,15 +225,17 @@ 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{} - if utils.Duplicate(req.FriendUserIDs) { - return nil, constant.ErrArgs.Wrap("friend userID repeated") + if err := s.userCheck.Access(ctx, req.UserID); err != nil { + return nil, err } - friends, err := s.FriendInterface.FindFriendsWithError(ctx, req.OwnerUserID, req.FriendUserIDs) + friends, total, err := s.FriendDatabase.PageOwnerFriends(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } - if resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends); err != nil { + resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends) + if err != nil { return nil, err } + resp.Total = int32(total) return resp, nil } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index dfa58f7ef..17eb81180 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -3,6 +3,7 @@ package group import ( "Open_IM/internal/common/check" "Open_IM/internal/common/notification" + "Open_IM/internal/tx" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/controller" @@ -44,7 +45,15 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error { return err } pbGroup.RegisterGroupServer(server, &groupServer{ - GroupInterface: controller.NewGroupInterface(controller.NewGroupDatabase(db, redis.GetClient(), mongo.GetClient())), + GroupDatabase: controller.NewGroupDatabase( + relation.NewGroupDB(db), + relation.NewGroupMemberDB(db), + relation.NewGroupRequest(db), + tx.NewGorm(db), + tx.NewMongo(mongo.GetClient()), + unrelation.NewSuperGroupMongoDriver(mongo.GetClient()), + redis.GetClient(), + ), UserCheck: check.NewUserCheck(client), ConversationChecker: check.NewConversationChecker(client), }) @@ -52,7 +61,7 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error { } type groupServer struct { - GroupInterface controller.GroupInterface + GroupDatabase controller.GroupDatabase UserCheck *check.UserCheck Notification *notification.Check ConversationChecker *check.ConversationChecker @@ -60,7 +69,7 @@ type groupServer struct { func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error { if !tokenverify.IsAppManagerUid(ctx) { - groupMember, err := s.GroupInterface.TakeGroupMember(ctx, groupID, tracelog.GetOpUserID(ctx)) + groupMember, err := s.GroupDatabase.TakeGroupMember(ctx, groupID, tracelog.GetOpUserID(ctx)) if err != nil { return err } @@ -90,7 +99,7 @@ func (s *groupServer) IsNotFound(err error) bool { func (s *groupServer) GenGroupID(ctx context.Context, groupID *string) error { if *groupID != "" { - _, err := s.GroupInterface.TakeGroup(ctx, *groupID) + _, err := s.GroupDatabase.TakeGroup(ctx, *groupID) if err == nil { return constant.ErrGroupIDExisted.Wrap("group id existed " + *groupID) } else if s.IsNotFound(err) { @@ -104,7 +113,7 @@ func (s *groupServer) GenGroupID(ctx context.Context, groupID *string) error { bi := big.NewInt(0) bi.SetString(id[0:8], 16) id = bi.String() - _, err := s.GroupInterface.TakeGroup(ctx, id) + _, err := s.GroupDatabase.TakeGroup(ctx, id) if err == nil { continue } else if s.IsNotFound(err) { @@ -159,7 +168,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR return nil, err } if req.GroupInfo.GroupType == constant.SuperGroup { - if err := s.GroupInterface.CreateSuperGroup(ctx, group.GroupID, userIDs); err != nil { + if err := s.GroupDatabase.CreateSuperGroup(ctx, group.GroupID, userIDs); err != nil { return nil, err } } else { @@ -174,7 +183,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR } } } - if err := s.GroupInterface.CreateGroup(ctx, []*relationTb.GroupModel{group}, groupMembers); err != nil { + if err := s.GroupDatabase.CreateGroup(ctx, []*relationTb.GroupModel{group}, groupMembers); err != nil { return nil, err } resp.GroupInfo = DbToPbGroupInfo(group, req.OwnerUserID, uint32(len(userIDs))) @@ -196,7 +205,7 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo if err := tokenverify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err } - total, members, err := s.GroupInterface.PageGroupMember(ctx, nil, []string{req.FromUserID}, nil, req.Pagination.PageNumber, req.Pagination.ShowNumber) + total, members, err := s.GroupDatabase.PageGroupMember(ctx, nil, []string{req.FromUserID}, nil, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -207,15 +216,15 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo groupIDs := utils.Slice(members, func(e *relationTb.GroupMemberModel) string { return e.GroupID }) - groups, err := s.GroupInterface.FindGroup(ctx, groupIDs) + groups, err := s.GroupDatabase.FindGroup(ctx, groupIDs) if err != nil { return nil, err } - groupMemberNum, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs) + groupMemberNum, err := s.GroupDatabase.MapGroupMemberNum(ctx, groupIDs) if err != nil { return nil, err } - owners, err := s.GroupInterface.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) + owners, err := s.GroupDatabase.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } @@ -238,14 +247,14 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite if utils.Duplicate(req.InvitedUserIDs) { return nil, constant.ErrArgs.Wrap("userID duplicate") } - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } if group.Status == constant.GroupStatusDismissed { return nil, constant.ErrDismissedAlready.Wrap() } - members, err := s.GroupInterface.FindGroupMember(ctx, []string{group.GroupID}, nil, nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{group.GroupID}, nil, nil) if err != nil { return nil, err } @@ -276,7 +285,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite InviterUserID: opUserID, }) } - if err := s.GroupInterface.CreateGroupRequest(ctx, requests); err != nil { + if err := s.GroupDatabase.CreateGroupRequest(ctx, requests); err != nil { return nil, err } for _, request := range requests { @@ -292,7 +301,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } } if group.GroupType == constant.SuperGroup { - if err := s.GroupInterface.CreateSuperGroupMember(ctx, req.GroupID, req.InvitedUserIDs); err != nil { + if err := s.GroupDatabase.CreateSuperGroupMember(ctx, req.GroupID, req.InvitedUserIDs); err != nil { return nil, err } for _, userID := range req.InvitedUserIDs { @@ -314,7 +323,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } groupMembers = append(groupMembers, member) } - if err := s.GroupInterface.CreateGroup(ctx, nil, groupMembers); err != nil { + if err := s.GroupDatabase.CreateGroup(ctx, nil, groupMembers); err != nil { return nil, err } s.Notification.MemberInvitedNotification(ctx, req.GroupID, req.Reason, req.InvitedUserIDs) @@ -324,14 +333,14 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) { resp := &pbGroup.GetGroupAllMemberResp{} - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } if group.GroupType == constant.SuperGroup { return nil, constant.ErrArgs.Wrap("unsupported super group") } - members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.GroupID}, nil, nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.GroupID}, nil, nil) if err != nil { return nil, err } @@ -352,7 +361,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) { resp := &pbGroup.GetGroupMemberListResp{} - total, members, err := s.GroupInterface.PageGroupMember(ctx, []string{req.GroupID}, nil, utils.If(req.Filter >= 0, []int32{req.Filter}, nil), req.Pagination.PageNumber, req.Pagination.ShowNumber) + total, members, err := s.GroupDatabase.PageGroupMember(ctx, []string{req.GroupID}, nil, utils.If(req.Filter >= 0, []int32{req.Filter}, nil), req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -374,7 +383,7 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) { resp := &pbGroup.KickGroupMemberResp{} - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } @@ -389,7 +398,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou return nil, constant.ErrArgs.Wrap("opUserID in KickedUserIDs") } if group.GroupType == constant.SuperGroup { - if err := s.GroupInterface.DeleteSuperGroupMember(ctx, req.GroupID, req.KickedUserIDs); err != nil { + if err := s.GroupDatabase.DeleteSuperGroupMember(ctx, req.GroupID, req.KickedUserIDs); err != nil { return nil, err } go func() { @@ -398,7 +407,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } }() } else { - members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.GroupID}, append(req.KickedUserIDs, opUserID), nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.GroupID}, append(req.KickedUserIDs, opUserID), nil) if err != nil { return nil, err } @@ -431,7 +440,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou return nil, constant.ErrNoPermission.Wrap("opUserID is OrdinaryUser") } } - if err := s.GroupInterface.DeleteGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil { + if err := s.GroupDatabase.DeleteGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil { return nil, err } s.Notification.MemberKickedNotification(ctx, req, req.KickedUserIDs) @@ -447,7 +456,7 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG if req.GroupID == "" { return nil, constant.ErrArgs.Wrap("groupID empty") } - members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.GroupID}, req.Members, nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.GroupID}, req.Members, nil) if err != nil { return nil, err } @@ -468,7 +477,7 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) { resp := &pbGroup.GetGroupApplicationListResp{} - total, groupRequests, err := s.GroupInterface.PageGroupRequestUser(ctx, req.FromUserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) + total, groupRequests, err := s.GroupDatabase.PageGroupRequestUser(ctx, req.FromUserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -490,7 +499,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. if err != nil { return nil, err } - groups, err := s.GroupInterface.FindGroup(ctx, utils.Distinct(groupIDs)) + groups, err := s.GroupDatabase.FindGroup(ctx, utils.Distinct(groupIDs)) if err != nil { return nil, err } @@ -500,11 +509,11 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. if ids := utils.Single(utils.Keys(groupMap), groupIDs); len(ids) > 0 { return nil, constant.ErrGroupIDNotFound.Wrap(strings.Join(ids, ",")) } - groupMemberNumMap, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs) + groupMemberNumMap, err := s.GroupDatabase.MapGroupMemberNum(ctx, groupIDs) if err != nil { return nil, err } - owners, err := s.GroupInterface.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) + owners, err := s.GroupDatabase.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } @@ -522,15 +531,15 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI if len(req.GroupIDs) == 0 { return nil, constant.ErrArgs.Wrap("groupID is empty") } - groups, err := s.GroupInterface.FindGroup(ctx, req.GroupIDs) + groups, err := s.GroupDatabase.FindGroup(ctx, req.GroupIDs) if err != nil { return nil, err } - groupMemberNumMap, err := s.GroupInterface.MapGroupMemberNum(ctx, req.GroupIDs) + groupMemberNumMap, err := s.GroupDatabase.MapGroupMemberNum(ctx, req.GroupIDs) if err != nil { return nil, err } - owners, err := s.GroupInterface.FindGroupMember(ctx, req.GroupIDs, nil, []int32{constant.GroupOwner}) + owners, err := s.GroupDatabase.FindGroupMember(ctx, req.GroupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } @@ -538,7 +547,7 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI return e.GroupID }) resp.GroupInfos = utils.Slice(groups, func(e *relationTb.GroupModel) *sdkws.GroupInfo { - return DbToPbGroupInfo(e, ownerMap[e.GroupID].UserID, uint32(groupMemberNumMap[e.GroupID])) + return DbToPbGroupInfo(e, ownerMap[e.GroupID].UserID, groupMemberNumMap[e.GroupID]) }) return resp, nil } @@ -549,7 +558,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup return nil, constant.ErrArgs.Wrap("HandleResult unknown") } if !tokenverify.IsAppManagerUid(ctx) { - groupMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.FromUserID) + groupMember, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, req.FromUserID) if err != nil { return nil, err } @@ -557,11 +566,11 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup return nil, constant.ErrNoPermission.Wrap("no group owner or admin") } } - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } - groupRequest, err := s.GroupInterface.TakeGroupRequest(ctx, req.GroupID, req.FromUserID) + groupRequest, err := s.GroupDatabase.TakeGroupRequest(ctx, req.GroupID, req.FromUserID) if err != nil { return nil, err } @@ -569,7 +578,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup return nil, constant.ErrArgs.Wrap("group request already processed") } var join bool - if _, err = s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.FromUserID); err == nil { + if _, err = s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, req.FromUserID); err == nil { join = true // 已经在群里了 } else if !s.IsNotFound(err) { return nil, err @@ -596,7 +605,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup return nil, err } } - if err := s.GroupInterface.HandlerGroupRequest(ctx, req.GroupID, req.FromUserID, req.HandledMsg, req.HandleResult, member); err != nil { + if err := s.GroupDatabase.HandlerGroupRequest(ctx, req.GroupID, req.FromUserID, req.HandledMsg, req.HandleResult, member); err != nil { return nil, err } if !join { @@ -615,7 +624,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) if _, err := s.UserCheck.GetPublicUserInfo(ctx, tracelog.GetOpUserID(ctx)); err != nil { return nil, err } - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } @@ -626,7 +635,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) if group.GroupType == constant.SuperGroup { return nil, constant.ErrGroupTypeNotSupport.Wrap() } - user, err := relation.GetUserByUserID(tracelog.GetOpUserID(ctx)) + user, err := s.UserCheck.GetUsersInfo(ctx, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -639,7 +648,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) if err := CallbackBeforeMemberJoinGroup(ctx, groupMember, group.Ex); err != nil { return nil, err } - if err := s.GroupInterface.CreateGroup(ctx, nil, []*relationTb.GroupMemberModel{groupMember}); err != nil { + if err := s.GroupDatabase.CreateGroup(ctx, nil, []*relationTb.GroupMemberModel{groupMember}); err != nil { return nil, err } s.Notification.MemberEnterDirectlyNotification(ctx, req.GroupID, tracelog.GetOpUserID(ctx), tracelog.GetOperationID(ctx)) @@ -652,7 +661,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) JoinSource: req.JoinSource, ReqTime: time.Now(), } - if err := s.GroupInterface.CreateGroupRequest(ctx, []*relationTb.GroupRequestModel{&groupRequest}); err != nil { + if err := s.GroupDatabase.CreateGroupRequest(ctx, []*relationTb.GroupRequestModel{&groupRequest}); err != nil { return nil, err } s.Notification.JoinGroupApplicationNotification(ctx, req) @@ -661,17 +670,17 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.QuitGroupResp, error) { resp := &pbGroup.QuitGroupResp{} - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } if group.GroupType == constant.SuperGroup { - if err := s.GroupInterface.DeleteSuperGroupMember(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil { + if err := s.GroupDatabase.DeleteSuperGroupMember(ctx, req.GroupID, []string{tracelog.GetOpUserID(ctx)}); err != nil { return nil, err } s.Notification.SuperGroupNotification(ctx, tracelog.GetOpUserID(ctx), tracelog.GetOpUserID(ctx)) } else { - _, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) + _, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -683,7 +692,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.SetGroupInfoResp, error) { resp := &pbGroup.SetGroupInfoResp{} if !tokenverify.IsAppManagerUid(ctx) { - groupMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupInfoForSet.GroupID, tracelog.GetOpUserID(ctx)) + groupMember, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupInfoForSet.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -691,14 +700,14 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf return nil, constant.ErrNoPermission.Wrap("no group owner or admin") } } - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupInfoForSet.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupInfoForSet.GroupID) if err != nil { return nil, err } if group.Status == constant.GroupStatusDismissed { return nil, utils.Wrap(constant.ErrDismissedAlready, "") } - userIDs, err := s.GroupInterface.FindGroupMemberUserID(ctx, group.GroupID) + userIDs, err := s.GroupDatabase.FindGroupMemberUserID(ctx, group.GroupID) if err != nil { return nil, err } @@ -706,10 +715,10 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf if len(data) > 0 { return resp, nil } - if err := s.GroupInterface.UpdateGroup(ctx, group.GroupID, data); err != nil { + if err := s.GroupDatabase.UpdateGroup(ctx, group.GroupID, data); err != nil { return nil, err } - group, err = s.GroupInterface.TakeGroup(ctx, req.GroupInfoForSet.GroupID) + group, err = s.GroupDatabase.TakeGroup(ctx, req.GroupInfoForSet.GroupID) if err != nil { return nil, err } @@ -734,7 +743,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) { resp := &pbGroup.TransferGroupOwnerResp{} - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } @@ -744,7 +753,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans if req.OldOwnerUserID == req.NewOwnerUserID { return nil, constant.ErrArgs.Wrap("OldOwnerUserID == NewOwnerUserID") } - members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.GroupID}, []string{req.OldOwnerUserID, req.NewOwnerUserID}, nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.GroupID}, []string{req.OldOwnerUserID, req.NewOwnerUserID}, nil) if err != nil { return nil, err } @@ -759,7 +768,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans oldOwner := memberMap[req.OldOwnerUserID] if tokenverify.IsAppManagerUid(ctx) { if oldOwner == nil { - oldOwner, err = s.GroupInterface.TakeGroupOwner(ctx, req.OldOwnerUserID) + oldOwner, err = s.GroupDatabase.TakeGroupOwner(ctx, req.OldOwnerUserID) if err != nil { return nil, err } @@ -772,7 +781,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans return nil, constant.ErrNoPermission.Wrap(fmt.Sprintf("user %s no permission transfer group owner", tracelog.GetOpUserID(ctx))) } } - if err := s.GroupInterface.TransferGroupOwner(ctx, req.GroupID, req.OldOwnerUserID, req.NewOwnerUserID, newOwner.RoleLevel); err != nil { + if err := s.GroupDatabase.TransferGroupOwner(ctx, req.GroupID, req.OldOwnerUserID, req.NewOwnerUserID, newOwner.RoleLevel); err != nil { return nil, err } s.Notification.GroupOwnerTransferredNotification(ctx, req) @@ -786,10 +795,10 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) err error ) if req.GroupID != "" { - groups, err = s.GroupInterface.FindGroup(ctx, []string{req.GroupID}) + groups, err = s.GroupDatabase.FindGroup(ctx, []string{req.GroupID}) resp.Total = uint32(len(groups)) } else { - resp.Total, groups, err = s.GroupInterface.SearchGroup(ctx, req.GroupName, req.Pagination.PageNumber, req.Pagination.ShowNumber) + resp.Total, groups, err = s.GroupDatabase.SearchGroup(ctx, req.GroupName, req.Pagination.PageNumber, req.Pagination.ShowNumber) } if err != nil { return nil, err @@ -797,7 +806,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) groupIDs := utils.Slice(groups, func(e *relationTb.GroupModel) string { return e.GroupID }) - ownerMembers, err := s.GroupInterface.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) + ownerMembers, err := s.GroupDatabase.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } @@ -807,7 +816,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) if ids := utils.Single(groupIDs, utils.Keys(ownerMemberMap)); len(ids) > 0 { return nil, constant.ErrDB.Wrap("group not owner " + strings.Join(ids, ",")) } - groupMemberNumMap, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs) + groupMemberNumMap, err := s.GroupDatabase.MapGroupMemberNum(ctx, groupIDs) if err != nil { return nil, err } @@ -820,7 +829,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGroupMembersCMSReq) (*pbGroup.GetGroupMembersCMSResp, error) { resp := &pbGroup.GetGroupMembersCMSResp{} - total, members, err := s.GroupInterface.SearchGroupMember(ctx, req.UserName, []string{req.GroupID}, nil, nil, req.Pagination.PageNumber, req.Pagination.ShowNumber) + total, members, err := s.GroupDatabase.SearchGroupMember(ctx, req.UserName, []string{req.GroupID}, nil, nil, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -846,7 +855,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou if err != nil { return nil, err } - total, requests, err := s.GroupInterface.PageGroupRequestUser(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) + total, requests, err := s.GroupDatabase.PageGroupRequestUser(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -857,7 +866,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou groupIDs := utils.Distinct(utils.Slice(requests, func(e *relationTb.GroupRequestModel) string { return e.GroupID })) - groups, err := s.GroupInterface.FindGroup(ctx, groupIDs) + groups, err := s.GroupDatabase.FindGroup(ctx, groupIDs) if err != nil { return nil, err } @@ -867,7 +876,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou if ids := utils.Single(groupIDs, utils.Keys(groupMap)); len(ids) > 0 { return nil, constant.ErrGroupIDNotFound.Wrap(strings.Join(ids, ",")) } - owners, err := s.GroupInterface.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) + owners, err := s.GroupDatabase.FindGroupMember(ctx, groupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } @@ -877,7 +886,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou if ids := utils.Single(groupIDs, utils.Keys(ownerMap)); len(ids) > 0 { return nil, constant.ErrData.Wrap("group no owner", strings.Join(ids, ",")) } - groupMemberNum, err := s.GroupInterface.MapGroupMemberNum(ctx, groupIDs) + groupMemberNum, err := s.GroupDatabase.MapGroupMemberNum(ctx, groupIDs) if err != nil { return nil, err } @@ -892,18 +901,18 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou if err := s.CheckGroupAdmin(ctx, req.GroupID); err != nil { return nil, err } - group, err := s.GroupInterface.TakeGroup(ctx, req.GroupID) + group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { return nil, err } if group.Status == constant.GroupStatusDismissed { return nil, constant.ErrArgs.Wrap("group status is dismissed") } - if err := s.GroupInterface.DismissGroup(ctx, req.GroupID); err != nil { + if err := s.GroupDatabase.DismissGroup(ctx, req.GroupID); err != nil { return nil, err } if group.GroupType == constant.SuperGroup { - if err := s.GroupInterface.DeleteSuperGroup(ctx, group.GroupID); err != nil { + if err := s.GroupDatabase.DeleteSuperGroup(ctx, group.GroupID); err != nil { return nil, err } } else { @@ -914,12 +923,12 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) { resp := &pbGroup.MuteGroupMemberResp{} - member, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID) + member, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, req.UserID) if err != nil { return nil, err } if !(tracelog.GetOpUserID(ctx) == req.UserID || tokenverify.IsAppManagerUid(ctx)) { - opMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID) + opMember, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, req.UserID) if err != nil { return nil, err } @@ -928,7 +937,7 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou } } data := UpdateGroupMemberMutedTimeMap(time.Now().Add(time.Second * time.Duration(req.MutedSeconds))) - if err := s.GroupInterface.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil { + if err := s.GroupDatabase.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil { return nil, err } s.Notification.GroupMemberMutedNotification(ctx, req.GroupID, req.UserID, req.MutedSeconds) @@ -937,12 +946,12 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) { resp := &pbGroup.CancelMuteGroupMemberResp{} - member, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, req.UserID) + member, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, req.UserID) if err != nil { return nil, err } if !(tracelog.GetOpUserID(ctx) == req.UserID || tokenverify.IsAppManagerUid(ctx)) { - opMember, err := s.GroupInterface.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) + opMember, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, tracelog.GetOpUserID(ctx)) if err != nil { return nil, err } @@ -951,7 +960,7 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca } } data := UpdateGroupMemberMutedTimeMap(time.Unix(0, 0)) - if err := s.GroupInterface.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil { + if err := s.GroupDatabase.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil { return nil, err } s.Notification.GroupMemberCancelMutedNotification(ctx, req.GroupID, req.UserID) @@ -963,7 +972,7 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) if err := s.CheckGroupAdmin(ctx, req.GroupID); err != nil { return nil, err } - if err := s.GroupInterface.UpdateGroup(ctx, req.GroupID, UpdateGroupStatusMap(constant.GroupStatusMuted)); err != nil { + if err := s.GroupDatabase.UpdateGroup(ctx, req.GroupID, UpdateGroupStatusMap(constant.GroupStatusMuted)); err != nil { return nil, err } s.Notification.GroupMutedNotification(ctx, req.GroupID) @@ -975,7 +984,7 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu if err := s.CheckGroupAdmin(ctx, req.GroupID); err != nil { return nil, err } - if err := s.GroupInterface.UpdateGroup(ctx, req.GroupID, UpdateGroupStatusMap(constant.GroupOk)); err != nil { + if err := s.GroupDatabase.UpdateGroup(ctx, req.GroupID, UpdateGroupStatusMap(constant.GroupOk)); err != nil { return nil, err } s.Notification.GroupCancelMutedNotification(ctx, req.GroupID) @@ -1001,7 +1010,7 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr } groupIDs := utils.Keys(groupIDMap) userIDs := utils.Keys(userIDMap) - members, err := s.GroupInterface.FindGroupMember(ctx, groupIDs, append(userIDs, tracelog.GetOpUserID(ctx)), nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, groupIDs, append(userIDs, tracelog.GetOpUserID(ctx)), nil) if err != nil { return nil, err } @@ -1044,7 +1053,7 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr return nil, err } } - err = s.GroupInterface.UpdateGroupMembers(ctx, utils.Slice(req.Members, func(e *pbGroup.SetGroupMemberInfo) *relationTb.BatchUpdateGroupMember { + err = s.GroupDatabase.UpdateGroupMembers(ctx, utils.Slice(req.Members, func(e *pbGroup.SetGroupMemberInfo) *relationTb.BatchUpdateGroupMember { return &relationTb.BatchUpdateGroupMember{ GroupID: e.GroupID, UserID: e.UserID, @@ -1068,7 +1077,7 @@ func (s *groupServer) GetGroupAbstractInfo(ctx context.Context, req *pbGroup.Get if utils.Duplicate(req.GroupIDs) { return nil, constant.ErrArgs.Wrap("groupIDs duplicate") } - groups, err := s.GroupInterface.FindGroup(ctx, req.GroupIDs) + groups, err := s.GroupDatabase.FindGroup(ctx, req.GroupIDs) if err != nil { return nil, err } @@ -1077,7 +1086,7 @@ func (s *groupServer) GetGroupAbstractInfo(ctx context.Context, req *pbGroup.Get })); len(ids) > 0 { return nil, constant.ErrGroupIDNotFound.Wrap("not found group " + strings.Join(ids, ",")) } - groupUserMap, err := s.GroupInterface.MapGroupMemberUserID(ctx, req.GroupIDs) + groupUserMap, err := s.GroupDatabase.MapGroupMemberUserID(ctx, req.GroupIDs) if err != nil { return nil, err } @@ -1096,7 +1105,7 @@ func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbGroup.Ge if len(req.GroupIDs) == 0 { return nil, constant.ErrArgs.Wrap("groupIDs empty") } - members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.UserID}, req.GroupIDs, nil) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.UserID}, req.GroupIDs, nil) if err != nil { return nil, err } @@ -1118,7 +1127,7 @@ func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbGroup.Ge func (s *groupServer) GetGroupMemberUserID(ctx context.Context, req *pbGroup.GetGroupMemberUserIDReq) (*pbGroup.GetGroupMemberUserIDResp, error) { resp := &pbGroup.GetGroupMemberUserIDResp{} var err error - resp.UserIDs, err = s.GroupInterface.FindGroupMemberUserID(ctx, req.GroupID) + resp.UserIDs, err = s.GroupDatabase.FindGroupMemberUserID(ctx, req.GroupID) if err != nil { return nil, err } @@ -1130,7 +1139,7 @@ func (s *groupServer) GetGroupMemberRoleLevel(ctx context.Context, req *pbGroup. if len(req.RoleLevels) == 0 { return nil, constant.ErrArgs.Wrap("RoleLevels empty") } - members, err := s.GroupInterface.FindGroupMember(ctx, []string{req.GroupID}, nil, req.RoleLevels) + members, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.GroupID}, nil, req.RoleLevels) if err != nil { return nil, err } diff --git a/internal/rpc/group/super_group.go b/internal/rpc/group/super_group.go index fc8df467b..d1d098ae7 100644 --- a/internal/rpc/group/super_group.go +++ b/internal/rpc/group/super_group.go @@ -14,14 +14,14 @@ import ( func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup.GetJoinedSuperGroupListReq) (*pbGroup.GetJoinedSuperGroupListResp, error) { resp := &pbGroup.GetJoinedSuperGroupListResp{} - joinSuperGroup, err := s.GroupInterface.FindJoinSuperGroup(ctx, req.UserID) + joinSuperGroup, err := s.GroupDatabase.FindJoinSuperGroup(ctx, req.UserID) if err != nil { return nil, err } if len(joinSuperGroup.GroupIDs) == 0 { return resp, nil } - owners, err := s.GroupInterface.FindGroupMember(ctx, joinSuperGroup.GroupIDs, nil, []int32{constant.GroupOwner}) + owners, err := s.GroupDatabase.FindGroupMember(ctx, joinSuperGroup.GroupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } @@ -31,7 +31,7 @@ func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup. if ids := utils.Single(joinSuperGroup.GroupIDs, utils.Keys(ownerMap)); len(ids) > 0 { return nil, constant.ErrData.Wrap(fmt.Sprintf("super group %s not owner", strings.Join(ids, ","))) } - groups, err := s.GroupInterface.FindGroup(ctx, joinSuperGroup.GroupIDs) + groups, err := s.GroupDatabase.FindGroup(ctx, joinSuperGroup.GroupIDs) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup. if ids := utils.Single(joinSuperGroup.GroupIDs, utils.Keys(groupMap)); len(ids) > 0 { return nil, constant.ErrData.Wrap(fmt.Sprintf("super group info %s not found", strings.Join(ids, ","))) } - superGroupMembers, err := s.GroupInterface.FindSuperGroup(ctx, joinSuperGroup.GroupIDs) + superGroupMembers, err := s.GroupDatabase.FindSuperGroup(ctx, joinSuperGroup.GroupIDs) if err != nil { return nil, err } @@ -59,18 +59,18 @@ func (s *groupServer) GetSuperGroupsInfo(ctx context.Context, req *pbGroup.GetSu if len(req.GroupIDs) == 0 { return nil, constant.ErrArgs.Wrap("groupIDs empty") } - groups, err := s.GroupInterface.FindGroup(ctx, req.GroupIDs) + groups, err := s.GroupDatabase.FindGroup(ctx, req.GroupIDs) if err != nil { return nil, err } - superGroupMembers, err := s.GroupInterface.FindSuperGroup(ctx, req.GroupIDs) + superGroupMembers, err := s.GroupDatabase.FindSuperGroup(ctx, req.GroupIDs) if err != nil { return nil, err } superGroupMemberMap := utils.SliceToMapAny(superGroupMembers, func(e *unrelation.SuperGroupModel) (string, []string) { return e.GroupID, e.MemberIDs }) - owners, err := s.GroupInterface.FindGroupMember(ctx, req.GroupIDs, nil, []int32{constant.GroupOwner}) + owners, err := s.GroupDatabase.FindGroupMember(ctx, req.GroupIDs, nil, []int32{constant.GroupOwner}) if err != nil { return nil, err } diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go index f8660e7e1..9815d0567 100644 --- a/internal/rpc/msg/callback.go +++ b/internal/rpc/msg/callback.go @@ -32,7 +32,7 @@ func toCommonCallback(ctx context.Context, msg *pbChat.SendMsgReq, command strin AtUserIDList: msg.MsgData.AtUserIDList, SenderFaceURL: msg.MsgData.SenderFaceURL, Content: utils.GetContent(msg.MsgData), - Seq: msg.MsgData.Seq, + Seq: uint32(msg.MsgData.Seq), Ex: msg.MsgData.Ex, } } diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go index d2e5e7b84..5695912a0 100644 --- a/internal/rpc/msg/delete.go +++ b/internal/rpc/msg/delete.go @@ -9,7 +9,7 @@ import ( 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 { + if _, err := m.MsgInterface.DelMsgBySeqs(ctx, req.UserID, req.SeqList); err != nil { return nil, err } DeleteMessageNotification(ctx, req.UserID, req.SeqList) @@ -21,11 +21,14 @@ func (m *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroup 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 { + //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 + //} + if err := m.MsgInterface.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, req.GroupID, req.UserID, 0); err != nil { return nil, err } return resp, nil @@ -36,8 +39,11 @@ func (m *msgServer) ClearMsg(ctx context.Context, req *msg.ClearMsgReq) (*msg.Cl if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { return nil, err } - if err := m.MsgInterface.DelUserAllSeq(ctx, req.UserID); err != nil { + if err := m.MsgInterface.CleanUpUserMsg(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 5d32729f2..ba3ad3a7c 100644 --- a/internal/rpc/msg/extend_msg.go +++ b/internal/rpc/msg/extend_msg.go @@ -3,7 +3,6 @@ package msg import ( "Open_IM/internal/common/notification" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" "Open_IM/pkg/proto/msg" "Open_IM/pkg/proto/sdkws" diff --git a/internal/rpc/msg/extend_msg_callback.go b/internal/rpc/msg/extend_msg_callback.go index f9876ee1d..4027cfa4a 100644 --- a/internal/rpc/msg/extend_msg_callback.go +++ b/internal/rpc/msg/extend_msg_callback.go @@ -5,10 +5,8 @@ import ( "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" "context" ) @@ -29,7 +27,7 @@ func CallbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMe MsgFirstModifyTime: setReq.MsgFirstModifyTime, } resp := &cbapi.CallbackBeforeSetMessageReactionExtResp{} - return http.CallBackPostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) } func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReactionExtensionsReq) error { @@ -48,52 +46,39 @@ func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReacti MsgFirstModifyTime: setReq.MsgFirstModifyTime, } resp := &cbapi.CallbackDeleteMessageReactionExtResp{} - defer log.NewDebug(setReq.OperationID, utils.GetSelfFuncName(), req, *resp) - return http.CallBackPostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) + return http.CallBackPostReturn(cbURL(), 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 -// -//} +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{} + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) +} + +func CallbackAddMessageReactionExtensions(setReq *msg.ModifyMessageReactionExtensionsReq) error { + 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{} + return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg) +} diff --git a/internal/rpc/msg/lock.go b/internal/rpc/msg/lock.go index cef59cb1a..bee152b15 100644 --- a/internal/rpc/msg/lock.go +++ b/internal/rpc/msg/lock.go @@ -1,7 +1,6 @@ package msg import ( - "Open_IM/pkg/common/db" "time" ) diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 150da4ae1..8cc24550d 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -165,14 +165,14 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe } if revokeMessage.RevokerID != revokeMessage.SourceMessageSendID { - resp, err := m.MsgInterface.GetSuperGroupMsg(ctx, data.MsgData.GroupID, revokeMessage.Seq) + resp, err := m.MsgInterface.GetSuperGroupMsgBySeqs(ctx, data.MsgData.GroupID, []int64{int64(revokeMessage.Seq)}) if err != nil { return nil, err } - if resp.ClientMsgID == revokeMessage.ClientMsgID && resp.Seq == revokeMessage.Seq { - revokeMessage.SourceMessageSendTime = resp.SendTime - revokeMessage.SourceMessageSenderNickname = resp.SenderNickname - revokeMessage.SourceMessageSendID = resp.SendID + if resp[0].ClientMsgID == revokeMessage.ClientMsgID && resp[0].Seq == int64(revokeMessage.Seq) { + revokeMessage.SourceMessageSendTime = resp[0].SendTime + revokeMessage.SourceMessageSenderNickname = resp[0].SenderNickname + revokeMessage.SourceMessageSendID = resp[0].SendID data.MsgData.Content = []byte(utils.StructToJsonString(revokeMessage)) } else { return nil, constant.ErrData.Wrap("MsgData") diff --git a/internal/rpc/msg/send_pull.go b/internal/rpc/msg/send_pull.go index 904e4f402..cba7e619c 100644 --- a/internal/rpc/msg/send_pull.go +++ b/internal/rpc/msg/send_pull.go @@ -2,7 +2,7 @@ package msg import ( "Open_IM/pkg/common/constant" - promePkg "Open_IM/pkg/common/prometheus" + promePkg "Open_IM/pkg/common/prome" pbConversation "Open_IM/pkg/proto/conversation" "Open_IM/pkg/proto/msg" "Open_IM/pkg/proto/sdkws" @@ -67,7 +67,7 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq) if err != nil { return nil, err } - isSend, err := modifyMessageByUserMessageReceiveOpt(req.MsgData.RecvID, req.MsgData.SendID, constant.SingleChatType, req) + isSend, err := m.modifyMessageByUserMessageReceiveOpt(ctx, req.MsgData.RecvID, req.MsgData.SendID, constant.SingleChatType, req) if err != nil { return nil, err } diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 1700d4e72..f9304b5f0 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -9,7 +9,7 @@ import ( discoveryRegistry "Open_IM/pkg/discoveryregistry" "github.com/OpenIMSDK/openKeeper" - promePkg "Open_IM/pkg/common/prometheus" + promePkg "Open_IM/pkg/common/prome" "Open_IM/pkg/proto/msg" "google.golang.org/grpc" ) diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 72ed92759..d72c4ed6f 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -4,13 +4,14 @@ import ( "Open_IM/internal/common/check" "Open_IM/internal/common/convert" "Open_IM/internal/common/notification" + "Open_IM/pkg/common/config" "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/tokenverify" "Open_IM/pkg/common/tracelog" - discoveryRegistry "Open_IM/pkg/discoveryregistry" + registry "Open_IM/pkg/discoveryregistry" "Open_IM/pkg/proto/sdkws" pbuser "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" @@ -20,27 +21,37 @@ import ( ) type userServer struct { - controller.UserInterface + controller.UserDatabase notification *notification.Check userCheck *check.UserCheck ConversationChecker *check.ConversationChecker - RegisterCenter discoveryRegistry.SvcDiscoveryRegistry + RegisterCenter registry.SvcDiscoveryRegistry + friendCheck *check.FriendChecker } func Start(client *openKeeper.ZkClient, server *grpc.Server) error { - mysql, err := relation.NewGormDB() + gormDB, err := relation.NewGormDB() if err != nil { return err } - if err := mysql.AutoMigrate(&tablerelation.UserModel{}); err != nil { + if err := gormDB.AutoMigrate(&tablerelation.UserModel{}); err != nil { return err } - pbuser.RegisterUserServer(server, &userServer{ - UserInterface: controller.NewUserController(mysql), + u := &userServer{ + UserDatabase: controller.NewUserDatabase(relation.NewUserGorm(gormDB)), notification: notification.NewCheck(client), userCheck: check.NewUserCheck(client), RegisterCenter: client, - }) + } + pbuser.RegisterUserServer(server, u) + users := make([]*tablerelation.UserModel, 0) + if len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname) { + return constant.ErrConfig.Wrap("len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname)") + } + for k, v := range config.Config.Manager.AppManagerUid { + users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k]}) + } + u.UserDatabase.InitOnce(context.Background(), users) return nil } @@ -58,10 +69,6 @@ func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbuser.GetDesig return resp, nil } -func (s *userServer) GetAllPageFriends(ctx context.Context, ownerUserID string) (resp []*sdkws.FriendInfo, err error) { - return -} - // ok func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserInfoReq) (resp *pbuser.UpdateUserInfoResp, err error) { resp = &pbuser.UpdateUserInfoResp{} @@ -69,14 +76,6 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI if err != nil { return nil, err } - //oldNickname := "" - //if req.UserInfo.Nickname != "" { - // u, err := s.FindWithError(ctx, []string{req.UserInfo.UserID}) - // if err != nil { - // return nil, err - // } - // oldNickname = u[0].Nickname - //} user, err := convert.NewPBUser(req.UserInfo).Convert() if err != nil { return nil, err @@ -85,7 +84,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI if err != nil { return nil, err } - friends, err := s.GetAllPageFriends(ctx, req.UserInfo.UserID) + friends, err := s.friendCheck.GetAllPageFriends(ctx, req.UserInfo.UserID) if err != nil { return nil, err } @@ -94,9 +93,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserI s.notification.FriendInfoUpdatedNotification(ctx, req.UserInfo.UserID, v.FriendUser.UserID, tracelog.GetOpUserID(ctx)) } }() - s.notification.UserInfoUpdatedNotification(ctx, tracelog.GetOpUserID(ctx), req.UserInfo.UserID) - return resp, nil } @@ -184,3 +181,13 @@ func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterR } return resp, nil } + +func (s *userServer) GetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.GetGlobalRecvMessageOptReq) (resp *pbuser.GetGlobalRecvMessageOptResp, err error) { + resp = &pbuser.GetGlobalRecvMessageOptResp{} + user, err := s.FindWithError(ctx, []string{req.UserID}) + if err != nil { + return nil, err + } + resp.GlobalRecvMsgOpt = user[0].GlobalRecvMsgOpt + return resp, nil +} diff --git a/internal/startrpc/start.go b/internal/startrpc/start.go index 1a487d2b7..89ce089e3 100644 --- a/internal/startrpc/start.go +++ b/internal/startrpc/start.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/middleware" - promePkg "Open_IM/pkg/common/prometheus" + promePkg "Open_IM/pkg/common/prome" "flag" "fmt" "github.com/OpenIMSDK/openKeeper" diff --git a/internal/tx/gorm.go b/internal/tx/gorm.go new file mode 100644 index 000000000..4d5ccd5be --- /dev/null +++ b/internal/tx/gorm.go @@ -0,0 +1,19 @@ +package tx + +import ( + "gorm.io/gorm" +) + +func NewGorm(db *gorm.DB) Tx { + return &_Gorm{tx: db} +} + +type _Gorm struct { + tx *gorm.DB +} + +func (g *_Gorm) Transaction(fn func(tx any) error) error { + return g.tx.Transaction(func(tx *gorm.DB) error { + return fn(tx) + }) +} diff --git a/internal/tx/mongo.go b/internal/tx/mongo.go new file mode 100644 index 000000000..dff6b4dd1 --- /dev/null +++ b/internal/tx/mongo.go @@ -0,0 +1,31 @@ +package tx + +import ( + "Open_IM/pkg/utils" + "context" + "go.mongodb.org/mongo-driver/mongo" +) + +func NewMongo(client *mongo.Client) CtxTx { + return &_Mongo{ + client: client, + } +} + +type _Mongo struct { + client *mongo.Client +} + +func (m *_Mongo) Transaction(ctx context.Context, fn func(ctx context.Context) error) error { + sess, err := m.client.StartSession() + if err != nil { + return err + } + sCtx := mongo.NewSessionContext(ctx, sess) + defer sess.EndSession(sCtx) + if err := fn(sCtx); err != nil { + _ = sess.AbortTransaction(sCtx) + return err + } + return utils.Wrap(sess.CommitTransaction(sCtx), "") +} diff --git a/internal/tx/tx.go b/internal/tx/tx.go new file mode 100644 index 000000000..e182271ff --- /dev/null +++ b/internal/tx/tx.go @@ -0,0 +1,11 @@ +package tx + +import "context" + +type Tx interface { + Transaction(fn func(tx any) error) error +} + +type CtxTx interface { + Transaction(ctx context.Context, fn func(ctx context.Context) error) error +} diff --git a/pkg/callbackstruct/message.go b/pkg/callbackstruct/message.go index ce8d72629..f26c9ba84 100644 --- a/pkg/callbackstruct/message.go +++ b/pkg/callbackstruct/message.go @@ -99,3 +99,38 @@ type CallbackDeleteMessageReactionExtResp struct { ResultReactionExtensionList []*msg.KeyValueResp `json:"resultReactionExtensionList"` MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` } + +type CallbackGetMessageListReactionExtReq struct { + OperationID string `json:"operationID"` + CallbackCommand `json:"callbackCommand"` + SourceID string `json:"sourceID"` + OpUserID string `json:"opUserID"` + SessionType int32 `json:"sessionType"` + TypeKeyList []string `json:"typeKeyList"` + MessageKeyList []*msg.GetMessageListReactionExtensionsReq_MessageReactionKey `json:"messageKeyList"` +} + +type CallbackGetMessageListReactionExtResp struct { + CommonCallbackResp + MessageResultList []*msg.SingleMessageExtensionResult `json:"messageResultList"` +} + +type CallbackAddMessageReactionExtReq struct { + OperationID string `json:"operationID"` + CallbackCommand `json:"callbackCommand"` + SourceID string `json:"sourceID"` + OpUserID string `json:"opUserID"` + SessionType int32 `json:"sessionType"` + ReactionExtensionList map[string]*sdkws.KeyValue `json:"reactionExtensionList"` + ClientMsgID string `json:"clientMsgID"` + IsReact bool `json:"isReact"` + IsExternalExtensions bool `json:"isExternalExtensions"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` +} + +type CallbackAddMessageReactionExtResp struct { + CommonCallbackResp + ResultReactionExtensionList []*msg.KeyValueResp `json:"resultReactionExtensionList"` + IsReact bool `json:"isReact"` + MsgFirstModifyTime int64 `json:"msgFirstModifyTime"` +} diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 1f42218c1..68a0140f6 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -212,9 +212,9 @@ type config struct { } } Manager struct { - AppManagerUid []string `yaml:"appManagerUid"` - Secrets []string `yaml:"secrets"` - AppSysNotificationName string `yaml:"appSysNotificationName"` + AppManagerUid []string `yaml:"appManagerUid"` + // AppSysNotificationName string `yaml:"appSysNotificationName"` + Nickname []string `yaml:"nickname"` } Kafka struct { diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index 1ad38f41b..146834b47 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -202,6 +202,8 @@ const ( CallbackBeforeSetGroupMemberInfoCommand = "CallbackBeforeSetGroupMemberInfoCommand" CallbackBeforeSetMessageReactionExtensionCommand = "callbackBeforeSetMessageReactionExtensionCommand" CallbackBeforeDeleteMessageReactionExtensionsCommand = "callbackBeforeDeleteMessageReactionExtensionsCommand" + CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand" + CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand" //callback actionCode ActionAllow = 0 @@ -315,16 +317,8 @@ func GroupIsBanPrivateChat(status int32) bool { return true } -const ( - TokenKicked = 1001 -) - const BigVersion = "v2" const LogFileName = "OpenIM.log" -const StatisticsTimeInterval = 60 - -const MaxNotificationNum = 500 - const CurrentVersion = "v2.3.4-rc0" diff --git a/pkg/common/constant/errors.go b/pkg/common/constant/errors.go index b998fc71d..03b45fa2f 100644 --- a/pkg/common/constant/errors.go +++ b/pkg/common/constant/errors.go @@ -14,7 +14,6 @@ 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", ""} @@ -54,6 +53,13 @@ var ( // ErrMutedInGroup = &ErrInfo{MutedInGroup, "MutedInGroup", ""} ErrMutedGroup = &ErrInfo{MutedGroup, "MutedGroup", ""} + + ErrConnOverMaxNumLimit = &ErrInfo{ConnOverMaxNumLimit, "ConnOverMaxNumLimit", ""} + + ErrConnArgsErr = &ErrInfo{ConnArgsErr, "args err, need token, sendID, platformID", ""} + ErrConnUpdateErr = &ErrInfo{ConnArgsErr, "upgrade http conn err", ""} + + ErrConfig = &ErrInfo{ConfigError, "ConfigError", ""} ) const ( @@ -87,6 +93,8 @@ const ( DataError = 90007 //数据错误 IdentityError = 90008 // 身份错误 非管理员token,且token中userID与请求userID不一致 + + ConfigError = 90009 ) // 账号错误码 @@ -142,6 +150,13 @@ const ( MessageHasReadDisable = 96001 ) +// 长连接网关错误码 +const ( + ConnOverMaxNumLimit = 970001 + ConnArgsErr = 970002 + ConnUpdateErr = 970003 +) + // temp var ( diff --git a/pkg/common/constant/limit.go b/pkg/common/constant/limit.go index cdd19e240..57e764eef 100644 --- a/pkg/common/constant/limit.go +++ b/pkg/common/constant/limit.go @@ -1,5 +1,7 @@ package constant const ( - ShowNumber = 1000 + ShowNumber = 1000 + StatisticsTimeInterval = 60 + MaxNotificationNum = 500 ) diff --git a/pkg/common/constant/platform_number_id_to_name.go b/pkg/common/constant/platform_id_to_name.go similarity index 100% rename from pkg/common/constant/platform_number_id_to_name.go rename to pkg/common/constant/platform_id_to_name.go diff --git a/pkg/common/db/cache/black.go b/pkg/common/db/cache/black.go index aedc616b6..bcd72b529 100644 --- a/pkg/common/db/cache/black.go +++ b/pkg/common/db/cache/black.go @@ -1,10 +1,10 @@ package cache import ( + "Open_IM/pkg/common/db/relation" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" - "encoding/json" "github.com/dtm-labs/rockscache" "github.com/go-redis/redis/v8" "time" @@ -26,6 +26,7 @@ type BlackCache interface { type BlackCacheRedis struct { expireTime time.Duration rcClient *rockscache.Client + black *relation.BlackGorm } func NewBlackCacheRedis(rdb redis.UniversalClient, blackDB BlackCache, options rockscache.Options) *BlackCacheRedis { @@ -40,31 +41,14 @@ func (b *BlackCacheRedis) getBlackIDsKey(ownerUserID string) string { } func (b *BlackCacheRedis) GetBlackIDs(ctx context.Context, userID string) (blackIDs []string, err error) { - getBlackIDList := func() (string, error) { - blackIDs, err := b.blackDB.GetBlackIDs(ctx, userID) - if err != nil { - return "", utils.Wrap(err, "") - } - bytes, err := json.Marshal(blackIDs) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "blackIDList", blackIDs) - }() - blackIDListStr, err := b.rcClient.Fetch(blackListCache+userID, b.expireTime, getBlackIDList) - if err != nil { - return nil, utils.Wrap(err, "") - } - err = json.Unmarshal([]byte(blackIDListStr), &blackIDs) - return blackIDs, utils.Wrap(err, "") + return GetCache(ctx, b.rcClient, b.getBlackIDsKey(userID), b.expireTime, func(ctx context.Context) ([]string, error) { + return b.black.FindBlackUserIDs(ctx, userID) + }) } func (b *BlackCacheRedis) DelBlackIDs(ctx context.Context, userID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) }() - return b.rcClient.TagAsDeleted(blackListCache + userID) + return b.rcClient.TagAsDeleted(b.getBlackIDsKey(userID)) } diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index 0491d36c7..742fac240 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -6,10 +6,8 @@ import ( "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" - "encoding/json" "github.com/dtm-labs/rockscache" "github.com/go-redis/redis/v8" - "golang.org/x/tools/go/ssa/testdata/src/strconv" "time" ) @@ -20,6 +18,7 @@ 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 @@ -28,13 +27,13 @@ type ConversationCache interface { 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 + DelUsersConversationIDs(ctx context.Context, userIDList []string) error // get one conversation from cache 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 FuncDB)([]*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 FuncDB ) ([]*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 @@ -51,11 +50,47 @@ type ConversationCache interface { //DelSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) } -type ConversationRedis struct { - rcClient *rockscache.Client +func NewConversationRedis(rdb redis.UniversalClient, opts rockscache.Options) ConversationCache { + return &ConversationRedis{rcClient: rockscache.NewClient(rdb, opts)} } -func (c *ConversationRedis) GetUserConversationIDs(ctx context.Context, userID string, fn func(ctx context.Context, userID string) ([]string, error)) ([]string, error) { +type ConversationRedis struct { + rcClient *rockscache.Client + expireTime time.Duration +} + +func (c *ConversationRedis) GetUserConversationIDs(ctx context.Context, userID string, fn FuncDB) ([]string, error) { + //TODO implement me + panic("implement me") +} + +func (c *ConversationRedis) GetConversation(ctx context.Context, ownerUserID, conversationID string, fn FuncDB) (*relationTb.ConversationModel, error) { + //TODO implement me + panic("implement me") +} + +func (c *ConversationRedis) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string, fn FuncDB) ([]*relationTb.ConversationModel, error) { + //TODO implement me + panic("implement me") +} + +func (c *ConversationRedis) GetUserAllConversations(ctx context.Context, ownerUserID string, fn FuncDB) ([]*relationTb.ConversationModel, error) { + //TODO implement me + panic("implement me") +} + +func (c *ConversationRedis) DelUserConversations(ctx context.Context, ownerUserID string, conversationIDList []string) error { + //TODO implement me + 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) { + //TODO implement me + 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) { + //TODO implement me panic("implement me") } @@ -63,34 +98,10 @@ func (c *ConversationRedis) DelUsersConversationIDs(ctx context.Context, userIDL 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} -} - func NewNewConversationRedis(rdb redis.UniversalClient, conversationDB *relation.ConversationGorm, options rockscache.Options) *ConversationRedis { return &ConversationRedis{rcClient: rockscache.NewClient(rdb, options)} } @@ -111,31 +122,31 @@ func (c *ConversationRedis) getSuperGroupRecvNotNotifyUserIDsKey(groupID string) return superGroupRecvMsgNotNotifyUserIDsKey + groupID } -func (c *ConversationRedis) GetUserConversationIDs(ctx context.Context, ownerUserID string, f func(userID string) ([]string, error)) (conversationIDs []string, err error) { - //getConversationIDs := func() (string, error) { - // conversationIDs, err := relation.GetConversationIDsByUserID(ownerUserID) - // if err != nil { - // return "", err - // } - // bytes, err := json.Marshal(conversationIDs) - // if err != nil { - // return "", utils.Wrap(err, "") - // } - // return string(bytes), nil - //} - //defer func() { - // tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs) - //}() - //conversationIDsStr, err := c.rcClient.Fetch(c.getConversationIDsKey(ownerUserID), time.Second*30*60, getConversationIDs) - //err = json.Unmarshal([]byte(conversationIDsStr), &conversationIDs) - //if err != nil { - // return nil, utils.Wrap(err, "") - //} - //return conversationIDs, nil - return GetCache(ctx, c.rcClient, c.getConversationIDsKey(ownerUserID), conversationExpireTime, func(ctx context.Context) ([]string, error) { - return f(ownerUserID) - }) -} +//func (c *ConversationRedis) GetUserConversationIDs(ctx context.Context, ownerUserID string) (conversationIDs []string, err error) { +// //getConversationIDs := func() (string, error) { +// // conversationIDs, err := relation.GetConversationIDsByUserID(ownerUserID) +// // if err != nil { +// // return "", err +// // } +// // bytes, err := json.Marshal(conversationIDs) +// // if err != nil { +// // return "", utils.Wrap(err, "") +// // } +// // return string(bytes), nil +// //} +// //defer func() { +// // tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs) +// //}() +// //conversationIDsStr, err := c.rcClient.Fetch(c.getConversationIDsKey(ownerUserID), time.Second*30*60, getConversationIDs) +// //err = json.Unmarshal([]byte(conversationIDsStr), &conversationIDs) +// //if err != nil { +// // return nil, utils.Wrap(err, "") +// //} +// //return conversationIDs, nil +// return GetCache(ctx, c.rcClient, c.getConversationIDsKey(ownerUserID), conversationExpireTime, func(ctx context.Context) ([]string, error) { +// panic("implement me") +// }) +//} func (c *ConversationRedis) GetUserConversationIDs1(ctx context.Context, ownerUserID string) (conversationIDs []string, err error) { //getConversationIDs := func() (string, error) { @@ -158,7 +169,11 @@ func (c *ConversationRedis) GetUserConversationIDs1(ctx context.Context, ownerUs // return nil, utils.Wrap(err, "") //} //return conversationIDs, nil - return GetCache1[[]string](c.rcClient, c.getConversationIDsKey(ownerUserID), conversationExpireTime, fn) + //return GetCache1[[]string](c.rcClient, c.getConversationIDsKey(ownerUserID), conversationExpireTime, fn) + + return GetCache(ctx, c.rcClient, c.getConversationIDsKey(ownerUserID), conversationExpireTime, func(ctx context.Context) ([]string, error) { + panic("") + }) } //func GetCache1[T any](rcClient *rockscache.Client, key string, expire time.Duration, fn func() (any, error)) (T, error) { @@ -191,29 +206,11 @@ func (c *ConversationRedis) DelUserConversationIDs(ctx context.Context, ownerUse return utils.Wrap(c.rcClient.TagAsDeleted(c.getConversationIDsKey(ownerUserID)), "DelUserConversationIDs err") } -func (c *ConversationRedis) GetConversation(ctx context.Context, ownerUserID, conversationID string) (conversation *relationTb.Conversation, err error) { - getConversation := func() (string, error) { - conversation, err := relation.GetConversation(ownerUserID, conversationID) - if err != nil { - return "", err - } - bytes, err := json.Marshal(conversation) - if err != nil { - return "", utils.Wrap(err, "conversation Marshal failed") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "conversation", *conversation) - }() - conversationStr, err := c.rcClient.Fetch(c.getConversationKey(ownerUserID, conversationID), c.expireTime, getConversation) - if err != nil { - return nil, err - } - conversation = &relationTb.ConversationModel{} - err = json.Unmarshal([]byte(conversationStr), &conversation) - return conversation, utils.Wrap(err, "Unmarshal failed") -} +//func (c *ConversationRedis) GetConversation(ctx context.Context, ownerUserID, conversationID string) (conversation *relationTb.ConversationModel, err error) { +// return GetCache(ctx, c.rcClient, c.getConversationKey(ownerUserID, conversationID), c.expireTime, func(ctx context.Context) (*relationTb.ConversationModel, error) { +// panic("implement me") +// }) +//} func (c *ConversationRedis) DelConversation(ctx context.Context, ownerUserID, conversationID string) (err error) { defer func() { @@ -222,73 +219,73 @@ func (c *ConversationRedis) DelConversation(ctx context.Context, ownerUserID, co return utils.Wrap(c.rcClient.TagAsDeleted(c.getConversationKey(ownerUserID, conversationID)), "DelConversation err") } -func (c *ConversationRedis) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []relationTb.ConversationModel, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs, "conversations", conversations) - }() - for _, conversationID := range conversationIDs { - conversation, err := c.GetConversation(ctx, ownerUserID, conversationID) - if err != nil { - return nil, err - } - conversations = append(conversations, *conversation) - } - return conversations, nil -} +//func (c *ConversationRedis) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []relationTb.ConversationModel, err error) { +// defer func() { +// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs, "conversations", conversations) +// }() +// for _, conversationID := range conversationIDs { +// conversation, err := c.GetConversation(ctx, ownerUserID, conversationID) +// if err != nil { +// return nil, err +// } +// conversations = append(conversations, *conversation) +// } +// return conversations, nil +//} -func (c *ConversationRedis) GetUserAllConversations(ctx context.Context, ownerUserID string) (conversations []relationTb.ConversationModel, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversations", conversations) - }() - IDs, err := c.GetUserConversationIDs(ctx, ownerUserID) - if err != nil { - return nil, err - } - var conversationIDs []relationTb.ConversationModel - for _, conversationID := range IDs { - conversation, err := c.GetConversation(ctx, ownerUserID, conversationID) - if err != nil { - return nil, err - } - conversationIDs = append(conversationIDs, *conversation) - } - return conversationIDs, nil -} +//func (c *ConversationRedis) GetUserAllConversations(ctx context.Context, ownerUserID string) (conversations []relationTb.ConversationModel, err error) { +// defer func() { +// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversations", conversations) +// }() +// IDs, err := c.GetUserConversationIDs(ctx, ownerUserID) +// if err != nil { +// return nil, err +// } +// var conversationIDs []relationTb.ConversationModel +// for _, conversationID := range IDs { +// conversation, err := c.GetConversation(ctx, ownerUserID, conversationID) +// if err != nil { +// return nil, err +// } +// conversationIDs = append(conversationIDs, *conversation) +// } +// return conversationIDs, nil +//} -func (c *ConversationRedis) GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error) { - getConversation := func() (string, error) { - conversation, err := relation.GetConversation(ownerUserID, conversationID) - if err != nil { - return "", err - } - return strconv.Itoa(int(conversation.RecvMsgOpt)), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "opt", opt) - }() - optStr, err := c.rcClient.Fetch(c.getConversationKey(ownerUserID, conversationID), c.expireTime, getConversation) - if err != nil { - return 0, err - } - return strconv.Atoi(optStr) -} +//func (c *ConversationRedis) GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error) { +// //getConversation := func() (string, error) { +// // conversation, err := relation.GetConversation(ownerUserID, conversationID) +// // if err != nil { +// // return "", err +// // } +// // return strconv.Itoa(int(conversation.RecvMsgOpt)), nil +// //} +// //defer func() { +// // tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "opt", opt) +// //}() +// //optStr, err := c.rcClient.Fetch(c.getConversationKey(ownerUserID, conversationID), c.expireTime, getConversation) +// //if err != nil { +// // return 0, err +// //} +// //return strconv.Atoi(optStr) +// // panic("implement me") +// return GetCache(ctx, c.rcClient, c.getConversationKey(ownerUserID, conversationID), c.expireTime, func(ctx context.Context) (int, error) { +// panic("implement me") +// }) +//} func (c *ConversationRedis) DelUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) error { return utils.Wrap(c.rcClient.TagAsDeleted(c.getConversationKey(ownerUserID, conversationID)), "DelUserRecvMsgOpt failed") } -func (c *ConversationRedis) GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) { - return nil, nil -} - func (c *ConversationRedis) DelSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (err error) { - return nil + panic("implement me") } func (c *ConversationRedis) GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint32, err error) { - return + panic("implement me") } func (c *ConversationRedis) DelSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) { - return + panic("implement me") } diff --git a/pkg/common/db/cache/extend_msg_set.go b/pkg/common/db/cache/extend_msg_set.go index 6a02f0af3..8d254f54f 100644 --- a/pkg/common/db/cache/extend_msg_set.go +++ b/pkg/common/db/cache/extend_msg_set.go @@ -19,34 +19,42 @@ type ExtendMsgSetCache struct { rcClient *rockscache.Client } -func (e *ExtendMsgSetCache) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, firstModifyTime int64) (extendMsg *unrelation.ExtendMsg, err error) { - getExtendMsg := func() (string, error) { - extendMsg, err := db.DB.GetExtendMsg(sourceID, sessionType, clientMsgID, firstModifyTime) - if err != nil { - return "", utils.Wrap(err, "GetExtendMsgList failed") - } - bytes, err := json.Marshal(extendMsg) - if err != nil { - return "", utils.Wrap(err, "Marshal failed") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "sourceID", sourceID, "sessionType", - sessionType, "clientMsgID", clientMsgID, "firstModifyTime", firstModifyTime, "extendMsg", extendMsg) - }() - extendMsgStr, err := db.DB.Rc.Fetch(extendMsgCache+clientMsgID, time.Second*30*60, getExtendMsg) - if err != nil { - return nil, utils.Wrap(err, "Fetch failed") - } - extendMsg = &mongoDB.ExtendMsg{} - err = json.Unmarshal([]byte(extendMsgStr), extendMsg) - return extendMsg, utils.Wrap(err, "Unmarshal failed") +func (e *ExtendMsgSetCache) getKey(clientMsgID string) string { + return extendMsgCache + clientMsgID +} + +func (e *ExtendMsgSetCache) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, firstModifyTime int64) (extendMsg *unrelation.ExtendMsgModel, err error) { + //getExtendMsg := func() (string, error) { + // extendMsg, err := db.DB.GetExtendMsg(sourceID, sessionType, clientMsgID, firstModifyTime) + // if err != nil { + // return "", utils.Wrap(err, "GetExtendMsgList failed") + // } + // bytes, err := json.Marshal(extendMsg) + // if err != nil { + // return "", utils.Wrap(err, "Marshal failed") + // } + // return string(bytes), nil + //} + //defer func() { + // tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "sourceID", sourceID, "sessionType", + // sessionType, "clientMsgID", clientMsgID, "firstModifyTime", firstModifyTime, "extendMsg", extendMsg) + //}() + //extendMsgStr, err := db.DB.Rc.Fetch(extendMsgCache+clientMsgID, time.Second*30*60, getExtendMsg) + //if err != nil { + // return nil, utils.Wrap(err, "Fetch failed") + //} + //extendMsg = &mongoDB.ExtendMsg{} + //err = json.Unmarshal([]byte(extendMsgStr), extendMsg) + //return extendMsg, utils.Wrap(err, "Unmarshal failed") + return GetCache(ctx, e.rcClient, e.getKey(clientMsgID), e.expireTime, func(ctx context.Context) (*unrelation.ExtendMsgModel, error) { + panic("") + }) + } func (e *ExtendMsgSetCache) DelExtendMsg(ctx context.Context, clientMsgID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "clientMsgID", clientMsgID) }() - return utils.Wrap(db.DB.Rc.TagAsDeleted(extendMsgCache+clientMsgID), "DelExtendMsg err") + return utils.Wrap(e.rcClient.TagAsDeleted(e.getKey(clientMsgID)), "DelExtendMsg err") } diff --git a/pkg/common/db/cache/friend.go b/pkg/common/db/cache/friend.go index 5f7fda202..dfe33f653 100644 --- a/pkg/common/db/cache/friend.go +++ b/pkg/common/db/cache/friend.go @@ -56,27 +56,10 @@ func (f *FriendCacheRedis) getFriendKey(ownerUserID, friendUserID string) string return friendKey + ownerUserID + "-" + friendUserID } -func (f *FriendCacheRedis) GetFriendIDs(ctx context.Context, ownerUserID string, fn func(ctx context.Context, ownerUserID string) (friendIDs []string, err error)) (friendIDs []string, err error) { - getFriendIDs := func() (string, error) { - friendIDs, err := f.friendDB.GetFriendIDs(ctx, ownerUserID) - if err != nil { - return "", err - } - bytes, err := json.Marshal(friendIDs) - if err != nil { - return "", utils.Wrap(err, "") - } - return string(bytes), nil - } - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendIDs", friendIDs) - }() - friendIDsStr, err := f.rcClient.Fetch(f.getFriendIDsKey(ownerUserID), f.expireTime, getFriendIDs) - if err != nil { - return nil, err - } - err = json.Unmarshal([]byte(friendIDsStr), &friendIDs) - return friendIDs, utils.Wrap(err, "") +func (f *FriendCacheRedis) GetFriendIDs(ctx context.Context, ownerUserID string) (friendIDs []string, err error) { + return GetCache(ctx, f.rcClient, f.getFriendIDsKey(ownerUserID), f.expireTime, func(ctx context.Context) ([]string, error) { + return f.friendDB.FindFriendUserIDs(ctx, ownerUserID) + }) } func (f *FriendCacheRedis) DelFriendIDs(ctx context.Context, ownerUserID string) (err error) { diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index 0e8322f0d..69b991ed7 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -2,7 +2,7 @@ package cache import ( relationTb "Open_IM/pkg/common/db/table/relation" - "Open_IM/pkg/common/db/unrelation" + unrelation2 "Open_IM/pkg/common/db/table/unrelation" "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" "context" @@ -51,17 +51,36 @@ type GroupCache interface { DelGroupMemberNum(ctx context.Context, groupID string) (err error) } +type GroupCacheRedisInterface interface { + GetGroupsInfo(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) + GetGroupInfo(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) + BatchDelJoinedSuperGroupIDs(ctx context.Context, userIDs []string) (err error) + DelJoinedSuperGroupIDs(ctx context.Context, userID string) (err error) + GetJoinedSuperGroupIDs(ctx context.Context, userID string) (joinedSuperGroupIDs []string, err error) + GetGroupMembersHash(ctx context.Context, groupID string) (hashCodeUint64 uint64, err error) + GetGroupMemberHash1(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) + DelGroupMembersHash(ctx context.Context, groupID string) (err error) + GetGroupMemberIDs(ctx context.Context, groupID string) (groupMemberIDs []string, err error) + DelGroupMemberIDs(ctx context.Context, groupID string) (err error) + DelJoinedGroupID(ctx context.Context, userID string) (err error) + GetGroupMemberInfo(ctx context.Context, groupID, userID string) (groupMember *relationTb.GroupMemberModel, err error) + DelGroupMemberInfo(ctx context.Context, groupID, userID string) (err error) + DelGroupMemberNum(ctx context.Context, groupID string) (err error) + DelGroupInfo(ctx context.Context, groupID string) (err error) + DelGroupsInfo(ctx context.Context, groupIDs []string) error +} + type GroupCacheRedis struct { group relationTb.GroupModelInterface groupMember relationTb.GroupMemberModelInterface groupRequest relationTb.GroupRequestModelInterface - mongoDB *unrelation.SuperGroupMongoDriver + mongoDB unrelation2.SuperGroupModelInterface expireTime time.Duration redisClient *RedisClient rcClient *rockscache.Client } -func NewGroupCacheRedis(rdb redis.UniversalClient, groupDB relationTb.GroupModelInterface, groupMemberDB relationTb.GroupMemberModelInterface, groupRequestDB relationTb.GroupRequestModelInterface, mongoClient *unrelation.SuperGroupMongoDriver, opts rockscache.Options) *GroupCacheRedis { +func NewGroupCacheRedis(rdb redis.UniversalClient, groupDB relationTb.GroupModelInterface, groupMemberDB relationTb.GroupMemberModelInterface, groupRequestDB relationTb.GroupRequestModelInterface, mongoClient unrelation2.SuperGroupModelInterface, opts rockscache.Options) GroupCacheRedisInterface { return &GroupCacheRedis{rcClient: rockscache.NewClient(rdb, opts), expireTime: groupExpireTime, group: groupDB, groupMember: groupMemberDB, groupRequest: groupRequestDB, redisClient: NewRedisClient(rdb), mongoDB: mongoClient, diff --git a/pkg/common/db/cache/redis.go b/pkg/common/db/cache/redis.go index 6d83cae9c..05129f93a 100644 --- a/pkg/common/db/cache/redis.go +++ b/pkg/common/db/cache/redis.go @@ -35,6 +35,8 @@ const ( sendMsgFailedFlag = "SEND_MSG_FAILED_FLAG:" userBadgeUnreadCountSum = "USER_BADGE_UNREAD_COUNT_SUM:" exTypeKeyLocker = "EX_LOCK:" + + uidPidToken = "UID_PID_TOKEN_STATUS:" ) type Cache interface { @@ -52,7 +54,9 @@ type Cache interface { SetGroupMinSeq(ctx context.Context, groupID string, minSeq int64) error AddTokenFlag(ctx context.Context, userID string, platformID int, token string, flag int) error - GetTokenMapByUidPid(ctx context.Context, userID, platformID string) (map[string]int, error) + + GetTokensWithoutError(ctx context.Context, userID, platformID string) (map[string]int, error) + SetTokenMapByUidPid(ctx context.Context, userID string, platformID int, m map[string]int) error DeleteTokenByUidPid(ctx context.Context, userID string, platformID int, fields []string) error GetMessageListBySeq(ctx context.Context, userID string, seqList []int64) (seqMsg []*sdkws.MsgData, failedSeqList []int64, err error) @@ -139,6 +143,10 @@ func NewRedisClient(rdb redis.UniversalClient) *RedisClient { return &RedisClient{rdb: rdb} } +func (r *RedisClient) GetClient() redis.UniversalClient { + return r.rdb +} + // Perform seq auto-increment operation of user messages func (r *RedisClient) IncrUserSeq(ctx context.Context, uid string) (int64, error) { key := userIncrSeq + uid @@ -205,11 +213,12 @@ func (r *RedisClient) SetGroupMinSeq(ctx context.Context, groupID string, minSeq } // Store userid and platform class to redis -func (r *RedisClient) AddTokenFlag(ctx context.Context, userID string, platformID int, token string, flag int) error { - key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID) +func (r *RedisClient) AddTokenFlag(ctx context.Context, userID string, platform string, token string, flag int) error { + key := uidPidToken + userID + ":" + platform return r.rdb.HSet(context.Background(), key, token, flag).Err() } +//key:userID+platform-> func (r *RedisClient) GetTokenMapByUidPid(ctx context.Context, userID, platformID string) (map[string]int, error) { key := uidPidToken + userID + ":" + platformID m, err := r.rdb.HGetAll(context.Background(), key).Result() @@ -219,8 +228,22 @@ func (r *RedisClient) GetTokenMapByUidPid(ctx context.Context, userID, platformI } return mm, err } -func (r *RedisClient) SetTokenMapByUidPid(ctx context.Context, userID string, platformID int, m map[string]int) error { - key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID) + +func (r *RedisClient) GetTokensWithoutError(ctx context.Context, userID, platform string) (map[string]int, error) { + key := uidPidToken + userID + ":" + platform + m, err := r.rdb.HGetAll(context.Background(), key).Result() + if err != nil && err == redis.Nil { + return nil, nil + } + mm := make(map[string]int) + for k, v := range m { + mm[k] = utils.StringToInt(v) + } + return mm, utils.Wrap(err, "") +} + +func (r *RedisClient) SetTokenMapByUidPid(ctx context.Context, userID string, platform string, m map[string]int) error { + key := uidPidToken + userID + ":" + platform mm := make(map[string]interface{}) for k, v := range m { mm[k] = v @@ -228,8 +251,8 @@ func (r *RedisClient) SetTokenMapByUidPid(ctx context.Context, userID string, pl return r.rdb.HSet(context.Background(), key, mm).Err() } -func (r *RedisClient) DeleteTokenByUidPid(ctx context.Context, userID string, platformID int, fields []string) error { - key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID) +func (r *RedisClient) DeleteTokenByUidPid(ctx context.Context, userID string, platform string, fields []string) error { + key := uidPidToken + userID + ":" + platform return r.rdb.HDel(context.Background(), key, fields...).Err() } diff --git a/pkg/common/db/cache/rockscache.go b/pkg/common/db/cache/rockscache.go index 066c7367f..1984113fe 100644 --- a/pkg/common/db/cache/rockscache.go +++ b/pkg/common/db/cache/rockscache.go @@ -10,38 +10,36 @@ import ( const scanCount = 3000 - -func (rc *RcClient) DelKeys() { - for _, key := range []string{"GROUP_CACHE:", "FRIEND_RELATION_CACHE", "BLACK_LIST_CACHE:", "USER_INFO_CACHE:", "GROUP_INFO_CACHE", groupOwnerIDCache, joinedGroupListCache, - groupMemberInfoCache, groupAllMemberInfoCache, "ALL_FRIEND_INFO_CACHE:"} { - fName := utils.GetSelfFuncName() - var cursor uint64 - var n int - for { - var keys []string - var err error - keys, cursor, err = rc.rdb.Scan(context.Background(), cursor, key+"*", scanCount).Result() - if err != nil { - panic(err.Error()) - } - n += len(keys) - // for each for redis cluster - for _, key := range keys { - if err = rc.rdb.Del(context.Background(), key).Err(); err != nil { - log.NewError("", fName, key, err.Error()) - err = rc.rdb.Del(context.Background(), key).Err() - if err != nil { - panic(err.Error()) - } - } - } - if cursor == 0 { - break - } - } - } -} - +//func (rc *RcClient) DelKeys() { +// for _, key := range []string{"GROUP_CACHE:", "FRIEND_RELATION_CACHE", "BLACK_LIST_CACHE:", "USER_INFO_CACHE:", "GROUP_INFO_CACHE", groupOwnerIDCache, joinedGroupListCache, +// groupMemberInfoCache, groupAllMemberInfoCache, "ALL_FRIEND_INFO_CACHE:"} { +// fName := utils.GetSelfFuncName() +// var cursor uint64 +// var n int +// for { +// var keys []string +// var err error +// keys, cursor, err = rc.rdb.Scan(context.Background(), cursor, key+"*", scanCount).Result() +// if err != nil { +// panic(err.Error()) +// } +// n += len(keys) +// // for each for redis cluster +// for _, key := range keys { +// if err = rc.rdb.Del(context.Background(), key).Err(); err != nil { +// log.NewError("", fName, key, err.Error()) +// err = rc.rdb.Del(context.Background(), key).Err() +// if err != nil { +// panic(err.Error()) +// } +// } +// } +// if cursor == 0 { +// break +// } +// } +// } +//} func GetCache[T any](ctx context.Context, rcClient *rockscache.Client, key string, expire time.Duration, fn func(ctx context.Context) (T, error)) (T, error) { var t T diff --git a/pkg/common/db/cache/token.go b/pkg/common/db/cache/token.go index b54792f2e..c343c759b 100644 --- a/pkg/common/db/cache/token.go +++ b/pkg/common/db/cache/token.go @@ -5,14 +5,9 @@ import ( "Open_IM/pkg/common/tokenverify" "Open_IM/pkg/utils" "context" - "github.com/go-redis/redis/v8" "github.com/golang-jwt/jwt/v4" ) -const ( - uidPidToken = "UID_PID_TOKEN_STATUS:" -) - type Token interface { //结果为空 不返回错误 GetTokensWithoutError(ctx context.Context, userID, platform string) (map[string]int, error) @@ -21,9 +16,9 @@ type Token interface { } type TokenRedis struct { - RedisClient *RedisClient - AccessSecret string - AccessExpire int64 + redisClient *RedisClient + accessSecret string + accessExpire int64 } func NewTokenRedis(redisClient *RedisClient, accessSecret string, accessExpire int64) *TokenRedis { @@ -32,21 +27,12 @@ func NewTokenRedis(redisClient *RedisClient, accessSecret string, accessExpire i // 结果为空 不返回错误 func (t *TokenRedis) GetTokensWithoutError(ctx context.Context, userID, platform string) (map[string]int, error) { - key := uidPidToken + userID + ":" + platform - m, err := t.RedisClient.GetClient().HGetAll(context.Background(), key).Result() - if err != nil && err == redis.Nil { - return nil, nil - } - mm := make(map[string]int) - for k, v := range m { - mm[k] = utils.StringToInt(v) - } - return mm, utils.Wrap(err, "") + return t.redisClient.GetTokensWithoutError(ctx, userID, platform) } // 创建token func (t *TokenRedis) CreateToken(ctx context.Context, userID string, platform string) (string, error) { - tokens, err := t.GetTokensWithoutError(ctx, userID, platform) + tokens, err := t.redisClient.GetTokensWithoutError(ctx, userID, platform) if err != nil { return "", err } @@ -58,18 +44,16 @@ func (t *TokenRedis) CreateToken(ctx context.Context, userID string, platform st } } if len(deleteTokenKey) != 0 { - key := uidPidToken + userID + ":" + platform - err := t.RedisClient.GetClient().HDel(context.Background(), key, deleteTokenKey...).Err() + err := t.redisClient.DeleteTokenByUidPid(ctx, userID, platform, deleteTokenKey) if err != nil { return "", err } } - claims := tokenverify.BuildClaims(userID, platform, t.AccessExpire) + claims := tokenverify.BuildClaims(userID, platform, t.accessExpire) token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) - tokenString, err := token.SignedString([]byte(t.AccessSecret)) + tokenString, err := token.SignedString([]byte(t.accessSecret)) if err != nil { return "", utils.Wrap(err, "") } - key := uidPidToken + userID + ":" + platform - return "", utils.Wrap(t.RedisClient.GetClient().HSet(context.Background(), key, tokenString, constant.NormalToken).Err(), "") + return tokenString, t.redisClient.AddTokenFlag(ctx, userID, platform, tokenString, constant.NormalToken) } diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go index 8fed34ebb..3be508189 100644 --- a/pkg/common/db/cache/user.go +++ b/pkg/common/db/cache/user.go @@ -73,13 +73,13 @@ func (u *UserCacheRedis) GetUserInfo(ctx context.Context, userID string) (userIn func (u *UserCacheRedis) GetUsersInfo(ctx context.Context, userIDs []string) ([]*relationTb.UserModel, error) { var users []*relationTb.UserModel - for _, userID := range userIDs { - user, err := GetUserInfoFromCache(ctx, userID) - if err != nil { - return nil, err - } - users = append(users, user) - } + //for _, userID := range userIDs { + // user, err := GetUserInfoFromCache(ctx, userID) + // if err != nil { + // return nil, err + // } + // users = append(users, user) + //} return users, nil } diff --git a/pkg/common/db/controller/auth.go b/pkg/common/db/controller/auth.go index ad485f117..0c31c8691 100644 --- a/pkg/common/db/controller/auth.go +++ b/pkg/common/db/controller/auth.go @@ -9,7 +9,6 @@ import ( type AuthInterface interface { //结果为空 不返回错误 GetTokensWithoutError(ctx context.Context, userID, platform string) (map[string]int, error) - //创建token CreateToken(ctx context.Context, userID string, platform string) (string, error) } diff --git a/pkg/common/db/controller/black.go b/pkg/common/db/controller/black.go index 6897b4974..3647cbc12 100644 --- a/pkg/common/db/controller/black.go +++ b/pkg/common/db/controller/black.go @@ -1,14 +1,14 @@ package controller import ( - relation2 "Open_IM/pkg/common/db/relation" "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/utils" "context" "errors" "gorm.io/gorm" ) -type BlackInterface interface { +type BlackDatabase interface { // Create 增加黑名单 Create(ctx context.Context, blacks []*relation.BlackModel) (err error) // Delete 删除黑名单 @@ -19,75 +19,32 @@ type BlackInterface interface { CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) } -type BlackController struct { - database BlackDatabaseInterface +type blackDatabase struct { + black relation.BlackModelInterface } -func NewBlackController(db *gorm.DB) *BlackController { - return &BlackController{database: NewBlackDatabase(db)} +func NewBlackDatabase(black relation.BlackModelInterface) BlackDatabase { + return &blackDatabase{black} } // Create 增加黑名单 -func (b *BlackController) Create(ctx context.Context, blacks []*relation.BlackModel) (err error) { - return b.database.Create(ctx, blacks) +func (b *blackDatabase) Create(ctx context.Context, blacks []*relation.BlackModel) (err error) { + return b.black.Create(ctx, blacks) } // Delete 删除黑名单 -func (b *BlackController) Delete(ctx context.Context, blacks []*relation.BlackModel) (err error) { - return b.database.Delete(ctx, blacks) +func (b *blackDatabase) Delete(ctx context.Context, blacks []*relation.BlackModel) (err error) { + return b.black.Delete(ctx, blacks) } // FindOwnerBlacks 获取黑名单列表 -func (b *BlackController) FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blackList []*relation.BlackModel, total int64, err error) { - return b.database.FindOwnerBlacks(ctx, ownerUserID, pageNumber, showNumber) +func (b *blackDatabase) FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*relation.BlackModel, total int64, err error) { + return b.black.FindOwnerBlacks(ctx, ownerUserID, pageNumber, showNumber) } // CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true) -func (b *BlackController) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) { - return b.database.CheckIn(ctx, userID1, userID2) -} - -type BlackDatabaseInterface interface { - // Create 增加黑名单 - Create(ctx context.Context, blacks []*relation.BlackModel) (err error) - // Delete 删除黑名单 - Delete(ctx context.Context, blacks []*relation.BlackModel) (err error) - // FindOwnerBlacks 获取黑名单列表 - FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*relation.BlackModel, total int64, err error) - // CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true) - CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) -} - -type BlackDatabase struct { - sqlDB *relation2.BlackGorm -} - -func NewBlackDatabase(db *gorm.DB) *BlackDatabase { - sqlDB := relation2.NewBlackGorm(db) - database := &BlackDatabase{ - sqlDB: sqlDB, - } - return database -} - -// Create 增加黑名单 -func (b *BlackDatabase) Create(ctx context.Context, blacks []*relation.BlackModel) (err error) { - return b.sqlDB.Create(ctx, blacks) -} - -// Delete 删除黑名单 -func (b *BlackDatabase) Delete(ctx context.Context, blacks []*relation.BlackModel) (err error) { - return b.sqlDB.Delete(ctx, blacks) -} - -// FindOwnerBlacks 获取黑名单列表 -func (b *BlackDatabase) FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*relation.BlackModel, total int64, err error) { - return b.sqlDB.FindOwnerBlacks(ctx, ownerUserID, pageNumber, showNumber) -} - -// CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true) -func (b *BlackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) { - _, err = b.sqlDB.Take(ctx, userID1, userID2) +func (b *blackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error) { + _, err = b.black.Take(ctx, userID1, userID2) if err != nil { if errors.Unwrap(err) != gorm.ErrRecordNotFound { return @@ -98,9 +55,9 @@ func (b *BlackDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (i } inUser2Blacks = true - _, err = b.sqlDB.Take(ctx, userID2, userID1) + _, err = b.black.Take(ctx, userID2, userID1) if err != nil { - if errors.Unwrap(err) != gorm.ErrRecordNotFound { + if utils.Unwrap(err) != gorm.ErrRecordNotFound { return } inUser2Blacks = false diff --git a/pkg/common/db/controller/chatlog.go b/pkg/common/db/controller/chatlog.go index 393f81630..024da2641 100644 --- a/pkg/common/db/controller/chatlog.go +++ b/pkg/common/db/controller/chatlog.go @@ -9,7 +9,7 @@ import ( type ChatLogInterface interface { CreateChatLog(msg pbMsg.MsgDataToMQ) error - GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) + GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relationTb.ChatLogModel, error) } func NewChatLogController(db *gorm.DB) ChatLogInterface { @@ -24,17 +24,17 @@ func (c *ChatLogController) CreateChatLog(msg pbMsg.MsgDataToMQ) error { return c.database.CreateChatLog(msg) } -func (c *ChatLogController) GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) { +func (c *ChatLogController) GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relationTb.ChatLogModel, error) { return c.database.GetChatLog(chatLog, pageNumber, showNumber, contentTypeList) } type ChatLogDataBaseInterface interface { CreateChatLog(msg pbMsg.MsgDataToMQ) error - GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) + GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relationTb.ChatLogModel, error) } type ChatLogDataBase struct { - chatLogDB *relationTb.ChatLogModelInterface + chatLogDB relationTb.ChatLogModelInterface } func NewChatLogDataBase(db *gorm.DB) ChatLogDataBaseInterface { @@ -45,6 +45,6 @@ func (c *ChatLogDataBase) CreateChatLog(msg pbMsg.MsgDataToMQ) error { return c.chatLogDB.Create(msg) } -func (c *ChatLogDataBase) GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relation.ChatLog, error) { +func (c *ChatLogDataBase) GetChatLog(chatLog *relationTb.ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []relationTb.ChatLogModel, error) { return c.chatLogDB.GetChatLog(chatLog, pageNumber, showNumber, contentTypeList) } diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go index 863026909..d1bf65996 100644 --- a/pkg/common/db/controller/conversation.go +++ b/pkg/common/db/controller/conversation.go @@ -1,6 +1,7 @@ package controller import ( + "Open_IM/internal/tx" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db/cache" "Open_IM/pkg/common/db/relation" @@ -8,68 +9,8 @@ import ( "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 - //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, 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} -} - -func (c *ConversationController) GetUserIDExistConversation(ctx context.Context, userIDList []string, conversationID string) ([]string, error) { - return c.database.GetUserIDExistConversation(ctx, userIDList, conversationID) -} - -func (c ConversationController) UpdateUsersConversationFiled(ctx context.Context, UserIDList []string, conversationID string, args map[string]interface{}) error { - return c.database.UpdateUsersConversationFiled(ctx, UserIDList, conversationID, args) -} - -func (c ConversationController) CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error { - return c.database.CreateConversation(ctx, conversations) -} - -func (c ConversationController) SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error { - return c.database.SyncPeerUserPrivateConversationTx(ctx, conversation) -} - -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) { - return c.database.GetUserAllConversation(ctx, ownerUserID) -} -func (c ConversationController) SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error { - return c.database.SetUserConversations(ctx, ownerUserID, conversations) -} - -var _ ConversationInterface = (*ConversationController)(nil) - type ConversationDataBaseInterface interface { //GetUserIDExistConversation 获取拥有该会话的的用户ID列表 GetUserIDExistConversation(ctx context.Context, userIDList []string, conversationID string) ([]string, error) @@ -89,22 +30,29 @@ type ConversationDataBaseInterface interface { SetUsersConversationFiledTx(ctx context.Context, userIDList []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error } -var _ ConversationDataBaseInterface = (*ConversationDataBase)(nil) +func NewConversationDatabase(conversation relation.Conversation, cache cache.ConversationCache, tx tx.Tx) ConversationDataBaseInterface { + return &ConversationDataBase{ + conversationDB: conversation, + cache: cache, + tx: tx, + } +} type ConversationDataBase struct { conversationDB relation.Conversation cache cache.ConversationCache - db *gorm.DB + tx tx.Tx } -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) +func (c *ConversationDataBase) SetUsersConversationFiledTx(ctx context.Context, userIDList []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error { + return c.tx.Transaction(func(tx any) error { + conversationTx := c.conversationDB.NewTx(tx) + haveUserID, err := conversationTx.FindUserID(ctx, userIDList, conversation.ConversationID) if err != nil { return err } if len(haveUserID) > 0 { - err = c.conversationDB.UpdateByMap(ctx, haveUserID, conversation.ConversationID, filedMap, tx) + err = conversationTx.UpdateByMap(ctx, haveUserID, conversation.ConversationID, filedMap) if err != nil { return err } @@ -119,7 +67,7 @@ func (c ConversationDataBase) SetUsersConversationFiledTx(ctx context.Context, u temp.OwnerUserID = v cList = append(cList, temp) } - err = c.conversationDB.Create(ctx, cList) + err = conversationTx.Create(ctx, cList) if err != nil { return err } @@ -137,37 +85,39 @@ func (c ConversationDataBase) SetUsersConversationFiledTx(ctx context.Context, u }) } -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) { +func (c *ConversationDataBase) GetUserIDExistConversation(ctx context.Context, userIDList []string, conversationID string) ([]string, error) { panic("implement me") } -func (c ConversationDataBase) UpdateUsersConversationFiled(ctx context.Context, UserIDList []string, conversationID string, args map[string]interface{}) error { +func (c *ConversationDataBase) UpdateUsersConversationFiled(ctx context.Context, UserIDList []string, conversationID string, args map[string]interface{}) error { panic("implement me") } -func (c ConversationDataBase) CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error { - panic("implement me") +func (c *ConversationDataBase) CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error { + return c.tx.Transaction(func(tx any) error { + if err := c.conversationDB.NewTx(tx).Create(ctx, conversations); err != nil { + return err + } + // clear cache + return nil + }) } -func (c ConversationDataBase) SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error { - return c.db.Transaction(func(tx *gorm.DB) error { +func (c *ConversationDataBase) SyncPeerUserPrivateConversationTx(ctx context.Context, conversation *relationTb.ConversationModel) error { + return c.tx.Transaction(func(tx any) error { userIDList := []string{conversation.OwnerUserID, conversation.UserID} - haveUserID, err := c.conversationDB.FindUserID(ctx, userIDList, conversation.ConversationID, tx) + conversationTx := c.conversationDB.NewTx(tx) + haveUserID, err := conversationTx.FindUserID(ctx, userIDList, conversation.ConversationID) 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) + err = conversationTx.UpdateByMap(ctx, haveUserID, conversation.ConversationID, filedMap) if err != nil { return err } } - NotUserID := utils.DifferenceString(haveUserID, userIDList) var cList []*relationTb.ConversationModel for _, v := range NotUserID { @@ -204,7 +154,7 @@ func (c ConversationDataBase) SyncPeerUserPrivateConversationTx(ctx context.Cont }) } -func (c ConversationDataBase) FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) { +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 { @@ -219,7 +169,7 @@ func (c ConversationDataBase) FindConversations(ctx context.Context, ownerUserID return c.cache.GetConversations(ctx, ownerUserID, conversationIDs, getConversation) } -func (c ConversationDataBase) GetConversation(ctx context.Context, ownerUserID string, conversationID string) (*relationTb.ConversationModel, error) { +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 { @@ -234,7 +184,7 @@ func (c ConversationDataBase) GetConversation(ctx context.Context, ownerUserID s return c.cache.GetConversation(ctx, ownerUserID, conversationID, getConversation) } -func (c ConversationDataBase) GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) { +func (c *ConversationDataBase) GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) { getConversationIDList := func() (string, error) { conversationIDList, err := c.conversationDB.FindUserIDAllConversationID(ctx, ownerUserID) if err != nil { @@ -252,27 +202,28 @@ func (c ConversationDataBase) GetUserAllConversation(ctx context.Context, ownerU } 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") + conversation, err := c.GetConversation(ctx, ownerUserID, conversationID) + if err != nil { + return nil, utils.Wrap(err, "GetConversation failed") } conversations = append(conversations, conversation) } return conversations, nil } -func (c ConversationDataBase) SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error { - return c.db.Transaction(func(tx *gorm.DB) error { +func (c *ConversationDataBase) SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error { + return c.tx.Transaction(func(tx any) error { var conversationIDList []string for _, conversation := range conversations { conversationIDList = append(conversationIDList, conversation.ConversationID) } - haveConversations, err := c.conversationDB.Find(ctx, ownerUserID, conversationIDList, tx) + conversationTx := c.conversationDB.NewTx(tx) + haveConversations, err := conversationTx.Find(ctx, ownerUserID, conversationIDList) if err != nil { return err } if len(haveConversations) > 0 { - err = c.conversationDB.Update(ctx, conversations, tx) + err = conversationTx.Update(ctx, conversations) if err != nil { return err } diff --git a/pkg/common/db/controller/extend_msg.go b/pkg/common/db/controller/extend_msg.go index ba0bf5b25..4f62f8925 100644 --- a/pkg/common/db/controller/extend_msg.go +++ b/pkg/common/db/controller/extend_msg.go @@ -88,12 +88,12 @@ func (e *ExtendMsgDatabase) InsertExtendMsg(ctx context.Context, sourceID string } func (e *ExtendMsgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error { - return e.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList) + return e.model.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList) } func (e *ExtendMsgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error { - return e.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList) + return e.model.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList) } func (e *ExtendMsgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) { - return e.GetExtendMsg(ctx, sourceID, sessionType, clientMsgID, maxMsgUpdateTime) + return e.model.TakeExtendMsg(ctx, sourceID, sessionType, clientMsgID, maxMsgUpdateTime) } diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go index ea322a9d3..4afde6f43 100644 --- a/pkg/common/db/controller/friend.go +++ b/pkg/common/db/controller/friend.go @@ -1,8 +1,8 @@ package controller import ( + "Open_IM/internal/tx" "Open_IM/pkg/common/constant" - relation1 "Open_IM/pkg/common/db/relation" "Open_IM/pkg/common/db/table/relation" "Open_IM/pkg/utils" "context" @@ -10,102 +10,7 @@ import ( "gorm.io/gorm" ) -type FriendInterface interface { - // 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true) - CheckIn(ctx context.Context, user1, user2 string) (inUser1Friends bool, inUser2Friends bool, err error) - // 增加或者更新好友申请 如果之前有记录则更新,没有记录则新增 - AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) - // (1)先判断是否在好友表 (在不在都不返回错误) (2)对于不在好友列表的 插入即可 - BecomeFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, addSource int32, OperatorUserID string) (err error) - // 拒绝好友申请 (1)检查是否有申请记录且为未处理状态 (没有记录返回错误) (2)修改申请记录 已拒绝 - RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) - // 同意好友申请 (1)检查是否有申请记录且为未处理状态 (没有记录返回错误) (2)检查是否好友(不返回错误) (3) 不是好友则建立双向好友关系 (4)修改申请记录 已同意 - AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) - // 删除好友 外部判断是否好友关系 - Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) - // 更新好友备注 零值也支持 - UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) - // 获取ownerUserID的好友列表 无结果不返回错误 - PageOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) - // friendUserID在哪些人的好友列表中 - PageInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) - // 获取我发出去的好友申请 无结果不返回错误 - PageFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) - // 获取我收到的的好友申请 无结果不返回错误 - PageFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) - // 获取某人指定好友的信息 如果有一个不存在也返回错误 - FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error) -} - -type FriendController struct { - database FriendDatabaseInterface -} - -func NewFriendController(db *gorm.DB) *FriendController { - return &FriendController{database: NewFriendDatabase(db)} -} - -// 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true) -func (f *FriendController) CheckIn(ctx context.Context, user1, user2 string) (inUser1Friends bool, inUser2Friends bool, err error) { - return f.database.CheckIn(ctx, user1, user2) -} - -// AddFriendRequest 增加或者更新好友申请 -func (f *FriendController) AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) { - return f.database.AddFriendRequest(ctx, fromUserID, toUserID, reqMsg, ex) -} - -// BecomeFriend 先判断是否在好友表,如果在则不插入 -func (f *FriendController) BecomeFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, addSource int32, OperatorUserID string) (err error) { - return f.database.BecomeFriends(ctx, ownerUserID, friendUserIDs, addSource, OperatorUserID) -} - -// RefuseFriendRequest 拒绝好友申请 -func (f *FriendController) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { - return f.database.RefuseFriendRequest(ctx, friendRequest) -} - -// AgreeFriendRequest 同意好友申请 -func (f *FriendController) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { - return f.database.AgreeFriendRequest(ctx, friendRequest) -} - -// Delete 删除好友 -func (f *FriendController) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) { - return f.database.Delete(ctx, ownerUserID, friendUserIDs) -} - -// UpdateRemark 更新好友备注 -func (f *FriendController) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { - return f.database.UpdateRemark(ctx, ownerUserID, friendUserID, remark) -} - -// FindOwnerFriends 获取ownerUserID的好友列表 -func (f *FriendController) PageOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { - return f.database.PageOwnerFriends(ctx, ownerUserID, pageNumber, showNumber) -} - -// FindInWhoseFriends friendUserID在哪些人的好友列表中 -func (f *FriendController) PageInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { - return f.database.PageInWhoseFriends(ctx, friendUserID, pageNumber, showNumber) -} - -// FindFriendRequestFromMe 获取我发出去的好友申请 -func (f *FriendController) PageFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) { - return f.database.PageFriendRequestFromMe(ctx, userID, pageNumber, showNumber) -} - -// FindFriendRequestToMe 获取我收到的的好友申请 -func (f *FriendController) PageFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) { - return f.database.PageFriendRequestToMe(ctx, userID, pageNumber, showNumber) -} - -// FindFriends 获取某人指定好友的信息 -func (f *FriendController) FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error) { - return f.database.FindFriendsWithError(ctx, ownerUserID, friendUserIDs) -} - -type FriendDatabaseInterface interface { +type FriendDatabase interface { // 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true) CheckIn(ctx context.Context, user1, user2 string) (inUser1Friends bool, inUser2Friends bool, err error) // 增加或者更新好友申请 @@ -132,17 +37,18 @@ type FriendDatabaseInterface interface { FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error) } -type FriendDatabase struct { - friend *relation1.FriendGorm - friendRequest *relation1.FriendRequestGorm +type friendDatabase struct { + friend relation.FriendModelInterface + friendRequest relation.FriendRequestModelInterface + tx tx.Tx } -func NewFriendDatabase(db *gorm.DB) *FriendDatabase { - return &FriendDatabase{friend: relation1.NewFriendGorm(db), friendRequest: relation1.NewFriendRequestGorm(db)} +func NewFriendDatabase(friend relation.FriendModelInterface, friendRequest relation.FriendRequestModelInterface, tx tx.Tx) FriendDatabase { + return &friendDatabase{friend: friend, friendRequest: friendRequest, tx: tx} } // ok 检查user2是否在user1的好友列表中(inUser1Friends==true) 检查user1是否在user2的好友列表中(inUser2Friends==true) -func (f *FriendDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Friends bool, inUser2Friends bool, err error) { +func (f *friendDatabase) CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Friends bool, inUser2Friends bool, err error) { friends, err := f.friend.FindUserState(ctx, userID1, userID2) if err != nil { return false, false, err @@ -159,9 +65,9 @@ func (f *FriendDatabase) CheckIn(ctx context.Context, userID1, userID2 string) ( } // 增加或者更新好友申请 如果之前有记录则更新,没有记录则新增 -func (f *FriendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) { - return f.friendRequest.DB.Transaction(func(tx *gorm.DB) error { - _, err := f.friendRequest.Take(ctx, fromUserID, toUserID, tx) +func (f *friendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUserID string, reqMsg string, ex string) (err error) { + return f.tx.Transaction(func(tx any) error { + _, err := f.friendRequest.NewTx(tx).Take(ctx, fromUserID, toUserID) //有db错误 if err != nil && errors.Unwrap(err) != gorm.ErrRecordNotFound { return err @@ -173,13 +79,13 @@ func (f *FriendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUse m["handle_msg"] = "" m["req_msg"] = reqMsg m["ex"] = ex - if err := f.friendRequest.UpdateByMap(ctx, fromUserID, toUserID, m, tx); err != nil { + if err := f.friendRequest.NewTx(tx).UpdateByMap(ctx, fromUserID, toUserID, m); err != nil { return err } return nil } //gorm.ErrRecordNotFound 错误,则新增 - if err := f.friendRequest.Create(ctx, []*relation.FriendRequestModel{&relation.FriendRequestModel{FromUserID: fromUserID, ToUserID: toUserID, ReqMsg: reqMsg, Ex: ex}}, tx); err != nil { + if err := f.friendRequest.NewTx(tx).Create(ctx, []*relation.FriendRequestModel{&relation.FriendRequestModel{FromUserID: fromUserID, ToUserID: toUserID, ReqMsg: reqMsg, Ex: ex}}); err != nil { return err } return nil @@ -187,10 +93,10 @@ func (f *FriendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUse } // (1)先判断是否在好友表 (在不在都不返回错误) (2)对于不在好友列表的 插入即可 -func (f *FriendDatabase) BecomeFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, addSource int32, OperatorUserID string) (err error) { - return f.friend.DB.Transaction(func(tx *gorm.DB) error { +func (f *friendDatabase) BecomeFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, addSource int32, OperatorUserID string) (err error) { + return f.tx.Transaction(func(tx any) error { //先find 找出重复的 去掉重复的 - fs1, err := f.friend.FindFriends(ctx, ownerUserID, friendUserIDs, tx) + fs1, err := f.friend.NewTx(tx).FindFriends(ctx, ownerUserID, friendUserIDs) if err != nil { return err } @@ -201,12 +107,12 @@ func (f *FriendDatabase) BecomeFriends(ctx context.Context, ownerUserID string, return e.FriendUserID }) - err = f.friend.Create(ctx, fs11, tx) + err = f.friend.NewTx(tx).Create(ctx, fs11) if err != nil { return err } - fs2, err := f.friend.FindReversalFriends(ctx, ownerUserID, friendUserIDs, tx) + fs2, err := f.friend.NewTx(tx).FindReversalFriends(ctx, ownerUserID, friendUserIDs) if err != nil { return err } @@ -216,7 +122,7 @@ func (f *FriendDatabase) BecomeFriends(ctx context.Context, ownerUserID string, fs22 := utils.DistinctAny(fs2, func(e *relation.FriendModel) string { return e.OwnerUserID }) - err = f.friend.Create(ctx, fs22, tx) + err = f.friend.NewTx(tx).Create(ctx, fs22) if err != nil { return err } @@ -225,7 +131,7 @@ func (f *FriendDatabase) BecomeFriends(ctx context.Context, ownerUserID string, } // 拒绝好友申请 (1)检查是否有申请记录且为未处理状态 (没有记录返回错误) (2)修改申请记录 已拒绝 -func (f *FriendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { +func (f *friendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { _, err = f.friendRequest.Take(ctx, friendRequest.FromUserID, friendRequest.ToUserID) if err != nil { return err @@ -239,15 +145,15 @@ func (f *FriendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest } // 同意好友申请 (1)检查是否有申请记录且为未处理状态 (没有记录返回错误) (2)检查是否好友(不返回错误) (3) 不是好友则建立双向好友关系 (4)修改申请记录 已同意 -func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { - return f.friend.DB.Transaction(func(tx *gorm.DB) error { - _, err = f.friendRequest.Take(ctx, friendRequest.FromUserID, friendRequest.ToUserID) +func (f *friendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { + return f.tx.Transaction(func(tx any) error { + _, err = f.friendRequest.NewTx(tx).Take(ctx, friendRequest.FromUserID, friendRequest.ToUserID) if err != nil { return err } friendRequest.HandlerUserID = friendRequest.FromUserID friendRequest.HandleResult = constant.FriendResponseAgree - err = f.friendRequest.Update(ctx, []*relation.FriendRequestModel{friendRequest}, tx) + err = f.friendRequest.NewTx(tx).Update(ctx, []*relation.FriendRequestModel{friendRequest}) if err != nil { return err } @@ -257,7 +163,7 @@ func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest * addSource := int32(constant.BecomeFriendByApply) OperatorUserID := friendRequest.FromUserID //先find 找出重复的 去掉重复的 - fs1, err := f.friend.FindFriends(ctx, ownerUserID, friendUserIDs, tx) + fs1, err := f.friend.NewTx(tx).FindFriends(ctx, ownerUserID, friendUserIDs) if err != nil { return err } @@ -268,12 +174,12 @@ func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest * return e.FriendUserID }) - err = f.friend.Create(ctx, fs11, tx) + err = f.friend.NewTx(tx).Create(ctx, fs11) if err != nil { return err } - fs2, err := f.friend.FindReversalFriends(ctx, ownerUserID, friendUserIDs, tx) + fs2, err := f.friend.NewTx(tx).FindReversalFriends(ctx, ownerUserID, friendUserIDs) if err != nil { return err } @@ -283,7 +189,7 @@ func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest * fs22 := utils.DistinctAny(fs2, func(e *relation.FriendModel) string { return e.OwnerUserID }) - err = f.friend.Create(ctx, fs22, tx) + err = f.friend.NewTx(tx).Create(ctx, fs22) if err != nil { return err } @@ -292,37 +198,37 @@ func (f *FriendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest * } // 删除好友 外部判断是否好友关系 -func (f *FriendDatabase) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) { +func (f *friendDatabase) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) { return f.friend.Delete(ctx, ownerUserID, friendUserIDs) } // 更新好友备注 零值也支持 -func (f *FriendDatabase) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { +func (f *friendDatabase) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { return f.friend.UpdateRemark(ctx, ownerUserID, friendUserID, remark) } // 获取ownerUserID的好友列表 无结果不返回错误 -func (f *FriendDatabase) PageOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { +func (f *friendDatabase) PageOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { return f.friend.FindOwnerFriends(ctx, ownerUserID, pageNumber, showNumber) } // friendUserID在哪些人的好友列表中 -func (f *FriendDatabase) PageInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { +func (f *friendDatabase) PageInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { return f.friend.FindInWhoseFriends(ctx, friendUserID, pageNumber, showNumber) } // 获取我发出去的好友申请 无结果不返回错误 -func (f *FriendDatabase) PageFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) { +func (f *friendDatabase) PageFriendRequestFromMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) { return f.friendRequest.FindFromUserID(ctx, userID, pageNumber, showNumber) } // 获取我收到的的好友申请 无结果不返回错误 -func (f *FriendDatabase) PageFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) { +func (f *friendDatabase) PageFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error) { return f.friendRequest.FindToUserID(ctx, userID, pageNumber, showNumber) } // 获取某人指定好友的信息 如果有好友不存在,也返回错误 -func (f *FriendDatabase) FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error) { +func (f *friendDatabase) FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error) { friends, err = f.friend.FindFriends(ctx, ownerUserID, friendUserIDs) if err != nil { return diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index a52da4a53..232b3bdc4 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -1,25 +1,21 @@ package controller import ( + "Open_IM/internal/tx" "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" unRelationTb "Open_IM/pkg/common/db/table/unrelation" - "Open_IM/pkg/common/db/unrelation" "Open_IM/pkg/utils" "context" "fmt" "github.com/dtm-labs/rockscache" _ "github.com/dtm-labs/rockscache" "github.com/go-redis/redis/v8" - "go.mongodb.org/mongo-driver/mongo" - "gorm.io/gorm" ) -//type GroupInterface GroupDataBaseInterface - -type GroupInterface interface { +type GroupDatabase interface { + // Group 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) @@ -45,217 +41,7 @@ type GroupInterface 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) - // SuperGroup - FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unRelationTb.SuperGroupModel, error) - FindJoinSuperGroup(ctx context.Context, userID string) (superGroup *unRelationTb.UserToSuperGroupModel, err 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 -} - -var _ GroupInterface = (*GroupController)(nil) - -func NewGroupInterface(database GroupDataBaseInterface) GroupInterface { - return &GroupController{database: database} -} - -type GroupController struct { - database GroupDataBaseInterface -} - -func (g *GroupController) FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error) { - return g.database.FindGroupMemberUserID(ctx, groupID) -} - -func (g *GroupController) CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error { - return g.database.CreateGroup(ctx, groups, groupMembers) -} - -func (g *GroupController) TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) { - return g.database.TakeGroup(ctx, groupID) -} - -func (g *GroupController) FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) { - return g.database.FindGroup(ctx, groupIDs) -} - -func (g *GroupController) SearchGroup(ctx context.Context, keyword string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupModel, error) { - return g.database.SearchGroup(ctx, keyword, pageNumber, showNumber) -} - -func (g *GroupController) UpdateGroup(ctx context.Context, groupID string, data map[string]any) error { - return g.database.UpdateGroup(ctx, groupID, data) -} - -func (g *GroupController) DismissGroup(ctx context.Context, groupID string) error { - return g.database.DismissGroup(ctx, groupID) -} - -func (g *GroupController) GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) { - return g.database.GetGroupIDsByGroupType(ctx, groupType) -} - -func (g *GroupController) TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationTb.GroupMemberModel, err error) { - return g.database.TakeGroupMember(ctx, groupID, userID) -} - -func (g *GroupController) TakeGroupOwner(ctx context.Context, groupID string) (*relationTb.GroupMemberModel, error) { - return g.database.TakeGroupOwner(ctx, groupID) -} - -func (g *GroupController) FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationTb.GroupMemberModel, error) { - return g.database.FindGroupMember(ctx, groupIDs, userIDs, roleLevels) -} - -func (g *GroupController) PageGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) { - return g.database.PageGroupMember(ctx, groupIDs, userIDs, roleLevels, pageNumber, showNumber) -} - -func (g *GroupController) SearchGroupMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) { - return g.database.SearchGroupMember(ctx, keyword, groupIDs, userIDs, roleLevels, pageNumber, showNumber) -} - -func (g *GroupController) HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relationTb.GroupMemberModel) error { - return g.database.HandlerGroupRequest(ctx, groupID, userID, handledMsg, handleResult, member) -} - -func (g *GroupController) DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error { - return g.database.DeleteGroupMember(ctx, groupID, userIDs) -} - -func (g *GroupController) MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) { - return g.database.MapGroupMemberUserID(ctx, groupIDs) -} - -func (g *GroupController) MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) { - return g.database.MapGroupMemberNum(ctx, groupIDs) -} - -func (g *GroupController) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error { - return g.database.TransferGroupOwner(ctx, groupID, oldOwnerUserID, newOwnerUserID, roleLevel) -} - -func (g *GroupController) UpdateGroupMembers(ctx context.Context, data []*relationTb.BatchUpdateGroupMember) error { - return g.database.UpdateGroupMembers(ctx, data) -} - -func (g *GroupController) UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error { - return g.database.UpdateGroupMember(ctx, groupID, userID, data) -} - -func (g *GroupController) CreateGroupRequest(ctx context.Context, requests []*relationTb.GroupRequestModel) error { - return g.database.CreateGroupRequest(ctx, requests) -} - -func (g *GroupController) TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationTb.GroupRequestModel, error) { - return g.database.TakeGroupRequest(ctx, groupID, userID) -} - -func (g *GroupController) PageGroupRequestUser(ctx context.Context, userID string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupRequestModel, error) { - return g.database.PageGroupRequestUser(ctx, userID, pageNumber, showNumber) -} - -func (g *GroupController) FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unRelationTb.SuperGroupModel, error) { - return g.database.FindSuperGroup(ctx, groupIDs) -} - -func (g *GroupController) FindJoinSuperGroup(ctx context.Context, userID string) (*unRelationTb.UserToSuperGroupModel, error) { - return g.database.FindJoinSuperGroup(ctx, userID) -} - -func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error { - return g.database.CreateSuperGroup(ctx, groupID, initMemberIDList) -} - -func (g *GroupController) DeleteSuperGroup(ctx context.Context, groupID string) error { - return g.database.DeleteSuperGroup(ctx, groupID) -} - -func (g *GroupController) DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { - return g.database.DeleteSuperGroupMember(ctx, groupID, userIDs) -} - -func (g *GroupController) CreateSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { - 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 // 解散群,并删除群成员 - GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err 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) - 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 // 解散群,并删除群成员 - GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) - - // GroupMember - 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 - // GroupRequest - 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) - // SuperGroup + // SuperGroupModelInterface 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 @@ -264,42 +50,47 @@ type GroupDataBaseInterface interface { CreateSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error } -func NewGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, mgoClient *mongo.Client) GroupDataBaseInterface { - groupDB := relation.NewGroupDB(db) - groupMemberDB := relation.NewGroupMemberDB(db) - groupRequestDB := relation.NewGroupRequest(db) - newDB := *db - SuperGroupMongoDriver := unrelation.NewSuperGroupMongoDriver(mgoClient) - database := &GroupDataBase{ - groupDB: groupDB, - groupMemberDB: groupMemberDB, - groupRequestDB: groupRequestDB, - db: &newDB, - cache: cache.NewGroupCacheRedis(rdb, groupDB, groupMemberDB, groupRequestDB, SuperGroupMongoDriver, rockscache.Options{ +func NewGroupDatabase( + group relationTb.GroupModelInterface, + member relationTb.GroupMemberModelInterface, + request relationTb.GroupRequestModelInterface, + tx tx.Tx, + ctxTx tx.CtxTx, + super unRelationTb.SuperGroupModelInterface, + client redis.UniversalClient, +) GroupDatabase { + database := &groupDatabase{ + groupDB: group, + groupMemberDB: member, + groupRequestDB: request, + tx: tx, + ctxTx: ctxTx, + cache: cache.NewGroupCacheRedis(client, group, member, request, super, rockscache.Options{ RandomExpireAdjustment: 0.2, DisableCacheRead: false, DisableCacheDelete: false, StrongConsistency: true, }), - mongoDB: SuperGroupMongoDriver, + mongoDB: super, } return database } -var _ GroupDataBaseInterface = (*GroupDataBase)(nil) - -type GroupDataBase struct { +type groupDatabase struct { groupDB relationTb.GroupModelInterface groupMemberDB relationTb.GroupMemberModelInterface groupRequestDB relationTb.GroupRequestModelInterface - db *gorm.DB - - //cache cache.GroupCache - cache *cache.GroupCacheRedis - mongoDB *unrelation.SuperGroupMongoDriver + tx tx.Tx + ctxTx tx.CtxTx + cache cache.GroupCacheRedisInterface + mongoDB unRelationTb.SuperGroupModelInterface } -func (g *GroupDataBase) delGroupMemberCache(ctx context.Context, groupID string, userIDs []string) error { +func (g *groupDatabase) GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) { + return g.groupDB.GetGroupIDsByGroupType(ctx, groupType) +} + +func (g *groupDatabase) delGroupMemberCache(ctx context.Context, groupID string, userIDs []string) error { for _, userID := range userIDs { if err := g.cache.DelJoinedGroupID(ctx, userID); err != nil { return err @@ -320,49 +111,41 @@ func (g *GroupDataBase) delGroupMemberCache(ctx context.Context, groupID string, return nil } -func (g *GroupDataBase) FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error) { +func (g *groupDatabase) FindGroupMemberUserID(ctx context.Context, groupID string) ([]string, error) { return g.cache.GetGroupMemberIDs(ctx, groupID) } -func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error { - return g.db.Transaction(func(tx *gorm.DB) error { +func (g *groupDatabase) CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error { + return g.tx.Transaction(func(tx any) error { if len(groups) > 0 { - if err := g.groupDB.Create(ctx, groups, tx); err != nil { + if err := g.groupDB.NewTx(tx).Create(ctx, groups); err != nil { return err } } if len(groupMembers) > 0 { - if err := g.groupMemberDB.Create(ctx, groupMembers, tx); err != nil { + if err := g.groupMemberDB.NewTx(tx).Create(ctx, groupMembers); 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 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) TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error) { + return g.cache.GetGroupInfo(ctx, groupID) } -func (g *GroupDataBase) FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) { +func (g *groupDatabase) FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) { return g.cache.GetGroupsInfo(ctx, groupIDs) } -func (g *GroupDataBase) SearchGroup(ctx context.Context, keyword string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupModel, error) { +func (g *groupDatabase) SearchGroup(ctx context.Context, keyword string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupModel, error) { return g.groupDB.Search(ctx, keyword, pageNumber, showNumber) } -func (g *GroupDataBase) UpdateGroup(ctx context.Context, groupID string, data map[string]any) error { - return g.db.Transaction(func(tx *gorm.DB) error { - if err := g.groupDB.UpdateMap(ctx, groupID, data, tx); err != nil { +func (g *groupDatabase) UpdateGroup(ctx context.Context, groupID string, data map[string]any) error { + return g.tx.Transaction(func(tx any) error { + if err := g.groupDB.NewTx(tx).UpdateMap(ctx, groupID, data); err != nil { return err } if err := g.cache.DelGroupInfo(ctx, groupID); err != nil { @@ -372,12 +155,12 @@ func (g *GroupDataBase) UpdateGroup(ctx context.Context, groupID string, data ma }) } -func (g *GroupDataBase) DismissGroup(ctx context.Context, groupID string) error { - return g.db.Transaction(func(tx *gorm.DB) error { - if err := g.groupDB.UpdateStatus(ctx, groupID, constant.GroupStatusDismissed, tx); err != nil { +func (g *groupDatabase) DismissGroup(ctx context.Context, groupID string) error { + return g.tx.Transaction(func(tx any) error { + if err := g.groupDB.NewTx(tx).UpdateStatus(ctx, groupID, constant.GroupStatusDismissed); err != nil { return err } - if err := g.groupMemberDB.DeleteGroup(ctx, []string{groupID}, tx); err != nil { + if err := g.groupMemberDB.NewTx(tx).DeleteGroup(ctx, []string{groupID}); err != nil { return err } userIDs, err := g.cache.GetGroupMemberIDs(ctx, groupID) @@ -391,33 +174,33 @@ func (g *GroupDataBase) DismissGroup(ctx context.Context, groupID string) error }) } -func (g *GroupDataBase) TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationTb.GroupMemberModel, err error) { +func (g *groupDatabase) TakeGroupMember(ctx context.Context, groupID string, userID string) (groupMember *relationTb.GroupMemberModel, err error) { return g.cache.GetGroupMemberInfo(ctx, groupID, userID) } -func (g *GroupDataBase) TakeGroupOwner(ctx context.Context, groupID string) (*relationTb.GroupMemberModel, error) { +func (g *groupDatabase) TakeGroupOwner(ctx context.Context, groupID string) (*relationTb.GroupMemberModel, error) { 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) { +func (g *groupDatabase) FindGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) ([]*relationTb.GroupMemberModel, error) { 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) { +func (g *groupDatabase) PageGroupMember(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) { return g.groupMemberDB.SearchMember(ctx, "", groupIDs, userIDs, roleLevels, pageNumber, showNumber) } -func (g *GroupDataBase) SearchGroupMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) { +func (g *groupDatabase) SearchGroupMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (uint32, []*relationTb.GroupMemberModel, error) { return g.groupMemberDB.SearchMember(ctx, keyword, groupIDs, userIDs, roleLevels, pageNumber, showNumber) } -func (g *GroupDataBase) HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relationTb.GroupMemberModel) error { - return g.db.Transaction(func(tx *gorm.DB) error { - if err := g.groupRequestDB.UpdateHandler(ctx, groupID, userID, handledMsg, handleResult, tx); err != nil { +func (g *groupDatabase) HandlerGroupRequest(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, member *relationTb.GroupMemberModel) error { + return g.tx.Transaction(func(tx any) error { + if err := g.groupRequestDB.NewTx(tx).UpdateHandler(ctx, groupID, userID, handledMsg, handleResult); err != nil { return err } if member != nil { - if err := g.groupMemberDB.Create(ctx, []*relationTb.GroupMemberModel{member}, tx); err != nil { + if err := g.groupMemberDB.NewTx(tx).Create(ctx, []*relationTb.GroupMemberModel{member}); err != nil { return err } if err := g.delGroupMemberCache(ctx, groupID, []string{userID}); err != nil { @@ -428,9 +211,9 @@ func (g *GroupDataBase) HandlerGroupRequest(ctx context.Context, groupID string, }) } -func (g *GroupDataBase) DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error { - return g.db.Transaction(func(tx *gorm.DB) error { - if err := g.groupMemberDB.Delete(ctx, groupID, userIDs, tx); err != nil { +func (g *groupDatabase) DeleteGroupMember(ctx context.Context, groupID string, userIDs []string) error { + return g.tx.Transaction(func(tx any) error { + if err := g.groupMemberDB.NewTx(tx).Delete(ctx, groupID, userIDs); err != nil { return err } if err := g.delGroupMemberCache(ctx, groupID, userIDs); err != nil { @@ -440,24 +223,24 @@ func (g *GroupDataBase) DeleteGroupMember(ctx context.Context, groupID string, u }) } -func (g *GroupDataBase) MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) { +func (g *groupDatabase) MapGroupMemberUserID(ctx context.Context, groupIDs []string) (map[string]*relationTb.GroupSimpleUserID, error) { return g.cache.GetGroupMemberHash1(ctx, groupIDs) } -func (g *GroupDataBase) MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) { +func (g *groupDatabase) MapGroupMemberNum(ctx context.Context, groupIDs []string) (map[string]uint32, error) { return g.groupMemberDB.MapGroupMemberNum(ctx, groupIDs) } -func (g *GroupDataBase) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error { - return g.db.Transaction(func(tx *gorm.DB) error { - rowsAffected, err := g.groupMemberDB.UpdateRoleLevel(ctx, groupID, oldOwnerUserID, roleLevel, tx) +func (g *groupDatabase) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error { + return g.tx.Transaction(func(tx any) error { + rowsAffected, err := g.groupMemberDB.NewTx(tx).UpdateRoleLevel(ctx, groupID, oldOwnerUserID, roleLevel) if err != nil { return err } if rowsAffected != 1 { return utils.Wrap(fmt.Errorf("oldOwnerUserID %s rowsAffected = %d", oldOwnerUserID, rowsAffected), "") } - rowsAffected, err = g.groupMemberDB.UpdateRoleLevel(ctx, groupID, newOwnerUserID, constant.GroupOwner, tx) + rowsAffected, err = g.groupMemberDB.NewTx(tx).UpdateRoleLevel(ctx, groupID, newOwnerUserID, constant.GroupOwner) if err != nil { return err } @@ -471,9 +254,9 @@ func (g *GroupDataBase) TransferGroupOwner(ctx context.Context, groupID string, }) } -func (g *GroupDataBase) UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error { - return g.db.Transaction(func(tx *gorm.DB) error { - if err := g.groupMemberDB.Update(ctx, groupID, userID, data, tx); err != nil { +func (g *groupDatabase) UpdateGroupMember(ctx context.Context, groupID string, userID string, data map[string]any) error { + return g.tx.Transaction(func(tx any) error { + if err := g.groupMemberDB.NewTx(tx).Update(ctx, groupID, userID, data); err != nil { return err } if err := g.cache.DelGroupMemberInfo(ctx, groupID, userID); err != nil { @@ -483,10 +266,10 @@ func (g *GroupDataBase) UpdateGroupMember(ctx context.Context, groupID string, u }) } -func (g *GroupDataBase) UpdateGroupMembers(ctx context.Context, data []*relationTb.BatchUpdateGroupMember) error { - return g.db.Transaction(func(tx *gorm.DB) error { +func (g *groupDatabase) UpdateGroupMembers(ctx context.Context, data []*relationTb.BatchUpdateGroupMember) error { + return g.tx.Transaction(func(tx any) error { for _, item := range data { - if err := g.groupMemberDB.Update(ctx, item.GroupID, item.UserID, item.Map, tx); err != nil { + if err := g.groupMemberDB.NewTx(tx).Update(ctx, item.GroupID, item.UserID, item.Map); err != nil { return err } if err := g.cache.DelGroupMemberInfo(ctx, item.GroupID, item.UserID); err != nil { @@ -497,46 +280,46 @@ func (g *GroupDataBase) UpdateGroupMembers(ctx context.Context, data []*relation }) } -func (g *GroupDataBase) CreateGroupRequest(ctx context.Context, requests []*relationTb.GroupRequestModel) error { +func (g *groupDatabase) CreateGroupRequest(ctx context.Context, requests []*relationTb.GroupRequestModel) error { return g.groupRequestDB.Create(ctx, requests) } -func (g *GroupDataBase) TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationTb.GroupRequestModel, error) { +func (g *groupDatabase) TakeGroupRequest(ctx context.Context, groupID string, userID string) (*relationTb.GroupRequestModel, error) { return g.groupRequestDB.Take(ctx, groupID, userID) } -func (g *GroupDataBase) PageGroupRequestUser(ctx context.Context, userID string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupRequestModel, error) { +func (g *groupDatabase) PageGroupRequestUser(ctx context.Context, userID string, pageNumber, showNumber int32) (uint32, []*relationTb.GroupRequestModel, error) { return g.groupRequestDB.Page(ctx, userID, pageNumber, showNumber) } -func (g *GroupDataBase) FindSuperGroup(ctx context.Context, groupIDs []string) ([]*table.SuperGroupModel, error) { +func (g *groupDatabase) FindSuperGroup(ctx context.Context, groupIDs []string) ([]*unRelationTb.SuperGroupModel, error) { return g.mongoDB.FindSuperGroup(ctx, groupIDs) } -func (g *GroupDataBase) FindJoinSuperGroup(ctx context.Context, userID string) (*table.UserToSuperGroupModel, error) { +func (g *groupDatabase) FindJoinSuperGroup(ctx context.Context, userID string) (*unRelationTb.UserToSuperGroupModel, error) { return g.mongoDB.GetSuperGroupByUserID(ctx, userID) } -func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error { - return unrelation.MongoTransaction(ctx, g.mongoDB.MgoClient, func(tx mongo.SessionContext) error { - return g.mongoDB.CreateSuperGroup(ctx, groupID, initMemberIDList, tx) +func (g *groupDatabase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string) error { + return g.ctxTx.Transaction(ctx, func(ctx context.Context) error { + return g.mongoDB.CreateSuperGroup(ctx, groupID, initMemberIDList) }) } -func (g *GroupDataBase) DeleteSuperGroup(ctx context.Context, groupID string) error { - return unrelation.MongoTransaction(ctx, g.mongoDB.MgoClient, func(tx mongo.SessionContext) error { - return g.mongoDB.DeleteSuperGroup(ctx, groupID, tx) +func (g *groupDatabase) DeleteSuperGroup(ctx context.Context, groupID string) error { + return g.ctxTx.Transaction(ctx, func(ctx context.Context) error { + return g.mongoDB.DeleteSuperGroup(ctx, groupID) }) } -func (g *GroupDataBase) DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { - return unrelation.MongoTransaction(ctx, g.mongoDB.MgoClient, func(tx mongo.SessionContext) error { - return g.mongoDB.RemoverUserFromSuperGroup(ctx, groupID, userIDs, tx) +func (g *groupDatabase) DeleteSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { + return g.ctxTx.Transaction(ctx, func(ctx context.Context) error { + return g.mongoDB.RemoverUserFromSuperGroup(ctx, groupID, userIDs) }) } -func (g *GroupDataBase) CreateSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { - return unrelation.MongoTransaction(ctx, g.mongoDB.MgoClient, func(tx mongo.SessionContext) error { - return g.mongoDB.AddUserToSuperGroup(ctx, groupID, userIDs, tx) +func (g *groupDatabase) CreateSuperGroupMember(ctx context.Context, groupID string, userIDs []string) error { + return g.ctxTx.Transaction(ctx, func(ctx context.Context) error { + return g.mongoDB.AddUserToSuperGroup(ctx, groupID, userIDs) }) } diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index 751ff1530..e1c45dbfb 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -33,7 +33,7 @@ type MsgInterface interface { DelMsgBySeqs(ctx context.Context, userID string, seqs []int64) (totalUnExistSeqs []int64, err error) // 通过seqList获取db中写扩散消息 GetMsgBySeqs(ctx context.Context, userID string, seqs []int64) (seqMsg []*sdkws.MsgData, err error) - // 通过seqList获取大群在db里面的消息 + // 通过seqList获取大群在db里面的消息 没找到返回错误 GetSuperGroupMsgBySeqs(ctx context.Context, groupID string, seqs []int64) (seqMsg []*sdkws.MsgData, err error) // 删除用户所有消息/cache/db然后重置seq CleanUpUserMsg(ctx context.Context, userID string) error @@ -49,6 +49,8 @@ type MsgInterface interface { SetGroupUserMinSeq(ctx context.Context, groupID, userID string, minSeq int64) (err error) // 设置用户最小seq 直接调用cache SetUserMinSeq(ctx context.Context, userID string, minSeq int64) (err error) + + MsgToMQ(ctx context.Context, key string, data *pbMsg.MsgDataToMQ) (err error) } func NewMsgController(mgo *mongo.Client, rdb redis.UniversalClient) MsgInterface { @@ -337,7 +339,7 @@ func (db *MsgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID s if err != nil { return nil, nil, nil, err } - if utils.Contain(msgPb.Seq, seqs) { + if utils.Contain(msgPb.Seq, seqs...) { indexes = append(indexes, i) seqMsgs = append(seqMsgs, msgPb) hasSeqList = append(hasSeqList, msgPb.Seq) @@ -348,7 +350,7 @@ func (db *MsgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID s } } for _, i := range seqs { - if utils.Contain(i, hasSeqList) { + if utils.Contain(i, hasSeqList...) { continue } unExistSeqs = append(unExistSeqs, i) @@ -398,7 +400,7 @@ func (db *MsgDatabase) getMsgBySeqs(ctx context.Context, sourceID string, seqs [ //log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) return nil, err } - if utils.Contain(msgPb.Seq, value) { + if utils.Contain(msgPb.Seq, value...) { seqMsg = append(seqMsg, msgPb) hasSeqs = append(hasSeqs, msgPb.Seq) singleCount++ diff --git a/pkg/common/db/controller/user.go b/pkg/common/db/controller/user.go index 0cdab97e1..3ec4fb9f0 100644 --- a/pkg/common/db/controller/user.go +++ b/pkg/common/db/controller/user.go @@ -2,105 +2,60 @@ package controller import ( "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db/relation" - relationTb "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/utils" "context" - "gorm.io/gorm" ) -type UserInterface interface { +type UserDatabase interface { //获取指定用户的信息 如有userID未找到 也返回错误 - FindWithError(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) + FindWithError(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) //获取指定用户的信息 如有userID未找到 不返回错误 - Find(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) + Find(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) //插入多条 外部保证userID 不重复 且在db中不存在 - Create(ctx context.Context, users []*relationTb.UserModel) (err error) + Create(ctx context.Context, users []*relation.UserModel) (err error) //更新(非零值) 外部保证userID存在 - Update(ctx context.Context, users []*relationTb.UserModel) (err error) + Update(ctx context.Context, users []*relation.UserModel) (err error) //更新(零值) 外部保证userID存在 UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) //如果没找到,不返回错误 - Page(ctx context.Context, pageNumber, showNumber int32) (users []*relationTb.UserModel, count int64, err error) + Page(ctx context.Context, pageNumber, showNumber int32) (users []*relation.UserModel, count int64, err error) //只要有一个存在就为true IsExist(ctx context.Context, userIDs []string) (exist bool, err error) //获取所有用户ID GetAllUserID(ctx context.Context) ([]string, error) + //函数内部先查询db中是否存在,存在则什么都不做;不存在则插入 + InitOnce(ctx context.Context, users []*relation.UserModel) (err error) } -type UserController struct { - database UserDatabaseInterface +type userDatabase struct { + userDB relation.UserModelInterface } -// 获取指定用户的信息 如有userID未找到 也返回错误 -func (u *UserController) FindWithError(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) { - return u.database.FindWithError(ctx, userIDs) +func NewUserDatabase(userDB relation.UserModelInterface) UserDatabase { + return &userDatabase{userDB: userDB} } -func (u *UserController) Find(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) { - return u.database.Find(ctx, userIDs) -} -func (u *UserController) Create(ctx context.Context, users []*relationTb.UserModel) error { - return u.database.Create(ctx, users) -} - -func (u *UserController) Update(ctx context.Context, users []*relationTb.UserModel) (err error) { - return u.database.Update(ctx, users) -} -func (u *UserController) UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) { - return u.database.UpdateByMap(ctx, userID, args) -} - -func (u *UserController) Page(ctx context.Context, pageNumber, showNumber int32) (users []*relationTb.UserModel, count int64, err error) { - return u.database.Page(ctx, pageNumber, showNumber) -} - -func (u *UserController) IsExist(ctx context.Context, userIDs []string) (exist bool, err error) { - return u.database.IsExist(ctx, userIDs) -} - -func (u *UserController) GetAllUserID(ctx context.Context) ([]string, error) { - return u.database.GetAllUserID(ctx) -} - -func NewUserController(db *gorm.DB) *UserController { - controller := &UserController{database: newUserDatabase(db)} - return controller -} - -type UserDatabaseInterface interface { - //获取指定用户的信息 如有userID未找到 也返回错误 - FindWithError(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) - //获取指定用户的信息 如有userID未找到 不返回错误 - Find(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) - //插入多条 外部保证userID 不重复 且在db中不存在 - Create(ctx context.Context, users []*relationTb.UserModel) (err error) - //更新(非零值) 外部保证userID存在 - Update(ctx context.Context, users []*relationTb.UserModel) (err error) - //更新(零值) 外部保证userID存在 - UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) - //如果没找到,不返回错误 - Page(ctx context.Context, pageNumber, showNumber int32) (users []*relationTb.UserModel, count int64, err error) - //只要有一个存在就为true - IsExist(ctx context.Context, userIDs []string) (exist bool, err error) - //获取所有用户ID - GetAllUserID(ctx context.Context) ([]string, error) -} - -type UserDatabase struct { - user *relation.UserGorm -} - -func newUserDatabase(db *gorm.DB) *UserDatabase { - sqlDB := relation.NewUserGorm(db) - database := &UserDatabase{ - user: sqlDB, +func (u *userDatabase) InitOnce(ctx context.Context, users []*relation.UserModel) (err error) { + userIDs := utils.Slice(users, func(e *relation.UserModel) string { + return e.UserID + }) + result, err := u.userDB.Find(ctx, userIDs) + if err != nil { + return err } - return database + miss := utils.SliceAnySub(users, result, func(e *relation.UserModel) string { return e.UserID }) + if len(miss) > 0 { + u.userDB.Create(ctx, miss) + } + + return nil } // 获取指定用户的信息 如有userID未找到 也返回错误 -func (u *UserDatabase) FindWithError(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) { - users, err = u.user.Find(ctx, userIDs) +func (u *userDatabase) FindWithError(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) { + + users, err = u.userDB.Find(ctx, userIDs) if err != nil { return } @@ -111,34 +66,34 @@ func (u *UserDatabase) FindWithError(ctx context.Context, userIDs []string) (use } // 获取指定用户的信息 如有userID未找到 不返回错误 -func (u *UserDatabase) Find(ctx context.Context, userIDs []string) (users []*relationTb.UserModel, err error) { - users, err = u.user.Find(ctx, userIDs) +func (u *userDatabase) Find(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) { + users, err = u.userDB.Find(ctx, userIDs) return } // 插入多条 外部保证userID 不重复 且在db中不存在 -func (u *UserDatabase) Create(ctx context.Context, users []*relationTb.UserModel) (err error) { - return u.user.Create(ctx, users) +func (u *userDatabase) Create(ctx context.Context, users []*relation.UserModel) (err error) { + return u.userDB.Create(ctx, users) } // 更新(非零值) 外部保证userID存在 -func (u *UserDatabase) Update(ctx context.Context, users []*relationTb.UserModel) (err error) { - return u.user.Update(ctx, users) +func (u *userDatabase) Update(ctx context.Context, users []*relation.UserModel) (err error) { + return u.userDB.Update(ctx, users) } // 更新(零值) 外部保证userID存在 -func (u *UserDatabase) UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) { - return u.user.UpdateByMap(ctx, userID, args) +func (u *userDatabase) UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) { + return u.userDB.UpdateByMap(ctx, userID, args) } // 获取,如果没找到,不返回错误 -func (u *UserDatabase) Page(ctx context.Context, showNumber, pageNumber int32) (users []*relationTb.UserModel, count int64, err error) { - return u.user.Page(ctx, showNumber, pageNumber) +func (u *userDatabase) Page(ctx context.Context, pageNumber, showNumber int32) (users []*relation.UserModel, count int64, err error) { + return u.userDB.Page(ctx, pageNumber, showNumber) } // userIDs是否存在 只要有一个存在就为true -func (u *UserDatabase) IsExist(ctx context.Context, userIDs []string) (exist bool, err error) { - users, err := u.user.Find(ctx, userIDs) +func (u *userDatabase) IsExist(ctx context.Context, userIDs []string) (exist bool, err error) { + users, err := u.userDB.Find(ctx, userIDs) if err != nil { return false, err } @@ -148,6 +103,21 @@ func (u *UserDatabase) IsExist(ctx context.Context, userIDs []string) (exist boo return false, nil } -func (u *UserDatabase) GetAllUserID(ctx context.Context) ([]string, error) { - return u.user.GetAllUserID(ctx) +func (u *userDatabase) GetAllUserID(ctx context.Context) (userIDs []string, err error) { + pageNumber := int32(0) + for { + tmp, total, err := u.userDB.PageUserID(ctx, pageNumber, constant.ShowNumber) + if err != nil { + return nil, err + } + if len(tmp) == 0 { + if total == int64(len(userIDs)) { + return userIDs, nil + } + return nil, constant.ErrData.Wrap("The total number of results and expectations are different, but result is nil") + } + userIDs = append(userIDs, tmp...) + pageNumber++ + } + return userIDs, nil } diff --git a/pkg/common/db/relation/black.go b/pkg/common/db/relation/black_model.go similarity index 85% rename from pkg/common/db/relation/black.go rename to pkg/common/db/relation/black_model.go index 2972c15fa..dbef9e116 100644 --- a/pkg/common/db/relation/black.go +++ b/pkg/common/db/relation/black_model.go @@ -12,10 +12,8 @@ type BlackGorm struct { DB *gorm.DB } -func NewBlackGorm(db *gorm.DB) *BlackGorm { - var black BlackGorm - black.DB = db - return &black +func NewBlackGorm(db *gorm.DB) relation.BlackModelInterface { + return &BlackGorm{db} } func (b *BlackGorm) Create(ctx context.Context, blacks []*relation.BlackModel) (err error) { @@ -76,3 +74,10 @@ func (b *BlackGorm) FindOwnerBlacks(ctx context.Context, ownerUserID string, pag err = utils.Wrap(b.DB.Model(&relation.BlackModel{}).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&blacks).Error, "") return } + +func (b *BlackGorm) FindBlackUserIDs(ctx context.Context, ownerUserID string) (blackUserIDs []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "blackUserIDs", blackUserIDs) + }() + return blackUserIDs, utils.Wrap(b.DB.Model(&relation.BlackModel{}).Where("owner_user_id = ?", blackUserIDs).Pluck("block_user_id", &blackUserIDs).Error, "") +} diff --git a/pkg/common/db/relation/conversation_model.go b/pkg/common/db/relation/conversation_model.go index 1071e26af..facbe3cd4 100644 --- a/pkg/common/db/relation/conversation_model.go +++ b/pkg/common/db/relation/conversation_model.go @@ -1,123 +1,95 @@ package relation import ( + "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/common/tracelog" + "Open_IM/pkg/utils" + "context" "gorm.io/gorm" ) -var ConversationDB *gorm.DB - -//type Conversation struct { -// OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"` -// ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"` -// ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"` -// UserID string `gorm:"column:user_id;type:char(64)" json:"userID"` -// GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"` -// RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"` -// UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"` -// DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"` -// IsPinned bool `gorm:"column:is_pinned" json:"isPinned"` -// IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"` -// BurnDuration int32 `gorm:"column:burn_duration;default:30" json:"burnDuration"` -// GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"` -// IsNotInGroup bool `gorm:"column:is_not_in_group" json:"isNotInGroup"` -// UpdateUnreadCountTime int64 `gorm:"column:update_unread_count_time" json:"updateUnreadCountTime"` -// AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` -// Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` -//} - -func (Conversation) TableName() string { - return "conversations" +type Conversation interface { + Create(ctx context.Context, conversations []*relation.ConversationModel) (err error) + Delete(ctx context.Context, groupIDs []string) (err error) + UpdateByMap(ctx context.Context, userIDList []string, conversationID string, args map[string]interface{}) (err error) + Update(ctx context.Context, conversations []*relation.ConversationModel) (err error) + Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*relation.ConversationModel, err error) + FindUserID(ctx context.Context, userIDList []string, conversationID string) ([]string, error) + FindUserIDAllConversationID(ctx context.Context, userID string) ([]string, error) + Take(ctx context.Context, userID, conversationID string) (conversation *relation.ConversationModel, err error) + FindConversationID(ctx context.Context, userID string, conversationIDList []string) (existConversationID []string, err error) + NewTx(tx any) Conversation +} +type ConversationGorm struct { + DB *gorm.DB } -func SetConversation(conversation Conversation) (bool, error) { - var isUpdate bool - newConversation := conversation - if ConversationDB.Model(&Conversation{}).Find(&newConversation).RowsAffected == 0 { - return isUpdate, ConversationDB.Model(&Conversation{}).Create(&conversation).Error - // if exist, then update record - } else { - //force update - isUpdate = true - return isUpdate, ConversationDB.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID). - Updates(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt, "is_pinned": conversation.IsPinned, "is_private_chat": conversation.IsPrivateChat, - "group_at_type": conversation.GroupAtType, "is_not_in_group": conversation.IsNotInGroup}).Error - } -} -func SetOneConversation(conversation Conversation) error { - return ConversationDB.Model(&Conversation{}).Create(&conversation).Error - +func NewConversationGorm(DB *gorm.DB) Conversation { + return &ConversationGorm{DB: DB} } -func PeerUserSetConversation(conversation Conversation) error { - newConversation := conversation - if ConversationDB.Model(&Conversation{}).Find(&newConversation).RowsAffected == 0 { - return ConversationDB.Model(&Conversation{}).Create(&conversation).Error - // if exist, then update record - } - //force update - return ConversationDB.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID). - Updates(map[string]interface{}{"is_private_chat": conversation.IsPrivateChat}).Error - +func (c *ConversationGorm) NewTx(tx any) Conversation { + return &ConversationGorm{DB: tx.(*gorm.DB)} } -func SetRecvMsgOpt(conversation Conversation) (bool, error) { - var isUpdate bool - newConversation := conversation - if ConversationDB.Model(&Conversation{}).Find(&newConversation).RowsAffected == 0 { - return isUpdate, ConversationDB.Model(&Conversation{}).Create(&conversation).Error - // if exist, then update record - } else { - //force update - isUpdate = true - return isUpdate, ConversationDB.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID). - Updates(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt}).Error - } +func (c *ConversationGorm) Create(ctx context.Context, conversations []*relation.ConversationModel) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "conversations", conversations) + }() + return utils.Wrap(c.DB.Create(&conversations).Error, "") } -func GetUserAllConversations(ownerUserID string) ([]Conversation, error) { - var conversations []Conversation - err := ConversationDB.Where("owner_user_id=?", ownerUserID).Find(&conversations).Error - return conversations, err -} -func GetMultipleUserConversationByConversationID(ownerUserIDList []string, conversationID string) ([]Conversation, error) { - var conversations []Conversation - err := ConversationDB.Where("owner_user_id IN ? and conversation_id=?", ownerUserIDList, conversationID).Find(&conversations).Error - return conversations, err -} -func GetExistConversationUserIDList(ownerUserIDList []string, conversationID string) ([]string, error) { - var resultArr []string - err := ConversationDB.Table("conversations").Where(" owner_user_id IN (?) and conversation_id=?", ownerUserIDList, conversationID).Pluck("owner_user_id", &resultArr).Error - if err != nil { - return nil, err - } - return resultArr, nil +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(c.DB.Where("group_id in (?)", groupIDs).Delete(&relation.ConversationModel{}).Error, "") } -func GetConversation(OwnerUserID, conversationID string) (Conversation, error) { - var conversation Conversation - err := ConversationDB.Table("conversations").Where("owner_user_id=? and conversation_id=?", OwnerUserID, conversationID).Take(&conversation).Error - return conversation, err +func (c *ConversationGorm) UpdateByMap(ctx context.Context, userIDList []string, conversationID string, args map[string]interface{}) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDList", userIDList, "conversationID", conversationID) + }() + return utils.Wrap(c.DB.Model(&relation.ConversationModel{}).Where("owner_user_id IN (?) and conversation_id=?", userIDList, conversationID).Updates(args).Error, "") } -func GetConversations(OwnerUserID string, conversationIDs []string) ([]Conversation, error) { - var conversations []Conversation - err := ConversationDB.Model(&Conversation{}).Where("conversation_id IN (?) and owner_user_id=?", conversationIDs, OwnerUserID).Find(&conversations).Error +func (c *ConversationGorm) Update(ctx context.Context, conversations []*relation.ConversationModel) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "conversations", conversations) + }() + return utils.Wrap(c.DB.Updates(&conversations).Error, "") +} + +func (c *ConversationGorm) Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*relation.ConversationModel, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "groups", conversations) + }() + err = utils.Wrap(c.DB.Where("owner_user_id=? and conversation_id IN (?)", ownerUserID, conversationIDs).Find(&conversations).Error, "") return conversations, err } -func GetConversationsByConversationIDMultipleOwner(OwnerUserIDList []string, conversationID string) ([]Conversation, error) { - var conversations []Conversation - err := ConversationDB.Model(&Conversation{}).Where("owner_user_id IN (?) and conversation_id=?", OwnerUserIDList, conversationID).Find(&conversations).Error - return conversations, err +func (c *ConversationGorm) Take(ctx context.Context, userID, conversationID string) (conversation *relation.ConversationModel, err error) { + cc := &relation.ConversationModel{} + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversation", *conversation) + }() + return cc, utils.Wrap(c.DB.Where("conversation_id = ? And owner_user_id = ?", conversationID, userID).Take(cc).Error, "") } - -func UpdateColumnsConversations(ownerUserIDList []string, conversationID string, args map[string]interface{}) error { - return ConversationDB.Model(&Conversation{}).Where("owner_user_id IN (?) and conversation_id=?", ownerUserIDList, conversationID).Updates(args).Error - +func (c *ConversationGorm) FindUserID(ctx context.Context, userIDList []string, conversationID string) (existUserID []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userIDList, "existUserID", existUserID) + }() + return existUserID, utils.Wrap(c.DB.Where(" owner_user_id IN (?) and conversation_id=?", userIDList, conversationID).Pluck("owner_user_id", &existUserID).Error, "") } - -func GetConversationIDListByUserID(userID string) ([]string, error) { - var IDList []string - err := ConversationDB.Model(&Conversation{}).Where("owner_user_id=?", userID).Pluck("conversation_id", &IDList).Error - return IDList, err +func (c *ConversationGorm) FindConversationID(ctx context.Context, userID string, conversationIDList []string) (existConversationID []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "existConversationIDList", existConversationID) + }() + return existConversationID, utils.Wrap(c.DB.Where(" conversation_id IN (?) and owner_user_id=?", conversationIDList, userID).Pluck("conversation_id", &existConversationID).Error, "") +} +func (c *ConversationGorm) FindUserIDAllConversationID(ctx context.Context, userID string) (conversationIDList []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversationIDList", conversationIDList) + }() + return conversationIDList, utils.Wrap(c.DB.Model(&relation.ConversationModel{}).Where("owner_user_id=?", userID).Pluck("conversation_id", &conversationIDList).Error, "") } diff --git a/pkg/common/db/relation/conversation_model_g.go b/pkg/common/db/relation/conversation_model_g.go deleted file mode 100644 index e45af0154..000000000 --- a/pkg/common/db/relation/conversation_model_g.go +++ /dev/null @@ -1,100 +0,0 @@ -package relation - -import ( - "Open_IM/pkg/common/db/table/relation" - "Open_IM/pkg/common/tracelog" - "Open_IM/pkg/utils" - "context" - "gorm.io/gorm" -) - -type Conversation interface { - TableName() string - Create(ctx context.Context, conversations []*relation.ConversationModel, tx ...any) (err error) - Delete(ctx context.Context, groupIDs []string) (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 -} - -func (c *ConversationGorm) TableName() string { - panic("implement me") -} - -func NewConversationGorm(DB *gorm.DB) Conversation { - return &ConversationGorm{DB: DB} -} - -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(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(&relation.ConversationModel{}).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, "userIDList", userIDList, "conversationID", conversationID) - }() - 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, conversations []*relation.ConversationModel, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "conversations", conversations) - }() - return utils.Wrap(getDBConn(c.DB, tx).Updates(&conversations).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, "ownerUserID", ownerUserID, "groups", conversations) - }() - 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, userID, conversationID string, tx ...any) (conversation *relation.ConversationModel, err error) { - cc := &relation.ConversationModel{} - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "conversation", *conversation) - }() - 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/demo_model.go b/pkg/common/db/relation/demo_model.go deleted file mode 100644 index 08cde761e..000000000 --- a/pkg/common/db/relation/demo_model.go +++ /dev/null @@ -1,42 +0,0 @@ -package relation - -import ( - "gorm.io/gorm" -) - -var RegisterDB *gorm.DB - -type Register struct { - Account string `gorm:"column:account;primary_key;type:char(255)" json:"account"` - Password string `gorm:"column:password;type:varchar(255)" json:"password"` - Ex string `gorm:"column:ex;size:1024" json:"ex"` - UserID string `gorm:"column:user_id;type:varchar(255)" json:"userID"` - AreaCode string `gorm:"column:area_code;type:varchar(255)"` - InvitationCode string `gorm:"column:invitation_code;type:varchar(255)"` - RegisterIP string `gorm:"column:register_ip;type:varchar(255)"` -} - -func GetRegister(account, areaCode, userID string) (*Register, error) { - var r Register - return &r, RegisterDB.Table("registers").Where("user_id = ? and user_id != ? or account = ? or account =? and area_code=?", - userID, "", account, account, areaCode).Take(&r).Error -} - -func SetPassword(account, password, ex, userID, areaCode, ip string) error { - r := Register{ - Account: account, - Password: password, - Ex: ex, - UserID: userID, - RegisterIP: ip, - AreaCode: areaCode, - } - return RegisterDB.Table("registers").Create(&r).Error -} - -func ResetPassword(account, password string) error { - r := Register{ - Password: password, - } - return RegisterDB.Table("registers").Where("account = ?", account).Updates(&r).Error -} diff --git a/pkg/common/db/relation/friend_model.go b/pkg/common/db/relation/friend_model.go index 1050b4958..15d541855 100644 --- a/pkg/common/db/relation/friend_model.go +++ b/pkg/common/db/relation/friend_model.go @@ -1,83 +1,132 @@ package relation -//import ( -// "fmt" -// "time" -//) -// -//func InsertToFriend(toInsertFollow *Friend) error { -// toInsertFollow.CreateTime = time.Now() -// err := FriendDB.Table("friends").Create(toInsertFollow).Error -// if err != nil { -// return err -// } -// return nil -//} -// -//func GetFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend, error) { -// var friend Friend -// err := FriendDB.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Take(&friend).Error -// if err != nil { -// return nil, err -// } -// return &friend, err -//} -// -//func GetFriendListByUserID(OwnerUserID string) ([]Friend, error) { -// var friends []Friend -// var x Friend -// x.OwnerUserID = OwnerUserID -// err := FriendDB.Table("friends").Where("owner_user_id=?", OwnerUserID).Find(&friends).Error -// if err != nil { -// return nil, err -// } -// return friends, nil -//} -// -//func GetFriendIDListByUserID(OwnerUserID string) ([]string, error) { -// var friendIDList []string -// err := FriendDB.Table("friends").Where("owner_user_id=?", OwnerUserID).Pluck("friend_user_id", &friendIDList).Error -// if err != nil { -// return nil, err -// } -// return friendIDList, nil -//} -// -//func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error { -// return FriendDB.Exec("update friends set remark=? where owner_user_id=? and friend_user_id=?", Remark, OwnerUserID, FriendUserID).Error -//} -// -//func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error { -// return FriendDB.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(Friend{}).Error -//} -// -//type FriendUser struct { -// Friend -// Nickname string `gorm:"column:name;size:255"` -//} -// -//func GetUserFriendsCMS(ownerUserID, friendUserName string, pageNumber, showNumber int32) (friendUserList []*FriendUser, count int64, err error) { -// DB := FriendDB.Table("friends"). -// Select("friends.*, users.name"). -// Where("friends.owner_user_id=?", ownerUserID).Limit(int(showNumber)). -// Joins("left join users on friends.friend_user_id = users.user_id"). -// Offset(int(showNumber * (pageNumber - 1))) -// if friendUserName != "" { -// DB = DB.Where("users.name like ?", fmt.Sprintf("%%%s%%", friendUserName)) -// } -// if err = DB.Count(&count).Error; err != nil { -// return -// } -// err = DB.Find(&friendUserList).Error -// return -//} -// -//func GetFriendByIDCMS(ownerUserID, friendUserID string) (friendUser *FriendUser, err error) { -// friendUser = &FriendUser{} -// err = FriendDB.Table("friends"). -// Select("friends.*, users.name"). -// Where("friends.owner_user_id=? and friends.friend_user_id=?", ownerUserID, friendUserID). -// Joins("left join users on friends.friend_user_id = users.user_id"). -// Take(friendUser).Error -// return friendUser, err -//} +import ( + "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/common/tracelog" + "Open_IM/pkg/utils" + "context" + "gorm.io/gorm" +) + +type FriendGorm struct { + DB *gorm.DB +} + +func NewFriendGorm(db *gorm.DB) relation.FriendModelInterface { + return &FriendGorm{DB: db} +} + +func (f *FriendGorm) NewTx(tx any) relation.FriendModelInterface { + return &FriendGorm{DB: tx.(*gorm.DB)} +} + +// 插入多条记录 +func (f *FriendGorm) Create(ctx context.Context, friends []*relation.FriendModel) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friends", friends) + }() + return utils.Wrap(f.DB.Create(&friends).Error, "") +} + +// 删除ownerUserID指定的好友 +func (f *FriendGorm) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) + }() + err = utils.Wrap(f.DB.Where("owner_user_id = ? AND friend_user_id in ( ?)", ownerUserID, friendUserIDs).Delete(&relation.FriendModel{}).Error, "") + return err +} + +// 更新ownerUserID单个好友信息 更新零值 +func (f *FriendGorm) UpdateByMap(ctx context.Context, ownerUserID string, friendUserID string, args map[string]interface{}) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "args", args) + }() + return utils.Wrap(f.DB.Model(&relation.FriendModel{}).Where("owner_user_id = ? AND friend_user_id = ? ", ownerUserID, friendUserID).Updates(args).Error, "") +} + +// 更新好友信息的非零值 +func (f *FriendGorm) Update(ctx context.Context, friends []*relation.FriendModel) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friends", friends) + }() + return utils.Wrap(f.DB.Updates(&friends).Error, "") +} + +// 更新好友备注(也支持零值 ) +func (f *FriendGorm) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "remark", remark) + }() + if remark != "" { + return utils.Wrap(f.DB.Model(&relation.FriendModel{}).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") + } + m := make(map[string]interface{}, 1) + m["remark"] = "" + return utils.Wrap(f.DB.Model(&relation.FriendModel{}).Where("owner_user_id = ?", ownerUserID).Updates(m).Error, "") + +} + +// 获取单个好友信息,如没找到 返回错误 +func (f *FriendGorm) Take(ctx context.Context, ownerUserID, friendUserID string) (friend *relation.FriendModel, err error) { + friend = &relation.FriendModel{} + defer tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", *friend) + return friend, utils.Wrap(f.DB.Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") +} + +// 查找好友关系,如果是双向关系,则都返回 +func (f *FriendGorm) FindUserState(ctx context.Context, userID1, userID2 string) (friends []*relation.FriendModel, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID1", userID1, "userID2", userID2, "friends", friends) + }() + return friends, utils.Wrap(f.DB.Where("(owner_user_id = ? and friend_user_id = ?) or (owner_user_id = ? and friend_user_id = ?)", userID1, userID2, userID2, userID1).Find(&friends).Error, "") +} + +// 获取 owner指定的好友列表 如果有friendUserIDs不存在,也不返回错误 +func (f *FriendGorm) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs, "friends", friends) + }() + return friends, utils.Wrap(f.DB.Where("owner_user_id = ? AND friend_user_id in (?)", ownerUserID, friendUserIDs).Find(&friends).Error, "") +} + +// 获取哪些人添加了friendUserID 如果有ownerUserIDs不存在,也不返回错误 +func (f *FriendGorm) FindReversalFriends(ctx context.Context, friendUserID string, ownerUserIDs []string) (friends []*relation.FriendModel, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friendUserID", friendUserID, "ownerUserIDs", ownerUserIDs, "friends", friends) + }() + return friends, utils.Wrap(f.DB.Where("friend_user_id = ? AND owner_user_id in (?)", friendUserID, ownerUserIDs).Find(&friends).Error, "") +} + +// 获取ownerUserID好友列表 支持翻页 +func (f *FriendGorm) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "pageNumber", pageNumber, "showNumber", showNumber, "friends", friends, "total", total) + }() + err = f.DB.Model(&relation.FriendModel{}).Where("owner_user_id = ? ", ownerUserID).Count(&total).Error + if err != nil { + return nil, 0, utils.Wrap(err, "") + } + err = utils.Wrap(f.DB.Where("owner_user_id = ? ", ownerUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friends).Error, "") + return +} + +// 获取哪些人添加了friendUserID 支持翻页 +func (f *FriendGorm) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*relation.FriendModel, total int64, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friendUserID", friendUserID, "pageNumber", pageNumber, "showNumber", showNumber, "friends", friends, "total", total) + }() + err = f.DB.Model(&relation.FriendModel{}).Where("friend_user_id = ? ", friendUserID).Count(&total).Error + if err != nil { + return nil, 0, utils.Wrap(err, "") + } + err = utils.Wrap(f.DB.Where("friend_user_id = ? ", friendUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friends).Error, "") + return +} + +func (f *FriendGorm) FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) + }() + return friendUserIDs, utils.Wrap(f.DB.Model(&relation.FriendModel{}).Where("owner_user_id = ? ", ownerUserID).Pluck("friend_user_id", &friendUserIDs).Error, "") +} diff --git a/pkg/common/db/relation/friend_model_k.go b/pkg/common/db/relation/friend_model_k.go deleted file mode 100644 index b452bae4e..000000000 --- a/pkg/common/db/relation/friend_model_k.go +++ /dev/null @@ -1,135 +0,0 @@ -package relation - -import ( - "Open_IM/pkg/common/db/table/relation" - "Open_IM/pkg/common/tracelog" - "Open_IM/pkg/utils" - "context" - "gorm.io/gorm" -) - -type FriendDB interface { - Create(ctx context.Context, friends []*relation.FriendModel) (err error) - Delete(ctx context.Context, ownerUserID string, friendUserIDs string) (err error) - UpdateByMap(ctx context.Context, ownerUserID string, args map[string]interface{}) (err error) - Update(ctx context.Context, friends []*relation.FriendModel) (err error) - UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) - FindOwnerUserID(ctx context.Context, ownerUserID string) (friends []*relation.FriendModel, err error) -} - -type FriendGorm struct { - DB *gorm.DB `gorm:"-"` -} - -func NewFriendGorm(DB *gorm.DB) *FriendGorm { - return &FriendGorm{DB: DB} -} - -type FriendUser struct { - FriendGorm - Nickname string `gorm:"column:name;size:255"` -} - -// 插入多条记录 -func (f *FriendGorm) Create(ctx context.Context, friends []*relation.FriendModel, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friends", friends) - }() - return utils.Wrap(getDBConn(f.DB, tx).Create(&friends).Error, "") -} - -// 删除ownerUserID指定的好友 -func (f *FriendGorm) Delete(ctx context.Context, ownerUserID string, friendUserIDs []string, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs) - }() - err = utils.Wrap(getDBConn(f.DB, tx).Where("owner_user_id = ? AND friend_user_id in ( ?)", ownerUserID, friendUserIDs).Delete(&relation.FriendModel{}).Error, "") - return err -} - -// 更新ownerUserID单个好友信息 更新零值 -func (f *FriendGorm) UpdateByMap(ctx context.Context, ownerUserID string, friendUserID string, args map[string]interface{}, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "args", args) - }() - return utils.Wrap(getDBConn(f.DB, tx).Model(&relation.FriendModel{}).Where("owner_user_id = ? AND friend_user_id = ? ", ownerUserID, friendUserID).Updates(args).Error, "") -} - -// 更新好友信息的非零值 -func (f *FriendGorm) Update(ctx context.Context, friends []*relation.FriendModel, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friends", friends) - }() - return utils.Wrap(getDBConn(f.DB, tx).Updates(&friends).Error, "") -} - -// 更新好友备注(也支持零值 ) -func (f *FriendGorm) UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "remark", remark) - }() - if remark != "" { - return utils.Wrap(getDBConn(f.DB, tx).Model(&relation.FriendModel{}).Where("owner_user_id = ? and friend_user_id = ?", ownerUserID, friendUserID).Update("remark", remark).Error, "") - } - m := make(map[string]interface{}, 1) - m["remark"] = "" - return utils.Wrap(getDBConn(f.DB, tx).Model(&relation.FriendModel{}).Where("owner_user_id = ?", ownerUserID).Updates(m).Error, "") - -} - -// 获取单个好友信息,如没找到 返回错误 -func (f *FriendGorm) Take(ctx context.Context, ownerUserID, friendUserID string, tx ...any) (friend *relation.FriendModel, err error) { - friend = &relation.FriendModel{} - defer tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserID", friendUserID, "friend", *friend) - return friend, utils.Wrap(getDBConn(f.DB, tx).Where("owner_user_id = ? and friend_user_id", ownerUserID, friendUserID).Take(friend).Error, "") -} - -// 查找好友关系,如果是双向关系,则都返回 -func (f *FriendGorm) FindUserState(ctx context.Context, userID1, userID2 string, tx ...any) (friends []*relation.FriendModel, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID1", userID1, "userID2", userID2, "friends", friends) - }() - return friends, utils.Wrap(getDBConn(f.DB, tx).Where("(owner_user_id = ? and friend_user_id = ?) or (owner_user_id = ? and friend_user_id = ?)", userID1, userID2, userID2, userID1).Find(&friends).Error, "") -} - -// 获取 owner指定的好友列表 如果有friendUserIDs不存在,也不返回错误 -func (f *FriendGorm) FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string, tx ...any) (friends []*relation.FriendModel, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "friendUserIDs", friendUserIDs, "friends", friends) - }() - return friends, utils.Wrap(getDBConn(f.DB, tx).Where("owner_user_id = ? AND friend_user_id in (?)", ownerUserID, friendUserIDs).Find(&friends).Error, "") -} - -// 获取哪些人添加了friendUserID 如果有ownerUserIDs不存在,也不返回错误 -func (f *FriendGorm) FindReversalFriends(ctx context.Context, friendUserID string, ownerUserIDs []string, tx ...any) (friends []*relation.FriendModel, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friendUserID", friendUserID, "ownerUserIDs", ownerUserIDs, "friends", friends) - }() - return friends, utils.Wrap(getDBConn(f.DB, tx).Where("friend_user_id = ? AND owner_user_id in (?)", friendUserID, ownerUserIDs).Find(&friends).Error, "") -} - -// 获取ownerUserID好友列表 支持翻页 -func (f *FriendGorm) FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32, tx ...any) (friends []*relation.FriendModel, total int64, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "pageNumber", pageNumber, "showNumber", showNumber, "friends", friends, "total", total) - }() - err = getDBConn(f.DB, tx).Model(&relation.FriendModel{}).Where("owner_user_id = ? ", ownerUserID).Count(&total).Error - if err != nil { - return nil, 0, utils.Wrap(err, "") - } - err = utils.Wrap(getDBConn(f.DB, tx).Where("owner_user_id = ? ", ownerUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friends).Error, "") - return -} - -// 获取哪些人添加了friendUserID 支持翻页 -func (f *FriendGorm) FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32, tx ...any) (friends []*relation.FriendModel, total int64, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friendUserID", friendUserID, "pageNumber", pageNumber, "showNumber", showNumber, "friends", friends, "total", total) - }() - err = getDBConn(f.DB, tx).Model(&relation.FriendModel{}).Where("friend_user_id = ? ", friendUserID).Count(&total).Error - if err != nil { - return nil, 0, utils.Wrap(err, "") - } - err = utils.Wrap(getDBConn(f.DB, tx).Where("friend_user_id = ? ", friendUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friends).Error, "") - return -} diff --git a/pkg/common/db/relation/friend_request_model.go b/pkg/common/db/relation/friend_request_model.go index b17017cbc..1326048ec 100644 --- a/pkg/common/db/relation/friend_request_model.go +++ b/pkg/common/db/relation/friend_request_model.go @@ -8,92 +8,92 @@ import ( "gorm.io/gorm" ) -//var FriendRequestDB *gorm.DB - -func NewFriendRequestGorm(db *gorm.DB) *FriendRequestGorm { - var fr FriendRequestGorm - fr.DB = db - return &fr +func NewFriendRequestGorm(db *gorm.DB) relation.FriendRequestModelInterface { + return &FriendRequestGorm{db} } type FriendRequestGorm struct { - DB *gorm.DB `gorm:"-"` + DB *gorm.DB +} + +func (f *FriendRequestGorm) NewTx(tx any) relation.FriendRequestModelInterface { + return &FriendRequestGorm{DB: tx.(*gorm.DB)} } // 插入多条记录 -func (f *FriendRequestGorm) Create(ctx context.Context, friendRequests []*relation.FriendRequestModel, tx ...*gorm.DB) (err error) { +func (f *FriendRequestGorm) Create(ctx context.Context, friendRequests []*relation.FriendRequestModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friendRequests", friendRequests) }() - return utils.Wrap(getDBConn(f.DB, tx).Create(&friendRequests).Error, "") + return utils.Wrap(f.DB.Create(&friendRequests).Error, "") } // 删除记录 -func (f *FriendRequestGorm) Delete(ctx context.Context, fromUserID, toUserID string, tx ...*gorm.DB) (err error) { +func (f *FriendRequestGorm) Delete(ctx context.Context, fromUserID, toUserID string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "fromUserID", fromUserID, "toUserID", toUserID) }() - return utils.Wrap(getDBConn(f.DB, tx).Where("from_user_id = ? AND to_user_id = ?", fromUserID, toUserID).Delete(&relation.FriendRequestModel{}).Error, "") + return utils.Wrap(f.DB.Where("from_user_id = ? AND to_user_id = ?", fromUserID, toUserID).Delete(&relation.FriendRequestModel{}).Error, "") } // 更新零值 -func (f *FriendRequestGorm) UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { +func (f *FriendRequestGorm) UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "formUserID", formUserID, "toUserID", toUserID, "args", args) }() - return utils.Wrap(getDBConn(f.DB, tx).Model(&relation.FriendRequestModel{}).Where("from_user_id = ? AND to_user_id ", formUserID, toUserID).Updates(args).Error, "") + return utils.Wrap(f.DB.Model(&relation.FriendRequestModel{}).Where("from_user_id = ? AND to_user_id ", formUserID, toUserID).Updates(args).Error, "") } // 更新多条记录 (非零值) -func (f *FriendRequestGorm) Update(ctx context.Context, friendRequests []*relation.FriendRequestModel, tx ...*gorm.DB) (err error) { +func (f *FriendRequestGorm) Update(ctx context.Context, friendRequests []*relation.FriendRequestModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "friendRequests", friendRequests) }() - return utils.Wrap(getDBConn(f.DB, tx).Updates(&friendRequests).Error, "") + return utils.Wrap(f.DB.Updates(&friendRequests).Error, "") } // 获取来指定用户的好友申请 未找到 不返回错误 -func (f *FriendRequestGorm) Find(ctx context.Context, fromUserID, toUserID string, tx ...*gorm.DB) (friendRequest *relation.FriendRequestModel, err error) { +func (f *FriendRequestGorm) Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) { friendRequest = &relation.FriendRequestModel{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "fromUserID", fromUserID, "toUserID", toUserID, "friendRequest", *friendRequest) }() - utils.Wrap(getDBConn(f.DB, tx).Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Find(friendRequest).Error, "") + utils.Wrap(f.DB.Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Find(friendRequest).Error, "") return } -func (f *FriendRequestGorm) Take(ctx context.Context, fromUserID, toUserID string, tx ...*gorm.DB) (friendRequest *relation.FriendRequestModel, err error) { +func (f *FriendRequestGorm) Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *relation.FriendRequestModel, err error) { friendRequest = &relation.FriendRequestModel{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "fromUserID", fromUserID, "toUserID", toUserID, "friendRequest", *friendRequest) }() - utils.Wrap(getDBConn(f.DB, tx).Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Take(friendRequest).Error, "") + utils.Wrap(f.DB.Where("from_user_id = ? and to_user_id", fromUserID, toUserID).Take(friendRequest).Error, "") return } // 获取toUserID收到的好友申请列表 -func (f *FriendRequestGorm) FindToUserID(ctx context.Context, toUserID string, pageNumber, showNumber int32, tx ...*gorm.DB) (friendRequests []*relation.FriendRequestModel, total int64, err error) { +func (f *FriendRequestGorm) FindToUserID(ctx context.Context, toUserID string, pageNumber, showNumber int32) (friendRequests []*relation.FriendRequestModel, total int64, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "toUserID", toUserID, "friendRequests", friendRequests) }() - err = getDBConn(f.DB, tx).Model(&relation.FriendRequestModel{}).Where("to_user_id = ? ", toUserID).Count(&total).Error + err = f.DB.Model(&relation.FriendRequestModel{}).Where("to_user_id = ? ", toUserID).Count(&total).Error if err != nil { return nil, 0, utils.Wrap(err, "") } - err = utils.Wrap(getDBConn(f.DB, tx).Where("to_user_id = ? ", toUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friendRequests).Error, "") + err = utils.Wrap(f.DB.Where("to_user_id = ? ", toUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friendRequests).Error, "") return } // 获取fromUserID发出去的好友申请列表 -func (f *FriendRequestGorm) FindFromUserID(ctx context.Context, fromUserID string, pageNumber, showNumber int32, tx ...*gorm.DB) (friendRequests []*relation.FriendRequestModel, total int64, err error) { +func (f *FriendRequestGorm) FindFromUserID(ctx context.Context, fromUserID string, pageNumber, showNumber int32) (friendRequests []*relation.FriendRequestModel, total int64, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "fromUserID", fromUserID, "friendRequests", friendRequests) }() - err = getDBConn(f.DB, tx).Model(&relation.FriendRequestModel{}).Where("from_user_id = ? ", fromUserID).Count(&total).Error + err = f.DB.Model(&relation.FriendRequestModel{}).Where("from_user_id = ? ", fromUserID).Count(&total).Error if err != nil { return nil, 0, utils.Wrap(err, "") } - err = utils.Wrap(getDBConn(f.DB, tx).Where("from_user_id = ? ", fromUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friendRequests).Error, "") + err = utils.Wrap(f.DB.Where("from_user_id = ? ", fromUserID).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&friendRequests).Error, "") return } diff --git a/pkg/common/db/relation/group_member_model.go b/pkg/common/db/relation/group_member_model.go index 06b41b43a..1c178eab3 100644 --- a/pkg/common/db/relation/group_member_model.go +++ b/pkg/common/db/relation/group_member_model.go @@ -19,49 +19,53 @@ func NewGroupMemberDB(db *gorm.DB) relation.GroupMemberModelInterface { return &GroupMemberGorm{DB: db} } -func (g *GroupMemberGorm) Create(ctx context.Context, groupMemberList []*relation.GroupMemberModel, tx ...any) (err error) { +func (g *GroupMemberGorm) NewTx(tx any) relation.GroupMemberModelInterface { + return &GroupMemberGorm{DB: tx.(*gorm.DB)} +} + +func (g *GroupMemberGorm) Create(ctx context.Context, groupMemberList []*relation.GroupMemberModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMemberList", groupMemberList) }() - return utils.Wrap(getDBConn(g.DB, tx).Create(&groupMemberList).Error, "") + return utils.Wrap(g.DB.Create(&groupMemberList).Error, "") } -func (g *GroupMemberGorm) Delete(ctx context.Context, groupID string, userIDs []string, tx ...any) (err error) { +func (g *GroupMemberGorm) Delete(ctx context.Context, groupID string, userIDs []string) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userIDs", userIDs) }() - return utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id in (?)", groupID, userIDs).Delete(&relation.GroupMemberModel{}).Error, "") + return utils.Wrap(g.DB.Where("group_id = ? and user_id in (?)", groupID, userIDs).Delete(&relation.GroupMemberModel{}).Error, "") } -func (g *GroupMemberGorm) DeleteGroup(ctx context.Context, groupIDs []string, tx ...any) (err error) { +func (g *GroupMemberGorm) DeleteGroup(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(&relation.GroupMemberModel{}).Error, "") + return utils.Wrap(g.DB.Where("group_id in (?)", groupIDs).Delete(&relation.GroupMemberModel{}).Error, "") } -func (g *GroupMemberGorm) Update(ctx context.Context, groupID string, userID string, data map[string]any, tx ...any) (err error) { +func (g *GroupMemberGorm) Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "data", data) }() - return utils.Wrap(getDBConn(g.DB, tx).Model(&relation.GroupMemberModel{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(data).Error, "") + return utils.Wrap(g.DB.Model(&relation.GroupMemberModel{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(data).Error, "") } -func (g *GroupMemberGorm) UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32, tx ...any) (rowsAffected int64, err error) { +func (g *GroupMemberGorm) UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) (rowsAffected int64, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "roleLevel", roleLevel) }() - db := getDBConn(g.DB, tx).Model(&relation.GroupMemberModel{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(map[string]any{ + db := g.DB.Model(&relation.GroupMemberModel{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(map[string]any{ "role_level": roleLevel, }) return db.RowsAffected, utils.Wrap(db.Error, "") } -func (g *GroupMemberGorm) Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, tx ...any) (groupList []*relation.GroupMemberModel, err error) { +func (g *GroupMemberGorm) Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (groupList []*relation.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "userIDs", userIDs, "groupList", groupList) }() - db := getDBConn(g.DB, tx) + db := g.DB if len(groupIDs) > 0 { db = db.Where("group_id in (?)", groupIDs) } @@ -74,41 +78,41 @@ func (g *GroupMemberGorm) Find(ctx context.Context, groupIDs []string, userIDs [ return groupList, utils.Wrap(db.Find(&groupList).Error, "") } -func (g *GroupMemberGorm) Take(ctx context.Context, groupID string, userID string, tx ...any) (groupMember *relation.GroupMemberModel, err error) { +func (g *GroupMemberGorm) Take(ctx context.Context, groupID string, userID string) (groupMember *relation.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember) }() groupMember = &relation.GroupMemberModel{} - return groupMember, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id = ?", groupID, userID).Take(groupMember).Error, "") + return groupMember, utils.Wrap(g.DB.Where("group_id = ? and user_id = ?", groupID, userID).Take(groupMember).Error, "") } -func (g *GroupMemberGorm) TakeOwner(ctx context.Context, groupID string, tx ...any) (groupMember *relation.GroupMemberModel, err error) { +func (g *GroupMemberGorm) TakeOwner(ctx context.Context, groupID string) (groupMember *relation.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMember", *groupMember) }() groupMember = &relation.GroupMemberModel{} - return groupMember, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and role_level = ?", groupID, constant.GroupOwner).Take(groupMember).Error, "") + return groupMember, utils.Wrap(g.DB.Where("group_id = ? and role_level = ?", groupID, constant.GroupOwner).Take(groupMember).Error, "") } -func (g *GroupMemberGorm) SearchMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32, tx ...any) (total uint32, groupList []*relation.GroupMemberModel, err error) { +func (g *GroupMemberGorm) SearchMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (total uint32, groupList []*relation.GroupMemberModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "keyword", keyword, "groupIDs", groupIDs, "userIDs", userIDs, "roleLevels", roleLevels, "pageNumber", pageNumber, "showNumber", showNumber, "total", total, "groupList", groupList) }() - db := getDBConn(g.DB, tx) + db := g.DB gormIn(&db, "group_id", groupIDs) gormIn(&db, "user_id", userIDs) gormIn(&db, "role_level", roleLevels) return gormSearch[relation.GroupMemberModel](db, []string{"nickname"}, keyword, pageNumber, showNumber) } -func (g *GroupMemberGorm) MapGroupMemberNum(ctx context.Context, groupIDs []string, tx ...any) (count map[string]uint32, err error) { +func (g *GroupMemberGorm) MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "count", count) }() - return mapCount(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs), "group_id") + return mapCount(g.DB.Where("group_id in (?)", groupIDs), "group_id") } -func (g *GroupMemberGorm) FindJoinUserID(ctx context.Context, groupIDs []string, tx ...any) (groupUsers map[string][]string, err error) { +func (g *GroupMemberGorm) FindJoinUserID(ctx context.Context, groupIDs []string) (groupUsers map[string][]string, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "groupUsers", groupUsers) }() @@ -116,7 +120,7 @@ func (g *GroupMemberGorm) FindJoinUserID(ctx context.Context, groupIDs []string, GroupID string `gorm:"group_id"` UserID string `gorm:"user_id"` } - if err := getDBConn(g.DB, tx).Model(&relation.GroupMemberModel{}).Where("group_id in (?)", groupIDs).Find(&items).Error; err != nil { + if err := g.DB.Model(&relation.GroupMemberModel{}).Where("group_id in (?)", groupIDs).Find(&items).Error; err != nil { return nil, utils.Wrap(err, "") } groupUsers = make(map[string][]string) @@ -126,9 +130,9 @@ func (g *GroupMemberGorm) FindJoinUserID(ctx context.Context, groupIDs []string, return groupUsers, nil } -func (g *GroupMemberGorm) FindMemberUserID(ctx context.Context, groupID string, tx ...any) (userIDs []string, err error) { +func (g *GroupMemberGorm) FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error) { 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).Error, "") + return userIDs, utils.Wrap(g.DB.Model(&relation.GroupMemberModel{}).Where("group_id = ?", groupID).Pluck("user_id", &userIDs).Error, "") } diff --git a/pkg/common/db/relation/group_model.go b/pkg/common/db/relation/group_model.go index b0cc99f5d..e6a4ff962 100644 --- a/pkg/common/db/relation/group_model.go +++ b/pkg/common/db/relation/group_model.go @@ -18,59 +18,56 @@ func NewGroupDB(db *gorm.DB) relation.GroupModelInterface { return &GroupGorm{DB: db} } -func (g *GroupGorm) Create(ctx context.Context, groups []*relation.GroupModel, tx ...any) (err error) { +func (g *GroupGorm) NewTx(tx any) relation.GroupModelInterface { + return &GroupGorm{DB: tx.(*gorm.DB)} +} + +func (g *GroupGorm) Create(ctx context.Context, groups []*relation.GroupModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups) }() - return utils.Wrap(getDBConn(g.DB, tx).Create(&groups).Error, "") + return utils.Wrap(g.DB.Create(&groups).Error, "") } -//func (g *GroupGorm) Delete(ctx context.Context, groupIDs []string, tx ...any) (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(&relation.GroupModel{}).Error, "") -//} - -func (g *GroupGorm) UpdateMap(ctx context.Context, groupID string, args map[string]interface{}, tx ...any) (err error) { +func (g *GroupGorm) UpdateMap(ctx context.Context, groupID string, args map[string]interface{}) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "args", args) }() - return utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Model(&relation.GroupModel{}).Updates(args).Error, "") + return utils.Wrap(g.DB.Where("group_id = ?", groupID).Model(&relation.GroupModel{}).Updates(args).Error, "") } -func (g *GroupGorm) UpdateStatus(ctx context.Context, groupID string, status int32, tx ...any) (err error) { +func (g *GroupGorm) UpdateStatus(ctx context.Context, groupID string, status int32) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "status", status) }() - return utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Model(&relation.GroupModel{}).Updates(map[string]any{"status": status}).Error, "") + return utils.Wrap(g.DB.Where("group_id = ?", groupID).Model(&relation.GroupModel{}).Updates(map[string]any{"status": status}).Error, "") } -func (g *GroupGorm) Find(ctx context.Context, groupIDs []string, tx ...any) (groups []*relation.GroupModel, err error) { +func (g *GroupGorm) Find(ctx context.Context, groupIDs []string) (groups []*relation.GroupModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "groups", groups) }() - return groups, utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Find(&groups).Error, "") + return groups, utils.Wrap(g.DB.Where("group_id in (?)", groupIDs).Find(&groups).Error, "") } -func (g *GroupGorm) Take(ctx context.Context, groupID string, tx ...any) (group *relation.GroupModel, err error) { +func (g *GroupGorm) Take(ctx context.Context, groupID string) (group *relation.GroupModel, err error) { group = &relation.GroupModel{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", group) }() - return group, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Take(group).Error, "") + return group, utils.Wrap(g.DB.Where("group_id = ?", groupID).Take(group).Error, "") } -func (g *GroupGorm) Search(ctx context.Context, keyword string, pageNumber, showNumber int32, tx ...any) (total uint32, groups []*relation.GroupModel, err error) { +func (g *GroupGorm) Search(ctx context.Context, keyword string, pageNumber, showNumber int32) (total uint32, groups []*relation.GroupModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "keyword", keyword, "pageNumber", pageNumber, "showNumber", showNumber, "total", total, "groups", groups) }() - return gormSearch[relation.GroupModel](getDBConn(g.DB, tx), []string{"name"}, keyword, pageNumber, showNumber) + return gormSearch[relation.GroupModel](g.DB, []string{"name"}, keyword, pageNumber, showNumber) } func (g *GroupGorm) GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) { - if err := g.DB.Model(&relation.GroupModel{}).Where("group_type = ? ", groupType).Pluck("group_id", &groupIDs).Error; err != nil { - return nil, utils.Wrap(err, "") - } - return groupIDs, nil + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupType", groupType, "groupIDs", groupIDs) + }() + return groupIDs, utils.Wrap(g.DB.Model(&relation.GroupModel{}).Where("group_type = ? ", groupType).Pluck("group_id", &groupIDs).Error, "") } diff --git a/pkg/common/db/relation/group_request_model.go b/pkg/common/db/relation/group_request_model.go index a0c4b01fb..3525878c6 100644 --- a/pkg/common/db/relation/group_request_model.go +++ b/pkg/common/db/relation/group_request_model.go @@ -8,78 +8,50 @@ import ( "gorm.io/gorm" ) -var _ relation.GroupRequestModelInterface = (*GroupRequestGorm)(nil) - type GroupRequestGorm struct { DB *gorm.DB } +func (g *GroupRequestGorm) NewTx(tx any) relation.GroupRequestModelInterface { + return &GroupRequestGorm{ + DB: tx.(*gorm.DB), + } +} + func NewGroupRequest(db *gorm.DB) relation.GroupRequestModelInterface { return &GroupRequestGorm{ DB: db, } } -func (g *GroupRequestGorm) Create(ctx context.Context, groupRequests []*relation.GroupRequestModel, tx ...any) (err error) { +func (g *GroupRequestGorm) Create(ctx context.Context, groupRequests []*relation.GroupRequestModel) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests) }() - return utils.Wrap(getDBConn(g.DB, tx).Create(&groupRequests).Error, utils.GetSelfFuncName()) + return utils.Wrap(g.DB.Create(&groupRequests).Error, utils.GetSelfFuncName()) } -//func (g *GroupRequestGorm) Delete(ctx context.Context, groupRequests []*relation.GroupRequestModel, tx ...any) (err error) { -// defer func() { -// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests) -// }() -// return utils.Wrap(getDBConn(g.DB, tx).Delete(&groupRequests).Error, utils.GetSelfFuncName()) -//} - -//func (g *GroupRequestGorm) UpdateMap(ctx context.Context, groupID string, userID string, args map[string]interface{}, tx ...any) (err error) { -// defer func() { -// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "args", args) -// }() -// return utils.Wrap(getDBConn(g.DB, tx).Model(&relation.GroupRequestModel{}).Where("group_id = ? and user_id = ? ", groupID, userID).Updates(args).Error, utils.GetSelfFuncName()) -//} - -func (g *GroupRequestGorm) UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, tx ...any) (err error) { +func (g *GroupRequestGorm) UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32) (err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "handledMsg", handledMsg, "handleResult", handleResult) }() - return utils.Wrap(getDBConn(g.DB, tx).Model(&relation.GroupRequestModel{}).Where("group_id = ? and user_id = ? ", groupID, userID).Updates(map[string]any{ + return utils.Wrap(g.DB.Model(&relation.GroupRequestModel{}).Where("group_id = ? and user_id = ? ", groupID, userID).Updates(map[string]any{ "handle_msg": handledMsg, "handle_result": handleResult, }).Error, utils.GetSelfFuncName()) } -//func (g *GroupRequestGorm) Update(ctx context.Context, groupRequests []*relation.GroupRequestModel, tx ...any) (err error) { -// defer func() { -// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests) -// }() -// return utils.Wrap(getDBConn(g.DB, tx).Updates(&groupRequests).Error, utils.GetSelfFuncName()) -//} - -//func (g *GroupRequestGorm) Find(ctx context.Context, groupRequests []*relation.GroupRequestModel, tx ...any) (resultGroupRequests []*relation.GroupRequestModel, err error) { -// defer func() { -// tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupRequests", groupRequests, "resultGroupRequests", resultGroupRequests) -// }() -// var where [][]interface{} -// for _, groupMember := range groupRequests { -// where = append(where, []interface{}{groupMember.GroupID, groupMember.UserID}) -// } -// return resultGroupRequests, utils.Wrap(getDBConn(g.DB, tx).Where("(group_id, user_id) in ?", where).Find(&resultGroupRequests).Error, utils.GetSelfFuncName()) -//} - -func (g *GroupRequestGorm) Take(ctx context.Context, groupID string, userID string, tx ...any) (groupRequest *relation.GroupRequestModel, err error) { +func (g *GroupRequestGorm) Take(ctx context.Context, groupID string, userID string) (groupRequest *relation.GroupRequestModel, err error) { groupRequest = &relation.GroupRequestModel{} defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupRequest", *groupRequest) }() - return groupRequest, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id = ? ", groupID, userID).Take(groupRequest).Error, utils.GetSelfFuncName()) + return groupRequest, utils.Wrap(g.DB.Where("group_id = ? and user_id = ? ", groupID, userID).Take(groupRequest).Error, utils.GetSelfFuncName()) } -func (g *GroupRequestGorm) Page(ctx context.Context, userID string, pageNumber, showNumber int32, tx ...any) (total uint32, groups []*relation.GroupRequestModel, err error) { +func (g *GroupRequestGorm) Page(ctx context.Context, userID string, pageNumber, showNumber int32) (total uint32, groups []*relation.GroupRequestModel, err error) { defer func() { tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "pageNumber", pageNumber, "showNumber", showNumber, "total", total, "groups", groups) }() - return gormSearch[relation.GroupRequestModel](getDBConn(g.DB, tx).Where("user_id = ?", userID), nil, "", pageNumber, showNumber) + return gormSearch[relation.GroupRequestModel](g.DB.Where("user_id = ?", userID), nil, "", pageNumber, showNumber) } diff --git a/pkg/common/db/relation/mysql_init.go b/pkg/common/db/relation/mysql_init.go index d4461c294..1047f51cc 100644 --- a/pkg/common/db/relation/mysql_init.go +++ b/pkg/common/db/relation/mysql_init.go @@ -3,14 +3,14 @@ package relation import ( "Open_IM/pkg/common/config" "fmt" + "gorm.io/driver/mysql" "time" - "gorm.io/driver/mysql" "gorm.io/gorm" "gorm.io/gorm/logger" ) -func NewGormDB() (*gorm.DB, error) { +func newMysqlGormDB() (*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) @@ -58,91 +58,13 @@ func NewGormDB() (*gorm.DB, error) { return db, nil } -type Mysql struct { - gormConn *gorm.DB +// gorm mysql +func NewGormDB() (*gorm.DB, error) { + return newMysqlGormDB() } -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/relation/user_model.go b/pkg/common/db/relation/user_model.go index 2983f4488..c76aca95e 100644 --- a/pkg/common/db/relation/user_model.go +++ b/pkg/common/db/relation/user_model.go @@ -1,204 +1,86 @@ package relation import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/table/relation" + "Open_IM/pkg/common/tracelog" "Open_IM/pkg/utils" - "fmt" + "context" "gorm.io/gorm" - "time" ) -func InitManager() { - for k, v := range config.Config.Manager.AppManagerUid { - _, err := GetUserByUserID(v) - if err != nil { - } else { - continue - } - var appMgr User - appMgr.UserID = v - if k == 0 { - appMgr.Nickname = config.Config.Manager.AppSysNotificationName - } else { - appMgr.Nickname = "AppManager" + utils.IntToString(k+1) - } - appMgr.AppMangerLevel = constant.AppAdmin - err = UserRegister(appMgr) - if err != nil { - fmt.Println("AppManager insert error ", err.Error(), appMgr) - } else { - fmt.Println("AppManager insert ", appMgr) - } - } +type UserGorm struct { + DB *gorm.DB } -func UserRegister(user User) error { - user.CreateTime = time.Now() - if user.AppMangerLevel == 0 { - user.AppMangerLevel = constant.AppOrdinaryUsers - } - if user.Birth.Unix() < 0 { - user.Birth = utils.UnixSecondToTime(0) - } - err := UserDB.Table("users").Create(&user).Error - if err != nil { - return err - } - return nil +func NewUserGorm(DB *gorm.DB) relation.UserModelInterface { + return &UserGorm{DB: DB} } -func GetAllUser() ([]User, error) { - var userList []User - err := UserDB.Table("users").Find(&userList).Error - return userList, err +// 插入多条 +func (u *UserGorm) Create(ctx context.Context, users []*relation.UserModel) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "users", users) + }() + return utils.Wrap(u.DB.Create(&users).Error, "") } -func TakeUserByUserID(userID string) (*User, error) { - var user User - err := UserDB.Table("users").Where("user_id=?", userID).Take(&user).Error - if err != nil { - return nil, err - } - return &user, nil +// 更新用户信息 零值 +func (u *UserGorm) UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "args", args) + }() + return utils.Wrap(u.DB.Model(&relation.UserModel{}).Where("user_id = ?", userID).Updates(args).Error, "") } -func GetUserByUserID(userID string) (*User, error) { - var user User - err := UserDB.Table("users").Where("user_id=?", userID).Take(&user).Error - if err != nil { - return nil, err - } - return &user, nil +// 更新多个用户信息 非零值 +func (u *UserGorm) Update(ctx context.Context, users []*relation.UserModel) (err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "users", users) + }() + return utils.Wrap(u.DB.Updates(&users).Error, "") } -func GetUsersByUserIDList(userIDList []string) ([]*User, error) { - var userList []*User - err := UserDB.Table("users").Where("user_id in (?)", userIDList).Find(&userList).Error - return userList, err -} - -func GetUserNameByUserID(userID string) (string, error) { - var user User - err := UserDB.Table("users").Select("name").Where("user_id=?", userID).First(&user).Error - if err != nil { - return "", err - } - return user.Nickname, nil -} - -func UpdateUserInfo(user User) error { - return UserDB.Where("user_id=?", user.UserID).Updates(&user).Error -} - -func UpdateUserInfoByMap(user User, m map[string]interface{}) error { - err := UserDB.Where("user_id=?", user.UserID).Updates(m).Error - return err -} - -func SelectAllUserID() ([]string, error) { - var resultArr []string - err := UserDB.Pluck("user_id", &resultArr).Error - if err != nil { - return nil, err - } - return resultArr, nil -} - -func SelectSomeUserID(userIDList []string) ([]string, error) { - var resultArr []string - err := UserDB.Pluck("user_id", &resultArr).Error - if err != nil { - return nil, err - } - return resultArr, nil -} - -func GetUsers(showNumber, pageNumber int32) ([]User, error) { - var users []User - err := UserDB.Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&users).Error - if err != nil { - return users, err - } +// 获取指定用户信息 不存在,也不返回错误 +func (u *UserGorm) Find(ctx context.Context, userIDs []string) (users []*relation.UserModel, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDs", userIDs, "users", users) + }() + err = utils.Wrap(u.DB.Where("user_id in (?)", userIDs).Find(&users).Error, "") return users, err } -func AddUser(userID string, phoneNumber string, name string, email string, gender int32, faceURL string, birth string) error { - _birth, err := utils.TimeStringToTime(birth) +// 获取某个用户信息 不存在,则返回错误 +func (u *UserGorm) Take(ctx context.Context, userID string) (user *relation.UserModel, err error) { + user = &relation.UserModel{} + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "user", *user) + }() + err = utils.Wrap(u.DB.Where("user_id = ?", userID).Take(&user).Error, "") + return user, err +} + +// 获取用户信息 不存在,不返回错误 +func (u *UserGorm) Page(ctx context.Context, pageNumber, showNumber int32) (users []*relation.UserModel, count int64, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "pageNumber", pageNumber, "showNumber", showNumber, "users", users, "count", count) + }() + err = utils.Wrap(u.DB.Model(&relation.UserModel{}).Count(&count).Error, "") if err != nil { - return err + return } - user := User{ - UserID: userID, - Nickname: name, - FaceURL: faceURL, - Gender: gender, - PhoneNumber: phoneNumber, - Birth: _birth, - Email: email, - Ex: "", - CreateTime: time.Now(), - } - result := UserDB.Create(&user) - return result.Error + err = utils.Wrap(u.DB.Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&users).Error, "") + return } -func UsersIsBlock(userIDList []string) (inBlockUserIDList []string, err error) { - err = BlackListDB.Where("uid in (?) and end_disable_time > now()", userIDList).Pluck("uid", &inBlockUserIDList).Error - return inBlockUserIDList, err -} - -type BlockUserInfo struct { - User User - BeginDisableTime time.Time - EndDisableTime time.Time -} - -func GetUserByName(userName string, showNumber, pageNumber int32) ([]User, error) { - var users []User - err := UserDB.Where(" name like ?", fmt.Sprintf("%%%s%%", userName)).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&users).Error - return users, err -} - -func GetUsersByNameAndID(content string, showNumber, pageNumber int32) ([]User, int64, error) { - var users []User - var count int64 - db := UserDB.Where(" name like ? or user_id = ? ", fmt.Sprintf("%%%s%%", content), content) - if err := db.Count(&count).Error; err != nil { - return nil, 0, err +// 获取所有用户ID +func (u *UserGorm) PageUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, count int64, err error) { + defer func() { + tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "pageNumber", pageNumber, "showNumber", showNumber, "userIDs", userIDs, "count", count) + }() + err = utils.Wrap(u.DB.Model(&relation.UserModel{}).Count(&count).Error, "") + if err != nil { + return } - err := db.Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&users).Error - return users, count, err -} - -func GetUserIDsByEmailAndID(phoneNumber, email string) ([]string, error) { - if phoneNumber == "" && email == "" { - return nil, nil - } - db := UserDB - if phoneNumber != "" { - db = db.Where("phone_number = ? ", phoneNumber) - } - if email != "" { - db = db.Where("email = ? ", email) - } - var userIDList []string - err := db.Pluck("user_id", &userIDList).Error - return userIDList, err -} - -func GetUsersCount(userName string) (int32, error) { - var count int64 - if err := UserDB.Where(" name like ? ", fmt.Sprintf("%%%s%%", userName)).Count(&count).Error; err != nil { - return 0, err - } - return int32(count), nil -} - -func GetBlockUsersNumCount() (int32, error) { - var count int64 - if err := BlackListDB.Count(&count).Error; err != nil { - return 0, err - } - return int32(count), nil + err = u.DB.Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Pluck("user_id", &userIDs).Error + return userIDs, count, err } diff --git a/pkg/common/db/relation/user_model_k.go b/pkg/common/db/relation/user_model_k.go deleted file mode 100644 index a3b573d94..000000000 --- a/pkg/common/db/relation/user_model_k.go +++ /dev/null @@ -1,109 +0,0 @@ -package relation - -import ( - "Open_IM/pkg/common/db/table/relation" - "Open_IM/pkg/common/tracelog" - "Open_IM/pkg/utils" - "context" - "fmt" - "gorm.io/gorm" -) - -type UserGorm struct { - DB *gorm.DB -} - -func NewUserGorm(db *gorm.DB) *UserGorm { - var user UserGorm - user.DB = db - return &user -} - -// 插入多条 -func (u *UserGorm) Create(ctx context.Context, users []*relation.UserModel, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "users", users) - }() - return utils.Wrap(getDBConn(u.DB, tx).Create(&users).Error, "") -} - -// 更新用户信息 零值 -func (u *UserGorm) UpdateByMap(ctx context.Context, userID string, args map[string]interface{}, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "args", args) - }() - return utils.Wrap(getDBConn(u.DB, tx).Model(&relation.UserModel{}).Where("user_id = ?", userID).Updates(args).Error, "") -} - -// 更新多个用户信息 非零值 -func (u *UserGorm) Update(ctx context.Context, users []*relation.UserModel, tx ...any) (err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "users", users) - }() - return utils.Wrap(getDBConn(u.DB, tx).Updates(&users).Error, "") -} - -// 获取指定用户信息 不存在,也不返回错误 -func (u *UserGorm) Find(ctx context.Context, userIDs []string, tx ...any) (users []*relation.UserModel, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDs", userIDs, "users", users) - }() - err = utils.Wrap(getDBConn(u.DB, tx).Where("user_id in (?)", userIDs).Find(&users).Error, "") - return users, err -} - -// 获取某个用户信息 不存在,则返回错误 -func (u *UserGorm) Take(ctx context.Context, userID string, tx ...any) (user *relation.UserModel, err error) { - user = &relation.UserModel{} - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID, "user", *user) - }() - err = utils.Wrap(getDBConn(u.DB, tx).Where("user_id = ?", userID).Take(&user).Error, "") - return user, err -} - -// 通过名字查找用户 不存在,不返回错误 -func (u *UserGorm) GetByName(ctx context.Context, userName string, pageNumber, showNumber int32, tx ...any) (users []*relation.UserModel, count int64, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userName", userName, "pageNumber", pageNumber, "showNumber", showNumber, "users", users, "count", count) - }() - err = utils.Wrap(getDBConn(u.DB, tx).Model(&relation.UserModel{}).Where(" name like ?", fmt.Sprintf("%%%s%%", userName)).Count(&count).Error, "") - if err != nil { - return - } - err = utils.Wrap(getDBConn(u.DB, tx).Model(&relation.UserModel{}).Where(" name like ?", fmt.Sprintf("%%%s%%", userName)).Limit(int(showNumber)).Offset(int(showNumber*pageNumber)).Find(&users).Error, "") - return -} - -// 通过名字或userID查找用户 不存在,不返回错误 -func (u *UserGorm) GetByNameAndID(ctx context.Context, content string, pageNumber, showNumber int32, tx ...any) (users []*relation.UserModel, count int64, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "content", content, "pageNumber", pageNumber, "showNumber", showNumber, "users", users, "count", count) - }() - db := getDBConn(u.DB, tx).Model(&relation.UserModel{}).Where(" name like ? or user_id = ? ", fmt.Sprintf("%%%s%%", content), content) - if err = db.Count(&count).Error; err != nil { - return - } - err = utils.Wrap(db.Limit(int(showNumber)).Offset(int(showNumber*pageNumber)).Find(&users).Error, "") - return -} - -// 获取用户信息 不存在,不返回错误 -func (u *UserGorm) Page(ctx context.Context, pageNumber, showNumber int32, tx ...any) (users []*relation.UserModel, count int64, err error) { - defer func() { - tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "pageNumber", pageNumber, "showNumber", showNumber, "users", users, "count", count) - }() - err = utils.Wrap(getDBConn(u.DB, tx).Model(&relation.UserModel{}).Count(&count).Error, "") - if err != nil { - return - } - err = utils.Wrap(getDBConn(u.DB, tx).Limit(int(showNumber)).Offset(int(pageNumber*showNumber)).Find(&users).Error, "") - return -} - -// 获取所有用户ID -func (u *UserGorm) GetAllUserID(ctx context.Context) ([]string, error) { - var userIDs []string - err := u.DB.Pluck("user_id", &userIDs).Error - return userIDs, err -} diff --git a/pkg/common/db/table/relation/black.go b/pkg/common/db/table/relation/black.go index 6dcf8fda0..fd25cff7f 100644 --- a/pkg/common/db/table/relation/black.go +++ b/pkg/common/db/table/relation/black.go @@ -1,6 +1,7 @@ package relation import ( + "context" "time" ) @@ -22,4 +23,12 @@ func (BlackModel) TableName() string { } type BlackModelInterface interface { + Create(ctx context.Context, blacks []*BlackModel) (err error) + Delete(ctx context.Context, blacks []*BlackModel) (err error) + UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]interface{}) (err error) + Update(ctx context.Context, blacks []*BlackModel) (err error) + Find(ctx context.Context, blacks []*BlackModel) (blackList []*BlackModel, err error) + Take(ctx context.Context, ownerUserID, blockUserID string) (black *BlackModel, err error) + FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*BlackModel, total int64, err error) + FindBlackUserIDs(ctx context.Context, ownerUserID string) (blackUserIDs []string, err error) } diff --git a/pkg/common/db/table/relation/friend.go b/pkg/common/db/table/relation/friend.go index de00f7747..e9eb35c65 100644 --- a/pkg/common/db/table/relation/friend.go +++ b/pkg/common/db/table/relation/friend.go @@ -1,6 +1,9 @@ package relation -import "time" +import ( + "context" + "time" +) const ( FriendModelTableName = "friends" @@ -21,4 +24,30 @@ func (FriendModel) TableName() string { } type FriendModelInterface interface { + // 插入多条记录 + Create(ctx context.Context, friends []*FriendModel) (err error) + // 删除ownerUserID指定的好友 + Delete(ctx context.Context, ownerUserID string, friendUserIDs []string) (err error) + // 更新ownerUserID单个好友信息 更新零值 + UpdateByMap(ctx context.Context, ownerUserID string, friendUserID string, args map[string]interface{}) (err error) + // 更新好友信息的非零值 + Update(ctx context.Context, friends []*FriendModel) (err error) + // 更新好友备注(也支持零值 ) + UpdateRemark(ctx context.Context, ownerUserID, friendUserID, remark string) (err error) + // 获取单个好友信息,如没找到 返回错误 + Take(ctx context.Context, ownerUserID, friendUserID string) (friend *FriendModel, err error) + // 查找好友关系,如果是双向关系,则都返回 + FindUserState(ctx context.Context, userID1, userID2 string) (friends []*FriendModel, err error) + // 获取 owner指定的好友列表 如果有friendUserIDs不存在,也不返回错误 + FindFriends(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*FriendModel, err error) + // 获取哪些人添加了friendUserID 如果有ownerUserIDs不存在,也不返回错误 + FindReversalFriends(ctx context.Context, friendUserID string, ownerUserIDs []string) (friends []*FriendModel, err error) + // 获取ownerUserID好友列表 支持翻页 + FindOwnerFriends(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (friends []*FriendModel, total int64, err error) + // 获取哪些人添加了friendUserID 支持翻页 + FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*FriendModel, total int64, err error) + // 获取好友UserID列表 + FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error) + + NewTx(tx any) FriendModelInterface } diff --git a/pkg/common/db/table/relation/friend_request.go b/pkg/common/db/table/relation/friend_request.go index 8a4ea2805..559b67bb2 100644 --- a/pkg/common/db/table/relation/friend_request.go +++ b/pkg/common/db/table/relation/friend_request.go @@ -1,6 +1,9 @@ package relation -import "time" +import ( + "context" + "time" +) const FriendRequestModelTableName = "friend_requests" @@ -21,4 +24,21 @@ func (FriendRequestModel) TableName() string { } type FriendRequestModelInterface interface { + // 插入多条记录 + Create(ctx context.Context, friendRequests []*FriendRequestModel) (err error) + // 删除记录 + Delete(ctx context.Context, fromUserID, toUserID string) (err error) + // 更新零值 + UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}) (err error) + // 更新多条记录 (非零值) + Update(ctx context.Context, friendRequests []*FriendRequestModel) (err error) + // 获取来指定用户的好友申请 未找到 不返回错误 + Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *FriendRequestModel, err error) + Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *FriendRequestModel, err error) + // 获取toUserID收到的好友申请列表 + FindToUserID(ctx context.Context, toUserID string, pageNumber, showNumber int32) (friendRequests []*FriendRequestModel, total int64, err error) + // 获取fromUserID发出去的好友申请列表 + FindFromUserID(ctx context.Context, fromUserID string, pageNumber, showNumber int32) (friendRequests []*FriendRequestModel, total int64, err error) + + NewTx(tx any) FriendRequestModelInterface } diff --git a/pkg/common/db/table/relation/group.go b/pkg/common/db/table/relation/group.go index b95e814da..c011699ae 100644 --- a/pkg/common/db/table/relation/group.go +++ b/pkg/common/db/table/relation/group.go @@ -32,11 +32,12 @@ func (GroupModel) TableName() string { } type GroupModelInterface interface { - Create(ctx context.Context, groups []*GroupModel, tx ...any) (err error) - //Delete(ctx context.Context, groupIDs []string, tx ...any) (err error) - UpdateMap(ctx context.Context, groupID string, args map[string]interface{}, tx ...any) (err error) - UpdateStatus(ctx context.Context, groupID string, status int32, tx ...any) (err error) - Find(ctx context.Context, groupIDs []string, tx ...any) (groups []*GroupModel, err error) - Take(ctx context.Context, groupID string, tx ...any) (group *GroupModel, err error) - Search(ctx context.Context, keyword string, pageNumber, showNumber int32, tx ...any) (total uint32, groups []*GroupModel, err error) + NewTx(tx any) GroupModelInterface + Create(ctx context.Context, groups []*GroupModel) (err error) + UpdateMap(ctx context.Context, groupID string, args map[string]interface{}) (err error) + UpdateStatus(ctx context.Context, groupID string, status int32) (err error) + Find(ctx context.Context, groupIDs []string) (groups []*GroupModel, err error) + Take(ctx context.Context, groupID string) (group *GroupModel, err error) + Search(ctx context.Context, keyword string, pageNumber, showNumber int32) (total uint32, groups []*GroupModel, err error) + GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) } diff --git a/pkg/common/db/table/relation/group_member.go b/pkg/common/db/table/relation/group_member.go index 221fe5a4b..c05332828 100644 --- a/pkg/common/db/table/relation/group_member.go +++ b/pkg/common/db/table/relation/group_member.go @@ -28,16 +28,17 @@ func (GroupMemberModel) TableName() string { } type GroupMemberModelInterface interface { - Create(ctx context.Context, groupMemberList []*GroupMemberModel, tx ...any) (err error) - Delete(ctx context.Context, groupID string, userIDs []string, tx ...any) (err error) - DeleteGroup(ctx context.Context, groupIDs []string, tx ...any) (err error) - Update(ctx context.Context, groupID string, userID string, data map[string]any, tx ...any) (err error) - UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32, tx ...any) (rowsAffected int64, err error) - Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32, tx ...any) (groupList []*GroupMemberModel, err error) - FindMemberUserID(ctx context.Context, groupID string, tx ...any) (userIDs []string, err error) - Take(ctx context.Context, groupID string, userID string, tx ...any) (groupMember *GroupMemberModel, err error) - TakeOwner(ctx context.Context, groupID string, tx ...any) (groupMember *GroupMemberModel, err error) - SearchMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32, tx ...any) (total uint32, groupList []*GroupMemberModel, err error) - MapGroupMemberNum(ctx context.Context, groupIDs []string, tx ...any) (count map[string]uint32, err error) - FindJoinUserID(ctx context.Context, groupIDs []string, tx ...any) (groupUsers map[string][]string, err error) + NewTx(tx any) GroupMemberModelInterface + Create(ctx context.Context, groupMemberList []*GroupMemberModel) (err error) + Delete(ctx context.Context, groupID string, userIDs []string) (err error) + DeleteGroup(ctx context.Context, groupIDs []string) (err error) + Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error) + UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) (rowsAffected int64, err error) + Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (groupList []*GroupMemberModel, err error) + FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error) + Take(ctx context.Context, groupID string, userID string) (groupMember *GroupMemberModel, err error) + TakeOwner(ctx context.Context, groupID string) (groupMember *GroupMemberModel, err error) + SearchMember(ctx context.Context, keyword string, groupIDs []string, userIDs []string, roleLevels []int32, pageNumber, showNumber int32) (total uint32, groupList []*GroupMemberModel, err error) + MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error) + FindJoinUserID(ctx context.Context, groupIDs []string) (groupUsers map[string][]string, err error) } diff --git a/pkg/common/db/table/relation/group_request.go b/pkg/common/db/table/relation/group_request.go index 1c9d112c4..03ca5fda0 100644 --- a/pkg/common/db/table/relation/group_request.go +++ b/pkg/common/db/table/relation/group_request.go @@ -28,12 +28,9 @@ func (GroupRequestModel) TableName() string { } type GroupRequestModelInterface interface { - Create(ctx context.Context, groupRequests []*GroupRequestModel, tx ...any) (err error) - //Delete(ctx context.Context, groupRequests []*GroupRequestModel, tx ...any) (err error) - //UpdateMap(ctx context.Context, groupID string, userID string, args map[string]interface{}, tx ...any) (err error) - UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32, tx ...any) (err error) - //Update(ctx context.Context, groupRequests []*GroupRequestModel, tx ...any) (err error) - //Find(ctx context.Context, groupRequests []*GroupRequestModel, tx ...any) (resultGroupRequests []*GroupRequestModel, err error) - Take(ctx context.Context, groupID string, userID string, tx ...any) (groupRequest *GroupRequestModel, err error) - Page(ctx context.Context, userID string, pageNumber, showNumber int32, tx ...any) (total uint32, groups []*GroupRequestModel, err error) + NewTx(tx any) GroupRequestModelInterface + Create(ctx context.Context, groupRequests []*GroupRequestModel) (err error) + UpdateHandler(ctx context.Context, groupID string, userID string, handledMsg string, handleResult int32) (err error) + Take(ctx context.Context, groupID string, userID string) (groupRequest *GroupRequestModel, err error) + Page(ctx context.Context, userID string, pageNumber, showNumber int32) (total uint32, groups []*GroupRequestModel, err error) } diff --git a/pkg/common/db/table/relation/user.go b/pkg/common/db/table/relation/user.go index 2dd119e13..2b0d2d441 100644 --- a/pkg/common/db/table/relation/user.go +++ b/pkg/common/db/table/relation/user.go @@ -1,6 +1,9 @@ package relation -import "time" +import ( + "context" + "time" +) const ( UserModelTableName = "users" @@ -17,13 +20,23 @@ type UserModel struct { Email string `gorm:"column:email;size:64"` Ex string `gorm:"column:ex;size:1024"` CreateTime time.Time `gorm:"column:create_time;index:create_time; autoCreateTime"` - AppMangerLevel int32 `gorm:"column:app_manger_level"` + AppMangerLevel int32 `gorm:"column:app_manger_level;default:18"` GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"` } func (UserModel) TableName() string { - return GroupRequestModelTableName + return UserModelTableName } type UserModelInterface interface { + Create(ctx context.Context, users []*UserModel) (err error) + UpdateByMap(ctx context.Context, userID string, args map[string]interface{}) (err error) + Update(ctx context.Context, users []*UserModel) (err error) + // 获取指定用户信息 不存在,也不返回错误 + Find(ctx context.Context, userIDs []string) (users []*UserModel, err error) + // 获取某个用户信息 不存在,则返回错误 + Take(ctx context.Context, userID string) (user *UserModel, err error) + // 获取用户信息 不存在,不返回错误 + Page(ctx context.Context, pageNumber, showNumber int32) (users []*UserModel, count int64, err error) + PageUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, count int64, err error) } diff --git a/pkg/common/db/table/unrelation/super_group.go b/pkg/common/db/table/unrelation/super_group.go index 6f4409f64..0c3a0c51c 100644 --- a/pkg/common/db/table/unrelation/super_group.go +++ b/pkg/common/db/table/unrelation/super_group.go @@ -2,7 +2,6 @@ package unrelation import ( "context" - "strconv" ) const ( @@ -29,11 +28,12 @@ func (UserToSuperGroupModel) TableName() string { } type SuperGroupModelInterface interface { - CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string, tx ...any) error - FindSuperGroup(ctx context.Context, groupIDs []string, tx ...any) (groups []*SuperGroupModel, err error) - AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...any) error - RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...any) error - GetSuperGroupByUserID(ctx context.Context, userID string, tx ...any) (*UserToSuperGroupModel, error) - DeleteSuperGroup(ctx context.Context, groupID string, tx ...any) error - RemoveGroupFromUser(ctx context.Context, groupID string, userIDs []string, tx ...any) error + CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string) error + TakeSuperGroup(ctx context.Context, groupID string) (group *SuperGroupModel, err error) + FindSuperGroup(ctx context.Context, groupIDs []string) (groups []*SuperGroupModel, err error) + AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error + RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string) error + GetSuperGroupByUserID(ctx context.Context, userID string) (*UserToSuperGroupModel, error) + DeleteSuperGroup(ctx context.Context, groupID string) error + RemoveGroupFromUser(ctx context.Context, groupID string, userIDs []string) error } diff --git a/pkg/common/db/unrelation/super_group.go b/pkg/common/db/unrelation/super_group.go index 7b74b76f4..82c75e54b 100644 --- a/pkg/common/db/unrelation/super_group.go +++ b/pkg/common/db/unrelation/super_group.go @@ -11,9 +11,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/readconcern" ) -var _ unrelation.SuperGroupModelInterface = (*SuperGroupMongoDriver)(nil) - -func NewSuperGroupMongoDriver(mgoClient *mongo.Client) *SuperGroupMongoDriver { +func NewSuperGroupMongoDriver(mgoClient *mongo.Client) unrelation.SuperGroupModelInterface { mgoDB := mgoClient.Database(config.Config.Mongo.DBDatabase) return &SuperGroupMongoDriver{MgoDB: mgoDB, MgoClient: mgoClient, superGroupCollection: mgoDB.Collection(unrelation.CSuperGroup), userToSuperGroupCollection: mgoDB.Collection(unrelation.CUserToSuperGroup)} } @@ -25,109 +23,7 @@ type SuperGroupMongoDriver struct { userToSuperGroupCollection *mongo.Collection } -// func (s *SuperGroupMongoDriver) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string, tx ...interface{}) error { -// superGroup := unrelation.SuperGroupModel{ -// GroupID: groupID, -// MemberIDs: initMemberIDs, -// } -// coll := getTxCtx(s.superGroupCollection, tx) -// _, err := coll.InsertOne(ctx, superGroup) -// if err != nil { -// return err -// } -// opts := &options.UpdateOptions{ -// Upsert: utils.ToPtr(true), -// } -// for _, userID := range initMemberIDs { -// _, err = coll.UpdateOne(ctx, bson.M{"user_id": userID}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts) -// if err != nil { -// return err -// } -// } -// return nil -// } -// -// func (s *SuperGroupMongoDriver) FindSuperGroup(ctx context.Context, groupIDs []string, tx ...interface{}) (groups []*unrelation.SuperGroupModel, err error) { -// cursor, err := s.superGroupCollection.Find(ctx, bson.M{"group_id": bson.M{ -// "$in": groupIDs, -// }}) -// if err != nil { -// return nil, utils.Wrap(err, "") -// } -// defer cursor.Close(ctx) -// if err := cursor.All(ctx, &groups); err != nil { -// return nil, utils.Wrap(err, "") -// } -// return groups, nil -// } -// -// func (s *SuperGroupMongoDriver) AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...interface{}) error { -// opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) -// return s.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { -// _, err := s.superGroupCollection.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$addToSet": bson.M{"member_id_list": bson.M{"$each": userIDs}}}) -// if err != nil { -// _ = sCtx.AbortTransaction(ctx) -// return err -// } -// upsert := true -// opts := &options.UpdateOptions{ -// Upsert: &upsert, -// } -// for _, userID := range userIDs { -// _, err = s.userToSuperGroupCollection.UpdateOne(sCtx, bson.M{"user_id": userID}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts) -// if err != nil { -// _ = sCtx.AbortTransaction(ctx) -// return utils.Wrap(err, "transaction failed") -// } -// } -// return sCtx.CommitTransaction(ctx) -// }) -// } -// -// func (s *SuperGroupMongoDriver) RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...interface{}) error { -// opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) -// return s.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { -// _, err := s.superGroupCollection.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$pull": bson.M{"member_id_list": bson.M{"$in": userIDs}}}) -// if err != nil { -// _ = sCtx.AbortTransaction(ctx) -// return err -// } -// err = s.RemoveGroupFromUser(sCtx, groupID, userIDs) -// if err != nil { -// _ = sCtx.AbortTransaction(ctx) -// return err -// } -// return sCtx.CommitTransaction(ctx) -// }) -// } -// -// func (s *SuperGroupMongoDriver) GetSuperGroupByUserID(ctx context.Context, userID string, tx ...interface{}) (*unrelation.UserToSuperGroupModel, error) { -// //TODO implement me -// panic("implement me") -// } -// -// func (s *SuperGroupMongoDriver) DeleteSuperGroup(ctx context.Context, groupID string, tx ...interface{}) error { -// //TODO implement me -// panic("implement me") -// } - -//func (s *SuperGroupMongoDriver) Transaction(ctx context.Context, fn func(ctx mongo.SessionContext) error) error { -// sess, err := s.MgoClient.StartSession() -// if err != nil { -// return err -// } -// sCtx := mongo.NewSessionContext(ctx, sess) -// -// defer sess.EndSession(sCtx) -// if err := fn(sCtx); err != nil { -// _ = sess.AbortTransaction(sCtx) -// return err -// } -// return utils.Wrap(sess.CommitTransaction(sCtx), "") -//} - -func (s *SuperGroupMongoDriver) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string, tx ...any) error { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDs []string) error { _, err := s.superGroupCollection.InsertOne(ctx, &unrelation.SuperGroupModel{ GroupID: groupID, MemberIDs: initMemberIDs, @@ -146,16 +42,14 @@ func (s *SuperGroupMongoDriver) CreateSuperGroup(ctx context.Context, groupID st return nil } -func (s *SuperGroupMongoDriver) TakeSuperGroup(ctx context.Context, groupID string, tx ...any) (group *unrelation.SuperGroupModel, err error) { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) TakeSuperGroup(ctx context.Context, groupID string) (group *unrelation.SuperGroupModel, err error) { if err := s.superGroupCollection.FindOne(ctx, bson.M{"group_id": groupID}).Decode(&group); err != nil { return nil, utils.Wrap(err, "") } return group, nil } -func (s *SuperGroupMongoDriver) FindSuperGroup(ctx context.Context, groupIDs []string, tx ...any) (groups []*unrelation.SuperGroupModel, err error) { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) FindSuperGroup(ctx context.Context, groupIDs []string) (groups []*unrelation.SuperGroupModel, err error) { cursor, err := s.superGroupCollection.Find(ctx, bson.M{"group_id": bson.M{ "$in": groupIDs, }}) @@ -170,8 +64,7 @@ func (s *SuperGroupMongoDriver) FindSuperGroup(ctx context.Context, groupIDs []s return groups, nil } -func (s *SuperGroupMongoDriver) AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...any) error { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) AddUserToSuperGroup(ctx context.Context, groupID string, userIDs []string) error { opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) return s.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { _, err := s.superGroupCollection.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$addToSet": bson.M{"member_id_list": bson.M{"$each": userIDs}}}) @@ -194,8 +87,7 @@ func (s *SuperGroupMongoDriver) AddUserToSuperGroup(ctx context.Context, groupID }) } -func (s *SuperGroupMongoDriver) RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string, tx ...any) error { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDs []string) error { opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) return s.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { _, err := s.superGroupCollection.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$pull": bson.M{"member_id_list": bson.M{"$in": userIDs}}}) @@ -212,16 +104,14 @@ func (s *SuperGroupMongoDriver) RemoverUserFromSuperGroup(ctx context.Context, g }) } -func (s *SuperGroupMongoDriver) GetSuperGroupByUserID(ctx context.Context, userID string, tx ...any) (*unrelation.UserToSuperGroupModel, error) { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) GetSuperGroupByUserID(ctx context.Context, userID string) (*unrelation.UserToSuperGroupModel, error) { var user unrelation.UserToSuperGroupModel err := s.userToSuperGroupCollection.FindOne(ctx, bson.M{"user_id": userID}).Decode(&user) return &user, utils.Wrap(err, "") } -func (s *SuperGroupMongoDriver) DeleteSuperGroup(ctx context.Context, groupID string, tx ...any) error { - ctx = getTxCtx(ctx, tx) - group, err := s.TakeSuperGroup(ctx, groupID, tx...) +func (s *SuperGroupMongoDriver) DeleteSuperGroup(ctx context.Context, groupID string) error { + group, err := s.TakeSuperGroup(ctx, groupID) if err != nil { return err } @@ -231,26 +121,7 @@ func (s *SuperGroupMongoDriver) DeleteSuperGroup(ctx context.Context, groupID st return s.RemoveGroupFromUser(ctx, groupID, group.MemberIDs) } -//func (s *SuperGroupMongoDriver) DeleteSuperGroup(ctx context.Context, groupID string, tx ...any) error { -// ctx = getTxCtx(ctx, tx) -// opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) -// return s.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { -// superGroup := &unrelation.SuperGroupModel{} -// _, err := s.superGroupCollection.DeleteOne(sCtx, bson.M{"group_id": groupID}) -// if err != nil { -// _ = sCtx.AbortTransaction(ctx) -// return err -// } -// if err = s.RemoveGroupFromUser(sCtx, groupID, superGroup.MemberIDs); err != nil { -// _ = sCtx.AbortTransaction(ctx) -// return err -// } -// return sCtx.CommitTransaction(ctx) -// }) -//} - -func (s *SuperGroupMongoDriver) RemoveGroupFromUser(ctx context.Context, groupID string, userIDs []string, tx ...any) error { - ctx = getTxCtx(ctx, tx) +func (s *SuperGroupMongoDriver) RemoveGroupFromUser(ctx context.Context, groupID string, userIDs []string) error { _, err := s.userToSuperGroupCollection.UpdateOne(ctx, bson.M{"user_id": bson.M{"$in": userIDs}}, bson.M{"$pull": bson.M{"group_id_list": groupID}}) return utils.Wrap(err, "") } diff --git a/pkg/common/kafka/producer.go b/pkg/common/kafka/producer.go index c894fd2b4..b02fe3ef3 100644 --- a/pkg/common/kafka/producer.go +++ b/pkg/common/kafka/producer.go @@ -9,7 +9,7 @@ import ( "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" - prome "Open_IM/pkg/common/prometheus" + prome "Open_IM/pkg/common/prome" ) type Producer struct { diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index ade02c87e..a10a79920 100644 --- a/pkg/proto/auth/auth.pb.go +++ b/pkg/proto/auth/auth.pb.go @@ -36,7 +36,7 @@ func (m *UserTokenReq) Reset() { *m = UserTokenReq{} } func (m *UserTokenReq) String() string { return proto.CompactTextString(m) } func (*UserTokenReq) ProtoMessage() {} func (*UserTokenReq) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_ffdf6e1278396193, []int{0} + return fileDescriptor_auth_750060e22d9d752f, []int{0} } func (m *UserTokenReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserTokenReq.Unmarshal(m, b) @@ -82,7 +82,7 @@ func (m *UserTokenResp) Reset() { *m = UserTokenResp{} } func (m *UserTokenResp) String() string { return proto.CompactTextString(m) } func (*UserTokenResp) ProtoMessage() {} func (*UserTokenResp) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_ffdf6e1278396193, []int{1} + return fileDescriptor_auth_750060e22d9d752f, []int{1} } func (m *UserTokenResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserTokenResp.Unmarshal(m, b) @@ -128,7 +128,7 @@ func (m *ForceLogoutReq) Reset() { *m = ForceLogoutReq{} } func (m *ForceLogoutReq) String() string { return proto.CompactTextString(m) } func (*ForceLogoutReq) ProtoMessage() {} func (*ForceLogoutReq) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_ffdf6e1278396193, []int{2} + return fileDescriptor_auth_750060e22d9d752f, []int{2} } func (m *ForceLogoutReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ForceLogoutReq.Unmarshal(m, b) @@ -172,7 +172,7 @@ func (m *ForceLogoutResp) Reset() { *m = ForceLogoutResp{} } func (m *ForceLogoutResp) String() string { return proto.CompactTextString(m) } func (*ForceLogoutResp) ProtoMessage() {} func (*ForceLogoutResp) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_ffdf6e1278396193, []int{3} + return fileDescriptor_auth_750060e22d9d752f, []int{3} } func (m *ForceLogoutResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ForceLogoutResp.Unmarshal(m, b) @@ -194,7 +194,6 @@ var xxx_messageInfo_ForceLogoutResp proto.InternalMessageInfo type ParseTokenReq struct { Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -204,7 +203,7 @@ func (m *ParseTokenReq) Reset() { *m = ParseTokenReq{} } func (m *ParseTokenReq) String() string { return proto.CompactTextString(m) } func (*ParseTokenReq) ProtoMessage() {} func (*ParseTokenReq) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_ffdf6e1278396193, []int{4} + return fileDescriptor_auth_750060e22d9d752f, []int{4} } func (m *ParseTokenReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ParseTokenReq.Unmarshal(m, b) @@ -231,13 +230,6 @@ func (m *ParseTokenReq) GetToken() string { return "" } -func (m *ParseTokenReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - type ParseTokenResp struct { UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` Platform string `protobuf:"bytes,2,opt,name=platform" json:"platform,omitempty"` @@ -251,7 +243,7 @@ func (m *ParseTokenResp) Reset() { *m = ParseTokenResp{} } func (m *ParseTokenResp) String() string { return proto.CompactTextString(m) } func (*ParseTokenResp) ProtoMessage() {} func (*ParseTokenResp) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_ffdf6e1278396193, []int{5} + return fileDescriptor_auth_750060e22d9d752f, []int{5} } func (m *ParseTokenResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ParseTokenResp.Unmarshal(m, b) @@ -439,30 +431,29 @@ var _Auth_serviceDesc = grpc.ServiceDesc{ Metadata: "auth/auth.proto", } -func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_ffdf6e1278396193) } +func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_750060e22d9d752f) } -var fileDescriptor_auth_ffdf6e1278396193 = []byte{ - // 350 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x4f, 0x4f, 0xfa, 0x40, - 0x10, 0x4d, 0x7f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, 0x4c, 0xf0, 0x89, 0xcf, 0x79, 0xa4, 0xfe, - 0x12, 0xaf, 0x0e, 0xb5, 0x03, 0x27, 0x49, 0xf6, 0x03, 0x54, 0x28, 0x10, 0x12, 0xd3, 0xd1, 0xd3, - 0xc4, 0x86, 0x9e, 0xd8, 0x82, 0x32, 0x27, 0x14, 0x81, 0x5a, 0xf2, 0x30, 0xb5, 0xd5, 0x29, 0x5b, - 0x40, 0x55, 0x37, 0x92, 0xa4, 0xa5, 0x30, 0xf4, 0x14, 0xcc, 0x84, 0xff, 0xfb, 0xac, 0x3b, 0xa3, - 0x14, 0x67, 0x37, 0x93, 0xff, 0xa5, 0x99, 0xcb, 0x4f, 0x03, 0xf2, 0xf1, 0xa6, 0xd9, 0x35, 0x94, - 0xd2, 0xde, 0x59, 0xa3, 0x93, 0xec, 0xbf, 0xa3, 0xaf, 0xd4, 0x3c, 0xce, 0x60, 0x25, 0xb1, 0x1b, - 0x28, 0x6b, 0x95, 0xb0, 0xe6, 0x5e, 0x75, 0xd8, 0xb8, 0x79, 0x92, 0xc9, 0x4b, 0x62, 0x5d, 0x80, - 0xef, 0xb1, 0x59, 0xfa, 0x93, 0x83, 0x4e, 0xcd, 0x66, 0x16, 0x2d, 0xe9, 0xee, 0xfc, 0xe5, 0x34, - 0x3e, 0xd1, 0x91, 0xd7, 0xd7, 0x6e, 0x33, 0x3e, 0xe4, 0x6e, 0xa2, 0x1f, 0x17, 0xb7, 0xd4, 0xd5, - 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x41, 0xd0, 0x40, 0x58, 0xe3, 0x02, 0x00, 0x00, +var fileDescriptor_auth_750060e22d9d752f = []byte{ + // 335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x52, 0x5d, 0x4b, 0x02, 0x51, + 0x10, 0xe5, 0xe6, 0x07, 0x39, 0xa5, 0xe2, 0xc5, 0x4c, 0x16,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xff, 0xd8, + 0x2b, 0x41, 0x71, 0xa7, 0x13, 0x93, 0x7d, 0x0e, 0x79, 0xea, 0x6b, 0xc6, 0x38, 0x7a, 0xec, 0x58, + 0x18, 0x8e, 0x6d, 0x0d, 0x05, 0x93, 0xc6, 0x64, 0x68, 0x08, 0x53, 0x43, 0x5a, 0xb0, 0xbf, 0x75, + 0xb2, 0x51, 0x8f, 0xeb, 0xe4, 0xdc, 0xe9, 0x3f, 0x72, 0x5f, 0x7d, 0x09, 0x48, 0x87, 0x6b, 0x94, + 0x37, 0x90, 0x8b, 0xa7, 0x2a, 0xcb, 0xcd, 0x68, 0xb9, 0x4d, 0x73, 0x61, 0xd6, 0x51, 0x02, 0xca, + 0x24, 0x6f, 0xe1, 0xc0, 0x08, 0x2c, 0x2b, 0x5b, 0xd6, 0xee, 0x3c, 0xad, 0xe3, 0x44, 0x9c, 0x49, + 0xb6, 0x00, 0x7e, 0x62, 0xcb, 0x58, 0x64, 0x67, 0x62, 0x56, 0x25, 0x09, 0x66, 0xba, 0x3f, 0x7b, + 0x39, 0x09, 0xef, 0xef, 0xd5, 0xed, 0x18, 0x87, 0x17, 0x5e, 0x69, 0x2b, 0xe2, 0x0f, 0xb2, 0x6b, + 0xe8, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xd6, 0xd6, 0x96, 0xc0, 0x02, 0x00, 0x00, } diff --git a/pkg/proto/auth/auth.proto b/pkg/proto/auth/auth.proto index ae0483a71..e46b5de25 100644 --- a/pkg/proto/auth/auth.proto +++ b/pkg/proto/auth/auth.proto @@ -30,8 +30,11 @@ message parseTokenResp{ } service Auth { + //生成token rpc userToken(userTokenReq) returns(userTokenResp); + //强制退出登录 rpc forceLogout(forceLogoutReq) returns(forceLogoutResp); + //解析token rpc parseToken(parseTokenReq)returns(parseTokenResp); } diff --git a/pkg/proto/auto_proto.sh b/pkg/proto/auto_proto.sh old mode 100644 new mode 100755 diff --git a/pkg/proto/file/file.proto b/pkg/proto/file/file.proto new file mode 100644 index 000000000..5c1ab246b --- /dev/null +++ b/pkg/proto/file/file.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +option go_package = "Open_IM/pkg/proto/file;file"; +package file; + + +message ApplySpaceReq { + string name = 1; // 文件名字 + int64 size = 2; // 大小 + string hash = 3; // md5 + uint32 purpose = 4; // 用途 + string contentType = 5; +} + +message ApplySpaceResp { + string url = 1; // 不为空表示已存在 + int64 size = 2; // 分片大小 + repeated string put = 3;// put地址 + string confirmID = 4; // 确认ID +} + +message ConfirmSpaceReq { + string confirmID = 1; // 确认ID +} + +message ConfirmSpaceResp { + string confirmID = 1; +} + +service file { + rpc ApplySpaceReq(ApplySpaceReq) returns(ApplySpaceResp); +} + + + + + + diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index 960d9ac01..1f6449800 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -25,18 +25,18 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type GetPaginationFriendsReq struct { - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` - FriendUserIDs []string `protobuf:"bytes,2,rep,name=friendUserIDs" json:"friendUserIDs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` + UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetPaginationFriendsReq) Reset() { *m = GetPaginationFriendsReq{} } func (m *GetPaginationFriendsReq) String() string { return proto.CompactTextString(m) } func (*GetPaginationFriendsReq) ProtoMessage() {} func (*GetPaginationFriendsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{0} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{0} } func (m *GetPaginationFriendsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationFriendsReq.Unmarshal(m, b) @@ -56,22 +56,23 @@ func (m *GetPaginationFriendsReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetPaginationFriendsReq proto.InternalMessageInfo -func (m *GetPaginationFriendsReq) GetOwnerUserID() string { +func (m *GetPaginationFriendsReq) GetPagination() *sdkws.RequestPagination { if m != nil { - return m.OwnerUserID - } - return "" -} - -func (m *GetPaginationFriendsReq) GetFriendUserIDs() []string { - if m != nil { - return m.FriendUserIDs + return m.Pagination } return nil } +func (m *GetPaginationFriendsReq) GetUserID() string { + if m != nil { + return m.UserID + } + return "" +} + type GetPaginationFriendsResp struct { - FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=friendsInfo" json:"friendsInfo,omitempty"` + FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=FriendsInfo" json:"FriendsInfo,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -81,7 +82,7 @@ func (m *GetPaginationFriendsResp) Reset() { *m = GetPaginationFriendsRe func (m *GetPaginationFriendsResp) String() string { return proto.CompactTextString(m) } func (*GetPaginationFriendsResp) ProtoMessage() {} func (*GetPaginationFriendsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{1} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{1} } func (m *GetPaginationFriendsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationFriendsResp.Unmarshal(m, b) @@ -108,6 +109,13 @@ func (m *GetPaginationFriendsResp) GetFriendsInfo() []*sdkws.FriendInfo { return nil } +func (m *GetPaginationFriendsResp) GetTotal() int32 { + if m != nil { + return m.Total + } + return 0 +} + type ApplyToAddFriendReq struct { FromUserID string `protobuf:"bytes,1,opt,name=fromUserID" json:"fromUserID,omitempty"` ToUserID string `protobuf:"bytes,2,opt,name=toUserID" json:"toUserID,omitempty"` @@ -122,7 +130,7 @@ func (m *ApplyToAddFriendReq) Reset() { *m = ApplyToAddFriendReq{} } func (m *ApplyToAddFriendReq) String() string { return proto.CompactTextString(m) } func (*ApplyToAddFriendReq) ProtoMessage() {} func (*ApplyToAddFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{2} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{2} } func (m *ApplyToAddFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ApplyToAddFriendReq.Unmarshal(m, b) @@ -180,7 +188,7 @@ func (m *ApplyToAddFriendResp) Reset() { *m = ApplyToAddFriendResp{} } func (m *ApplyToAddFriendResp) String() string { return proto.CompactTextString(m) } func (*ApplyToAddFriendResp) ProtoMessage() {} func (*ApplyToAddFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{3} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{3} } func (m *ApplyToAddFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ApplyToAddFriendResp.Unmarshal(m, b) @@ -212,7 +220,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{4} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{4} } func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) @@ -256,7 +264,7 @@ func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} } func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) } func (*ImportFriendResp) ProtoMessage() {} func (*ImportFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{5} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{5} } func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b) @@ -288,7 +296,7 @@ func (m *GetPaginationFriendsApplyToReq) Reset() { *m = GetPaginationFri func (m *GetPaginationFriendsApplyToReq) String() string { return proto.CompactTextString(m) } func (*GetPaginationFriendsApplyToReq) ProtoMessage() {} func (*GetPaginationFriendsApplyToReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{6} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{6} } func (m *GetPaginationFriendsApplyToReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationFriendsApplyToReq.Unmarshal(m, b) @@ -334,7 +342,7 @@ func (m *GetPaginationFriendsApplyToResp) Reset() { *m = GetPaginationFr func (m *GetPaginationFriendsApplyToResp) String() string { return proto.CompactTextString(m) } func (*GetPaginationFriendsApplyToResp) ProtoMessage() {} func (*GetPaginationFriendsApplyToResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{7} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{7} } func (m *GetPaginationFriendsApplyToResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationFriendsApplyToResp.Unmarshal(m, b) @@ -369,18 +377,18 @@ func (m *GetPaginationFriendsApplyToResp) GetTotal() int32 { } type GetDesignatedFriendsReq struct { - Pagination *sdkws.RequestPagination `protobuf:"bytes,1,opt,name=pagination" json:"pagination,omitempty"` - UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + FriendUserIDs []string `protobuf:"bytes,2,rep,name=friendUserIDs" json:"friendUserIDs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetDesignatedFriendsReq) Reset() { *m = GetDesignatedFriendsReq{} } func (m *GetDesignatedFriendsReq) String() string { return proto.CompactTextString(m) } func (*GetDesignatedFriendsReq) ProtoMessage() {} func (*GetDesignatedFriendsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{8} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{8} } func (m *GetDesignatedFriendsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetDesignatedFriendsReq.Unmarshal(m, b) @@ -400,23 +408,22 @@ func (m *GetDesignatedFriendsReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetDesignatedFriendsReq proto.InternalMessageInfo -func (m *GetDesignatedFriendsReq) GetPagination() *sdkws.RequestPagination { +func (m *GetDesignatedFriendsReq) GetOwnerUserID() string { if m != nil { - return m.Pagination - } - return nil -} - -func (m *GetDesignatedFriendsReq) GetUserID() string { - if m != nil { - return m.UserID + return m.OwnerUserID } return "" } +func (m *GetDesignatedFriendsReq) GetFriendUserIDs() []string { + if m != nil { + return m.FriendUserIDs + } + return nil +} + type GetDesignatedFriendsResp struct { - FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=FriendsInfo" json:"FriendsInfo,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total" json:"total,omitempty"` + FriendsInfo []*sdkws.FriendInfo `protobuf:"bytes,1,rep,name=friendsInfo" json:"friendsInfo,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -426,7 +433,7 @@ func (m *GetDesignatedFriendsResp) Reset() { *m = GetDesignatedFriendsRe func (m *GetDesignatedFriendsResp) String() string { return proto.CompactTextString(m) } func (*GetDesignatedFriendsResp) ProtoMessage() {} func (*GetDesignatedFriendsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{9} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{9} } func (m *GetDesignatedFriendsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetDesignatedFriendsResp.Unmarshal(m, b) @@ -453,13 +460,6 @@ func (m *GetDesignatedFriendsResp) GetFriendsInfo() []*sdkws.FriendInfo { return nil } -func (m *GetDesignatedFriendsResp) GetTotal() int32 { - if m != nil { - return m.Total - } - return 0 -} - type AddBlackReq struct { OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` BlackUserID string `protobuf:"bytes,2,opt,name=blackUserID" json:"blackUserID,omitempty"` @@ -472,7 +472,7 @@ func (m *AddBlackReq) Reset() { *m = AddBlackReq{} } func (m *AddBlackReq) String() string { return proto.CompactTextString(m) } func (*AddBlackReq) ProtoMessage() {} func (*AddBlackReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{10} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{10} } func (m *AddBlackReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlackReq.Unmarshal(m, b) @@ -516,7 +516,7 @@ func (m *AddBlackResp) Reset() { *m = AddBlackResp{} } func (m *AddBlackResp) String() string { return proto.CompactTextString(m) } func (*AddBlackResp) ProtoMessage() {} func (*AddBlackResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{11} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{11} } func (m *AddBlackResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlackResp.Unmarshal(m, b) @@ -548,7 +548,7 @@ func (m *RemoveBlackReq) Reset() { *m = RemoveBlackReq{} } func (m *RemoveBlackReq) String() string { return proto.CompactTextString(m) } func (*RemoveBlackReq) ProtoMessage() {} func (*RemoveBlackReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{12} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{12} } func (m *RemoveBlackReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlackReq.Unmarshal(m, b) @@ -592,7 +592,7 @@ func (m *RemoveBlackResp) Reset() { *m = RemoveBlackResp{} } func (m *RemoveBlackResp) String() string { return proto.CompactTextString(m) } func (*RemoveBlackResp) ProtoMessage() {} func (*RemoveBlackResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{13} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{13} } func (m *RemoveBlackResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlackResp.Unmarshal(m, b) @@ -624,7 +624,7 @@ func (m *GetPaginationBlacksReq) Reset() { *m = GetPaginationBlacksReq{} func (m *GetPaginationBlacksReq) String() string { return proto.CompactTextString(m) } func (*GetPaginationBlacksReq) ProtoMessage() {} func (*GetPaginationBlacksReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{14} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{14} } func (m *GetPaginationBlacksReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationBlacksReq.Unmarshal(m, b) @@ -670,7 +670,7 @@ func (m *GetPaginationBlacksResp) Reset() { *m = GetPaginationBlacksResp func (m *GetPaginationBlacksResp) String() string { return proto.CompactTextString(m) } func (*GetPaginationBlacksResp) ProtoMessage() {} func (*GetPaginationBlacksResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{15} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{15} } func (m *GetPaginationBlacksResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationBlacksResp.Unmarshal(m, b) @@ -716,7 +716,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{16} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{16} } func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) @@ -762,7 +762,7 @@ func (m *IsFriendResp) Reset() { *m = IsFriendResp{} } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{17} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{17} } func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) @@ -808,7 +808,7 @@ func (m *IsBlackReq) Reset() { *m = IsBlackReq{} } func (m *IsBlackReq) String() string { return proto.CompactTextString(m) } func (*IsBlackReq) ProtoMessage() {} func (*IsBlackReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{18} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{18} } func (m *IsBlackReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsBlackReq.Unmarshal(m, b) @@ -854,7 +854,7 @@ func (m *IsBlackResp) Reset() { *m = IsBlackResp{} } func (m *IsBlackResp) String() string { return proto.CompactTextString(m) } func (*IsBlackResp) ProtoMessage() {} func (*IsBlackResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{19} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{19} } func (m *IsBlackResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsBlackResp.Unmarshal(m, b) @@ -900,7 +900,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{20} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{20} } func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) @@ -944,7 +944,7 @@ func (m *DeleteFriendResp) Reset() { *m = DeleteFriendResp{} } func (m *DeleteFriendResp) String() string { return proto.CompactTextString(m) } func (*DeleteFriendResp) ProtoMessage() {} func (*DeleteFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{21} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{21} } func (m *DeleteFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendResp.Unmarshal(m, b) @@ -979,7 +979,7 @@ func (m *RespondFriendApplyReq) Reset() { *m = RespondFriendApplyReq{} } func (m *RespondFriendApplyReq) String() string { return proto.CompactTextString(m) } func (*RespondFriendApplyReq) ProtoMessage() {} func (*RespondFriendApplyReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{22} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{22} } func (m *RespondFriendApplyReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RespondFriendApplyReq.Unmarshal(m, b) @@ -1037,7 +1037,7 @@ func (m *RespondFriendApplyResp) Reset() { *m = RespondFriendApplyResp{} func (m *RespondFriendApplyResp) String() string { return proto.CompactTextString(m) } func (*RespondFriendApplyResp) ProtoMessage() {} func (*RespondFriendApplyResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{23} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{23} } func (m *RespondFriendApplyResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RespondFriendApplyResp.Unmarshal(m, b) @@ -1070,7 +1070,7 @@ func (m *SetFriendRemarkReq) Reset() { *m = SetFriendRemarkReq{} } func (m *SetFriendRemarkReq) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkReq) ProtoMessage() {} func (*SetFriendRemarkReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{24} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{24} } func (m *SetFriendRemarkReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkReq.Unmarshal(m, b) @@ -1121,7 +1121,7 @@ func (m *SetFriendRemarkResp) Reset() { *m = SetFriendRemarkResp{} } func (m *SetFriendRemarkResp) String() string { return proto.CompactTextString(m) } func (*SetFriendRemarkResp) ProtoMessage() {} func (*SetFriendRemarkResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{25} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{25} } func (m *SetFriendRemarkResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendRemarkResp.Unmarshal(m, b) @@ -1153,7 +1153,7 @@ func (m *GetPaginationFriendsApplyFromReq) Reset() { *m = GetPaginationF func (m *GetPaginationFriendsApplyFromReq) String() string { return proto.CompactTextString(m) } func (*GetPaginationFriendsApplyFromReq) ProtoMessage() {} func (*GetPaginationFriendsApplyFromReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{26} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{26} } func (m *GetPaginationFriendsApplyFromReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationFriendsApplyFromReq.Unmarshal(m, b) @@ -1199,7 +1199,7 @@ func (m *GetPaginationFriendsApplyFromResp) Reset() { *m = GetPagination func (m *GetPaginationFriendsApplyFromResp) String() string { return proto.CompactTextString(m) } func (*GetPaginationFriendsApplyFromResp) ProtoMessage() {} func (*GetPaginationFriendsApplyFromResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_b44dbd852f0b513f, []int{27} + return fileDescriptor_friend_2a356ccaa517dcdd, []int{27} } func (m *GetPaginationFriendsApplyFromResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationFriendsApplyFromResp.Unmarshal(m, b) @@ -1793,69 +1793,68 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Metadata: "friend/friend.proto", } -func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_b44dbd852f0b513f) } +func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_2a356ccaa517dcdd) } -var fileDescriptor_friend_b44dbd852f0b513f = []byte{ - // 974 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x5f, 0x6f, 0x1b, 0x45, - 0x10, 0x97, 0x1d, 0xe2, 0x26, 0x63, 0xd7, 0x29, 0xe3, 0xd4, 0x3d, 0x5d, 0xfe, 0xb9, 0xab, 0xaa, - 0x98, 0x87, 0xc6, 0xaa, 0x81, 0x27, 0x24, 0x20, 0x51, 0x14, 0x11, 0xa4, 0x08, 0xb8, 0x16, 0x50, - 0x40, 0x22, 0xba, 0x72, 0x6b, 0x73, 0x8a, 0x7d, 0xb7, 0xb9, 0xb9, 0x24, 0xed, 0x0b, 0x02, 0xf1, - 0x19, 0xf8, 0x68, 0x7c, 0x1f, 0x74, 0xbb, 0x7b, 0x77, 0x7b, 0xe7, 0xb3, 0xeb, 0x86, 0xf4, 0xc9, - 0x9a, 0x99, 0xdf, 0xfc, 0xdd, 0xf1, 0xcc, 0x1c, 0x74, 0x46, 0x91, 0xcf, 0x03, 0x6f, 0xa0, 0x7e, - 0xf6, 0x45, 0x14, 0xc6, 0x21, 0x36, 0x14, 0x65, 0xf7, 0xbf, 0x15, 0x3c, 0x78, 0x76, 0x72, 0xfa, - 0xec, 0x05, 0x8f, 0xae, 0x79, 0x34, 0x10, 0x17, 0xe3, 0x81, 0x44, 0x0c, 0xc8, 0xbb, 0x38, 0xbf, - 0xa1, 0xc1, 0x0d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, 0x81, 0x2f, 0x00, - 0x67, 0x47, 0x0d, 0xee, 0xe4, 0x45, 0xab, 0x98, 0x8e, 0xf6, 0xee, 0x22, 0x31, 0x09, 0xfc, 0x06, - 0x36, 0x4a, 0x13, 0x03, 0xed, 0x54, 0x65, 0x76, 0x7c, 0xd9, 0x5b, 0x73, 0x65, 0x24, 0xf0, 0x10, - 0xee, 0x9b, 0xf7, 0x2f, 0xe5, 0x49, 0x96, 0x2e, 0xee, 0x3c, 0xc9, 0xf2, 0xbd, 0x8c, 0x67, 0xb0, - 0x59, 0x75, 0xb2, 0xa1, 0x59, 0xe0, 0xaa, 0x4b, 0xd2, 0xee, 0x2d, 0x06, 0x64, 0xa6, 0x67, 0x3a, - 0x1c, 0xf7, 0x16, 0xf5, 0x7f, 0xd9, 0x74, 0xe5, 0x87, 0xd2, 0xe1, 0xe3, 0x9f, 0xf7, 0x92, 0x6f, - 0xba, 0xf3, 0x93, 0x53, 0xe3, 0x63, 0x4e, 0x29, 0x7d, 0xae, 0x7e, 0x5e, 0x35, 0x24, 0xf3, 0x93, - 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xaf, 0x0f, 0xd2, 0x1a, 0x0e, 0x00, 0x00, +var fileDescriptor_friend_2a356ccaa517dcdd = []byte{ + // 957 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xe1, 0x6e, 0xdb, 0x46, + 0x0c, 0x86, 0x9d, 0x25, 0x4d, 0x68, 0xd7, 0x49, 0x69, 0xd7, 0x15, 0x94, 0x36, 0x71, 0x0f, 0x43, + 0xeb, 0xfd, 0x68, 0x8c, 0xba, 0x18, 0x30, 0x60, 0xc3, 0xb0, 0x04, 0x45, 0x81, 0x0c, 0x08, 0xba, + 0xa9, 0xed, 0x86, 0xec, 0xc7, 0x06, 0x75, 0x3a, 0x7b, 0x9e, 0x6d, 0xe9, 0x22, 0x2a, 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 0x64, 0x6a, 0xc2, 0x5a, 0x0c, 0x6d, 0xc2, 0x16, 0x38, 0x77, + 0x08, 0xb7, 0x34, 0xc3, 0x21, 0x1a, 0x40, 0x1e, 0xae, 0xbd, 0xa0, 0x23, 0x81, 0xbf, 0x40, 0xbb, + 0x62, 0xab, 0xe0, 0x41, 0x65, 0x8d, 0xf2, 0xf5, 0xe6, 0x1e, 0xae, 0xb4, 0x93, 0xc0, 0x63, 0x68, + 0xda, 0xcc, 0x85, 0xf9, 0x5d, 0x4b, 0x44, 0xe9, 0x3a, 0xd5, 0x06, 0x12, 0xf8, 0x0a, 0x70, 0x91, + 0x50, 0xf0, 0x81, 0x29, 0x5a, 0x05, 0x07, 0xba, 0x07, 0xab, 0xcc, 0x24, 0xf0, 0x47, 0xd8, 0x2d, + 0xf1, 0x02, 0xba, 0xd9, 0x91, 0x45, 0x92, 0x72, 0xf7, 0x97, 0xda, 0x48, 0xe0, 0x09, 0xdc, 0xb6, + 0x1f, 0x9f, 0x64, 0x2e, 0x59, 0x7a, 0xee, 0x9a, 0x4b, 0x96, 0x1f, 0xab, 0x78, 0x0e, 0x9d, 0xaa, + 0xe7, 0x15, 0xda, 0x05, 0xae, 0x7a, 0xdf, 0xb9, 0xbd, 0xd5, 0x80, 0xdc, 0xf5, 0xc2, 0x84, 0xe3, + 0xe1, 0xaa, 0xf9, 0x2f, 0xbb, 0xae, 0xfc, 0xbf, 0x72, 0xf2, 0xf0, 0xb7, 0xc3, 0xf4, 0x3f, 0xd6, + 0x1f, 0xa7, 0x67, 0xd6, 0x9f, 0x2b, 0x75, 0xe8, 0x5b, 0xf5, 0xf3, 0x76, 0x4b, 0x2a, 0x9f, 0xfd, + 0x17, 0x00, 0x00, 0xff, 0xff, 0x90, 0x2a, 0xf6, 0x16, 0xaa, 0x0d, 0x00, 0x00, } diff --git a/pkg/proto/friend/friend.proto b/pkg/proto/friend/friend.proto index 2120a72bb..de47b441e 100644 --- a/pkg/proto/friend/friend.proto +++ b/pkg/proto/friend/friend.proto @@ -4,11 +4,15 @@ option go_package = "Open_IM/pkg/proto/friend;friend"; package friend; message getPaginationFriendsReq{ - string ownerUserID = 1; - repeated string friendUserIDs = 2; + sdkws.RequestPagination pagination = 1; + string userID = 2; } message getPaginationFriendsResp{ - repeated sdkws.FriendInfo friendsInfo = 1; + repeated sdkws.FriendInfo FriendsInfo = 1; + int32 total = 2; + + + } @@ -43,12 +47,11 @@ message getPaginationFriendsApplyToResp{ message getDesignatedFriendsReq{ - sdkws.RequestPagination pagination = 1; - string userID = 2; + string ownerUserID = 1; + repeated string friendUserIDs = 2; } message getDesignatedFriendsResp{ - repeated sdkws.FriendInfo FriendsInfo = 1; - int32 total = 2; + repeated sdkws.FriendInfo friendsInfo = 1; } @@ -160,4 +163,9 @@ service friend{ rpc getDesignatedFriends(getDesignatedFriendsReq) returns(getDesignatedFriendsResp); //获取指定好友信息 有id不存在也返回错误 rpc getPaginationFriends(getPaginationFriendsReq) returns (getPaginationFriendsResp); + + + + + } \ No newline at end of file diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index 86bb1a00d..1fb0d7d14 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_4a94cf46004e5ca3, []int{0} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{1} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{2} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{3} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{4} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{5} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{6} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{7} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{8} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{9} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{10} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{11} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{12} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{13} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{14} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{15} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{16} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{17} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{18} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{19} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{20} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{21} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{22} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{23} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{24} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{25} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{26} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{27} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{28} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{29} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{30} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{31} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{32} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{33} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{34} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{35} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{36} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{37} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{38} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{39} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{40} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{41} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{42} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{43} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{44} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{45} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{46} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{47} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{48} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{49} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{50} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{51} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{52} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{53} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{54} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{55} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{56} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{57} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{58} + return fileDescriptor_group_a9155eb4f624bfe9, []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_4a94cf46004e5ca3, []int{59} + return fileDescriptor_group_a9155eb4f624bfe9, []int{59} } func (m *GetGroupMemberUserIDResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberUserIDResp.Unmarshal(m, b) @@ -2573,7 +2573,7 @@ func (m *GetGroupMemberRoleLevelReq) Reset() { *m = GetGroupMemberRoleLe func (m *GetGroupMemberRoleLevelReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberRoleLevelReq) ProtoMessage() {} func (*GetGroupMemberRoleLevelReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_4a94cf46004e5ca3, []int{60} + return fileDescriptor_group_a9155eb4f624bfe9, []int{60} } func (m *GetGroupMemberRoleLevelReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberRoleLevelReq.Unmarshal(m, b) @@ -2618,7 +2618,7 @@ func (m *GetGroupMemberRoleLevelResp) Reset() { *m = GetGroupMemberRoleL func (m *GetGroupMemberRoleLevelResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberRoleLevelResp) ProtoMessage() {} func (*GetGroupMemberRoleLevelResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_4a94cf46004e5ca3, []int{61} + return fileDescriptor_group_a9155eb4f624bfe9, []int{61} } func (m *GetGroupMemberRoleLevelResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberRoleLevelResp.Unmarshal(m, b) @@ -3727,9 +3727,9 @@ var _Group_serviceDesc = grpc.ServiceDesc{ Metadata: "group/group.proto", } -func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_4a94cf46004e5ca3) } +func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_a9155eb4f624bfe9) } -var fileDescriptor_group_4a94cf46004e5ca3 = []byte{ +var fileDescriptor_group_a9155eb4f624bfe9 = []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, diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index 08cdde4fc..ad33c83e6 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_9bd9d9abca588885, []int{0} + return fileDescriptor_msg_6d33b8473e6e0931, []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_9bd9d9abca588885, []int{1} + return fileDescriptor_msg_6d33b8473e6e0931, []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_9bd9d9abca588885, []int{2} + return fileDescriptor_msg_6d33b8473e6e0931, []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_9bd9d9abca588885, []int{3} + return fileDescriptor_msg_6d33b8473e6e0931, []int{3} } func (m *MsgDataToMongoByMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToMongoByMQ.Unmarshal(m, b) @@ -253,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_9bd9d9abca588885, []int{4} + return fileDescriptor_msg_6d33b8473e6e0931, []int{4} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -301,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_9bd9d9abca588885, []int{5} + return fileDescriptor_msg_6d33b8473e6e0931, []int{5} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -360,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_9bd9d9abca588885, []int{6} + return fileDescriptor_msg_6d33b8473e6e0931, []int{6} } func (m *SendMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsgReq.Unmarshal(m, b) @@ -400,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_9bd9d9abca588885, []int{7} + return fileDescriptor_msg_6d33b8473e6e0931, []int{7} } func (m *SendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsgResp.Unmarshal(m, b) @@ -452,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_9bd9d9abca588885, []int{8} + return fileDescriptor_msg_6d33b8473e6e0931, []int{8} } func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b) @@ -489,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_9bd9d9abca588885, []int{9} + return fileDescriptor_msg_6d33b8473e6e0931, []int{9} } func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b) @@ -522,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_9bd9d9abca588885, []int{10} + return fileDescriptor_msg_6d33b8473e6e0931, []int{10} } func (m *SetMsgMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMsgMinSeqReq.Unmarshal(m, b) @@ -573,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_9bd9d9abca588885, []int{11} + return fileDescriptor_msg_6d33b8473e6e0931, []int{11} } func (m *SetMsgMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMsgMinSeqResp.Unmarshal(m, b) @@ -604,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_9bd9d9abca588885, []int{12} + return fileDescriptor_msg_6d33b8473e6e0931, []int{12} } func (m *SetSendMsgStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetSendMsgStatusReq.Unmarshal(m, b) @@ -641,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_9bd9d9abca588885, []int{13} + return fileDescriptor_msg_6d33b8473e6e0931, []int{13} } func (m *SetSendMsgStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetSendMsgStatusResp.Unmarshal(m, b) @@ -672,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_9bd9d9abca588885, []int{14} + return fileDescriptor_msg_6d33b8473e6e0931, []int{14} } func (m *GetSendMsgStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSendMsgStatusReq.Unmarshal(m, b) @@ -712,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_9bd9d9abca588885, []int{15} + return fileDescriptor_msg_6d33b8473e6e0931, []int{15} } func (m *GetSendMsgStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSendMsgStatusResp.Unmarshal(m, b) @@ -765,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_9bd9d9abca588885, []int{16} + return fileDescriptor_msg_6d33b8473e6e0931, []int{16} } func (m *DelSuperGroupMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DelSuperGroupMsgReq.Unmarshal(m, b) @@ -809,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_9bd9d9abca588885, []int{17} + return fileDescriptor_msg_6d33b8473e6e0931, []int{17} } func (m *DelSuperGroupMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DelSuperGroupMsgResp.Unmarshal(m, b) @@ -842,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_9bd9d9abca588885, []int{18} + return fileDescriptor_msg_6d33b8473e6e0931, []int{18} } func (m *GetSuperGroupMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupMsgReq.Unmarshal(m, b) @@ -896,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_9bd9d9abca588885, []int{19} + return fileDescriptor_msg_6d33b8473e6e0931, []int{19} } func (m *GetSuperGroupMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetSuperGroupMsgResp.Unmarshal(m, b) @@ -949,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_9bd9d9abca588885, []int{20} + return fileDescriptor_msg_6d33b8473e6e0931, []int{20} } func (m *GetWriteDiffMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetWriteDiffMsgReq.Unmarshal(m, b) @@ -996,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_9bd9d9abca588885, []int{21} + return fileDescriptor_msg_6d33b8473e6e0931, []int{21} } func (m *GetWriteDiffMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetWriteDiffMsgResp.Unmarshal(m, b) @@ -1058,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_9bd9d9abca588885, []int{22} + return fileDescriptor_msg_6d33b8473e6e0931, []int{22} } func (m *ModifyMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ModifyMessageReactionExtensionsReq.Unmarshal(m, b) @@ -1176,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_9bd9d9abca588885, []int{23} + return fileDescriptor_msg_6d33b8473e6e0931, []int{23} } func (m *SetMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMessageReactionExtensionsReq.Unmarshal(m, b) @@ -1289,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_9bd9d9abca588885, []int{24} + return fileDescriptor_msg_6d33b8473e6e0931, []int{24} } func (m *SetMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetMessageReactionExtensionsResp.Unmarshal(m, b) @@ -1357,6 +1357,7 @@ type GetMessageListReactionExtensionsReq struct { SourceID string `protobuf:"bytes,3,opt,name=sourceID" json:"sourceID,omitempty"` SessionType int32 `protobuf:"varint,4,opt,name=sessionType" json:"sessionType,omitempty"` MessageReactionKeyList []*GetMessageListReactionExtensionsReq_MessageReactionKey `protobuf:"bytes,5,rep,name=messageReactionKeyList" json:"messageReactionKeyList,omitempty"` + TypeKeyList []string `protobuf:"bytes,6,rep,name=TypeKeyList" json:"TypeKeyList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1366,7 +1367,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_9bd9d9abca588885, []int{25} + return fileDescriptor_msg_6d33b8473e6e0931, []int{25} } func (m *GetMessageListReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMessageListReactionExtensionsReq.Unmarshal(m, b) @@ -1421,6 +1422,13 @@ func (m *GetMessageListReactionExtensionsReq) GetMessageReactionKeyList() []*Get return nil } +func (m *GetMessageListReactionExtensionsReq) GetTypeKeyList() []string { + if m != nil { + return m.TypeKeyList + } + return nil +} + type GetMessageListReactionExtensionsReq_MessageReactionKey struct { ClientMsgID string `protobuf:"bytes,1,opt,name=clientMsgID" json:"clientMsgID,omitempty"` MsgFirstModifyTime int64 `protobuf:"varint,2,opt,name=msgFirstModifyTime" json:"msgFirstModifyTime,omitempty"` @@ -1437,7 +1445,7 @@ func (m *GetMessageListReactionExtensionsReq_MessageReactionKey) String() string } func (*GetMessageListReactionExtensionsReq_MessageReactionKey) ProtoMessage() {} func (*GetMessageListReactionExtensionsReq_MessageReactionKey) Descriptor() ([]byte, []int) { - return fileDescriptor_msg_9bd9d9abca588885, []int{25, 0} + return fileDescriptor_msg_6d33b8473e6e0931, []int{25, 0} } func (m *GetMessageListReactionExtensionsReq_MessageReactionKey) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMessageListReactionExtensionsReq_MessageReactionKey.Unmarshal(m, b) @@ -1484,7 +1492,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_9bd9d9abca588885, []int{26} + return fileDescriptor_msg_6d33b8473e6e0931, []int{26} } func (m *GetMessageListReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMessageListReactionExtensionsResp.Unmarshal(m, b) @@ -1539,7 +1547,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_9bd9d9abca588885, []int{27} + return fileDescriptor_msg_6d33b8473e6e0931, []int{27} } func (m *SingleMessageExtensionResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingleMessageExtensionResult.Unmarshal(m, b) @@ -1601,7 +1609,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_9bd9d9abca588885, []int{28} + return fileDescriptor_msg_6d33b8473e6e0931, []int{28} } func (m *ModifyMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ModifyMessageReactionExtensionsResp.Unmarshal(m, b) @@ -1669,7 +1677,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_9bd9d9abca588885, []int{29} + return fileDescriptor_msg_6d33b8473e6e0931, []int{29} } func (m *DeleteMessageListReactionExtensionsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteMessageListReactionExtensionsReq.Unmarshal(m, b) @@ -1760,7 +1768,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_9bd9d9abca588885, []int{30} + return fileDescriptor_msg_6d33b8473e6e0931, []int{30} } func (m *DeleteMessageListReactionExtensionsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteMessageListReactionExtensionsResp.Unmarshal(m, b) @@ -1814,7 +1822,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_9bd9d9abca588885, []int{31} + return fileDescriptor_msg_6d33b8473e6e0931, []int{31} } func (m *ExtendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsgResp.Unmarshal(m, b) @@ -1870,7 +1878,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_9bd9d9abca588885, []int{32} + return fileDescriptor_msg_6d33b8473e6e0931, []int{32} } func (m *ExtendMsg) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsg.Unmarshal(m, b) @@ -1938,7 +1946,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_9bd9d9abca588885, []int{33} + return fileDescriptor_msg_6d33b8473e6e0931, []int{33} } func (m *KeyValueResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KeyValueResp.Unmarshal(m, b) @@ -1992,7 +2000,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_9bd9d9abca588885, []int{34} + return fileDescriptor_msg_6d33b8473e6e0931, []int{34} } func (m *MsgDataToModifyByMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToModifyByMQ.Unmarshal(m, b) @@ -2033,6 +2041,82 @@ func (m *MsgDataToModifyByMQ) GetTriggerID() string { return "" } +type DelMsgListReq struct { + UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` + SeqList []uint32 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +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_msg_6d33b8473e6e0931, []int{35} +} +func (m *DelMsgListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelMsgListReq.Unmarshal(m, b) +} +func (m *DelMsgListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelMsgListReq.Marshal(b, m, deterministic) +} +func (dst *DelMsgListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelMsgListReq.Merge(dst, src) +} +func (m *DelMsgListReq) XXX_Size() int { + return xxx_messageInfo_DelMsgListReq.Size(m) +} +func (m *DelMsgListReq) XXX_DiscardUnknown() { + xxx_messageInfo_DelMsgListReq.DiscardUnknown(m) +} + +var xxx_messageInfo_DelMsgListReq proto.InternalMessageInfo + +func (m *DelMsgListReq) GetUserID() string { + if m != nil { + return m.UserID + } + return "" +} + +func (m *DelMsgListReq) GetSeqList() []uint32 { + if m != nil { + return m.SeqList + } + return nil +} + +type DelMsgListResp struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +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_msg_6d33b8473e6e0931, []int{36} +} +func (m *DelMsgListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelMsgListResp.Unmarshal(m, b) +} +func (m *DelMsgListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelMsgListResp.Marshal(b, m, deterministic) +} +func (dst *DelMsgListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelMsgListResp.Merge(dst, src) +} +func (m *DelMsgListResp) XXX_Size() int { + return xxx_messageInfo_DelMsgListResp.Size(m) +} +func (m *DelMsgListResp) XXX_DiscardUnknown() { + xxx_messageInfo_DelMsgListResp.DiscardUnknown(m) +} + +var xxx_messageInfo_DelMsgListResp proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgDataToMQ)(nil), "msg.MsgDataToMQ") proto.RegisterType((*MsgDataToDB)(nil), "msg.MsgDataToDB") @@ -2074,6 +2158,8 @@ func init() { proto.RegisterMapType((map[string]*KeyValueResp)(nil), "msg.ExtendMsg.ReactionExtensionListEntry") proto.RegisterType((*KeyValueResp)(nil), "msg.KeyValueResp") proto.RegisterType((*MsgDataToModifyByMQ)(nil), "msg.MsgDataToModifyByMQ") + proto.RegisterType((*DelMsgListReq)(nil), "msg.DelMsgListReq") + proto.RegisterType((*DelMsgListResp)(nil), "msg.DelMsgListResp") } // Reference imports to suppress errors if they are not otherwise used. @@ -2094,7 +2180,7 @@ type MsgClient interface { // 发送消息 SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) // 删除某人消息 - DelMsgList(ctx context.Context, in *sdkws.DelMsgListReq, opts ...grpc.CallOption) (*sdkws.DelMsgListResp, error) + DelMsgList(ctx context.Context, in *DelMsgListReq, opts ...grpc.CallOption) (*DelMsgListResp, error) // 删除某个用户某个大群消息 DelSuperGroupMsg(ctx context.Context, in *DelSuperGroupMsgReq, opts ...grpc.CallOption) (*DelSuperGroupMsgResp, error) // 清空某人所有消息 @@ -2145,8 +2231,8 @@ func (c *msgClient) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.Ca return out, nil } -func (c *msgClient) DelMsgList(ctx context.Context, in *sdkws.DelMsgListReq, opts ...grpc.CallOption) (*sdkws.DelMsgListResp, error) { - out := new(sdkws.DelMsgListResp) +func (c *msgClient) DelMsgList(ctx context.Context, in *DelMsgListReq, opts ...grpc.CallOption) (*DelMsgListResp, error) { + out := new(DelMsgListResp) err := grpc.Invoke(ctx, "/msg.msg/DelMsgList", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2236,7 +2322,7 @@ type MsgServer interface { // 发送消息 SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) // 删除某人消息 - DelMsgList(context.Context, *sdkws.DelMsgListReq) (*sdkws.DelMsgListResp, error) + DelMsgList(context.Context, *DelMsgListReq) (*DelMsgListResp, error) // 删除某个用户某个大群消息 DelSuperGroupMsg(context.Context, *DelSuperGroupMsgReq) (*DelSuperGroupMsgResp, error) // 清空某人所有消息 @@ -2311,7 +2397,7 @@ func _Msg_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interfa } func _Msg_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(sdkws.DelMsgListReq) + in := new(DelMsgListReq) if err := dec(in); err != nil { return nil, err } @@ -2323,7 +2409,7 @@ func _Msg_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(inte FullMethod: "/msg.msg/DelMsgList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelMsgList(ctx, req.(*sdkws.DelMsgListReq)) + return srv.(MsgServer).DelMsgList(ctx, req.(*DelMsgListReq)) } return interceptor(ctx, in, info, handler) } @@ -2529,107 +2615,109 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "msg/msg.proto", } -func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_9bd9d9abca588885) } +func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_6d33b8473e6e0931) } -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, 0x1b, 0x47, 0xae, 0x62, 0xa4, 0x6c, 0x12, - 0xca, 0x6d, 0x90, 0xe6, 0x90, 0x32, 0xd6, 0x9a, 0x21, 0xcc, 0x3f, 0x73, 0xa9, 0x58, 0x02, 0x7a, - 0xe9, 0xa1, 0xbd, 0xf5, 0x35, 0x7a, 0xeb, 0x43, 0xe4, 0x09, 0xfa, 0x20, 0x3d, 0x15, 0xe8, 0xb9, - 0x2d, 0x76, 0xb9, 0xa2, 0xf8, 0x2b, 0xd1, 0x0a, 0x02, 0xe4, 0xd0, 0x9b, 0x67, 0x76, 0x76, 0x7e, - 0xbf, 0x19, 0x2d, 0xc7, 0xb0, 0x6c, 0x13, 0x63, 0xc7, 0x26, 0x46, 0xcb, 0xf3, 0xdd, 0xc0, 0x45, - 0x92, 0x4d, 0x0c, 0x79, 0xeb, 0x81, 0x87, 0x9d, 0xed, 0x03, 0x75, 0xbb, 0x8b, 0xfd, 0x97, 0xd8, - 0xdf, 0xf1, 0x4e, 0x8c, 0x1d, 0x76, 0xbc, 0x43, 0x7a, 0x27, 0x67, 0x64, 0xe7, 0x8c,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4, 0xac, 0xed, 0xae, 0xb6, 0x28, 0x48, 0x62, 0xd1, 0x6a, 0x71, 0x21, - 0xb4, 0x09, 0x8b, 0x81, 0x6f, 0x1a, 0x06, 0xf3, 0x75, 0x8e, 0x69, 0x1d, 0x33, 0x94, 0x6f, 0x00, - 0x75, 0x70, 0xa0, 0xea, 0x83, 0x3b, 0x4e, 0x4f, 0x35, 0x9d, 0x2e, 0x3e, 0xd5, 0xf0, 0x29, 0xda, - 0x80, 0x2a, 0x0f, 0x2e, 0xcc, 0x14, 0xa7, 0xd2, 0x69, 0x14, 0x33, 0x69, 0x54, 0xce, 0x60, 0x2d, - 0xa3, 0x8f, 0x78, 0x34, 0xf0, 0x7d, 0xdf, 0xbf, 0xeb, 0xf6, 0x30, 0xd3, 0x58, 0xd1, 0x46, 0x24, - 0x35, 0xb5, 0xef, 0xfb, 0x2a, 0x31, 0xb8, 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, 0x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x68, 0x07, - 0x16, 0x46, 0x6b, 0x3a, 0x14, 0x7a, 0x18, 0x5b, 0xee, 0xc9, 0x17, 0x53, 0x9c, 0xd0, 0x72, 0x7a, - 0x4f, 0xc6, 0x2d, 0xe7, 0x6c, 0xdb, 0xb8, 0xe5, 0xbc, 0xc5, 0x1a, 0x55, 0xd4, 0xc9, 0x57, 0xd4, - 0x29, 0x54, 0x94, 0xbb, 0x50, 0x3b, 0x81, 0xcd, 0x49, 0x1f, 0x01, 0xe8, 0x5a, 0x99, 0x0f, 0x3d, - 0xf9, 0x7a, 0x09, 0x29, 0xe2, 0xa1, 0x33, 0x68, 0x4c, 0x7b, 0x02, 0xa2, 0x66, 0xd9, 0x47, 0xae, - 0x7c, 0xa3, 0xa4, 0x24, 0xf1, 0xd0, 0x29, 0x6c, 0xde, 0xe9, 0xf5, 0x8a, 0xa3, 0xdc, 0x2a, 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, +var fileDescriptor_msg_6d33b8473e6e0931 = []byte{ + // 1604 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcb, 0x6e, 0xdb, 0x46, + 0x17, 0x06, 0x49, 0x4b, 0xb6, 0x8f, 0x7c, 0xcb, 0xd8, 0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+ 0x66, 0x6d, 0x67, 0xa9, 0xc5, 0xdc, 0xb5, 0x22, 0xe3, 0xc6, 0x68, 0x5b, 0x7b, 0x22, 0x38, 0x6c, + 0xef, 0x8a, 0x07, 0xa5, 0xb1, 0x07, 0x27, 0x07, 0xa1, 0xfd, 0x28, 0xc1, 0xf2, 0xc3, 0x01, 0x79, + 0x21, 0x26, 0xd4, 0x80, 0xda, 0x03, 0xe1, 0x14, 0x4f, 0x4b, 0x5c, 0x12, 0x23, 0x90, 0xc7, 0x47, + 0xa0, 0xc1, 0x82, 0x3f, 0x20, 0x2f, 0x0e, 0xbc, 0x6f, 0x08, 0x0e, 0xf6, 0xdb, 0x2c, 0xd3, 0x79, + 0x23, 0xb1, 0xa6, 0xfd, 0x26, 0x01, 0x3a, 0xf7, 0xef, 0xb9, 0x96, 0xb7, 0x3b, 0xd4, 0x1f, 0xa1, + 0x3a, 0xcc, 0xf6, 0x4d, 0x12, 0x76, 0xf1, 0x09, 0x0b, 0x61, 0xc6, 0x18, 0x89, 0xe8, 0x1a, 0x2c, + 0x9a, 0x96, 0x15, 0x60, 0x2b, 0x99, 0x58, 0x72, 0x11, 0xed, 0x40, 0xcd, 0xc1, 0x84, 0x98, 0x16, + 0xfe, 0xca, 0x26, 0x61, 0x5d, 0x69, 0x28, 0xcd, 0xda, 0xce, 0x4a, 0x8b, 0x92, 0x44, 0xc8, 0xd6, + 0x10, 0x95, 0xd0, 0x06, 0xcc, 0x87, 0x81, 0x6d, 0x59, 0x2c, 0xd6, 0x19, 0x66, 0xf5, 0x7c, 0x41, + 0xfb, 0x1a, 0x50, 0x07, 0x87, 0xba, 0x79, 0x76, 0xc7, 0xed, 0xe9, 0xb6, 0xdb, 0xc5, 0x27, 0x06, + 0x3e, 0x41, 0xeb, 0x50, 0x8d, 0x92, 0xe3, 0x48, 0x45, 0x52, 0x1a, 0x46, 0x39, 0x03, 0xa3, 0x76, + 0x0a, 0xab, 0x19, 0x7b, 0xc4, 0xa7, 0x89, 0xef,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0x46, + 0x87, 0x8c, 0x99, 0xd4, 0x25, 0x96, 0xb2, 0x97, 0xf8, 0x7b, 0x58, 0xeb, 0xe4, 0x18, 0xa4, 0xd9, + 0xe1, 0x24, 0x91, 0xf0, 0x39, 0x91, 0x70, 0x82, 0x48, 0x38, 0x26, 0x52, 0x14, 0xb2, 0x92, 0x08, + 0xb9, 0x03, 0xab, 0x6d, 0xdc, 0xef, 0x0e, 0x7c, 0x1c, 0x74, 0x28, 0x40, 0x99, 0x8a, 0xc8, 0x45, + 0xb0, 0x2a, 0x09, 0x58, 0x69, 0xee, 0x59, 0x43, 0xc4, 0xd7, 0x0e, 0x79, 0xee, 0x69, 0x07, 0x13, + 0x73, 0x47, 0x2b, 0xa0, 0xd0, 0x22, 0xc9, 0xac, 0x48, 0xf4, 0xcf, 0x31, 0xce, 0x03, 0x8e, 0x53, + 0xda, 0xf9, 0x14, 0x38, 0x95, 0xbf, 0x32, 0xf7, 0x58, 0xcf, 0x78, 0x1c, 0xd8, 0x21, 0x6e, 0xdb, + 0x47, 0x47, 0xd3, 0xe7, 0xa5, 0x9d, 0x30, 0x88, 0x92, 0x96, 0xde, 0x70, 0xf0, 0x3f, 0x55, 0x40, + 0xd3, 0xbd, 0x9e, 0x7d, 0x34, 0xd4, 0x79, 0x93, 0x34, 0xb0, 0x79, 0x48, 0x03, 0xdc, 0x3b, 0x0b, + 0xb1, 0x4b, 0x6c, 0xcf, 0x2d, 0xc7, 0x50, 0x76, 0xcb, 0xbd, 0x41, 0x70, 0x88, 0x63, 0xaa, 0xc4, + 0x32, 0xdd, 0xf3, 0xfc, 0xc4, 0xcf, 0x43, 0x2c, 0xf3, 0x0e, 0x43, 0xa8, 0xa3, 0x83, 0xa1, 0x8f, + 0x59, 0x87, 0xa9, 0x18, 0xe2, 0x12, 0x3a, 0x83, 0xff, 0x05, 0xe9, 0xa0, 0x58, 0xbf, 0xaf, 0xb0, + 0x7e, 0xbf, 0xcb, 0xfb, 0xfd, 0xc4, 0x1c, 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43, 0x9d, 0x42, 0x43, 0xb9, 0x33, 0xbc, 0x63, 0xd8, 0x18, 0xf7, 0xdd, 0x81, 0xae, + 0x95, 0xf9, 0xb6, 0x54, 0xaf, 0x97, 0xd0, 0x22, 0x3e, 0x3a, 0x85, 0xc6, 0xa4, 0x37, 0x25, 0x6a, + 0x96, 0x7d, 0x57, 0xab, 0x37, 0x4a, 0x6a, 0x12, 0x1f, 0x9d, 0xc0, 0xc6, 0x9d, 0x5e, 0xaf, 0x38, + 0xcb, 0xcd, 0x92, 0x63, 0x1c, 0xb5, 0x59, 0x4e, 0x91, 0xf8, 0xe8, 0x07, 0xb8, 0x92, 0xf8, 0x4d, + 0xcc, 0xf1, 0x7a, 0x73, 0xc4, 0xac, 0x12, 0xaf, 0x15, 0xf5, 0x56, 0x79, 0x65, 0xe2, 0xef, 0xfe, + 0xff, 0xbb, 0xcb, 0x0f, 0x7c, 0xec, 0x3e, 0xdb, 0xd7, 0x85, 0xff, 0x36, 0x39, 0xc4, 0xba, 0xed, + 0x10, 0xeb, 0x79, 0x95, 0x89, 0xef, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x24, 0xb5, 0xd1, 0x36, + 0xd5, 0x1a, 0x00, 0x00, } diff --git a/pkg/proto/msg/msg.proto b/pkg/proto/msg/msg.proto index 563732e87..63902a98b 100644 --- a/pkg/proto/msg/msg.proto +++ b/pkg/proto/msg/msg.proto @@ -158,6 +158,7 @@ message GetMessageListReactionExtensionsReq { int64 msgFirstModifyTime = 2; } repeated MessageReactionKey messageReactionKeyList = 5; + repeated string TypeKeyList = 6; } message GetMessageListReactionExtensionsResp{ int32 errCode = 1; diff --git a/pkg/proto/msggateway/relay.pb.go b/pkg/proto/msggateway/relay.pb.go index 57288faee..e56b9c9c0 100644 --- a/pkg/proto/msggateway/relay.pb.go +++ b/pkg/proto/msggateway/relay.pb.go @@ -37,7 +37,7 @@ func (m *OnlinePushMsgReq) Reset() { *m = OnlinePushMsgReq{} } func (m *OnlinePushMsgReq) String() string { return proto.CompactTextString(m) } func (*OnlinePushMsgReq) ProtoMessage() {} func (*OnlinePushMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{0} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{0} } func (m *OnlinePushMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OnlinePushMsgReq.Unmarshal(m, b) @@ -89,7 +89,7 @@ func (m *OnlinePushMsgResp) Reset() { *m = OnlinePushMsgResp{} } func (m *OnlinePushMsgResp) String() string { return proto.CompactTextString(m) } func (*OnlinePushMsgResp) ProtoMessage() {} func (*OnlinePushMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{1} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{1} } func (m *OnlinePushMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OnlinePushMsgResp.Unmarshal(m, b) @@ -129,7 +129,7 @@ func (m *SingelMsgToUserResultList) Reset() { *m = SingelMsgToUserResult func (m *SingelMsgToUserResultList) String() string { return proto.CompactTextString(m) } func (*SingelMsgToUserResultList) ProtoMessage() {} func (*SingelMsgToUserResultList) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{2} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{2} } func (m *SingelMsgToUserResultList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingelMsgToUserResultList.Unmarshal(m, b) @@ -183,7 +183,7 @@ func (m *OnlineBatchPushOneMsgReq) Reset() { *m = OnlineBatchPushOneMsgR func (m *OnlineBatchPushOneMsgReq) String() string { return proto.CompactTextString(m) } func (*OnlineBatchPushOneMsgReq) ProtoMessage() {} func (*OnlineBatchPushOneMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{3} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{3} } func (m *OnlineBatchPushOneMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OnlineBatchPushOneMsgReq.Unmarshal(m, b) @@ -235,7 +235,7 @@ func (m *OnlineBatchPushOneMsgResp) Reset() { *m = OnlineBatchPushOneMsg func (m *OnlineBatchPushOneMsgResp) String() string { return proto.CompactTextString(m) } func (*OnlineBatchPushOneMsgResp) ProtoMessage() {} func (*OnlineBatchPushOneMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{4} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{4} } func (m *OnlineBatchPushOneMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OnlineBatchPushOneMsgResp.Unmarshal(m, b) @@ -275,7 +275,7 @@ func (m *SingleMsgToUserPlatform) Reset() { *m = SingleMsgToUserPlatform func (m *SingleMsgToUserPlatform) String() string { return proto.CompactTextString(m) } func (*SingleMsgToUserPlatform) ProtoMessage() {} func (*SingleMsgToUserPlatform) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{5} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{5} } func (m *SingleMsgToUserPlatform) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingleMsgToUserPlatform.Unmarshal(m, b) @@ -329,7 +329,7 @@ func (m *GetUsersOnlineStatusReq) Reset() { *m = GetUsersOnlineStatusReq func (m *GetUsersOnlineStatusReq) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusReq) ProtoMessage() {} func (*GetUsersOnlineStatusReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{6} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{6} } func (m *GetUsersOnlineStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusReq.Unmarshal(m, b) @@ -384,7 +384,7 @@ func (m *GetUsersOnlineStatusResp) Reset() { *m = GetUsersOnlineStatusRe func (m *GetUsersOnlineStatusResp) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp) ProtoMessage() {} func (*GetUsersOnlineStatusResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{7} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{7} } func (m *GetUsersOnlineStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp.Unmarshal(m, b) @@ -448,7 +448,7 @@ func (m *GetUsersOnlineStatusResp_SuccessDetail) Reset() { func (m *GetUsersOnlineStatusResp_SuccessDetail) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp_SuccessDetail) ProtoMessage() {} func (*GetUsersOnlineStatusResp_SuccessDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{7, 0} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{7, 0} } func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Unmarshal(m, b) @@ -509,7 +509,7 @@ func (m *GetUsersOnlineStatusResp_FailedDetail) Reset() { *m = GetUsersO func (m *GetUsersOnlineStatusResp_FailedDetail) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp_FailedDetail) ProtoMessage() {} func (*GetUsersOnlineStatusResp_FailedDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{7, 1} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{7, 1} } func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Unmarshal(m, b) @@ -565,7 +565,7 @@ func (m *GetUsersOnlineStatusResp_SuccessResult) Reset() { func (m *GetUsersOnlineStatusResp_SuccessResult) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp_SuccessResult) ProtoMessage() {} func (*GetUsersOnlineStatusResp_SuccessResult) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{7, 2} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{7, 2} } func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Unmarshal(m, b) @@ -619,7 +619,7 @@ func (m *KickUserOfflineReq) Reset() { *m = KickUserOfflineReq{} } func (m *KickUserOfflineReq) String() string { return proto.CompactTextString(m) } func (*KickUserOfflineReq) ProtoMessage() {} func (*KickUserOfflineReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{8} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{8} } func (m *KickUserOfflineReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickUserOfflineReq.Unmarshal(m, b) @@ -670,7 +670,7 @@ func (m *KickUserOfflineResp) Reset() { *m = KickUserOfflineResp{} } func (m *KickUserOfflineResp) String() string { return proto.CompactTextString(m) } func (*KickUserOfflineResp) ProtoMessage() {} func (*KickUserOfflineResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{9} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{9} } func (m *KickUserOfflineResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickUserOfflineResp.Unmarshal(m, b) @@ -704,7 +704,7 @@ func (m *MultiTerminalLoginCheckReq) Reset() { *m = MultiTerminalLoginCh func (m *MultiTerminalLoginCheckReq) String() string { return proto.CompactTextString(m) } func (*MultiTerminalLoginCheckReq) ProtoMessage() {} func (*MultiTerminalLoginCheckReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{10} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{10} } func (m *MultiTerminalLoginCheckReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MultiTerminalLoginCheckReq.Unmarshal(m, b) @@ -764,7 +764,7 @@ func (m *MultiTerminalLoginCheckResp) Reset() { *m = MultiTerminalLoginC func (m *MultiTerminalLoginCheckResp) String() string { return proto.CompactTextString(m) } func (*MultiTerminalLoginCheckResp) ProtoMessage() {} func (*MultiTerminalLoginCheckResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_fe7346d2191b0ff8, []int{11} + return fileDescriptor_relay_7fdb1a3cb7bcd264, []int{11} } func (m *MultiTerminalLoginCheckResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MultiTerminalLoginCheckResp.Unmarshal(m, b) @@ -1053,61 +1053,61 @@ var _Relay_serviceDesc = grpc.ServiceDesc{ Metadata: "relay/relay.proto", } -func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_fe7346d2191b0ff8) } +func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_7fdb1a3cb7bcd264) } -var fileDescriptor_relay_fe7346d2191b0ff8 = []byte{ - // 844 bytes of a gzipped FileDescriptorProto +var fileDescriptor_relay_7fdb1a3cb7bcd264 = []byte{ + // 834 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x97, 0x37, 0xc9, 0xee, 0xf6, 0xb5, 0x85, 0xee, 0xd0, 0x25, 0xae, 0x91, 0x92, 0xac, 0x0f, - 0x28, 0x42, 0x34, 0x91, 0x02, 0x37, 0x6e, 0xd9, 0x68, 0x4b, 0x44, 0xa3, 0x54, 0x93, 0x45, 0xa0, - 0xbd, 0x04, 0xd7, 0x99, 0x38, 0x56, 0x1c, 0xcf, 0x74, 0xc6, 0x6e, 0xd5, 0x0b, 0x1c, 0xb9, 0x20, - 0x0e, 0x7c, 0x00, 0x0e, 0x7c, 0x45, 0xbe, 0x00, 0x9a, 0x3f, 0x31, 0x76, 0x12, 0x37, 0x14, 0xa9, - 0x97, 0x36, 0xef, 0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x81, 0x89, 0x48, 0xa3, 0xe4, 0x32, - 0x14, 0x09, 0xfa, 0x14, 0x9e, 0xa7, 0xba, 0x09, 0xcd, 0xce, 0x58, 0x59, 0xa5, 0x67, 0xff, 0xbd, - 0x12, 0x6a, 0x00, 0xd0, 0xac, 0x65, 0x45, 0xea, 0x25, 0xce, 0x21, 0xee, 0x9f, 0x16, 0xd8, 0x9a, - 0x53, 0xdf, 0x4b, 0xfc, 0x85, 0xc4, 0xc6, 0x31, 0x79, 0x62, 0xad, 0xbf, 0x80, 0x93, 0xbc, 0xae, - 0x92, 0xb4, 0x5d, 0x69, 0x55, 0xda, 0x07, 0x78, 0x0b, 0x77, 0x43, 0x38, 0x2b, 0xe9, 0x4f, 0x30, - 0x74, 0x09, 0x27, 0x42, 0xd1, 0x97, 0xb8, 0x56, 0xd0, 0xcc, 0xa1, 0x95, 0x53, 0x67, 0xa7, 0xca, - 0x78, 0x2b, 0xd2, 0xbd, 0x87, 0x7a, 0x89, 0x98, 0x52, 0x46, 0xed, 0xf4, 0x96, 0xce, 0x88, 0x12, - 0xa2, 0x82, 0x73, 0x88, 0x1c, 0x19, 0x26, 0xfe, 0xed, 0x70, 0xa0, 0x64, 0x38, 0xc0, 0xc6, 0x42, - 0x9f, 0xc3, 0x47, 0xf2, 0x97, 0xcc, 0xf3, 0x8e, 0xf2, 0x95, 0xd9, 0xab, 0x1a, 0xde, 0x40, 0xdd, - 0x3b, 0xa8, 0x5f, 0x90, 0x44, 0x96, 0x14, 0x9a, 0xed, 0x24, 0xf1, 0x92, 0x54, 0xc8, 0x21, 0x34, - 0x00, 0xd2, 0x7f, 0x65, 0xb2, 0x94, 0x4c, 0x39, 0x44, 0x0e, 0x89, 0xe6, 0x86, 0xa4, 0xeb, 0xe7, - 0x21, 0xe4, 0xc0, 0x4b, 0xca, 0x0a, 0x6b, 0x9d, 0xd9, 0xee, 0xdf, 0x55, 0xb0, 0x77, 0x57, 0x16, - 0x0c, 0xd9, 0xf0, 0x82, 0x70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, 0x29, 0x51, 0xe4, 0x2b, 0x38, 0x87, 0xc8, 0x36, 0x61, 0xe2, 0xdf, 0x0e, + 0x07, 0x8a, 0xfa, 0x1e, 0x36, 0x16, 0xfa, 0x02, 0xde, 0xc8, 0x5f, 0x32, 0xce, 0x47, 0xca, 0x97, + 0x66, 0x96, 0x6a, 0x78, 0x0d, 0x75, 0xef, 0xa0, 0x7e, 0x46, 0x12, 0x99, 0x52, 0x68, 0xb6, 0x93, + 0xc4, 0x4b, 0x52, 0x21, 0x85, 0x6f, 0x00, 0xa4, 0xff, 0xca, 0x64, 0x29, 0x99, 0x72, 0x88, 0x6c, + 0x0c, 0xcd, 0x35, 0x46, 0xe7, 0xcf, 0x43, 0xc8, 0x81, 0xd7, 0x94, 0x15, 0x46, 0x39, 0xb3, 0xdd, + 0xbf, 0xab, 0x60, 0x6f, 0xcf, 0x2c, 0x18, 0xb2, 0xe1, 0x15, 0xe1, 0x3c, 0xa3, 0x5c, 0xc3, 0x2b, + 0x53, 0xf2, 0x25, 0x9c, 0x8f, 0x44, 0xb0, 0xe2, 0xab, 0x2d, 0x34, 0x81, 0x43, 0x91, 0xfa, 0x3e, + 0x11, 0xc2, 0x74, 0xa3, 0xa2, 0xba, 0x71, 0x6a, 0xba, 0x51, 0x96, 0xa9, 0x33, 0xc9, 0x6f, 0xc2, + 0xc5, 0x18, 0xe8, 0x02, 0x0e, 0x66, 0x5e, 0x18, 0x91, 0xa9, 0x89, 0x59, 0x55, 0x31, 0xbf, 0xde, + 0x15, 0xf3, 0xa3, 0xda, 0x33, 0x20, 0x89, 0x17, 0x46, 0xb8, 0x10, 0xc1, 0xf9, 0x0d, 0x0e, 0x4d, + 0x46, 0xbd, 0x2c, 0x25, 0x62, 0xa6, 0xd7, 0x66, 0xb4, 0x33, 0x5b, 0x72, 0x15, 0x2a, 0xea, 0x8a, + 0xab, 0xb6, 0x24, 0xee, 0xd3, 0x38, 0xce, 0x44, 0x35, 0x96, 0xbc, 0x3d, 0x42, 0x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x40, 0x8d, 0x47, 0x27, 0xe4, 0xc6, 0x69, 0xee, 0x98, 0x20, 0x74, 0x05, 0xef, + 0xb6, 0x5e, 0xf9, 0xa8, 0x59, 0xa8, 0x65, 0xf3, 0x91, 0x72, 0x5a, 0x8f, 0x3b, 0x08, 0x86, 0xa6, + 0xd0, 0x9c, 0xa4, 0x8c, 0xf0, 0x33, 0x4e, 0x53, 0xf6, 0x6c, 0x59, 0xbe, 0x83, 0x4f, 0xd6, 0xe6, + 0x0b, 0x9d, 0x98, 0x4d, 0x9b, 0x73, 0xef, 0x38, 0x65, 0x4b, 0x82, 0xa1, 0x5f, 0xa0, 0x5e, 0x32, + 0x03, 0xe8, 0xbd, 0xd9, 0x56, 0x3e, 0xb1, 0x8e, 0xbb, 0xcb, 0x45, 0xb0, 0xfe, 0xfb, 0xab, 0xa6, + 0xfc, 0xf0, 0xfa, 0x79, 0x38, 0xca, 0x7d, 0x71, 0xa9, 0x6d, 0xdf, 0xb2, 0x6b, 0x2c, 0xff, 0x5f, + 0xbf, 0x54, 0xe0, 0x37, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x59, 0x61, 0x49, 0x43, 0xbc, 0x09, + 0x00, 0x00, } diff --git a/pkg/proto/proto_dir.cfg b/pkg/proto/proto_dir.cfg index a85a69155..7509903fe 100644 --- a/pkg/proto/proto_dir.cfg +++ b/pkg/proto/proto_dir.cfg @@ -10,4 +10,5 @@ all_proto=( relay/relay.proto sdkws/ws.proto conversation/conversation.proto + file/file.proto ) diff --git a/pkg/proto/sdk_ws/group.proto b/pkg/proto/sdk_ws/group.proto new file mode 100644 index 000000000..4ab168601 --- /dev/null +++ b/pkg/proto/sdk_ws/group.proto @@ -0,0 +1,369 @@ +syntax = "proto3"; +import "Open-IM-Server/pkg/proto/sdkws/ws.proto"; +import "Open-IM-Server/pkg/proto/sdkws/wrappers.proto"; +option go_package = "Open_IM/pkg/proto/group;group"; +package group; + + + +message CreateGroupReq{ + repeated string initMembers = 1; + sdkws.GroupInfo groupInfo = 2; + repeated string adminUserIDs = 3; + string ownerUserID = 4; //owner +} +message CreateGroupResp{ + sdkws.GroupInfo groupInfo = 1; +} + + +message GetGroupsInfoReq{ + repeated string groupIDs = 1; +} +message GetGroupsInfoResp{ + repeated sdkws.GroupInfo groupInfos = 1; +} + + +message SetGroupInfoReq{ + sdkws.GroupInfoForSet groupInfoForSet = 1; +} +message SetGroupInfoResp{ +} + + +message GetGroupApplicationListReq { + sdkws.RequestPagination pagination = 1; + string fromUserID = 2; //owner or admin +} +message GetGroupApplicationListResp { + uint32 total = 1; + repeated sdkws.GroupRequest groupRequests = 2; +} + +message GetUserReqApplicationListReq{ + sdkws.RequestPagination pagination = 1; + string userID = 2; +} + +message GetUserReqApplicationListResp{ + uint32 total = 1; + repeated sdkws.GroupRequest groupRequests = 2; +} + + +message TransferGroupOwnerReq { + string groupID = 1; + string oldOwnerUserID = 2; + string newOwnerUserID = 3; +} +message TransferGroupOwnerResp{ + +} + +message JoinGroupReq{ + string groupID = 1; + string reqMessage = 2; + int32 joinSource = 3; + string inviterUserID = 4; +} +message JoinGroupResp{ +} + + +message GroupApplicationResponseReq{ + string groupID = 1; + string fromUserID = 2; // + string handledMsg = 3; + int32 handleResult = 4; +} +message GroupApplicationResponseResp{ + +} + + + +message QuitGroupReq{ + string groupID = 1; +} +message QuitGroupResp{ +} + + +message GetGroupMemberListReq { + sdkws.RequestPagination pagination = 1; + string groupID = 2; + int32 filter = 3; +} + +message GetGroupMemberListResp { + uint32 total = 1; + repeated sdkws.GroupMemberFullInfo members = 2; +} + + +message GetGroupMembersInfoReq { + string groupID = 1; + repeated string members = 2; +} + +message GetGroupMembersInfoResp { + repeated sdkws.GroupMemberFullInfo members = 1; +} + +message KickGroupMemberReq { + string groupID = 1; + repeated string kickedUserIDs = 2; + string reason = 3; +} + +message KickGroupMemberResp { + +} + + +message GetJoinedGroupListReq { + sdkws.RequestPagination pagination = 1; + string fromUserID = 2; +} +message GetJoinedGroupListResp{ + uint32 total = 1; + repeated sdkws.GroupInfo groups = 2; +} + + +message InviteUserToGroupReq { + string groupID = 1; + string reason = 2; + repeated string invitedUserIDs = 3; +} +message InviteUserToGroupResp { + +} + + +message GetGroupAllMemberReq { + sdkws.RequestPagination pagination = 1; + string groupID = 2; +} +message GetGroupAllMemberResp { + repeated sdkws.GroupMemberFullInfo members = 1; +} + +message CMSGroup { + sdkws.GroupInfo groupInfo = 1; + string groupOwnerUserName = 2; + string groupOwnerUserID = 3; +} + + +message GetGroupsReq { + sdkws.RequestPagination pagination = 1; + string groupName = 2; + string groupID = 3; +} + +message GetGroupsResp { + uint32 total = 1; + repeated CMSGroup groups = 2; +} + +message GetGroupMemberReq { + string groupID = 1; +} + +message GetGroupMembersCMSReq { + sdkws.RequestPagination pagination = 1; + string groupID = 2; + string userName = 3; +} + +message GetGroupMembersCMSResp { + uint32 total = 1; + repeated sdkws.GroupMemberFullInfo members = 2; +} + +message DismissGroupReq{ + string groupID = 1; +} + +message DismissGroupResp{ +} + + +message MuteGroupMemberReq{ + string groupID = 1; + string userID = 2; + uint32 mutedSeconds = 3; +} + +message MuteGroupMemberResp{ +} + + + +message CancelMuteGroupMemberReq{ + string groupID = 1; + string userID = 2; +} + +message CancelMuteGroupMemberResp{ +} + + +message MuteGroupReq{ + string groupID = 1; +} + +message MuteGroupResp{ +} + + + +message CancelMuteGroupReq{ + string groupID = 1; +} + +message CancelMuteGroupResp{ +} + +message GetJoinedSuperGroupListReq { + string userID = 1; +} + +message GetJoinedSuperGroupListResp { + repeated sdkws.GroupInfo groups = 1; +} + +message GetSuperGroupsInfoReq { + repeated string groupIDs = 1; +} + +message GetSuperGroupsInfoResp { + repeated sdkws.GroupInfo groupInfos = 1; +} + +message SetGroupMemberInfo{ + string groupID = 1; + string userID = 2; + google.protobuf.StringValue nickname = 3; + google.protobuf.StringValue faceURL = 4; + google.protobuf.Int32Value roleLevel = 5; + google.protobuf.StringValue ex = 6; +} + +message SetGroupMemberInfoReq{ + repeated SetGroupMemberInfo members = 1; +} + +message SetGroupMemberInfoResp{ + +} + +message GetGroupAbstractInfoReq{ + repeated string groupIDs = 1; +} + +message GroupAbstractInfo{ + string groupID = 1; + uint32 groupMemberNumber = 2; + uint64 groupMemberListHash = 3; +} + +message GetGroupAbstractInfoResp{ + repeated GroupAbstractInfo groupAbstractInfos = 1; +} + +message GetUserInGroupMembersReq { + string userID = 1; + repeated string groupIDs = 2; +} + +message GetUserInGroupMembersResp{ + repeated sdkws.GroupMemberFullInfo members = 1; +} + +message GetGroupMemberUserIDReq{ + string groupID = 1; +} + +message GetGroupMemberUserIDResp{ + repeated string userIDs = 1; +} + +message GetGroupMemberRoleLevelReq{ + string groupID = 1; + repeated string roleLevel = 2; +} + +message GetGroupMemberRoleLevelResp { + repeated sdkws.GroupMemberFullInfo members = 1; +} + +service group{ + //创建群 + rpc createGroup(CreateGroupReq) returns(CreateGroupResp); + //申请加群 + rpc joinGroup(JoinGroupReq) returns(JoinGroupResp); + //退出群 + rpc quitGroup(QuitGroupReq) returns(QuitGroupResp); + //获取指定群信息 + rpc getGroupsInfo(GetGroupsInfoReq) returns(GetGroupsInfoResp); + //设置群信息 + rpc setGroupInfo(SetGroupInfoReq) returns(SetGroupInfoResp); + //(以管理员或群主身份)获取群的加群申请 + rpc getGroupApplicationList(GetGroupApplicationListReq) returns(GetGroupApplicationListResp); + //获取用户自己的主动加群申请 + rpc getUserReqApplicationList(GetUserReqApplicationListReq) returns(GetUserReqApplicationListResp); + //转让群主 + rpc transferGroupOwner(TransferGroupOwnerReq) returns(TransferGroupOwnerResp); + //群主或管理员处理进群申请 + rpc groupApplicationResponse(GroupApplicationResponseReq) returns(GroupApplicationResponseResp); + //获取某个群的群成员 + rpc getGroupMemberList(GetGroupMemberListReq) returns(GetGroupMemberListResp); + //获取某个群的指定群成员 + rpc getGroupMembersInfo(GetGroupMembersInfoReq) returns(GetGroupMembersInfoResp); + //踢出群 + rpc kickGroupMember(KickGroupMemberReq) returns (KickGroupMemberResp); + //获取某个人已加入群 + rpc getJoinedGroupList(GetJoinedGroupListReq) returns (GetJoinedGroupListResp); + //邀请某些人进群 + rpc inviteUserToGroup(InviteUserToGroupReq) returns (InviteUserToGroupResp); + + rpc getGroups(GetGroupsReq) returns(GetGroupsResp); + rpc getGroupMembersCMS(GetGroupMembersCMSReq) returns(GetGroupMembersCMSResp); + + //解散群 + rpc dismissGroup(DismissGroupReq) returns(DismissGroupResp); + //对某个群成员禁言 + rpc muteGroupMember(MuteGroupMemberReq) returns(MuteGroupMemberResp); + //对某个群成员取消禁言 + rpc cancelMuteGroupMember(CancelMuteGroupMemberReq) returns(CancelMuteGroupMemberResp); + //对某个群禁言 + rpc muteGroup(MuteGroupReq) returns(MuteGroupResp); + //对某个群取消禁言 + rpc cancelMuteGroup(CancelMuteGroupReq) returns(CancelMuteGroupResp); + + //获取某个用户加入的超级群 + rpc getJoinedSuperGroupList(GetJoinedSuperGroupListReq) returns (GetJoinedSuperGroupListResp); + //获取指定的超级群信息 + rpc getSuperGroupsInfo(GetSuperGroupsInfoReq) returns (GetSuperGroupsInfoResp); + //设置群成员昵称 + //设置群成员信息 + rpc setGroupMemberInfo(SetGroupMemberInfoReq) returns (SetGroupMemberInfoResp); + //获取群信息hash值 + rpc getGroupAbstractInfo(GetGroupAbstractInfoReq) returns (GetGroupAbstractInfoResp); + //获取某个用户在指定群中的信息 + rpc getUserInGroupMembers(GetUserInGroupMembersReq) returns (GetUserInGroupMembersResp); + //获取群成员用户ID + rpc getGroupMemberUserID(GetGroupMemberUserIDReq) returns (GetGroupMemberUserIDResp); + //查询群组中对应级别的成员 + rpc GetGroupMemberRoleLevel(GetGroupMemberRoleLevelReq)returns (GetGroupMemberRoleLevelResp); +} + + + + + + + diff --git a/pkg/proto/sdkws/ws.pb.go b/pkg/proto/sdkws/ws.pb.go index 2e0524c1a..dc6569378 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_2c814dd0dc73fa33, []int{0} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{1} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{2} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{3} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{4} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{5} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{6} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{7} + return fileDescriptor_ws_32de46e041571b6e, []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_2c814dd0dc73fa33, []int{8} + return fileDescriptor_ws_32de46e041571b6e, []int{8} } func (m *FriendRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendRequest.Unmarshal(m, b) @@ -1055,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_2c814dd0dc73fa33, []int{9} + return fileDescriptor_ws_32de46e041571b6e, []int{9} } func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) @@ -1107,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_2c814dd0dc73fa33, []int{10} + return fileDescriptor_ws_32de46e041571b6e, []int{10} } func (m *SeqList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SeqList.Unmarshal(m, b) @@ -1145,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_2c814dd0dc73fa33, []int{11} + return fileDescriptor_ws_32de46e041571b6e, []int{11} } func (m *MsgDataList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataList.Unmarshal(m, b) @@ -1186,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_2c814dd0dc73fa33, []int{12} + return fileDescriptor_ws_32de46e041571b6e, []int{12} } func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b) @@ -1246,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_2c814dd0dc73fa33, []int{13} + return fileDescriptor_ws_32de46e041571b6e, []int{13} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -1292,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_2c814dd0dc73fa33, []int{14} + return fileDescriptor_ws_32de46e041571b6e, []int{14} } func (m *MaxAndMinSeq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MaxAndMinSeq.Unmarshal(m, b) @@ -1339,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_2c814dd0dc73fa33, []int{15} + return fileDescriptor_ws_32de46e041571b6e, []int{15} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -1393,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_2c814dd0dc73fa33, []int{16} + return fileDescriptor_ws_32de46e041571b6e, []int{16} } func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) @@ -1466,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_2c814dd0dc73fa33, []int{17} + return fileDescriptor_ws_32de46e041571b6e, []int{17} } func (m *MsgData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgData.Unmarshal(m, b) @@ -1655,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_2c814dd0dc73fa33, []int{18} + return fileDescriptor_ws_32de46e041571b6e, []int{18} } func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b) @@ -1723,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_2c814dd0dc73fa33, []int{19} + return fileDescriptor_ws_32de46e041571b6e, []int{19} } func (m *TipsComm) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TipsComm.Unmarshal(m, b) @@ -1780,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_2c814dd0dc73fa33, []int{20} + return fileDescriptor_ws_32de46e041571b6e, []int{20} } func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b) @@ -1849,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_2c814dd0dc73fa33, []int{21} + return fileDescriptor_ws_32de46e041571b6e, []int{21} } func (m *GroupInfoSetTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfoSetTips.Unmarshal(m, b) @@ -1904,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_2c814dd0dc73fa33, []int{22} + return fileDescriptor_ws_32de46e041571b6e, []int{22} } func (m *JoinGroupApplicationTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupApplicationTips.Unmarshal(m, b) @@ -1960,7 +1960,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_2c814dd0dc73fa33, []int{23} + return fileDescriptor_ws_32de46e041571b6e, []int{23} } func (m *MemberQuitTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberQuitTips.Unmarshal(m, b) @@ -2016,7 +2016,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_2c814dd0dc73fa33, []int{24} + return fileDescriptor_ws_32de46e041571b6e, []int{24} } func (m *GroupApplicationAcceptedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationAcceptedTips.Unmarshal(m, b) @@ -2079,7 +2079,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_2c814dd0dc73fa33, []int{25} + return fileDescriptor_ws_32de46e041571b6e, []int{25} } func (m *GroupApplicationRejectedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationRejectedTips.Unmarshal(m, b) @@ -2142,7 +2142,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_2c814dd0dc73fa33, []int{26} + return fileDescriptor_ws_32de46e041571b6e, []int{26} } func (m *GroupOwnerTransferredTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupOwnerTransferredTips.Unmarshal(m, b) @@ -2205,7 +2205,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_2c814dd0dc73fa33, []int{27} + return fileDescriptor_ws_32de46e041571b6e, []int{27} } func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b) @@ -2268,7 +2268,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_2c814dd0dc73fa33, []int{28} + return fileDescriptor_ws_32de46e041571b6e, []int{28} } func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b) @@ -2330,7 +2330,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_2c814dd0dc73fa33, []int{29} + return fileDescriptor_ws_32de46e041571b6e, []int{29} } func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b) @@ -2384,7 +2384,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_2c814dd0dc73fa33, []int{30} + return fileDescriptor_ws_32de46e041571b6e, []int{30} } func (m *GroupDismissedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupDismissedTips.Unmarshal(m, b) @@ -2440,7 +2440,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_2c814dd0dc73fa33, []int{31} + return fileDescriptor_ws_32de46e041571b6e, []int{31} } func (m *GroupMemberMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberMutedTips.Unmarshal(m, b) @@ -2509,7 +2509,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_2c814dd0dc73fa33, []int{32} + return fileDescriptor_ws_32de46e041571b6e, []int{32} } func (m *GroupMemberCancelMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberCancelMutedTips.Unmarshal(m, b) @@ -2570,7 +2570,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_2c814dd0dc73fa33, []int{33} + return fileDescriptor_ws_32de46e041571b6e, []int{33} } func (m *GroupMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMutedTips.Unmarshal(m, b) @@ -2624,7 +2624,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_2c814dd0dc73fa33, []int{34} + return fileDescriptor_ws_32de46e041571b6e, []int{34} } func (m *GroupCancelMutedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupCancelMutedTips.Unmarshal(m, b) @@ -2679,7 +2679,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_2c814dd0dc73fa33, []int{35} + return fileDescriptor_ws_32de46e041571b6e, []int{35} } func (m *GroupMemberInfoSetTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberInfoSetTips.Unmarshal(m, b) @@ -2740,7 +2740,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_2c814dd0dc73fa33, []int{36} + return fileDescriptor_ws_32de46e041571b6e, []int{36} } func (m *FriendApplication) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplication.Unmarshal(m, b) @@ -2793,7 +2793,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_2c814dd0dc73fa33, []int{37} + return fileDescriptor_ws_32de46e041571b6e, []int{37} } func (m *FromToUserID) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FromToUserID.Unmarshal(m, b) @@ -2839,7 +2839,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_2c814dd0dc73fa33, []int{38} + return fileDescriptor_ws_32de46e041571b6e, []int{38} } func (m *FriendApplicationTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationTips.Unmarshal(m, b) @@ -2879,7 +2879,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_2c814dd0dc73fa33, []int{39} + return fileDescriptor_ws_32de46e041571b6e, []int{39} } func (m *FriendApplicationApprovedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationApprovedTips.Unmarshal(m, b) @@ -2926,7 +2926,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_2c814dd0dc73fa33, []int{40} + return fileDescriptor_ws_32de46e041571b6e, []int{40} } func (m *FriendApplicationRejectedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationRejectedTips.Unmarshal(m, b) @@ -2974,7 +2974,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_2c814dd0dc73fa33, []int{41} + return fileDescriptor_ws_32de46e041571b6e, []int{41} } func (m *FriendAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendAddedTips.Unmarshal(m, b) @@ -3027,7 +3027,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_2c814dd0dc73fa33, []int{42} + return fileDescriptor_ws_32de46e041571b6e, []int{42} } func (m *FriendDeletedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendDeletedTips.Unmarshal(m, b) @@ -3065,7 +3065,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_2c814dd0dc73fa33, []int{43} + return fileDescriptor_ws_32de46e041571b6e, []int{43} } func (m *BlackAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackAddedTips.Unmarshal(m, b) @@ -3103,7 +3103,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_2c814dd0dc73fa33, []int{44} + return fileDescriptor_ws_32de46e041571b6e, []int{44} } func (m *BlackDeletedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackDeletedTips.Unmarshal(m, b) @@ -3141,7 +3141,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_2c814dd0dc73fa33, []int{45} + return fileDescriptor_ws_32de46e041571b6e, []int{45} } func (m *FriendInfoChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfoChangedTips.Unmarshal(m, b) @@ -3180,7 +3180,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_2c814dd0dc73fa33, []int{46} + return fileDescriptor_ws_32de46e041571b6e, []int{46} } func (m *UserInfoUpdatedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserInfoUpdatedTips.Unmarshal(m, b) @@ -3221,7 +3221,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_2c814dd0dc73fa33, []int{47} + return fileDescriptor_ws_32de46e041571b6e, []int{47} } func (m *ConversationUpdateTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ConversationUpdateTips.Unmarshal(m, b) @@ -3275,7 +3275,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_2c814dd0dc73fa33, []int{48} + return fileDescriptor_ws_32de46e041571b6e, []int{48} } func (m *ConversationSetPrivateTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ConversationSetPrivateTips.Unmarshal(m, b) @@ -3330,7 +3330,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_2c814dd0dc73fa33, []int{49} + return fileDescriptor_ws_32de46e041571b6e, []int{49} } func (m *DeleteMessageTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteMessageTips.Unmarshal(m, b) @@ -3384,7 +3384,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_2c814dd0dc73fa33, []int{50} + return fileDescriptor_ws_32de46e041571b6e, []int{50} } func (m *RequestPagination) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestPagination.Unmarshal(m, b) @@ -3441,7 +3441,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_2c814dd0dc73fa33, []int{51} + return fileDescriptor_ws_32de46e041571b6e, []int{51} } func (m *SignalReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalReq.Unmarshal(m, b) @@ -3830,7 +3830,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_2c814dd0dc73fa33, []int{52} + return fileDescriptor_ws_32de46e041571b6e, []int{52} } func (m *SignalResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalResp.Unmarshal(m, b) @@ -4160,7 +4160,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_2c814dd0dc73fa33, []int{53} + return fileDescriptor_ws_32de46e041571b6e, []int{53} } func (m *InvitationInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InvitationInfo.Unmarshal(m, b) @@ -4270,7 +4270,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_2c814dd0dc73fa33, []int{54} + return fileDescriptor_ws_32de46e041571b6e, []int{54} } func (m *ParticipantMetaData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ParticipantMetaData.Unmarshal(m, b) @@ -4325,7 +4325,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_2c814dd0dc73fa33, []int{55} + return fileDescriptor_ws_32de46e041571b6e, []int{55} } func (m *SignalInviteReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteReq.Unmarshal(m, b) @@ -4387,7 +4387,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_2c814dd0dc73fa33, []int{56} + return fileDescriptor_ws_32de46e041571b6e, []int{56} } func (m *SignalInviteReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteReply.Unmarshal(m, b) @@ -4449,7 +4449,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_2c814dd0dc73fa33, []int{57} + return fileDescriptor_ws_32de46e041571b6e, []int{57} } func (m *SignalInviteInGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteInGroupReq.Unmarshal(m, b) @@ -4511,7 +4511,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_2c814dd0dc73fa33, []int{58} + return fileDescriptor_ws_32de46e041571b6e, []int{58} } func (m *SignalInviteInGroupReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalInviteInGroupReply.Unmarshal(m, b) @@ -4573,7 +4573,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_2c814dd0dc73fa33, []int{59} + return fileDescriptor_ws_32de46e041571b6e, []int{59} } func (m *SignalCancelReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalCancelReq.Unmarshal(m, b) @@ -4631,7 +4631,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_2c814dd0dc73fa33, []int{60} + return fileDescriptor_ws_32de46e041571b6e, []int{60} } func (m *SignalCancelReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalCancelReply.Unmarshal(m, b) @@ -4666,7 +4666,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_2c814dd0dc73fa33, []int{61} + return fileDescriptor_ws_32de46e041571b6e, []int{61} } func (m *SignalAcceptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalAcceptReq.Unmarshal(m, b) @@ -4734,7 +4734,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_2c814dd0dc73fa33, []int{62} + return fileDescriptor_ws_32de46e041571b6e, []int{62} } func (m *SignalAcceptReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalAcceptReply.Unmarshal(m, b) @@ -4788,7 +4788,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_2c814dd0dc73fa33, []int{63} + return fileDescriptor_ws_32de46e041571b6e, []int{63} } func (m *SignalHungUpReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalHungUpReq.Unmarshal(m, b) @@ -4839,7 +4839,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_2c814dd0dc73fa33, []int{64} + return fileDescriptor_ws_32de46e041571b6e, []int{64} } func (m *SignalHungUpReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalHungUpReply.Unmarshal(m, b) @@ -4874,7 +4874,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_2c814dd0dc73fa33, []int{65} + return fileDescriptor_ws_32de46e041571b6e, []int{65} } func (m *SignalRejectReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalRejectReq.Unmarshal(m, b) @@ -4939,7 +4939,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_2c814dd0dc73fa33, []int{66} + return fileDescriptor_ws_32de46e041571b6e, []int{66} } func (m *SignalRejectReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalRejectReply.Unmarshal(m, b) @@ -4972,7 +4972,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_2c814dd0dc73fa33, []int{67} + return fileDescriptor_ws_32de46e041571b6e, []int{67} } func (m *SignalGetRoomByGroupIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetRoomByGroupIDReq.Unmarshal(m, b) @@ -5026,7 +5026,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_2c814dd0dc73fa33, []int{68} + return fileDescriptor_ws_32de46e041571b6e, []int{68} } func (m *SignalGetRoomByGroupIDReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetRoomByGroupIDReply.Unmarshal(m, b) @@ -5080,7 +5080,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_2c814dd0dc73fa33, []int{69} + return fileDescriptor_ws_32de46e041571b6e, []int{69} } func (m *SignalOnRoomParticipantConnectedReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalOnRoomParticipantConnectedReq.Unmarshal(m, b) @@ -5136,7 +5136,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_2c814dd0dc73fa33, []int{70} + return fileDescriptor_ws_32de46e041571b6e, []int{70} } func (m *SignalOnRoomParticipantDisconnectedReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalOnRoomParticipantDisconnectedReq.Unmarshal(m, b) @@ -5191,7 +5191,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_2c814dd0dc73fa33, []int{71} + return fileDescriptor_ws_32de46e041571b6e, []int{71} } func (m *SignalGetTokenByRoomIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetTokenByRoomIDReq.Unmarshal(m, b) @@ -5251,7 +5251,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_2c814dd0dc73fa33, []int{72} + return fileDescriptor_ws_32de46e041571b6e, []int{72} } func (m *SignalGetTokenByRoomIDReply) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignalGetTokenByRoomIDReply.Unmarshal(m, b) @@ -5297,7 +5297,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_2c814dd0dc73fa33, []int{73} + return fileDescriptor_ws_32de46e041571b6e, []int{73} } func (m *SetAppBackgroundStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetAppBackgroundStatusReq.Unmarshal(m, b) @@ -5343,7 +5343,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_2c814dd0dc73fa33, []int{74} + return fileDescriptor_ws_32de46e041571b6e, []int{74} } func (m *SetAppBackgroundStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetAppBackgroundStatusResp.Unmarshal(m, b) @@ -5393,7 +5393,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_2c814dd0dc73fa33, []int{75} + return fileDescriptor_ws_32de46e041571b6e, []int{75} } func (m *ExtendMsgSet) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsgSet.Unmarshal(m, b) @@ -5470,7 +5470,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_2c814dd0dc73fa33, []int{76} + return fileDescriptor_ws_32de46e041571b6e, []int{76} } func (m *ExtendMsg) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ExtendMsg.Unmarshal(m, b) @@ -5538,7 +5538,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_2c814dd0dc73fa33, []int{77} + return fileDescriptor_ws_32de46e041571b6e, []int{77} } func (m *KeyValue) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KeyValue.Unmarshal(m, b) @@ -5666,9 +5666,9 @@ func init() { proto.RegisterType((*KeyValue)(nil), "sdkws.KeyValue") } -func init() { proto.RegisterFile("sdkws/ws.proto", fileDescriptor_ws_2c814dd0dc73fa33) } +func init() { proto.RegisterFile("sdkws/ws.proto", fileDescriptor_ws_32de46e041571b6e) } -var fileDescriptor_ws_2c814dd0dc73fa33 = []byte{ +var fileDescriptor_ws_32de46e041571b6e = []byte{ // 3680 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5b, 0xcf, 0x6f, 0xdc, 0xd6, 0xf1, 0x0f, 0x77, 0xb5, 0x92, 0x76, 0x56, 0x3f, 0x69, 0x5b, 0xd9, 0x6c, 0x62, 0x47, 0x60, 0xf2, diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index c55249f0c..8e05e8d7e 100644 --- a/pkg/proto/user/user.pb.go +++ b/pkg/proto/user/user.pb.go @@ -36,7 +36,7 @@ func (m *GetAllUserIDReq) Reset() { *m = GetAllUserIDReq{} } func (m *GetAllUserIDReq) String() string { return proto.CompactTextString(m) } func (*GetAllUserIDReq) ProtoMessage() {} func (*GetAllUserIDReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{0} + return fileDescriptor_user_4ddd294c9f082be5, []int{0} } func (m *GetAllUserIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllUserIDReq.Unmarshal(m, b) @@ -75,7 +75,7 @@ func (m *GetAllUserIDResp) Reset() { *m = GetAllUserIDResp{} } func (m *GetAllUserIDResp) String() string { return proto.CompactTextString(m) } func (*GetAllUserIDResp) ProtoMessage() {} func (*GetAllUserIDResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{1} + return fileDescriptor_user_4ddd294c9f082be5, []int{1} } func (m *GetAllUserIDResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllUserIDResp.Unmarshal(m, b) @@ -120,7 +120,7 @@ func (m *AccountCheckReq) Reset() { *m = AccountCheckReq{} } func (m *AccountCheckReq) String() string { return proto.CompactTextString(m) } func (*AccountCheckReq) ProtoMessage() {} func (*AccountCheckReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{2} + return fileDescriptor_user_4ddd294c9f082be5, []int{2} } func (m *AccountCheckReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckReq.Unmarshal(m, b) @@ -158,7 +158,7 @@ func (m *AccountCheckResp) Reset() { *m = AccountCheckResp{} } func (m *AccountCheckResp) String() string { return proto.CompactTextString(m) } func (*AccountCheckResp) ProtoMessage() {} func (*AccountCheckResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{3} + return fileDescriptor_user_4ddd294c9f082be5, []int{3} } func (m *AccountCheckResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckResp.Unmarshal(m, b) @@ -197,7 +197,7 @@ func (m *AccountCheckRespSingleUserStatus) Reset() { *m = AccountCheckRe func (m *AccountCheckRespSingleUserStatus) String() string { return proto.CompactTextString(m) } func (*AccountCheckRespSingleUserStatus) ProtoMessage() {} func (*AccountCheckRespSingleUserStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{3, 0} + return fileDescriptor_user_4ddd294c9f082be5, []int{3, 0} } func (m *AccountCheckRespSingleUserStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckRespSingleUserStatus.Unmarshal(m, b) @@ -242,7 +242,7 @@ func (m *GetDesignateUsersReq) Reset() { *m = GetDesignateUsersReq{} } func (m *GetDesignateUsersReq) String() string { return proto.CompactTextString(m) } func (*GetDesignateUsersReq) ProtoMessage() {} func (*GetDesignateUsersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{4} + return fileDescriptor_user_4ddd294c9f082be5, []int{4} } func (m *GetDesignateUsersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetDesignateUsersReq.Unmarshal(m, b) @@ -280,7 +280,7 @@ func (m *GetDesignateUsersResp) Reset() { *m = GetDesignateUsersResp{} } func (m *GetDesignateUsersResp) String() string { return proto.CompactTextString(m) } func (*GetDesignateUsersResp) ProtoMessage() {} func (*GetDesignateUsersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{5} + return fileDescriptor_user_4ddd294c9f082be5, []int{5} } func (m *GetDesignateUsersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetDesignateUsersResp.Unmarshal(m, b) @@ -318,7 +318,7 @@ func (m *UpdateUserInfoReq) Reset() { *m = UpdateUserInfoReq{} } func (m *UpdateUserInfoReq) String() string { return proto.CompactTextString(m) } func (*UpdateUserInfoReq) ProtoMessage() {} func (*UpdateUserInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{6} + return fileDescriptor_user_4ddd294c9f082be5, []int{6} } func (m *UpdateUserInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateUserInfoReq.Unmarshal(m, b) @@ -355,7 +355,7 @@ func (m *UpdateUserInfoResp) Reset() { *m = UpdateUserInfoResp{} } func (m *UpdateUserInfoResp) String() string { return proto.CompactTextString(m) } func (*UpdateUserInfoResp) ProtoMessage() {} func (*UpdateUserInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{7} + return fileDescriptor_user_4ddd294c9f082be5, []int{7} } func (m *UpdateUserInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateUserInfoResp.Unmarshal(m, b) @@ -387,7 +387,7 @@ func (m *SetGlobalRecvMessageOptReq) Reset() { *m = SetGlobalRecvMessage func (m *SetGlobalRecvMessageOptReq) String() string { return proto.CompactTextString(m) } func (*SetGlobalRecvMessageOptReq) ProtoMessage() {} func (*SetGlobalRecvMessageOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{8} + return fileDescriptor_user_4ddd294c9f082be5, []int{8} } func (m *SetGlobalRecvMessageOptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGlobalRecvMessageOptReq.Unmarshal(m, b) @@ -431,7 +431,7 @@ func (m *SetGlobalRecvMessageOptResp) Reset() { *m = SetGlobalRecvMessag func (m *SetGlobalRecvMessageOptResp) String() string { return proto.CompactTextString(m) } func (*SetGlobalRecvMessageOptResp) ProtoMessage() {} func (*SetGlobalRecvMessageOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{9} + return fileDescriptor_user_4ddd294c9f082be5, []int{9} } func (m *SetGlobalRecvMessageOptResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGlobalRecvMessageOptResp.Unmarshal(m, b) @@ -464,7 +464,7 @@ func (m *SetConversationReq) Reset() { *m = SetConversationReq{} } func (m *SetConversationReq) String() string { return proto.CompactTextString(m) } func (*SetConversationReq) ProtoMessage() {} func (*SetConversationReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{10} + return fileDescriptor_user_4ddd294c9f082be5, []int{10} } func (m *SetConversationReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetConversationReq.Unmarshal(m, b) @@ -515,7 +515,7 @@ func (m *SetConversationResp) Reset() { *m = SetConversationResp{} } func (m *SetConversationResp) String() string { return proto.CompactTextString(m) } func (*SetConversationResp) ProtoMessage() {} func (*SetConversationResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{11} + return fileDescriptor_user_4ddd294c9f082be5, []int{11} } func (m *SetConversationResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetConversationResp.Unmarshal(m, b) @@ -550,7 +550,7 @@ func (m *SetRecvMsgOptReq) Reset() { *m = SetRecvMsgOptReq{} } func (m *SetRecvMsgOptReq) String() string { return proto.CompactTextString(m) } func (*SetRecvMsgOptReq) ProtoMessage() {} func (*SetRecvMsgOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{12} + return fileDescriptor_user_4ddd294c9f082be5, []int{12} } func (m *SetRecvMsgOptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetRecvMsgOptReq.Unmarshal(m, b) @@ -615,7 +615,7 @@ func (m *SetRecvMsgOptResp) Reset() { *m = SetRecvMsgOptResp{} } func (m *SetRecvMsgOptResp) String() string { return proto.CompactTextString(m) } func (*SetRecvMsgOptResp) ProtoMessage() {} func (*SetRecvMsgOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{13} + return fileDescriptor_user_4ddd294c9f082be5, []int{13} } func (m *SetRecvMsgOptResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetRecvMsgOptResp.Unmarshal(m, b) @@ -648,7 +648,7 @@ func (m *GetConversationReq) Reset() { *m = GetConversationReq{} } func (m *GetConversationReq) String() string { return proto.CompactTextString(m) } func (*GetConversationReq) ProtoMessage() {} func (*GetConversationReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{14} + return fileDescriptor_user_4ddd294c9f082be5, []int{14} } func (m *GetConversationReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationReq.Unmarshal(m, b) @@ -700,7 +700,7 @@ func (m *GetConversationResp) Reset() { *m = GetConversationResp{} } func (m *GetConversationResp) String() string { return proto.CompactTextString(m) } func (*GetConversationResp) ProtoMessage() {} func (*GetConversationResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{15} + return fileDescriptor_user_4ddd294c9f082be5, []int{15} } func (m *GetConversationResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationResp.Unmarshal(m, b) @@ -740,7 +740,7 @@ func (m *GetConversationsReq) Reset() { *m = GetConversationsReq{} } func (m *GetConversationsReq) String() string { return proto.CompactTextString(m) } func (*GetConversationsReq) ProtoMessage() {} func (*GetConversationsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{16} + return fileDescriptor_user_4ddd294c9f082be5, []int{16} } func (m *GetConversationsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationsReq.Unmarshal(m, b) @@ -792,7 +792,7 @@ func (m *GetConversationsResp) Reset() { *m = GetConversationsResp{} } func (m *GetConversationsResp) String() string { return proto.CompactTextString(m) } func (*GetConversationsResp) ProtoMessage() {} func (*GetConversationsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{17} + return fileDescriptor_user_4ddd294c9f082be5, []int{17} } func (m *GetConversationsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationsResp.Unmarshal(m, b) @@ -831,7 +831,7 @@ func (m *GetAllConversationsReq) Reset() { *m = GetAllConversationsReq{} func (m *GetAllConversationsReq) String() string { return proto.CompactTextString(m) } func (*GetAllConversationsReq) ProtoMessage() {} func (*GetAllConversationsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{18} + return fileDescriptor_user_4ddd294c9f082be5, []int{18} } func (m *GetAllConversationsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllConversationsReq.Unmarshal(m, b) @@ -876,7 +876,7 @@ func (m *GetAllConversationsResp) Reset() { *m = GetAllConversationsResp func (m *GetAllConversationsResp) String() string { return proto.CompactTextString(m) } func (*GetAllConversationsResp) ProtoMessage() {} func (*GetAllConversationsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{19} + return fileDescriptor_user_4ddd294c9f082be5, []int{19} } func (m *GetAllConversationsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllConversationsResp.Unmarshal(m, b) @@ -917,7 +917,7 @@ func (m *BatchSetConversationsReq) Reset() { *m = BatchSetConversationsR func (m *BatchSetConversationsReq) String() string { return proto.CompactTextString(m) } func (*BatchSetConversationsReq) ProtoMessage() {} func (*BatchSetConversationsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{20} + return fileDescriptor_user_4ddd294c9f082be5, []int{20} } func (m *BatchSetConversationsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BatchSetConversationsReq.Unmarshal(m, b) @@ -977,7 +977,7 @@ func (m *BatchSetConversationsResp) Reset() { *m = BatchSetConversations func (m *BatchSetConversationsResp) String() string { return proto.CompactTextString(m) } func (*BatchSetConversationsResp) ProtoMessage() {} func (*BatchSetConversationsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{21} + return fileDescriptor_user_4ddd294c9f082be5, []int{21} } func (m *BatchSetConversationsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BatchSetConversationsResp.Unmarshal(m, b) @@ -1022,7 +1022,7 @@ func (m *GetPaginationUsersReq) Reset() { *m = GetPaginationUsersReq{} } func (m *GetPaginationUsersReq) String() string { return proto.CompactTextString(m) } func (*GetPaginationUsersReq) ProtoMessage() {} func (*GetPaginationUsersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{22} + return fileDescriptor_user_4ddd294c9f082be5, []int{22} } func (m *GetPaginationUsersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationUsersReq.Unmarshal(m, b) @@ -1061,7 +1061,7 @@ func (m *GetPaginationUsersResp) Reset() { *m = GetPaginationUsersResp{} func (m *GetPaginationUsersResp) String() string { return proto.CompactTextString(m) } func (*GetPaginationUsersResp) ProtoMessage() {} func (*GetPaginationUsersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{23} + return fileDescriptor_user_4ddd294c9f082be5, []int{23} } func (m *GetPaginationUsersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetPaginationUsersResp.Unmarshal(m, b) @@ -1106,7 +1106,7 @@ func (m *UserRegisterReq) Reset() { *m = UserRegisterReq{} } func (m *UserRegisterReq) String() string { return proto.CompactTextString(m) } func (*UserRegisterReq) ProtoMessage() {} func (*UserRegisterReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{24} + return fileDescriptor_user_4ddd294c9f082be5, []int{24} } func (m *UserRegisterReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserRegisterReq.Unmarshal(m, b) @@ -1143,7 +1143,7 @@ func (m *UserRegisterResp) Reset() { *m = UserRegisterResp{} } func (m *UserRegisterResp) String() string { return proto.CompactTextString(m) } func (*UserRegisterResp) ProtoMessage() {} func (*UserRegisterResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_c6c77fe2e81ca7ab, []int{25} + return fileDescriptor_user_4ddd294c9f082be5, []int{25} } func (m *UserRegisterResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserRegisterResp.Unmarshal(m, b) @@ -1163,6 +1163,82 @@ func (m *UserRegisterResp) XXX_DiscardUnknown() { var xxx_messageInfo_UserRegisterResp proto.InternalMessageInfo +type GetGlobalRecvMessageOptReq struct { + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetGlobalRecvMessageOptReq) Reset() { *m = GetGlobalRecvMessageOptReq{} } +func (m *GetGlobalRecvMessageOptReq) String() string { return proto.CompactTextString(m) } +func (*GetGlobalRecvMessageOptReq) ProtoMessage() {} +func (*GetGlobalRecvMessageOptReq) Descriptor() ([]byte, []int) { + return fileDescriptor_user_4ddd294c9f082be5, []int{26} +} +func (m *GetGlobalRecvMessageOptReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetGlobalRecvMessageOptReq.Unmarshal(m, b) +} +func (m *GetGlobalRecvMessageOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetGlobalRecvMessageOptReq.Marshal(b, m, deterministic) +} +func (dst *GetGlobalRecvMessageOptReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetGlobalRecvMessageOptReq.Merge(dst, src) +} +func (m *GetGlobalRecvMessageOptReq) XXX_Size() int { + return xxx_messageInfo_GetGlobalRecvMessageOptReq.Size(m) +} +func (m *GetGlobalRecvMessageOptReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetGlobalRecvMessageOptReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetGlobalRecvMessageOptReq proto.InternalMessageInfo + +func (m *GetGlobalRecvMessageOptReq) GetUserID() string { + if m != nil { + return m.UserID + } + return "" +} + +type GetGlobalRecvMessageOptResp struct { + GlobalRecvMsgOpt int32 `protobuf:"varint,1,opt,name=globalRecvMsgOpt" json:"globalRecvMsgOpt,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetGlobalRecvMessageOptResp) Reset() { *m = GetGlobalRecvMessageOptResp{} } +func (m *GetGlobalRecvMessageOptResp) String() string { return proto.CompactTextString(m) } +func (*GetGlobalRecvMessageOptResp) ProtoMessage() {} +func (*GetGlobalRecvMessageOptResp) Descriptor() ([]byte, []int) { + return fileDescriptor_user_4ddd294c9f082be5, []int{27} +} +func (m *GetGlobalRecvMessageOptResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetGlobalRecvMessageOptResp.Unmarshal(m, b) +} +func (m *GetGlobalRecvMessageOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetGlobalRecvMessageOptResp.Marshal(b, m, deterministic) +} +func (dst *GetGlobalRecvMessageOptResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetGlobalRecvMessageOptResp.Merge(dst, src) +} +func (m *GetGlobalRecvMessageOptResp) XXX_Size() int { + return xxx_messageInfo_GetGlobalRecvMessageOptResp.Size(m) +} +func (m *GetGlobalRecvMessageOptResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetGlobalRecvMessageOptResp.DiscardUnknown(m) +} + +var xxx_messageInfo_GetGlobalRecvMessageOptResp proto.InternalMessageInfo + +func (m *GetGlobalRecvMessageOptResp) GetGlobalRecvMsgOpt() int32 { + if m != nil { + return m.GlobalRecvMsgOpt + } + return 0 +} + func init() { proto.RegisterType((*GetAllUserIDReq)(nil), "user.getAllUserIDReq") proto.RegisterType((*GetAllUserIDResp)(nil), "user.getAllUserIDResp") @@ -1191,6 +1267,8 @@ func init() { proto.RegisterType((*GetPaginationUsersResp)(nil), "user.getPaginationUsersResp") proto.RegisterType((*UserRegisterReq)(nil), "user.userRegisterReq") proto.RegisterType((*UserRegisterResp)(nil), "user.userRegisterResp") + proto.RegisterType((*GetGlobalRecvMessageOptReq)(nil), "user.getGlobalRecvMessageOptReq") + proto.RegisterType((*GetGlobalRecvMessageOptResp)(nil), "user.getGlobalRecvMessageOptResp") } // Reference imports to suppress errors if they are not otherwise used. @@ -1210,6 +1288,8 @@ type UserClient interface { UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error) // 设置用户消息接收选项 SetGlobalRecvMessageOpt(ctx context.Context, in *SetGlobalRecvMessageOptReq, opts ...grpc.CallOption) (*SetGlobalRecvMessageOptResp, error) + // 获取用户消息接收选项 没找到不返回错误 + GetGlobalRecvMessageOpt(ctx context.Context, in *GetGlobalRecvMessageOptReq, opts ...grpc.CallOption) (*GetGlobalRecvMessageOptResp, error) // 检查userID是否存在 AccountCheck(ctx context.Context, in *AccountCheckReq, opts ...grpc.CallOption) (*AccountCheckResp, error) // 翻页(或指定userID,昵称)拉取用户信息 全字段 @@ -1253,6 +1333,15 @@ func (c *userClient) SetGlobalRecvMessageOpt(ctx context.Context, in *SetGlobalR return out, nil } +func (c *userClient) GetGlobalRecvMessageOpt(ctx context.Context, in *GetGlobalRecvMessageOptReq, opts ...grpc.CallOption) (*GetGlobalRecvMessageOptResp, error) { + out := new(GetGlobalRecvMessageOptResp) + err := grpc.Invoke(ctx, "/user.user/getGlobalRecvMessageOpt", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *userClient) AccountCheck(ctx context.Context, in *AccountCheckReq, opts ...grpc.CallOption) (*AccountCheckResp, error) { out := new(AccountCheckResp) err := grpc.Invoke(ctx, "/user.user/accountCheck", in, out, c.cc, opts...) @@ -1289,6 +1378,8 @@ type UserServer interface { UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*UpdateUserInfoResp, error) // 设置用户消息接收选项 SetGlobalRecvMessageOpt(context.Context, *SetGlobalRecvMessageOptReq) (*SetGlobalRecvMessageOptResp, error) + // 获取用户消息接收选项 没找到不返回错误 + GetGlobalRecvMessageOpt(context.Context, *GetGlobalRecvMessageOptReq) (*GetGlobalRecvMessageOptResp, error) // 检查userID是否存在 AccountCheck(context.Context, *AccountCheckReq) (*AccountCheckResp, error) // 翻页(或指定userID,昵称)拉取用户信息 全字段 @@ -1355,6 +1446,24 @@ func _User_SetGlobalRecvMessageOpt_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _User_GetGlobalRecvMessageOpt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGlobalRecvMessageOptReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).GetGlobalRecvMessageOpt(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/user.user/GetGlobalRecvMessageOpt", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).GetGlobalRecvMessageOpt(ctx, req.(*GetGlobalRecvMessageOptReq)) + } + return interceptor(ctx, in, info, handler) +} + func _User_AccountCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AccountCheckReq) if err := dec(in); err != nil { @@ -1425,6 +1534,10 @@ var _User_serviceDesc = grpc.ServiceDesc{ MethodName: "setGlobalRecvMessageOpt", Handler: _User_SetGlobalRecvMessageOpt_Handler, }, + { + MethodName: "getGlobalRecvMessageOpt", + Handler: _User_GetGlobalRecvMessageOpt_Handler, + }, { MethodName: "accountCheck", Handler: _User_AccountCheck_Handler, @@ -1442,65 +1555,66 @@ var _User_serviceDesc = grpc.ServiceDesc{ Metadata: "user/user.proto", } -func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_c6c77fe2e81ca7ab) } +func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_4ddd294c9f082be5) } -var fileDescriptor_user_c6c77fe2e81ca7ab = []byte{ - // 911 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x6d, 0x6f, 0xe3, 0x44, - 0x10, 0x96, 0x93, 0xe6, 0x8e, 0x4e, 0x7b, 0xd7, 0x74, 0xfb, 0x66, 0x5c, 0x0e, 0x95, 0xd5, 0x09, - 0x2a, 0xa4, 0x4b, 0xa0, 0x08, 0x01, 0x42, 0x20, 0x8e, 0x46, 0x40, 0xa4, 0x46, 0x39, 0x39, 0x54, - 0x20, 0xde, 0x82, 0xeb, 0x6e, 0x7d, 0x56, 0x8d, 0xbd, 0xf1, 0xac, 0x5b, 0xf1, 0x0d, 0x89, 0x7f, - 0xc2, 0x17, 0xfe, 0x0a, 0x42, 0xfc, 0x28, 0xb4, 0x6b, 0xa7, 0x59, 0x7b, 0xed, 0x5e, 0xae, 0xba, - 0x2f, 0x89, 0x77, 0x76, 0xe6, 0xd9, 0x79, 0x66, 0x66, 0x77, 0x06, 0x36, 0x32, 0x64, 0x69, 0x5f, - 0xfe, 0xf4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0x5b, 0x2f, 0xd0, 0x40, 0x4e, - 0x3e, 0x83, 0x75, 0x7d, 0x66, 0x22, 0x3b, 0x75, 0x73, 0xd4, 0xcc, 0xd9, 0xad, 0x1f, 0xaf, 0xc8, - 0x58, 0x3d, 0xf4, 0x95, 0xbc, 0x93, 0x45, 0x58, 0xcc, 0x82, 0x73, 0xde, 0x68, 0xde, 0xcc, 0xfd, - 0xd1, 0xf3, 0x33, 0xf7, 0xa7, 0x92, 0xf9, 0xb9, 0x3f, 0xd5, 0x54, 0x7e, 0xf9, 0xe8, 0x87, 0x7d, - 0x39, 0x42, 0x4f, 0x87, 0x23, 0x6d, 0x76, 0x96, 0x5a, 0x9f, 0xca, 0x9f, 0xb3, 0x7b, 0x4a, 0xf0, - 0xc1, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x3a, 0xa4, 0xbe, 0xa9, 0x0b, 0x00, 0x00, +var fileDescriptor_user_4ddd294c9f082be5 = []byte{ + // 927 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x6d, 0x6f, 0xe4, 0x34, + 0x10, 0x56, 0xb6, 0xdd, 0x3b, 0x3a, 0xed, 0xdd, 0x6e, 0xdd, 0xb7, 0x90, 0x72, 0xa8, 0x58, 0xc0, + 0x55, 0xa0, 0xee, 0xa2, 0x02, 0x52, 0x25, 0x04, 0xba, 0xa3, 0xd5, 0xc1, 0x8a, 0xab, 0xf6, 0x48, + 0xa9, 0x84, 0x00, 0x01, 0x69, 0xea, 0xa6, 0x51, 0xa3, 0xc4, 0x9b, 0x71, 0x5a, 0xf1, 0x0d, 0x89, + 0x7f, 0xc2, 0x17, 0xf8, 0x2d, 0x88, 0x1f, 0x85, 0x6c, 0x67, 0xbb, 0x4e, 0x9c, 0xf4, 0x05, 0xdd, + 0x97, 0xdd, 0x78, 0x5e, 0x1e, 0xcf, 0x33, 0x1e, 0x7b, 0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xb7, 0x59, 0x81, 0x9c, 0xfc, 0x0c, 0x1b, 0x2d, 0x4d, 0x96, 0x6c, 0x69, 0xa7, 0xf6, 0x2e, + 0xef, 0xbd, 0x73, 0x8b, 0x85, 0xc6, 0x8f, 0x6e, 0xc6, 0x8f, 0x6e, 0xc5, 0xbf, 0xe9, 0x1c, 0x3e, + 0x87, 0x25, 0x73, 0xb0, 0x23, 0x6b, 0x4d, 0xc3, 0xde, 0xc4, 0x5b, 0x6f, 0x9e, 0x01, 0xc9, 0x58, + 0x75, 0xa9, 0x5a, 0x01, 0x93, 0x59, 0xda, 0xed, 0xdb, 0xe2, 0xbd, 0xd5, 0xae, 0xd4, 0xf1, 0x98, + 0x05, 0x38, 0x8d, 0xa7, 0x56, 0xce, 0xd3, 0x78, 0xea, 0xb5, 0xfa, 0xe5, 0x93, 0x1f, 0x36, 0xe5, + 0x6c, 0xff, 0xcb, 0xe8, 0xd0, 0x18, 0xea, 0xa5, 0xd5, 0x67, 0xf2, 0xe7, 0xe4, 0x81, 0x12, 0x7c, + 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcd, 0xd8, 0x30, 0x73, 0x41, 0x0c, 0x00, 0x00, } diff --git a/pkg/utils/utils_v2.go b/pkg/utils/utils_v2.go index f32a7b73a..8d567e050 100644 --- a/pkg/utils/utils_v2.go +++ b/pkg/utils/utils_v2.go @@ -5,6 +5,38 @@ import ( "sort" ) +// SliceSub a中存在,b中不存在 (a-b) +func SliceSub[E comparable](a, b []E) []E { + k := make(map[E]struct{}) + for i := 0; i < len(b); i++ { + k[b[i]] = struct{}{} + } + t := make(map[E]struct{}) + rs := make([]E, 0, len(a)) + for i := 0; i < len(a); i++ { + e := a[i] + if _, ok := t[e]; ok { + continue + } + if _, ok := k[e]; ok { + continue + } + rs = append(rs, e) + t[e] = struct{}{} + } + return rs +} + +// SliceSubAny a中存在,b中不存在 (a-b) +func SliceSubAny[E comparable, T any](a []E, b []T, fn func(t T) E) []E { + return SliceSub(a, Slice(b, fn)) +} + +// SliceAnySub a中存在,b中不存在 (a-b) fn 返回的是uuid +func SliceAnySub[E any, T comparable](a, b []E, fn func(t E) T) []E { + panic("todo") +} + // DistinctAny 去重 func DistinctAny[E any, K comparable](es []E, fn func(e E) K) []E { v := make([]E, 0, len(es)) @@ -159,7 +191,7 @@ func Filter[E, T any](es []E, fn func(e E) (T, bool)) []T { func Slice[E any, T any](es []E, fn func(e E) T) []T { v := make([]T, len(es)) for i := 0; i < len(es); i++ { - v = append(v, fn(es[i])) + v[i] = fn(es[i]) } return v }