mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-18 07:49:01 +08:00
Compare commits
128 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b81d60dce | |||
| 0ed9aa5372 | |||
| 2ace964573 | |||
| a8201aaa58 | |||
| 776fa2f4f6 | |||
| eabef540cf | |||
| d6ec8f4930 | |||
| aaf834a33b | |||
| 043f9bde59 | |||
| 170310e23c | |||
| 31a558cfea | |||
| adc4fec19b | |||
| 74beec2b85 | |||
| d7cd8ba780 | |||
| a69ebf4299 | |||
| 8085c62774 | |||
| 3e51e781a6 | |||
| fa028fdafd | |||
| d2ce4192cc | |||
| 822f689c48 | |||
| c6ade8d9bc | |||
| 0e99fb27b5 | |||
| 058a191e61 | |||
| ebd867a6d5 | |||
| 687933a63e | |||
| 1f40c87dd9 | |||
| 93ffbe2a79 | |||
| a090e602b3 | |||
| c9a48081fd | |||
| 5b026e13f6 | |||
| f1aab5ad3b | |||
| d7028f22e2 | |||
| 570c0cb9a1 | |||
| 053792e89d | |||
| 31212d4f4b | |||
| 19489afefc | |||
| 5dd494d9a2 | |||
| 2adbf9f686 | |||
| 9dbad9ce53 | |||
| 52498bf05e | |||
| e4e5608c8c | |||
| d629874468 | |||
| 7da98935b9 | |||
| d50a0abd2a | |||
| 33b9685985 | |||
| cd14f3e649 | |||
| 70eaa7d968 | |||
| f1b51f9c97 | |||
| 65398fb147 | |||
| a8575b4fc7 | |||
| 67ede12fd8 | |||
| e6b5819099 | |||
| 5cd1af5b48 | |||
| 6d1c70b8d3 | |||
| cda28cb2ee | |||
| aac7a0f5af | |||
| 0501cbcf4c | |||
| f08941c0bd | |||
| c1ed2f14c8 | |||
| 3ae5c9dca1 | |||
| ace6ef0029 | |||
| 140724d665 | |||
| c476c255b8 | |||
| cf069970bd | |||
| a8341ec86d | |||
| 23b965a20a | |||
| 2104ba787a | |||
| 15660663f6 | |||
| 4d3e79281d | |||
| 21ff7a36b8 | |||
| 42e2957bee | |||
| bd62da8e1a | |||
| df592d99dd | |||
| 39f5e13463 | |||
| 58785e9470 | |||
| 3495d75a6f | |||
| bee12423b0 | |||
| a705e595ee | |||
| 45f29c4c6f | |||
| 5f90851458 | |||
| 01515f919d | |||
| a2292b1177 | |||
| b2f5f56fa0 | |||
| 2be1e1a70d | |||
| b416cd380a | |||
| f18f54afc6 | |||
| b02830c891 | |||
| aff733bbd9 | |||
| 4a66911a61 | |||
| c9b3a017a4 | |||
| 6712d65de4 | |||
| c2a45cdbeb | |||
| 0f20e58a46 | |||
| 2f37767899 | |||
| f4c7272305 | |||
| 8a8e33763c | |||
| d55eda0bb3 | |||
| 6c7483733f | |||
| c7590c120d | |||
| b3dec3653a | |||
| 7cb42c49de | |||
| 32dffb0375 | |||
| c3d13c73ce | |||
| 0ea48af892 | |||
| 72b09864ce | |||
| d8e5fe367b | |||
| b1244c0a1b | |||
| 7a3b56955c | |||
| 5dcb7f2a80 | |||
| 64e71440e2 | |||
| e7e3b6dd15 | |||
| 06551575b1 | |||
| 912ec51315 | |||
| 1363c98cd8 | |||
| b9e49e37ea | |||
| 4bb64e301e | |||
| 1c9c911373 | |||
| 75a638f728 | |||
| 09fd45346e | |||
| 3329068bcc | |||
| aae6874928 | |||
| 6dacf23312 | |||
| bcc0cd33f1 | |||
| 0daa840eaa | |||
| ea5e69e26d | |||
| 26f0234e3d | |||
| 95ac2c62e8 | |||
| ace77e6fd0 |
+1
-1
Submodule cmd/Open-IM-SDK-Core updated: 610fc07d46...3699730514
+11
-9
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
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/conversation"
|
||||||
"Open_IM/internal/api/friend"
|
"Open_IM/internal/api/friend"
|
||||||
"Open_IM/internal/api/group"
|
"Open_IM/internal/api/group"
|
||||||
"Open_IM/internal/api/manage"
|
"Open_IM/internal/api/manage"
|
||||||
@@ -17,15 +18,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
//logFile, err := os.OpenFile("./fatal.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0660)
|
|
||||||
// if err != nil {
|
|
||||||
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
//syscall.Dup2(int(logFile.Fd()), int(os.Stderr.Fd()))
|
|
||||||
|
|
||||||
//log.Info("", "", "api server running...")
|
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.Use(utils.CorsHandler())
|
r.Use(utils.CorsHandler())
|
||||||
// user routing group, which handles user registration and login services
|
// user routing group, which handles user registration and login services
|
||||||
@@ -33,6 +25,7 @@ func main() {
|
|||||||
{
|
{
|
||||||
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo)
|
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo)
|
||||||
userRouterGroup.POST("/get_user_info", user.GetUserInfo)
|
userRouterGroup.POST("/get_user_info", user.GetUserInfo)
|
||||||
|
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus)
|
||||||
}
|
}
|
||||||
//friend routing group
|
//friend routing group
|
||||||
friendRouterGroup := r.Group("/friend")
|
friendRouterGroup := r.Group("/friend")
|
||||||
@@ -94,7 +87,16 @@ func main() {
|
|||||||
managementGroup.POST("/delete_user", manage.DeleteUser)
|
managementGroup.POST("/delete_user", manage.DeleteUser)
|
||||||
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
||||||
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid)
|
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid)
|
||||||
|
managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus)
|
||||||
}
|
}
|
||||||
|
//Conversation
|
||||||
|
conversationGroup := r.Group("/conversation")
|
||||||
|
{
|
||||||
|
conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt)
|
||||||
|
conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt)
|
||||||
|
conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt)
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.PHONY: all build run gotool install clean help
|
||||||
|
|
||||||
|
BINARY_NAME=open_im_demo
|
||||||
|
BIN_DIR=../../bin/
|
||||||
|
|
||||||
|
|
||||||
|
all: gotool build
|
||||||
|
|
||||||
|
build:
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||||
|
|
||||||
|
run:
|
||||||
|
@go run ./
|
||||||
|
|
||||||
|
gotool:
|
||||||
|
go fmt ./
|
||||||
|
go vet ./
|
||||||
|
|
||||||
|
install:
|
||||||
|
make build
|
||||||
|
mv ${BINARY_NAME} ${BIN_DIR}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/internal/demo/register"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"flag"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
r := gin.Default()
|
||||||
|
r.Use(utils.CorsHandler())
|
||||||
|
|
||||||
|
authRouterGroup := r.Group("/auth")
|
||||||
|
{
|
||||||
|
authRouterGroup.POST("/code", register.SendVerificationCode)
|
||||||
|
authRouterGroup.POST("/verify", register.Verify)
|
||||||
|
authRouterGroup.POST("/password", register.SetPassword)
|
||||||
|
authRouterGroup.POST("/login", register.Login)
|
||||||
|
}
|
||||||
|
log.NewPrivateLog("demo")
|
||||||
|
ginPort := flag.Int("port", 42233, "get ginServerPort from cmd,default 42233 as port")
|
||||||
|
flag.Parse()
|
||||||
|
r.Run(utils.ServerIP + ":" + strconv.Itoa(*ginPort))
|
||||||
|
}
|
||||||
@@ -42,17 +42,17 @@ func main() {
|
|||||||
for {
|
for {
|
||||||
uidList, err := im_mysql_model.SelectAllUID()
|
uidList, err := im_mysql_model.SelectAllUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError("999999", err.Error())
|
//log.NewError("999999", err.Error())
|
||||||
} else {
|
} else {
|
||||||
for _, v := range uidList {
|
for _, v := range uidList {
|
||||||
minSeq, err := commonDB.DB.GetMinSeqFromMongo(v)
|
minSeq, err := commonDB.DB.GetMinSeqFromMongo(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError("999999", "get user minSeq err", err.Error(), v)
|
//log.NewError("999999", "get user minSeq err", err.Error(), v)
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
err := commonDB.DB.SetUserMinSeq(v, minSeq)
|
err := commonDB.DB.SetUserMinSeq(v, minSeq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError("999999", "set user minSeq err", err.Error(), v)
|
//log.NewError("999999", "set user minSeq err", err.Error(), v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
time.Sleep(time.Duration(100) * time.Millisecond)
|
time.Sleep(time.Duration(100) * time.Millisecond)
|
||||||
|
|||||||
+46
-11
@@ -8,7 +8,7 @@ etcd:
|
|||||||
etcdAddr: [ 127.0.0.1:2379 ]
|
etcdAddr: [ 127.0.0.1:2379 ]
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
dbMysqlAddress: [ 127.0.0.1:3306 ]
|
dbMysqlAddress: [ 127.0.0.1:13306 ]
|
||||||
dbMysqlUserName: root
|
dbMysqlUserName: root
|
||||||
dbMysqlPassword: openIM
|
dbMysqlPassword: openIM
|
||||||
dbMysqlDatabaseName: openIM
|
dbMysqlDatabaseName: openIM
|
||||||
@@ -19,7 +19,7 @@ mysql:
|
|||||||
dbMaxLifeTime: 120
|
dbMaxLifeTime: 120
|
||||||
|
|
||||||
mongo:
|
mongo:
|
||||||
dbAddress: [ 127.0.0.1:27017 ]
|
dbAddress: [ 127.0.0.1:37017 ]
|
||||||
dbDirect: false
|
dbDirect: false
|
||||||
dbTimeout: 10
|
dbTimeout: 10
|
||||||
dbDatabase: openIM
|
dbDatabase: openIM
|
||||||
@@ -30,7 +30,7 @@ mongo:
|
|||||||
dbRetainChatRecords: 7
|
dbRetainChatRecords: 7
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
dbAddress: 127.0.0.1:6379
|
dbAddress: 127.0.0.1:16379
|
||||||
dbMaxIdle: 128
|
dbMaxIdle: 128
|
||||||
dbMaxActive: 0
|
dbMaxActive: 0
|
||||||
dbIdleTimeout: 120
|
dbIdleTimeout: 120
|
||||||
@@ -55,7 +55,7 @@ kafka:
|
|||||||
# The service ip default is empty,
|
# The service ip default is empty,
|
||||||
# automatically obtain the machine's valid network card ip as the service ip,
|
# automatically obtain the machine's valid network card ip as the service ip,
|
||||||
# otherwise the configuration ip is preferred
|
# otherwise the configuration ip is preferred
|
||||||
serverip:
|
serverip: 0.0.0.0
|
||||||
|
|
||||||
api:
|
api:
|
||||||
openImApiPort: [ 10000 ]
|
openImApiPort: [ 10000 ]
|
||||||
@@ -79,7 +79,15 @@ rpcport:
|
|||||||
openImGroupPort: [ 10500 ]
|
openImGroupPort: [ 10500 ]
|
||||||
openImAuthPort: [ 10600 ]
|
openImAuthPort: [ 10600 ]
|
||||||
openImPushPort: [ 10700 ]
|
openImPushPort: [ 10700 ]
|
||||||
|
c2c:
|
||||||
|
callbackBeforeSendMsg:
|
||||||
|
switch: false
|
||||||
|
timeoutStrategy: 1 #1:send
|
||||||
|
callbackAfterSendMsg:
|
||||||
|
switch: false
|
||||||
|
state:
|
||||||
|
stateChange:
|
||||||
|
switch: false
|
||||||
|
|
||||||
rpcregistername:
|
rpcregistername:
|
||||||
openImUserName: User
|
openImUserName: User
|
||||||
@@ -130,10 +138,7 @@ manager:
|
|||||||
|
|
||||||
secret: tuoyun
|
secret: tuoyun
|
||||||
|
|
||||||
multiloginpolicy:
|
multiloginpolicy: 1
|
||||||
onlyOneTerminalAccess: false
|
|
||||||
mobileAndPCTerminalAccessButOtherTerminalKickEachOther: true
|
|
||||||
allTerminalAccess: false
|
|
||||||
|
|
||||||
#token config
|
#token config
|
||||||
tokenpolicy:
|
tokenpolicy:
|
||||||
@@ -142,5 +147,35 @@ tokenpolicy:
|
|||||||
accessExpire: 7
|
accessExpire: 7
|
||||||
|
|
||||||
messagecallback:
|
messagecallback:
|
||||||
callbackSwitch: false
|
callbackUrl: "http://www.xxx.com/msg/judge"
|
||||||
callbackUrl: "http://www.xxx.com/msg/judge"
|
#TimeOut use second as unit
|
||||||
|
callbackTimeOut: 10
|
||||||
|
c2c:
|
||||||
|
callbackBeforeSendMsg:
|
||||||
|
switch: false
|
||||||
|
timeoutStrategy: 1 #1:send
|
||||||
|
callbackAfterSendMsg:
|
||||||
|
switch: false
|
||||||
|
state:
|
||||||
|
stateChange:
|
||||||
|
switch: false
|
||||||
|
|
||||||
|
#---------------demo configuration---------------------#
|
||||||
|
#The following configuration items are applied to openIM Demo configuration
|
||||||
|
demoswitch: true
|
||||||
|
demo:
|
||||||
|
openImDemoPort: [ 42233 ]
|
||||||
|
alismsverify:
|
||||||
|
accessKeyId: LTAI5tJPkn4HuuePdiLdGqe71
|
||||||
|
accessKeySecret: 4n9OJ7ZCVN1U6KeHDAtOyNeVZcjOuV1
|
||||||
|
signName: OpenIM Corporation
|
||||||
|
verificationCodeTemplateCode: SMS_2268101641
|
||||||
|
superCode: 666666
|
||||||
|
mail:
|
||||||
|
title: "openIM"
|
||||||
|
senderMail: "1765567899@qq.com"
|
||||||
|
senderAuthorizationCode: "1gxyausfoevlzbfag"
|
||||||
|
smtpAddr: "smtp.qq.com"
|
||||||
|
smtpPort: 25
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+17
-35
@@ -5,7 +5,8 @@ services:
|
|||||||
mysql:
|
mysql:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 13306:3306
|
||||||
|
- 23306:33060
|
||||||
container_name: mysql
|
container_name: mysql
|
||||||
volumes:
|
volumes:
|
||||||
- ./components/mysql/data:/var/lib/mysql
|
- ./components/mysql/data:/var/lib/mysql
|
||||||
@@ -17,18 +18,23 @@ services:
|
|||||||
mongodb:
|
mongodb:
|
||||||
image: mongo:4.0
|
image: mongo:4.0
|
||||||
ports:
|
ports:
|
||||||
- 27017:27017
|
- 37017:27017
|
||||||
container_name: mongo
|
container_name: mongo
|
||||||
volumes:
|
volumes:
|
||||||
- ./components/mongodb/data:/data/db
|
- ./components/mongodb/data/db:/data/db
|
||||||
environment:
|
- ./components/mongodb/data/logs:/data/logs
|
||||||
TZ: Asia/Shanghai
|
- ./components/mongodb/data/conf:/etc/mongo
|
||||||
|
# environment:
|
||||||
|
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
||||||
|
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
||||||
|
|
||||||
|
#TZ: Asia/Shanghai
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 16379:6379
|
||||||
container_name: redis
|
container_name: redis
|
||||||
volumes:
|
volumes:
|
||||||
- ./components/redis/data:/data
|
- ./components/redis/data:/data
|
||||||
@@ -82,38 +88,14 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
|
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
|
||||||
|
|
||||||
|
open_im_server:
|
||||||
#fixme-----build from dockerfile---------
|
image: openim/open_im_server
|
||||||
# open-im-server:
|
container_name: open_im_server
|
||||||
# image: open_im_server
|
|
||||||
# container_name: open-im-server
|
|
||||||
# volumes:
|
|
||||||
# - ./logs:/Open-IM-Server/logs
|
|
||||||
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
|
||||||
# restart: always
|
|
||||||
# build:
|
|
||||||
# context: .
|
|
||||||
# dockerfile: deploy.Dockerfile
|
|
||||||
# depends_on:
|
|
||||||
# - mysql
|
|
||||||
# - mongodb
|
|
||||||
# - redis
|
|
||||||
# - kafka
|
|
||||||
# - etcd
|
|
||||||
# network_mode: "host"
|
|
||||||
# logging:
|
|
||||||
# driver: json-file
|
|
||||||
# options:
|
|
||||||
# max-size: "1g"
|
|
||||||
# max-file: "2"
|
|
||||||
|
|
||||||
#fixme----build from docker hub------
|
|
||||||
open-im-server:
|
|
||||||
image: lyt1123/open_im_server
|
|
||||||
container_name: open-im-server
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/Open-IM-Server/logs
|
- ./logs:/Open-IM-Server/logs
|
||||||
- ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
- ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||||
|
- ./db/sdk:/Open-IM-Server/db/sdk
|
||||||
|
- ./script:/Open-IM-Server/script
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- kafka
|
- kafka
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 21 KiB |
@@ -5,6 +5,9 @@ go 1.15
|
|||||||
require (
|
require (
|
||||||
github.com/Shopify/sarama v1.19.0
|
github.com/Shopify/sarama v1.19.0
|
||||||
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
|
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
|
||||||
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8
|
||||||
|
github.com/alibabacloud-go/tea v1.1.17
|
||||||
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
|
||||||
@@ -41,6 +44,8 @@ require (
|
|||||||
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf
|
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect
|
||||||
google.golang.org/grpc v1.33.2
|
google.golang.org/grpc v1.33.2
|
||||||
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||||
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
|
||||||
sigs.k8s.io/yaml v1.2.0 // indirect
|
sigs.k8s.io/yaml v1.2.0 // indirect
|
||||||
|
|||||||
@@ -7,6 +7,30 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso
|
|||||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11 h1:w59gtSA0s87p0U5NNG/N/PIHsRP3rtj7qCP9hx9+GL8=
|
||||||
|
github.com/alibabacloud-go/darabonba-openapi v0.1.11/go.mod h1:MPJMxv7HYrFm5m9uOZWkDYsAWyZztEgnBRfk9Fg0eIU=
|
||||||
|
github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA=
|
||||||
|
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50=
|
||||||
|
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY=
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525 v1.1.2 h1:AiQv4HpDWV0GAXzauPB2Xdrx4cuBo18bqNzIjMJyWjk=
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8 h1:KXMiCg99Jx7B6V+DlRFbWwL9UCGippE5z1wGzhyimiA=
|
||||||
|
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8/go.mod h1:8aL6tSyQIWJygF7W/Vqxdf/QDbN2S+u57k36bEA8hD8=
|
||||||
|
github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
|
||||||
|
github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
|
||||||
|
github.com/alibabacloud-go/openapi-util v0.0.9 h1:Z0DP4LFzkM/rW2nxOMiiLoQVZSeE3jVc5jrZ9Fd/UX0=
|
||||||
|
github.com/alibabacloud-go/openapi-util v0.0.9/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.15/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.17 h1:05R5DnaJXe9sCNIe8KUgWHC/z6w/VZIwczgUwzRnul8=
|
||||||
|
github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
|
||||||
|
github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
|
||||||
|
github.com/alibabacloud-go/tea-utils v1.3.9 h1:TtbzxS+BXrisA7wzbAMRtlU8A2eWLg0ufm7m/Tl6fc4=
|
||||||
|
github.com/alibabacloud-go/tea-utils v1.3.9/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
|
||||||
|
github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY=
|
||||||
|
github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
|
||||||
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
|
||||||
github.com/antonfisher/nested-logrus-formatter v1.3.0 h1:8zixYquU1Odk+vzAaAQPAdRh1ZjmUXNQ1T+dUBvlhVo=
|
github.com/antonfisher/nested-logrus-formatter v1.3.0 h1:8zixYquU1Odk+vzAaAQPAdRh1ZjmUXNQ1T+dUBvlhVo=
|
||||||
github.com/antonfisher/nested-logrus-formatter v1.3.0/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
|
github.com/antonfisher/nested-logrus-formatter v1.3.0/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
|
||||||
@@ -108,7 +132,6 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
|
|||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
@@ -116,6 +139,9 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
|
|||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
|
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
|
||||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
|
||||||
|
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
@@ -143,17 +169,19 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
|
|||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||||
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
@@ -191,6 +219,8 @@ 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 h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
|
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=
|
||||||
@@ -227,8 +257,13 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
|
|||||||
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=
|
||||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||||
|
github.com/smartystreets/assertions v1.1.1 h1:T/YLemO5Yp7KPzS+lVtu+WsHn8yoSwTfItdAd1r3cck=
|
||||||
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||||
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak=
|
github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak=
|
||||||
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
|
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
|
||||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
@@ -237,14 +272,18 @@ github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
|
|||||||
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
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/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/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
|
||||||
|
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||||
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=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||||
@@ -255,6 +294,8 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY
|
|||||||
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/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.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
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=
|
||||||
@@ -276,6 +317,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
|
|||||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@@ -285,6 +328,7 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
|
|||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
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.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
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/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=
|
||||||
@@ -297,7 +341,9 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||||||
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-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-20200226121028-0de0cce0169b/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-20200506145744-7e3656a0809f/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-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ=
|
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ=
|
||||||
@@ -306,6 +352,8 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG
|
|||||||
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-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/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/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=
|
||||||
@@ -317,6 +365,7 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
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-20200509044756-6aff5f38e54f/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-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
|
||||||
@@ -333,10 +382,12 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm
|
|||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
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/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=
|
||||||
@@ -360,11 +411,19 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
|
|||||||
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
||||||
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
|
||||||
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 h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
|
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/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
|
||||||
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
|
||||||
|
gopkg.in/ini.v1 v1.56.0 h1:DPMeDvGTM54DXbPkVIZsp19fp/I2K7zwA/itHYHKo8Y=
|
||||||
|
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
|
||||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package apiChat
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"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"
|
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -27,8 +27,8 @@ func UserGetSeq(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.VerifyToken(token, params.SendID) {
|
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pbData := pbMsg.GetMaxAndMinSeqReq{}
|
pbData := pbMsg.GetMaxAndMinSeqReq{}
|
||||||
@@ -42,7 +42,8 @@ func UserGetSeq(c *gin.Context) {
|
|||||||
msgClient := pbMsg.NewChatClient(grpcConn)
|
msgClient := pbMsg.NewChatClient(grpcConn)
|
||||||
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.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserGetSeq rpc failed, " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package apiChat
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
"Open_IM/pkg/proto/chat"
|
"Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -30,8 +30,8 @@ func UserPullMsg(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.VerifyToken(token, params.SendID) {
|
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pbData := pbChat.PullMessageReq{}
|
pbData := pbChat.PullMessageReq{}
|
||||||
@@ -43,7 +43,8 @@ func UserPullMsg(c *gin.Context) {
|
|||||||
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 {
|
||||||
log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error())
|
log.NewError(params.OperationID, "UserPullMsg rpc failed, ", params, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserPullMsg rpc failed, " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),
|
log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(),
|
||||||
@@ -86,8 +87,8 @@ func UserPullMsgBySeqList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if !utils.VerifyToken(token, params.SendID) {
|
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pbData := pbChat.PullMessageBySeqListReq{}
|
pbData := pbChat.PullMessageBySeqListReq{}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type paramsUserSendMsg struct {
|
|||||||
RecvID string `json:"recvID" binding:"required"`
|
RecvID string `json:"recvID" binding:"required"`
|
||||||
ForceList []string `json:"forceList"`
|
ForceList []string `json:"forceList"`
|
||||||
Content string `json:"content" binding:"required"`
|
Content string `json:"content" binding:"required"`
|
||||||
Options map[string]interface{} `json:"options" `
|
Options map[string]int32 `json:"options" `
|
||||||
ClientMsgID string `json:"clientMsgID" binding:"required"`
|
ClientMsgID string `json:"clientMsgID" binding:"required"`
|
||||||
OffLineInfo map[string]interface{} `json:"offlineInfo" `
|
OffLineInfo map[string]interface{} `json:"offlineInfo" `
|
||||||
Ex map[string]interface{} `json:"ext"`
|
Ex map[string]interface{} `json:"ext"`
|
||||||
@@ -49,7 +49,7 @@ func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSend
|
|||||||
RecvID: params.Data.RecvID,
|
RecvID: params.Data.RecvID,
|
||||||
ForceList: params.Data.ForceList,
|
ForceList: params.Data.ForceList,
|
||||||
Content: params.Data.Content,
|
Content: params.Data.Content,
|
||||||
Options: utils.MapToJsonString(params.Data.Options),
|
Options: utils.MapIntToJsonString(params.Data.Options),
|
||||||
ClientMsgID: params.Data.ClientMsgID,
|
ClientMsgID: params.Data.ClientMsgID,
|
||||||
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
|
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
|
||||||
Ex: utils.MapToJsonString(params.Data.Ex),
|
Ex: utils.MapToJsonString(params.Data.Ex),
|
||||||
@@ -77,7 +77,12 @@ func UserSendMsg(c *gin.Context) {
|
|||||||
|
|
||||||
log.Info("", "", "api UserSendMsg call, api call rpc...")
|
log.Info("", "", "api UserSendMsg call, api call rpc...")
|
||||||
|
|
||||||
reply, _ := client.UserSendMsg(context.Background(), pbData)
|
reply, err := client.UserSendMsg(context.Background(), pbData)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "UserSendMsg rpc failed, ", params, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserSendMsg rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package conversation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
"Open_IM/pkg/proto/user"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsSetReceiveMessageOpt struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
Option *int32 `json:"option" binding:"required"`
|
||||||
|
ConversationIdList []string `json:"conversationIdList" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OptResult struct {
|
||||||
|
ConversationId string `json:"conversationId" binding:"required"`
|
||||||
|
Result int32 `json:"result" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetReceiveMessageOptResp struct {
|
||||||
|
ErrCode int32 `json:"errCode"`
|
||||||
|
ErrMsg string `json:"errMsg"`
|
||||||
|
Data []OptResult `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type paramGetReceiveMessageOpt struct {
|
||||||
|
ConversationIdList []string `json:"conversationIdList" binding:"required"`
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetReceiveMessageOptResp struct {
|
||||||
|
SetReceiveMessageOptResp
|
||||||
|
}
|
||||||
|
|
||||||
|
type paramGetAllConversationMessageOpt struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetAllConversationMessageOptResp struct {
|
||||||
|
SetReceiveMessageOptResp
|
||||||
|
}
|
||||||
|
|
||||||
|
//CopyStructFields
|
||||||
|
|
||||||
|
func GetAllConversationMessageOpt(c *gin.Context) {
|
||||||
|
params := paramGetAllConversationMessageOpt{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token"))
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &user.GetAllConversationMsgOptReq{
|
||||||
|
UId: claims.UID,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt req: ", req)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := user.NewUserClient(etcdConn)
|
||||||
|
resp, err := client.GetAllConversationMsgOpt(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetAllConversationMsgOpt rpc failed, ", req, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var ginResp GetAllConversationMessageOptResp
|
||||||
|
ginResp.ErrCode = resp.ErrCode
|
||||||
|
ginResp.ErrMsg = resp.ErrMsg
|
||||||
|
for _, v := range resp.ConversationOptResult {
|
||||||
|
var opt OptResult
|
||||||
|
err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result")
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "CopyStructFields failed ", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ginResp.Data = append(ginResp.Data, opt)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt resp: ", ginResp, req)
|
||||||
|
c.JSON(http.StatusOK, ginResp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetReceiveMessageOpt(c *gin.Context) {
|
||||||
|
params := paramGetReceiveMessageOpt{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token"))
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &user.GetReceiveMessageOptReq{
|
||||||
|
UId: claims.UID,
|
||||||
|
ConversationId: params.ConversationIdList,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOptReq req: ", req)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := user.NewUserClient(etcdConn)
|
||||||
|
resp, err := client.GetReceiveMessageOpt(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetReceiveMessageOpt rpc failed, ", req, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "GetReceiveMessageOpt rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOptReq req: ", req, resp)
|
||||||
|
var ginResp GetReceiveMessageOptResp
|
||||||
|
ginResp.ErrCode = resp.ErrCode
|
||||||
|
ginResp.ErrMsg = resp.ErrMsg
|
||||||
|
|
||||||
|
for _, v := range resp.ConversationOptResult {
|
||||||
|
var opt OptResult
|
||||||
|
log.NewInfo("CopyStructFields begin ", v, req.OperationID)
|
||||||
|
err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result")
|
||||||
|
log.NewInfo("CopyStructFields end ", v, req.OperationID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "CopyStructFields failed ", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ginResp.Data = append(ginResp.Data, opt)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOpt resp: ", ginResp)
|
||||||
|
c.JSON(http.StatusOK, ginResp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetReceiveMessageOpt(c *gin.Context) {
|
||||||
|
params := paramsSetReceiveMessageOpt{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token"))
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &user.SetReceiveMessageOptReq{
|
||||||
|
UId: claims.UID,
|
||||||
|
Opt: *params.Option,
|
||||||
|
ConversationId: params.ConversationIdList,
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt req: ", req)
|
||||||
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
|
client := user.NewUserClient(etcdConn)
|
||||||
|
resp, err := client.SetReceiveMessageOpt(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "SetReceiveMessageOpt rpc failed, ", req, err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SetReceiveMessageOpt rpc failed, " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt req: ", req, resp)
|
||||||
|
ginResp := SetReceiveMessageOptResp{
|
||||||
|
ErrCode: resp.ErrCode,
|
||||||
|
ErrMsg: resp.ErrMsg,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range resp.OptResult {
|
||||||
|
var opt OptResult
|
||||||
|
log.NewDebug("CopyStructFields begin ", v, req.OperationID)
|
||||||
|
err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result")
|
||||||
|
log.NewDebug("CopyStructFields end ", v, req.OperationID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "CopyStructFields failed ", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ginResp.Data = append(ginResp.Data, opt)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt resp: ", ginResp)
|
||||||
|
c.JSON(http.StatusOK, ginResp)
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ type paramsAddFriend struct {
|
|||||||
//
|
//
|
||||||
func ImportFriend(c *gin.Context) {
|
func ImportFriend(c *gin.Context) {
|
||||||
log.Info("", "", "ImportFriend init ....")
|
log.Info("", "", "ImportFriend init ....")
|
||||||
|
log.NewDebug("", "api importFriend start")
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
client := pbFriend.NewFriendClient(etcdConn)
|
client := pbFriend.NewFriendClient(etcdConn)
|
||||||
|
|
||||||
@@ -41,16 +41,19 @@ func ImportFriend(c *gin.Context) {
|
|||||||
OwnerUid: params.OwnerUid,
|
OwnerUid: params.OwnerUid,
|
||||||
Token: c.Request.Header.Get("token"),
|
Token: c.Request.Header.Get("token"),
|
||||||
}
|
}
|
||||||
|
log.NewDebug(req.OperationID, "args is ", req.String())
|
||||||
RpcResp, err := client.ImportFriend(context.Background(), req)
|
RpcResp, err := client.ImportFriend(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,ImportFriend failed", err)
|
log.NewError(req.OperationID, "rpc importFriend failed", err.Error())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed" + err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.InfoByArgs("ImportFriend success,args=%s", RpcResp.String())
|
failedUidList := make([]string, 0)
|
||||||
resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList}
|
for _, v := range RpcResp.FailedUidList {
|
||||||
c.JSON(http.StatusOK, resp)
|
failedUidList = append(failedUidList, v)
|
||||||
log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
}
|
||||||
|
log.NewDebug(req.OperationID, "rpc importFriend success", RpcResp.CommonResp.ErrorMsg, RpcResp.CommonResp.ErrorCode, RpcResp.FailedUidList)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": failedUidList})
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddFriend(c *gin.Context) {
|
func AddFriend(c *gin.Context) {
|
||||||
@@ -78,7 +81,8 @@ func AddFriend(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String())
|
log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String())
|
||||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
c.JSON(http.StatusOK, gin.H{
|
||||||
c.JSON(http.StatusOK, resp)
|
"errCode": RpcResp.ErrorCode,
|
||||||
log.InfoByArgs("api add friend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
"errMsg": RpcResp.ErrorMsg,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package group
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"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"
|
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -56,7 +56,7 @@ func GetGroupApplicationList(c *gin.Context) {
|
|||||||
pbData := newUserRegisterReq(¶ms)
|
pbData := newUserRegisterReq(¶ms)
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if claims, err := utils.ParseToken(token); err != nil {
|
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package group
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"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"
|
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -63,7 +63,7 @@ func ApplicationGroupResponse(c *gin.Context) {
|
|||||||
pbData := newGroupApplicationResponse(¶ms)
|
pbData := newGroupApplicationResponse(¶ms)
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if claims, err := utils.ParseToken(token); err != nil {
|
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package group
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"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"
|
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -41,7 +41,7 @@ func TransferGroupOwner(c *gin.Context) {
|
|||||||
pbData := newTransferGroupOwnerReq(¶ms)
|
pbData := newTransferGroupOwnerReq(¶ms)
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
if claims, err := utils.ParseToken(token); err != nil {
|
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"Open_IM/pkg/common/config"
|
"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/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
@@ -24,15 +25,17 @@ import (
|
|||||||
var validate *validator.Validate
|
var validate *validator.Validate
|
||||||
|
|
||||||
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"`
|
||||||
RecvID string `json:"recvID" binding:"required"`
|
RecvID string `json:"recvID" binding:"required"`
|
||||||
SenderNickName string `json:"senderNickName" `
|
SenderNickName string `json:"senderNickName" `
|
||||||
SenderFaceURL string `json:"senderFaceURL" `
|
SenderFaceURL string `json:"senderFaceURL" `
|
||||||
ForceList []string `json:"forceList" `
|
SenderPlatformID int32 `json:"senderPlatformID"`
|
||||||
Content map[string]interface{} `json:"content" binding:"required"`
|
ForceList []string `json:"forceList" `
|
||||||
ContentType int32 `json:"contentType" binding:"required"`
|
Content map[string]interface{} `json:"content" binding:"required"`
|
||||||
SessionType int32 `json:"sessionType" binding:"required"`
|
ContentType int32 `json:"contentType" binding:"required"`
|
||||||
|
SessionType int32 `json:"sessionType" binding:"required"`
|
||||||
|
IsOnlineOnly bool `json:"isOnlineOnly"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
||||||
@@ -49,7 +52,11 @@ func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
|||||||
case constant.File:
|
case constant.File:
|
||||||
newContent = utils.StructToJsonString(params.Content)
|
newContent = utils.StructToJsonString(params.Content)
|
||||||
default:
|
default:
|
||||||
|
}
|
||||||
|
options := make(map[string]int32, 2)
|
||||||
|
if params.IsOnlineOnly {
|
||||||
|
options["history"] = 0
|
||||||
|
options["persistent"] = 0
|
||||||
}
|
}
|
||||||
pbData := pbChat.UserSendMsgReq{
|
pbData := pbChat.UserSendMsgReq{
|
||||||
ReqIdentifier: constant.WSSendMsg,
|
ReqIdentifier: constant.WSSendMsg,
|
||||||
@@ -57,7 +64,7 @@ func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
|||||||
SenderNickName: params.SenderNickName,
|
SenderNickName: params.SenderNickName,
|
||||||
SenderFaceURL: params.SenderFaceURL,
|
SenderFaceURL: params.SenderFaceURL,
|
||||||
OperationID: params.OperationID,
|
OperationID: params.OperationID,
|
||||||
PlatformID: 0,
|
PlatformID: params.SenderPlatformID,
|
||||||
SessionType: params.SessionType,
|
SessionType: params.SessionType,
|
||||||
MsgFrom: constant.UserMsgType,
|
MsgFrom: constant.UserMsgType,
|
||||||
ContentType: params.ContentType,
|
ContentType: params.ContentType,
|
||||||
@@ -65,6 +72,7 @@ func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq {
|
|||||||
ForceList: params.ForceList,
|
ForceList: params.ForceList,
|
||||||
Content: newContent,
|
Content: newContent,
|
||||||
ClientMsgID: utils.GetMsgID(params.SendID),
|
ClientMsgID: utils.GetMsgID(params.SendID),
|
||||||
|
Options: utils.MapIntToJsonString(options),
|
||||||
}
|
}
|
||||||
return &pbData
|
return &pbData
|
||||||
}
|
}
|
||||||
@@ -84,8 +92,24 @@ func ManagementSendMsg(c *gin.Context) {
|
|||||||
data = TextElem{}
|
data = TextElem{}
|
||||||
case constant.Picture:
|
case constant.Picture:
|
||||||
data = PictureElem{}
|
data = PictureElem{}
|
||||||
|
case constant.Voice:
|
||||||
|
data = SoundElem{}
|
||||||
|
case constant.Video:
|
||||||
|
data = VideoElem{}
|
||||||
|
case constant.File:
|
||||||
|
data = FileElem{}
|
||||||
|
//case constant.AtText:
|
||||||
|
// data = AtElem{}
|
||||||
|
//case constant.Merger:
|
||||||
|
// data =
|
||||||
|
//case constant.Card:
|
||||||
|
//case constant.Location:
|
||||||
case constant.Custom:
|
case constant.Custom:
|
||||||
data = CustomElem{}
|
data = CustomElem{}
|
||||||
|
//case constant.Revoke:
|
||||||
|
//case constant.HasReadReceipt:
|
||||||
|
//case constant.Typing:
|
||||||
|
//case constant.Quote:
|
||||||
default:
|
default:
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
||||||
log.ErrorByKv("contentType err", c.PostForm("operationID"), "content", c.PostForm("content"))
|
log.ErrorByKv("contentType err", c.PostForm("operationID"), "content", c.PostForm("content"))
|
||||||
@@ -102,7 +126,7 @@ func ManagementSendMsg(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token := c.Request.Header.Get("token")
|
token := c.Request.Header.Get("token")
|
||||||
claims, err := utils.ParseToken(token)
|
claims, err := token_verify.ParseToken(token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(params.OperationID, "parse token failed", err.Error())
|
log.NewError(params.OperationID, "parse token failed", err.Error())
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
||||||
|
|||||||
@@ -8,9 +8,13 @@ package manage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
pbUser "Open_IM/pkg/proto/user"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -24,6 +28,10 @@ type paramsDeleteUsers struct {
|
|||||||
type paramsGetAllUsersUid struct {
|
type paramsGetAllUsersUid struct {
|
||||||
OperationID string `json:"operationID" binding:"required"`
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
}
|
}
|
||||||
|
type paramsGetUsersOnlineStatus struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
UserIDList []string `json:"userIDList" binding:"required,lte=200"`
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteUser(c *gin.Context) {
|
func DeleteUser(c *gin.Context) {
|
||||||
params := paramsDeleteUsers{}
|
params := paramsDeleteUsers{}
|
||||||
@@ -43,10 +51,14 @@ func DeleteUser(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
RpcResp, err := client.DeleteUsers(context.Background(), req)
|
RpcResp, err := client.DeleteUsers(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "call delete users rpc server failed", err.Error())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete users rpc server failed"})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete users rpc server failed"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
failedUidList := make([]string, 0)
|
||||||
|
for _, v := range RpcResp.FailedUidList {
|
||||||
|
failedUidList = append(failedUidList, v)
|
||||||
|
}
|
||||||
log.InfoByKv("call delete user rpc server is success", params.OperationID, "resp args", RpcResp.String())
|
log.InfoByKv("call delete user rpc server is success", params.OperationID, "resp args", RpcResp.String())
|
||||||
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)
|
||||||
@@ -76,3 +88,66 @@ func GetAllUsersUid(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func GetUsersOnlineStatus(c *gin.Context) {
|
||||||
|
params := paramsGetUsersOnlineStatus{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
claims, err := token_verify.ParseToken(c.Request.Header.Get("token"))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("parse token failed", params.OperationID, "err", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
|
log.ErrorByKv(" Authentication failed", params.OperationID, "args", c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 402, "errMsg": "not authorized"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req := &pbRelay.GetUsersOnlineStatusReq{
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
UserIDList: params.UserIDList,
|
||||||
|
}
|
||||||
|
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
flag := false
|
||||||
|
log.NewDebug(params.OperationID, "GetUsersOnlineStatus req come here", params.UserIDList)
|
||||||
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
client := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||||
|
reply, err := client.GetUsersOnlineStatus(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error())
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
if reply.ErrCode == 0 {
|
||||||
|
wsResult = append(wsResult, reply.SuccessResult...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult)
|
||||||
|
//Online data merge of each node
|
||||||
|
for _, v1 := range params.UserIDList {
|
||||||
|
flag = false
|
||||||
|
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||||
|
for _, v2 := range wsResult {
|
||||||
|
if v2.UserID == v1 {
|
||||||
|
flag = true
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OnlineStatus
|
||||||
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if !flag {
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OfflineStatus
|
||||||
|
}
|
||||||
|
respResult = append(respResult, temp)
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "Finished merged data", respResult)
|
||||||
|
resp := gin.H{"errCode": 0, "errMsg": "", "successResult": respResult}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package apiThird
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
log2 "Open_IM/pkg/common/log"
|
log2 "Open_IM/pkg/common/log"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
|
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
|
||||||
@@ -70,7 +71,7 @@ func TencentCloudStorageCredential(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log2.Error(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential err = %s", err.Error())
|
log2.Error(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential err = %s", err.Error())
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"errCode": config.ErrTencentCredential.ErrCode,
|
"errCode": constant.ErrTencentCredential.ErrCode,
|
||||||
"errMsg": err.Error(),
|
"errMsg": err.Error(),
|
||||||
"bucket": "",
|
"bucket": "",
|
||||||
"region": "",
|
"region": "",
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package user
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"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"
|
||||||
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
pbUser "Open_IM/pkg/proto/user"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
"context"
|
"context"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -22,6 +24,72 @@ type userInfo struct {
|
|||||||
Ex string `json:"ex"`
|
Ex string `json:"ex"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type paramsGetUsersOnlineStatus struct {
|
||||||
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
|
UserIDList []string `json:"userIDList" binding:"required,lte=200"`
|
||||||
|
Secret string `json:"secret" binding:"required,max=32"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUsersOnlineStatus(c *gin.Context) {
|
||||||
|
params := paramsGetUsersOnlineStatus{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.NewError(params.OperationID, "bind json failed ", err.Error(), c)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if params.Secret != config.Config.Secret {
|
||||||
|
log.NewError(params.OperationID, "parse token failed ", params.Secret, config.Config.Secret)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "secret failed"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
req := &pbRelay.GetUsersOnlineStatusReq{
|
||||||
|
OperationID: params.OperationID,
|
||||||
|
UserIDList: params.UserIDList,
|
||||||
|
}
|
||||||
|
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||||
|
flag := false
|
||||||
|
log.NewDebug(params.OperationID, "GetUsersOnlineStatus req come here", params.UserIDList)
|
||||||
|
|
||||||
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
client := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||||
|
reply, err := client.GetUsersOnlineStatus(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error())
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
if reply.ErrCode == 0 {
|
||||||
|
wsResult = append(wsResult, reply.SuccessResult...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult)
|
||||||
|
//Online data merge of each node
|
||||||
|
for _, v1 := range params.UserIDList {
|
||||||
|
flag = false
|
||||||
|
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||||
|
for _, v2 := range wsResult {
|
||||||
|
if v2.UserID == v1 {
|
||||||
|
flag = true
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OnlineStatus
|
||||||
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !flag {
|
||||||
|
temp.UserID = v1
|
||||||
|
temp.Status = constant.OfflineStatus
|
||||||
|
}
|
||||||
|
respResult = append(respResult, temp)
|
||||||
|
}
|
||||||
|
log.NewDebug(params.OperationID, "Finished merged data", respResult)
|
||||||
|
resp := gin.H{"errCode": 0, "errMsg": "", "successResult": respResult}
|
||||||
|
c.JSON(http.StatusOK, resp)
|
||||||
|
}
|
||||||
|
|
||||||
func GetUserInfo(c *gin.Context) {
|
func GetUserInfo(c *gin.Context) {
|
||||||
log.InfoByKv("api get userinfo init...", "")
|
log.InfoByKv("api get userinfo init...", "")
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ParamsLogin struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Platform int32 `json:"platform"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Login(c *gin.Context) {
|
||||||
|
log.NewDebug("Login api is statrting...")
|
||||||
|
params := ParamsLogin{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("api Login get params", account)
|
||||||
|
|
||||||
|
queryParams := im_mysql_model.Register{
|
||||||
|
Account: account,
|
||||||
|
Password: params.Password,
|
||||||
|
}
|
||||||
|
|
||||||
|
canLogin := im_mysql_model.Login(&queryParams)
|
||||||
|
if canLogin == 1 {
|
||||||
|
log.ErrorByKv("Incorrect phone number password", account, "err", "Mobile phone number is not registered")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Mobile phone number is not registered"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if canLogin == 2 {
|
||||||
|
log.ErrorByKv("Incorrect phone number password", account, "err", "Incorrect password")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Incorrect password"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := OpenIMToken(account, params.Platform)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("get token by phone number err", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response, err := ioutil.ReadAll(resp.Body)
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("Failed to read file", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IoErrot, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
imRep := IMRegisterResp{}
|
||||||
|
err = json.Unmarshal(response, &imRep)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("json parsing failed", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if imRep.ErrCode != 0 {
|
||||||
|
log.ErrorByKv("openIM Login request failed", account, "err")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": imRep.ErrMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": imRep.Data})
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func OpenIMToken(Account string, platform int32) (*http.Response, error) {
|
||||||
|
url := fmt.Sprintf("http://%s:10000/auth/user_token", utils.ServerIP)
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
|
||||||
|
params["secret"] = config.Config.Secret
|
||||||
|
params["platform"] = platform
|
||||||
|
params["uid"] = Account
|
||||||
|
con, err := json.Marshal(params)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("json parsing failed", Account, "err", err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(con)))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("request error", "/auth/user_token", "err", err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"fmt"
|
||||||
|
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
||||||
|
dysmsapi20170525 "github.com/alibabacloud-go/dysmsapi-20170525/v2/client"
|
||||||
|
"github.com/alibabacloud-go/tea/tea"
|
||||||
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"gopkg.in/gomail.v2"
|
||||||
|
"math/rand"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsVerificationCode struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func SendVerificationCode(c *gin.Context) {
|
||||||
|
log.InfoByKv("sendCode api is statrting...", "")
|
||||||
|
params := paramsVerificationCode{}
|
||||||
|
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.ErrorByKv("request params json parsing failed", params.PhoneNumber, params.Email, "err", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
queryParams := im_mysql_model.GetRegisterParams{
|
||||||
|
Account: account,
|
||||||
|
}
|
||||||
|
_, err, rowsAffected := im_mysql_model.GetRegister(&queryParams)
|
||||||
|
|
||||||
|
if err == nil && rowsAffected != 0 {
|
||||||
|
log.ErrorByKv("The phone number has been registered", queryParams.Account, "err")
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "The phone number has been registered"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin sendSms", account)
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
code := 100000 + rand.Intn(900000)
|
||||||
|
log.NewDebug("", config.Config.Demo)
|
||||||
|
if params.Email != "" {
|
||||||
|
m := gomail.NewMessage()
|
||||||
|
m.SetHeader(`From`, config.Config.Demo.Mail.SenderMail)
|
||||||
|
m.SetHeader(`To`, []string{account}...)
|
||||||
|
m.SetHeader(`Subject`, config.Config.Demo.Mail.Title)
|
||||||
|
m.SetBody(`text/html`, fmt.Sprintf("%d", code))
|
||||||
|
if err := gomail.NewDialer(config.Config.Demo.Mail.SmtpAddr, config.Config.Demo.Mail.SmtpPort, config.Config.Demo.Mail.SenderMail, config.Config.Demo.Mail.SenderAuthorizationCode).DialAndSend(m); err != nil {
|
||||||
|
log.ErrorByKv("send mail error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
client, err := CreateClient(tea.String(config.Config.Demo.AliSMSVerify.AccessKeyID), tea.String(config.Config.Demo.AliSMSVerify.AccessKeySecret))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("create sendSms client err", "", "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
sendSmsRequest := &dysmsapi20170525.SendSmsRequest{
|
||||||
|
PhoneNumbers: tea.String(account),
|
||||||
|
SignName: tea.String(config.Config.Demo.AliSMSVerify.SignName),
|
||||||
|
TemplateCode: tea.String(config.Config.Demo.AliSMSVerify.VerificationCodeTemplateCode),
|
||||||
|
TemplateParam: tea.String(fmt.Sprintf("{\"code\":\"%d\"}", code)),
|
||||||
|
}
|
||||||
|
|
||||||
|
response, err := client.SendSms(sendSmsRequest)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("sendSms error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if *response.Body.Code != "OK" {
|
||||||
|
log.ErrorByKv("alibabacloud sendSms error", account, "err", response.Body.Code, response.Body.Message)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin store redis", account)
|
||||||
|
v, err := redis.Int(db.DB.Exec("TTL", account))
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("get account from redis error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch {
|
||||||
|
case v == -2:
|
||||||
|
_, err = db.DB.Exec("SET", account, code, "EX", 600)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("set redis error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enter the superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verification code sent successfully!", "data": data})
|
||||||
|
log.InfoByKv("send new verification code", account)
|
||||||
|
return
|
||||||
|
case v > 540:
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Frequent operation!", "data": data})
|
||||||
|
log.InfoByKv("frequent operation", account)
|
||||||
|
return
|
||||||
|
case v < 540:
|
||||||
|
_, err = db.DB.Exec("SET", account, code, "EX", 600)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IntentionalError, "errMsg": "Enterthe superCode directly in the verification code box, SuperCode can be configured in config.xml"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verification code has been reset!", "data": data})
|
||||||
|
log.InfoByKv("Reset verification code", account)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateClient(accessKeyId *string, accessKeySecret *string) (result *dysmsapi20170525.Client, err error) {
|
||||||
|
c := &openapi.Config{
|
||||||
|
// 您的AccessKey ID
|
||||||
|
AccessKeyId: accessKeyId,
|
||||||
|
// 您的AccessKey Secret
|
||||||
|
AccessKeySecret: accessKeySecret,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 访问的域名
|
||||||
|
c.Endpoint = tea.String("dysmsapi.aliyuncs.com")
|
||||||
|
result = &dysmsapi20170525.Client{}
|
||||||
|
result, err = dysmsapi20170525.NewClient(c)
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ParamsSetPassword struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
VerificationCode string `json:"verificationCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
ExpiredTime int64 `json:"expiredTime"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Uid string `json:"uid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IMRegisterResp struct {
|
||||||
|
Data Data `json:"data"`
|
||||||
|
ErrCode int32 `json:"errCode"`
|
||||||
|
ErrMsg string `json:"errMsg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetPassword(c *gin.Context) {
|
||||||
|
log.InfoByKv("setPassword api is statrting...", "")
|
||||||
|
params := ParamsSetPassword{}
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin store redis", account)
|
||||||
|
v, err := redis.String(db.DB.Exec("GET", account))
|
||||||
|
|
||||||
|
if params.VerificationCode == config.Config.Demo.SuperCode {
|
||||||
|
goto openIMRegisterTab
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Get Redis:", v, err)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("password Verification code expired", account, "err", err.Error())
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["phoneNumber"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification expired!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if v != params.VerificationCode {
|
||||||
|
log.InfoByKv("password Verification code error", account, params.VerificationCode)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["PhoneNumber"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification code error!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
openIMRegisterTab:
|
||||||
|
log.InfoByKv("openIM register begin", account)
|
||||||
|
resp, err := OpenIMRegister(account)
|
||||||
|
|
||||||
|
log.InfoByKv("openIM register resp", account, resp, err)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("request openIM register error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response, err := ioutil.ReadAll(resp.Body)
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.IoErrot, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
imrep := IMRegisterResp{}
|
||||||
|
err = json.Unmarshal(response, &imrep)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if imrep.ErrCode != 0 {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.HttpError, "errMsg": imrep.ErrMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
queryParams := im_mysql_model.SetPasswordParams{
|
||||||
|
Account: account,
|
||||||
|
Password: params.Password,
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("begin store mysql", account, params.Password)
|
||||||
|
_, err = im_mysql_model.SetPassword(&queryParams)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("set phone number password error", account, "err", err.Error())
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.DatabaseError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("end setPassword", account)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": imrep.Data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func OpenIMRegister(account string) (*http.Response, error) {
|
||||||
|
url := fmt.Sprintf("http://%s:10000/auth/user_register", utils.ServerIP)
|
||||||
|
fmt.Println("1:", config.Config.Secret)
|
||||||
|
|
||||||
|
client := &http.Client{}
|
||||||
|
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
|
||||||
|
params["secret"] = config.Config.Secret
|
||||||
|
params["platform"] = 2
|
||||||
|
params["uid"] = account
|
||||||
|
params["name"] = account
|
||||||
|
params["icon"] = ""
|
||||||
|
params["gender"] = 0
|
||||||
|
|
||||||
|
params["mobile"] = ""
|
||||||
|
|
||||||
|
params["email"] = ""
|
||||||
|
params["birth"] = ""
|
||||||
|
params["ex"] = ""
|
||||||
|
con, err := json.Marshal(params)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
log.InfoByKv("openIM register params", account, params)
|
||||||
|
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(con)))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package register
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
|
||||||
|
"github.com/garyburd/redigo/redis"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type paramsCertification struct {
|
||||||
|
Email string `json:"email"`
|
||||||
|
PhoneNumber string `json:"phoneNumber"`
|
||||||
|
VerificationCode string `json:"verificationCode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Verify(c *gin.Context) {
|
||||||
|
log.InfoByKv("Verify api is statrting...", "")
|
||||||
|
params := paramsCertification{}
|
||||||
|
|
||||||
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
|
log.ErrorByKv("request params json parsing failed", "", "err", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": constant.FormattingError, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo("recv req: ", params)
|
||||||
|
|
||||||
|
var account string
|
||||||
|
if params.Email != "" {
|
||||||
|
account = params.Email
|
||||||
|
} else {
|
||||||
|
account = params.PhoneNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
if params.VerificationCode == config.Config.Demo.SuperCode {
|
||||||
|
log.InfoByKv("Super Code Verified successfully", account)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
data["verificationCode"] = params.VerificationCode
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verified successfully!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo("0", " params.VerificationCode != config.Config.Demo.SuperCode", params.VerificationCode, config.Config.Demo)
|
||||||
|
log.InfoByKv("begin get form redis", account)
|
||||||
|
v, err := redis.String(db.DB.Exec("GET", account))
|
||||||
|
log.InfoByKv("redis phone number and verificating Code", account, v)
|
||||||
|
if err != nil {
|
||||||
|
log.ErrorByKv("Verification code expired", account, "err", err.Error())
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification code expired!", "data": data})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if params.VerificationCode == v {
|
||||||
|
log.InfoByKv("Verified successfully", account)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
data["verificationCode"] = params.VerificationCode
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verified successfully!", "data": data})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
log.InfoByKv("Verification code error", account, params.VerificationCode)
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
data["account"] = account
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": constant.LogicalError, "errMsg": "Verification code error!", "data": data})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
|
|||||||
dec := gob.NewDecoder(b)
|
dec := gob.NewDecoder(b)
|
||||||
err := dec.Decode(&m)
|
err := dec.Decode(&m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("ws json Unmarshal err", "", "err", err.Error())
|
log.ErrorByKv("ws Decode err", "", "err", err.Error())
|
||||||
ws.sendErrMsg(conn, 200, err.Error(), constant.WSDataError, "", "")
|
ws.sendErrMsg(conn, 200, err.Error(), constant.WSDataError, "", "")
|
||||||
err = conn.Close()
|
err = conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -103,18 +103,28 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
|
|||||||
temp := &pbRelay.SingleMsgToUser{
|
temp := &pbRelay.SingleMsgToUser{
|
||||||
ResultCode: resultCode,
|
ResultCode: resultCode,
|
||||||
RecvID: UIDAndPID[0],
|
RecvID: UIDAndPID[0],
|
||||||
RecvPlatFormID: utils.PlatformNameToID(UIDAndPID[1]),
|
RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]),
|
||||||
}
|
}
|
||||||
resp = append(resp, temp)
|
resp = append(resp, temp)
|
||||||
} else {
|
} else {
|
||||||
temp := &pbRelay.SingleMsgToUser{
|
temp := &pbRelay.SingleMsgToUser{
|
||||||
ResultCode: -1,
|
ResultCode: -1,
|
||||||
RecvID: UIDAndPID[0],
|
RecvID: UIDAndPID[0],
|
||||||
RecvPlatFormID: utils.PlatformNameToID(UIDAndPID[1]),
|
RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]),
|
||||||
}
|
}
|
||||||
resp = append(resp, temp)
|
resp = append(resp, temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Single chat sender synchronization message
|
||||||
|
if in.GetSessionType() == constant.SingleChatType {
|
||||||
|
userIDList = genUidPlatformArray(in.SendID)
|
||||||
|
for _, v := range userIDList {
|
||||||
|
UIDAndPID = strings.Split(v, " ")
|
||||||
|
if conn := ws.getUserConn(v); conn != nil {
|
||||||
|
_ = sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if !tag {
|
if !tag {
|
||||||
log.NewError(in.OperationID, "push err ,no matched ws conn not in map", in.String())
|
log.NewError(in.OperationID, "push err ,no matched ws conn not in map", in.String())
|
||||||
}
|
}
|
||||||
@@ -122,12 +132,36 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
|
|||||||
Resp: resp,
|
Resp: resp,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUsersOnlineStatusReq) (*pbRelay.GetUsersOnlineStatusResp, error) {
|
||||||
|
log.NewDebug(req.OperationID, "rpc GetUsersOnlineStatus arrived server", req.String())
|
||||||
|
var UIDAndPID []string
|
||||||
|
var resp pbRelay.GetUsersOnlineStatusResp
|
||||||
|
for _, v1 := range req.UserIDList {
|
||||||
|
userIDList := genUidPlatformArray(v1)
|
||||||
|
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||||
|
temp.UserID = v1
|
||||||
|
for _, v2 := range userIDList {
|
||||||
|
UIDAndPID = strings.Split(v2, " ")
|
||||||
|
if conn := ws.getUserConn(v2); conn != nil {
|
||||||
|
ps := new(pbRelay.GetUsersOnlineStatusResp_SuccessDetail)
|
||||||
|
ps.Platform = UIDAndPID[1]
|
||||||
|
ps.Status = constant.OnlineStatus
|
||||||
|
temp.Status = constant.OnlineStatus
|
||||||
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if temp.Status == constant.OnlineStatus {
|
||||||
|
resp.SuccessResult = append(resp.SuccessResult, temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &resp, nil
|
||||||
|
}
|
||||||
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPlatForm, RecvID string) (ResultCode int64) {
|
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPlatForm, RecvID string) (ResultCode int64) {
|
||||||
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
|
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(),
|
log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(),
|
||||||
"error", err, "senderPlatform", utils.PlatformIDToName(in.PlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
|
"error", err, "senderPlatform", constant.PlatformIDToName(in.PlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
|
||||||
ResultCode = -2
|
ResultCode = -2
|
||||||
return ResultCode
|
return ResultCode
|
||||||
} else {
|
} else {
|
||||||
@@ -138,8 +172,8 @@ func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPl
|
|||||||
|
|
||||||
}
|
}
|
||||||
func genUidPlatformArray(uid string) (array []string) {
|
func genUidPlatformArray(uid string) (array []string) {
|
||||||
for i := 1; i <= utils.LinuxPlatformID; i++ {
|
for i := 1; i <= constant.LinuxPlatformID; i++ {
|
||||||
array = append(array, uid+" "+utils.PlatformIDToName(int32(i)))
|
array = append(array, uid+" "+constant.PlatformIDToName(int32(i)))
|
||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,13 @@ package gate
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
|
"bytes"
|
||||||
|
"encoding/gob"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -53,10 +58,10 @@ func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
//Connection mapping relationship,
|
//Connection mapping relationship,
|
||||||
//userID+" "+platformID->conn
|
//userID+" "+platformID->conn
|
||||||
SendID := query["sendID"][0] + " " + utils.PlatformIDToName(int32(utils.StringToInt64(query["platformID"][0])))
|
|
||||||
//Initialize a lock for each user
|
//Initialize a lock for each user
|
||||||
newConn := &UserConn{conn, new(sync.Mutex)}
|
newConn := &UserConn{conn, new(sync.Mutex)}
|
||||||
ws.addUserConn(SendID, newConn)
|
ws.addUserConn(query["sendID"][0], int32(utils.StringToInt64(query["platformID"][0])), newConn, query["token"][0])
|
||||||
go ws.readMsg(newConn)
|
go ws.readMsg(newConn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,20 +91,70 @@ func (ws *WServer) writeMsg(conn *UserConn, a int, msg []byte) error {
|
|||||||
return conn.WriteMessage(a, msg)
|
return conn.WriteMessage(a, msg)
|
||||||
|
|
||||||
}
|
}
|
||||||
func (ws *WServer) addUserConn(uid string, conn *UserConn) {
|
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newConn *UserConn, token string) {
|
||||||
|
switch config.Config.MultiLoginPolicy {
|
||||||
|
case constant.AllLoginButSameTermKick:
|
||||||
|
if oldConn, ok := ws.wsUserToConn[genMapKey(uid, platformID)]; ok {
|
||||||
|
log.NewDebug("", uid, platformID, "kick old conn")
|
||||||
|
ws.sendKickMsg(oldConn, newConn)
|
||||||
|
m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "get token from redis err", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if m == nil {
|
||||||
|
log.NewError("", "get token from redis err", "m is nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for k, _ := range m {
|
||||||
|
if k != token {
|
||||||
|
m[k] = constant.KickedToken
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.NewDebug("get map is ", m)
|
||||||
|
err = db.DB.SetTokenMapByUidPid(uid, platformID, m)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "SetTokenMapByUidPid err", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = oldConn.Close()
|
||||||
|
delete(ws.wsConnToUser, oldConn)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "conn close err", err.Error())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.NewDebug("no other conn", ws.wsUserToConn)
|
||||||
|
}
|
||||||
|
|
||||||
|
case constant.SingleTerminalLogin:
|
||||||
|
case constant.WebAndOther:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (ws *WServer) sendKickMsg(oldConn, newConn *UserConn) {
|
||||||
|
mReply := Resp{
|
||||||
|
ReqIdentifier: constant.WSKickOnlineMsg,
|
||||||
|
ErrCode: constant.ErrTokenInvalid.ErrCode,
|
||||||
|
ErrMsg: constant.ErrTokenInvalid.ErrMsg,
|
||||||
|
}
|
||||||
|
var b bytes.Buffer
|
||||||
|
enc := gob.NewEncoder(&b)
|
||||||
|
err := enc.Encode(mReply)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "Encode Msg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = ws.writeMsg(oldConn, websocket.BinaryMessage, b.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "WS WriteMsg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) {
|
||||||
|
key := genMapKey(uid, platformID)
|
||||||
rwLock.Lock()
|
rwLock.Lock()
|
||||||
defer rwLock.Unlock()
|
defer rwLock.Unlock()
|
||||||
if oldConn, ok := ws.wsUserToConn[uid]; ok {
|
ws.MultiTerminalLoginChecker(uid, platformID, conn, token)
|
||||||
err := oldConn.Close()
|
ws.wsConnToUser[conn] = key
|
||||||
delete(ws.wsConnToUser, oldConn)
|
ws.wsUserToConn[key] = conn
|
||||||
if err != nil {
|
|
||||||
log.ErrorByKv("close err", "", "uid", uid, "conn", conn)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.InfoByKv("this user is first login", "", "uid", uid)
|
|
||||||
}
|
|
||||||
ws.wsConnToUser[conn] = uid
|
|
||||||
ws.wsUserToConn[uid] = conn
|
|
||||||
log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn))
|
log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn))
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -146,10 +201,11 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
status := http.StatusUnauthorized
|
status := http.StatusUnauthorized
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
if len(query["token"]) != 0 && len(query["sendID"]) != 0 && len(query["platformID"]) != 0 {
|
if len(query["token"]) != 0 && len(query["sendID"]) != 0 && len(query["platformID"]) != 0 {
|
||||||
if !utils.VerifyToken(query["token"][0], query["sendID"][0]) {
|
if ok, err := token_verify.VerifyToken(query["token"][0], query["sendID"][0]); !ok {
|
||||||
|
e := err.(*constant.ErrInfo)
|
||||||
log.ErrorByKv("Token verify failed", "", "query", query)
|
log.ErrorByKv("Token verify failed", "", "query", query)
|
||||||
w.Header().Set("Sec-Websocket-Version", "13")
|
w.Header().Set("Sec-Websocket-Version", "13")
|
||||||
http.Error(w, http.StatusText(status), status)
|
http.Error(w, e.ErrMsg, int(e.ErrCode))
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
log.InfoByKv("Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0])
|
||||||
@@ -163,3 +219,6 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func genMapKey(uid string, platformID int32) string {
|
||||||
|
return uid + " " + constant.PlatformIDToName(platformID)
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
|
|||||||
pbSaveData.OperationID = pbData.OperationID
|
pbSaveData.OperationID = pbData.OperationID
|
||||||
pbSaveData.RecvID = pbData.RecvID
|
pbSaveData.RecvID = pbData.RecvID
|
||||||
pbSaveData.PlatformID = pbData.PlatformID
|
pbSaveData.PlatformID = pbData.PlatformID
|
||||||
Options := utils.JsonStringToMap(pbData.Options)
|
options := utils.JsonStringToMap(pbData.Options)
|
||||||
//Control whether to store offline messages (mongo)
|
//Control whether to store offline messages (mongo)
|
||||||
isHistory := utils.GetSwitchFromOptions(Options, "history")
|
isHistory := utils.GetSwitchFromOptions(options, "history")
|
||||||
//Control whether to store history messages (mysql)
|
//Control whether to store history messages (mysql)
|
||||||
isPersist := utils.GetSwitchFromOptions(Options, "persistent")
|
isPersist := utils.GetSwitchFromOptions(options, "persistent")
|
||||||
switch pbData.SessionType {
|
switch pbData.SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist)
|
log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist)
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey strin
|
|||||||
log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error())
|
log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Options := utils.JsonStringToMap(pbData.Options)
|
options := utils.JsonStringToMap(pbData.Options)
|
||||||
//Control whether to store history messages (mysql)
|
//Control whether to store history messages (mysql)
|
||||||
isPersist := utils.GetSwitchFromOptions(Options, "persistent")
|
isPersist := utils.GetSwitchFromOptions(options, "persistent")
|
||||||
//Only process receiver data
|
//Only process receiver data
|
||||||
if isPersist {
|
if isPersist {
|
||||||
if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType {
|
if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType {
|
||||||
|
|||||||
@@ -20,15 +20,17 @@ func JGAccountListPush(accounts []string, content, detailContent, platform strin
|
|||||||
var au requestBody.Audience
|
var au requestBody.Audience
|
||||||
au.SetAlias(accounts)
|
au.SetAlias(accounts)
|
||||||
var no requestBody.Notification
|
var no requestBody.Notification
|
||||||
no.SetAlert(content)
|
no.SetAlert(content, platform)
|
||||||
no.SetAndroidIntent()
|
|
||||||
var me requestBody.Message
|
var me requestBody.Message
|
||||||
me.SetMsgContent(detailContent)
|
me.SetMsgContent(detailContent)
|
||||||
|
var o requestBody.Options
|
||||||
|
o.SetApnsProduction(false)
|
||||||
var po requestBody.PushObj
|
var po requestBody.PushObj
|
||||||
po.SetPlatform(&pf)
|
po.SetPlatform(&pf)
|
||||||
po.SetAudience(&au)
|
po.SetAudience(&au)
|
||||||
po.SetNotification(&no)
|
po.SetNotification(&no)
|
||||||
po.SetMessage(&me)
|
po.SetMessage(&me)
|
||||||
|
po.SetOptions(&o)
|
||||||
|
|
||||||
con, err := json.Marshal(po)
|
con, err := json.Marshal(po)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package requestBody
|
package requestBody
|
||||||
|
|
||||||
import "Open_IM/pkg/common/config"
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
)
|
||||||
|
|
||||||
type Notification struct {
|
type Notification struct {
|
||||||
Alert string `json:"alert,omitempty"`
|
Alert string `json:"alert,omitempty"`
|
||||||
@@ -15,11 +18,23 @@ type Android struct {
|
|||||||
} `json:"intent,omitempty"`
|
} `json:"intent,omitempty"`
|
||||||
}
|
}
|
||||||
type Ios struct {
|
type Ios struct {
|
||||||
|
Alert string `json:"alert,omitempty"`
|
||||||
|
Sound string `json:"sound,omitempty"`
|
||||||
|
Badge string `json:"badge,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Notification) SetAlert(alert string) {
|
func (n *Notification) SetAlert(alert, platform string) {
|
||||||
n.Alert = alert
|
n.Alert = alert
|
||||||
n.Android.Alert = alert
|
switch platform {
|
||||||
|
case constant.AndroidPlatformStr:
|
||||||
|
n.Android.Alert = alert
|
||||||
|
n.SetAndroidIntent()
|
||||||
|
case constant.IOSPlatformStr:
|
||||||
|
n.IOS.Alert = alert
|
||||||
|
n.IOS.Sound = "default"
|
||||||
|
n.IOS.Badge = "+1"
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func (n *Notification) SetAndroidIntent() {
|
func (n *Notification) SetAndroidIntent() {
|
||||||
n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent
|
n.Android.Intent.URL = config.Config.Push.Jpns.PushIntent
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package requestBody
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
ApnsProduction bool `json:"apns_production"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *Options) SetApnsProduction(c bool) {
|
||||||
|
o.ApnsProduction = c
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package requestBody
|
package requestBody
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/common/constant"
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,9 +53,9 @@ func (p *Platform) Set(os string) error {
|
|||||||
}
|
}
|
||||||
func (p *Platform) SetPlatform(platform string) error {
|
func (p *Platform) SetPlatform(platform string) error {
|
||||||
switch platform {
|
switch platform {
|
||||||
case utils.AndroidPlatformStr:
|
case constant.AndroidPlatformStr:
|
||||||
return p.SetAndroid()
|
return p.SetAndroid()
|
||||||
case utils.IOSPlatformStr:
|
case constant.IOSPlatformStr:
|
||||||
return p.SetIOS()
|
return p.SetIOS()
|
||||||
default:
|
default:
|
||||||
return errors.New("platform err")
|
return errors.New("platform err")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ type PushObj struct {
|
|||||||
Audience interface{} `json:"audience"`
|
Audience interface{} `json:"audience"`
|
||||||
Notification interface{} `json:"notification,omitempty"`
|
Notification interface{} `json:"notification,omitempty"`
|
||||||
Message interface{} `json:"message,omitempty"`
|
Message interface{} `json:"message,omitempty"`
|
||||||
|
Options interface{} `json:"options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PushObj) SetPlatform(pf *Platform) {
|
func (p *PushObj) SetPlatform(pf *Platform) {
|
||||||
@@ -22,3 +23,6 @@ func (p *PushObj) SetNotification(no *Notification) {
|
|||||||
func (p *PushObj) SetMessage(m *Message) {
|
func (p *PushObj) SetMessage(m *Message) {
|
||||||
p.Message = m
|
p.Message = m
|
||||||
}
|
}
|
||||||
|
func (p *PushObj) SetOptions(o *Options) {
|
||||||
|
p.Options = o
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ package logic
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/kafka"
|
"Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -24,7 +24,7 @@ func Init(rpcPort int) {
|
|||||||
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
||||||
rpcServer.Init(rpcPort)
|
rpcServer.Init(rpcPort)
|
||||||
pushCh.Init()
|
pushCh.Init()
|
||||||
pushTerminal = []int32{utils.IOSPlatformID, utils.AndroidPlatformID}
|
pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID}
|
||||||
}
|
}
|
||||||
func init() {
|
func init() {
|
||||||
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -53,7 +54,7 @@ func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) {
|
|||||||
sendPbData.PlatformID = pbData.PlatformID
|
sendPbData.PlatformID = pbData.PlatformID
|
||||||
sendPbData.RecvSeq = pbData.RecvSeq
|
sendPbData.RecvSeq = pbData.RecvSeq
|
||||||
//Call push module to send message to the user
|
//Call push module to send message to the user
|
||||||
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options)
|
MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options))
|
||||||
}
|
}
|
||||||
func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPu
|
|||||||
sendPbData.PlatformID = pbData.PlatformID
|
sendPbData.PlatformID = pbData.PlatformID
|
||||||
sendPbData.RecvSeq = pbData.RecvSeq
|
sendPbData.RecvSeq = pbData.RecvSeq
|
||||||
//Call push module to send message to the user
|
//Call push module to send message to the user
|
||||||
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options)
|
MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options))
|
||||||
return &pbPush.PushMsgResp{
|
return &pbPush.PushMsgResp{
|
||||||
ResultCode: 0,
|
ResultCode: 0,
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@@ -34,12 +34,10 @@ type AtContent struct {
|
|||||||
IsAtSelf bool `json:"isAtSelf"`
|
IsAtSelf bool `json:"isAtSelf"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
|
func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo string, Options map[string]int32) {
|
||||||
var wsResult []*pbRelay.SingleMsgToUser
|
var wsResult []*pbRelay.SingleMsgToUser
|
||||||
MOptions := utils.JsonStringToMap(Options) //Control whether to push message to sender's other terminal
|
isOfflinePush := utils.GetSwitchFromOptions(Options, "offlinePush")
|
||||||
//isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync")
|
log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData, Options, isOfflinePush)
|
||||||
isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush")
|
|
||||||
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.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||||
//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)
|
||||||
@@ -48,8 +46,9 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
|
|||||||
reply, err := msgClient.MsgToUser(context.Background(), sendPbData)
|
reply, err := msgClient.MsgToUser(context.Background(), sendPbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.InfoByKv("push data to client rpc err", sendPbData.OperationID, "err", err)
|
log.InfoByKv("push data to client rpc err", sendPbData.OperationID, "err", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if reply != nil && reply.Resp != nil && err == nil {
|
if reply != nil && reply.Resp != nil {
|
||||||
wsResult = append(wsResult, reply.Resp...)
|
wsResult = append(wsResult, reply.Resp...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,11 +96,11 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
|
|||||||
default:
|
default:
|
||||||
content = constant.ContentType2PushContent[constant.Common]
|
content = constant.ContentType2PushContent[constant.Common]
|
||||||
}
|
}
|
||||||
pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, utils.PlatformIDToName(t))
|
pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t)
|
log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), constant.PlatformIDToName(t))
|
||||||
} else {
|
} else {
|
||||||
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t)
|
log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, constant.PlatformIDToName(t))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -145,8 +144,8 @@ func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) {
|
func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) {
|
||||||
pid, offset, err := producer.SendMessage(m, key)
|
pid, offset, err := producer.SendMessage(m, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbAuth "Open_IM/pkg/proto/auth"
|
pbAuth "Open_IM/pkg/proto/auth"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ func (rpc *rpcAuth) UserToken(_ context.Context, pb *pbAuth.UserTokenReq) (*pbAu
|
|||||||
}
|
}
|
||||||
log.Info("", "", "rpc user_token call..., im_mysql_model.AppServerFindFromUserByUserID")
|
log.Info("", "", "rpc user_token call..., im_mysql_model.AppServerFindFromUserByUserID")
|
||||||
|
|
||||||
tokens, expTime, err := utils.CreateToken(pb.UID, pb.Platform)
|
tokens, expTime, err := token_verify.CreateToken(pb.UID, pb.Platform)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", "rpc user_token call..., utils.CreateToken fail [uid: %s] [err: %s]", pb.UID, err.Error())
|
log.Error("", "", "rpc user_token call..., utils.CreateToken fail [uid: %s] [err: %s]", pb.UID, err.Error())
|
||||||
return &pbAuth.UserTokenResp{ErrCode: 500, ErrMsg: err.Error()}, err
|
return &pbAuth.UserTokenResp{ErrCode: 500, ErrMsg: err.Error()}, err
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import (
|
|||||||
"Open_IM/internal/push/content_struct"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
http2 "Open_IM/pkg/common/http"
|
http2 "Open_IM/pkg/common/http"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
|
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -21,14 +23,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MsgCallBackReq struct {
|
type MsgCallBackReq struct {
|
||||||
SendID string `json:"sendID"`
|
SendID string `json:"sendID"`
|
||||||
RecvID string `json:"recvID"`
|
RecvID string `json:"recvID"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
SendTime int64 `json:"sendTime"`
|
SendTime int64 `json:"sendTime"`
|
||||||
MsgFrom int32 `json:"msgFrom"`
|
MsgFrom int32 `json:"msgFrom"`
|
||||||
ContentType int32 `json:"contentType"`
|
ContentType int32 `json:"contentType"`
|
||||||
SessionType int32 `json:"sessionType"`
|
SessionType int32 `json:"sessionType"`
|
||||||
PlatformID int32 `json:"senderPlatformID"`
|
PlatformID int32 `json:"senderPlatformID"`
|
||||||
|
MsgID string `json:"msgID"`
|
||||||
|
IsOnlineOnly bool `json:"isOnlineOnly"`
|
||||||
}
|
}
|
||||||
type MsgCallBackResp struct {
|
type MsgCallBackResp struct {
|
||||||
ErrCode int32 `json:"errCode"`
|
ErrCode int32 `json:"errCode"`
|
||||||
@@ -68,37 +72,52 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
|
|||||||
} else {
|
} else {
|
||||||
pbData.SendTime = pb.SendTime
|
pbData.SendTime = pb.SendTime
|
||||||
}
|
}
|
||||||
m := MsgCallBackResp{}
|
options := utils.JsonStringToMap(pbData.Options)
|
||||||
|
isHistory := utils.GetSwitchFromOptions(options, "history")
|
||||||
|
mReq := MsgCallBackReq{
|
||||||
|
SendID: pb.SendID,
|
||||||
|
RecvID: pb.RecvID,
|
||||||
|
Content: pb.Content,
|
||||||
|
SendTime: pbData.SendTime,
|
||||||
|
MsgFrom: pbData.MsgFrom,
|
||||||
|
ContentType: pb.ContentType,
|
||||||
|
SessionType: pb.SessionType,
|
||||||
|
PlatformID: pb.PlatformID,
|
||||||
|
MsgID: pb.ClientMsgID,
|
||||||
|
}
|
||||||
|
if !isHistory {
|
||||||
|
mReq.IsOnlineOnly = true
|
||||||
|
}
|
||||||
|
mResp := MsgCallBackResp{}
|
||||||
if config.Config.MessageCallBack.CallbackSwitch {
|
if config.Config.MessageCallBack.CallbackSwitch {
|
||||||
bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, MsgCallBackReq{
|
bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, mReq, config.Config.MessageCallBack.CallBackTimeOut)
|
||||||
SendID: pb.SendID,
|
|
||||||
RecvID: pb.RecvID,
|
|
||||||
Content: pb.Content,
|
|
||||||
SendTime: pbData.SendTime,
|
|
||||||
MsgFrom: pbData.MsgFrom,
|
|
||||||
ContentType: pb.ContentType,
|
|
||||||
SessionType: pb.SessionType,
|
|
||||||
PlatformID: pb.PlatformID,
|
|
||||||
}, "application/json; charset=utf-8")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("callback to Business server err", pb.OperationID, "args", pb.String(), "err", err.Error())
|
log.ErrorByKv("callback to Business server err", pb.OperationID, "args", pb.String(), "err", err.Error())
|
||||||
return returnMsg(&replay, pb, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), "", 0)
|
return returnMsg(&replay, pb, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), "", 0)
|
||||||
} else if err = json.Unmarshal(bMsg, &m); err != nil {
|
} else if err = json.Unmarshal(bMsg, &mResp); err != nil {
|
||||||
log.ErrorByKv("ws json Unmarshal err", pb.OperationID, "args", pb.String(), "err", err.Error())
|
log.ErrorByKv("ws json Unmarshal err", pb.OperationID, "args", pb.String(), "err", err.Error())
|
||||||
return returnMsg(&replay, pb, 200, err.Error(), "", 0)
|
return returnMsg(&replay, pb, 200, err.Error(), "", 0)
|
||||||
} else {
|
} else {
|
||||||
if m.ErrCode != 0 {
|
if mResp.ErrCode != 0 {
|
||||||
return returnMsg(&replay, pb, m.ResponseErrCode, m.ErrMsg, "", 0)
|
return returnMsg(&replay, pb, mResp.ResponseErrCode, mResp.ErrMsg, "", 0)
|
||||||
} else {
|
} else {
|
||||||
pbData.Content = m.ResponseResult.ModifiedMsg
|
pbData.Content = mResp.ResponseResult.ModifiedMsg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch pbData.SessionType {
|
switch pbData.SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
err1 := rpc.sendMsgToKafka(&pbData, pbData.RecvID)
|
isSend := modifyMessageByUserMessageReceiveOpt(pbData.RecvID, pbData.SendID, constant.SingleChatType, &pbData)
|
||||||
|
if isSend {
|
||||||
|
err1 := rpc.sendMsgToKafka(&pbData, pbData.RecvID)
|
||||||
|
if err1 != nil {
|
||||||
|
log.NewError(pbData.OperationID, "kafka send msg err:RecvID", pbData.RecvID, pbData.String())
|
||||||
|
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
err2 := rpc.sendMsgToKafka(&pbData, pbData.SendID)
|
err2 := rpc.sendMsgToKafka(&pbData, pbData.SendID)
|
||||||
if err1 != nil || err2 != nil {
|
if err2 != nil {
|
||||||
|
log.NewError(pbData.OperationID, "kafka send msg err:SendID", pbData.SendID, pbData.String())
|
||||||
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
||||||
}
|
}
|
||||||
return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime)
|
return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime)
|
||||||
@@ -145,16 +164,25 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
|
|||||||
groupID := pbData.RecvID
|
groupID := pbData.RecvID
|
||||||
for i, v := range reply.MemberList {
|
for i, v := range reply.MemberList {
|
||||||
pbData.RecvID = v.UserId + " " + groupID
|
pbData.RecvID = v.UserId + " " + groupID
|
||||||
err := rpc.sendMsgToKafka(&pbData, utils.IntToString(i))
|
isSend := modifyMessageByUserMessageReceiveOpt(v.UserId, groupID, constant.GroupChatType, &pbData)
|
||||||
if err != nil {
|
if isSend {
|
||||||
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
err := rpc.sendMsgToKafka(&pbData, utils.IntToString(i))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(pbData.OperationID, "kafka send msg err:UserId", v.UserId, pbData.String())
|
||||||
|
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for i, v := range addUidList {
|
for i, v := range addUidList {
|
||||||
pbData.RecvID = v + " " + groupID
|
pbData.RecvID = v + " " + groupID
|
||||||
err := rpc.sendMsgToKafka(&pbData, utils.IntToString(i+1))
|
isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, &pbData)
|
||||||
if err != nil {
|
if isSend {
|
||||||
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
err := rpc.sendMsgToKafka(&pbData, utils.IntToString(i+1))
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(pbData.OperationID, "kafka send msg err:UserId", v, pbData.String())
|
||||||
|
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime)
|
return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime)
|
||||||
@@ -163,6 +191,20 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type WSToMsgSvrChatMsg struct {
|
||||||
|
SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"`
|
||||||
|
RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"`
|
||||||
|
Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"`
|
||||||
|
MsgFrom int32 `protobuf:"varint,5,opt,name=MsgFrom" json:"MsgFrom,omitempty"`
|
||||||
|
ContentType int32 `protobuf:"varint,8,opt,name=ContentType" json:"ContentType,omitempty"`
|
||||||
|
SessionType int32 `protobuf:"varint,9,opt,name=SessionType" json:"SessionType,omitempty"`
|
||||||
|
OperationID string `protobuf:"bytes,10,opt,name=OperationID" json:"OperationID,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func Notification(m *WSToMsgSvrChatMsg, onlineUserOnly bool, offlineInfo open_im_sdk.OfflinePushInfo) {
|
||||||
|
|
||||||
}
|
}
|
||||||
func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error {
|
func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error {
|
||||||
pid, offset, err := rpc.producer.SendMessage(m, key)
|
pid, offset, err := rpc.producer.SendMessage(m, key)
|
||||||
@@ -184,3 +226,27 @@ func returnMsg(replay *pbChat.UserSendMsgResp, pb *pbChat.UserSendMsgReq, errCod
|
|||||||
replay.SendTime = sendTime
|
replay.SendTime = sendTime
|
||||||
return replay, nil
|
return replay, nil
|
||||||
}
|
}
|
||||||
|
func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, msg *pbChat.WSToMsgSvrChatMsg) bool {
|
||||||
|
conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType)
|
||||||
|
opt, err := db.DB.GetSingleConversationMsgOpt(userID, conversationID)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(msg.OperationID, "GetSingleConversationMsgOpt from redis err", msg.String())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
switch opt {
|
||||||
|
case constant.ReceiveMessage:
|
||||||
|
return true
|
||||||
|
case constant.NotReceiveMessage:
|
||||||
|
return false
|
||||||
|
case constant.ReceiveNotNotifyMessage:
|
||||||
|
options := utils.JsonStringToMap(msg.Options)
|
||||||
|
if options == nil {
|
||||||
|
options = make(map[string]int32, 2)
|
||||||
|
}
|
||||||
|
utils.SetSwitchFromOptions(options, "offlinePush", 0)
|
||||||
|
msg.Options = utils.MapIntToJsonString(options)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package friend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
@@ -12,10 +14,10 @@ import (
|
|||||||
func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.CommonResp, error) {
|
func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc add blacklist is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc add blacklist is server,args=%s", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
isMagagerFlag := 0
|
isMagagerFlag := 0
|
||||||
@@ -29,7 +31,7 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl
|
|||||||
err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid)
|
err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrMysql.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid)
|
log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid)
|
||||||
return &pbFriend.CommonResp{}, nil
|
return &pbFriend.CommonResp{}, nil
|
||||||
@@ -38,7 +40,7 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl
|
|||||||
err = im_mysql_model.InsertInToUserBlackList(req.OwnerUid, req.Uid)
|
err = im_mysql_model.InsertInToUserBlackList(req.OwnerUid, req.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrMysql.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid)
|
log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid)
|
||||||
return &pbFriend.CommonResp{}, nil
|
return &pbFriend.CommonResp{}, nil
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
@@ -16,22 +17,22 @@ import (
|
|||||||
func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.CommonResp, error) {
|
func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc add friend is server,userid=%s", req.Uid)
|
log.Info(req.Token, req.OperationID, "rpc add friend is server,userid=%s", req.Uid)
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//Cannot add non-existent users
|
//Cannot add non-existent users
|
||||||
if _, err = im_mysql_model.FindUserByUID(req.Uid); err != nil {
|
if _, err = im_mysql_model.FindUserByUID(req.Uid); err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend")
|
log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend")
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrAddFriend.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//Establish a latest relationship in the friend request table
|
//Establish a latest relationship in the friend request table
|
||||||
err = im_mysql_model.ReplaceIntoFriendReq(claims.UID, req.Uid, constant.ApplicationFriendFlag, req.ReqMessage)
|
err = im_mysql_model.ReplaceIntoFriendReq(claims.UID, req.Uid, constant.ApplicationFriendFlag, req.ReqMessage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,create friend request record failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,create friend request record failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrAddFriend.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrAddFriend.ErrCode, ErrorMsg: constant.ErrAddFriend.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc add friend is success return,uid=%s", req.Uid)
|
log.Info(req.Token, req.OperationID, "rpc add friend is success return,uid=%s", req.Uid)
|
||||||
//Push message when add friend successfully
|
//Push message when add friend successfully
|
||||||
@@ -57,23 +58,23 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
|
|||||||
var resp pbFriend.ImportFriendResp
|
var resp pbFriend.ImportFriendResp
|
||||||
var c pbFriend.CommonResp
|
var c pbFriend.CommonResp
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.NewError(req.OperationID, "parse token failed", err.Error())
|
||||||
c.ErrorCode = config.ErrAddFriend.ErrCode
|
c.ErrorCode = constant.ErrAddFriend.ErrCode
|
||||||
c.ErrorMsg = config.ErrParseToken.ErrMsg
|
c.ErrorMsg = constant.ErrParseToken.ErrMsg
|
||||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
log.Error(req.Token, req.OperationID, "not manager uid", claims.UID)
|
log.NewError(req.OperationID, "not manager uid", claims.UID)
|
||||||
c.ErrorCode = config.ErrAddFriend.ErrCode
|
c.ErrorCode = constant.ErrAddFriend.ErrCode
|
||||||
c.ErrorMsg = "not authorized"
|
c.ErrorMsg = "not authorized"
|
||||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
||||||
}
|
}
|
||||||
if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil {
|
if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend", req.OwnerUid)
|
log.NewError(req.OperationID, "this user not exists,cant not add friend", req.OwnerUid)
|
||||||
c.ErrorCode = config.ErrAddFriend.ErrCode
|
c.ErrorCode = constant.ErrAddFriend.ErrCode
|
||||||
c.ErrorMsg = "this user not exists,cant not add friend"
|
c.ErrorMsg = "this user not exists,cant not add friend"
|
||||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
||||||
}
|
}
|
||||||
@@ -81,7 +82,6 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
|
|||||||
if _, fErr := im_mysql_model.FindUserByUID(v); fErr != nil {
|
if _, fErr := im_mysql_model.FindUserByUID(v); fErr != nil {
|
||||||
c.ErrorMsg = "some uid establish failed"
|
c.ErrorMsg = "some uid establish failed"
|
||||||
c.ErrorCode = 408
|
c.ErrorCode = 408
|
||||||
resp.CommonResp = &c
|
|
||||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||||
} else {
|
} else {
|
||||||
if _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, v); err != nil {
|
if _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, v); err != nil {
|
||||||
@@ -119,14 +119,15 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
|
|||||||
OperationID: req.OperationID,
|
OperationID: req.OperationID,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
resp.CommonResp.ErrorMsg = "some uid establish failed"
|
c.ErrorMsg = "some uid establish failed"
|
||||||
resp.CommonResp.ErrorCode = 408
|
c.ErrorCode = 408
|
||||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
resp.CommonResp = &c
|
||||||
|
log.NewDebug(req.OperationID, "rpc come end", resp.CommonResp.ErrorCode, resp.CommonResp.ErrorMsg, resp.FailedUidList)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package friend
|
|||||||
import (
|
import (
|
||||||
"Open_IM/internal/push/content_struct"
|
"Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/internal/push/logic"
|
"Open_IM/internal/push/logic"
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
@@ -16,21 +16,21 @@ import (
|
|||||||
func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.CommonResp, error) {
|
func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc add friend response is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc add friend response is server,args=%s", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//Check there application before agreeing or refuse to a friend's application
|
//Check there application before agreeing or refuse to a friend's application
|
||||||
if _, err = im_mysql_model.FindFriendApplyFromFriendReqByUid(req.Uid, claims.UID); err != nil {
|
if _, err = im_mysql_model.FindFriendApplyFromFriendReqByUid(req.Uid, claims.UID); err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "No such application record")
|
log.Error(req.Token, req.OperationID, "No such application record")
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrAgreeToAddFriend.ErrCode, ErrorMsg: config.ErrAgreeToAddFriend.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrAgreeToAddFriend.ErrCode, ErrorMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//Change friend request status flag
|
//Change friend request status flag
|
||||||
err = im_mysql_model.UpdateFriendRelationshipToFriendReq(req.Uid, claims.UID, req.Flag)
|
err = im_mysql_model.UpdateFriendRelationshipToFriendReq(req.Uid, claims.UID, req.Flag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,update friend request table failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,update friend request table failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrAgreeToAddFriend.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc add friend response success return,userid=%s,flag=%d", req.Uid, req.Flag)
|
log.Info(req.Token, req.OperationID, "rpc add friend response success return,userid=%s,flag=%d", req.Uid, req.Flag)
|
||||||
//Change the status of the friend request form
|
//Change the status of the friend request form
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.CommonResp, error) {
|
func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc delete friend is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc delete friend is server,args=%s", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
err = im_mysql_model.DeleteSingleFriendInfo(claims.UID, req.Uid)
|
err = im_mysql_model.DeleteSingleFriendInfo(claims.UID, req.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,delete friend failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,delete friend failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrMysql.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc delete friend success return")
|
log.Info(req.Token, req.OperationID, "rpc delete friend success return")
|
||||||
return &pbFriend.CommonResp{}, nil
|
return &pbFriend.CommonResp{}, nil
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,15 +16,15 @@ func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlackl
|
|||||||
comment string
|
comment string
|
||||||
)
|
)
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.GetBlacklistResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.GetBlacklistResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
blackListInfo, err := im_mysql_model.GetBlackListByUID(claims.UID)
|
blackListInfo, err := im_mysql_model.GetBlackListByUID(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s get blacklist failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s get blacklist failed", err.Error())
|
||||||
return &pbFriend.GetBlacklistResp{ErrorCode: config.ErrGetBlackList.ErrCode, ErrorMsg: config.ErrGetBlackList.ErrMsg}, nil
|
return &pbFriend.GetBlacklistResp{ErrorCode: constant.ErrGetBlackList.ErrCode, ErrorMsg: constant.ErrGetBlackList.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
for _, blackUser := range blackListInfo {
|
for _, blackUser := range blackListInfo {
|
||||||
var blackUserInfo pbFriend.UserInfo
|
var blackUserInfo pbFriend.UserInfo
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
@@ -71,10 +72,10 @@ func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFrie
|
|||||||
comment string
|
comment string
|
||||||
)
|
)
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.GetFriendInfoResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.GetFriendInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
friendShip, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.Uid)
|
friendShip, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.Uid)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -84,7 +85,7 @@ func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFrie
|
|||||||
friendUserInfo, err := im_mysql_model.FindUserByUID(req.Uid)
|
friendUserInfo, err := im_mysql_model.FindUserByUID(req.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,no this user", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,no this user", err.Error())
|
||||||
return &pbFriend.GetFriendInfoResp{ErrorCode: config.ErrSearchUserInfo.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil
|
return &pbFriend.GetFriendInfoResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
err = im_mysql_model.FindRelationshipFromBlackList(claims.UID, req.Uid)
|
err = im_mysql_model.FindRelationshipFromBlackList(claims.UID, req.Uid)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -15,16 +15,16 @@ func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.Get
|
|||||||
log.Info(req.Token, req.OperationID, "rpc get friend apply list is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc get friend apply list is server,args=%s", req.String())
|
||||||
var appleUserList []*pbFriend.ApplyUserInfo
|
var appleUserList []*pbFriend.ApplyUserInfo
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.GetFriendApplyResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
// Find the current user friend applications received
|
// Find the current user friend applications received
|
||||||
ApplyUsersInfo, err := im_mysql_model.FindFriendsApplyFromFriendReq(claims.UID)
|
ApplyUsersInfo, err := im_mysql_model.FindFriendsApplyFromFriendReq(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,search applyInfo failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,search applyInfo failed", err.Error())
|
||||||
return &pbFriend.GetFriendApplyResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrMysql.ErrMsg}, nil
|
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
for _, applyUserInfo := range ApplyUsersInfo {
|
for _, applyUserInfo := range ApplyUsersInfo {
|
||||||
var userInfo pbFriend.ApplyUserInfo
|
var userInfo pbFriend.ApplyUserInfo
|
||||||
@@ -57,16 +57,16 @@ func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetFr
|
|||||||
log.Info(req.Token, req.OperationID, "rpc get self apply list is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc get self apply list is server,args=%s", req.String())
|
||||||
var selfApplyOtherUserList []*pbFriend.ApplyUserInfo
|
var selfApplyOtherUserList []*pbFriend.ApplyUserInfo
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.GetFriendApplyResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
// Find the self add other userinfo
|
// Find the self add other userinfo
|
||||||
usersInfo, err := im_mysql_model.FindSelfApplyFromFriendReq(claims.UID)
|
usersInfo, err := im_mysql_model.FindSelfApplyFromFriendReq(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,search self to other user Info failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,search self to other user Info failed", err.Error())
|
||||||
return &pbFriend.GetFriendApplyResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrMysql.ErrMsg}, nil
|
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
for _, selfApplyOtherUserInfo := range usersInfo {
|
for _, selfApplyOtherUserInfo := range usersInfo {
|
||||||
var userInfo pbFriend.ApplyUserInfo
|
var userInfo pbFriend.ApplyUserInfo
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -14,15 +13,15 @@ func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFrien
|
|||||||
log.Info(req.Token, req.OperationID, "rpc get friend list is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc get friend list is server,args=%s", req.String())
|
||||||
var userInfoList []*pbFriend.UserInfo
|
var userInfoList []*pbFriend.UserInfo
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.GetFriendListResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.GetFriendListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
friends, err := im_mysql_model.FindUserInfoFromFriend(claims.UID)
|
friends, err := im_mysql_model.FindUserInfoFromFriend(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s search friendInfo failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s search friendInfo failed", err.Error())
|
||||||
return &pbFriend.GetFriendListResp{ErrorCode: config.ErrSearchUserInfo.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil
|
return &pbFriend.GetFriendListResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
for _, friendUser := range friends {
|
for _, friendUser := range friends {
|
||||||
var friendUserInfo pbFriend.UserInfo
|
var friendUserInfo pbFriend.UserInfo
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
@@ -14,10 +13,10 @@ import (
|
|||||||
func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) {
|
func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) {
|
||||||
log.InfoByArgs("rpc is friend is server,args=%s", req.String())
|
log.InfoByArgs("rpc is friend is server,args=%s", req.String())
|
||||||
var isFriend int32
|
var isFriend int32
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.IsFriendResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.IsFriendResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
_, err = im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.ReceiveUid)
|
_, err = im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.ReceiveUid)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.CommonResp, error) {
|
func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc remove blacklist is server,userid=%s", req.Uid)
|
log.Info(req.Token, req.OperationID, "rpc remove blacklist is server,userid=%s", req.Uid)
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
err = im_mysql_model.RemoveBlackList(claims.UID, req.Uid)
|
err = im_mysql_model.RemoveBlackList(claims.UID, req.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,remove blacklist failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,remove blacklist failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: config.ErrMysql.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc remove blacklist success return,userid=%s", req.Uid)
|
log.Info(req.Token, req.OperationID, "rpc remove blacklist success return,userid=%s", req.Uid)
|
||||||
return &pbFriend.CommonResp{}, nil
|
return &pbFriend.CommonResp{}, nil
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
package friend
|
package friend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *friendServer) SetFriendComment(ctx context.Context, req *pbFriend.SetFriendCommentReq) (*pbFriend.CommonResp, error) {
|
func (s *friendServer) SetFriendComment(ctx context.Context, req *pbFriend.SetFriendCommentReq) (*pbFriend.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc set friend comment is server,params=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc set friend comment is server,params=%s", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
err = im_mysql_model.UpdateFriendComment(claims.UID, req.Uid, req.Comment)
|
err = im_mysql_model.UpdateFriendComment(claims.UID, req.Uid, req.Comment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "set friend comment failed,err=%s", err.Error())
|
log.Error(req.Token, req.OperationID, "set friend comment failed,err=%s", err.Error())
|
||||||
return &pbFriend.CommonResp{ErrorCode: config.ErrSetFriendComment.ErrCode, ErrorMsg: config.ErrSetFriendComment.ErrMsg}, nil
|
return &pbFriend.CommonResp{ErrorCode: constant.ErrSetFriendComment.ErrCode, ErrorMsg: constant.ErrSetFriendComment.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(req.Token, req.OperationID, "rpc set friend comment is success return")
|
log.Info(req.Token, req.OperationID, "rpc set friend comment is success return")
|
||||||
return &pbFriend.CommonResp{}, nil
|
return &pbFriend.CommonResp{}, nil
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
@@ -73,17 +74,17 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
groupId string
|
groupId string
|
||||||
)
|
)
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.CreateGroupResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//Time stamp + MD5 to generate group chat id
|
//Time stamp + MD5 to generate group chat id
|
||||||
groupId = utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10))
|
groupId = utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10))
|
||||||
err = im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ex)
|
err = im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("create group chat failed", req.OperationID, "err=%s", err.Error())
|
log.ErrorByKv("create group chat failed", req.OperationID, "err=%s", err.Error())
|
||||||
return &pbGroup.CreateGroupResp{ErrorCode: config.ErrCreateGroup.ErrCode, ErrorMsg: config.ErrCreateGroup.ErrMsg}, nil
|
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
isMagagerFlag := 0
|
isMagagerFlag := 0
|
||||||
@@ -98,18 +99,18 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
|
|||||||
us, err := im_mysql_model.FindUserByUID(claims.UID)
|
us, err := im_mysql_model.FindUserByUID(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", req.OperationID, "find userInfo failed", err.Error())
|
log.Error("", req.OperationID, "find userInfo failed", err.Error())
|
||||||
return &pbGroup.CreateGroupResp{ErrorCode: config.ErrCreateGroup.ErrCode, ErrorMsg: config.ErrCreateGroup.ErrMsg}, nil
|
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
err = im_mysql_model.InsertIntoGroupMember(groupId, claims.UID, us.Name, us.Icon, constant.GroupOwner)
|
err = im_mysql_model.InsertIntoGroupMember(groupId, claims.UID, us.Name, us.Icon, constant.GroupOwner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", req.OperationID, "create group chat failed,err=%s", err.Error())
|
log.Error("", req.OperationID, "create group chat failed,err=%s", err.Error())
|
||||||
return &pbGroup.CreateGroupResp{ErrorCode: config.ErrCreateGroup.ErrCode, ErrorMsg: config.ErrCreateGroup.ErrMsg}, nil
|
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = db.DB.AddGroupMember(groupId, claims.UID)
|
err = db.DB.AddGroupMember(groupId, claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", "create mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
log.Error("", "", "create mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
||||||
return &pbGroup.CreateGroupResp{ErrorCode: config.ErrCreateGroup.ErrCode, ErrorMsg: config.ErrCreateGroup.ErrMsg}, nil
|
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsInfoReq) (*pbGroup.GetGroupsInfoResp, error) {
|
func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsInfoReq) (*pbGroup.GetGroupsInfoResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc get group info is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc get group info is server,args=%s", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.GetGroupsInfoResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.GetGroupsInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info("", req.OperationID, "args:", req.GroupIDList, claims.UID)
|
log.Info("", req.OperationID, "args:", req.GroupIDList, claims.UID)
|
||||||
groupsInfoList := make([]*pbGroup.GroupInfo, 0)
|
groupsInfoList := make([]*pbGroup.GroupInfo, 0)
|
||||||
|
|||||||
+19
-18
@@ -6,6 +6,7 @@ import (
|
|||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
@@ -19,17 +20,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJoinedGroupListReq) (*pbGroup.GetJoinedGroupListResp, error) {
|
func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJoinedGroupListReq) (*pbGroup.GetJoinedGroupListResp, error) {
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.GetJoinedGroupListResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.GetJoinedGroupListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
||||||
|
|
||||||
joinedGroupList, err := imdb.GetJoinedGroupIdListByMemberId(claims.UID)
|
joinedGroupList, err := imdb.GetJoinedGroupIdListByMemberId(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(claims.UID, req.OperationID, "GetJoinedGroupIdListByMemberId failed, err: ", err.Error())
|
log.Error(claims.UID, req.OperationID, "GetJoinedGroupIdListByMemberId failed, err: ", err.Error())
|
||||||
return &pbGroup.GetJoinedGroupListResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
return &pbGroup.GetJoinedGroupListResp{ErrorCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp pbGroup.GetJoinedGroupListResp
|
var resp pbGroup.GetJoinedGroupListResp
|
||||||
@@ -57,23 +58,23 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.InviteUserToGroupReq) (*pbGroup.InviteUserToGroupResp, error) {
|
func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.InviteUserToGroupReq) (*pbGroup.InviteUserToGroupResp, error) {
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.InviteUserToGroupResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
||||||
// if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid
|
// if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid
|
||||||
|
|
||||||
if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||||
log.Error(req.Token, req.OperationID, "err= invite user not in group")
|
log.Error(req.Token, req.OperationID, "err= invite user not in group")
|
||||||
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrAccess.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil
|
return &pbGroup.InviteUserToGroupResp{ErrorCode: constant.ErrAccess.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
groupInfoFromMysql, err := imdb.FindGroupInfoByGroupId(req.GroupID)
|
groupInfoFromMysql, err := imdb.FindGroupInfoByGroupId(req.GroupID)
|
||||||
if err != nil || groupInfoFromMysql == nil {
|
if err != nil || groupInfoFromMysql == nil {
|
||||||
log.NewError(req.OperationID, "get group info error", req.GroupID, req.UidList)
|
log.NewError(req.OperationID, "get group info error", req.GroupID, req.UidList)
|
||||||
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrAccess.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil
|
return &pbGroup.InviteUserToGroupResp{ErrorCode: constant.ErrAccess.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -175,7 +176,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
|
|||||||
resp.ErrorCode = 0
|
resp.ErrorCode = 0
|
||||||
memberList, err := imdb.FindGroupMemberListByGroupId(req.GroupID)
|
memberList, err := imdb.FindGroupMemberListByGroupId(req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.ErrorCode = config.ErrDb.ErrCode
|
resp.ErrorCode = constant.ErrDb.ErrCode
|
||||||
resp.ErrorMsg = err.Error()
|
resp.ErrorMsg = err.Error()
|
||||||
log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed,", err.Error(), req.GroupID)
|
log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed,", err.Error(), req.GroupID)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
@@ -196,10 +197,10 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) {
|
func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) {
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.GetGroupMemberListResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.GetGroupMemberListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
// log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
// log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
||||||
fmt.Println("req: ", req.GroupID)
|
fmt.Println("req: ", req.GroupID)
|
||||||
@@ -207,7 +208,7 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr
|
|||||||
resp.ErrorCode = 0
|
resp.ErrorCode = 0
|
||||||
memberList, err := imdb.GetGroupMemberByGroupId(req.GroupID, req.Filter, req.NextSeq, 30)
|
memberList, err := imdb.GetGroupMemberByGroupId(req.GroupID, req.Filter, req.NextSeq, 30)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.ErrorCode = config.ErrDb.ErrCode
|
resp.ErrorCode = constant.ErrDb.ErrCode
|
||||||
resp.ErrorMsg = err.Error()
|
resp.ErrorMsg = err.Error()
|
||||||
log.Error(claims.UID, req.OperationID, "GetGroupMemberByGroupId failed, ", err.Error(), "params: ", req.GroupID, req.Filter, req.NextSeq)
|
log.Error(claims.UID, req.OperationID, "GetGroupMemberByGroupId failed, ", err.Error(), "params: ", req.GroupID, req.Filter, req.NextSeq)
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
@@ -256,17 +257,17 @@ func (c *kickGroupMemberApiReq) ContentToString() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) {
|
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) {
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.KickGroupMemberResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
||||||
|
|
||||||
ownerList, err := imdb.GetOwnerManagerByGroupId(req.GroupID)
|
ownerList, err := imdb.GetOwnerManagerByGroupId(req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(claims.UID, req.OperationID, req.GroupID, "GetOwnerManagerByGroupId, ", err.Error())
|
log.Error(claims.UID, req.OperationID, req.GroupID, "GetOwnerManagerByGroupId, ", err.Error())
|
||||||
return &pbGroup.KickGroupMemberResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//op is group owner?
|
//op is group owner?
|
||||||
var flag = 0
|
var flag = 0
|
||||||
@@ -285,12 +286,12 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
|||||||
|
|
||||||
if flag != 1 {
|
if flag != 1 {
|
||||||
log.Error(claims.UID, req.OperationID, "no access kick")
|
log.Error(claims.UID, req.OperationID, "no access kick")
|
||||||
return &pbGroup.KickGroupMemberResp{ErrorCode: config.ErrAccess.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil
|
return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrAccess.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(req.UidListInfo) == 0 {
|
if len(req.UidListInfo) == 0 {
|
||||||
log.Error(claims.UID, req.OperationID, "kick list 0")
|
log.Error(claims.UID, req.OperationID, "kick list 0")
|
||||||
return &pbGroup.KickGroupMemberResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil
|
return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//remove
|
//remove
|
||||||
var resp pbGroup.KickGroupMemberResp
|
var resp pbGroup.KickGroupMemberResp
|
||||||
@@ -362,10 +363,10 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) {
|
func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) {
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.GetGroupMembersInfoResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.GetGroupMembersInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.InfoByKv(claims.UID, req.OperationID, "param: ", req.MemberList)
|
log.InfoByKv(claims.UID, req.OperationID, "param: ", req.MemberList)
|
||||||
var resp pbGroup.GetGroupMembersInfoResp
|
var resp pbGroup.GetGroupMembersInfoResp
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.CommonResp, error) {
|
func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.CommonResp, error) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc join group is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc join group is server,args=%s", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
applicationUserInfo, err := im_mysql_model.FindUserByUID(claims.UID)
|
applicationUserInfo, err := im_mysql_model.FindUserByUID(claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "No this user,err=%s", err.Error())
|
log.Error(req.Token, req.OperationID, "No this user,err=%s", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrSearchUserInfo.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = im_mysql_model.FindGroupRequestUserInfoByGroupIDAndUid(req.GroupID, claims.UID)
|
_, err = im_mysql_model.FindGroupRequestUserInfoByGroupIDAndUid(req.GroupID, claims.UID)
|
||||||
@@ -32,7 +32,7 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
|
|||||||
|
|
||||||
if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Name, applicationUserInfo.Icon); err != nil {
|
if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Name, applicationUserInfo.Icon); err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error())
|
log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrJoinGroupApplication.ErrCode, ErrorMsg: config.ErrJoinGroupApplication.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrJoinGroupApplication.ErrCode, ErrorMsg: constant.ErrJoinGroupApplication.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
////Find the the group owner
|
////Find the the group owner
|
||||||
//groupCreatorInfo, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupCreator)
|
//groupCreatorInfo, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupCreator)
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.CommonResp, error) {
|
func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.CommonResp, error) {
|
||||||
log.InfoByArgs("rpc quit group is server,args:", req.String())
|
log.InfoByArgs("rpc quit group is server,args:", req.String())
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
log.InfoByKv("args:", req.OperationID, req.GetGroupID(), claims.UID)
|
log.InfoByKv("args:", req.OperationID, req.GetGroupID(), claims.UID)
|
||||||
//Check to see whether there is a user in the group.
|
//Check to see whether there is a user in the group.
|
||||||
_, err = im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID)
|
_, err = im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "no such group or you are not in the group,err=%s", err.Error(), req.OperationID, req.GroupID, claims.UID)
|
log.Error(req.Token, req.OperationID, "no such group or you are not in the group,err=%s", err.Error(), req.OperationID, req.GroupID, claims.UID)
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrQuitGroup.ErrCode, ErrorMsg: config.ErrQuitGroup.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//After the user's verification is successful, user will quit the group chat.
|
//After the user's verification is successful, user will quit the group chat.
|
||||||
err = im_mysql_model.DeleteGroupMemberByGroupIdAndUserId(req.GroupID, claims.UID)
|
err = im_mysql_model.DeleteGroupMemberByGroupIdAndUserId(req.GroupID, claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByArgs("this user exit the group failed,err=%s", err.Error(), req.OperationID, req.GroupID, claims.UID)
|
log.ErrorByArgs("this user exit the group failed,err=%s", err.Error(), req.OperationID, req.GroupID, claims.UID)
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrQuitGroup.ErrCode, ErrorMsg: config.ErrQuitGroup.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = db.DB.DelGroupMember(req.GroupID, claims.UID)
|
err = db.DB.DelGroupMember(req.GroupID, claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", "delete mongo group member failed, db.DB.DelGroupMember fail [err: %s]", err.Error())
|
log.Error("", "", "delete mongo group member failed, db.DB.DelGroupMember fail [err: %s]", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrQuitGroup.ErrCode, ErrorMsg: config.ErrQuitGroup.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
////Push message when quit group chat
|
////Push message when quit group chat
|
||||||
//jsonInfo, _ := json.Marshal(req)
|
//jsonInfo, _ := json.Marshal(req)
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbGroup "Open_IM/pkg/proto/group"
|
pbGroup "Open_IM/pkg/proto/group"
|
||||||
"Open_IM/pkg/utils"
|
|
||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -14,22 +13,22 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
log.Info(req.Token, req.OperationID, "rpc set group info is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc set group info is server,args=%s", req.String())
|
||||||
|
|
||||||
//Parse token, to find current user information
|
//Parse token, to find current user information
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID)
|
groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", req.OperationID, "your are not in the group,can not change this group info,err=%s", err.Error())
|
log.Error("", req.OperationID, "your are not in the group,can not change this group info,err=%s", err.Error())
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrSetGroupInfo.ErrCode, ErrorMsg: config.ErrSetGroupInfo.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrSetGroupInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
if groupUserInfo.AdministratorLevel == constant.OrdinaryMember {
|
if groupUserInfo.AdministratorLevel == constant.OrdinaryMember {
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrSetGroupInfo.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
//only administrators can set group information
|
//only administrators can set group information
|
||||||
if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil {
|
if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil {
|
||||||
return &pbGroup.CommonResp{ErrorCode: config.ErrSetGroupInfo.ErrCode, ErrorMsg: config.ErrSetGroupInfo.ErrMsg}, nil
|
return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrSetGroupInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
////Push message when set group info
|
////Push message when set group info
|
||||||
//jsonInfo, _ := json.Marshal(req)
|
//jsonInfo, _ := json.Marshal(req)
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s *userServer) SetReceiveMessageOpt(ctx context.Context, req *pbUser.SetReceiveMessageOptReq) (*pbUser.SetReceiveMessageOptResp, error) {
|
||||||
|
m := make(map[string]int, len(req.ConversationId))
|
||||||
|
for _, v := range req.ConversationId {
|
||||||
|
m[v] = int(req.Opt)
|
||||||
|
}
|
||||||
|
err := db.DB.SetMultiConversationMsgOpt(req.UId, m)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "SetMultiConversationMsgOpt failed ", err.Error(), req)
|
||||||
|
return &pbUser.SetReceiveMessageOptResp{ErrCode: constant.DatabaseError, ErrMsg: err.Error()}, nil
|
||||||
|
}
|
||||||
|
var resp pbUser.SetReceiveMessageOptResp
|
||||||
|
resp.ErrCode = 0
|
||||||
|
|
||||||
|
for _, v := range req.ConversationId {
|
||||||
|
resp.OptResult = append(resp.OptResult, &pbUser.OptResult{ConversationId: v, Result: 0})
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "SetReceiveMessageOpt req, resp ", req, resp)
|
||||||
|
return &resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *userServer) GetReceiveMessageOpt(ctx context.Context, req *pbUser.GetReceiveMessageOptReq) (*pbUser.GetReceiveMessageOptResp, error) {
|
||||||
|
m, err := db.DB.GetMultiConversationMsgOpt(req.UId, req.ConversationId)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "GetMultiConversationMsgOpt failed ", err.Error(), req)
|
||||||
|
return &pbUser.GetReceiveMessageOptResp{ErrCode: constant.DatabaseError, ErrMsg: err.Error()}, nil
|
||||||
|
}
|
||||||
|
var resp pbUser.GetReceiveMessageOptResp
|
||||||
|
resp.ErrCode = 0
|
||||||
|
for k, v := range m {
|
||||||
|
resp.ConversationOptResult = append(resp.ConversationOptResult, &pbUser.OptResult{ConversationId: k, Result: int32(v)})
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetReceiveMessageOpt, req, resp", req, resp)
|
||||||
|
return &resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *userServer) GetAllConversationMsgOpt(ctx context.Context, req *pbUser.GetAllConversationMsgOptReq) (*pbUser.GetAllConversationMsgOptResp, error) {
|
||||||
|
m, err := db.DB.GetAllConversationMsgOpt(req.UId)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, "GetAllConversationMsgOpt failed ", err.Error(), req)
|
||||||
|
return &pbUser.GetAllConversationMsgOptResp{ErrCode: constant.DatabaseError, ErrMsg: err.Error()}, nil
|
||||||
|
}
|
||||||
|
var resp pbUser.GetAllConversationMsgOptResp
|
||||||
|
resp.ErrCode = 0
|
||||||
|
for k, v := range m {
|
||||||
|
resp.ConversationOptResult = append(resp.ConversationOptResult, &pbUser.OptResult{ConversationId: k, Result: int32(v)})
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt, req, resp", req, resp)
|
||||||
|
return &resp, nil
|
||||||
|
}
|
||||||
@@ -8,8 +8,10 @@ package user
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
pbUser "Open_IM/pkg/proto/user"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
@@ -18,10 +20,11 @@ import (
|
|||||||
func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq) (*pbUser.DeleteUsersResp, error) {
|
func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq) (*pbUser.DeleteUsersResp, error) {
|
||||||
log.InfoByKv("rpc DeleteUsers arrived server", req.OperationID, "args", req.String())
|
log.InfoByKv("rpc DeleteUsers arrived server", req.OperationID, "args", req.String())
|
||||||
var resp pbUser.DeleteUsersResp
|
var resp pbUser.DeleteUsersResp
|
||||||
c, err := utils.ParseToken(req.Token)
|
var common pbUser.CommonResp
|
||||||
|
c, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("parse token failed", req.OperationID, "err", err.Error())
|
log.ErrorByKv("parse token failed", req.OperationID, "err", err.Error())
|
||||||
return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, FailedUidList: req.DeleteUidList}, nil
|
return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, FailedUidList: req.DeleteUidList}, nil
|
||||||
}
|
}
|
||||||
if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) {
|
if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) {
|
||||||
log.ErrorByKv(" Authentication failed", req.OperationID, "args", c)
|
log.ErrorByKv(" Authentication failed", req.OperationID, "args", c)
|
||||||
@@ -30,21 +33,22 @@ func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq)
|
|||||||
for _, uid := range req.DeleteUidList {
|
for _, uid := range req.DeleteUidList {
|
||||||
err = im_mysql_model.UserDelete(uid)
|
err = im_mysql_model.UserDelete(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.CommonResp.ErrorCode = 201
|
common.ErrorCode = 201
|
||||||
resp.CommonResp.ErrorMsg = "some uid deleted failed"
|
common.ErrorMsg = "some uid deleted failed"
|
||||||
resp.FailedUidList = append(resp.FailedUidList, uid)
|
resp.FailedUidList = append(resp.FailedUidList, uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
resp.CommonResp = &common
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) GetAllUsersUid(_ context.Context, req *pbUser.GetAllUsersUidReq) (*pbUser.GetAllUsersUidResp, error) {
|
func (s *userServer) GetAllUsersUid(_ context.Context, req *pbUser.GetAllUsersUidReq) (*pbUser.GetAllUsersUidResp, error) {
|
||||||
log.InfoByKv("rpc GetAllUsersUid arrived server", req.OperationID, "args", req.String())
|
log.InfoByKv("rpc GetAllUsersUid arrived server", req.OperationID, "args", req.String())
|
||||||
c, err := utils.ParseToken(req.Token)
|
c, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.InfoByKv("parse token failed", req.OperationID, "err", err.Error())
|
log.InfoByKv("parse token failed", req.OperationID, "err", err.Error())
|
||||||
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil
|
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil
|
||||||
}
|
}
|
||||||
if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) {
|
if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) {
|
||||||
log.ErrorByKv(" Authentication failed", req.OperationID, "args", c)
|
log.ErrorByKv(" Authentication failed", req.OperationID, "args", c)
|
||||||
@@ -53,7 +57,7 @@ func (s *userServer) GetAllUsersUid(_ context.Context, req *pbUser.GetAllUsersUi
|
|||||||
uidList, err := im_mysql_model.SelectAllUID()
|
uidList, err := im_mysql_model.SelectAllUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorByKv("db get failed", req.OperationID, "err", err.Error())
|
log.ErrorByKv("db get failed", req.OperationID, "err", err.Error())
|
||||||
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrMysql.ErrCode, ErrorMsg: err.Error()}}, nil
|
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: err.Error()}}, nil
|
||||||
} else {
|
} else {
|
||||||
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 0, ErrorMsg: ""}, UidList: uidList}, nil
|
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 0, ErrorMsg: ""}, UidList: uidList}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
pbFriend "Open_IM/pkg/proto/friend"
|
pbFriend "Open_IM/pkg/proto/friend"
|
||||||
@@ -17,10 +18,10 @@ import (
|
|||||||
|
|
||||||
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) {
|
||||||
log.Info(req.Token, req.OperationID, "rpc modify user is server,args=%s", req.String())
|
log.Info(req.Token, req.OperationID, "rpc modify user is server,args=%s", req.String())
|
||||||
claims, err := utils.ParseToken(req.Token)
|
claims, err := token_verify.ParseToken(req.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||||
return &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, nil
|
return &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ownerUid := ""
|
ownerUid := ""
|
||||||
@@ -34,7 +35,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
|
|||||||
err = im_mysql_model.UpDateUserInfo(ownerUid, req.Name, req.Icon, req.Mobile, req.Birth, req.Email, req.Ex, req.Gender)
|
err = im_mysql_model.UpDateUserInfo(ownerUid, req.Name, req.Icon, req.Mobile, req.Birth, req.Email, req.Ex, req.Gender)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
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: constant.ErrModifyUserInfo.ErrCode, ErrorMsg: constant.ErrModifyUserInfo.ErrMsg}, nil
|
||||||
}
|
}
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
client := pbFriend.NewFriendClient(etcdConn)
|
client := pbFriend.NewFriendClient(etcdConn)
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/common/constant"
|
||||||
|
"Open_IM/pkg/common/token_verify"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ func Test_BuildClaims(t *testing.T) {
|
|||||||
uid := "1"
|
uid := "1"
|
||||||
platform := "PC"
|
platform := "PC"
|
||||||
ttl := int64(-1)
|
ttl := int64(-1)
|
||||||
claim := utils.BuildClaims(uid, platform, ttl)
|
claim := token_verify.BuildClaims(uid, platform, ttl)
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
|
|
||||||
assert.Equal(t, claim.UID, uid, "uid should equal")
|
assert.Equal(t, claim.UID, uid, "uid should equal")
|
||||||
@@ -25,7 +26,7 @@ func Test_BuildClaims(t *testing.T) {
|
|||||||
|
|
||||||
ttl = int64(60)
|
ttl = int64(60)
|
||||||
now = time.Now().Unix()
|
now = time.Now().Unix()
|
||||||
claim = utils.BuildClaims(uid, platform, ttl)
|
claim = token_verify.BuildClaims(uid, platform, ttl)
|
||||||
// time difference within 1s
|
// time difference within 1s
|
||||||
assert.Equal(t, claim.RegisteredClaims.ExpiresAt, int64(60)+now, "StandardClaims.ExpiresAt should be equal")
|
assert.Equal(t, claim.RegisteredClaims.ExpiresAt, int64(60)+now, "StandardClaims.ExpiresAt should be equal")
|
||||||
assert.Equal(t, claim.RegisteredClaims.IssuedAt, now, "StandardClaims.IssuedAt should be equal")
|
assert.Equal(t, claim.RegisteredClaims.IssuedAt, now, "StandardClaims.IssuedAt should be equal")
|
||||||
@@ -37,7 +38,7 @@ func Test_CreateToken(t *testing.T) {
|
|||||||
platform := int32(1)
|
platform := int32(1)
|
||||||
now := time.Now().Unix()
|
now := time.Now().Unix()
|
||||||
|
|
||||||
tokenString, expiresAt, err := utils.CreateToken(uid, platform)
|
tokenString, expiresAt, err := token_verify.CreateToken(uid, platform)
|
||||||
|
|
||||||
assert.NotEmpty(t, tokenString)
|
assert.NotEmpty(t, tokenString)
|
||||||
assert.Equal(t, expiresAt, 604800+now)
|
assert.Equal(t, expiresAt, 604800+now)
|
||||||
@@ -47,36 +48,42 @@ func Test_CreateToken(t *testing.T) {
|
|||||||
func Test_VerifyToken(t *testing.T) {
|
func Test_VerifyToken(t *testing.T) {
|
||||||
uid := "1"
|
uid := "1"
|
||||||
platform := int32(1)
|
platform := int32(1)
|
||||||
tokenString, _, _ := utils.CreateToken(uid, platform)
|
tokenString, _, _ := token_verify.CreateToken(uid, platform)
|
||||||
result := utils.VerifyToken(tokenString, uid)
|
result, _ := token_verify.VerifyToken(tokenString, uid)
|
||||||
assert.True(t, result)
|
assert.True(t, result)
|
||||||
result = utils.VerifyToken(tokenString, "2")
|
result, _ = token_verify.VerifyToken(tokenString, "2")
|
||||||
assert.False(t, result)
|
assert.False(t, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ParseRedisInterfaceToken(t *testing.T) {
|
func Test_ParseRedisInterfaceToken(t *testing.T) {
|
||||||
uid := "1"
|
uid := "1"
|
||||||
platform := int32(1)
|
platform := int32(1)
|
||||||
tokenString, _, _ := utils.CreateToken(uid, platform)
|
tokenString, _, _ := token_verify.CreateToken(uid, platform)
|
||||||
|
|
||||||
claims, err := utils.ParseRedisInterfaceToken([]uint8(tokenString))
|
claims, err := token_verify.ParseRedisInterfaceToken([]uint8(tokenString))
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, claims.UID, uid)
|
assert.Equal(t, claims.UID, uid)
|
||||||
|
|
||||||
// timeout
|
// timeout
|
||||||
config.Config.TokenPolicy.AccessExpire = -80
|
config.Config.TokenPolicy.AccessExpire = -80
|
||||||
tokenString, _, _ = utils.CreateToken(uid, platform)
|
tokenString, _, _ = token_verify.CreateToken(uid, platform)
|
||||||
claims, err = utils.ParseRedisInterfaceToken([]uint8(tokenString))
|
claims, err = token_verify.ParseRedisInterfaceToken([]uint8(tokenString))
|
||||||
assert.Equal(t, err, utils.TokenExpired)
|
assert.Equal(t, err, constant.TokenExpired)
|
||||||
assert.Nil(t, claims)
|
assert.Nil(t, claims)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_ParseToken(t *testing.T) {
|
func Test_ParseToken(t *testing.T) {
|
||||||
uid := "1"
|
uid := "1"
|
||||||
platform := int32(1)
|
platform := int32(1)
|
||||||
tokenString, _, _ := utils.CreateToken(uid, platform)
|
tokenString, _, _ := token_verify.CreateToken(uid, platform)
|
||||||
claims, err := utils.ParseToken(tokenString)
|
claims, err := token_verify.ParseToken(tokenString)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
assert.Equal(t, claims.UID, uid)
|
assert.Equal(t, claims.UID, uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func Test_GetClaimFromToken(t *testing.T) {
|
||||||
|
token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVSUQiOiJvcGVuSU0xMjM0NTYiLCJQbGF0Zm9ybSI6IiIsImV4cCI6MTYzODg0NjQ3NiwibmJmIjoxNjM4MjQxNjc2LCJpYXQiOjE2MzgyNDE2NzZ9.W8RZB7ec5ySFj-rGE2Aho2z32g3MprQMdCyPiQu_C2I"
|
||||||
|
c, err := token_verify.GetClaimFromToken(token)
|
||||||
|
assert.Nil(t, c)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,46 +1,46 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/common/constant"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_PlatformIDToName(t *testing.T) {
|
func Test_PlatformIDToName(t *testing.T) {
|
||||||
assert.Equal(t, utils.PlatformIDToName(1), "IOS")
|
assert.Equal(t, constant.PlatformIDToName(1), "IOS")
|
||||||
assert.Equal(t, utils.PlatformIDToName(2), "Android")
|
assert.Equal(t, constant.PlatformIDToName(2), "Android")
|
||||||
assert.Equal(t, utils.PlatformIDToName(3), "Windows")
|
assert.Equal(t, constant.PlatformIDToName(3), "Windows")
|
||||||
assert.Equal(t, utils.PlatformIDToName(4), "OSX")
|
assert.Equal(t, constant.PlatformIDToName(4), "OSX")
|
||||||
assert.Equal(t, utils.PlatformIDToName(5), "Web")
|
assert.Equal(t, constant.PlatformIDToName(5), "Web")
|
||||||
assert.Equal(t, utils.PlatformIDToName(6), "MiniWeb")
|
assert.Equal(t, constant.PlatformIDToName(6), "MiniWeb")
|
||||||
assert.Equal(t, utils.PlatformIDToName(7), "Linux")
|
assert.Equal(t, constant.PlatformIDToName(7), "Linux")
|
||||||
|
|
||||||
assert.Equal(t, utils.PlatformIDToName(0), "")
|
assert.Equal(t, constant.PlatformIDToName(0), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_PlatformNameToID(t *testing.T) {
|
func Test_PlatformNameToID(t *testing.T) {
|
||||||
assert.Equal(t, utils.PlatformNameToID("IOS"), int32(1))
|
assert.Equal(t, constant.PlatformNameToID("IOS"), int32(1))
|
||||||
assert.Equal(t, utils.PlatformNameToID("Android"), int32(2))
|
assert.Equal(t, constant.PlatformNameToID("Android"), int32(2))
|
||||||
assert.Equal(t, utils.PlatformNameToID("Windows"), int32(3))
|
assert.Equal(t, constant.PlatformNameToID("Windows"), int32(3))
|
||||||
assert.Equal(t, utils.PlatformNameToID("OSX"), int32(4))
|
assert.Equal(t, constant.PlatformNameToID("OSX"), int32(4))
|
||||||
assert.Equal(t, utils.PlatformNameToID("Web"), int32(5))
|
assert.Equal(t, constant.PlatformNameToID("Web"), int32(5))
|
||||||
assert.Equal(t, utils.PlatformNameToID("MiniWeb"), int32(6))
|
assert.Equal(t, constant.PlatformNameToID("MiniWeb"), int32(6))
|
||||||
assert.Equal(t, utils.PlatformNameToID("Linux"), int32(7))
|
assert.Equal(t, constant.PlatformNameToID("Linux"), int32(7))
|
||||||
|
|
||||||
assert.Equal(t, utils.PlatformNameToID("UnknownDevice"), int32(0))
|
assert.Equal(t, constant.PlatformNameToID("UnknownDevice"), int32(0))
|
||||||
assert.Equal(t, utils.PlatformNameToID(""), int32(0))
|
assert.Equal(t, constant.PlatformNameToID(""), int32(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_PlatformNameToClass(t *testing.T) {
|
func Test_PlatformNameToClass(t *testing.T) {
|
||||||
assert.Equal(t, utils.PlatformNameToClass("IOS"), "Mobile")
|
assert.Equal(t, constant.PlatformNameToClass("IOS"), "Mobile")
|
||||||
assert.Equal(t, utils.PlatformNameToClass("Android"), "Mobile")
|
assert.Equal(t, constant.PlatformNameToClass("Android"), "Mobile")
|
||||||
assert.Equal(t, utils.PlatformNameToClass("OSX"), "PC")
|
assert.Equal(t, constant.PlatformNameToClass("OSX"), "PC")
|
||||||
assert.Equal(t, utils.PlatformNameToClass("Windows"), "PC")
|
assert.Equal(t, constant.PlatformNameToClass("Windows"), "PC")
|
||||||
assert.Equal(t, utils.PlatformNameToClass("Web"), "PC")
|
assert.Equal(t, constant.PlatformNameToClass("Web"), "PC")
|
||||||
assert.Equal(t, utils.PlatformNameToClass("MiniWeb"), "Mobile")
|
assert.Equal(t, constant.PlatformNameToClass("MiniWeb"), "Mobile")
|
||||||
assert.Equal(t, utils.PlatformNameToClass("Linux"), "PC")
|
assert.Equal(t, constant.PlatformNameToClass("Linux"), "PC")
|
||||||
|
|
||||||
assert.Equal(t, utils.PlatformNameToClass("UnknownDevice"), "")
|
assert.Equal(t, constant.PlatformNameToClass("UnknownDevice"), "")
|
||||||
assert.Equal(t, utils.PlatformNameToClass(""), "")
|
assert.Equal(t, constant.PlatformNameToClass(""), "")
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-10
@@ -145,18 +145,32 @@ type config struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Secret string `yaml:"secret"`
|
Secret string `yaml:"secret"`
|
||||||
MultiLoginPolicy struct {
|
MultiLoginPolicy int `yaml:"multiloginpolicy"`
|
||||||
OnlyOneTerminalAccess bool `yaml:"onlyOneTerminalAccess"`
|
TokenPolicy struct {
|
||||||
MobileAndPCTerminalAccessButOtherTerminalKickEachOther bool `yaml:"mobileAndPCTerminalAccessButOtherTerminalKickEachOther"`
|
|
||||||
AllTerminalAccess bool `yaml:"allTerminalAccess"`
|
|
||||||
}
|
|
||||||
TokenPolicy struct {
|
|
||||||
AccessSecret string `yaml:"accessSecret"`
|
AccessSecret string `yaml:"accessSecret"`
|
||||||
AccessExpire int64 `yaml:"accessExpire"`
|
AccessExpire int64 `yaml:"accessExpire"`
|
||||||
}
|
}
|
||||||
MessageCallBack struct {
|
MessageCallBack struct {
|
||||||
CallbackSwitch bool `yaml:"callbackSwitch"`
|
CallbackSwitch bool `yaml:"callbackSwitch"`
|
||||||
CallbackUrl string `yaml:"callbackUrl"`
|
CallbackUrl string `yaml:"callbackUrl"`
|
||||||
|
CallBackTimeOut int `yaml:"callbackTimeOut"`
|
||||||
|
}
|
||||||
|
Demo struct {
|
||||||
|
Port []int `yaml:"openImDemoPort"`
|
||||||
|
AliSMSVerify struct {
|
||||||
|
AccessKeyID string `yaml:"accessKeyId"`
|
||||||
|
AccessKeySecret string `yaml:"accessKeySecret"`
|
||||||
|
SignName string `yaml:"signName"`
|
||||||
|
VerificationCodeTemplateCode string `yaml:"verificationCodeTemplateCode"`
|
||||||
|
}
|
||||||
|
SuperCode string `yaml:"superCode"`
|
||||||
|
Mail struct {
|
||||||
|
Title string `yaml:"title"`
|
||||||
|
SenderMail string `yaml:"senderMail"`
|
||||||
|
SenderAuthorizationCode string `yaml:"senderAuthorizationCode"`
|
||||||
|
SmtpAddr string `yaml:"smtpAddr"`
|
||||||
|
SmtpPort int `yaml:"smtpPort"`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,10 +181,10 @@ func init() {
|
|||||||
// it will panic cannot find config/config.yaml
|
// it will panic cannot find config/config.yaml
|
||||||
bytes, err := ioutil.ReadFile(Root + "/config/config.yaml")
|
bytes, err := ioutil.ReadFile(Root + "/config/config.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
if err = yaml.Unmarshal(bytes, &Config); err != nil {
|
if err = yaml.Unmarshal(bytes, &Config); err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const (
|
|||||||
WSSendMsg = 1003
|
WSSendMsg = 1003
|
||||||
WSPullMsgBySeqList = 1004
|
WSPullMsgBySeqList = 1004
|
||||||
WSPushMsg = 2001
|
WSPushMsg = 2001
|
||||||
|
WSKickOnlineMsg = 2002
|
||||||
WSDataError = 3001
|
WSDataError = 3001
|
||||||
|
|
||||||
///ContentType
|
///ContentType
|
||||||
@@ -32,9 +33,13 @@ const (
|
|||||||
Video = 104
|
Video = 104
|
||||||
File = 105
|
File = 105
|
||||||
AtText = 106
|
AtText = 106
|
||||||
|
Merger = 107
|
||||||
|
Card = 108
|
||||||
|
Location = 109
|
||||||
Custom = 110
|
Custom = 110
|
||||||
HasReadReceipt = 112
|
HasReadReceipt = 112
|
||||||
Typing = 113
|
Typing = 113
|
||||||
|
Quote = 114
|
||||||
Common = 200
|
Common = 200
|
||||||
GroupMsg = 201
|
GroupMsg = 201
|
||||||
|
|
||||||
@@ -66,6 +71,29 @@ const (
|
|||||||
//SessionType
|
//SessionType
|
||||||
SingleChatType = 1
|
SingleChatType = 1
|
||||||
GroupChatType = 2
|
GroupChatType = 2
|
||||||
|
//token
|
||||||
|
NormalToken = 0
|
||||||
|
InValidToken = 1
|
||||||
|
KickedToken = 2
|
||||||
|
ExpiredToken = 3
|
||||||
|
|
||||||
|
//MultiTerminalLogin
|
||||||
|
//全端登录,但是同端互斥
|
||||||
|
AllLoginButSameTermKick = 1
|
||||||
|
//所有端中只能有一端能够登录
|
||||||
|
SingleTerminalLogin = 2
|
||||||
|
//web端可以同时在线,其他端只能有一端登录
|
||||||
|
WebAndOther = 3
|
||||||
|
//Pc端互斥,移动端互斥,但是web端可以同时在线
|
||||||
|
PcMobileAndWeb = 4
|
||||||
|
|
||||||
|
OnlineStatus = "online"
|
||||||
|
OfflineStatus = "offline"
|
||||||
|
|
||||||
|
//MsgReceiveOpt
|
||||||
|
ReceiveMessage = 0
|
||||||
|
NotReceiveMessage = 1
|
||||||
|
ReceiveNotNotifyMessage = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
var ContentType2PushContent = map[int64]string{
|
var ContentType2PushContent = map[int64]string{
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
package config
|
package constant
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
// key = errCode, string = errMsg
|
// key = errCode, string = errMsg
|
||||||
type ErrInfo struct {
|
type ErrInfo struct {
|
||||||
@@ -20,8 +22,6 @@ var (
|
|||||||
ErrorUserRegister = ErrInfo{600, "User registration failed"}
|
ErrorUserRegister = ErrInfo{600, "User registration failed"}
|
||||||
ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"}
|
ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"}
|
||||||
ErrUserPassword = ErrInfo{602, "User password error"}
|
ErrUserPassword = ErrInfo{602, "User password error"}
|
||||||
ErrTokenIncorrect = ErrInfo{603, "Invalid token"}
|
|
||||||
ErrTokenExpired = ErrInfo{604, "Expired token"}
|
|
||||||
ErrRefreshToken = ErrInfo{605, "Failed to refresh token"}
|
ErrRefreshToken = ErrInfo{605, "Failed to refresh token"}
|
||||||
ErrAddFriend = ErrInfo{606, "Failed to add friends"}
|
ErrAddFriend = ErrInfo{606, "Failed to add friends"}
|
||||||
ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"}
|
ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"}
|
||||||
@@ -40,9 +40,37 @@ var (
|
|||||||
ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"}
|
ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"}
|
||||||
ErrQuitGroup = ErrInfo{621, "Failed to quit the group"}
|
ErrQuitGroup = ErrInfo{621, "Failed to quit the group"}
|
||||||
ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"}
|
ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"}
|
||||||
ErrParam = ErrInfo{ErrCode: 700, ErrMsg: "param failed"}
|
ErrParam = ErrInfo{700, "param failed"}
|
||||||
|
ErrTokenExpired = ErrInfo{701, TokenExpired.Error()}
|
||||||
|
ErrTokenInvalid = ErrInfo{702, TokenInvalid.Error()}
|
||||||
|
ErrTokenMalformed = ErrInfo{703, TokenMalformed.Error()}
|
||||||
|
ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYet.Error()}
|
||||||
|
ErrTokenUnknown = ErrInfo{705, TokenUnknown.Error()}
|
||||||
|
|
||||||
ErrAccess = ErrInfo{ErrCode: 800, ErrMsg: "no permission"}
|
ErrAccess = ErrInfo{ErrCode: 800, ErrMsg: "no permission"}
|
||||||
|
|
||||||
ErrDb = ErrInfo{ErrCode: 900, ErrMsg: "db failed"}
|
ErrDb = ErrInfo{ErrCode: 900, ErrMsg: "db failed"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
TokenExpired = errors.New("token is timed out, please log in again")
|
||||||
|
TokenInvalid = errors.New("token has been invalidated")
|
||||||
|
TokenNotValidYet = errors.New("token not active yet")
|
||||||
|
TokenMalformed = errors.New("that's not even a token")
|
||||||
|
TokenUnknown = errors.New("couldn't handle this token")
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
NoError = 0
|
||||||
|
FormattingError = 10001
|
||||||
|
DatabaseError = 10002
|
||||||
|
LogicalError = 10003
|
||||||
|
ServerError = 10004
|
||||||
|
HttpError = 10005
|
||||||
|
IoErrot = 10006
|
||||||
|
IntentionalError = 10007
|
||||||
|
)
|
||||||
|
|
||||||
|
func (e *ErrInfo) Error() string {
|
||||||
|
return e.ErrMsg
|
||||||
|
}
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package utils
|
package constant
|
||||||
|
|
||||||
// fixme 1<--->IOS 2<--->Android 3<--->Windows
|
// fixme 1<--->IOS 2<--->Android 3<--->Windows
|
||||||
//fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
|
//fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux
|
||||||
@@ -48,10 +48,10 @@ var PlatformName2ID = map[string]int32{
|
|||||||
var Platform2class = map[string]string{
|
var Platform2class = map[string]string{
|
||||||
IOSPlatformStr: TerminalMobile,
|
IOSPlatformStr: TerminalMobile,
|
||||||
AndroidPlatformStr: TerminalMobile,
|
AndroidPlatformStr: TerminalMobile,
|
||||||
MiniWebPlatformStr: TerminalMobile,
|
MiniWebPlatformStr: WebPlatformStr,
|
||||||
|
WebPlatformStr: WebPlatformStr,
|
||||||
WindowsPlatformStr: TerminalPC,
|
WindowsPlatformStr: TerminalPC,
|
||||||
OSXPlatformStr: TerminalPC,
|
OSXPlatformStr: TerminalPC,
|
||||||
WebPlatformStr: TerminalPC,
|
|
||||||
LinuxPlatformStr: TerminalPC,
|
LinuxPlatformStr: TerminalPC,
|
||||||
}
|
}
|
||||||
|
|
||||||
+12
-2
@@ -2,6 +2,7 @@ package db
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
"gopkg.in/mgo.v2"
|
"gopkg.in/mgo.v2"
|
||||||
"time"
|
"time"
|
||||||
@@ -20,6 +21,8 @@ func key(dbAddress, dbName string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
var mgoSession *mgo.Session
|
||||||
|
var err1 error
|
||||||
//mysql init
|
//mysql init
|
||||||
initMysqlDB()
|
initMysqlDB()
|
||||||
// mongo init
|
// mongo init
|
||||||
@@ -35,14 +38,21 @@ func init() {
|
|||||||
}
|
}
|
||||||
mgoSession, err := mgo.DialWithInfo(mgoDailInfo)
|
mgoSession, err := mgo.DialWithInfo(mgoDailInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.NewError("mgo init err", err.Error(), mgoDailInfo)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
time.Sleep(time.Duration(30) * time.Second)
|
||||||
|
mgoSession, err1 = mgo.DialWithInfo(mgoDailInfo)
|
||||||
|
if err1 != nil {
|
||||||
|
panic(err1.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DB.mgoSession = mgoSession
|
DB.mgoSession = mgoSession
|
||||||
DB.mgoSession.SetMode(mgo.Monotonic, true)
|
DB.mgoSession.SetMode(mgo.Monotonic, true)
|
||||||
c := DB.mgoSession.DB(config.Config.Mongo.DBDatabase).C(cChat)
|
c := DB.mgoSession.DB(config.Config.Mongo.DBDatabase).C(cChat)
|
||||||
err = c.EnsureIndexKey("uid")
|
err = c.EnsureIndexKey("uid")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// redis pool init
|
// redis pool init
|
||||||
|
|||||||
@@ -198,14 +198,14 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu
|
|||||||
return errors.New("session == nil")
|
return errors.New("session == nil")
|
||||||
}
|
}
|
||||||
defer session.Close()
|
defer session.Close()
|
||||||
log.NewInfo("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime)
|
log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime)
|
||||||
c := session.DB(config.Config.Mongo.DBDatabase).C(cChat)
|
c := session.DB(config.Config.Mongo.DBDatabase).C(cChat)
|
||||||
seqUid = getSeqUid(uid, m.RecvSeq)
|
seqUid = getSeqUid(uid, m.RecvSeq)
|
||||||
n, err := c.Find(bson.M{"uid": seqUid}).Count()
|
n, err := c.Find(bson.M{"uid": seqUid}).Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.NewInfo("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime)
|
log.NewDebug("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime)
|
||||||
sMsg := MsgInfo{}
|
sMsg := MsgInfo{}
|
||||||
sMsg.SendTime = sendTime
|
sMsg.SendTime = sendTime
|
||||||
if sMsg.Msg, err = proto.Marshal(m); err != nil {
|
if sMsg.Msg, err = proto.Marshal(m); err != nil {
|
||||||
@@ -225,7 +225,7 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.NewInfo("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime)
|
log.NewDebug("", "insert mgo data cost time", getCurrentTimestampByMill()-newTime)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+30
-14
@@ -19,18 +19,24 @@ func initMysqlDB() {
|
|||||||
//When there is no open IM database, connect to the mysql built-in database to create openIM database
|
//When there is no open IM database, connect to the mysql built-in database to create openIM database
|
||||||
dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local",
|
dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local",
|
||||||
config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], "mysql")
|
config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], "mysql")
|
||||||
|
var db *gorm.DB
|
||||||
|
var err1 error
|
||||||
db, err := gorm.Open("mysql", dsn)
|
db, err := gorm.Open("mysql", dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "", dsn)
|
log.Error("", "", dsn)
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
time.Sleep(time.Duration(30) * time.Second)
|
||||||
|
db, err1 = gorm.Open("mysql", dsn)
|
||||||
|
if err1 != nil {
|
||||||
|
panic(err1.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
//Check the database and table during initialization
|
//Check the database and table during initialization
|
||||||
sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s ;", config.Config.Mysql.DBDatabaseName)
|
sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s ;", config.Config.Mysql.DBDatabaseName)
|
||||||
err = db.Exec(sql).Error
|
err = db.Exec(sql).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
db.Close()
|
db.Close()
|
||||||
|
|
||||||
@@ -38,7 +44,7 @@ func initMysqlDB() {
|
|||||||
config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], config.Config.Mysql.DBDatabaseName)
|
config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], config.Config.Mysql.DBDatabaseName)
|
||||||
db, err = gorm.Open("mysql", dsn)
|
db, err = gorm.Open("mysql", dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable := "CREATE TABLE IF NOT EXISTS `user` (" +
|
sqlTable := "CREATE TABLE IF NOT EXISTS `user` (" +
|
||||||
@@ -56,7 +62,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `friend` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `friend` (" +
|
||||||
@@ -69,7 +75,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `friend_request` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `friend_request` (" +
|
||||||
@@ -82,7 +88,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `black_list` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `black_list` (" +
|
||||||
@@ -94,7 +100,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `user_black_list` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `user_black_list` (" +
|
||||||
@@ -105,7 +111,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `group` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `group` (" +
|
||||||
@@ -120,7 +126,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `group_member` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `group_member` (" +
|
||||||
@@ -134,7 +140,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `group_request` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `group_request` (" +
|
||||||
@@ -155,7 +161,7 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4;"
|
" ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlTable = "CREATE TABLE IF NOT EXISTS `chat_log` (" +
|
sqlTable = "CREATE TABLE IF NOT EXISTS `chat_log` (" +
|
||||||
@@ -173,7 +179,17 @@ func initMysqlDB() {
|
|||||||
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;"
|
||||||
err = db.Exec(sqlTable).Error
|
err = db.Exec(sqlTable).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlTable = "CREATE TABLE IF NOT EXISTS `register` (" +
|
||||||
|
" `account` varchar(255) NOT NULL," +
|
||||||
|
" `password` varchar(255) NOT NULL," +
|
||||||
|
" PRIMARY KEY (`account`) USING BTREE" +
|
||||||
|
" ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;"
|
||||||
|
err = db.Exec(sqlTable).Error
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package im_mysql_model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/db"
|
||||||
|
_ "github.com/jinzhu/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetRegisterParams struct {
|
||||||
|
Account string `json:"account"`
|
||||||
|
}
|
||||||
|
type Register struct {
|
||||||
|
Account string `gorm:"column:account"`
|
||||||
|
Password string `gorm:"column:password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRegister(params *GetRegisterParams) (Register, error, int64) {
|
||||||
|
var r Register
|
||||||
|
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||||
|
if err != nil {
|
||||||
|
return r, err, 0
|
||||||
|
}
|
||||||
|
result := dbConn.
|
||||||
|
Where(&Register{Account: params.Account}).
|
||||||
|
Find(&r)
|
||||||
|
return r, result.Error, result.RowsAffected
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetPasswordParams struct {
|
||||||
|
Account string `json:"account"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetPassword(params *SetPasswordParams) (Register, error) {
|
||||||
|
r := Register{
|
||||||
|
Account: params.Account,
|
||||||
|
Password: params.Password,
|
||||||
|
}
|
||||||
|
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||||
|
if err != nil {
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result := dbConn.Create(&r)
|
||||||
|
|
||||||
|
return r, result.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func Login(params *Register) int64 {
|
||||||
|
var r Register
|
||||||
|
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||||
|
if err != nil {
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
result := dbConn.
|
||||||
|
Where(&Register{Account: params.Account}).
|
||||||
|
Find(&r)
|
||||||
|
if result.Error != nil && result.RowsAffected == 0 {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
if r.Password != params.Password {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
@@ -63,7 +63,7 @@ func FindGroupMemberInfoByGroupIdAndUserId(groupId, uid string) (*GroupMember, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var groupMember GroupMember
|
var groupMember GroupMember
|
||||||
err = dbConn.Raw("select * from `group_member` where group_id=? and uid=? limit 1", groupId, uid).Scan(&groupMember).Error
|
err = dbConn.Raw("select * from `group_member` where group_id=? and uid=? limit 1", groupId, uid).Find(&groupMember).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,10 @@ func SelectAllUID() ([]string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return uid, err
|
return uid, err
|
||||||
}
|
}
|
||||||
rows, _ := dbConn.Raw("select uid from user").Rows()
|
rows, err := dbConn.Raw("select uid from user").Rows()
|
||||||
|
if err != nil {
|
||||||
|
return uid, err
|
||||||
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
var strUID string
|
var strUID string
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
|||||||
+50
-32
@@ -1,15 +1,17 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
log2 "Open_IM/pkg/common/log"
|
log2 "Open_IM/pkg/common/log"
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
userIncrSeq = "REDIS_USER_INCR_SEQ:" // user incr seq
|
userIncrSeq = "REDIS_USER_INCR_SEQ:" // user incr seq
|
||||||
appleDeviceToken = "DEVICE_TOKEN"
|
appleDeviceToken = "DEVICE_TOKEN"
|
||||||
lastGetSeq = "LAST_GET_SEQ"
|
userMinSeq = "REDIS_USER_MIN_SEQ:"
|
||||||
userMinSeq = "REDIS_USER_MIN_SEQ:"
|
uidPidToken = "UID_PID_TOKEN_STATUS:"
|
||||||
|
conversationReceiveMessageOpt = "CON_RECV_MSG_OPT:"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
||||||
@@ -71,36 +73,52 @@ func (d *DataBases) DelAppleDeviceToken(accountAddress string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//Record the last time the user actively pulled the value of Seq
|
|
||||||
func (d *DataBases) SetLastGetSeq(uid string) (err error) {
|
|
||||||
key := lastGetSeq + uid
|
|
||||||
_, err = d.Exec("SET", key)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get the value of the user's last active pull Seq
|
|
||||||
func (d *DataBases) GetLastGetSeq(uid string) (int64, error) {
|
|
||||||
key := lastGetSeq + uid
|
|
||||||
return redis.Int64(d.Exec("GET", key))
|
|
||||||
}
|
|
||||||
|
|
||||||
//Store userid and platform class to redis
|
//Store userid and platform class to redis
|
||||||
func (d *DataBases) SetUserIDAndPlatform(userID, platformClass, value string, ttl int64) error {
|
func (d *DataBases) AddTokenFlag(userID string, platformID int32, token string, flag int) error {
|
||||||
key := userID + platformClass
|
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
|
||||||
_, err := d.Exec("SET", key, value, "EX", ttl)
|
log2.NewDebug("", "add token key is ", key)
|
||||||
|
_, err1 := d.Exec("HSet", key, token, flag)
|
||||||
|
return err1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DataBases) GetTokenMapByUidPid(userID, platformID string) (map[string]int, error) {
|
||||||
|
key := uidPidToken + userID + ":" + platformID
|
||||||
|
log2.NewDebug("", "get token key is ", key)
|
||||||
|
return redis.IntMap(d.Exec("HGETALL", key))
|
||||||
|
}
|
||||||
|
func (d *DataBases) SetTokenMapByUidPid(userID string, platformID int32, m map[string]int) error {
|
||||||
|
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
|
||||||
|
_, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
func (d *DataBases) SetSingleConversationMsgOpt(userID, conversationID string, opt int) error {
|
||||||
//Check exists userid and platform class from redis
|
key := conversationReceiveMessageOpt + userID
|
||||||
func (d *DataBases) ExistsUserIDAndPlatform(userID, platformClass string) (interface{}, error) {
|
_, err1 := d.Exec("HSet", key, conversationID, opt)
|
||||||
key := userID + platformClass
|
return err1
|
||||||
exists, err := d.Exec("EXISTS", key)
|
|
||||||
return exists, err
|
|
||||||
}
|
}
|
||||||
|
func (d *DataBases) GetSingleConversationMsgOpt(userID, conversationID string) (int, error) {
|
||||||
//Get platform class Token
|
key := conversationReceiveMessageOpt + userID
|
||||||
func (d *DataBases) GetPlatformToken(userID, platformClass string) (interface{}, error) {
|
return redis.Int(d.Exec("HGet", key, conversationID))
|
||||||
key := userID + platformClass
|
}
|
||||||
token, err := d.Exec("GET", key)
|
func (d *DataBases) GetAllConversationMsgOpt(userID string) (map[string]int, error) {
|
||||||
return token, err
|
key := conversationReceiveMessageOpt + userID
|
||||||
|
return redis.IntMap(d.Exec("HGETALL", key))
|
||||||
|
}
|
||||||
|
func (d *DataBases) SetMultiConversationMsgOpt(userID string, m map[string]int) error {
|
||||||
|
key := conversationReceiveMessageOpt + userID
|
||||||
|
_, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
func (d *DataBases) GetMultiConversationMsgOpt(userID string, conversationIDs []string) (m map[string]int, err error) {
|
||||||
|
m = make(map[string]int)
|
||||||
|
key := conversationReceiveMessageOpt + userID
|
||||||
|
i, err := redis.Ints(d.Exec("hmget", key, redis.Args{}.Add().AddFlat(conversationIDs)...))
|
||||||
|
if err != nil {
|
||||||
|
return m, err
|
||||||
|
}
|
||||||
|
for k, v := range conversationIDs {
|
||||||
|
m[v] = i[k]
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_SetTokenMapByUidPid(t *testing.T) {
|
||||||
|
m := make(map[string]int, 0)
|
||||||
|
m["test1"] = 1
|
||||||
|
m["test2"] = 2
|
||||||
|
m["2332"] = 4
|
||||||
|
_ = DB.SetTokenMapByUidPid("1234", 2, m)
|
||||||
|
|
||||||
|
}
|
||||||
|
func Test_GetTokenMapByUidPid(t *testing.T) {
|
||||||
|
m, err := DB.GetTokenMapByUidPid("1234", "Android")
|
||||||
|
assert.Nil(t, err)
|
||||||
|
fmt.Println(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDataBases_GetMultiConversationMsgOpt(t *testing.T) {
|
||||||
|
m, err := DB.GetMultiConversationMsgOpt("fg", []string{"user", "age", "color"})
|
||||||
|
assert.Nil(t, err)
|
||||||
|
fmt.Println(m)
|
||||||
|
}
|
||||||
@@ -29,22 +29,24 @@ func Get(url string) (response []byte, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//application/json; charset=utf-8
|
//application/json; charset=utf-8
|
||||||
func Post(url string, data interface{}, contentType string) (content []byte, err error) {
|
func Post(url string, data interface{}, timeOutSecond int) (content []byte, err error) {
|
||||||
jsonStr, _ := json.Marshal(data)
|
jsonStr, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
|
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req.Header.Add("content-type", contentType)
|
req.Close = true
|
||||||
defer req.Body.Close()
|
req.Header.Add("content-type", "application/json; charset=utf-8")
|
||||||
|
|
||||||
client := &http.Client{Timeout: 5 * time.Second}
|
client := &http.Client{Timeout: time.Duration(timeOutSecond) * time.Second}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
result, err := ioutil.ReadAll(resp.Body)
|
result, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ func NewKafkaConsumer(addr []string, topic string) *Consumer {
|
|||||||
|
|
||||||
consumer, err := sarama.NewConsumer(p.addr, nil)
|
consumer, err := sarama.NewConsumer(p.addr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
p.Consumer = consumer
|
p.Consumer = consumer
|
||||||
|
|
||||||
partitionList, err := consumer.Partitions(p.Topic)
|
partitionList, err := consumer.Partitions(p.Topic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
p.PartitionList = partitionList
|
p.PartitionList = partitionList
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ func NewMConsumerGroup(consumerConfig *MConsumerGroupConfig, topics, addr []stri
|
|||||||
config.Consumer.Return.Errors = consumerConfig.IsReturnErr
|
config.Consumer.Return.Errors = consumerConfig.IsReturnErr
|
||||||
client, err := sarama.NewClient(addr, config)
|
client, err := sarama.NewClient(addr, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
consumerGroup, err := sarama.NewConsumerGroupFromClient(groupID, client)
|
consumerGroup, err := sarama.NewConsumerGroupFromClient(groupID, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
return &MConsumerGroup{
|
return &MConsumerGroup{
|
||||||
consumerGroup,
|
consumerGroup,
|
||||||
@@ -47,7 +47,7 @@ func (mc *MConsumerGroup) RegisterHandleAndConsumer(handler sarama.ConsumerGroup
|
|||||||
for {
|
for {
|
||||||
err := mc.ConsumerGroup.Consume(ctx, mc.topics, handler)
|
err := mc.ConsumerGroup.Consume(ctx, mc.topics, handler)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func NewKafkaProducer(addr []string, topic string) *Producer {
|
|||||||
|
|
||||||
producer, err := sarama.NewSyncProducer(p.addr, p.config) //Initialize the client
|
producer, err := sarama.NewSyncProducer(p.addr, p.config) //Initialize the client
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
p.producer = producer
|
p.producer = producer
|
||||||
|
|||||||
@@ -61,19 +61,18 @@ func newEsHook(moduleName string) *esHook {
|
|||||||
return &esHook{client: es, moduleName: moduleName}
|
return &esHook{client: es, moduleName: moduleName}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fire log hook interface 方法
|
//Fire log hook interface
|
||||||
func (hook *esHook) Fire(entry *logrus.Entry) error {
|
func (hook *esHook) Fire(entry *logrus.Entry) error {
|
||||||
doc := newEsLog(entry)
|
doc := newEsLog(entry)
|
||||||
go hook.sendEs(doc)
|
go hook.sendEs(doc)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//Levels log hook interface 方法,此hook影响的日志
|
|
||||||
func (hook *esHook) Levels() []logrus.Level {
|
func (hook *esHook) Levels() []logrus.Level {
|
||||||
return logrus.AllLevels
|
return logrus.AllLevels
|
||||||
}
|
}
|
||||||
|
|
||||||
//sendEs 异步发送日志到es
|
//sendEs
|
||||||
func (hook *esHook) sendEs(doc appLogDocModel) {
|
func (hook *esHook) sendEs(doc appLogDocModel) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
@@ -102,7 +101,7 @@ func newEsLog(e *logrus.Entry) appLogDocModel {
|
|||||||
return ins
|
return ins
|
||||||
}
|
}
|
||||||
|
|
||||||
// indexName es index name 时间分割
|
// indexName es index name
|
||||||
func (m *appLogDocModel) indexName() string {
|
func (m *appLogDocModel) indexName() string {
|
||||||
return time.Now().Format("2006-01-02")
|
return time.Now().Format("2006-01-02")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func loggerInit(moduleName string) *Logger {
|
|||||||
//Close std console output
|
//Close std console output
|
||||||
src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
writer := bufio.NewWriter(src)
|
writer := bufio.NewWriter(src)
|
||||||
logger.SetOutput(writer)
|
logger.SetOutput(writer)
|
||||||
@@ -82,7 +82,7 @@ func initRotateLogs(rotationTime time.Duration, maxRemainNum uint, level string,
|
|||||||
rotatelogs.WithRotationCount(maxRemainNum),
|
rotatelogs.WithRotationCount(maxRemainNum),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
} else {
|
} else {
|
||||||
return writer
|
return writer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,73 +1,73 @@
|
|||||||
package multi_terminal_login
|
package multi_terminal_login
|
||||||
|
|
||||||
import (
|
//
|
||||||
"Open_IM/internal/push/content_struct"
|
//import (
|
||||||
"Open_IM/internal/push/logic"
|
// "Open_IM/internal/push/content_struct"
|
||||||
"Open_IM/pkg/common/config"
|
// "Open_IM/internal/push/logic"
|
||||||
"Open_IM/pkg/common/constant"
|
// "Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/db"
|
// "Open_IM/pkg/common/constant"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
// "Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/utils"
|
// pbChat "Open_IM/pkg/proto/chat"
|
||||||
)
|
// "Open_IM/pkg/utils"
|
||||||
|
//)
|
||||||
func MultiTerminalLoginChecker(uid, token string, platformID int32) error {
|
//
|
||||||
// 1.check userid and platform class 0 not exists and 1 exists
|
//const DayOfSecond = 24*60*60
|
||||||
existsInterface, err := db.DB.ExistsUserIDAndPlatform(uid, utils.PlatformNameToClass(utils.PlatformIDToName(platformID)))
|
//func MultiTerminalLoginChecker(uid, token string, platformID int32) error {
|
||||||
if err != nil {
|
// // 1.check userid and platform class 0 not exists and 1 exists
|
||||||
return err
|
// exists, err := db.DB.ExistsUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)))
|
||||||
}
|
// if err != nil {
|
||||||
exists := existsInterface.(int64)
|
// return err
|
||||||
//get config multi login policy
|
// }
|
||||||
if config.Config.MultiLoginPolicy.OnlyOneTerminalAccess {
|
// //get config multi login policy
|
||||||
//OnlyOneTerminalAccess policy need to check all terminal
|
// if config.Config.MultiLoginPolicy {
|
||||||
if utils.PlatformNameToClass(utils.PlatformIDToName(platformID)) == "PC" {
|
// //OnlyOneTerminalAccess policy need to check all terminal
|
||||||
existsInterface, err = db.DB.ExistsUserIDAndPlatform(uid, "Mobile")
|
// if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == "PC" {
|
||||||
if err != nil {
|
// exists, err = db.DB.ExistsUserIDAndPlatform(uid, "Mobile")
|
||||||
return err
|
// if err != nil {
|
||||||
}
|
// return err
|
||||||
} else {
|
// }
|
||||||
existsInterface, err = db.DB.ExistsUserIDAndPlatform(uid, "PC")
|
// } else {
|
||||||
if err != nil {
|
// exists, err = db.DB.ExistsUserIDAndPlatform(uid, "PC")
|
||||||
return err
|
// if err != nil {
|
||||||
}
|
// return err
|
||||||
}
|
// }
|
||||||
exists = existsInterface.(int64)
|
// }
|
||||||
if exists == 1 {
|
// if exists == 1 {
|
||||||
err := db.DB.SetUserIDAndPlatform(uid, utils.PlatformNameToClass(utils.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire)
|
// err := db.DB.SetUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire*DayOfSecond)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
PushMessageToTheTerminal(uid, platformID)
|
// PushMessageToTheTerminal(uid, platformID)
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
} else if config.Config.MultiLoginPolicy.MobileAndPCTerminalAccessButOtherTerminalKickEachOther {
|
// } else if config.Config.MultiLoginPolicy.MobileAndPCTerminalAccessButOtherTerminalKickEachOther {
|
||||||
// common terminal need to kick eich other
|
// // common terminal need to kick eich other
|
||||||
if exists == 1 {
|
// if exists == 1 {
|
||||||
err := db.DB.SetUserIDAndPlatform(uid, utils.PlatformNameToClass(utils.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire)
|
// err := db.DB.SetUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire*DayOfSecond)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
PushMessageToTheTerminal(uid, platformID)
|
// PushMessageToTheTerminal(uid, platformID)
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
err = db.DB.SetUserIDAndPlatform(uid, utils.PlatformNameToClass(utils.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire)
|
// err = db.DB.SetUserIDAndPlatform(uid, constant.PlatformNameToClass(constant.PlatformIDToName(platformID)), token, config.Config.TokenPolicy.AccessExpire*DayOfSecond)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return err
|
// return err
|
||||||
}
|
// }
|
||||||
PushMessageToTheTerminal(uid, platformID)
|
// PushMessageToTheTerminal(uid, platformID)
|
||||||
return nil
|
// return nil
|
||||||
}
|
//}
|
||||||
|
////
|
||||||
func PushMessageToTheTerminal(uid string, platform int32) {
|
////func PushMessageToTheTerminal(uid string, platform int32) {
|
||||||
|
////
|
||||||
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
//// logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||||
SendID: uid,
|
//// SendID: uid,
|
||||||
RecvID: uid,
|
//// RecvID: uid,
|
||||||
Content: content_struct.NewContentStructString(1, "", "Your account is already logged on other terminal,please confirm"),
|
//// Content: content_struct.NewContentStructString(1, "", "Your account is already logged on other terminal,please confirm"),
|
||||||
SendTime: utils.GetCurrentTimestampBySecond(),
|
//// SendTime: utils.GetCurrentTimestampBySecond(),
|
||||||
MsgFrom: constant.SysMsgType,
|
//// MsgFrom: constant.SysMsgType,
|
||||||
ContentType: constant.KickOnlineTip,
|
//// ContentType: constant.KickOnlineTip,
|
||||||
PlatformID: platform,
|
//// PlatformID: platform,
|
||||||
})
|
//// })
|
||||||
}
|
////}
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package token_verify
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
|
commonDB "Open_IM/pkg/common/db"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"github.com/golang-jwt/jwt/v4"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
//var (
|
||||||
|
// TokenExpired = errors.New("token is timed out, please log in again")
|
||||||
|
// TokenInvalid = errors.New("token has been invalidated")
|
||||||
|
// TokenNotValidYet = errors.New("token not active yet")
|
||||||
|
// TokenMalformed = errors.New("that's not even a token")
|
||||||
|
// TokenUnknown = errors.New("couldn't handle this token")
|
||||||
|
//)
|
||||||
|
|
||||||
|
type Claims struct {
|
||||||
|
UID string
|
||||||
|
Platform string //login platform
|
||||||
|
jwt.RegisteredClaims
|
||||||
|
}
|
||||||
|
|
||||||
|
func BuildClaims(uid, platform string, ttl int64) Claims {
|
||||||
|
now := time.Now()
|
||||||
|
return Claims{
|
||||||
|
UID: uid,
|
||||||
|
Platform: platform,
|
||||||
|
RegisteredClaims: jwt.RegisteredClaims{
|
||||||
|
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), //Expiration time
|
||||||
|
IssuedAt: jwt.NewNumericDate(now), //Issuing time
|
||||||
|
NotBefore: jwt.NewNumericDate(now), //Begin Effective time
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateToken(userID string, platformID int32) (string, int64, error) {
|
||||||
|
claims := BuildClaims(userID, constant.PlatformIDToName(platformID), config.Config.TokenPolicy.AccessExpire)
|
||||||
|
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||||
|
tokenString, err := token.SignedString([]byte(config.Config.TokenPolicy.AccessSecret))
|
||||||
|
if err != nil {
|
||||||
|
return "", 0, err
|
||||||
|
}
|
||||||
|
err = commonDB.DB.AddTokenFlag(userID, platformID, tokenString, constant.NormalToken)
|
||||||
|
if err != nil {
|
||||||
|
return "", 0, err
|
||||||
|
}
|
||||||
|
return tokenString, claims.ExpiresAt.Time.Unix(), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func secret() jwt.Keyfunc {
|
||||||
|
return func(token *jwt.Token) (interface{}, error) {
|
||||||
|
return []byte(config.Config.TokenPolicy.AccessSecret), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetClaimFromToken(tokensString string) (*Claims, error) {
|
||||||
|
token, err := jwt.ParseWithClaims(tokensString, &Claims{}, secret())
|
||||||
|
if err != nil {
|
||||||
|
if ve, ok := err.(*jwt.ValidationError); ok {
|
||||||
|
if ve.Errors&jwt.ValidationErrorMalformed != 0 {
|
||||||
|
return nil, &constant.ErrTokenMalformed
|
||||||
|
} else if ve.Errors&jwt.ValidationErrorExpired != 0 {
|
||||||
|
return nil, &constant.ErrTokenExpired
|
||||||
|
} else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 {
|
||||||
|
return nil, &constant.ErrTokenNotValidYet
|
||||||
|
} else {
|
||||||
|
return nil, &constant.ErrTokenUnknown
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return nil, &constant.ErrTokenNotValidYet
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if claims, ok := token.Claims.(*Claims); ok && token.Valid {
|
||||||
|
log.NewDebug("", claims.UID, claims.Platform)
|
||||||
|
return claims, nil
|
||||||
|
}
|
||||||
|
return nil, &constant.ErrTokenNotValidYet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ParseToken(tokensString string) (claims *Claims, err error) {
|
||||||
|
|
||||||
|
claims, err = GetClaimFromToken(tokensString)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "token validate err", err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
m, err := commonDB.DB.GetTokenMapByUidPid(claims.UID, claims.Platform)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("", "get token from redis err", err.Error())
|
||||||
|
return nil, &constant.ErrTokenInvalid
|
||||||
|
}
|
||||||
|
if m == nil {
|
||||||
|
log.NewError("", "get token from redis err", "m is nil")
|
||||||
|
return nil, &constant.ErrTokenInvalid
|
||||||
|
}
|
||||||
|
if v, ok := m[tokensString]; ok {
|
||||||
|
switch v {
|
||||||
|
case constant.NormalToken:
|
||||||
|
log.NewDebug("", "this is normal return", claims)
|
||||||
|
return claims, nil
|
||||||
|
case constant.InValidToken:
|
||||||
|
return nil, &constant.ErrTokenInvalid
|
||||||
|
case constant.KickedToken:
|
||||||
|
return nil, &constant.ErrTokenInvalid
|
||||||
|
case constant.ExpiredToken:
|
||||||
|
return nil, &constant.ErrTokenExpired
|
||||||
|
default:
|
||||||
|
return nil, &constant.ErrTokenUnknown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, &constant.ErrTokenUnknown
|
||||||
|
}
|
||||||
|
|
||||||
|
//func MakeTheTokenInvalid(currentClaims *Claims, platformClass string) (bool, error) {
|
||||||
|
// storedRedisTokenInterface, err := db.DB.GetPlatformToken(currentClaims.UID, platformClass)
|
||||||
|
// if err != nil {
|
||||||
|
// return false, err
|
||||||
|
// }
|
||||||
|
// storedRedisPlatformClaims, err := ParseRedisInterfaceToken(storedRedisTokenInterface)
|
||||||
|
// if err != nil {
|
||||||
|
// return false, err
|
||||||
|
// }
|
||||||
|
// //if issue time less than redis token then make this token invalid
|
||||||
|
// if currentClaims.IssuedAt.Time.Unix() < storedRedisPlatformClaims.IssuedAt.Time.Unix() {
|
||||||
|
// return true, constant.TokenInvalid
|
||||||
|
// }
|
||||||
|
// return false, nil
|
||||||
|
//}
|
||||||
|
|
||||||
|
func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) {
|
||||||
|
return GetClaimFromToken(string(redisToken.([]uint8)))
|
||||||
|
}
|
||||||
|
|
||||||
|
//Validation token, false means failure, true means successful verification
|
||||||
|
func VerifyToken(token, uid string) (bool, error) {
|
||||||
|
claims, err := ParseToken(token)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if claims.UID != uid {
|
||||||
|
return false, &constant.ErrTokenUnknown
|
||||||
|
}
|
||||||
|
log.NewDebug("", claims.UID, claims.Platform)
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
+13
-13
@@ -50,7 +50,7 @@ func (m *WSToMsgSvrChatMsg) Reset() { *m = WSToMsgSvrChatMsg{} }
|
|||||||
func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) }
|
func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) }
|
||||||
func (*WSToMsgSvrChatMsg) ProtoMessage() {}
|
func (*WSToMsgSvrChatMsg) ProtoMessage() {}
|
||||||
func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) {
|
func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{0}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{0}
|
||||||
}
|
}
|
||||||
func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error {
|
func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b)
|
return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b)
|
||||||
@@ -215,7 +215,7 @@ func (m *MsgSvrToPushSvrChatMsg) Reset() { *m = MsgSvrToPushSvrChatMsg{}
|
|||||||
func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) }
|
func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {}
|
func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {}
|
||||||
func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) {
|
func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{1}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{1}
|
||||||
}
|
}
|
||||||
func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error {
|
func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b)
|
return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b)
|
||||||
@@ -361,7 +361,7 @@ func (m *PullMessageReq) Reset() { *m = PullMessageReq{} }
|
|||||||
func (m *PullMessageReq) String() string { return proto.CompactTextString(m) }
|
func (m *PullMessageReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PullMessageReq) ProtoMessage() {}
|
func (*PullMessageReq) ProtoMessage() {}
|
||||||
func (*PullMessageReq) Descriptor() ([]byte, []int) {
|
func (*PullMessageReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{2}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{2}
|
||||||
}
|
}
|
||||||
func (m *PullMessageReq) XXX_Unmarshal(b []byte) error {
|
func (m *PullMessageReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PullMessageReq.Unmarshal(m, b)
|
return xxx_messageInfo_PullMessageReq.Unmarshal(m, b)
|
||||||
@@ -425,7 +425,7 @@ func (m *PullMessageResp) Reset() { *m = PullMessageResp{} }
|
|||||||
func (m *PullMessageResp) String() string { return proto.CompactTextString(m) }
|
func (m *PullMessageResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PullMessageResp) ProtoMessage() {}
|
func (*PullMessageResp) ProtoMessage() {}
|
||||||
func (*PullMessageResp) Descriptor() ([]byte, []int) {
|
func (*PullMessageResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{3}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{3}
|
||||||
}
|
}
|
||||||
func (m *PullMessageResp) XXX_Unmarshal(b []byte) error {
|
func (m *PullMessageResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PullMessageResp.Unmarshal(m, b)
|
return xxx_messageInfo_PullMessageResp.Unmarshal(m, b)
|
||||||
@@ -500,7 +500,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq
|
|||||||
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
|
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PullMessageBySeqListReq) ProtoMessage() {}
|
func (*PullMessageBySeqListReq) ProtoMessage() {}
|
||||||
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
|
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{4}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{4}
|
||||||
}
|
}
|
||||||
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
|
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
|
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
|
||||||
@@ -553,7 +553,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
|
|||||||
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
||||||
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{5}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{5}
|
||||||
}
|
}
|
||||||
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
||||||
@@ -601,7 +601,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
|
|||||||
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
||||||
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{6}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{6}
|
||||||
}
|
}
|
||||||
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
||||||
@@ -663,7 +663,7 @@ func (m *GatherFormat) Reset() { *m = GatherFormat{} }
|
|||||||
func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
|
func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GatherFormat) ProtoMessage() {}
|
func (*GatherFormat) ProtoMessage() {}
|
||||||
func (*GatherFormat) Descriptor() ([]byte, []int) {
|
func (*GatherFormat) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{7}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{7}
|
||||||
}
|
}
|
||||||
func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
|
func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
|
return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
|
||||||
@@ -731,7 +731,7 @@ func (m *MsgFormat) Reset() { *m = MsgFormat{} }
|
|||||||
func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
|
func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgFormat) ProtoMessage() {}
|
func (*MsgFormat) ProtoMessage() {}
|
||||||
func (*MsgFormat) Descriptor() ([]byte, []int) {
|
func (*MsgFormat) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{8}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{8}
|
||||||
}
|
}
|
||||||
func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
|
func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
|
return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
|
||||||
@@ -863,7 +863,7 @@ func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} }
|
|||||||
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UserSendMsgReq) ProtoMessage() {}
|
func (*UserSendMsgReq) ProtoMessage() {}
|
||||||
func (*UserSendMsgReq) Descriptor() ([]byte, []int) {
|
func (*UserSendMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{9}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{9}
|
||||||
}
|
}
|
||||||
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
|
||||||
@@ -1025,7 +1025,7 @@ func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} }
|
|||||||
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UserSendMsgResp) ProtoMessage() {}
|
func (*UserSendMsgResp) ProtoMessage() {}
|
||||||
func (*UserSendMsgResp) Descriptor() ([]byte, []int) {
|
func (*UserSendMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_chat_feb94a5514034c46, []int{10}
|
return fileDescriptor_chat_163a8d226aa6edb5, []int{10}
|
||||||
}
|
}
|
||||||
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
|
||||||
@@ -1272,9 +1272,9 @@ var _Chat_serviceDesc = grpc.ServiceDesc{
|
|||||||
Metadata: "chat/chat.proto",
|
Metadata: "chat/chat.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_feb94a5514034c46) }
|
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_163a8d226aa6edb5) }
|
||||||
|
|
||||||
var fileDescriptor_chat_feb94a5514034c46 = []byte{
|
var fileDescriptor_chat_163a8d226aa6edb5 = []byte{
|
||||||
// 981 bytes of a gzipped FileDescriptorProto
|
// 981 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6a, 0xe3, 0x46,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6a, 0xe3, 0x46,
|
||||||
0x14, 0xc6, 0x92, 0x2d, 0xdb, 0xc7, 0xbf, 0x99, 0x86, 0xec, 0x90, 0x96, 0xd6, 0x88, 0x6d, 0x31,
|
0x14, 0xc6, 0x92, 0x2d, 0xdb, 0xc7, 0xbf, 0x99, 0x86, 0xec, 0x90, 0x96, 0xd6, 0x88, 0x6d, 0x31,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func (m *PushMsgReq) Reset() { *m = PushMsgReq{} }
|
|||||||
func (m *PushMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *PushMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PushMsgReq) ProtoMessage() {}
|
func (*PushMsgReq) ProtoMessage() {}
|
||||||
func (*PushMsgReq) Descriptor() ([]byte, []int) {
|
func (*PushMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_push_4f08d2ff54ba8af2, []int{0}
|
return fileDescriptor_push_e44270f7d93180b9, []int{0}
|
||||||
}
|
}
|
||||||
func (m *PushMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *PushMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PushMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_PushMsgReq.Unmarshal(m, b)
|
||||||
@@ -192,7 +192,7 @@ func (m *PushMsgResp) Reset() { *m = PushMsgResp{} }
|
|||||||
func (m *PushMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *PushMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PushMsgResp) ProtoMessage() {}
|
func (*PushMsgResp) ProtoMessage() {}
|
||||||
func (*PushMsgResp) Descriptor() ([]byte, []int) {
|
func (*PushMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_push_4f08d2ff54ba8af2, []int{1}
|
return fileDescriptor_push_e44270f7d93180b9, []int{1}
|
||||||
}
|
}
|
||||||
func (m *PushMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *PushMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PushMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_PushMsgResp.Unmarshal(m, b)
|
||||||
@@ -296,9 +296,9 @@ var _PushMsgService_serviceDesc = grpc.ServiceDesc{
|
|||||||
Metadata: "push/push.proto",
|
Metadata: "push/push.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_4f08d2ff54ba8af2) }
|
func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_e44270f7d93180b9) }
|
||||||
|
|
||||||
var fileDescriptor_push_4f08d2ff54ba8af2 = []byte{
|
var fileDescriptor_push_e44270f7d93180b9 = []byte{
|
||||||
// 378 bytes of a gzipped FileDescriptorProto
|
// 378 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x5d, 0xeb, 0xda, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x5d, 0xeb, 0xda, 0x30,
|
||||||
0x14, 0xc6, 0xe9, 0xb4, 0xbe, 0x1c, 0xe7, 0xcb, 0xc2, 0x18, 0xc1, 0x8b, 0x51, 0x64, 0x0c, 0x6f,
|
0x14, 0xc6, 0xe9, 0xb4, 0xbe, 0x1c, 0xe7, 0xcb, 0xc2, 0x18, 0xc1, 0x8b, 0x51, 0x64, 0x0c, 0x6f,
|
||||||
|
|||||||
+350
-32
@@ -47,7 +47,7 @@ func (m *MsgToUserReq) Reset() { *m = MsgToUserReq{} }
|
|||||||
func (m *MsgToUserReq) String() string { return proto.CompactTextString(m) }
|
func (m *MsgToUserReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgToUserReq) ProtoMessage() {}
|
func (*MsgToUserReq) ProtoMessage() {}
|
||||||
func (*MsgToUserReq) Descriptor() ([]byte, []int) {
|
func (*MsgToUserReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_relay_ff2396ffa84abfa7, []int{0}
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{0}
|
||||||
}
|
}
|
||||||
func (m *MsgToUserReq) XXX_Unmarshal(b []byte) error {
|
func (m *MsgToUserReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgToUserReq.Unmarshal(m, b)
|
return xxx_messageInfo_MsgToUserReq.Unmarshal(m, b)
|
||||||
@@ -176,7 +176,7 @@ func (m *MsgToUserResp) Reset() { *m = MsgToUserResp{} }
|
|||||||
func (m *MsgToUserResp) String() string { return proto.CompactTextString(m) }
|
func (m *MsgToUserResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgToUserResp) ProtoMessage() {}
|
func (*MsgToUserResp) ProtoMessage() {}
|
||||||
func (*MsgToUserResp) Descriptor() ([]byte, []int) {
|
func (*MsgToUserResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_relay_ff2396ffa84abfa7, []int{1}
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{1}
|
||||||
}
|
}
|
||||||
func (m *MsgToUserResp) XXX_Unmarshal(b []byte) error {
|
func (m *MsgToUserResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgToUserResp.Unmarshal(m, b)
|
return xxx_messageInfo_MsgToUserResp.Unmarshal(m, b)
|
||||||
@@ -227,7 +227,7 @@ func (m *SingleMsgToUser) Reset() { *m = SingleMsgToUser{} }
|
|||||||
func (m *SingleMsgToUser) String() string { return proto.CompactTextString(m) }
|
func (m *SingleMsgToUser) String() string { return proto.CompactTextString(m) }
|
||||||
func (*SingleMsgToUser) ProtoMessage() {}
|
func (*SingleMsgToUser) ProtoMessage() {}
|
||||||
func (*SingleMsgToUser) Descriptor() ([]byte, []int) {
|
func (*SingleMsgToUser) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_relay_ff2396ffa84abfa7, []int{2}
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{2}
|
||||||
}
|
}
|
||||||
func (m *SingleMsgToUser) XXX_Unmarshal(b []byte) error {
|
func (m *SingleMsgToUser) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_SingleMsgToUser.Unmarshal(m, b)
|
return xxx_messageInfo_SingleMsgToUser.Unmarshal(m, b)
|
||||||
@@ -268,10 +268,281 @@ func (m *SingleMsgToUser) GetRecvPlatFormID() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetUsersOnlineStatusReq struct {
|
||||||
|
UserIDList []string `protobuf:"bytes,1,rep,name=userIDList" json:"userIDList,omitempty"`
|
||||||
|
OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusReq) Reset() { *m = GetUsersOnlineStatusReq{} }
|
||||||
|
func (m *GetUsersOnlineStatusReq) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetUsersOnlineStatusReq) ProtoMessage() {}
|
||||||
|
func (*GetUsersOnlineStatusReq) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{3}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusReq) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusReq.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusReq.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetUsersOnlineStatusReq) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusReq.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusReq) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusReq.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusReq) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusReq.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetUsersOnlineStatusReq proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusReq) GetUserIDList() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.UserIDList
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusReq) GetOperationID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.OperationID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUsersOnlineStatusResp struct {
|
||||||
|
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||||
|
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||||
|
SuccessResult []*GetUsersOnlineStatusResp_SuccessResult `protobuf:"bytes,3,rep,name=successResult" json:"successResult,omitempty"`
|
||||||
|
FailedResult []*GetUsersOnlineStatusResp_FailedDetail `protobuf:"bytes,4,rep,name=failedResult" json:"failedResult,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp) Reset() { *m = GetUsersOnlineStatusResp{} }
|
||||||
|
func (m *GetUsersOnlineStatusResp) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetUsersOnlineStatusResp) ProtoMessage() {}
|
||||||
|
func (*GetUsersOnlineStatusResp) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetUsersOnlineStatusResp) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetUsersOnlineStatusResp proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp) GetErrCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp) GetErrMsg() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrMsg
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp) GetSuccessResult() []*GetUsersOnlineStatusResp_SuccessResult {
|
||||||
|
if m != nil {
|
||||||
|
return m.SuccessResult
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp) GetFailedResult() []*GetUsersOnlineStatusResp_FailedDetail {
|
||||||
|
if m != nil {
|
||||||
|
return m.FailedResult
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUsersOnlineStatusResp_SuccessDetail struct {
|
||||||
|
Platform string `protobuf:"bytes,1,opt,name=platform" json:"platform,omitempty"`
|
||||||
|
Status string `protobuf:"bytes,2,opt,name=status" json:"status,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) Reset() {
|
||||||
|
*m = GetUsersOnlineStatusResp_SuccessDetail{}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetUsersOnlineStatusResp_SuccessDetail) ProtoMessage() {}
|
||||||
|
func (*GetUsersOnlineStatusResp_SuccessDetail) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4, 0}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetUsersOnlineStatusResp_SuccessDetail) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) GetPlatform() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Platform
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessDetail) GetStatus() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Status
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUsersOnlineStatusResp_FailedDetail struct {
|
||||||
|
UserID string `protobuf:"bytes,3,opt,name=userID" json:"userID,omitempty"`
|
||||||
|
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||||
|
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) Reset() { *m = GetUsersOnlineStatusResp_FailedDetail{} }
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetUsersOnlineStatusResp_FailedDetail) ProtoMessage() {}
|
||||||
|
func (*GetUsersOnlineStatusResp_FailedDetail) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4, 1}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetUsersOnlineStatusResp_FailedDetail) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) GetUserID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.UserID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) GetErrCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_FailedDetail) GetErrMsg() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrMsg
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUsersOnlineStatusResp_SuccessResult struct {
|
||||||
|
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
|
||||||
|
Status string `protobuf:"bytes,2,opt,name=status" json:"status,omitempty"`
|
||||||
|
DetailPlatformStatus []*GetUsersOnlineStatusResp_SuccessDetail `protobuf:"bytes,3,rep,name=detailPlatformStatus" json:"detailPlatformStatus,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) Reset() {
|
||||||
|
*m = GetUsersOnlineStatusResp_SuccessResult{}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetUsersOnlineStatusResp_SuccessResult) ProtoMessage() {}
|
||||||
|
func (*GetUsersOnlineStatusResp_SuccessResult) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4, 2}
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetUsersOnlineStatusResp_SuccessResult) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) GetUserID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.UserID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) GetStatus() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Status
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetUsersOnlineStatusResp_SuccessResult) GetDetailPlatformStatus() []*GetUsersOnlineStatusResp_SuccessDetail {
|
||||||
|
if m != nil {
|
||||||
|
return m.DetailPlatformStatus
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*MsgToUserReq)(nil), "relay.MsgToUserReq")
|
proto.RegisterType((*MsgToUserReq)(nil), "relay.MsgToUserReq")
|
||||||
proto.RegisterType((*MsgToUserResp)(nil), "relay.MsgToUserResp")
|
proto.RegisterType((*MsgToUserResp)(nil), "relay.MsgToUserResp")
|
||||||
proto.RegisterType((*SingleMsgToUser)(nil), "relay.SingleMsgToUser")
|
proto.RegisterType((*SingleMsgToUser)(nil), "relay.SingleMsgToUser")
|
||||||
|
proto.RegisterType((*GetUsersOnlineStatusReq)(nil), "relay.GetUsersOnlineStatusReq")
|
||||||
|
proto.RegisterType((*GetUsersOnlineStatusResp)(nil), "relay.GetUsersOnlineStatusResp")
|
||||||
|
proto.RegisterType((*GetUsersOnlineStatusResp_SuccessDetail)(nil), "relay.GetUsersOnlineStatusResp.SuccessDetail")
|
||||||
|
proto.RegisterType((*GetUsersOnlineStatusResp_FailedDetail)(nil), "relay.GetUsersOnlineStatusResp.FailedDetail")
|
||||||
|
proto.RegisterType((*GetUsersOnlineStatusResp_SuccessResult)(nil), "relay.GetUsersOnlineStatusResp.SuccessResult")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@@ -286,6 +557,7 @@ const _ = grpc.SupportPackageIsVersion4
|
|||||||
|
|
||||||
type OnlineMessageRelayServiceClient interface {
|
type OnlineMessageRelayServiceClient interface {
|
||||||
MsgToUser(ctx context.Context, in *MsgToUserReq, opts ...grpc.CallOption) (*MsgToUserResp, error)
|
MsgToUser(ctx context.Context, in *MsgToUserReq, opts ...grpc.CallOption) (*MsgToUserResp, error)
|
||||||
|
GetUsersOnlineStatus(ctx context.Context, in *GetUsersOnlineStatusReq, opts ...grpc.CallOption) (*GetUsersOnlineStatusResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type onlineMessageRelayServiceClient struct {
|
type onlineMessageRelayServiceClient struct {
|
||||||
@@ -305,10 +577,20 @@ func (c *onlineMessageRelayServiceClient) MsgToUser(ctx context.Context, in *Msg
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *onlineMessageRelayServiceClient) GetUsersOnlineStatus(ctx context.Context, in *GetUsersOnlineStatusReq, opts ...grpc.CallOption) (*GetUsersOnlineStatusResp, error) {
|
||||||
|
out := new(GetUsersOnlineStatusResp)
|
||||||
|
err := grpc.Invoke(ctx, "/relay.OnlineMessageRelayService/GetUsersOnlineStatus", in, out, c.cc, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Server API for OnlineMessageRelayService service
|
// Server API for OnlineMessageRelayService service
|
||||||
|
|
||||||
type OnlineMessageRelayServiceServer interface {
|
type OnlineMessageRelayServiceServer interface {
|
||||||
MsgToUser(context.Context, *MsgToUserReq) (*MsgToUserResp, error)
|
MsgToUser(context.Context, *MsgToUserReq) (*MsgToUserResp, error)
|
||||||
|
GetUsersOnlineStatus(context.Context, *GetUsersOnlineStatusReq) (*GetUsersOnlineStatusResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterOnlineMessageRelayServiceServer(s *grpc.Server, srv OnlineMessageRelayServiceServer) {
|
func RegisterOnlineMessageRelayServiceServer(s *grpc.Server, srv OnlineMessageRelayServiceServer) {
|
||||||
@@ -333,6 +615,24 @@ func _OnlineMessageRelayService_MsgToUser_Handler(srv interface{}, ctx context.C
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _OnlineMessageRelayService_GetUsersOnlineStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetUsersOnlineStatusReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(OnlineMessageRelayServiceServer).GetUsersOnlineStatus(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/relay.OnlineMessageRelayService/GetUsersOnlineStatus",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(OnlineMessageRelayServiceServer).GetUsersOnlineStatus(ctx, req.(*GetUsersOnlineStatusReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _OnlineMessageRelayService_serviceDesc = grpc.ServiceDesc{
|
var _OnlineMessageRelayService_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "relay.OnlineMessageRelayService",
|
ServiceName: "relay.OnlineMessageRelayService",
|
||||||
HandlerType: (*OnlineMessageRelayServiceServer)(nil),
|
HandlerType: (*OnlineMessageRelayServiceServer)(nil),
|
||||||
@@ -341,39 +641,57 @@ var _OnlineMessageRelayService_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "MsgToUser",
|
MethodName: "MsgToUser",
|
||||||
Handler: _OnlineMessageRelayService_MsgToUser_Handler,
|
Handler: _OnlineMessageRelayService_MsgToUser_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetUsersOnlineStatus",
|
||||||
|
Handler: _OnlineMessageRelayService_GetUsersOnlineStatus_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "relay/relay.proto",
|
Metadata: "relay/relay.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_ff2396ffa84abfa7) }
|
func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_709d2b3cc3a7ad83) }
|
||||||
|
|
||||||
var fileDescriptor_relay_ff2396ffa84abfa7 = []byte{
|
var fileDescriptor_relay_709d2b3cc3a7ad83 = []byte{
|
||||||
// 414 bytes of a gzipped FileDescriptorProto
|
// 628 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6b, 0xdb, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x41, 0x6b, 0xdb, 0x4c,
|
||||||
0x14, 0xc6, 0xf1, 0xbc, 0xa4, 0xcd, 0x4b, 0x93, 0xac, 0xda, 0x28, 0x5a, 0x0f, 0xc3, 0x84, 0x51,
|
0x10, 0x45, 0x9f, 0xe2, 0x24, 0x9e, 0xd8, 0xc9, 0x97, 0x6d, 0x48, 0xb7, 0x3a, 0xa4, 0xc6, 0x94,
|
||||||
0xc2, 0x0e, 0x19, 0x74, 0xb0, 0x4b, 0x6f, 0xab, 0x09, 0x18, 0xe6, 0x76, 0xc8, 0xe9, 0x65, 0x37,
|
0x60, 0x4a, 0xeb, 0x42, 0x0a, 0xbd, 0xe4, 0x56, 0x0b, 0x17, 0x41, 0x9c, 0x84, 0x95, 0x43, 0x4b,
|
||||||
0xd7, 0x7d, 0x33, 0x62, 0xb6, 0xe4, 0x48, 0x5e, 0xa1, 0xff, 0xdd, 0xfe, 0xb4, 0xa1, 0xa7, 0x64,
|
0x7b, 0x52, 0xe4, 0x89, 0x11, 0x95, 0x25, 0x79, 0x77, 0x1d, 0xc8, 0xdf, 0xe9, 0xb9, 0xf7, 0x5e,
|
||||||
0xd1, 0x32, 0x7a, 0x31, 0xfe, 0x7e, 0xef, 0xf3, 0xf3, 0xa7, 0xa7, 0x07, 0xa7, 0x06, 0x9b, 0xf2,
|
0xfb, 0xd3, 0xca, 0xee, 0x4a, 0xf6, 0xda, 0xb5, 0x1b, 0x72, 0x31, 0x7e, 0x6f, 0x66, 0xdf, 0xcc,
|
||||||
0xe9, 0x23, 0x3d, 0x97, 0x9d, 0xd1, 0xbd, 0x66, 0x03, 0x12, 0xf3, 0xdf, 0x31, 0x9c, 0xe4, 0xb6,
|
0xbc, 0xd9, 0x15, 0x1c, 0x72, 0x4c, 0xa3, 0x87, 0x77, 0xfa, 0xb7, 0x5b, 0xf0, 0x5c, 0xe6, 0xa4,
|
||||||
0x5e, 0xeb, 0x3b, 0x8b, 0x46, 0xe0, 0x86, 0x9d, 0xc1, 0xb0, 0x40, 0xf5, 0x90, 0xa5, 0x3c, 0x4a,
|
0xa6, 0x41, 0xfb, 0xb7, 0x0b, 0x8d, 0x81, 0x18, 0x0f, 0xf3, 0x1b, 0x81, 0x9c, 0xe1, 0x94, 0x1c,
|
||||||
0xa2, 0xc5, 0x48, 0x6c, 0x95, 0xe3, 0x02, 0xab, 0xc7, 0x2c, 0xe5, 0x2f, 0x3c, 0xf7, 0x8a, 0x71,
|
0xc3, 0x76, 0x88, 0xd9, 0x28, 0xf0, 0xa9, 0xd3, 0x72, 0x3a, 0x75, 0x56, 0x22, 0xc5, 0x33, 0x8c,
|
||||||
0x38, 0xba, 0xd6, 0xaa, 0x47, 0xd5, 0xf3, 0x01, 0x15, 0x76, 0xd2, 0x55, 0x9c, 0xa7, 0xc0, 0x0d,
|
0xef, 0x03, 0x9f, 0xfe, 0x67, 0x78, 0x83, 0x08, 0x85, 0x9d, 0x5e, 0x9e, 0x49, 0xcc, 0x24, 0xad,
|
||||||
0x1f, 0x26, 0xd1, 0x22, 0x16, 0x3b, 0xc9, 0xce, 0xe1, 0xd8, 0x75, 0x5d, 0xcb, 0x16, 0xf9, 0x11,
|
0xe9, 0x40, 0x05, 0x55, 0x44, 0xe5, 0x84, 0x38, 0xa5, 0xdb, 0x2d, 0xa7, 0xe3, 0xb2, 0x0a, 0x12,
|
||||||
0x95, 0xfe, 0x6a, 0xf7, 0x55, 0x6e, 0xeb, 0x95, 0xd1, 0x2d, 0x3f, 0x4e, 0xa2, 0xc5, 0x40, 0xec,
|
0x0f, 0x76, 0x95, 0xea, 0x30, 0x99, 0x20, 0xdd, 0xd1, 0xa1, 0x39, 0x56, 0xa7, 0x06, 0x62, 0xdc,
|
||||||
0x24, 0x4b, 0x60, 0xbc, 0x6d, 0xbd, 0x7e, 0xea, 0x90, 0x8f, 0xa8, 0x1a, 0x22, 0xe7, 0x28, 0xd0,
|
0xe7, 0xf9, 0x84, 0xee, 0xb6, 0x9c, 0x4e, 0x8d, 0x55, 0x90, 0xb4, 0x60, 0xaf, 0x94, 0x1e, 0x3e,
|
||||||
0x5a, 0xa9, 0x15, 0x39, 0xc0, 0x3b, 0x02, 0xe4, 0x1c, 0xb7, 0x1d, 0x9a, 0xb2, 0x97, 0x5a, 0x65,
|
0x14, 0x48, 0xeb, 0x3a, 0x6a, 0x53, 0x2a, 0x23, 0x44, 0x21, 0x92, 0x3c, 0xd3, 0x19, 0x60, 0x32,
|
||||||
0x29, 0x1f, 0x53, 0xe2, 0x10, 0xf9, 0x1e, 0xe6, 0x11, 0x4d, 0x6e, 0xeb, 0x2c, 0xe5, 0x27, 0xde,
|
0x2c, 0x4a, 0x65, 0x5c, 0x15, 0xc8, 0x23, 0x99, 0xe4, 0x59, 0xe0, 0xd3, 0x3d, 0xdd, 0xb1, 0x4d,
|
||||||
0x11, 0x20, 0xf6, 0x0e, 0xe0, 0x5b, 0x53, 0xf6, 0x3f, 0xb4, 0x69, 0xb3, 0x94, 0x4f, 0xe8, 0x27,
|
0x19, 0x0d, 0x7e, 0x8f, 0x7c, 0x20, 0xc6, 0x81, 0x4f, 0x1b, 0x26, 0xc3, 0xa2, 0xc8, 0x09, 0xc0,
|
||||||
0x01, 0x61, 0x17, 0x30, 0x75, 0xa7, 0x41, 0x73, 0x23, 0xab, 0x9f, 0x37, 0x65, 0x8b, 0x7c, 0x4a,
|
0x75, 0x1a, 0xc9, 0xbb, 0x9c, 0x4f, 0x02, 0x9f, 0x36, 0x75, 0x11, 0x8b, 0x21, 0xa7, 0xb0, 0xaf,
|
||||||
0x4d, 0x0e, 0x28, 0x7b, 0x0f, 0x13, 0x4f, 0x56, 0x65, 0x85, 0x77, 0xe2, 0x2b, 0x9f, 0x91, 0xed,
|
0xa6, 0x41, 0x7e, 0x99, 0xc4, 0xdf, 0x2f, 0xa3, 0x09, 0xd2, 0x7d, 0x2d, 0xb2, 0xc2, 0x92, 0x57,
|
||||||
0x5f, 0x48, 0xa7, 0x6e, 0x24, 0xaa, 0xde, 0xe7, 0x79, 0xe5, 0xf3, 0x04, 0x68, 0x7e, 0x05, 0x93,
|
0xd0, 0x34, 0x4c, 0x3f, 0x8a, 0xf1, 0x86, 0x5d, 0xd0, 0x03, 0x9d, 0xb6, 0x4c, 0xea, 0xa9, 0xd3,
|
||||||
0xe0, 0x06, 0x6d, 0xc7, 0x3e, 0xc0, 0x4b, 0x83, 0xb6, 0xe3, 0x51, 0x12, 0x2f, 0xc6, 0x97, 0x67,
|
0x04, 0x33, 0x69, 0xfa, 0xf9, 0xdf, 0xf4, 0x63, 0x51, 0xed, 0x73, 0x68, 0x5a, 0x1b, 0x14, 0x05,
|
||||||
0x4b, 0x7f, 0xed, 0x85, 0x54, 0x75, 0x83, 0x7b, 0x27, 0x79, 0xe6, 0x1b, 0x98, 0x1d, 0x14, 0xdc,
|
0x79, 0x0d, 0x5b, 0x1c, 0x45, 0x41, 0x9d, 0x96, 0xdb, 0xd9, 0x3b, 0x3b, 0xee, 0x9a, 0xb5, 0x87,
|
||||||
0xf9, 0x04, 0xda, 0x5f, 0x4d, 0x7f, 0xad, 0x1f, 0x90, 0xb6, 0x20, 0x16, 0x01, 0x79, 0x76, 0x13,
|
0x49, 0x36, 0x4e, 0x71, 0x91, 0xa9, 0x73, 0xda, 0x53, 0x38, 0x58, 0x09, 0xa8, 0xf9, 0x18, 0x8a,
|
||||||
0x2e, 0x60, 0xea, 0xde, 0xdc, 0x24, 0x56, 0x7e, 0x36, 0x31, 0xcd, 0xe6, 0x80, 0x5e, 0x16, 0xf0,
|
0x59, 0x2a, 0x7b, 0xf9, 0x08, 0xf5, 0x2d, 0x70, 0x99, 0xc5, 0x6c, 0xbc, 0x09, 0xa7, 0xb0, 0xaf,
|
||||||
0xf6, 0x56, 0x35, 0x52, 0x61, 0x8e, 0xd6, 0x96, 0x35, 0x0a, 0x17, 0xcf, 0x0d, 0x58, 0x56, 0xc8,
|
0xfe, 0x29, 0x27, 0xfa, 0xc6, 0x1b, 0x57, 0x7b, 0xb3, 0xc2, 0xb6, 0xbf, 0xc1, 0xf3, 0x4f, 0x28,
|
||||||
0x3e, 0xc3, 0x68, 0x9f, 0xe4, 0xf5, 0x36, 0x7a, 0xb8, 0xa0, 0xe7, 0x6f, 0xfe, 0x87, 0xb6, 0xfb,
|
0x55, 0x29, 0x71, 0x95, 0xa5, 0x49, 0x86, 0xa1, 0x8c, 0xe4, 0x4c, 0xa8, 0xcb, 0x77, 0x02, 0x30,
|
||||||
0x72, 0xfa, 0x7d, 0xb6, 0xf4, 0xfb, 0x7d, 0xd5, 0xdd, 0x53, 0xc7, 0xfb, 0x21, 0x2d, 0xfa, 0xa7,
|
0x13, 0xc8, 0x03, 0xff, 0x22, 0x11, 0x52, 0xf7, 0x5f, 0x67, 0x16, 0xa3, 0xcc, 0xc8, 0xad, 0xf5,
|
||||||
0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x9b, 0x83, 0x12, 0xfd, 0x02, 0x00, 0x00,
|
0x99, 0xfa, 0x36, 0xd5, 0xfe, 0xb5, 0x05, 0x74, 0xbd, 0xba, 0x28, 0xd4, 0xdd, 0x42, 0xce, 0xe7,
|
||||||
|
0x63, 0xd5, 0x58, 0x05, 0xd5, 0x4c, 0xc8, 0xd5, 0x7e, 0xab, 0x99, 0x0c, 0x22, 0x21, 0x34, 0xc5,
|
||||||
|
0x2c, 0x8e, 0x51, 0x08, 0x63, 0x00, 0x75, 0xb5, 0xa7, 0x6f, 0x4b, 0x4f, 0x37, 0x55, 0xea, 0x86,
|
||||||
|
0xf6, 0x21, 0xb6, 0xac, 0x41, 0xae, 0xa1, 0x71, 0x17, 0x25, 0x29, 0x8e, 0x4a, 0xcd, 0x2d, 0xad,
|
||||||
|
0xf9, 0xe6, 0x31, 0xcd, 0xbe, 0x3e, 0xe3, 0xa3, 0x8c, 0x92, 0x94, 0x2d, 0x29, 0x78, 0x3d, 0x68,
|
||||||
|
0x96, 0x15, 0x4d, 0x58, 0xbd, 0xb0, 0xa2, 0xbc, 0x91, 0xe5, 0x3b, 0x9e, 0x63, 0x35, 0xab, 0xd0,
|
||||||
|
0xaa, 0xd5, 0xac, 0x06, 0x79, 0x5f, 0xa0, 0x61, 0x97, 0x50, 0x79, 0xc6, 0x7a, 0xbd, 0xc7, 0x3a,
|
||||||
|
0x2b, 0xd1, 0xd3, 0x5d, 0xf4, 0x7e, 0x38, 0xf3, 0xfe, 0x4a, 0x0b, 0x16, 0xda, 0xce, 0x92, 0xf6,
|
||||||
|
0x86, 0xde, 0x48, 0x04, 0x47, 0x23, 0xdd, 0x55, 0xf5, 0xce, 0x8c, 0x2f, 0x4f, 0x5c, 0x47, 0xe9,
|
||||||
|
0xdd, 0x5a, 0xa9, 0xb3, 0x9f, 0x0e, 0xbc, 0x30, 0x07, 0x07, 0x28, 0x44, 0x34, 0x46, 0xa6, 0x34,
|
||||||
|
0xd5, 0xc3, 0x4f, 0x62, 0x24, 0x1f, 0xa0, 0xbe, 0x78, 0x21, 0xcf, 0xca, 0x7a, 0xf6, 0x87, 0xd3,
|
||||||
|
0x3b, 0xfa, 0x9b, 0x14, 0x05, 0xf9, 0x0c, 0x47, 0xeb, 0xba, 0x22, 0x27, 0xff, 0x6c, 0x79, 0xea,
|
||||||
|
0xbd, 0x7c, 0x64, 0xa4, 0x8f, 0x87, 0x5f, 0x0f, 0xba, 0xe6, 0x83, 0x7e, 0x5e, 0xdc, 0xea, 0x56,
|
||||||
|
0x6f, 0xb7, 0xf5, 0x97, 0xfd, 0xfd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xe4, 0x7c, 0xdc,
|
||||||
|
0xee, 0x05, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,34 @@ message SingleMsgToUser{
|
|||||||
string RecvID = 2;
|
string RecvID = 2;
|
||||||
int32 RecvPlatFormID = 3;
|
int32 RecvPlatFormID = 3;
|
||||||
}
|
}
|
||||||
|
message GetUsersOnlineStatusReq{
|
||||||
|
repeated string userIDList = 1;
|
||||||
|
string operationID = 2;
|
||||||
|
}
|
||||||
|
message GetUsersOnlineStatusResp{
|
||||||
|
int32 errCode = 1;
|
||||||
|
string errMsg = 2;
|
||||||
|
repeated SuccessResult successResult = 3;
|
||||||
|
repeated FailedDetail failedResult = 4;
|
||||||
|
message SuccessDetail{
|
||||||
|
string platform = 1;
|
||||||
|
string status = 2;
|
||||||
|
}
|
||||||
|
message FailedDetail{
|
||||||
|
string userID = 3;
|
||||||
|
int32 errCode = 1;
|
||||||
|
string errMsg = 2;
|
||||||
|
}
|
||||||
|
message SuccessResult{
|
||||||
|
string userID = 1;
|
||||||
|
string status = 2;
|
||||||
|
repeated SuccessDetail detailPlatformStatus = 3;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
service OnlineMessageRelayService {
|
service OnlineMessageRelayService {
|
||||||
rpc MsgToUser(MsgToUserReq) returns(MsgToUserResp);
|
rpc MsgToUser(MsgToUserReq) returns(MsgToUserResp);
|
||||||
|
rpc GetUsersOnlineStatus(GetUsersOnlineStatusReq)returns(GetUsersOnlineStatusResp);
|
||||||
// rpc SendMsgByWS(SendMsgByWSReq) returns(MsgToUserResp);
|
// rpc SendMsgByWS(SendMsgByWSReq) returns(MsgToUserResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+116
-59
@@ -32,7 +32,7 @@ func (m *PullMessageBySeqListResp) Reset() { *m = PullMessageBySeqListRe
|
|||||||
func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) }
|
func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PullMessageBySeqListResp) ProtoMessage() {}
|
func (*PullMessageBySeqListResp) ProtoMessage() {}
|
||||||
func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) {
|
func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{0}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{0}
|
||||||
}
|
}
|
||||||
func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error {
|
func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b)
|
return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b)
|
||||||
@@ -91,7 +91,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq
|
|||||||
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
|
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*PullMessageBySeqListReq) ProtoMessage() {}
|
func (*PullMessageBySeqListReq) ProtoMessage() {}
|
||||||
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
|
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{1}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{1}
|
||||||
}
|
}
|
||||||
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
|
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
|
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
|
||||||
@@ -128,7 +128,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
|
|||||||
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
||||||
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{2}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{2}
|
||||||
}
|
}
|
||||||
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
||||||
@@ -160,7 +160,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
|
|||||||
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
||||||
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{3}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{3}
|
||||||
}
|
}
|
||||||
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
||||||
@@ -208,7 +208,7 @@ func (m *GatherFormat) Reset() { *m = GatherFormat{} }
|
|||||||
func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
|
func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GatherFormat) ProtoMessage() {}
|
func (*GatherFormat) ProtoMessage() {}
|
||||||
func (*GatherFormat) Descriptor() ([]byte, []int) {
|
func (*GatherFormat) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{4}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{4}
|
||||||
}
|
}
|
||||||
func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
|
func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
|
return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
|
||||||
@@ -276,7 +276,7 @@ func (m *MsgFormat) Reset() { *m = MsgFormat{} }
|
|||||||
func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
|
func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgFormat) ProtoMessage() {}
|
func (*MsgFormat) ProtoMessage() {}
|
||||||
func (*MsgFormat) Descriptor() ([]byte, []int) {
|
func (*MsgFormat) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{5}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{5}
|
||||||
}
|
}
|
||||||
func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
|
func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
|
return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
|
||||||
@@ -401,7 +401,7 @@ func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} }
|
|||||||
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) }
|
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UserSendMsgReq) ProtoMessage() {}
|
func (*UserSendMsgReq) ProtoMessage() {}
|
||||||
func (*UserSendMsgReq) Descriptor() ([]byte, []int) {
|
func (*UserSendMsgReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{6}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{6}
|
||||||
}
|
}
|
||||||
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
|
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
|
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
|
||||||
@@ -511,7 +511,7 @@ func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} }
|
|||||||
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) }
|
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UserSendMsgResp) ProtoMessage() {}
|
func (*UserSendMsgResp) ProtoMessage() {}
|
||||||
func (*UserSendMsgResp) Descriptor() ([]byte, []int) {
|
func (*UserSendMsgResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{7}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{7}
|
||||||
}
|
}
|
||||||
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
|
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
|
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
|
||||||
@@ -575,7 +575,7 @@ func (m *MsgData) Reset() { *m = MsgData{} }
|
|||||||
func (m *MsgData) String() string { return proto.CompactTextString(m) }
|
func (m *MsgData) String() string { return proto.CompactTextString(m) }
|
||||||
func (*MsgData) ProtoMessage() {}
|
func (*MsgData) ProtoMessage() {}
|
||||||
func (*MsgData) Descriptor() ([]byte, []int) {
|
func (*MsgData) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_ws_f143de4f947df40f, []int{8}
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{8}
|
||||||
}
|
}
|
||||||
func (m *MsgData) XXX_Unmarshal(b []byte) error {
|
func (m *MsgData) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_MsgData.Unmarshal(m, b)
|
return xxx_messageInfo_MsgData.Unmarshal(m, b)
|
||||||
@@ -686,6 +686,60 @@ func (m *MsgData) GetClientMsgID() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OfflinePushInfo struct {
|
||||||
|
Title string `protobuf:"bytes,1,opt,name=Title" json:"Title,omitempty"`
|
||||||
|
Desc string `protobuf:"bytes,2,opt,name=Desc" json:"Desc,omitempty"`
|
||||||
|
Ext string `protobuf:"bytes,3,opt,name=Ext" json:"Ext,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OfflinePushInfo) Reset() { *m = OfflinePushInfo{} }
|
||||||
|
func (m *OfflinePushInfo) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*OfflinePushInfo) ProtoMessage() {}
|
||||||
|
func (*OfflinePushInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_ws_ff6df30c494aaf36, []int{9}
|
||||||
|
}
|
||||||
|
func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *OfflinePushInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_OfflinePushInfo.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *OfflinePushInfo) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_OfflinePushInfo.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *OfflinePushInfo) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_OfflinePushInfo.Size(m)
|
||||||
|
}
|
||||||
|
func (m *OfflinePushInfo) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_OfflinePushInfo.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_OfflinePushInfo proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *OfflinePushInfo) GetTitle() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Title
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OfflinePushInfo) GetDesc() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Desc
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OfflinePushInfo) GetExt() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Ext
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*PullMessageBySeqListResp)(nil), "open_im_sdk.PullMessageBySeqListResp")
|
proto.RegisterType((*PullMessageBySeqListResp)(nil), "open_im_sdk.PullMessageBySeqListResp")
|
||||||
proto.RegisterType((*PullMessageBySeqListReq)(nil), "open_im_sdk.PullMessageBySeqListReq")
|
proto.RegisterType((*PullMessageBySeqListReq)(nil), "open_im_sdk.PullMessageBySeqListReq")
|
||||||
@@ -697,57 +751,60 @@ func init() {
|
|||||||
proto.RegisterMapType((map[string]int32)(nil), "open_im_sdk.UserSendMsgReq.OptionsEntry")
|
proto.RegisterMapType((map[string]int32)(nil), "open_im_sdk.UserSendMsgReq.OptionsEntry")
|
||||||
proto.RegisterType((*UserSendMsgResp)(nil), "open_im_sdk.UserSendMsgResp")
|
proto.RegisterType((*UserSendMsgResp)(nil), "open_im_sdk.UserSendMsgResp")
|
||||||
proto.RegisterType((*MsgData)(nil), "open_im_sdk.MsgData")
|
proto.RegisterType((*MsgData)(nil), "open_im_sdk.MsgData")
|
||||||
|
proto.RegisterType((*OfflinePushInfo)(nil), "open_im_sdk.OfflinePushInfo")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_f143de4f947df40f) }
|
func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_ff6df30c494aaf36) }
|
||||||
|
|
||||||
var fileDescriptor_ws_f143de4f947df40f = []byte{
|
var fileDescriptor_ws_ff6df30c494aaf36 = []byte{
|
||||||
// 739 bytes of a gzipped FileDescriptorProto
|
// 780 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4b, 0x6b, 0xdb, 0x4a,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x5b, 0x6b, 0x1a, 0x41,
|
||||||
0x14, 0x46, 0x52, 0xfc, 0xd0, 0xb1, 0xf3, 0x60, 0x6e, 0xc8, 0xd5, 0x0d, 0x97, 0x8b, 0x11, 0x97,
|
0x14, 0xc6, 0x5d, 0x6f, 0x7b, 0x34, 0x17, 0xa6, 0x21, 0xdd, 0x86, 0x52, 0x64, 0x29, 0x45, 0xf2,
|
||||||
0x62, 0xb2, 0x70, 0x20, 0xd9, 0x94, 0x94, 0x52, 0x9a, 0x3a, 0x09, 0x2e, 0x71, 0x1a, 0xc6, 0xc9,
|
0x60, 0x20, 0x79, 0x29, 0x29, 0xa5, 0x34, 0x35, 0x09, 0x96, 0x98, 0x84, 0x35, 0x79, 0xe9, 0x4b,
|
||||||
0xa6, 0x9b, 0xa0, 0xda, 0x53, 0x57, 0xd8, 0x7a, 0x58, 0x47, 0x79, 0xf8, 0xc7, 0xf4, 0x0f, 0x75,
|
0xd8, 0xea, 0x68, 0x16, 0xf7, 0xa2, 0x7b, 0xd6, 0x24, 0xfe, 0x98, 0xfe, 0xa1, 0x3e, 0xf4, 0x1f,
|
||||||
0xd1, 0x7f, 0x54, 0x28, 0x67, 0x46, 0x72, 0x66, 0x6c, 0xd3, 0x76, 0x37, 0xe7, 0xd3, 0x9c, 0x99,
|
0x15, 0xca, 0x99, 0xd9, 0x35, 0x33, 0x2a, 0x6d, 0xdf, 0xe6, 0x7c, 0xce, 0x99, 0x99, 0xf3, 0x5d,
|
||||||
0x39, 0xdf, 0x03, 0xc1, 0x36, 0x8e, 0x26, 0x77, 0x8f, 0x78, 0xf8, 0x88, 0x9d, 0x34, 0x4b, 0xf2,
|
0x5c, 0xd8, 0xc2, 0xc1, 0xf8, 0xee, 0x11, 0x0f, 0x1e, 0xb1, 0x35, 0x49, 0xe2, 0x34, 0x66, 0xb5,
|
||||||
0x84, 0x35, 0x92, 0x54, 0xc4, 0x77, 0x61, 0x74, 0x87, 0xa3, 0x89, 0xff, 0xcd, 0x02, 0xef, 0xfa,
|
0x78, 0xc2, 0xa3, 0x3b, 0x3f, 0xbc, 0xc3, 0xc1, 0xd8, 0xf9, 0x59, 0x00, 0xfb, 0x7a, 0x16, 0x04,
|
||||||
0x7e, 0x3a, 0xed, 0x0b, 0xc4, 0x60, 0x2c, 0x4e, 0xe7, 0x03, 0x31, 0xbb, 0x0c, 0x31, 0xe7, 0x02,
|
0x5d, 0x8e, 0xe8, 0x8d, 0xf8, 0xc9, 0xbc, 0xc7, 0xa7, 0x17, 0x3e, 0xa6, 0x2e, 0xc7, 0x09, 0xdb,
|
||||||
0x53, 0xb6, 0x07, 0xd5, 0x7e, 0xf0, 0x34, 0x10, 0x33, 0xcf, 0x6a, 0x59, 0x6d, 0x87, 0x17, 0x95,
|
0x85, 0x72, 0xd7, 0x7b, 0xea, 0xf1, 0xa9, 0x5d, 0x68, 0x14, 0x9a, 0xa6, 0x9b, 0x55, 0x02, 0xf7,
|
||||||
0xc4, 0xc3, 0x98, 0x70, 0xbb, 0xc0, 0x65, 0xc5, 0xde, 0xc0, 0xe6, 0x20, 0x8c, 0xc7, 0x53, 0x71,
|
0x23, 0xc2, 0x8d, 0x0c, 0x17, 0x15, 0xfb, 0x04, 0x1b, 0x3d, 0x3f, 0x1a, 0x05, 0xfc, 0x16, 0x79,
|
||||||
0x8b, 0x22, 0xeb, 0xe3, 0xd8, 0x73, 0x5a, 0x4e, 0xbb, 0x71, 0xf4, 0x4f, 0x47, 0xbb, 0xb1, 0x73,
|
0xd2, 0xc5, 0x91, 0x6d, 0x36, 0xcc, 0x66, 0xed, 0xf0, 0x55, 0x4b, 0xb9, 0xb1, 0x75, 0xee, 0xa5,
|
||||||
0x11, 0xe4, 0x5f, 0x44, 0x76, 0x9e, 0x64, 0x51, 0x90, 0x73, 0x73, 0x3f, 0x7b, 0x0d, 0xcd, 0x8b,
|
0xf7, 0x3c, 0x39, 0x8b, 0x93, 0xd0, 0x4b, 0x5d, 0x7d, 0x3f, 0xfb, 0x08, 0xf5, 0xf3, 0x24, 0x9e,
|
||||||
0x2c, 0xb9, 0x4f, 0xcb, 0xfe, 0x8d, 0xdf, 0xf5, 0x1b, 0xdb, 0xfd, 0x63, 0xf8, 0x7b, 0xfd, 0x2c,
|
0x4d, 0xf2, 0xfe, 0xe2, 0xbf, 0xfa, 0xb5, 0xed, 0xce, 0x11, 0xbc, 0x5c, 0x3f, 0xcb, 0x94, 0xd9,
|
||||||
0x33, 0xe6, 0x41, 0x0d, 0x55, 0xe5, 0x59, 0x2d, 0xa7, 0xed, 0xf0, 0xb2, 0xf4, 0x77, 0x81, 0x5d,
|
0x50, 0x41, 0x59, 0xd9, 0x85, 0x86, 0xd9, 0x34, 0xdd, 0xbc, 0x74, 0x76, 0x80, 0x9d, 0xf3, 0xb4,
|
||||||
0x88, 0xbc, 0x1f, 0x3c, 0xbd, 0x8d, 0x47, 0x6a, 0x0e, 0x2e, 0x66, 0xfe, 0x19, 0xfc, 0xb5, 0x82,
|
0xeb, 0x3d, 0x7d, 0x8e, 0x06, 0x72, 0x0e, 0x97, 0x4f, 0x9d, 0x53, 0x78, 0xb1, 0x82, 0x4a, 0x46,
|
||||||
0x2a, 0x46, 0x22, 0x83, 0x91, 0x68, 0xc1, 0x48, 0x64, 0x30, 0xa2, 0x2a, 0xff, 0x3d, 0x34, 0xf5,
|
0x42, 0x8d, 0x91, 0x70, 0xc1, 0x48, 0xa8, 0x31, 0x22, 0x2b, 0xe7, 0x2b, 0xd4, 0xd5, 0xf7, 0xb2,
|
||||||
0xf7, 0xb2, 0x2d, 0xb0, 0x7b, 0x5d, 0xd9, 0xeb, 0x72, 0xbb, 0xd7, 0x65, 0x07, 0xb0, 0x21, 0xdf,
|
0x4d, 0x30, 0x3a, 0x6d, 0xd1, 0x6b, 0xb9, 0x46, 0xa7, 0xcd, 0xf6, 0xa1, 0x28, 0xde, 0x64, 0x88,
|
||||||
0x64, 0xcb, 0x41, 0xf7, 0x8c, 0x41, 0xfb, 0x38, 0x2e, 0xa6, 0x94, 0x7b, 0xfc, 0x1f, 0x36, 0xb8,
|
0x41, 0x77, 0xb5, 0x41, 0xbb, 0x38, 0xca, 0xa6, 0x14, 0x7b, 0x9c, 0xdf, 0x06, 0x58, 0x0b, 0x8c,
|
||||||
0x0b, 0x8c, 0x6e, 0x1c, 0x88, 0x78, 0xb4, 0x38, 0xad, 0xa8, 0x08, 0xe7, 0x62, 0xf8, 0xd0, 0xeb,
|
0x6e, 0xec, 0xf1, 0x68, 0xb0, 0x38, 0x2d, 0xab, 0x08, 0x77, 0x79, 0xff, 0xa1, 0xd3, 0x16, 0x2f,
|
||||||
0xca, 0x97, 0xb8, 0xbc, 0xa8, 0x88, 0x00, 0x6a, 0xce, 0x92, 0xc8, 0x73, 0x5a, 0x56, 0xbb, 0xc2,
|
0xb1, 0xdc, 0xac, 0x22, 0x02, 0xa8, 0x39, 0x89, 0x43, 0xdb, 0x6c, 0x14, 0x9a, 0x25, 0x37, 0x2f,
|
||||||
0xcb, 0x92, 0xb5, 0xa0, 0xf1, 0x2e, 0x89, 0x73, 0x11, 0xe7, 0x37, 0xf3, 0x54, 0x78, 0x1b, 0xf2,
|
0x59, 0x03, 0x6a, 0x5f, 0xe2, 0x28, 0xe5, 0x51, 0x7a, 0x33, 0x9f, 0x70, 0xbb, 0x28, 0x7e, 0x55,
|
||||||
0xab, 0x0e, 0xd1, 0x8e, 0x81, 0xc8, 0x1e, 0x24, 0xc9, 0xbd, 0xae, 0x57, 0x91, 0x07, 0xeb, 0x10,
|
0x21, 0xda, 0xd1, 0xe3, 0xc9, 0x83, 0x20, 0xb9, 0xd3, 0xb6, 0x4b, 0xe2, 0x60, 0x15, 0xa2, 0xd3,
|
||||||
0x9d, 0x5e, 0x34, 0x78, 0x55, 0xf9, 0xb5, 0x2c, 0xd9, 0x0e, 0x38, 0x44, 0x4b, 0x4d, 0xd2, 0x42,
|
0xb3, 0x06, 0xbb, 0x2c, 0x7e, 0xcd, 0x4b, 0xb6, 0x0d, 0x26, 0xd1, 0x52, 0x11, 0xb4, 0xd0, 0x92,
|
||||||
0x4b, 0xb6, 0x0f, 0x75, 0x7a, 0xeb, 0x4d, 0x18, 0x09, 0xaf, 0x2e, 0xe1, 0x45, 0xcd, 0x0e, 0x60,
|
0xed, 0x41, 0x95, 0xde, 0x7a, 0xe3, 0x87, 0xdc, 0xae, 0x0a, 0x78, 0x51, 0xb3, 0x7d, 0xd8, 0xa6,
|
||||||
0x87, 0xd6, 0x22, 0xbb, 0x9e, 0x06, 0xf9, 0xe7, 0x24, 0x8b, 0x7a, 0x5d, 0xcf, 0x95, 0x0f, 0x5a,
|
0x35, 0x4f, 0xae, 0x03, 0x2f, 0x1d, 0xc6, 0x49, 0xd8, 0x69, 0xdb, 0x96, 0x78, 0xd0, 0x0a, 0xce,
|
||||||
0xc1, 0xd9, 0x0b, 0xd8, 0x52, 0xd8, 0x55, 0x38, 0x9c, 0x5c, 0x05, 0x91, 0xf0, 0x40, 0x5e, 0xbd,
|
0xde, 0xc1, 0xa6, 0xc4, 0x2e, 0xfd, 0xfe, 0xf8, 0xd2, 0x0b, 0xb9, 0x0d, 0xe2, 0xea, 0x25, 0x94,
|
||||||
0x84, 0xb2, 0xff, 0x61, 0x53, 0x21, 0xe7, 0xc1, 0x50, 0xdc, 0xf2, 0x4b, 0xaf, 0x21, 0xb7, 0x99,
|
0xbd, 0x85, 0x0d, 0x89, 0x9c, 0x79, 0x7d, 0x7e, 0xeb, 0x5e, 0xd8, 0x35, 0xb1, 0x4d, 0x07, 0x05,
|
||||||
0xa0, 0x64, 0x61, 0x1a, 0x8a, 0x38, 0x57, 0x33, 0x36, 0xd5, 0x8c, 0x1a, 0xe4, 0x7f, 0x77, 0x60,
|
0x0b, 0x81, 0xcf, 0xa3, 0x54, 0xce, 0x58, 0x97, 0x33, 0x2a, 0x90, 0xf3, 0xcb, 0x84, 0x4d, 0x72,
|
||||||
0x8b, 0x9c, 0x46, 0x7d, 0x7d, 0x1c, 0x93, 0xab, 0x4e, 0xa1, 0xf6, 0x21, 0xcd, 0xc3, 0x24, 0x46,
|
0x1a, 0xf5, 0x75, 0x71, 0x44, 0xae, 0x3a, 0x81, 0xca, 0xd5, 0x24, 0xf5, 0xe3, 0x08, 0x85, 0xab,
|
||||||
0xe9, 0xaa, 0xc6, 0x51, 0xdb, 0x50, 0xd0, 0xdc, 0xdd, 0x29, 0xb6, 0x9e, 0xc5, 0x79, 0x36, 0xe7,
|
0x6a, 0x87, 0x4d, 0x4d, 0x41, 0x7d, 0x77, 0x2b, 0xdb, 0x7a, 0x1a, 0xa5, 0xc9, 0xdc, 0xcd, 0x1b,
|
||||||
0x65, 0xe3, 0x9a, 0x31, 0xec, 0x3f, 0x1b, 0xc3, 0x59, 0x37, 0xc6, 0x7f, 0x00, 0x1a, 0x75, 0x4a,
|
0xd7, 0x8c, 0x61, 0xfc, 0xdf, 0x18, 0xe6, 0xba, 0x31, 0xde, 0x00, 0x28, 0xd4, 0x49, 0x2d, 0x15,
|
||||||
0x4b, 0x0d, 0x51, 0x52, 0x22, 0x86, 0x49, 0x2c, 0xc5, 0xae, 0x28, 0xb1, 0x35, 0x48, 0x37, 0x4a,
|
0x44, 0x4a, 0x89, 0xe8, 0xc7, 0x91, 0x10, 0xbb, 0x24, 0xc5, 0x56, 0x20, 0xd5, 0x28, 0xe5, 0xbf,
|
||||||
0xf5, 0x97, 0x46, 0xa9, 0xad, 0x1a, 0xe5, 0xd9, 0x7c, 0x75, 0xc3, 0x7c, 0xff, 0x82, 0x7b, 0x9e,
|
0x1a, 0xa5, 0xb2, 0x6a, 0x94, 0x67, 0xf3, 0x55, 0x35, 0xf3, 0xbd, 0x06, 0xeb, 0x2c, 0x4e, 0xfa,
|
||||||
0x64, 0x43, 0x21, 0xbd, 0xee, 0xb6, 0x9c, 0xb6, 0xcb, 0x9f, 0x01, 0xdd, 0x3c, 0x60, 0x9a, 0x67,
|
0x5c, 0x78, 0xdd, 0x6a, 0x98, 0x4d, 0xcb, 0x7d, 0x06, 0x54, 0xf3, 0x80, 0x6e, 0x9e, 0x25, 0x51,
|
||||||
0x49, 0x94, 0xc6, 0x8a, 0x28, 0xfb, 0x27, 0xd0, 0xd4, 0x69, 0x25, 0xbb, 0x4d, 0xc4, 0xbc, 0xc8,
|
0x6a, 0x2b, 0xa2, 0xec, 0x1d, 0x43, 0x5d, 0xa5, 0x95, 0xec, 0x36, 0xe6, 0xf3, 0x2c, 0x13, 0xb4,
|
||||||
0x04, 0x2d, 0xd9, 0x2e, 0x54, 0x1e, 0x82, 0xe9, 0xbd, 0xa2, 0xb5, 0xc2, 0x55, 0x71, 0x62, 0xbf,
|
0x64, 0x3b, 0x50, 0x7a, 0xf0, 0x82, 0x99, 0xa4, 0xb5, 0xe4, 0xca, 0xe2, 0xd8, 0x78, 0x5f, 0x70,
|
||||||
0xb4, 0xfc, 0x19, 0x6c, 0x1b, 0x0a, 0x61, 0xba, 0xec, 0x74, 0x6b, 0xd5, 0xe9, 0x4b, 0x4f, 0xb2,
|
0xa6, 0xb0, 0xa5, 0x29, 0x84, 0x93, 0x65, 0xa7, 0x17, 0x56, 0x9d, 0xbe, 0xf4, 0x24, 0x63, 0xe5,
|
||||||
0x57, 0x9e, 0x44, 0xfe, 0xc6, 0xd2, 0xdf, 0x8e, 0xf2, 0x77, 0x59, 0xfb, 0x5f, 0x1d, 0xc9, 0x6e,
|
0x49, 0xe4, 0x6f, 0xcc, 0xfd, 0x6d, 0x4a, 0x7f, 0xe7, 0xb5, 0xf3, 0xc3, 0x14, 0xec, 0xb6, 0xbd,
|
||||||
0x37, 0xc8, 0x03, 0x22, 0x0b, 0x8d, 0x04, 0xe3, 0x22, 0xc1, 0x99, 0x91, 0x60, 0x55, 0xd1, 0xcd,
|
0xd4, 0x23, 0xb2, 0x50, 0x4b, 0x30, 0x2e, 0x12, 0x9c, 0x68, 0x09, 0x96, 0x15, 0xdd, 0x8c, 0x8a,
|
||||||
0xa8, 0x49, 0xa7, 0x52, 0xac, 0x43, 0x44, 0x64, 0x54, 0x48, 0xa7, 0x94, 0x2f, 0x4b, 0xea, 0x1d,
|
0x74, 0x32, 0xc5, 0x2a, 0x44, 0x44, 0x86, 0x99, 0x74, 0x52, 0xf9, 0xbc, 0xa4, 0xde, 0xbe, 0x22,
|
||||||
0x6a, 0xd2, 0x15, 0xb2, 0x0f, 0xcd, 0x8c, 0xa3, 0x36, 0xb9, 0x4a, 0xb1, 0x0e, 0xd1, 0xe9, 0x45,
|
0x5d, 0x26, 0x7b, 0x5f, 0xcf, 0x38, 0x2a, 0x93, 0xcb, 0x14, 0xab, 0x10, 0x9d, 0x9e, 0x35, 0x08,
|
||||||
0x83, 0x94, 0xde, 0xe5, 0x65, 0x69, 0x4c, 0x5c, 0x37, 0x27, 0x26, 0x41, 0x50, 0xcc, 0x64, 0x88,
|
0xe9, 0x2d, 0x37, 0x2f, 0xb5, 0x89, 0xab, 0xfa, 0xc4, 0x24, 0x08, 0xf2, 0xa9, 0x08, 0xb1, 0xe9,
|
||||||
0x1d, 0x4e, 0x4b, 0xca, 0x38, 0x2e, 0x67, 0x1c, 0x54, 0xc6, 0x71, 0x4d, 0xc6, 0xd1, 0x0c, 0x87,
|
0xd2, 0x92, 0x32, 0x8e, 0xcb, 0x19, 0x07, 0x99, 0x71, 0x5c, 0x93, 0x71, 0xd4, 0xc3, 0x21, 0x3d,
|
||||||
0xf2, 0xc0, 0x12, 0x4a, 0xe1, 0x40, 0x23, 0x1c, 0x2a, 0xbf, 0x26, 0x28, 0x59, 0xd0, 0xb4, 0xdb,
|
0xb0, 0x84, 0x52, 0x38, 0x50, 0x0b, 0x87, 0xcc, 0xaf, 0x0e, 0x0a, 0x16, 0x14, 0xed, 0x36, 0xe4,
|
||||||
0x54, 0x33, 0x6a, 0xd0, 0xe9, 0xde, 0xc7, 0xdd, 0xce, 0xa1, 0xfa, 0x61, 0xbe, 0xd2, 0x92, 0xfc,
|
0x8c, 0x0a, 0xe4, 0x74, 0x61, 0xeb, 0x6a, 0x38, 0x0c, 0xfc, 0x88, 0x5f, 0xcf, 0xf0, 0xbe, 0x13,
|
||||||
0xa9, 0x2a, 0x7f, 0x9d, 0xc7, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x38, 0x51, 0xff, 0xb4, 0x4d,
|
0x0d, 0x63, 0xf2, 0xcf, 0x8d, 0x9f, 0x06, 0x3c, 0x53, 0x49, 0x16, 0x8c, 0x41, 0xb1, 0xcd, 0xb1,
|
||||||
0x07, 0x00, 0x00,
|
0x9f, 0x49, 0x24, 0xd6, 0x34, 0xea, 0xe9, 0x53, 0x9a, 0xe5, 0x92, 0x96, 0x27, 0xbb, 0xdf, 0x76,
|
||||||
|
0x5a, 0x07, 0xf2, 0xfb, 0xfb, 0x41, 0xf9, 0x63, 0xf8, 0x5e, 0x16, 0x5f, 0xe2, 0xa3, 0x3f, 0x01,
|
||||||
|
0x00, 0x00, 0xff, 0xff, 0xf1, 0x1f, 0x85, 0x3b, 0x9c, 0x07, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,3 +87,9 @@ message MsgData {
|
|||||||
string clientMsgID =13;
|
string clientMsgID =13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message OfflinePushInfo{
|
||||||
|
string Title = 1;
|
||||||
|
string Desc = 2;
|
||||||
|
string Ext = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+539
-49
@@ -35,7 +35,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} }
|
|||||||
func (m *CommonResp) String() string { return proto.CompactTextString(m) }
|
func (m *CommonResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*CommonResp) ProtoMessage() {}
|
func (*CommonResp) ProtoMessage() {}
|
||||||
func (*CommonResp) Descriptor() ([]byte, []int) {
|
func (*CommonResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{0}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{0}
|
||||||
}
|
}
|
||||||
func (m *CommonResp) XXX_Unmarshal(b []byte) error {
|
func (m *CommonResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_CommonResp.Unmarshal(m, b)
|
return xxx_messageInfo_CommonResp.Unmarshal(m, b)
|
||||||
@@ -81,7 +81,7 @@ func (m *DeleteUsersResp) Reset() { *m = DeleteUsersResp{} }
|
|||||||
func (m *DeleteUsersResp) String() string { return proto.CompactTextString(m) }
|
func (m *DeleteUsersResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DeleteUsersResp) ProtoMessage() {}
|
func (*DeleteUsersResp) ProtoMessage() {}
|
||||||
func (*DeleteUsersResp) Descriptor() ([]byte, []int) {
|
func (*DeleteUsersResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{1}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{1}
|
||||||
}
|
}
|
||||||
func (m *DeleteUsersResp) XXX_Unmarshal(b []byte) error {
|
func (m *DeleteUsersResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DeleteUsersResp.Unmarshal(m, b)
|
return xxx_messageInfo_DeleteUsersResp.Unmarshal(m, b)
|
||||||
@@ -128,7 +128,7 @@ func (m *DeleteUsersReq) Reset() { *m = DeleteUsersReq{} }
|
|||||||
func (m *DeleteUsersReq) String() string { return proto.CompactTextString(m) }
|
func (m *DeleteUsersReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DeleteUsersReq) ProtoMessage() {}
|
func (*DeleteUsersReq) ProtoMessage() {}
|
||||||
func (*DeleteUsersReq) Descriptor() ([]byte, []int) {
|
func (*DeleteUsersReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{2}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{2}
|
||||||
}
|
}
|
||||||
func (m *DeleteUsersReq) XXX_Unmarshal(b []byte) error {
|
func (m *DeleteUsersReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_DeleteUsersReq.Unmarshal(m, b)
|
return xxx_messageInfo_DeleteUsersReq.Unmarshal(m, b)
|
||||||
@@ -181,7 +181,7 @@ func (m *GetAllUsersUidReq) Reset() { *m = GetAllUsersUidReq{} }
|
|||||||
func (m *GetAllUsersUidReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetAllUsersUidReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetAllUsersUidReq) ProtoMessage() {}
|
func (*GetAllUsersUidReq) ProtoMessage() {}
|
||||||
func (*GetAllUsersUidReq) Descriptor() ([]byte, []int) {
|
func (*GetAllUsersUidReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{3}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{3}
|
||||||
}
|
}
|
||||||
func (m *GetAllUsersUidReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetAllUsersUidReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetAllUsersUidReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetAllUsersUidReq.Unmarshal(m, b)
|
||||||
@@ -227,7 +227,7 @@ func (m *GetAllUsersUidResp) Reset() { *m = GetAllUsersUidResp{} }
|
|||||||
func (m *GetAllUsersUidResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetAllUsersUidResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetAllUsersUidResp) ProtoMessage() {}
|
func (*GetAllUsersUidResp) ProtoMessage() {}
|
||||||
func (*GetAllUsersUidResp) Descriptor() ([]byte, []int) {
|
func (*GetAllUsersUidResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{4}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{4}
|
||||||
}
|
}
|
||||||
func (m *GetAllUsersUidResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetAllUsersUidResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetAllUsersUidResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetAllUsersUidResp.Unmarshal(m, b)
|
||||||
@@ -274,7 +274,7 @@ func (m *GetUserInfoReq) Reset() { *m = GetUserInfoReq{} }
|
|||||||
func (m *GetUserInfoReq) String() string { return proto.CompactTextString(m) }
|
func (m *GetUserInfoReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetUserInfoReq) ProtoMessage() {}
|
func (*GetUserInfoReq) ProtoMessage() {}
|
||||||
func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
|
func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{5}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{5}
|
||||||
}
|
}
|
||||||
func (m *GetUserInfoReq) XXX_Unmarshal(b []byte) error {
|
func (m *GetUserInfoReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetUserInfoReq.Unmarshal(m, b)
|
return xxx_messageInfo_GetUserInfoReq.Unmarshal(m, b)
|
||||||
@@ -328,7 +328,7 @@ func (m *GetUserInfoResp) Reset() { *m = GetUserInfoResp{} }
|
|||||||
func (m *GetUserInfoResp) String() string { return proto.CompactTextString(m) }
|
func (m *GetUserInfoResp) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetUserInfoResp) ProtoMessage() {}
|
func (*GetUserInfoResp) ProtoMessage() {}
|
||||||
func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
|
func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{6}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{6}
|
||||||
}
|
}
|
||||||
func (m *GetUserInfoResp) XXX_Unmarshal(b []byte) error {
|
func (m *GetUserInfoResp) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_GetUserInfoResp.Unmarshal(m, b)
|
return xxx_messageInfo_GetUserInfoResp.Unmarshal(m, b)
|
||||||
@@ -387,7 +387,7 @@ func (m *UserInfo) Reset() { *m = UserInfo{} }
|
|||||||
func (m *UserInfo) String() string { return proto.CompactTextString(m) }
|
func (m *UserInfo) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UserInfo) ProtoMessage() {}
|
func (*UserInfo) ProtoMessage() {}
|
||||||
func (*UserInfo) Descriptor() ([]byte, []int) {
|
func (*UserInfo) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{7}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{7}
|
||||||
}
|
}
|
||||||
func (m *UserInfo) XXX_Unmarshal(b []byte) error {
|
func (m *UserInfo) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_UserInfo.Unmarshal(m, b)
|
return xxx_messageInfo_UserInfo.Unmarshal(m, b)
|
||||||
@@ -475,7 +475,7 @@ func (m *LogoutReq) Reset() { *m = LogoutReq{} }
|
|||||||
func (m *LogoutReq) String() string { return proto.CompactTextString(m) }
|
func (m *LogoutReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*LogoutReq) ProtoMessage() {}
|
func (*LogoutReq) ProtoMessage() {}
|
||||||
func (*LogoutReq) Descriptor() ([]byte, []int) {
|
func (*LogoutReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{8}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{8}
|
||||||
}
|
}
|
||||||
func (m *LogoutReq) XXX_Unmarshal(b []byte) error {
|
func (m *LogoutReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_LogoutReq.Unmarshal(m, b)
|
return xxx_messageInfo_LogoutReq.Unmarshal(m, b)
|
||||||
@@ -529,7 +529,7 @@ func (m *UpdateUserInfoReq) Reset() { *m = UpdateUserInfoReq{} }
|
|||||||
func (m *UpdateUserInfoReq) String() string { return proto.CompactTextString(m) }
|
func (m *UpdateUserInfoReq) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UpdateUserInfoReq) ProtoMessage() {}
|
func (*UpdateUserInfoReq) ProtoMessage() {}
|
||||||
func (*UpdateUserInfoReq) Descriptor() ([]byte, []int) {
|
func (*UpdateUserInfoReq) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_user_9e1dacb346b997d7, []int{9}
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{9}
|
||||||
}
|
}
|
||||||
func (m *UpdateUserInfoReq) XXX_Unmarshal(b []byte) error {
|
func (m *UpdateUserInfoReq) XXX_Unmarshal(b []byte) error {
|
||||||
return xxx_messageInfo_UpdateUserInfoReq.Unmarshal(m, b)
|
return xxx_messageInfo_UpdateUserInfoReq.Unmarshal(m, b)
|
||||||
@@ -619,6 +619,376 @@ func (m *UpdateUserInfoReq) GetUid() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SetReceiveMessageOptReq struct {
|
||||||
|
UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"`
|
||||||
|
Opt int32 `protobuf:"varint,2,opt,name=opt" json:"opt,omitempty"`
|
||||||
|
ConversationId []string `protobuf:"bytes,3,rep,name=conversationId" json:"conversationId,omitempty"`
|
||||||
|
OperationID string `protobuf:"bytes,4,opt,name=operationID" json:"operationID,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptReq) Reset() { *m = SetReceiveMessageOptReq{} }
|
||||||
|
func (m *SetReceiveMessageOptReq) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*SetReceiveMessageOptReq) ProtoMessage() {}
|
||||||
|
func (*SetReceiveMessageOptReq) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{10}
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptReq) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_SetReceiveMessageOptReq.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_SetReceiveMessageOptReq.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *SetReceiveMessageOptReq) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_SetReceiveMessageOptReq.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptReq) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_SetReceiveMessageOptReq.Size(m)
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptReq) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_SetReceiveMessageOptReq.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_SetReceiveMessageOptReq proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptReq) GetUId() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.UId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptReq) GetOpt() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Opt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptReq) GetConversationId() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ConversationId
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptReq) GetOperationID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.OperationID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetReceiveMessageOptResp struct {
|
||||||
|
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||||
|
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||||
|
OptResult []*OptResult `protobuf:"bytes,3,rep,name=optResult" json:"optResult,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptResp) Reset() { *m = SetReceiveMessageOptResp{} }
|
||||||
|
func (m *SetReceiveMessageOptResp) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*SetReceiveMessageOptResp) ProtoMessage() {}
|
||||||
|
func (*SetReceiveMessageOptResp) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{11}
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptResp) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_SetReceiveMessageOptResp.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_SetReceiveMessageOptResp.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *SetReceiveMessageOptResp) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_SetReceiveMessageOptResp.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptResp) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_SetReceiveMessageOptResp.Size(m)
|
||||||
|
}
|
||||||
|
func (m *SetReceiveMessageOptResp) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_SetReceiveMessageOptResp.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_SetReceiveMessageOptResp proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptResp) GetErrCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptResp) GetErrMsg() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrMsg
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *SetReceiveMessageOptResp) GetOptResult() []*OptResult {
|
||||||
|
if m != nil {
|
||||||
|
return m.OptResult
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetReceiveMessageOptReq struct {
|
||||||
|
UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"`
|
||||||
|
ConversationId []string `protobuf:"bytes,2,rep,name=conversationId" json:"conversationId,omitempty"`
|
||||||
|
OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptReq) Reset() { *m = GetReceiveMessageOptReq{} }
|
||||||
|
func (m *GetReceiveMessageOptReq) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetReceiveMessageOptReq) ProtoMessage() {}
|
||||||
|
func (*GetReceiveMessageOptReq) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{12}
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptReq) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetReceiveMessageOptReq.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetReceiveMessageOptReq.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetReceiveMessageOptReq) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetReceiveMessageOptReq.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptReq) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetReceiveMessageOptReq.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptReq) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetReceiveMessageOptReq.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetReceiveMessageOptReq proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptReq) GetUId() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.UId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptReq) GetConversationId() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ConversationId
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptReq) GetOperationID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.OperationID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type OptResult struct {
|
||||||
|
ConversationId string `protobuf:"bytes,1,opt,name=conversationId" json:"conversationId,omitempty"`
|
||||||
|
Result int32 `protobuf:"varint,2,opt,name=result" json:"result,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OptResult) Reset() { *m = OptResult{} }
|
||||||
|
func (m *OptResult) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*OptResult) ProtoMessage() {}
|
||||||
|
func (*OptResult) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{13}
|
||||||
|
}
|
||||||
|
func (m *OptResult) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_OptResult.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *OptResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_OptResult.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *OptResult) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_OptResult.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *OptResult) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_OptResult.Size(m)
|
||||||
|
}
|
||||||
|
func (m *OptResult) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_OptResult.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_OptResult proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *OptResult) GetConversationId() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ConversationId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OptResult) GetResult() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Result
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetReceiveMessageOptResp struct {
|
||||||
|
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||||
|
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||||
|
ConversationOptResult []*OptResult `protobuf:"bytes,3,rep,name=conversationOptResult" json:"conversationOptResult,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptResp) Reset() { *m = GetReceiveMessageOptResp{} }
|
||||||
|
func (m *GetReceiveMessageOptResp) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetReceiveMessageOptResp) ProtoMessage() {}
|
||||||
|
func (*GetReceiveMessageOptResp) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{14}
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptResp) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetReceiveMessageOptResp.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetReceiveMessageOptResp.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetReceiveMessageOptResp) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetReceiveMessageOptResp.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptResp) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetReceiveMessageOptResp.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetReceiveMessageOptResp) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetReceiveMessageOptResp.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetReceiveMessageOptResp proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptResp) GetErrCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptResp) GetErrMsg() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrMsg
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetReceiveMessageOptResp) GetConversationOptResult() []*OptResult {
|
||||||
|
if m != nil {
|
||||||
|
return m.ConversationOptResult
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetAllConversationMsgOptReq struct {
|
||||||
|
UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"`
|
||||||
|
OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptReq) Reset() { *m = GetAllConversationMsgOptReq{} }
|
||||||
|
func (m *GetAllConversationMsgOptReq) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetAllConversationMsgOptReq) ProtoMessage() {}
|
||||||
|
func (*GetAllConversationMsgOptReq) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{15}
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptReq) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetAllConversationMsgOptReq.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetAllConversationMsgOptReq.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetAllConversationMsgOptReq) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetAllConversationMsgOptReq.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptReq) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetAllConversationMsgOptReq.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptReq) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetAllConversationMsgOptReq.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetAllConversationMsgOptReq proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptReq) GetUId() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.UId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptReq) GetOperationID() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.OperationID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetAllConversationMsgOptResp struct {
|
||||||
|
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||||
|
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||||
|
ConversationOptResult []*OptResult `protobuf:"bytes,3,rep,name=conversationOptResult" json:"conversationOptResult,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptResp) Reset() { *m = GetAllConversationMsgOptResp{} }
|
||||||
|
func (m *GetAllConversationMsgOptResp) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetAllConversationMsgOptResp) ProtoMessage() {}
|
||||||
|
func (*GetAllConversationMsgOptResp) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_user_2aac409c3ed42d0b, []int{16}
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptResp) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetAllConversationMsgOptResp.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetAllConversationMsgOptResp.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (dst *GetAllConversationMsgOptResp) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetAllConversationMsgOptResp.Merge(dst, src)
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptResp) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetAllConversationMsgOptResp.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetAllConversationMsgOptResp) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetAllConversationMsgOptResp.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetAllConversationMsgOptResp proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptResp) GetErrCode() int32 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptResp) GetErrMsg() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.ErrMsg
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetAllConversationMsgOptResp) GetConversationOptResult() []*OptResult {
|
||||||
|
if m != nil {
|
||||||
|
return m.ConversationOptResult
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*CommonResp)(nil), "user.CommonResp")
|
proto.RegisterType((*CommonResp)(nil), "user.CommonResp")
|
||||||
proto.RegisterType((*DeleteUsersResp)(nil), "user.DeleteUsersResp")
|
proto.RegisterType((*DeleteUsersResp)(nil), "user.DeleteUsersResp")
|
||||||
@@ -630,6 +1000,13 @@ func init() {
|
|||||||
proto.RegisterType((*UserInfo)(nil), "user.UserInfo")
|
proto.RegisterType((*UserInfo)(nil), "user.UserInfo")
|
||||||
proto.RegisterType((*LogoutReq)(nil), "user.LogoutReq")
|
proto.RegisterType((*LogoutReq)(nil), "user.LogoutReq")
|
||||||
proto.RegisterType((*UpdateUserInfoReq)(nil), "user.UpdateUserInfoReq")
|
proto.RegisterType((*UpdateUserInfoReq)(nil), "user.UpdateUserInfoReq")
|
||||||
|
proto.RegisterType((*SetReceiveMessageOptReq)(nil), "user.SetReceiveMessageOptReq")
|
||||||
|
proto.RegisterType((*SetReceiveMessageOptResp)(nil), "user.SetReceiveMessageOptResp")
|
||||||
|
proto.RegisterType((*GetReceiveMessageOptReq)(nil), "user.GetReceiveMessageOptReq")
|
||||||
|
proto.RegisterType((*OptResult)(nil), "user.OptResult")
|
||||||
|
proto.RegisterType((*GetReceiveMessageOptResp)(nil), "user.GetReceiveMessageOptResp")
|
||||||
|
proto.RegisterType((*GetAllConversationMsgOptReq)(nil), "user.GetAllConversationMsgOptReq")
|
||||||
|
proto.RegisterType((*GetAllConversationMsgOptResp)(nil), "user.GetAllConversationMsgOptResp")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@@ -647,6 +1024,9 @@ type UserClient interface {
|
|||||||
UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*CommonResp, error)
|
UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||||
DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error)
|
DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error)
|
||||||
GetAllUsersUid(ctx context.Context, in *GetAllUsersUidReq, opts ...grpc.CallOption) (*GetAllUsersUidResp, error)
|
GetAllUsersUid(ctx context.Context, in *GetAllUsersUidReq, opts ...grpc.CallOption) (*GetAllUsersUidResp, error)
|
||||||
|
SetReceiveMessageOpt(ctx context.Context, in *SetReceiveMessageOptReq, opts ...grpc.CallOption) (*SetReceiveMessageOptResp, error)
|
||||||
|
GetReceiveMessageOpt(ctx context.Context, in *GetReceiveMessageOptReq, opts ...grpc.CallOption) (*GetReceiveMessageOptResp, error)
|
||||||
|
GetAllConversationMsgOpt(ctx context.Context, in *GetAllConversationMsgOptReq, opts ...grpc.CallOption) (*GetAllConversationMsgOptResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type userClient struct {
|
type userClient struct {
|
||||||
@@ -693,6 +1073,33 @@ func (c *userClient) GetAllUsersUid(ctx context.Context, in *GetAllUsersUidReq,
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *userClient) SetReceiveMessageOpt(ctx context.Context, in *SetReceiveMessageOptReq, opts ...grpc.CallOption) (*SetReceiveMessageOptResp, error) {
|
||||||
|
out := new(SetReceiveMessageOptResp)
|
||||||
|
err := grpc.Invoke(ctx, "/user.user/SetReceiveMessageOpt", in, out, c.cc, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) GetReceiveMessageOpt(ctx context.Context, in *GetReceiveMessageOptReq, opts ...grpc.CallOption) (*GetReceiveMessageOptResp, error) {
|
||||||
|
out := new(GetReceiveMessageOptResp)
|
||||||
|
err := grpc.Invoke(ctx, "/user.user/GetReceiveMessageOpt", in, out, c.cc, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) GetAllConversationMsgOpt(ctx context.Context, in *GetAllConversationMsgOptReq, opts ...grpc.CallOption) (*GetAllConversationMsgOptResp, error) {
|
||||||
|
out := new(GetAllConversationMsgOptResp)
|
||||||
|
err := grpc.Invoke(ctx, "/user.user/GetAllConversationMsgOpt", in, out, c.cc, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Server API for User service
|
// Server API for User service
|
||||||
|
|
||||||
type UserServer interface {
|
type UserServer interface {
|
||||||
@@ -700,6 +1107,9 @@ type UserServer interface {
|
|||||||
UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*CommonResp, error)
|
UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*CommonResp, error)
|
||||||
DeleteUsers(context.Context, *DeleteUsersReq) (*DeleteUsersResp, error)
|
DeleteUsers(context.Context, *DeleteUsersReq) (*DeleteUsersResp, error)
|
||||||
GetAllUsersUid(context.Context, *GetAllUsersUidReq) (*GetAllUsersUidResp, error)
|
GetAllUsersUid(context.Context, *GetAllUsersUidReq) (*GetAllUsersUidResp, error)
|
||||||
|
SetReceiveMessageOpt(context.Context, *SetReceiveMessageOptReq) (*SetReceiveMessageOptResp, error)
|
||||||
|
GetReceiveMessageOpt(context.Context, *GetReceiveMessageOptReq) (*GetReceiveMessageOptResp, error)
|
||||||
|
GetAllConversationMsgOpt(context.Context, *GetAllConversationMsgOptReq) (*GetAllConversationMsgOptResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterUserServer(s *grpc.Server, srv UserServer) {
|
func RegisterUserServer(s *grpc.Server, srv UserServer) {
|
||||||
@@ -778,6 +1188,60 @@ func _User_GetAllUsersUid_Handler(srv interface{}, ctx context.Context, dec func
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _User_SetReceiveMessageOpt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(SetReceiveMessageOptReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).SetReceiveMessageOpt(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/user.user/SetReceiveMessageOpt",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).SetReceiveMessageOpt(ctx, req.(*SetReceiveMessageOptReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_GetReceiveMessageOpt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetReceiveMessageOptReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).GetReceiveMessageOpt(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/user.user/GetReceiveMessageOpt",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).GetReceiveMessageOpt(ctx, req.(*GetReceiveMessageOptReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_GetAllConversationMsgOpt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetAllConversationMsgOptReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).GetAllConversationMsgOpt(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/user.user/GetAllConversationMsgOpt",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).GetAllConversationMsgOpt(ctx, req.(*GetAllConversationMsgOptReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _User_serviceDesc = grpc.ServiceDesc{
|
var _User_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "user.user",
|
ServiceName: "user.user",
|
||||||
HandlerType: (*UserServer)(nil),
|
HandlerType: (*UserServer)(nil),
|
||||||
@@ -798,49 +1262,75 @@ var _User_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetAllUsersUid",
|
MethodName: "GetAllUsersUid",
|
||||||
Handler: _User_GetAllUsersUid_Handler,
|
Handler: _User_GetAllUsersUid_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SetReceiveMessageOpt",
|
||||||
|
Handler: _User_SetReceiveMessageOpt_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetReceiveMessageOpt",
|
||||||
|
Handler: _User_GetReceiveMessageOpt_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetAllConversationMsgOpt",
|
||||||
|
Handler: _User_GetAllConversationMsgOpt_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "user/user.proto",
|
Metadata: "user/user.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_9e1dacb346b997d7) }
|
func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_2aac409c3ed42d0b) }
|
||||||
|
|
||||||
var fileDescriptor_user_9e1dacb346b997d7 = []byte{
|
var fileDescriptor_user_2aac409c3ed42d0b = []byte{
|
||||||
// 562 bytes of a gzipped FileDescriptorProto
|
// 796 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcb, 0x6e, 0xdb, 0x3a,
|
||||||
0x10, 0x95, 0xed, 0x24, 0x8d, 0x27, 0x6a, 0x92, 0xae, 0x0a, 0xac, 0x22, 0x84, 0x22, 0x8b, 0x43,
|
0x10, 0x85, 0xfc, 0x8a, 0x35, 0x46, 0xec, 0x84, 0xc8, 0x83, 0xf0, 0xcd, 0x0d, 0x7c, 0x89, 0x8b,
|
||||||
0x4e, 0x01, 0x85, 0x1b, 0x3d, 0x41, 0x22, 0xaa, 0x88, 0xa2, 0x4a, 0x96, 0x7c, 0xe1, 0x84, 0xd3,
|
0xc2, 0x9b, 0xa6, 0x45, 0xba, 0x6b, 0x56, 0xad, 0xdd, 0x1a, 0x46, 0x12, 0x18, 0x55, 0xe1, 0x4d,
|
||||||
0x9d, 0xa6, 0x2b, 0x1c, 0xaf, 0xb1, 0x37, 0x52, 0x8f, 0xfc, 0x24, 0xfe, 0x1a, 0xff, 0x00, 0xed,
|
0x57, 0x55, 0xac, 0x89, 0x23, 0xd4, 0x16, 0x55, 0x49, 0x0e, 0x02, 0xf4, 0x03, 0xba, 0x2e, 0xba,
|
||||||
0x38, 0x4e, 0xfc, 0x55, 0x0e, 0x70, 0xb1, 0x76, 0xde, 0xae, 0xdf, 0xdb, 0x37, 0x33, 0x3b, 0x30,
|
0xe8, 0x6f, 0xf4, 0xd7, 0xfa, 0x07, 0x05, 0x49, 0xcb, 0xa2, 0x1e, 0x76, 0x82, 0xb6, 0x40, 0x37,
|
||||||
0xda, 0x67, 0x98, 0xbe, 0x31, 0x9f, 0x79, 0x92, 0x2a, 0xad, 0x58, 0xc7, 0xac, 0xbd, 0x4f, 0x00,
|
0x02, 0xe7, 0x90, 0x3c, 0xc3, 0x33, 0x33, 0xe4, 0x08, 0x5a, 0x8b, 0x10, 0x83, 0x27, 0xe2, 0x73,
|
||||||
0x4b, 0xb5, 0xdb, 0xa9, 0xd8, 0xc7, 0x2c, 0x61, 0x2f, 0xc1, 0xc5, 0x34, 0x55, 0xe9, 0x52, 0x09,
|
0xe2, 0x07, 0x3c, 0xe2, 0xa4, 0x22, 0xc6, 0xec, 0x35, 0x40, 0x8f, 0xcf, 0xe7, 0xdc, 0xb3, 0x30,
|
||||||
0xe4, 0xd6, 0xd4, 0x9a, 0x75, 0xfd, 0x13, 0xc0, 0x26, 0xd0, 0xa7, 0xe0, 0x4b, 0xb6, 0xe5, 0xf6,
|
0xf4, 0xc9, 0x11, 0x98, 0x18, 0x04, 0x3c, 0xe8, 0x71, 0x07, 0xa9, 0xd1, 0x31, 0xba, 0x55, 0x2b,
|
||||||
0xd4, 0x9a, 0xb9, 0xfe, 0x31, 0xf6, 0x24, 0x8c, 0x56, 0x18, 0xa1, 0xc6, 0x20, 0xc3, 0x34, 0x23,
|
0x01, 0x48, 0x1b, 0xea, 0xd2, 0xb8, 0x0c, 0xa7, 0xb4, 0xd4, 0x31, 0xba, 0xa6, 0xb5, 0xb2, 0x99,
|
||||||
0xb2, 0xb7, 0x00, 0x77, 0x47, 0x6a, 0x62, 0x1b, 0x2c, 0xc6, 0x73, 0xba, 0xc1, 0x49, 0xd2, 0x2f,
|
0x0b, 0xad, 0x3e, 0xce, 0x30, 0xc2, 0x71, 0x88, 0x41, 0x28, 0xc9, 0x9e, 0x02, 0x4c, 0x56, 0xd4,
|
||||||
0x9d, 0x61, 0xaf, 0xe1, 0xfc, 0x3e, 0x94, 0x11, 0x8a, 0x40, 0x8a, 0x1b, 0x99, 0x69, 0x6e, 0x4f,
|
0x92, 0xad, 0x71, 0xba, 0x73, 0x22, 0x4f, 0x90, 0xb8, 0xb4, 0xb4, 0x35, 0xe4, 0x7f, 0xd8, 0xbe,
|
||||||
0x9d, 0x99, 0xeb, 0x57, 0x41, 0x2f, 0x86, 0x61, 0x45, 0xea, 0x87, 0xf9, 0x4f, 0xe4, 0x48, 0xf5,
|
0xb6, 0xdd, 0x19, 0x3a, 0x63, 0xd7, 0xb9, 0x70, 0xc3, 0x88, 0x96, 0x3a, 0xe5, 0xae, 0x69, 0xa5,
|
||||||
0xbf, 0x0a, 0xc8, 0x2e, 0xa1, 0xab, 0xd5, 0x77, 0x8c, 0xb9, 0x43, 0x77, 0xcf, 0x03, 0x36, 0x85,
|
0x41, 0xe6, 0x41, 0x33, 0xe5, 0xea, 0xa3, 0xd8, 0xe7, 0x28, 0x24, 0xbd, 0x2f, 0x05, 0x92, 0x3d,
|
||||||
0xc1, 0x6d, 0x82, 0x69, 0xa8, 0xa5, 0x8a, 0xd7, 0x2b, 0xde, 0xa1, 0xbd, 0x32, 0xe4, 0x7d, 0x86,
|
0xa8, 0x46, 0xfc, 0x03, 0x7a, 0xb4, 0x2c, 0xcf, 0xae, 0x0c, 0xd2, 0x81, 0xc6, 0xc8, 0xc7, 0xc0,
|
||||||
0x8b, 0x6b, 0xd4, 0x1f, 0xa2, 0x88, 0xf4, 0x02, 0x29, 0x8c, 0xe4, 0x91, 0xcc, 0xae, 0x91, 0xa9,
|
0x8e, 0x5c, 0xee, 0x0d, 0xfb, 0xb4, 0x22, 0xe7, 0x74, 0x88, 0x9d, 0xc3, 0xee, 0x00, 0xa3, 0x17,
|
||||||
0x12, 0x59, 0x2e, 0x54, 0x86, 0xbc, 0x6f, 0xc0, 0xea, 0x64, 0xff, 0x94, 0x2a, 0x0e, 0x67, 0xfb,
|
0xb3, 0x99, 0xf4, 0x37, 0x76, 0x1d, 0xe1, 0x72, 0x45, 0x56, 0xca, 0x90, 0x71, 0x8d, 0x4c, 0x39,
|
||||||
0x8a, 0xd9, 0x22, 0xf4, 0x1e, 0x60, 0x78, 0x8d, 0xda, 0xd0, 0xaf, 0xe3, 0x7b, 0x65, 0xee, 0xfa,
|
0xd2, 0x21, 0xf6, 0x1e, 0x48, 0x96, 0xec, 0x97, 0x42, 0x45, 0x61, 0x6b, 0x91, 0x12, 0x1b, 0x9b,
|
||||||
0x0a, 0xc0, 0x50, 0xad, 0x57, 0x74, 0xdc, 0xa2, 0xe3, 0x25, 0xe4, 0x69, 0x2f, 0xb7, 0x4d, 0x2f,
|
0xec, 0x06, 0x9a, 0x03, 0x8c, 0x04, 0xfd, 0xd0, 0xbb, 0xe6, 0xe2, 0xac, 0xc7, 0x00, 0x82, 0x6a,
|
||||||
0xe5, 0xc4, 0x28, 0x18, 0x55, 0x94, 0xfe, 0xa7, 0x81, 0x98, 0x07, 0x9d, 0x55, 0xa8, 0x43, 0xee,
|
0xd8, 0x97, 0xcb, 0x0d, 0xb9, 0x5c, 0x43, 0xd6, 0x6b, 0x19, 0xe5, 0xb5, 0xe8, 0x81, 0xe1, 0xd0,
|
||||||
0x4c, 0x9d, 0xd9, 0x60, 0x31, 0xcc, 0xcd, 0x1f, 0xb9, 0x69, 0xcf, 0xfb, 0x65, 0x41, 0xbf, 0x80,
|
0x4a, 0x79, 0xfa, 0x9d, 0x02, 0x22, 0x0c, 0x2a, 0x7d, 0x3b, 0xb2, 0x69, 0xb9, 0x53, 0xee, 0x36,
|
||||||
0xd8, 0x18, 0x9c, 0xbd, 0x14, 0x24, 0xe2, 0xfa, 0x66, 0xc9, 0x18, 0x74, 0xe2, 0x70, 0x87, 0x07,
|
0x4e, 0x9b, 0x4a, 0xfc, 0x8a, 0x5b, 0xce, 0xb1, 0xef, 0x06, 0xd4, 0x63, 0x88, 0xec, 0x40, 0x79,
|
||||||
0x6a, 0x5a, 0x1b, 0x4c, 0xde, 0xa9, 0xa2, 0xe6, 0xb4, 0x66, 0xcf, 0xa1, 0xb7, 0xc5, 0x58, 0x60,
|
0xe1, 0x3a, 0xd2, 0x89, 0x69, 0x89, 0x21, 0x21, 0x50, 0xf1, 0xec, 0x39, 0x2e, 0xa9, 0xe5, 0x58,
|
||||||
0x4a, 0xd5, 0xee, 0xfa, 0x87, 0xc8, 0xe0, 0x3b, 0xb5, 0x91, 0x11, 0xf2, 0x2e, 0x9d, 0x3e, 0x44,
|
0x60, 0xee, 0x84, 0xc7, 0x39, 0x97, 0x63, 0x72, 0x00, 0xb5, 0x29, 0x7a, 0x0e, 0x06, 0x32, 0xdb,
|
||||||
0x26, 0x3f, 0x1b, 0x99, 0xea, 0x07, 0xde, 0xcb, 0xf3, 0x43, 0x81, 0x41, 0x71, 0x17, 0xca, 0x88,
|
0x55, 0x6b, 0x69, 0x09, 0x7c, 0xce, 0xaf, 0xdc, 0x19, 0xd2, 0xaa, 0x5c, 0xbd, 0xb4, 0x44, 0x7c,
|
||||||
0x9f, 0xe5, 0x28, 0x05, 0x6c, 0x08, 0x36, 0x3e, 0xf2, 0x3e, 0x41, 0x36, 0x3e, 0x7a, 0x4b, 0x70,
|
0xae, 0xdc, 0x20, 0xba, 0xa1, 0x35, 0x15, 0x1f, 0x69, 0x08, 0x14, 0xe7, 0xb6, 0x3b, 0xa3, 0x5b,
|
||||||
0x6f, 0xd4, 0x56, 0xed, 0xb5, 0x29, 0x44, 0x2d, 0xa5, 0x56, 0x23, 0xa5, 0xed, 0xa5, 0xf0, 0x7e,
|
0x0a, 0x95, 0x06, 0x69, 0x42, 0x09, 0xef, 0x68, 0x5d, 0x42, 0x25, 0xbc, 0x63, 0x3d, 0x30, 0x2f,
|
||||||
0x5b, 0x70, 0x11, 0x24, 0x22, 0xcc, 0x5b, 0xbe, 0x28, 0x6b, 0x61, 0xcd, 0x2a, 0x59, 0x6b, 0x4b,
|
0xf8, 0x94, 0x2f, 0x22, 0x91, 0x88, 0x4c, 0x48, 0x8d, 0x5c, 0x48, 0x8b, 0x53, 0xc1, 0x7e, 0x18,
|
||||||
0xc1, 0xc9, 0xae, 0xf3, 0x84, 0xdd, 0x4e, 0xbb, 0xdd, 0x6e, 0xab, 0xdd, 0x5e, 0xd3, 0xee, 0x59,
|
0xb0, 0x3b, 0xf6, 0x1d, 0x5b, 0x95, 0x7c, 0x9c, 0xd6, 0x58, 0x9a, 0xa1, 0x49, 0x2b, 0x0a, 0x41,
|
||||||
0x61, 0xf7, 0x74, 0xff, 0xfe, 0x5f, 0x5a, 0xc9, 0x6d, 0xfa, 0x1e, 0x83, 0x13, 0x48, 0xc1, 0x21,
|
0x22, 0xb7, 0xbc, 0x46, 0x6e, 0xa5, 0x58, 0x6e, 0xb5, 0x50, 0x6e, 0x2d, 0x2f, 0x77, 0x2b, 0x96,
|
||||||
0x2f, 0x66, 0x20, 0xc5, 0xe2, 0xa7, 0x0d, 0x34, 0xa1, 0xd8, 0x7b, 0x18, 0x6c, 0x4f, 0x5d, 0xc6,
|
0x9b, 0x9c, 0xbf, 0xbe, 0xa1, 0x94, 0xcc, 0xbc, 0xee, 0x1d, 0x28, 0x8f, 0x5d, 0x87, 0x82, 0x4a,
|
||||||
0x2e, 0xf3, 0xce, 0xa8, 0xb6, 0xf8, 0xe4, 0x59, 0x0b, 0x9a, 0x25, 0xec, 0x0a, 0x86, 0xd5, 0xbc,
|
0xe6, 0xd8, 0x75, 0xd8, 0x67, 0x03, 0x0e, 0xdf, 0x62, 0x64, 0xe1, 0x04, 0xdd, 0x5b, 0xbc, 0xc4,
|
||||||
0xb1, 0x17, 0x87, 0xc6, 0xaa, 0x67, 0x73, 0xd2, 0x78, 0x6e, 0x46, 0xb8, 0x34, 0x67, 0x0a, 0xe1,
|
0x30, 0xb4, 0xa7, 0x38, 0xf2, 0x65, 0x1c, 0x45, 0xea, 0x87, 0x49, 0xea, 0x87, 0x8e, 0x40, 0xb8,
|
||||||
0xea, 0xe8, 0x29, 0x84, 0xeb, 0xb3, 0x6f, 0x49, 0x8f, 0xb0, 0xf4, 0xcc, 0x0b, 0xe1, 0xc6, 0x24,
|
0x1f, 0x49, 0xd9, 0x55, 0x4b, 0x0c, 0xc9, 0x23, 0x68, 0x4e, 0xb8, 0x77, 0x8b, 0x41, 0xa8, 0x7c,
|
||||||
0x99, 0xf0, 0xf6, 0x8d, 0x2c, 0xf9, 0x78, 0xfe, 0x75, 0x30, 0xa7, 0x89, 0x7d, 0x65, 0x3e, 0x9b,
|
0x38, 0xb2, 0xb2, 0x4c, 0x2b, 0x83, 0x66, 0xaf, 0x6c, 0x25, 0x7f, 0x65, 0x3f, 0x01, 0x2d, 0x3e,
|
||||||
0x1e, 0xcd, 0xed, 0x77, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x30, 0xbd, 0x59, 0x5b, 0xca, 0x05,
|
0x88, 0xba, 0x86, 0x18, 0xe8, 0xd5, 0x1e, 0x9b, 0x22, 0xba, 0x18, 0x68, 0x95, 0xbe, 0xb4, 0xc8,
|
||||||
0x00, 0x00,
|
0x63, 0x30, 0xb9, 0xdc, 0xbc, 0x98, 0x45, 0xcb, 0x62, 0x6f, 0xa9, 0x62, 0x1f, 0xc5, 0xb0, 0x95,
|
||||||
|
0xac, 0x60, 0x0b, 0x38, 0x1c, 0x3c, 0x38, 0x0a, 0x79, 0xcd, 0xa5, 0x87, 0x68, 0x2e, 0x78, 0xa6,
|
||||||
|
0xce, 0xc1, 0x5c, 0x1d, 0xa7, 0x80, 0x56, 0xf9, 0xcc, 0xd2, 0x1e, 0x40, 0x2d, 0x50, 0xba, 0x54,
|
||||||
|
0x1e, 0x96, 0x16, 0xfb, 0x6a, 0x00, 0x1d, 0xfc, 0xb9, 0x08, 0xbe, 0x82, 0x7d, 0xdd, 0xf1, 0xe8,
|
||||||
|
0xbe, 0x68, 0x16, 0xaf, 0x66, 0x6f, 0xe0, 0x1f, 0xf5, 0x12, 0xf7, 0xb4, 0xe9, 0xcb, 0x70, 0xba,
|
||||||
|
0x36, 0xba, 0x99, 0xa8, 0x95, 0xf2, 0x51, 0xfb, 0x66, 0xc0, 0xd1, 0x7a, 0xce, 0xbf, 0x28, 0xf6,
|
||||||
|
0xf4, 0x4b, 0x05, 0x64, 0xbf, 0x27, 0xcf, 0xa1, 0x31, 0x4d, 0xde, 0x6c, 0xb2, 0xa7, 0xf6, 0xa7,
|
||||||
|
0x1b, 0x46, 0x7b, 0xbf, 0x00, 0x0d, 0x7d, 0x72, 0x06, 0xcd, 0xf4, 0x2b, 0x44, 0x0e, 0x97, 0xcf,
|
||||||
|
0x74, 0xf6, 0x6d, 0x6a, 0xe7, 0x9a, 0x97, 0x70, 0xac, 0x75, 0xed, 0xd8, 0x71, 0xba, 0x91, 0xc7,
|
||||||
|
0x8e, 0xb3, 0x7f, 0x12, 0x3d, 0xd9, 0xd2, 0xb4, 0xa6, 0x19, 0x3b, 0xce, 0xf5, 0xe5, 0x36, 0x2d,
|
||||||
|
0x9e, 0x08, 0x7d, 0x32, 0x86, 0xbd, 0xa2, 0x6b, 0x4c, 0xfe, 0x55, 0x3b, 0xd6, 0xbc, 0x35, 0xed,
|
||||||
|
0xe3, 0x4d, 0xd3, 0x8a, 0x76, 0xb0, 0x81, 0x76, 0xb0, 0x99, 0x76, 0xed, 0xb5, 0xb0, 0xe5, 0x95,
|
||||||
|
0x29, 0xac, 0x24, 0xf2, 0x9f, 0xae, 0xb1, 0xb0, 0x7a, 0xdb, 0xec, 0xbe, 0x25, 0xa1, 0xff, 0x72,
|
||||||
|
0xfb, 0x5d, 0xe3, 0x44, 0xfe, 0x10, 0x9e, 0x89, 0xcf, 0x55, 0x4d, 0xfe, 0x16, 0x3e, 0xfb, 0x19,
|
||||||
|
0x00, 0x00, 0xff, 0xff, 0xac, 0xcf, 0xd3, 0x1b, 0x29, 0x0a, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,9 +65,55 @@ message UpdateUserInfoReq{
|
|||||||
string Uid = 10;
|
string Uid = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message SetReceiveMessageOptReq{
|
||||||
|
string uId = 1;
|
||||||
|
int32 opt = 2;
|
||||||
|
repeated string conversationId = 3;
|
||||||
|
string operationID = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetReceiveMessageOptResp{
|
||||||
|
int32 errCode = 1;
|
||||||
|
string errMsg = 2;
|
||||||
|
repeated OptResult optResult = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message GetReceiveMessageOptReq{
|
||||||
|
string uId = 1;
|
||||||
|
repeated string conversationId = 2;
|
||||||
|
string operationID = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message OptResult{
|
||||||
|
string conversationId = 1;
|
||||||
|
int32 result = 2; //-1: failed; 0:default; 1: not receive ; 2: not jpush
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetReceiveMessageOptResp{
|
||||||
|
int32 errCode = 1;
|
||||||
|
string errMsg = 2;
|
||||||
|
repeated OptResult conversationOptResult = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetAllConversationMsgOptReq{
|
||||||
|
string uId = 1;
|
||||||
|
string operationID = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetAllConversationMsgOptResp{
|
||||||
|
int32 errCode = 1;
|
||||||
|
string errMsg = 2;
|
||||||
|
repeated OptResult conversationOptResult = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
service user {
|
service user {
|
||||||
rpc getUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
|
rpc getUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
|
||||||
rpc UpdateUserInfo(UpdateUserInfoReq) returns(CommonResp);
|
rpc UpdateUserInfo(UpdateUserInfoReq) returns(CommonResp);
|
||||||
rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp);
|
rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp);
|
||||||
rpc GetAllUsersUid(GetAllUsersUidReq)returns(GetAllUsersUidResp);
|
rpc GetAllUsersUid(GetAllUsersUidReq)returns(GetAllUsersUidResp);
|
||||||
|
rpc SetReceiveMessageOpt(SetReceiveMessageOptReq)returns(SetReceiveMessageOptResp);
|
||||||
|
rpc GetReceiveMessageOpt(GetReceiveMessageOptReq)returns(GetReceiveMessageOptResp);
|
||||||
|
rpc GetAllConversationMsgOpt(GetAllConversationMsgOptReq)returns(GetAllConversationMsgOptResp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func init() {
|
|||||||
// see https://gist.github.com/jniltinho/9787946#gistcomment-3019898
|
// see https://gist.github.com/jniltinho/9787946#gistcomment-3019898
|
||||||
conn, err := net.Dial("udp", "8.8.8.8:80")
|
conn, err := net.Dial("udp", "8.8.8.8:80")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|||||||
@@ -1,153 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"Open_IM/pkg/common/config"
|
|
||||||
"Open_IM/pkg/common/db"
|
|
||||||
"errors"
|
|
||||||
"github.com/golang-jwt/jwt/v4"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
TokenExpired = errors.New("token is timed out, please log in again")
|
|
||||||
TokenInvalid = errors.New("token has been invalidated")
|
|
||||||
TokenNotValidYet = errors.New("token not active yet")
|
|
||||||
TokenMalformed = errors.New("that's not even a token")
|
|
||||||
TokenUnknown = errors.New("couldn't handle this token")
|
|
||||||
)
|
|
||||||
|
|
||||||
type Claims struct {
|
|
||||||
UID string
|
|
||||||
Platform string //login platform
|
|
||||||
jwt.RegisteredClaims
|
|
||||||
}
|
|
||||||
|
|
||||||
func BuildClaims(uid, platform string, ttl int64) Claims {
|
|
||||||
now := time.Now()
|
|
||||||
return Claims{
|
|
||||||
UID: uid,
|
|
||||||
Platform: platform,
|
|
||||||
RegisteredClaims: jwt.RegisteredClaims{
|
|
||||||
ExpiresAt: jwt.NewNumericDate(now.Add(time.Duration(ttl*24) * time.Hour)), //Expiration time
|
|
||||||
IssuedAt: jwt.NewNumericDate(now), //Issuing time
|
|
||||||
NotBefore: jwt.NewNumericDate(now), //Begin Effective time
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateToken(userID string, platform int32) (string, int64, error) {
|
|
||||||
claims := BuildClaims(userID, PlatformIDToName(platform), config.Config.TokenPolicy.AccessExpire)
|
|
||||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
|
||||||
tokenString, err := token.SignedString([]byte(config.Config.TokenPolicy.AccessSecret))
|
|
||||||
|
|
||||||
return tokenString, claims.ExpiresAt.Time.Unix(), err
|
|
||||||
}
|
|
||||||
|
|
||||||
func secret() jwt.Keyfunc {
|
|
||||||
return func(token *jwt.Token) (interface{}, error) {
|
|
||||||
return []byte(config.Config.TokenPolicy.AccessSecret), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getClaimFromToken(tokensString string) (*Claims, error) {
|
|
||||||
token, err := jwt.ParseWithClaims(tokensString, &Claims{}, secret())
|
|
||||||
if err != nil {
|
|
||||||
if ve, ok := err.(*jwt.ValidationError); ok {
|
|
||||||
if ve.Errors&jwt.ValidationErrorMalformed != 0 {
|
|
||||||
return nil, TokenMalformed
|
|
||||||
} else if ve.Errors&jwt.ValidationErrorExpired != 0 {
|
|
||||||
return nil, TokenExpired
|
|
||||||
} else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 {
|
|
||||||
return nil, TokenNotValidYet
|
|
||||||
} else {
|
|
||||||
return nil, TokenUnknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if claims, ok := token.Claims.(*Claims); ok && token.Valid {
|
|
||||||
return claims, nil
|
|
||||||
}
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseToken(tokensString string) (claims *Claims, err error) {
|
|
||||||
claims, err = getClaimFromToken(tokensString)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1.check userid and platform class 0 not exists and 1 exists
|
|
||||||
existsInterface, err := db.DB.ExistsUserIDAndPlatform(claims.UID, Platform2class[claims.Platform])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
exists := existsInterface.(int64)
|
|
||||||
//get config multi login policy
|
|
||||||
if config.Config.MultiLoginPolicy.OnlyOneTerminalAccess {
|
|
||||||
//OnlyOneTerminalAccess policy need to check all terminal
|
|
||||||
//When only one end is allowed to log in, there is a situation that needs to be paid attention to. After PC login,
|
|
||||||
//mobile login should check two platform times. One of them is less than the redis storage time, which is the invalid token.
|
|
||||||
platform := "PC"
|
|
||||||
if Platform2class[claims.Platform] == "PC" {
|
|
||||||
platform = "Mobile"
|
|
||||||
}
|
|
||||||
|
|
||||||
existsInterface, err = db.DB.ExistsUserIDAndPlatform(claims.UID, platform)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
exists = existsInterface.(int64)
|
|
||||||
if exists == 1 {
|
|
||||||
res, err := MakeTheTokenInvalid(claims, platform)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if res {
|
|
||||||
return nil, TokenInvalid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// config.Config.MultiLoginPolicy.MobileAndPCTerminalAccessButOtherTerminalKickEachOther == true
|
|
||||||
// or PC/Mobile validate success
|
|
||||||
// final check
|
|
||||||
if exists == 1 {
|
|
||||||
res, err := MakeTheTokenInvalid(claims, Platform2class[claims.Platform])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if res {
|
|
||||||
return nil, TokenInvalid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return claims, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func MakeTheTokenInvalid(currentClaims *Claims, platformClass string) (bool, error) {
|
|
||||||
storedRedisTokenInterface, err := db.DB.GetPlatformToken(currentClaims.UID, platformClass)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
storedRedisPlatformClaims, err := ParseRedisInterfaceToken(storedRedisTokenInterface)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
//if issue time less than redis token then make this token invalid
|
|
||||||
if currentClaims.IssuedAt.Time.Unix() < storedRedisPlatformClaims.IssuedAt.Time.Unix() {
|
|
||||||
return true, TokenInvalid
|
|
||||||
}
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) {
|
|
||||||
return getClaimFromToken(string(redisToken.([]uint8)))
|
|
||||||
}
|
|
||||||
|
|
||||||
//Validation token, false means failure, true means successful verification
|
|
||||||
func VerifyToken(token, uid string) bool {
|
|
||||||
claims, err := ParseToken(token)
|
|
||||||
if err != nil || claims.UID != uid {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
+5
-2
@@ -111,13 +111,16 @@ func MapIntToJsonString(param map[string]int32) string {
|
|||||||
dataString := string(dataType)
|
dataString := string(dataType)
|
||||||
return dataString
|
return dataString
|
||||||
}
|
}
|
||||||
func JsonStringToMap(str string) (tempMap map[string]interface{}) {
|
func JsonStringToMap(str string) (tempMap map[string]int32) {
|
||||||
_ = json.Unmarshal([]byte(str), &tempMap)
|
_ = json.Unmarshal([]byte(str), &tempMap)
|
||||||
return tempMap
|
return tempMap
|
||||||
}
|
}
|
||||||
func GetSwitchFromOptions(Options map[string]interface{}, key string) (result bool) {
|
func GetSwitchFromOptions(Options map[string]int32, key string) (result bool) {
|
||||||
if flag, ok := Options[key]; !ok || flag == 1 {
|
if flag, ok := Options[key]; !ok || flag == 1 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
func SetSwitchFromOptions(Options map[string]int32, key string, value int32) {
|
||||||
|
Options[key] = value
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -24,6 +25,9 @@ func StringToInt64(i string) int64 {
|
|||||||
j, _ := strconv.ParseInt(i, 10, 64)
|
j, _ := strconv.ParseInt(i, 10, 64)
|
||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
func Int32ToString(i int32) string {
|
||||||
|
return strconv.FormatInt(int64(i), 10)
|
||||||
|
}
|
||||||
|
|
||||||
//judge a string whether in the string list
|
//judge a string whether in the string list
|
||||||
func IsContain(target string, List []string) bool {
|
func IsContain(target string, List []string) bool {
|
||||||
@@ -60,6 +64,15 @@ func GetMsgID(sendID string) string {
|
|||||||
t := int64ToString(GetCurrentTimestampByNano())
|
t := int64ToString(GetCurrentTimestampByNano())
|
||||||
return Md5(t + sendID + int64ToString(rand.Int63n(GetCurrentTimestampByNano())))
|
return Md5(t + sendID + int64ToString(rand.Int63n(GetCurrentTimestampByNano())))
|
||||||
}
|
}
|
||||||
|
func GetConversationIDBySessionType(sourceID string, sessionType int) string {
|
||||||
|
switch sessionType {
|
||||||
|
case constant.SingleChatType:
|
||||||
|
return "single_" + sourceID
|
||||||
|
case constant.GroupChatType:
|
||||||
|
return "group_" + sourceID
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
func int64ToString(i int64) string {
|
func int64ToString(i int64) string {
|
||||||
return strconv.FormatInt(i, 10)
|
return strconv.FormatInt(i, 10)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// copy a by b b->a
|
||||||
|
func CopyStructFields(a interface{}, b interface{}, fields ...string) (err error) {
|
||||||
|
at := reflect.TypeOf(a)
|
||||||
|
av := reflect.ValueOf(a)
|
||||||
|
bt := reflect.TypeOf(b)
|
||||||
|
bv := reflect.ValueOf(b)
|
||||||
|
|
||||||
|
if at.Kind() != reflect.Ptr {
|
||||||
|
err = fmt.Errorf("a must be a struct pointer")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
av = reflect.ValueOf(av.Interface())
|
||||||
|
|
||||||
|
_fields := make([]string, 0)
|
||||||
|
if len(fields) > 0 {
|
||||||
|
_fields = fields
|
||||||
|
} else {
|
||||||
|
for i := 0; i < bv.NumField(); i++ {
|
||||||
|
_fields = append(_fields, bt.Field(i).Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(_fields) == 0 {
|
||||||
|
err = fmt.Errorf("no fields to copy")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(_fields); i++ {
|
||||||
|
name := _fields[i]
|
||||||
|
f := av.Elem().FieldByName(name)
|
||||||
|
bValue := bv.FieldByName(name)
|
||||||
|
|
||||||
|
if f.IsValid() && f.Kind() == bValue.Kind() {
|
||||||
|
f.Set(bValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type S1 struct {
|
||||||
|
Name string
|
||||||
|
Age int
|
||||||
|
}
|
||||||
|
|
||||||
|
type S2 struct {
|
||||||
|
Name string
|
||||||
|
Age int32
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
image=openim/open_im_server:v1.0.5
|
||||||
|
rm Open-IM-Server -rf
|
||||||
|
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||||
|
cd Open-IM-Server
|
||||||
|
git checkout tuoyun
|
||||||
|
cd cmd/Open-IM-SDK-Core/
|
||||||
|
git checkout tuoyun
|
||||||
|
cd ../../
|
||||||
|
docker build -t $image . -f deploy.Dockerfile
|
||||||
|
docker push $image
|
||||||
@@ -14,8 +14,15 @@ service_port_name=(
|
|||||||
openImPushPort
|
openImPushPort
|
||||||
openImWsPort
|
openImWsPort
|
||||||
openImSdkWsPort
|
openImSdkWsPort
|
||||||
|
openImDemoPort
|
||||||
)
|
)
|
||||||
|
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
|
||||||
for i in ${service_port_name[*]}; do
|
for i in ${service_port_name[*]}; do
|
||||||
|
if [ ${switch} != "true" ]; then
|
||||||
|
if [ ${i} == "openImDemoPort"]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
list=$(cat $config_path | grep -w ${i} | awk -F '[:]' '{print $NF}')
|
||||||
list_to_string $list
|
list_to_string $list
|
||||||
for j in ${ports_array}; do
|
for j in ${ports_array}; do
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#Include shell font styles and some basic information
|
||||||
|
source ./style_info.cfg
|
||||||
|
source ./path_info.cfg
|
||||||
|
source ./function.sh
|
||||||
|
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
|
||||||
|
if [ ${switch} != "true" ]; then
|
||||||
|
echo -e ${YELLOW_PREFIX}" demo service switch is false not start demo "${COLOR_SUFFIX}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
list1=$(cat $config_path | grep openImDemoPort | awk -F '[:]' '{print $NF}')
|
||||||
|
list_to_string $list1
|
||||||
|
api_ports=($ports_array)
|
||||||
|
|
||||||
|
#Check if the service exists
|
||||||
|
#If it is exists,kill this process
|
||||||
|
check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l)
|
||||||
|
if [ $check -ge 1 ]; then
|
||||||
|
oldPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}')
|
||||||
|
kill -9 $oldPid
|
||||||
|
fi
|
||||||
|
#Waiting port recycling
|
||||||
|
sleep 1
|
||||||
|
cd ${demo_server_binary_root}
|
||||||
|
|
||||||
|
for ((i = 0; i < ${#api_ports[@]}; i++)); do
|
||||||
|
nohup ./${demo_server_name} -port ${api_ports[$i]} >>../logs/openIM.log 2>&1 &
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
#Check launched service process
|
||||||
|
check=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | wc -l)
|
||||||
|
if [ $check -ge 1 ]; then
|
||||||
|
newPid=$(ps aux | grep -w ./${demo_server_name} | grep -v grep | awk '{print $2}')
|
||||||
|
ports=$(netstat -netulp | grep -w ${newPid} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
|
||||||
|
allPorts=""
|
||||||
|
|
||||||
|
for i in $ports; do
|
||||||
|
allPorts=${allPorts}"$i "
|
||||||
|
done
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS "${COLOR_SUFFIX}
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"PID: "${COLOR_SUFFIX}${YELLOW_PREFIX}${newPid}${COLOR_SUFFIX}
|
||||||
|
echo -e ${SKY_BLUE_PREFIX}"LISTENING_PORT: "${COLOR_SUFFIX}${YELLOW_PREFIX}${allPorts}${COLOR_SUFFIX}
|
||||||
|
else
|
||||||
|
echo -e ${YELLOW_PREFIX}${demo_server_name}${COLOR_SUFFIX}${RED_PREFIX}"SERVICE START ERROR, PLEASE CHECK openIM.log"${COLOR_SUFFIX}
|
||||||
|
fi
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user