docs: integrate swagger to show api doc (#61)

* docs: integrate swagger to show api doc

* feat: optmise to get etcd connection
pull/83/head
Yaxian 4 years ago committed by GitHub
parent c934368c1a
commit d4db6c0f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -140,6 +140,16 @@ or try with `docker-compose`
docker-compose -f docker-compose.dev.yaml logs -f docker-compose -f docker-compose.dev.yaml logs -f
``` ```
### Api Swagger
run service by `pm2` firstly, then run visit `[ip]:10000/swagger/index.html`
run following command to generate swagger docs
```
go get -u github.com/swaggo/swag/cmd/swag
export PATH=$(go env GOPATH)/bin:$PATH
swag init --generalInfo cmd/open_im_api/main.go
```
### CONFIGURATION INSTRUCTIONS ### CONFIGURATION INSTRUCTIONS
> Open-IM configuration is divided into basic component configuration and business internal service configuration. Developers need to fill in the address of each component as the address of their server component when using the product, and ensure that the internal service port of the business is not occupied > Open-IM configuration is divided into basic component configuration and business internal service configuration. Developers need to fill in the address of each component as the address of their server component when using the product, and ensure that the internal service port of the business is not occupied

@ -3,6 +3,9 @@ apps:
- name: open_im_api - name: open_im_api
script: "go run main.go" script: "go run main.go"
cwd: "cmd/open_im_api" cwd: "cmd/open_im_api"
env:
OPEN_IM_SWAGGER_API: true
watch: ["docs", "cmd", "internal", "pkg"]
- name: open_im_auth - name: open_im_auth
script: "go run main.go" script: "go run main.go"

@ -1,6 +1,7 @@
package main package main
import ( import (
docs "Open_IM/docs"
apiAuth "Open_IM/internal/api/auth" apiAuth "Open_IM/internal/api/auth"
apiChat "Open_IM/internal/api/chat" apiChat "Open_IM/internal/api/chat"
"Open_IM/internal/api/friend" "Open_IM/internal/api/friend"
@ -11,9 +12,15 @@ import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"flag" "flag"
"github.com/gin-gonic/gin" "os"
"strconv" "strconv"
"github.com/gin-gonic/gin"
//"syscall" //"syscall"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
) )
func main() { func main() {
@ -28,6 +35,12 @@ func main() {
//log.Info("", "", "api server running...") //log.Info("", "", "api server running...")
r := gin.Default() r := gin.Default()
r.Use(utils.CorsHandler()) r.Use(utils.CorsHandler())
if os.Getenv("OPEN_IM_SWAGGER_API") == "true" {
docs.SwaggerInfo.BasePath = "/"
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
}
// user routing group, which handles user registration and login services // user routing group, which handles user registration and login services
userRouterGroup := r.Group("/user") userRouterGroup := r.Group("/user")
{ {
@ -98,5 +111,6 @@ func main() {
log.NewPrivateLog("api") log.NewPrivateLog("api")
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port") ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
flag.Parse() flag.Parse()
r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort)) r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort))
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -8,13 +8,15 @@ require (
github.com/antonfisher/nested-logrus-formatter v1.3.0 github.com/antonfisher/nested-logrus-formatter v1.3.0
github.com/bwmarrin/snowflake v0.3.0 github.com/bwmarrin/snowflake v0.3.0
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect
github.com/eapache/go-resiliency v1.2.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/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect github.com/eapache/queue v1.1.0 // indirect
github.com/frankban/quicktest v1.14.0 // indirect github.com/frankban/quicktest v1.14.0 // indirect
github.com/garyburd/redigo v1.6.2 github.com/garyburd/redigo v1.6.2
github.com/gin-gonic/gin v1.7.0 github.com/gin-gonic/gin v1.7.4
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-playground/validator/v10 v10.4.1 github.com/go-playground/validator/v10 v10.4.1
github.com/golang-jwt/jwt/v4 v4.1.0 github.com/golang-jwt/jwt/v4 v4.1.0
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
@ -34,12 +36,16 @@ require (
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 // indirect
github.com/swaggo/gin-swagger v1.3.3 // indirect
github.com/swaggo/swag v1.7.4 // indirect
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf golang.org/x/net v0.0.0-20211111160137-58aab5ef257a
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect golang.org/x/sys v0.0.0-20211112143042-c6105e7cf70d // indirect
golang.org/x/tools v0.1.7 // indirect
google.golang.org/grpc v1.33.2 google.golang.org/grpc v1.33.2
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b

@ -1,6 +1,12 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/sarama v1.19.0 h1:9oksLxC6uxVPHPVYUmq6xhr1BOF/hHobWH2UzO67z1s= github.com/Shopify/sarama v1.19.0 h1:9oksLxC6uxVPHPVYUmq6xhr1BOF/hHobWH2UzO67z1s=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
@ -26,6 +32,10 @@ github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmf
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28= github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -55,25 +65,48 @@ github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzP
github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og=
github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM= github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/gzip v0.0.3/go.mod h1:YxxswVZIqOvcHEQpsSn+QF5guQtO1dCfy0shBPy4jFc=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= 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-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU=
github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM=
github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM=
github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
github.com/go-openapi/spec v0.20.3 h1:uH9RQ6vdyPSs2pSy9fL8QPspDF2AMIMPtmK5coSSjtQ=
github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg=
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=
github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
@ -168,6 +201,9 @@ github.com/lestrrat-go/strftime v1.0.4/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR7
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
@ -191,6 +227,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= 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/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/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olivere/elastic/v7 v7.0.23 h1:b7tjMogDMhf2CisGI+L02LXLVa0ZyE82Z15XfW1e8t8= 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/olivere/elastic/v7 v7.0.23/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY=
@ -223,6 +260,13 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 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.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
@ -243,6 +287,13 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E=
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 h1:+iNTcqQJy0OZ5jk6a5NLib47eqXK8uYcPX+O4+cBpEM=
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w=
github.com/swaggo/gin-swagger v1.3.3 h1:XHyYmeNVFG5PbyWHG4jXtxOm2P4kiZapDCWsyDDiQ/I=
github.com/swaggo/gin-swagger v1.3.3/go.mod h1:ymsZuGpbbu+S7ZoQ49QPpZoDBj6uqhb8WizgQPVgWl0=
github.com/swaggo/swag v1.7.4 h1:up+ixy8yOqJKiFcuhMgkuYuF4xnevuhnFAXXF8OSfNg=
github.com/swaggo/swag v1.7.4/go.mod h1:zD8h6h4SPv7t3l+4BKdRquqW1ASWjKZgT6Qv9z3kNqI=
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G/aIr3WiUesWHL2YGYgEqjM5tCAJ43Ml+0C18wDkWWs= github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G/aIr3WiUesWHL2YGYgEqjM5tCAJ43Ml+0C18wDkWWs=
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw= github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@ -252,10 +303,14 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg= go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 h1:jWtjCJX1qxhHISBMLRztWwR+EXkI7MJAF2HjHAE/x/I= go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 h1:jWtjCJX1qxhHISBMLRztWwR+EXkI7MJAF2HjHAE/x/I=
@ -287,6 +342,7 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -296,17 +352,24 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ=
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a h1:c83jeVQW0KGKNaKBRfelNYNHaev+qawl9yaA825s8XE=
golang.org/x/net v0.0.0-20211111160137-58aab5ef257a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/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-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/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-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -319,14 +382,22 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211112143042-c6105e7cf70d h1:jp6PtFmjL+vGsuzd86xYqaJGv6eXdLvmVGzVVLI6EPI=
golang.org/x/sys v0.0.0-20211112143042-c6105e7cf70d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/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.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@ -339,6 +410,10 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ= golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -363,6 +438,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
@ -371,9 +447,13 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

@ -6,11 +6,12 @@ import (
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbAuth "Open_IM/pkg/proto/auth" pbAuth "Open_IM/pkg/proto/auth"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsUserRegister struct
type paramsUserRegister struct { type paramsUserRegister struct {
Secret string `json:"secret" binding:"required,max=32"` Secret string `json:"secret" binding:"required,max=32"`
Platform int32 `json:"platform" binding:"required,min=1,max=7"` Platform int32 `json:"platform" binding:"required,min=1,max=7"`
@ -24,6 +25,13 @@ type paramsUserRegister struct {
Ex string `json:"ex" binding:"omitempty,max=1024"` Ex string `json:"ex" binding:"omitempty,max=1024"`
} }
// resultUserRegister struct
type resultUserRegister struct {
UID string `json:"uid"`
Token string `json:"token"`
ExpiredTime int64 `json:"expiredTime"`
}
func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq { func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq {
pbData := pbAuth.UserRegisterReq{ pbData := pbAuth.UserRegisterReq{
UID: params.UID, UID: params.UID,
@ -38,9 +46,20 @@ func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq {
return &pbData return &pbData
} }
// @Summary
// @Schemes
// @Description register a new user
// @Tags auth
// @Accept json
// @Produce json
// @Param body body apiAuth.paramsUserRegister true "new user params"
// @Success 200 {object} user.result{data=apiAuth.resultUserRegister}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /auth/user_register [post]
func UserRegister(c *gin.Context) { func UserRegister(c *gin.Context) {
log.Info("", "", "api user_register init ....") log.Info("", "", "api user_register init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) etcdConn := getcdv3.GetAuthConn()
client := pbAuth.NewAuthClient(etcdConn) client := pbAuth.NewAuthClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -6,11 +6,12 @@ import (
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbAuth "Open_IM/pkg/proto/auth" pbAuth "Open_IM/pkg/proto/auth"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsUserToken struct
type paramsUserToken struct { type paramsUserToken struct {
Secret string `json:"secret" binding:"required,max=32"` Secret string `json:"secret" binding:"required,max=32"`
Platform int32 `json:"platform" binding:"required,min=1,max=8"` Platform int32 `json:"platform" binding:"required,min=1,max=8"`
@ -25,9 +26,20 @@ func newUserTokenReq(params *paramsUserToken) *pbAuth.UserTokenReq {
return &pbData return &pbData
} }
// @Summary
// @Schemes
// @Description get token
// @Tags auth
// @Accept json
// @Produce json
// @Param body body apiAuth.paramsUserToken true "get token params"
// @Success 200 {object} user.result{data=apiAuth.resultUserRegister}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /auth/user_token [post]
func UserToken(c *gin.Context) { func UserToken(c *gin.Context) {
log.Info("", "", "api user_token init ....") log.Info("", "", "api user_token init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) etcdConn := getcdv3.GetAuthConn()
client := pbAuth.NewAuthClient(etcdConn) client := pbAuth.NewAuthClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,17 +1,17 @@
package apiChat package apiChat
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbMsg "Open_IM/pkg/proto/chat" pbMsg "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsUserNewestSeq struct
type paramsUserNewestSeq struct { type paramsUserNewestSeq struct {
ReqIdentifier int `json:"reqIdentifier" binding:"required"` ReqIdentifier int `json:"reqIdentifier" binding:"required"`
SendID string `json:"sendID" binding:"required"` SendID string `json:"sendID" binding:"required"`
@ -19,6 +19,30 @@ type paramsUserNewestSeq struct {
MsgIncr int `json:"msgIncr" binding:"required"` MsgIncr int `json:"msgIncr" binding:"required"`
} }
// resultUserNewestSeq struct
type resultUserNewestSeq struct {
ErrCode int32 `json:"errCode`
ErrMsg string `json:"errMsg"`
MsgIncr int `json:"msgIncr"`
ReqIdentifier int `json:"reqIdentifier"`
Data struct {
MaxSeq int64 `json:"maxSeq,omitempty"`
MinSeq int64 `json:"minSeq,omitempty"`
} `json:"data"`
}
// @Summary
// @Schemes
// @Description get latest message seq
// @Tags chat
// @Accept json
// @Produce json
// @Param body body apiChat.paramsUserNewestSeq true "user get latest seq params"
// @Param token header string true "token"
// @Success 200 {object} apiChat.resultUserNewestSeq
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /chat/newest_seq [post]
func UserGetSeq(c *gin.Context) { func UserGetSeq(c *gin.Context) {
params := paramsUserNewestSeq{} params := paramsUserNewestSeq{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
@ -34,7 +58,7 @@ func UserGetSeq(c *gin.Context) {
pbData := pbMsg.GetMaxAndMinSeqReq{} pbData := pbMsg.GetMaxAndMinSeqReq{}
pbData.UserID = params.SendID pbData.UserID = params.SendID
pbData.OperationID = params.OperationID pbData.OperationID = params.OperationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetOfflineMessageConn()
if grpcConn == nil { if grpcConn == nil {
log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", params) log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", params)
@ -43,6 +67,7 @@ func UserGetSeq(c *gin.Context) {
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData) reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
if err != nil { if err != nil {
log.ErrorByKv("rpc call failed to getNewSeq", pbData.OperationID, "err", err, "pbData", pbData.String()) log.ErrorByKv("rpc call failed to getNewSeq", pbData.OperationID, "err", err, "pbData", pbData.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return return
} }

@ -1,17 +1,17 @@
package apiChat package apiChat
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
"Open_IM/pkg/proto/chat" pbChat "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsUserPullMsg struct
type paramsUserPullMsg struct { type paramsUserPullMsg struct {
ReqIdentifier *int `json:"reqIdentifier" binding:"required"` ReqIdentifier *int `json:"reqIdentifier" binding:"required"`
SendID string `json:"sendID" binding:"required"` SendID string `json:"sendID" binding:"required"`
@ -22,6 +22,18 @@ type paramsUserPullMsg struct {
} }
} }
// @Summary
// @Schemes
// @Description user pull messages
// @Tags chat
// @Accept json
// @Produce json
// @Param body body apiChat.paramsUserPullMsg true "user pull messages"
// @Param token header string true "token"
// @Success 200 {object} user.result{reqIdentifier=int}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /chat/pull_msg [post]
func UserPullMsg(c *gin.Context) { func UserPullMsg(c *gin.Context) {
params := paramsUserPullMsg{} params := paramsUserPullMsg{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
@ -39,7 +51,7 @@ func UserPullMsg(c *gin.Context) {
pbData.OperationID = params.OperationID pbData.OperationID = params.OperationID
pbData.SeqBegin = *params.Data.SeqBegin pbData.SeqBegin = *params.Data.SeqBegin
pbData.SeqEnd = *params.Data.SeqEnd pbData.SeqEnd = *params.Data.SeqEnd
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetOfflineMessageConn()
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessage(context.Background(), &pbData) reply, err := msgClient.PullMessage(context.Background(), &pbData)
if err != nil { if err != nil {
@ -71,6 +83,7 @@ func UserPullMsg(c *gin.Context) {
} }
// paramsUserPullMsgBySeqList struct
type paramsUserPullMsgBySeqList struct { type paramsUserPullMsgBySeqList struct {
ReqIdentifier int `json:"reqIdentifier" binding:"required"` ReqIdentifier int `json:"reqIdentifier" binding:"required"`
SendID string `json:"sendID" binding:"required"` SendID string `json:"sendID" binding:"required"`
@ -78,6 +91,18 @@ type paramsUserPullMsgBySeqList struct {
SeqList []int64 `json:"seqList"` SeqList []int64 `json:"seqList"`
} }
// @Summary
// @Schemes
// @Description user pull msg by seq
// @Tags chat
// @Accept json
// @Produce json
// @Param body body apiChat.paramsUserPullMsgBySeqList true "pull msg by seq"
// @Param token header string true "token"
// @Success 200 {object} user.result{reqIdentifier=int}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /chat/pull_msg_by_seq [post]
func UserPullMsgBySeqList(c *gin.Context) { func UserPullMsgBySeqList(c *gin.Context) {
params := paramsUserPullMsgBySeqList{} params := paramsUserPullMsgBySeqList{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
@ -95,11 +120,12 @@ func UserPullMsgBySeqList(c *gin.Context) {
pbData.OperationID = params.OperationID pbData.OperationID = params.OperationID
pbData.SeqList = params.SeqList pbData.SeqList = params.SeqList
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetOfflineMessageConn()
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData) reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
if err != nil { if err != nil {
log.ErrorByKv("PullMessageBySeqList error", pbData.OperationID, "err", err.Error()) log.ErrorByKv("PullMessageBySeqList error", pbData.OperationID, "err", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return return
} }
log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),

@ -1,18 +1,18 @@
package apiChat package apiChat
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
pbChat "Open_IM/pkg/proto/chat" pbChat "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsUserSendMsg struct
type paramsUserSendMsg struct { type paramsUserSendMsg struct {
ReqIdentifier int32 `json:"reqIdentifier" binding:"required"` ReqIdentifier int32 `json:"reqIdentifier" binding:"required"`
PlatformID int32 `json:"platformID" binding:"required"` PlatformID int32 `json:"platformID" binding:"required"`
@ -57,6 +57,24 @@ func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSend
return &pbData return &pbData
} }
// resultSendMsg struct
type resultSendMsg struct {
ClientMsgID string `json:"clientMsgID"`
ServerMsgID string `json:"serverMsgID"`
SendTime int64 `json:"sendTime"`
}
// @Summary
// @Schemes
// @Description user send messages
// @Tags chat
// @Accept json
// @Produce json
// @Param body body apiChat.paramsUserSendMsg true "user send messages"
// @Param token header string true "token"
// @Success 200 {object} user.result{reqIdentifier=int,data=resultSendMsg}
// @Failure 400 {object} user.result
// @Router /chat/send_msg [post]
func UserSendMsg(c *gin.Context) { func UserSendMsg(c *gin.Context) {
params := paramsUserSendMsg{} params := paramsUserSendMsg{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
@ -72,7 +90,7 @@ func UserSendMsg(c *gin.Context) {
pbData := newUserSendMsgReq(token, &params) pbData := newUserSendMsgReq(token, &params)
log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String()) log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetOfflineMessageConn()
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
log.Info("", "", "api UserSendMsg call, api call rpc...") log.Info("", "", "api UserSendMsg call, api call rpc...")

@ -1,26 +1,31 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
)
/* "github.com/gin-gonic/gin"
type paramsAddBlackList struct { )
OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"`
}*/
// @Summary
// @Schemes
// @Description add a user into black list
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSearchFriend true "add black list params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/add_blacklist [post]
func AddBlacklist(c *gin.Context) { func AddBlacklist(c *gin.Context) {
log.Info("", "", "api add blacklist init ....") log.Info("", "", "api add blacklist init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,33 +1,52 @@
package friend package friend
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend" pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsImportFriendReq struct
type paramsImportFriendReq struct { type paramsImportFriendReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UIDList []string `json:"uidList" binding:"required"` UIDList []string `json:"uidList" binding:"required"`
OwnerUid string `json:"ownerUid" binding:"required"` OwnerUid string `json:"ownerUid" binding:"required"`
} }
// resultImportFriend struct
type resultImportFriend struct {
ErrCode int `json:"errCode" example:"0"`
ErrMsg string `json:"errMsg" example:"error"`
FailedUidList []string `json:"failedUidList" example: []`
}
// paramsAddFriend struct
type paramsAddFriend struct { type paramsAddFriend struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UID string `json:"uid" binding:"required"`
ReqMessage string `json:"reqMessage"` ReqMessage string `json:"reqMessage"`
} }
// // @Summary
// @Schemes
// @Description import friend
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsImportFriendReq true "import friend params"
// @Param token header string true "token"
// @Success 200 {object} friend.resultImportFriend
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/import_friend [post]
func ImportFriend(c *gin.Context) { func ImportFriend(c *gin.Context) {
log.Info("", "", "ImportFriend init ....") log.Info("", "", "ImportFriend init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
params := paramsImportFriendReq{} params := paramsImportFriendReq{}
@ -53,10 +72,22 @@ func ImportFriend(c *gin.Context) {
log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
} }
// @Summary
// @Schemes
// @Description add a new friend by uid
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsAddFriend true "add friend params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/add_friend [post]
func AddFriend(c *gin.Context) { func AddFriend(c *gin.Context) {
log.Info("", "", "api add friend init ....") log.Info("", "", "api add friend init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
params := paramsAddFriend{} params := paramsAddFriend{}

@ -1,27 +1,39 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsAddFriendResponse struct
type paramsAddFriendResponse struct { type paramsAddFriendResponse struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UID string `json:"uid" binding:"required"`
Flag int32 `json:"flag" binding:"required"` Flag int32 `json:"flag" binding:"required"`
} }
// @Summary
// @Schemes
// @Description the response of adding friend
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsAddFriendResponse true "response of adding friend"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/add_friend_response [post]
func AddFriendResponse(c *gin.Context) { func AddFriendResponse(c *gin.Context) {
log.Info("", "", fmt.Sprintf("api add friend response init ....")) log.Info("", "", fmt.Sprintf("api add friend response init ...."))
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,26 +1,38 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsDeleteFriend struct
type paramsDeleteFriend struct { type paramsDeleteFriend struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UID string `json:"uid" binding:"required"`
} }
// @Summary
// @Schemes
// @Description delete friend
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSearchFriend true "delete friend params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/delete_friend [post]
func DeleteFriend(c *gin.Context) { func DeleteFriend(c *gin.Context) {
log.Info("", "", fmt.Sprintf("api delete_friend init ....")) log.Info("", "", fmt.Sprintf("api delete_friend init ...."))
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,21 +1,22 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsGetBlackList struct
type paramsGetBlackList struct { type paramsGetBlackList struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// blackListUserInfo struct
type blackListUserInfo struct { type blackListUserInfo struct {
UID string `json:"uid"` UID string `json:"uid"`
Name string `json:"name"` Name string `json:"name"`
@ -27,10 +28,22 @@ type blackListUserInfo struct {
Ex string `json:"ex"` Ex string `json:"ex"`
} }
// @Summary
// @Schemes
// @Description get black list
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSearchFriend true "get black list"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=[]friend.blackListUserInfo}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/get_blacklist [post]
func GetBlacklist(c *gin.Context) { func GetBlacklist(c *gin.Context) {
log.Info("", "", "api get blacklist init ....") log.Info("", "", "api get blacklist init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,19 +1,21 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsGetApplyList struct
type paramsGetApplyList struct { type paramsGetApplyList struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// UserInfo struct
type UserInfo struct { type UserInfo struct {
UID string `json:"uid"` UID string `json:"uid"`
Name string `json:"name"` Name string `json:"name"`
@ -28,10 +30,22 @@ type UserInfo struct {
Flag int32 `json:"flag"` Flag int32 `json:"flag"`
} }
// @Summary
// @Schemes
// @Description get friend apply list
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsGetApplyList true "get friend apply list"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=[]friend.UserInfo}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/get_friend_apply_list [post]
func GetFriendApplyList(c *gin.Context) { func GetFriendApplyList(c *gin.Context) {
log.Info("", "", "api get_friend_apply_list init ....") log.Info("", "", "api get_friend_apply_list init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()
@ -78,10 +92,22 @@ func GetFriendApplyList(c *gin.Context) {
log.InfoByArgs("api get friend apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String()) log.InfoByArgs("api get friend apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String())
} }
// @Summary
// @Schemes
// @Description get self friend apply list
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsGetApplyList true "get self friend apply list"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=[]friend.UserInfo}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/get_self_apply_list [post]
func GetSelfApplyList(c *gin.Context) { func GetSelfApplyList(c *gin.Context) {
log.Info("", "", "api get self friend apply list init ....") log.Info("", "", "api get self friend apply list init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,21 +1,22 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsGetFriendLIst struct
type paramsGetFriendLIst struct { type paramsGetFriendLIst struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// friendInfo struct
type friendInfo struct { type friendInfo struct {
UID string `json:"uid"` UID string `json:"uid"`
Name string `json:"name"` Name string `json:"name"`
@ -29,10 +30,22 @@ type friendInfo struct {
IsInBlackList int32 `json:"isInBlackList"` IsInBlackList int32 `json:"isInBlackList"`
} }
// @Summary
// @Schemes
// @Description get friend apply list
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsGetFriendLIst true "get friend apply list"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=[]friend.friendInfo}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/get_friend_list [post]
func GetFriendList(c *gin.Context) { func GetFriendList(c *gin.Context) {
log.Info("", "", fmt.Sprintf("api get_friendlist init ....")) log.Info("", "", fmt.Sprintf("api get_friendlist init ...."))
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,26 +1,50 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsSearchFriend struct
type paramsSearchFriend struct { type paramsSearchFriend struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UID string `json:"uid" binding:"required"`
OwnerUid string `json:"ownerUid"` OwnerUid string `json:"ownerUid"`
} }
// resultFriendInfo struct
type resultFriendInfo struct {
UID string `json:"uid"`
Name string `json:"name"`
Icon string `json:"icon"`
Gender int32 `json:"gender"`
Mobile string `json:"mobile"`
Birth string `json:"birth"`
Email string `json:"email"`
Ex string `json:"ex"`
Comment string `json:"comment"`
}
// @Summary
// @Schemes
// @Description get friend info
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSearchFriend true "search friend params"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=friend.resultFriendInfo}
// @Failure 200 {object} user.result
// @Router /friend/get_friends_info [post]
func GetFriendsInfo(c *gin.Context) { func GetFriendsInfo(c *gin.Context) {
log.Info("", "", fmt.Sprintf("api search friend init ....")) log.Info("", "", fmt.Sprintf("api search friend init ...."))
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,25 +1,37 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsIsFriend struct
type paramsIsFriend struct { type paramsIsFriend struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
ReceiveUid string `json:"receive_uid"` ReceiveUid string `json:"receive_uid"`
} }
// @Summary
// @Schemes
// @Description check is friend
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSearchFriend true "is friend params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/is_friend [post]
func IsFriend(c *gin.Context) { func IsFriend(c *gin.Context) {
log.Info("", "", "api is friend init....") log.Info("", "", "api is friend init....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,25 +1,37 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsRemoveBlackList struct
type paramsRemoveBlackList struct { type paramsRemoveBlackList struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UID string `json:"uid" binding:"required"`
} }
// @Summary
// @Schemes
// @Description remove black list
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSearchFriend true "remove black list params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/remove_blacklist [post]
func RemoveBlacklist(c *gin.Context) { func RemoveBlacklist(c *gin.Context) {
log.Info("", "", "api remove_blacklist init ....") log.Info("", "", "api remove_blacklist init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,26 +1,38 @@
package friend package friend
import ( import (
pbFriend "Open_IM/pkg/proto/friend"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbFriend "Open_IM/pkg/proto/friend"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsSetFriendComment struct
type paramsSetFriendComment struct { type paramsSetFriendComment struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UID string `json:"uid" binding:"required"`
Comment string `json:"comment"` Comment string `json:"comment"`
} }
// @Summary
// @Schemes
// @Description set friend comment
// @Tags friend
// @Accept json
// @Produce json
// @Param body body friend.paramsSetFriendComment true "set friend comment"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /friend/set_friend_comment [post]
func SetFriendComment(c *gin.Context) { func SetFriendComment(c *gin.Context) {
log.Info("", "", "api set friend comment init ....") log.Info("", "", "api set friend comment init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,16 +1,28 @@
package group package group
import ( import (
pb "Open_IM/pkg/proto/group"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pb "Open_IM/pkg/proto/group"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsCreateGroup struct
type paramsCreateGroup struct {
MemberList struct {
Uid string `json:"uid"`
SetRole string `json:"setRole,omitempty"`
} `json:"memberList"`
GroupName string `json:"groupName"`
Introduction string `json:"introduction"`
Notification string `json:"notification"`
FaceUrl string `json:"faceUrl"`
OperationID string `json:"operationID" binding:"required"`
Ex string `json:"ex"`
}
type paramsCreateGroupStruct struct { type paramsCreateGroupStruct struct {
MemberList []*pb.GroupAddMemberInfo `json:"memberList"` MemberList []*pb.GroupAddMemberInfo `json:"memberList"`
GroupName string `json:"groupName"` GroupName string `json:"groupName"`
@ -21,10 +33,22 @@ type paramsCreateGroupStruct struct {
Ex string `json:"ex"` Ex string `json:"ex"`
} }
// @Summary
// @Schemes
// @Description create group
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsCreateGroup true "create group params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/create_group [post]
func CreateGroup(c *gin.Context) { func CreateGroup(c *gin.Context) {
log.Info("", "", "api create group init ....") log.Info("", "", "api create group init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,17 +1,17 @@
package group package group
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
"Open_IM/pkg/proto/group" "Open_IM/pkg/proto/group"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsGroupApplicationList struct
type paramsGroupApplicationList struct { type paramsGroupApplicationList struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
@ -23,6 +23,7 @@ func newUserRegisterReq(params *paramsGroupApplicationList) *group.GetGroupAppli
return &pbData return &pbData
} }
// paramsGroupApplicationListRet struct
type paramsGroupApplicationListRet struct { type paramsGroupApplicationListRet struct {
ID string `json:"id"` ID string `json:"id"`
GroupID string `json:"groupID"` GroupID string `json:"groupID"`
@ -42,9 +43,27 @@ type paramsGroupApplicationListRet struct {
HandleResult int32 `json:"handleResult"` HandleResult int32 `json:"handleResult"`
} }
// resultGroupApplication struct
type resultGroupApplication struct {
Count int `json:"count"`
User []paramsGroupApplicationListRet `json:"user"`
}
// @Summary
// @Schemes
// @Description get group application list
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsGroupApplicationList true "get group application list params"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=group.resultGroupApplication}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/get_group_applicationList [post]
func GetGroupApplicationList(c *gin.Context) { func GetGroupApplicationList(c *gin.Context) {
log.Info("", "", "api GetGroupApplicationList init ....") log.Info("", "", "api GetGroupApplicationList init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := group.NewGroupClient(etcdConn) client := group.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,14 +1,13 @@
package group package group
import ( import (
pb "Open_IM/pkg/proto/group"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pb "Open_IM/pkg/proto/group"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
type paramsGetGroupInfo struct { type paramsGetGroupInfo struct {
@ -16,10 +15,22 @@ type paramsGetGroupInfo struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// @Summary
// @Schemes
// @Description get groups info
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsGetGroupInfo true "get groups info params"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=[]group.GroupInfo}
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/get_groups_info [post]
func GetGroupsInfo(c *gin.Context) { func GetGroupsInfo(c *gin.Context) {
log.Info("", "", "api get groups info init ....") log.Info("", "", "api get groups info init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,17 +1,19 @@
package group package group
import ( import (
pb "Open_IM/pkg/proto/group"
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pb "Open_IM/pkg/proto/group"
"context" "context"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings" "strings"
"github.com/gin-gonic/gin"
) )
// InviteUserToGroupReq struct
type InviteUserToGroupReq struct { type InviteUserToGroupReq struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
UidList []string `json:"uidList" binding:"required"` UidList []string `json:"uidList" binding:"required"`
@ -19,10 +21,25 @@ type InviteUserToGroupReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// GetJoinedGroupListReq struct
type GetJoinedGroupListReq struct { type GetJoinedGroupListReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// paramsKickGroupMember struct
type paramsKickGroupMember struct {
GroupID string `json:"groupID"`
UidListInfo []struct {
UserId string `json:"userId,omitempty"`
Role int32 `json:"role,omitempty"`
JoinTime uint64 `json:"joinTime,omitempty"`
NickName string `json:"nickName,omitempty"`
FaceUrl string `json:"faceUrl,omitempty"`
} `json:"uidListInfo" binding:"required"`
Reason string `json:"reason"`
OperationID string `json:"operationID" binding:"required"`
}
type KickGroupMemberReq struct { type KickGroupMemberReq struct {
GroupID string `json:"groupID"` GroupID string `json:"groupID"`
UidListInfo []*pb.GroupMemberFullInfo `json:"uidListInfo" binding:"required"` UidListInfo []*pb.GroupMemberFullInfo `json:"uidListInfo" binding:"required"`
@ -30,10 +47,22 @@ type KickGroupMemberReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// @Summary
// @Schemes
// @Description kick member from group
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsKickGroupMember true "kick member from group params"
// @Param token header string true "token"
// @Success 200 {object} group.KickGroupMemberResp
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/kick_group [post]
func KickGroupMember(c *gin.Context) { func KickGroupMember(c *gin.Context) {
log.Info("", "", "KickGroupMember start....") log.Info("", "", "KickGroupMember start....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
params := KickGroupMemberReq{} params := KickGroupMemberReq{}
@ -58,6 +87,7 @@ func KickGroupMember(c *gin.Context) {
return return
} }
// KickGroupMemberResp struct
type KickGroupMemberResp struct { type KickGroupMemberResp struct {
ErrorCode int32 `json:"errCode"` ErrorCode int32 `json:"errCode"`
ErrorMsg string `json:"errMsg"` ErrorMsg string `json:"errMsg"`
@ -75,21 +105,36 @@ func KickGroupMember(c *gin.Context) {
c.JSON(http.StatusOK, memberListResp) c.JSON(http.StatusOK, memberListResp)
} }
// GetGroupMembersInfoReq struct
type GetGroupMembersInfoReq struct { type GetGroupMembersInfoReq struct {
GroupID string `json:"groupID"` GroupID string `json:"groupID"`
MemberList []string `json:"memberList"` MemberList []string `json:"memberList"`
OperationID string `json:"operationID"` OperationID string `json:"operationID"`
} }
// GetGroupMembersInfoResp struct
type GetGroupMembersInfoResp struct { type GetGroupMembersInfoResp struct {
ErrorCode int32 `json:"errCode"` ErrorCode int32 `json:"errCode"`
ErrorMsg string `json:"errMsg"` ErrorMsg string `json:"errMsg"`
Data []MemberResult `json:"data"` Data []MemberResult `json:"data"`
} }
// @Summary
// @Schemes
// @Description get group members info
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.GetGroupMembersInfoReq true "get group members info params"
// @Param token header string true "token"
// @Success 200 {object} group.GetGroupMembersInfoResp
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/get_group_members_info [post]
func GetGroupMembersInfo(c *gin.Context) { func GetGroupMembersInfo(c *gin.Context) {
log.Info("", "", "GetGroupMembersInfo start....") log.Info("", "", "GetGroupMembersInfo start....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
params := GetGroupMembersInfoReq{} params := GetGroupMembersInfoReq{}
@ -128,17 +173,21 @@ func GetGroupMembersInfo(c *gin.Context) {
c.JSON(http.StatusOK, memberListResp) c.JSON(http.StatusOK, memberListResp)
} }
// GetGroupMemberListReq struct
type GetGroupMemberListReq struct { type GetGroupMemberListReq struct {
GroupID string `json:"groupID"` GroupID string `json:"groupID"`
Filter int32 `json:"filter"` Filter int32 `json:"filter"`
NextSeq int32 `json:"nextSeq"` NextSeq int32 `json:"nextSeq,omitempty"`
OperationID string `json:"operationID"` OperationID string `json:"operationID"`
} }
// getGroupAllMemberReq struct
type getGroupAllMemberReq struct { type getGroupAllMemberReq struct {
GroupID string `json:"groupID"` GroupID string `json:"groupID"`
OperationID string `json:"operationID"` OperationID string `json:"operationID"`
} }
// MemberResult struct
type MemberResult struct { type MemberResult struct {
GroupId string `json:"groupID"` GroupId string `json:"groupID"`
UserId string `json:"userId"` UserId string `json:"userId"`
@ -148,10 +197,22 @@ type MemberResult struct {
FaceUrl string `json:"faceUrl"` FaceUrl string `json:"faceUrl"`
} }
// @Summary
// @Schemes
// @Description get group member list
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.GetGroupMemberListReq true "get group member list params"
// @Param token header string true "token"
// @Success 200 {object} group.GetGroupMemberListResp
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/get_group_member_list [post]
func GetGroupMemberList(c *gin.Context) { func GetGroupMemberList(c *gin.Context) {
log.Info("", "", "GetGroupMemberList start....") log.Info("", "", "GetGroupMemberList start....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
params := GetGroupMemberListReq{} params := GetGroupMemberListReq{}
@ -174,6 +235,7 @@ func GetGroupMemberList(c *gin.Context) {
return return
} }
// GetGroupMemberListResp struct
type GetGroupMemberListResp struct { type GetGroupMemberListResp struct {
ErrorCode int32 `json:"errCode"` ErrorCode int32 `json:"errCode"`
ErrorMsg string `json:"errMsg"` ErrorMsg string `json:"errMsg"`
@ -198,10 +260,22 @@ func GetGroupMemberList(c *gin.Context) {
} }
// @Summary
// @Schemes
// @Description get group all members
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.getGroupAllMemberReq true "get group all members params"
// @Param token header string true "token"
// @Success 200 {object} group.GetGroupMemberListResp
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/get_group_all_member_list [post]
func GetGroupAllMember(c *gin.Context) { func GetGroupAllMember(c *gin.Context) {
log.Info("", "", "GetGroupAllMember start....") log.Info("", "", "GetGroupAllMember start....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
params := getGroupAllMemberReq{} params := getGroupAllMemberReq{}
@ -222,6 +296,7 @@ func GetGroupAllMember(c *gin.Context) {
return return
} }
// GetGroupMemberListResp struct
type GetGroupMemberListResp struct { type GetGroupMemberListResp struct {
ErrorCode int32 `json:"errCode"` ErrorCode int32 `json:"errCode"`
ErrorMsg string `json:"errMsg"` ErrorMsg string `json:"errMsg"`
@ -243,6 +318,7 @@ func GetGroupAllMember(c *gin.Context) {
c.JSON(http.StatusOK, memberListResp) c.JSON(http.StatusOK, memberListResp)
} }
// groupResult struct
type groupResult struct { type groupResult struct {
GroupId string `json:"groupId"` GroupId string `json:"groupId"`
GroupName string `json:"groupName"` GroupName string `json:"groupName"`
@ -254,10 +330,22 @@ type groupResult struct {
MemberCount uint32 `json:"memberCount"` MemberCount uint32 `json:"memberCount"`
} }
// @Summary
// @Schemes
// @Description get joined group list
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.GetJoinedGroupListReq true "get joined group list params"
// @Param token header string true "token"
// @Success 200 {object} group.GetJoinedGroupListResp
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/get_joined_group_list [post]
func GetJoinedGroupList(c *gin.Context) { func GetJoinedGroupList(c *gin.Context) {
log.Info("", "", "GetJoinedGroupList start....") log.Info("", "", "GetJoinedGroupList start....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
fmt.Println("config: ", etcdConn, config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) fmt.Println("config: ", etcdConn, config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
@ -280,6 +368,7 @@ func GetJoinedGroupList(c *gin.Context) {
} }
log.Info(req.Token, req.OperationID, "GetJoinedGroupList: ", RpcResp) log.Info(req.Token, req.OperationID, "GetJoinedGroupList: ", RpcResp)
// GetJoinedGroupListResp struct
type GetJoinedGroupListResp struct { type GetJoinedGroupListResp struct {
ErrorCode int32 `json:"errCode"` ErrorCode int32 `json:"errCode"`
ErrorMsg string `json:"errMsg"` ErrorMsg string `json:"errMsg"`
@ -302,14 +391,27 @@ func GetJoinedGroupList(c *gin.Context) {
c.JSON(http.StatusOK, GroupListResp) c.JSON(http.StatusOK, GroupListResp)
} }
// Id2Result struct
type Id2Result struct { type Id2Result struct {
UId string `json:"uid"` UId string `json:"uid"`
Result int32 `json:"result"` Result int32 `json:"result"`
} }
// @Summary
// @Schemes
// @Description invite user to group
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.InviteUserToGroupReq true "invite user to group params"
// @Param token header string true "token"
// @Success 200 {object} group.InviteUserToGroupResp
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/invite_user_to_group [post]
func InviteUserToGroup(c *gin.Context) { func InviteUserToGroup(c *gin.Context) {
log.Info("", "", "InviteUserToGroup start....") log.Info("", "", "InviteUserToGroup start....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
params := InviteUserToGroupReq{} params := InviteUserToGroupReq{}
@ -333,6 +435,7 @@ func InviteUserToGroup(c *gin.Context) {
return return
} }
// InviteUserToGroupResp struct
type InviteUserToGroupResp struct { type InviteUserToGroupResp struct {
ErrorCode int32 `json:"errCode"` ErrorCode int32 `json:"errCode"`
ErrorMsg string `json:"errMsg"` ErrorMsg string `json:"errMsg"`

@ -1,17 +1,17 @@
package group package group
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
"Open_IM/pkg/proto/group" "Open_IM/pkg/proto/group"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsGroupApplicationResponse struct
type paramsGroupApplicationResponse struct { type paramsGroupApplicationResponse struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
@ -49,9 +49,21 @@ func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group.
return &pbData return &pbData
} }
// @Summary
// @Schemes
// @Description response of application group
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsGroupApplicationResponse true "application group param"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/group_application_response [post]
func ApplicationGroupResponse(c *gin.Context) { func ApplicationGroupResponse(c *gin.Context) {
log.Info("", "", "api GroupApplicationResponse init ....") log.Info("", "", "api GroupApplicationResponse init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := group.NewGroupClient(etcdConn) client := group.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,26 +1,38 @@
package group package group
import ( import (
pb "Open_IM/pkg/proto/group"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pb "Open_IM/pkg/proto/group"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsJoinGroup struct
type paramsJoinGroup struct { type paramsJoinGroup struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
Message string `json:"message"` Message string `json:"message"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// @Summary
// @Schemes
// @Description join group
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsJoinGroup true "join group params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/set_group_info [post]
func JoinGroup(c *gin.Context) { func JoinGroup(c *gin.Context) {
log.Info("", "", "api join group init....") log.Info("", "", "api join group init....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,25 +1,37 @@
package group package group
import ( import (
pb "Open_IM/pkg/proto/group"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pb "Open_IM/pkg/proto/group"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsQuitGroup struct
type paramsQuitGroup struct { type paramsQuitGroup struct {
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// @Summary
// @Schemes
// @Description quit group
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsQuitGroup true "quit group"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/set_group_info [post]
func QuitGroup(c *gin.Context) { func QuitGroup(c *gin.Context) {
log.Info("", "", "api quit group init ....") log.Info("", "", "api quit group init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,16 +1,16 @@
package group package group
import ( import (
pb "Open_IM/pkg/proto/group"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pb "Open_IM/pkg/proto/group"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsSetGroupInfo struct
type paramsSetGroupInfo struct { type paramsSetGroupInfo struct {
GroupID string `json:"groupId" binding:"required"` GroupID string `json:"groupId" binding:"required"`
GroupName string `json:"groupName"` GroupName string `json:"groupName"`
@ -20,10 +20,22 @@ type paramsSetGroupInfo struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// @Summary
// @Schemes
// @Description set group info
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsSetGroupInfo true "set group info params"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/set_group_info [post]
func SetGroupInfo(c *gin.Context) { func SetGroupInfo(c *gin.Context) {
log.Info("", "", "api set group info init...") log.Info("", "", "api set group info init...")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pb.NewGroupClient(etcdConn) client := pb.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -1,17 +1,17 @@
package group package group
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
"Open_IM/pkg/proto/group" "Open_IM/pkg/proto/group"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsTransferGroupOwner struct
type paramsTransferGroupOwner struct { type paramsTransferGroupOwner struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
GroupID string `json:"groupID" binding:"required"` GroupID string `json:"groupID" binding:"required"`
@ -27,9 +27,21 @@ func newTransferGroupOwnerReq(params *paramsTransferGroupOwner) *group.TransferG
return &pbData return &pbData
} }
// @Summary
// @Schemes
// @Description transfer group owner
// @Tags group
// @Accept json
// @Produce json
// @Param body body group.paramsTransferGroupOwner true "transfer group owner param"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /group/transfer_group [post]
func TransferGroupOwner(c *gin.Context) { func TransferGroupOwner(c *gin.Context) {
log.Info("", "", "api TransferGroupOwner init ....") log.Info("", "", "api TransferGroupOwner init ....")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := group.NewGroupClient(etcdConn) client := group.NewGroupClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -14,15 +14,16 @@ import (
pbChat "Open_IM/pkg/proto/chat" pbChat "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"net/http"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
"net/http"
"strings"
) )
var validate *validator.Validate var validate *validator.Validate
// paramsManagementSendMsg struct
type paramsManagementSendMsg struct { type paramsManagementSendMsg struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
SendID string `json:"sendID" binding:"required"` SendID string `json:"sendID" binding:"required"`
@ -35,6 +36,14 @@ type paramsManagementSendMsg struct {
SessionType int32 `json:"sessionType" binding:"required"` SessionType int32 `json:"sessionType" binding:"required"`
} }
// sendMsgResult struct
type sendMsgResult struct {
ErrCode int `json:"errCode" example:"0"`
ErrMsg string `json:"errMsg" example:"error"`
SendTime int `json:"sendTime" example:0`
MsgID string `json:"msgID" example:""`
}
func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq { func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
var newContent string var newContent string
switch params.ContentType { switch params.ContentType {
@ -71,6 +80,19 @@ func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
func init() { func init() {
validate = validator.New() validate = validator.New()
} }
// @Summary
// @Schemes
// @Description manage send message
// @Tags manage
// @Accept json
// @Produce json
// @Param body body manage.paramsManagementSendMsg true "manage send message"
// @Param token header string true "token"
// @Success 200 {object} manage.sendMsgResult
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /manager/send_msg [post]
func ManagementSendMsg(c *gin.Context) { func ManagementSendMsg(c *gin.Context) {
var data interface{} var data interface{}
params := paramsManagementSendMsg{} params := paramsManagementSendMsg{}
@ -117,7 +139,7 @@ func ManagementSendMsg(c *gin.Context) {
pbData := newUserSendMsgReq(&params) pbData := newUserSendMsgReq(&params)
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String()) log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetOfflineMessageConn()
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
log.Info("", "", "api ManagementSendMsg call, api call rpc...") log.Info("", "", "api ManagementSendMsg call, api call rpc...")

@ -7,24 +7,52 @@
package manage package manage
import ( import (
pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbUser "Open_IM/pkg/proto/user"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// paramsDeleteUsers struct
type paramsDeleteUsers struct { type paramsDeleteUsers struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
DeleteUidList []string `json:"deleteUidList" binding:"required"` DeleteUidList []string `json:"deleteUidList" binding:"required"`
} }
// paramsGetAllUsersUid struct
type paramsGetAllUsersUid struct { type paramsGetAllUsersUid struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
// deleteUserResult struct
type deleteUserResult struct {
ErrCode int `json:"errCode" example:"0"`
ErrMsg string `json:"errMsg" example:"error"`
FailedUidList []string `json:"failedUidList" example:[]`
}
// uidListResult struct
type uidListResult struct {
ErrCode int `json:"errCode" example:"0"`
ErrMsg string `json:"errMsg" example:"error"`
UidList []string `json:"uidList" example:[]`
}
// @Summary
// @Schemes
// @Description delete user
// @Tags manage
// @Accept json
// @Produce json
// @Param body body manage.paramsDeleteUsers true "user to be deleted"
// @Param token header string true "token"
// @Success 200 {object} manage.deleteUserResult
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /manager/delete_user [post]
func DeleteUser(c *gin.Context) { func DeleteUser(c *gin.Context) {
params := paramsDeleteUsers{} params := paramsDeleteUsers{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
@ -32,7 +60,7 @@ func DeleteUser(c *gin.Context) {
return return
} }
log.InfoByKv("DeleteUser req come here", params.OperationID, "DeleteUidList", params.DeleteUidList) log.InfoByKv("DeleteUser req come here", params.OperationID, "DeleteUidList", params.DeleteUidList)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetUserConn()
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()
@ -51,6 +79,18 @@ func DeleteUser(c *gin.Context) {
resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList} resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList}
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
} }
// @Summary
// @Schemes
// @Description get all user ids
// @Tags manage
// @Accept json
// @Produce json
// @Param body body manage.paramsGetAllUsersUid true "all user ids"
// @Param token header string true "token"
// @Success 200 {object} manage.uidListResult
// @Failure 500 {object} manage.uidListResult
// @Router /manager/get_all_users_uid [post]
func GetAllUsersUid(c *gin.Context) { func GetAllUsersUid(c *gin.Context) {
params := paramsGetAllUsersUid{} params := paramsGetAllUsersUid{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
@ -58,7 +98,7 @@ func GetAllUsersUid(c *gin.Context) {
return return
} }
log.InfoByKv("GetAllUsersUid req come here", params.OperationID) log.InfoByKv("GetAllUsersUid req come here", params.OperationID)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetUserConn()
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()

@ -3,20 +3,43 @@ package apiThird
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
log2 "Open_IM/pkg/common/log" log2 "Open_IM/pkg/common/log"
"github.com/gin-gonic/gin"
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
"net/http" "net/http"
"time" "time"
"github.com/gin-gonic/gin"
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
) )
// paramsTencentCloudStorageCredential struct
type paramsTencentCloudStorageCredential struct { type paramsTencentCloudStorageCredential struct {
Token string `json:"token"` Token string `json:"token"`
OperationID string `json:"operationID"` OperationID string `json:"operationID"`
} }
// resultTencentCredential struct
type resultTencentCredential struct {
ErrCode int `json:"errCode`
ErrMsg string `json:"errMsg"`
Region string `json:"region"`
Bucket string `json:"bucket"`
Data interface{} `json:"data"`
}
var lastTime int64 var lastTime int64
var lastRes *sts.CredentialResult var lastRes *sts.CredentialResult
// @Summary
// @Schemes
// @Description get Tencent cloud storage credential
// @Tags third
// @Accept json
// @Produce json
// @Param body body apiThird.paramsTencentCloudStorageCredential true "get Tencent cloud storage credential params"
// @Param token header string true "token"
// @Success 200 {object} apiThird.resultTencentCredential
// @Failure 400 {object} user.result
// @Failure 500 {object} user.result
// @Router /third/user_register [post]
func TencentCloudStorageCredential(c *gin.Context) { func TencentCloudStorageCredential(c *gin.Context) {
params := paramsTencentCloudStorageCredential{} params := paramsTencentCloudStorageCredential{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {

@ -1,16 +1,23 @@
package user package user
import ( import (
pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbUser "Open_IM/pkg/proto/user"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
// result struct
type result struct {
ErrCode int `json:"errCode" example:"0"`
ErrMsg string `json:"errMsg" example:"error"`
Data interface{} `json:"data,omitempty"`
}
// userInfo struct
type userInfo struct { type userInfo struct {
UID string `json:"uid"` UID string `json:"uid"`
Name string `json:"name"` Name string `json:"name"`
@ -22,14 +29,30 @@ type userInfo struct {
Ex string `json:"ex"` Ex string `json:"ex"`
} }
// queryUserInfoParam struct
type queryUserInfoParam struct {
OperationID string `json:"operationID" binding:"required"`
UIDList []string `json:"uidList"`
}
// @Summary
// @Description get user info by uid list
// @Tags user
// @Accept json
// @Produce json
// @Param body body user.queryUserInfoParam true "get userInfo by uidList"
// @Param token header string true "token"
// @Success 200 {object} user.result{data=[]user.userInfo}
// @Failure 400 {object} user.result
// @Router /user/get_user_info [post]
func GetUserInfo(c *gin.Context) { func GetUserInfo(c *gin.Context) {
log.InfoByKv("api get userinfo init...", "") log.InfoByKv("api get userinfo init...", "")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetUserConn()
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()
params := paramsStruct{} params := queryUserInfoParam{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return return
@ -44,8 +67,8 @@ func GetUserInfo(c *gin.Context) {
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err) log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err)
c.JSON(http.StatusInternalServerError, gin.H{ c.JSON(http.StatusInternalServerError, gin.H{
"errorCode": 500, "errCode": 500,
"errorMsg": "call rpc server failed", "errMsg": "call rpc server failed",
}) })
return return
} }

@ -0,0 +1,31 @@
package user
import (
"bytes"
"net/http"
"net/http/httptest"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
func init() {
gin.SetMode(gin.TestMode)
}
func Test_UserRegister(t *testing.T) {
res := httptest.NewRecorder()
c, _ := gin.CreateTestContext(res)
c.Request, _ = http.NewRequest("POST", "/", bytes.NewBufferString(`{"uidList": []}`))
GetUserInfo(c)
assert.Equal(t, 400, res.Code)
res = httptest.NewRecorder()
c, _ = gin.CreateTestContext(res)
c.Request, _ = http.NewRequest("POST", "/", bytes.NewBufferString(`{"operationID": "1", "uidList": []}`))
GetUserInfo(c)
assert.Equal(t, 200, res.Code)
}

@ -1,38 +1,46 @@
package user package user
import ( import (
pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbUser "Open_IM/pkg/proto/user"
"context" "context"
"github.com/gin-gonic/gin"
"net/http" "net/http"
"strings"
"github.com/gin-gonic/gin"
) )
type paramsStruct struct { // updateUserInfoParam struct
OperationID string `json:"operationID" binding:"required"` type updateUserInfoParam struct {
UIDList []string `json:"uidList"` OperationID string `json:"operationID" binding:"required"`
Platform int32 `json:"platform"` Name string `json:"name"`
Name string `json:"name"` Icon string `json:"icon"`
Icon string `json:"icon"` Gender int32 `json:"gender"`
Gender int32 `json:"gender"` Mobile string `json:"mobile"`
Mobile string `json:"mobile"` Birth string `json:"birth"`
Birth string `json:"birth"` Email string `json:"email"`
Email string `json:"email"` Ex string `json:"ex"`
Ex string `json:"ex"` Uid string `json:"uid"`
Uid string `json:"uid"`
} }
// @Summary
// @Description update user info
// @Tags user
// @Accept json
// @Produce json
// @Param body body user.updateUserInfoParam true "new user info"
// @Param token header string true "token"
// @Success 200 {object} user.result
// @Failure 500 {object} user.result
// @Router /user/update_user_info [post]
func UpdateUserInfo(c *gin.Context) { func UpdateUserInfo(c *gin.Context) {
log.InfoByKv("api update userinfo init...", "") log.InfoByKv("api update userinfo init...", "")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetUserConn()
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
//defer etcdConn.Close() //defer etcdConn.Close()
params := paramsStruct{} params := updateUserInfoParam{}
if err := c.BindJSON(&params); err != nil { if err := c.BindJSON(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return return

@ -1,7 +1,6 @@
package gate package gate
import ( import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
@ -12,10 +11,10 @@ import (
"context" "context"
"encoding/gob" "encoding/gob"
"encoding/json" "encoding/json"
"runtime"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"runtime"
"strings"
) )
func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) { func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
@ -69,7 +68,7 @@ func (ws *WServer) getSeqReq(conn *UserConn, m *Req) {
nReply := new(pbChat.GetMaxAndMinSeqResp) nReply := new(pbChat.GetMaxAndMinSeqResp)
pbData.UserID = m.SendID pbData.UserID = m.SendID
pbData.OperationID = m.OperationID pbData.OperationID = m.OperationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetOfflineMessageConn()
if grpcConn == nil { if grpcConn == nil {
log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", m) log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", m)
} }
@ -110,7 +109,7 @@ func (ws *WServer) pullMsgReq(conn *UserConn, m *Req) {
pbData.OperationID = m.OperationID pbData.OperationID = m.OperationID
pbData.SeqBegin = data.(SeqData).SeqBegin pbData.SeqBegin = data.(SeqData).SeqBegin
pbData.SeqEnd = data.(SeqData).SeqEnd pbData.SeqEnd = data.(SeqData).SeqEnd
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetOfflineMessageConn()
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessage(context.Background(), &pbData) reply, err := msgClient.PullMessage(context.Background(), &pbData)
if err != nil { if err != nil {
@ -176,7 +175,7 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) {
pbData.SeqList = data.(open_im_sdk.PullMessageBySeqListReq).SeqList pbData.SeqList = data.(open_im_sdk.PullMessageBySeqListReq).SeqList
pbData.UserID = m.SendID pbData.UserID = m.SendID
pbData.OperationID = m.OperationID pbData.OperationID = m.OperationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetOfflineMessageConn()
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData) reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
if err != nil { if err != nil {
@ -219,7 +218,7 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) {
SendTime: sendTime, SendTime: sendTime,
} }
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data) log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetOfflineMessageConn()
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
reply, err := client.UserSendMsg(context.Background(), &pbData) reply, err := client.UserSendMsg(context.Background(), &pbData)
if err != nil { if err != nil {

@ -10,9 +10,10 @@ import (
pbPush "Open_IM/pkg/proto/push" pbPush "Open_IM/pkg/proto/push"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"strings"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"strings"
) )
type fcb func(msg []byte, msgKey string) type fcb func(msg []byte, msgKey string)
@ -138,7 +139,7 @@ func sendMessageToPush(message *pbMsg.MsgSvrToPushSvrChatMsg) {
msg.SendTime = message.SendTime msg.SendTime = message.SendTime
msg.MsgID = message.MsgID msg.MsgID = message.MsgID
msg.OfflineInfo = message.OfflineInfo msg.OfflineInfo = message.OfflineInfo
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) grpcConn := getcdv3.GetPushConn()
if grpcConn == nil { if grpcConn == nil {
log.ErrorByKv("rpc dial failed", msg.OperationID, "push data", msg.String()) log.ErrorByKv("rpc dial failed", msg.OperationID, "push data", msg.String())
pid, offset, err := producer.SendMessage(message) pid, offset, err := producer.SendMessage(message)

@ -19,7 +19,6 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"encoding/json" "encoding/json"
"strings"
) )
type OpenIMContent struct { type OpenIMContent struct {
@ -40,7 +39,7 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
//isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync") //isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync")
isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush") isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush")
log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData) log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData)
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) grpcCons := getcdv3.GetOnlineMessageConn()
//Online push message //Online push message
log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData) log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData)
for _, v := range grpcCons { for _, v := range grpcCons {
@ -120,7 +119,7 @@ func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {
sendMsgToKafka(m, m.SendID, "msgKey--sendID") sendMsgToKafka(m, m.SendID, "msgKey--sendID")
sendMsgToKafka(m, m.RecvID, "msgKey--recvID") sendMsgToKafka(m, m.RecvID, "msgKey--recvID")
case constant.GroupChatType: case constant.GroupChatType:
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
req := &pbGroup.GetGroupAllMemberReq{ req := &pbGroup.GetGroupAllMemberReq{
GroupID: m.RecvID, GroupID: m.RecvID,

@ -16,7 +16,6 @@ import (
"math/rand" "math/rand"
"net/http" "net/http"
"strconv" "strconv"
"strings"
"time" "time"
) )
@ -103,7 +102,7 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
} }
return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime) return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime)
case constant.GroupChatType: case constant.GroupChatType:
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetGroupConn()
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
req := &pbGroup.GetGroupAllMemberReq{ req := &pbGroup.GetGroupAllMemberReq{
GroupID: pbData.RecvID, GroupID: pbData.RecvID,

@ -1,15 +1,13 @@
package internal_service package internal_service
import ( import (
pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/common/config"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbUser "Open_IM/pkg/proto/user"
"context" "context"
"strings"
) )
func GetUserInfoClient(req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) { func GetUserInfoClient(req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) {
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetUserConn()
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
RpcResp, err := client.GetUserInfo(context.Background(), req) RpcResp, err := client.GetUserInfo(context.Background(), req)
return RpcResp, err return RpcResp, err

@ -12,7 +12,6 @@ import (
pbUser "Open_IM/pkg/proto/user" pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"strings"
) )
func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.CommonResp, error) { func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.CommonResp, error) {
@ -36,7 +35,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
log.Error(req.Token, req.OperationID, "update user some attribute failed,err=%s", err.Error()) log.Error(req.Token, req.OperationID, "update user some attribute failed,err=%s", err.Error())
return &pbUser.CommonResp{ErrorCode: config.ErrModifyUserInfo.ErrCode, ErrorMsg: config.ErrModifyUserInfo.ErrMsg}, nil return &pbUser.CommonResp{ErrorCode: config.ErrModifyUserInfo.ErrCode, ErrorMsg: config.ErrModifyUserInfo.ErrMsg}, nil
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) etcdConn := getcdv3.GetFriendConn()
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
newReq := &pbFriend.GetFriendListReq{ newReq := &pbFriend.GetFriendListReq{
OperationID: req.OperationID, OperationID: req.OperationID,

@ -1,17 +1,21 @@
package getcdv3 package getcdv3
import ( import (
"Open_IM/pkg/common/config"
"context" "context"
"fmt" "fmt"
"go.etcd.io/etcd/clientv3" "go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/mvcc/mvccpb" "go.etcd.io/etcd/mvcc/mvccpb"
//"google.golang.org/genproto/googleapis/ads/googleads/v1/services" //"google.golang.org/genproto/googleapis/ads/googleads/v1/services"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/resolver"
"strings" "strings"
"sync" "sync"
"time" "time"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/resolver"
) )
type Resolver struct { type Resolver struct {
@ -88,6 +92,34 @@ func GetConn(schema, etcdaddr, serviceName string) *grpc.ClientConn {
return r.grpcClientConn return r.grpcClientConn
} }
func GetAuthConn() *grpc.ClientConn {
return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
}
func GetOfflineMessageConn() *grpc.ClientConn {
return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
}
func GetFriendConn() *grpc.ClientConn {
return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
}
func GetGroupConn() *grpc.ClientConn {
return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
}
func GetUserConn() *grpc.ClientConn {
return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
}
func GetPushConn() *grpc.ClientConn {
return GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName)
}
func GetOnlineMessageConn() []*grpc.ClientConn {
return GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
}
func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
if r.cli == nil { if r.cli == nil {
return nil, fmt.Errorf("etcd clientv3 client failed, etcd:%s", target) return nil, fmt.Errorf("etcd clientv3 client failed, etcd:%s", target)

@ -163,6 +163,7 @@ func (m *CreateGroupReq) GetEx() string {
return "" return ""
} }
// GroupAddMemberInfo struct
type GroupAddMemberInfo struct { type GroupAddMemberInfo struct {
Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"`
SetRole int32 `protobuf:"varint,2,opt,name=setRole" json:"setRole,omitempty"` SetRole int32 `protobuf:"varint,2,opt,name=setRole" json:"setRole,omitempty"`
@ -1879,6 +1880,7 @@ func (m *GetJoinedGroupListReq) GetOperationID() string {
return "" return ""
} }
// GroupInfo struct
type GroupInfo struct { type GroupInfo struct {
GroupId string `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"` GroupId string `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"`
GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"`

Loading…
Cancel
Save