Merge branch 'superGroup' into tuoyun

# Conflicts:
#	internal/push/logic/push_to_client.go
This commit is contained in:
wangchuxiao 2022-06-17 15:54:57 +08:00
commit 0a2951c2eb
108 changed files with 7177 additions and 2867 deletions

View File

@ -39,6 +39,7 @@ func main() {
userRouterGroup := r.Group("/user") userRouterGroup := r.Group("/user")
{ {
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1 userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1
userRouterGroup.POST("/set_global_msg_recv_opt", user.SetGlobalRecvMessageOpt)
userRouterGroup.POST("/get_users_info", user.GetUsersInfo) //1 userRouterGroup.POST("/get_users_info", user.GetUsersInfo) //1
userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1 userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) //1 userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) //1
@ -70,7 +71,7 @@ func main() {
{ {
groupRouterGroup.POST("/create_group", group.CreateGroup) //1 groupRouterGroup.POST("/create_group", group.CreateGroup) //1
groupRouterGroup.POST("/set_group_info", group.SetGroupInfo) //1 groupRouterGroup.POST("/set_group_info", group.SetGroupInfo) //1
groupRouterGroup.POST("join_group", group.JoinGroup) //1 groupRouterGroup.POST("/join_group", group.JoinGroup) //1
groupRouterGroup.POST("/quit_group", group.QuitGroup) //1 groupRouterGroup.POST("/quit_group", group.QuitGroup) //1
groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) //1 groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) //1
groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1 groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1
@ -82,7 +83,7 @@ func main() {
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1 groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1 groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1 groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1 groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
groupRouterGroup.POST("/dismiss_group", group.DismissGroup) // groupRouterGroup.POST("/dismiss_group", group.DismissGroup) //
groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember) groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember)
groupRouterGroup.POST("/cancel_mute_group_member", group.CancelMuteGroupMember) //MuteGroup groupRouterGroup.POST("/cancel_mute_group_member", group.CancelMuteGroupMember) //MuteGroup
@ -91,12 +92,18 @@ func main() {
groupRouterGroup.POST("/set_group_member_nickname", group.SetGroupMemberNickname) groupRouterGroup.POST("/set_group_member_nickname", group.SetGroupMemberNickname)
groupRouterGroup.POST("/set_group_member_info", group.SetGroupMemberInfo) groupRouterGroup.POST("/set_group_member_info", group.SetGroupMemberInfo)
} }
superGroupRouterGroup := r.Group("/super_group")
{
superGroupRouterGroup.POST("/get_joined_group_list", group.GetJoinedSuperGroupList)
superGroupRouterGroup.POST("/get_groups_info", group.GetSuperGroupsInfo)
}
//certificate //certificate
authRouterGroup := r.Group("/auth") authRouterGroup := r.Group("/auth")
{ {
authRouterGroup.POST("/user_register", apiAuth.UserRegister) //1 authRouterGroup.POST("/user_register", apiAuth.UserRegister) //1
authRouterGroup.POST("/user_token", apiAuth.UserToken) //1 authRouterGroup.POST("/user_token", apiAuth.UserToken) //1
authRouterGroup.POST("/parse_token", apiAuth.ParseToken) //1 authRouterGroup.POST("/parse_token", apiAuth.ParseToken) //1
authRouterGroup.POST("/force_logout", apiAuth.ForceLogout) //1
} }
//Third service //Third service
thirdGroup := r.Group("/third") thirdGroup := r.Group("/third")
@ -117,6 +124,7 @@ func main() {
chatGroup.POST("/send_msg", apiChat.SendMsg) chatGroup.POST("/send_msg", apiChat.SendMsg)
chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList) chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList)
chatGroup.POST("/del_msg", apiChat.DelMsg) chatGroup.POST("/del_msg", apiChat.DelMsg)
chatGroup.POST("/clear_msg", apiChat.ClearMsg)
} }
//Manager //Manager
managementGroup := r.Group("/manager") managementGroup := r.Group("/manager")
@ -127,7 +135,6 @@ func main() {
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1 managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1
managementGroup.POST("/account_check", manage.AccountCheck) //1 managementGroup.POST("/account_check", manage.AccountCheck) //1
managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1 managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1
} }
//Conversation //Conversation
conversationGroup := r.Group("/conversation") conversationGroup := r.Group("/conversation")

View File

@ -23,7 +23,7 @@ mysql:
mongo: mongo:
dbUri: ""#当dbUri值不为空则直接使用该值 dbUri: ""#当dbUri值不为空则直接使用该值
dbAddress: [ 127.0.0.1:37017 ] #mongo地址 目前仅支持单机,默认即可 dbAddress: 127.0.0.1:37017 #单机时为mongo地址使用分片集群时为mongos地址 默认即可
dbDirect: false dbDirect: false
dbTimeout: 60 dbTimeout: 60
dbDatabase: openIM #mongo db 默认即可 dbDatabase: openIM #mongo db 默认即可
@ -34,11 +34,12 @@ mongo:
dbRetainChatRecords: 3650 #mongo保存离线消息时间根据需求修改 dbRetainChatRecords: 3650 #mongo保存离线消息时间根据需求修改
redis: redis:
dbAddress: 127.0.0.1:16379 #redis地址 目前仅支持单机,默认即可 dbAddress: [ 127.0.0.1:16379 ] #redis地址 单机填写一个地址即可使用redis集群时候填写集群中多个节点地址主从地址都可以填写增加容灾能力,默认即可
dbMaxIdle: 128 dbMaxIdle: 128
dbMaxActive: 0 dbMaxActive: 0
dbIdleTimeout: 120 dbIdleTimeout: 120
dbPassWord: openIM #redis密码 建议修改 dbPassWord: openIM #redis密码 建议修改
enableCluster: false #如果外部redis以集群方式启动需要打开此开关
kafka: kafka:
ws2mschat: ws2mschat:
@ -47,12 +48,15 @@ kafka:
ws2mschatoffline: ws2mschatoffline:
addr: [ 127.0.0.1:9092 ] #kafka配置默认即可 addr: [ 127.0.0.1:9092 ] #kafka配置默认即可
topic: "ws2ms_chat_offline" topic: "ws2ms_chat_offline"
msgtomongo:
addr: [ 127.0.0.1:9092 ] #kafka配置默认即可
topic: "msg_to_mongo"
ms2pschat: ms2pschat:
addr: [ 127.0.0.1:9092 ] #kafka配置默认即可 addr: [ 127.0.0.1:9092 ] #kafka配置默认即可
topic: "ms2ps_chat" topic: "ms2ps_chat"
consumergroupid: consumergroupid:
msgToMongo: mongo msgToTransfer: mongo
msgToMongoOffline: mongo_offline msgToMongo: mongo_ex
msgToMySql: mysql msgToMySql: mysql
msgToPush: push msgToPush: push
@ -218,6 +222,7 @@ manager:
#app管理员userID和对应的secret 建议修改。 用于管理后台登录也可以用户管理后台对应的api #app管理员userID和对应的secret 建议修改。 用于管理后台登录也可以用户管理后台对应的api
appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"] appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"]
secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"] secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"]
appSysNotificationName: "系统通知"
secret: tuoyun secret: tuoyun
# 多端互踢策略 # 多端互踢策略
@ -229,11 +234,12 @@ chatpersistencemysql: true
#可靠性存储 #可靠性存储
reliablestorage: false reliablestorage: false
#消息缓存时间 #消息缓存时间
msgCacheTimeout: 3600 msgCacheTimeout: 86400
#群聊已读开启 #群聊已读开启
groupMessageHasReadReceiptEnable: false groupMessageHasReadReceiptEnable: true
#单聊已读开启 #单聊已读开启
singleMessageHasReadReceiptEnable: false singleMessageHasReadReceiptEnable: true
#token config #token config
tokenpolicy: tokenpolicy:
accessSecret: "open_im_server" #token生成相关默认即可 accessSecret: "open_im_server" #token生成相关默认即可
@ -700,4 +706,4 @@ demo:
imAPIURL: http://127.0.0.1:10002 imAPIURL: http://127.0.0.1:10002
rtc: rtc:
signalTimeout: 60 signalTimeout: 35

View File

@ -75,7 +75,7 @@ services:
TZ: Asia/Shanghai TZ: Asia/Shanghai
KAFKA_BROKER_ID: 0 KAFKA_BROKER_ID: 0
KAFKA_ZOOKEEPER_CONNECT: 127.0.0.1:2181 KAFKA_ZOOKEEPER_CONNECT: 127.0.0.1:2181
KAFKA_CREATE_TOPICS: "ws2ms_chat:2:1,ms2ps_chat:2:1" KAFKA_CREATE_TOPICS: "ws2ms_chat:8:1,ms2ps_chat:8:1,msg_to_mongo:8:1"
KAFKA_ADVERTISED_LISTENERS: INSIDE://127.0.0.1:9092,OUTSIDE://103.116.45.174:9093 KAFKA_ADVERTISED_LISTENERS: INSIDE://127.0.0.1:9092,OUTSIDE://103.116.45.174:9093
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093 KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT" KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"

3
go.mod
View File

@ -11,7 +11,6 @@ require (
github.com/antonfisher/nested-logrus-formatter v1.3.0 github.com/antonfisher/nested-logrus-formatter v1.3.0
github.com/bwmarrin/snowflake v0.3.0 github.com/bwmarrin/snowflake v0.3.0
github.com/fatih/structs v1.1.0 github.com/fatih/structs v1.1.0
github.com/garyburd/redigo v1.6.2
github.com/gin-gonic/gin v1.7.0 github.com/gin-gonic/gin v1.7.0
github.com/go-playground/validator/v10 v10.4.1 github.com/go-playground/validator/v10 v10.4.1
github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redis/v8 v8.11.5
@ -51,3 +50,5 @@ require (
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
) )
replace github.com/Shopify/sarama => github.com/Shopify/sarama v1.29.0

52
go.sum
View File

@ -3,10 +3,10 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/Shopify/sarama v1.32.0 h1:P+RUjEaRU0GMMbYexGMDyrMkLhbbBVUVISDywi+IlFU= github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE=
github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGLy1Y1Njs= github.com/Shopify/sarama v1.29.0/go.mod h1:2QpgD79wpdAESqNQMxNc0KYMkycd4slxGdV3TWSVqrU=
github.com/Shopify/toxiproxy/v2 v2.3.0 h1:62YkpiP4bzdhKMH+6uC5E95y608k3zDwdzuBMsnn3uQ= github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
github.com/Shopify/toxiproxy/v2 v2.3.0/go.mod h1:KvQTtB6RjCJY4zqNJn7C7JDFgsG5uoHYDirfUfpIm0c= 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/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/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=
@ -70,7 +70,6 @@ github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmf
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@ -101,13 +100,11 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM=
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
@ -162,8 +159,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
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=
@ -172,9 +169,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/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.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/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.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@ -182,7 +178,6 @@ github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/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-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI= github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
@ -233,10 +228,10 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.14.4 h1:eijASRJcobkVtSt81Olfh7JX43osYLwy5krOJo6YEu4=
github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s= github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4= github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
@ -244,9 +239,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/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/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
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/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=
@ -310,8 +304,8 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A=
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@ -338,12 +332,8 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo= github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM= github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
@ -376,14 +366,14 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/scram v1.1.0 h1:d70R37I0HrDLsafRrMBXyrD4lmQbCHE873t00Vr0gm0=
github.com/xdg-go/scram v1.1.0/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc= github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc=
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
github.com/xdg/scram v1.0.3/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@ -416,8 +406,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh
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/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b h1:7mWr3k41Qtv8XlltBkDkl8LoP3mpSgBW8BUoxtEdbXg=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
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=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk= golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
@ -451,9 +441,10 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210427231257-85d9c07bbe3a/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -571,7 +562,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= 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/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=

View File

@ -36,7 +36,13 @@ func UserRegister(c *gin.Context) {
//copier.Copy(req.UserInfo, &params) //copier.Copy(req.UserInfo, &params)
req.OperationID = params.OperationID req.OperationID = params.OperationID
log.NewInfo(req.OperationID, "UserRegister args ", req.String()) log.NewInfo(req.OperationID, "UserRegister args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + " getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewAuthClient(etcdConn) client := rpc.NewAuthClient(etcdConn)
reply, err := client.UserRegister(context.Background(), req) reply, err := client.UserRegister(context.Background(), req)
if err != nil { if err != nil {
@ -84,7 +90,13 @@ func UserToken(c *gin.Context) {
} }
req := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID} req := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID}
log.NewInfo(req.OperationID, "UserToken args ", req.String()) log.NewInfo(req.OperationID, "UserToken args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + " getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewAuthClient(etcdConn) client := rpc.NewAuthClient(etcdConn)
reply, err := client.UserToken(context.Background(), req) reply, err := client.UserToken(context.Background(), req)
if err != nil { if err != nil {
@ -124,3 +136,46 @@ func ParseToken(c *gin.Context) {
log.NewInfo(params.OperationID, "ParseToken return ", resp) log.NewInfo(params.OperationID, "ParseToken return ", resp)
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
} }
func ForceLogout(c *gin.Context) {
params := api.ForceLogoutReq{}
if err := c.BindJSON(&params); err != nil {
errMsg := " BindJSON failed " + err.Error()
log.NewError("0", errMsg)
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
return
}
req := &rpc.ForceLogoutReq{}
utils.CopyStructFields(req, &params)
var ok bool
var errInfo string
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
log.NewInfo(req.OperationID, "ForceLogout args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + " getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewAuthClient(etcdConn)
reply, err := client.ForceLogout(context.Background(), req)
if err != nil {
errMsg := req.OperationID + " UserToken failed " + err.Error() + req.String()
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
resp := api.ForceLogoutResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
log.NewInfo(params.OperationID, utils.GetSelfFuncName(), " return ", resp)
c.JSON(http.StatusOK, resp)
}

View File

@ -5,8 +5,9 @@ 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" rpc "Open_IM/pkg/proto/chat"
pbCommon "Open_IM/pkg/proto/sdk_ws" pbCommon "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
@ -29,8 +30,14 @@ func DelMsg(c *gin.Context) {
if err := utils.CopyStructFields(&reqPb, &req); err != nil { if err := utils.CopyStructFields(&reqPb, &req); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
} }
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
msgClient := pbChat.NewChatClient(grpcConn) if grpcConn == nil {
errMsg := req.OperationID + " getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
msgClient := rpc.NewChatClient(grpcConn)
respPb, err := msgClient.DelMsgList(context.Background(), &reqPb) respPb, err := msgClient.DelMsgList(context.Background(), &reqPb)
if err != nil { if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb) log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
@ -42,3 +49,47 @@ func DelMsg(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
} }
func ClearMsg(c *gin.Context) {
params := api.CleanUpMsgReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
//
req := &rpc.ClearMsgReq{}
utils.CopyStructFields(req, &params)
var ok bool
var errInfo string
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + " getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewChatClient(etcdConn)
RpcResp, err := client.ClearMsg(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, " CleanUpMsg failed ", err.Error(), req.String(), RpcResp.ErrMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": RpcResp.ErrMsg})
return
}
resp := api.CleanUpMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
c.JSON(http.StatusOK, resp)
}

View File

@ -5,7 +5,8 @@ import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbMsg "Open_IM/pkg/proto/chat" pbChat "Open_IM/pkg/proto/chat"
sdk_ws "Open_IM/pkg/proto/sdk_ws"
"context" "context"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"net/http" "net/http"
@ -31,11 +32,18 @@ func GetSeq(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
return return
} }
pbData := pbMsg.GetMaxAndMinSeqReq{} pbData := sdk_ws.GetMaxAndMinSeqReq{}
pbData.UserID = params.SendID pbData.UserID = params.SendID
pbData.OperationID = params.OperationID pbData.OperationID = params.OperationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, pbData.OperationID)
msgClient := pbMsg.NewChatClient(grpcConn) if grpcConn == nil {
errMsg := pbData.OperationID + " getcdv3.GetConn == nil"
log.NewError(pbData.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData) reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
if err != nil { if err != nil {
log.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error()) log.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error())

View File

@ -51,7 +51,13 @@ func PullMsgBySeqList(c *gin.Context) {
pbData.OperationID = params.OperationID pbData.OperationID = params.OperationID
pbData.SeqList = params.SeqList pbData.SeqList = params.SeqList
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, pbData.OperationID)
if grpcConn == nil {
errMsg := pbData.OperationID + "getcdv3.GetConn == nil"
log.NewError(pbData.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData) reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
if err != nil { if err != nil {

View File

@ -69,9 +69,15 @@ func SendMsg(c *gin.Context) {
token := c.Request.Header.Get("token") token := c.Request.Header.Get("token")
log.NewInfo(params.OperationID, "api call success to sendMsgReq", params) log.NewInfo(params.OperationID, "api call success to sendMsgReq", params)
pbData := newUserSendMsgReq(token, &params) pbData := newUserSendMsgReq(token, &params)
log.Info("", "", "api SendMsg call start..., [data: %s]", pbData.String()) log.Info(params.OperationID, "", "api SendMsg call start..., [data: %s]", pbData.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, params.OperationID)
if etcdConn == nil {
errMsg := params.OperationID + "getcdv3.GetConn == nil"
log.NewError(params.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
log.Info("", "", "api SendMsg call, api call rpc...") log.Info("", "", "api SendMsg call, api call rpc...")
@ -82,7 +88,7 @@ func SendMsg(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SendMsg rpc failed, " + err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SendMsg rpc failed, " + err.Error()})
return return
} }
log.Info("", "", "api SendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) log.Info(params.OperationID, "", "api SendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"errCode": reply.ErrCode, "errCode": reply.ErrCode,

View File

@ -32,7 +32,13 @@ func SetConversation(c *gin.Context) {
if err != nil { if err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -63,7 +69,13 @@ func ModifyConversationField(c *gin.Context) {
if err != nil { if err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbConversation.NewConversationClient(etcdConn) client := pbConversation.NewConversationClient(etcdConn)
respPb, err := client.ModifyConversationField(context.Background(), &reqPb) respPb, err := client.ModifyConversationField(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -92,7 +104,13 @@ func BatchSetConversations(c *gin.Context) {
if err := utils.CopyStructFields(&reqPb, req); err != nil { if err := utils.CopyStructFields(&reqPb, req); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.BatchSetConversations(context.Background(), &reqPb) respPb, err := client.BatchSetConversations(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -124,7 +142,13 @@ func GetAllConversations(c *gin.Context) {
if err := utils.CopyStructFields(&reqPb, req); err != nil { if err := utils.CopyStructFields(&reqPb, req); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.GetAllConversations(context.Background(), &reqPb) respPb, err := client.GetAllConversations(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -156,7 +180,13 @@ func GetConversation(c *gin.Context) {
if err := utils.CopyStructFields(&reqPb, req); err != nil { if err := utils.CopyStructFields(&reqPb, req); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.GetConversation(context.Background(), &reqPb) respPb, err := client.GetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -188,7 +218,13 @@ func GetConversations(c *gin.Context) {
if err := utils.CopyStructFields(&reqPb, req); err != nil { if err := utils.CopyStructFields(&reqPb, req); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.GetConversations(context.Background(), &reqPb) respPb, err := client.GetConversations(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -220,7 +256,13 @@ func SetRecvMsgOpt(c *gin.Context) {
if err := utils.CopyStructFields(&reqPb, req); err != nil { if err := utils.CopyStructFields(&reqPb, req); err != nil {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetRecvMsgOpt(context.Background(), &reqPb) respPb, err := client.SetRecvMsgOpt(context.Background(), &reqPb)
if err != nil { if err != nil {

View File

@ -36,7 +36,7 @@ func AddBlack(c *gin.Context) {
} }
log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) log.NewInfo(params.OperationID, "AddBlacklist args ", req.String())
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, req.CommID.OperationID)
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.AddBlacklist(context.Background(), req) RpcResp, err := client.AddBlacklist(context.Background(), req)
if err != nil { if err != nil {
@ -69,8 +69,14 @@ func ImportFriend(c *gin.Context) {
} }
log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) log.NewInfo(req.OperationID, "ImportFriend args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.ImportFriend(context.Background(), req) RpcResp, err := client.ImportFriend(context.Background(), req)
if err != nil { if err != nil {
@ -114,7 +120,13 @@ func AddFriend(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.AddFriend(context.Background(), req) RpcResp, err := client.AddFriend(context.Background(), req)
if err != nil { if err != nil {
@ -153,7 +165,14 @@ func AddFriendResponse(c *gin.Context) {
utils.CopyStructFields(req, &params) utils.CopyStructFields(req, &params)
log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.AddFriendResponse(context.Background(), req) RpcResp, err := client.AddFriendResponse(context.Background(), req)
if err != nil { if err != nil {
@ -189,7 +208,13 @@ func DeleteFriend(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.DeleteFriend(context.Background(), req) RpcResp, err := client.DeleteFriend(context.Background(), req)
if err != nil { if err != nil {
@ -225,7 +250,13 @@ func GetBlacklist(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.GetBlacklist(context.Background(), req) RpcResp, err := client.GetBlacklist(context.Background(), req)
if err != nil { if err != nil {
@ -268,7 +299,13 @@ func SetFriendRemark(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.SetFriendRemark(context.Background(), req) RpcResp, err := client.SetFriendRemark(context.Background(), req)
if err != nil { if err != nil {
@ -303,7 +340,14 @@ func RemoveBlack(c *gin.Context) {
} }
log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.RemoveBlacklist(context.Background(), req) RpcResp, err := client.RemoveBlacklist(context.Background(), req)
if err != nil { if err != nil {
@ -338,7 +382,13 @@ func IsFriend(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String()) log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.IsFriend(context.Background(), req) RpcResp, err := client.IsFriend(context.Background(), req)
if err != nil { if err != nil {
@ -375,7 +425,13 @@ func GetFriendList(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String()) log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.GetFriendList(context.Background(), req) RpcResp, err := client.GetFriendList(context.Background(), req)
if err != nil { if err != nil {
@ -413,7 +469,13 @@ func GetFriendApplyList(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.GetFriendApplyList(context.Background(), req) RpcResp, err := client.GetFriendApplyList(context.Background(), req)
@ -451,7 +513,13 @@ func GetSelfFriendApplyList(c *gin.Context) {
log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String())
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, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewFriendClient(etcdConn) client := rpc.NewFriendClient(etcdConn)
RpcResp, err := client.GetSelfApplyList(context.Background(), req) RpcResp, err := client.GetSelfApplyList(context.Background(), req)
if err != nil { if err != nil {

View File

@ -43,7 +43,13 @@ func KickGroupMember(c *gin.Context) {
log.NewInfo(req.OperationID, "KickGroupMember args ", req.String()) log.NewInfo(req.OperationID, "KickGroupMember args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.KickGroupMember(context.Background(), req) RpcResp, err := client.KickGroupMember(context.Background(), req)
if err != nil { if err != nil {
@ -88,7 +94,13 @@ func GetGroupMembersInfo(c *gin.Context) {
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String()) log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetGroupMembersInfo(context.Background(), req) RpcResp, err := client.GetGroupMembersInfo(context.Background(), req)
@ -126,7 +138,13 @@ func GetGroupMemberList(c *gin.Context) {
log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String()) log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetGroupMemberList(context.Background(), req) RpcResp, err := client.GetGroupMemberList(context.Background(), req)
@ -165,7 +183,13 @@ func GetGroupAllMemberList(c *gin.Context) {
log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String()) log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetGroupAllMember(context.Background(), req) RpcResp, err := client.GetGroupAllMember(context.Background(), req)
if err != nil { if err != nil {
@ -202,7 +226,13 @@ func GetJoinedGroupList(c *gin.Context) {
log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String()) log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetJoinedGroupList(context.Background(), req) RpcResp, err := client.GetJoinedGroupList(context.Background(), req)
if err != nil { if err != nil {
@ -239,7 +269,13 @@ func InviteUserToGroup(c *gin.Context) {
log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String()) log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.InviteUserToGroup(context.Background(), req) RpcResp, err := client.InviteUserToGroup(context.Background(), req)
if err != nil { if err != nil {
@ -291,7 +327,13 @@ func CreateGroup(c *gin.Context) {
log.NewInfo(req.OperationID, "CreateGroup args ", req.String()) log.NewInfo(req.OperationID, "CreateGroup args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.CreateGroup(context.Background(), req) RpcResp, err := client.CreateGroup(context.Background(), req)
if err != nil { if err != nil {
@ -328,7 +370,13 @@ func GetRecvGroupApplicationList(c *gin.Context) {
//} //}
log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String()) log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.GetGroupApplicationList(context.Background(), req) reply, err := client.GetGroupApplicationList(context.Background(), req)
if err != nil { if err != nil {
@ -359,7 +407,13 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
// return // return
//} //}
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String()) log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetUserReqApplicationList(context.Background(), req) RpcResp, err := client.GetUserReqApplicationList(context.Background(), req)
if err != nil { if err != nil {
@ -395,7 +449,13 @@ func GetGroupsInfo(c *gin.Context) {
} }
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String()) log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.GetGroupsInfo(context.Background(), req) RpcResp, err := client.GetGroupsInfo(context.Background(), req)
if err != nil { if err != nil {
@ -433,7 +493,13 @@ func ApplicationGroupResponse(c *gin.Context) {
log.NewInfo(req.OperationID, "ApplicationGroupResponse args ", req.String()) log.NewInfo(req.OperationID, "ApplicationGroupResponse args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.GroupApplicationResponse(context.Background(), req) reply, err := client.GroupApplicationResponse(context.Background(), req)
if err != nil { if err != nil {
@ -468,7 +534,13 @@ func JoinGroup(c *gin.Context) {
} }
log.NewInfo(req.OperationID, "JoinGroup args ", req.String()) log.NewInfo(req.OperationID, "JoinGroup args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.JoinGroup(context.Background(), req) RpcResp, err := client.JoinGroup(context.Background(), req)
@ -504,7 +576,13 @@ func QuitGroup(c *gin.Context) {
log.NewInfo(req.OperationID, "QuitGroup args ", req.String()) log.NewInfo(req.OperationID, "QuitGroup args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.QuitGroup(context.Background(), req) RpcResp, err := client.QuitGroup(context.Background(), req)
if err != nil { if err != nil {
@ -540,7 +618,13 @@ func SetGroupInfo(c *gin.Context) {
log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String()) log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
RpcResp, err := client.SetGroupInfo(context.Background(), req) RpcResp, err := client.SetGroupInfo(context.Background(), req)
if err != nil { if err != nil {
@ -575,7 +659,13 @@ func TransferGroupOwner(c *gin.Context) {
log.NewInfo(req.OperationID, "TransferGroupOwner args ", req.String()) log.NewInfo(req.OperationID, "TransferGroupOwner args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.TransferGroupOwner(context.Background(), req) reply, err := client.TransferGroupOwner(context.Background(), req)
if err != nil { if err != nil {
@ -611,7 +701,13 @@ func DismissGroup(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.DismissGroup(context.Background(), req) reply, err := client.DismissGroup(context.Background(), req)
if err != nil { if err != nil {
@ -647,7 +743,13 @@ func MuteGroupMember(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.MuteGroupMember(context.Background(), req) reply, err := client.MuteGroupMember(context.Background(), req)
if err != nil { if err != nil {
@ -683,7 +785,13 @@ func CancelMuteGroupMember(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.CancelMuteGroupMember(context.Background(), req) reply, err := client.CancelMuteGroupMember(context.Background(), req)
if err != nil { if err != nil {
@ -719,7 +827,13 @@ func MuteGroup(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.MuteGroup(context.Background(), req) reply, err := client.MuteGroup(context.Background(), req)
if err != nil { if err != nil {
@ -755,7 +869,13 @@ func CancelMuteGroup(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.CancelMuteGroup(context.Background(), req) reply, err := client.CancelMuteGroup(context.Background(), req)
if err != nil { if err != nil {
@ -793,7 +913,13 @@ func SetGroupMemberNickname(c *gin.Context) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
reply, err := client.SetGroupMemberNickname(context.Background(), req) reply, err := client.SetGroupMemberNickname(context.Background(), req)
if err != nil { if err != nil {
@ -846,7 +972,13 @@ func SetGroupMemberInfo(c *gin.Context) {
reqPb.RoleLevel = &wrappers.Int32Value{Value: *req.RoleLevel} reqPb.RoleLevel = &wrappers.Int32Value{Value: *req.RoleLevel}
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn) client := rpc.NewGroupClient(etcdConn)
respPb, err := client.SetGroupMemberInfo(context.Background(), reqPb) respPb, err := client.SetGroupMemberInfo(context.Background(), reqPb)
if err != nil { if err != nil {

View File

@ -0,0 +1,88 @@
package group
import (
jsonData "Open_IM/internal/utils"
api "Open_IM/pkg/base_info"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
rpc "Open_IM/pkg/proto/group"
"Open_IM/pkg/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
func GetJoinedSuperGroupList(c *gin.Context) {
req := api.GetJoinedSuperGroupListReq{}
if err := c.BindJSON(&req); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
ok, opUserID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
reqPb := rpc.GetJoinedSuperGroupListReq{OperationID: req.OperationID, OpUserID: opUserID, UserID: req.FromUserID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn)
rpcResp, err := client.GetJoinedSuperGroupList(context.Background(), &reqPb)
if err != nil {
log.NewError(req.OperationID, "InviteUserToGroup failed ", err.Error(), reqPb.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
GroupListResp := api.GetJoinedSuperGroupListResp{GetJoinedGroupListResp: api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupList}}
GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp)
c.JSON(http.StatusOK, GroupListResp)
}
func GetSuperGroupsInfo(c *gin.Context) {
req := api.GetSuperGroupsInfoReq{}
if err := c.BindJSON(&req); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
ok, opUserID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
reqPb := rpc.GetSuperGroupsInfoReq{OperationID: req.OperationID, OpUserID: opUserID, GroupIDList: req.GroupIDList}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewGroupClient(etcdConn)
rpcResp, err := client.GetSuperGroupsInfo(context.Background(), &reqPb)
if err != nil {
log.NewError(req.OperationID, "InviteUserToGroup failed ", err.Error(), reqPb.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
resp := api.GetSuperGroupsInfoResp{GetGroupInfoResp: api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupInfoList}}
resp.Data = jsonData.JsonDataList(resp.GroupInfoList)
log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
c.JSON(http.StatusOK, resp)
}

View File

@ -138,7 +138,7 @@ func ManagementSendMsg(c *gin.Context) {
log.Error(c.PostForm("operationID"), "data args validate err", err.Error()) log.Error(c.PostForm("operationID"), "data args validate err", err.Error())
return return
} }
log.NewInfo("", data, params) log.NewInfo(params.OperationID, data, params)
token := c.Request.Header.Get("token") token := c.Request.Header.Get("token")
claims, err := token_verify.ParseToken(token, params.OperationID) claims, err := token_verify.ParseToken(token, params.OperationID)
if err != nil { if err != nil {
@ -169,12 +169,18 @@ func ManagementSendMsg(c *gin.Context) {
log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params) log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params)
pbData := newUserSendMsgReq(&params) pbData := newUserSendMsgReq(&params)
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String()) log.Info(params.OperationID, "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, params.OperationID)
if etcdConn == nil {
errMsg := params.OperationID + "getcdv3.GetConn == nil"
log.NewError(params.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
log.Info("", "", "api ManagementSendMsg call, api call rpc...") log.Info(params.OperationID, "", "api ManagementSendMsg call, api call rpc...")
RpcResp, err := client.SendMsg(context.Background(), pbData) RpcResp, err := client.SendMsg(context.Background(), pbData)
if err != nil { if err != nil {
@ -182,7 +188,7 @@ func ManagementSendMsg(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call UserSendMsg rpc server failed"}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call UserSendMsg rpc server failed"})
return return
} }
log.Info("", "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String()) log.Info(params.OperationID, "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String())
resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: server_api_params.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}} resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: server_api_params.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}}
log.Info(params.OperationID, "ManagementSendMsg return", resp) log.Info(params.OperationID, "ManagementSendMsg return", resp)
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
@ -239,7 +245,7 @@ func ManagementBatchSendMsg(c *gin.Context) {
log.Error(c.PostForm("operationID"), "data args validate err", err.Error()) log.Error(c.PostForm("operationID"), "data args validate err", err.Error())
return return
} }
log.NewInfo("", data, params) log.NewInfo(params.OperationID, data, params)
token := c.Request.Header.Get("token") token := c.Request.Header.Get("token")
claims, err := token_verify.ParseToken(token, params.OperationID) claims, err := token_verify.ParseToken(token, params.OperationID)
if err != nil { if err != nil {
@ -256,8 +262,14 @@ func ManagementBatchSendMsg(c *gin.Context) {
for _, recvID := range params.RecvIDList { for _, recvID := range params.RecvIDList {
pbData := newUserSendMsgReq(&params.ManagementSendMsgReq) pbData := newUserSendMsgReq(&params.ManagementSendMsgReq)
pbData.MsgData.RecvID = recvID pbData.MsgData.RecvID = recvID
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String()) log.Info(params.OperationID, "", "api ManagementSendMsg call start..., ", pbData.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, params.OperationID)
if etcdConn == nil {
errMsg := params.OperationID + "getcdv3.GetConn == nil"
log.NewError(params.OperationID, errMsg)
resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID)
continue
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
rpcResp, err := client.SendMsg(context.Background(), pbData) rpcResp, err := client.SendMsg(context.Background(), pbData)
if err != nil { if err != nil {
@ -266,7 +278,7 @@ func ManagementBatchSendMsg(c *gin.Context) {
continue continue
} }
if rpcResp.ErrCode != 0 { if rpcResp.ErrCode != 0 {
log.NewError(params.OperationID, utils.GetSelfFuncName(), "rpc failed", pbData) log.NewError(params.OperationID, utils.GetSelfFuncName(), "rpc failed", pbData, rpcResp)
resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID) resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID)
continue continue
} }
@ -347,15 +359,15 @@ type RevokeElem struct {
RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"` RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"`
} }
type OANotificationElem struct { type OANotificationElem struct {
NotificationName string `mapstructure:"notificationName" validate:"required"` NotificationName string `mapstructure:"notificationName" json:"notificationName" validate:"required"`
NotificationFaceURL string `mapstructure:"notificationFaceURL" validate:"required"` NotificationFaceURL string `mapstructure:"notificationFaceURL" json:"notificationFaceURL" validate:"required"`
NotificationType int32 `mapstructure:"notificationType" validate:"required"` NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"`
Text string `mapstructure:"text" validate:"required"` Text string `mapstructure:"text" json:"text" validate:"required"`
Url string `mapstructure:"url"` Url string `mapstructure:"url" json:"url"`
MixType int32 `mapstructure:"mixType"` MixType int32 `mapstructure:"mixType" json:"mixType"`
PictureElem PictureElem `mapstructure:"pictureElem"` PictureElem PictureElem `mapstructure:"pictureElem" json:"pictureElem"`
SoundElem SoundElem `mapstructure:"soundElem"` SoundElem SoundElem `mapstructure:"soundElem" json:"soundElem"`
VideoElem VideoElem `mapstructure:"videoElem"` VideoElem VideoElem `mapstructure:"videoElem" json:"videoElem"`
FileElem FileElem `mapstructure:"fileElem"` FileElem FileElem `mapstructure:"fileElem" json:"fileElem"`
Ex string `mapstructure:"ex"` Ex string `mapstructure:"ex" json:"ex"`
} }

View File

@ -42,7 +42,13 @@ func DeleteUser(c *gin.Context) {
} }
log.NewInfo(params.OperationID, "DeleteUser args ", req.String()) log.NewInfo(params.OperationID, "DeleteUser args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.DeleteUsers(context.Background(), req) RpcResp, err := client.DeleteUsers(context.Background(), req)
@ -78,7 +84,13 @@ func GetAllUsersUid(c *gin.Context) {
} }
log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String()) log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.GetAllUserID(context.Background(), req) RpcResp, err := client.GetAllUserID(context.Background(), req)
if err != nil { if err != nil {
@ -114,7 +126,13 @@ func AccountCheck(c *gin.Context) {
} }
log.NewInfo(params.OperationID, "AccountCheck args ", req.String()) log.NewInfo(params.OperationID, "AccountCheck args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.AccountCheck(context.Background(), req) RpcResp, err := client.AccountCheck(context.Background(), req)

View File

@ -42,7 +42,13 @@ func GetUserTags(c *gin.Context) {
reqPb.UserID = userID reqPb.UserID = userID
reqPb.OperationID = req.OperationID reqPb.OperationID = req.OperationID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.GetUserTags(context.Background(), &reqPb) respPb, err := client.GetUserTags(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -89,7 +95,13 @@ func CreateTag(c *gin.Context) {
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.CreateTag(context.Background(), &reqPb) respPb, err := client.CreateTag(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -131,7 +143,13 @@ func DeleteTag(c *gin.Context) {
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.DeleteTag(context.Background(), &reqPb) respPb, err := client.DeleteTag(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -173,7 +191,13 @@ func SetTag(c *gin.Context) {
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.SetTag(context.Background(), &reqPb) respPb, err := client.SetTag(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -215,7 +239,13 @@ func SendMsg2Tag(c *gin.Context) {
} }
reqPb.SendID = userID reqPb.SendID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.SendMsg2Tag(context.Background(), &reqPb) respPb, err := client.SendMsg2Tag(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -259,7 +289,13 @@ func GetTagSendLogs(c *gin.Context) {
PageNumber: req.PageNumber, PageNumber: req.PageNumber,
ShowNumber: req.ShowNumber, ShowNumber: req.ShowNumber,
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
maxSizeOption := grpc.MaxCallRecvMsgSize(1024 * 1024 * 20) maxSizeOption := grpc.MaxCallRecvMsgSize(1024 * 1024 * 20)
respPb, err := client.GetTagSendLogs(context.Background(), &reqPb, maxSizeOption) respPb, err := client.GetTagSendLogs(context.Background(), &reqPb, maxSizeOption)
@ -308,7 +344,13 @@ func GetUserTagByID(c *gin.Context) {
reqPb.UserID = userID reqPb.UserID = userID
reqPb.OperationID = req.OperationID reqPb.OperationID = req.OperationID
reqPb.TagID = req.TagID reqPb.TagID = req.TagID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.GetUserTagByID(context.Background(), &reqPb) respPb, err := client.GetUserTagByID(context.Background(), &reqPb)
if err != nil { if err != nil {

View File

@ -44,7 +44,14 @@ func CreateOneWorkMoment(c *gin.Context) {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
reqPb.WorkMoment.UserID = userID reqPb.WorkMoment.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.CreateOneWorkMoment(context.Background(), &reqPb) respPb, err := client.CreateOneWorkMoment(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -89,7 +96,14 @@ func DeleteOneWorkMoment(c *gin.Context) {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.DeleteOneWorkMoment(context.Background(), &reqPb) respPb, err := client.DeleteOneWorkMoment(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -133,7 +147,13 @@ func LikeOneWorkMoment(c *gin.Context) {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.LikeOneWorkMoment(context.Background(), &reqPb) respPb, err := client.LikeOneWorkMoment(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -177,7 +197,13 @@ func CommentOneWorkMoment(c *gin.Context) {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.CommentOneWorkMoment(context.Background(), &reqPb) respPb, err := client.CommentOneWorkMoment(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -219,7 +245,13 @@ func DeleteComment(c *gin.Context) {
return return
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.DeleteComment(context.Background(), &reqPb) respPb, err := client.DeleteComment(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -262,7 +294,13 @@ func GetWorkMomentByID(c *gin.Context) {
reqPb.OperationID = req.OperationID reqPb.OperationID = req.OperationID
reqPb.OpUserID = userID reqPb.OpUserID = userID
reqPb.WorkMomentID = req.WorkMomentID reqPb.WorkMomentID = req.WorkMomentID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.GetWorkMomentByID(context.Background(), &reqPb) respPb, err := client.GetWorkMomentByID(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -314,7 +352,13 @@ func GetUserWorkMoments(c *gin.Context) {
} }
reqPb.OpUserID = opUserID reqPb.OpUserID = opUserID
reqPb.UserID = req.UserID reqPb.UserID = req.UserID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.GetUserWorkMoments(context.Background(), &reqPb) respPb, err := client.GetUserWorkMoments(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -411,7 +455,13 @@ func GetUserFriendWorkMoments(c *gin.Context) {
ShowNumber: req.ShowNumber, ShowNumber: req.ShowNumber,
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.GetUserFriendWorkMoments(context.Background(), &reqPb) respPb, err := client.GetUserFriendWorkMoments(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -506,7 +556,13 @@ func SetUserWorkMomentsLevel(c *gin.Context) {
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
} }
reqPb.UserID = userID reqPb.UserID = userID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbOffice.NewOfficeServiceClient(etcdConn) client := pbOffice.NewOfficeServiceClient(etcdConn)
respPb, err := client.SetUserWorkMomentsLevel(context.Background(), &reqPb) respPb, err := client.SetUserWorkMomentsLevel(context.Background(), &reqPb)
if err != nil { if err != nil {

View File

@ -36,7 +36,14 @@ func CreateDepartment(c *gin.Context) {
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.CreateDepartment(context.Background(), req) RpcResp, err := client.CreateDepartment(context.Background(), req)
if err != nil { if err != nil {
@ -72,7 +79,14 @@ func UpdateDepartment(c *gin.Context) {
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.UpdateDepartment(context.Background(), req) RpcResp, err := client.UpdateDepartment(context.Background(), req)
if err != nil { if err != nil {
@ -106,7 +120,13 @@ func GetSubDepartment(c *gin.Context) {
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.GetSubDepartment(context.Background(), req) RpcResp, err := client.GetSubDepartment(context.Background(), req)
if err != nil { if err != nil {
@ -144,7 +164,13 @@ func DeleteDepartment(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.DeleteDepartment(context.Background(), req) RpcResp, err := client.DeleteDepartment(context.Background(), req)
if err != nil { if err != nil {
@ -180,7 +206,13 @@ func CreateOrganizationUser(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.CreateOrganizationUser(context.Background(), req) RpcResp, err := client.CreateOrganizationUser(context.Background(), req)
if err != nil { if err != nil {
@ -215,7 +247,13 @@ func UpdateOrganizationUser(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.UpdateOrganizationUser(context.Background(), req) RpcResp, err := client.UpdateOrganizationUser(context.Background(), req)
if err != nil { if err != nil {
@ -251,7 +289,13 @@ func CreateDepartmentMember(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.CreateDepartmentMember(context.Background(), req) RpcResp, err := client.CreateDepartmentMember(context.Background(), req)
if err != nil { if err != nil {
@ -286,7 +330,13 @@ func GetUserInDepartment(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.GetUserInDepartment(context.Background(), req) RpcResp, err := client.GetUserInDepartment(context.Background(), req)
if err != nil { if err != nil {
@ -322,7 +372,13 @@ func UpdateUserInDepartment(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.UpdateUserInDepartment(context.Background(), req) RpcResp, err := client.UpdateUserInDepartment(context.Background(), req)
if err != nil { if err != nil {
@ -357,7 +413,13 @@ func DeleteOrganizationUser(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.DeleteOrganizationUser(context.Background(), req) RpcResp, err := client.DeleteOrganizationUser(context.Background(), req)
if err != nil { if err != nil {
@ -392,7 +454,13 @@ func GetDepartmentMember(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.GetDepartmentMember(context.Background(), req) RpcResp, err := client.GetDepartmentMember(context.Background(), req)
if err != nil { if err != nil {
@ -427,7 +495,13 @@ func DeleteUserInDepartment(c *gin.Context) {
return return
} }
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewOrganizationClient(etcdConn) client := rpc.NewOrganizationClient(etcdConn)
RpcResp, err := client.DeleteUserInDepartment(context.Background(), req) RpcResp, err := client.DeleteUserInDepartment(context.Background(), req)
if err != nil { if err != nil {

View File

@ -87,7 +87,7 @@ func MinioUploadFile(c *gin.Context) {
log.Debug(req.OperationID, utils.GetSelfFuncName(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, newType, MinioClient.EndpointURL()) log.Debug(req.OperationID, utils.GetSelfFuncName(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, newType, MinioClient.EndpointURL())
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType}) _, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType})
if err != nil { if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "upload file error") log.NewError(req.OperationID, utils.GetSelfFuncName(), "upload file error", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "upload file error" + err.Error()}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "upload file error" + err.Error()})
return return
} }

View File

@ -38,7 +38,13 @@ func GetUsersInfoFromCache(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return return
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.GetUserInfo(context.Background(), req) RpcResp, err := client.GetUserInfo(context.Background(), req)
if err != nil { if err != nil {
@ -80,7 +86,13 @@ func GetFriendIDListFromCache(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return return
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := cacheRpc.NewCacheClient(etcdConn) client := cacheRpc.NewCacheClient(etcdConn)
respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb) respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -116,7 +128,13 @@ func GetBlackIDListFromCache(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return return
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := cacheRpc.NewCacheClient(etcdConn) client := cacheRpc.NewCacheClient(etcdConn)
respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb) respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -151,7 +169,13 @@ func GetUsersInfo(c *gin.Context) {
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String()) log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.GetUserInfo(context.Background(), req) RpcResp, err := client.GetUserInfo(context.Background(), req)
if err != nil { if err != nil {
@ -191,8 +215,13 @@ func UpdateUserInfo(c *gin.Context) {
return return
} }
log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String()) log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.UpdateUserInfo(context.Background(), req) RpcResp, err := client.UpdateUserInfo(context.Background(), req)
if err != nil { if err != nil {
@ -204,6 +233,44 @@ func UpdateUserInfo(c *gin.Context) {
log.NewInfo(req.OperationID, "UpdateUserInfo api return ", resp) log.NewInfo(req.OperationID, "UpdateUserInfo api return ", resp)
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
} }
func SetGlobalRecvMessageOpt(c *gin.Context) {
params := api.SetGlobalRecvMessageOptReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
req := &rpc.SetGlobalRecvMessageOptReq{}
utils.CopyStructFields(req, &params)
req.OperationID = params.OperationID
var ok bool
var errInfo string
ok, req.UserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
if !ok {
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
log.NewInfo(params.OperationID, "SetGlobalRecvMessageOpt args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.SetGlobalRecvMessageOpt(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, "SetGlobalRecvMessageOpt failed ", err.Error(), req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
return
}
resp := api.UpdateUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
log.NewInfo(req.OperationID, "SetGlobalRecvMessageOpt api return ", resp)
c.JSON(http.StatusOK, resp)
}
func GetSelfUserInfo(c *gin.Context) { func GetSelfUserInfo(c *gin.Context) {
params := api.GetSelfUserInfoReq{} params := api.GetSelfUserInfoReq{}
@ -229,7 +296,13 @@ func GetSelfUserInfo(c *gin.Context) {
req.UserIDList = append(req.UserIDList, req.OpUserID) req.UserIDList = append(req.UserIDList, req.OpUserID)
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String()) log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := rpc.NewUserClient(etcdConn) client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.GetUserInfo(context.Background(), req) RpcResp, err := client.GetUserInfo(context.Background(), req)
if err != nil { if err != nil {

View File

@ -12,6 +12,7 @@ import (
"context" "context"
"github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
"net/http"
"strings" "strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -68,7 +69,14 @@ func AdminLogin(c *gin.Context) {
} }
reqPb.Secret = req.Secret reqPb.Secret = req.Secret
reqPb.AdminID = req.AdminName reqPb.AdminID = req.AdminName
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName) reqPb.OperationID = utils.OperationIDGenerator()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbAdmin.NewAdminCMSClient(etcdConn) client := pbAdmin.NewAdminCMSClient(etcdConn)
respPb, err := client.AdminLogin(context.Background(), &reqPb) respPb, err := client.AdminLogin(context.Background(), &reqPb)
if err != nil { if err != nil {

View File

@ -10,6 +10,7 @@ import (
commonPb "Open_IM/pkg/proto/sdk_ws" commonPb "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"net/http"
"strings" "strings"
pbGroup "Open_IM/pkg/proto/group" pbGroup "Open_IM/pkg/proto/group"
@ -28,9 +29,16 @@ func GetGroupById(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
respPb, err := client.GetGroupById(context.Background(), &reqPb) respPb, err := client.GetGroupById(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -60,10 +68,17 @@ func GetGroups(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.Pagination = &commonPb.RequestPagination{} reqPb.Pagination = &commonPb.RequestPagination{}
utils.CopyStructFields(&reqPb.Pagination, req) utils.CopyStructFields(&reqPb.Pagination, req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
respPb, err := client.GetGroups(context.Background(), &reqPb) respPb, err := client.GetGroups(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -101,11 +116,18 @@ func GetGroupByName(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupName = req.GroupName reqPb.GroupName = req.GroupName
reqPb.Pagination = &commonPb.RequestPagination{} reqPb.Pagination = &commonPb.RequestPagination{}
utils.CopyStructFields(&reqPb.Pagination, req) utils.CopyStructFields(&reqPb.Pagination, req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
respPb, err := client.GetGroup(context.Background(), &reqPb) respPb, err := client.GetGroup(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -143,7 +165,8 @@ func CreateGroup(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupInfo = &commonPb.GroupInfo{} reqPb.GroupInfo = &commonPb.GroupInfo{}
reqPb.GroupInfo.GroupName = req.GroupName reqPb.GroupInfo.GroupName = req.GroupName
reqPb.GroupInfo.CreatorUserID = req.GroupMasterId reqPb.GroupInfo.CreatorUserID = req.GroupMasterId
@ -155,7 +178,13 @@ func CreateGroup(c *gin.Context) {
RoleLevel: 1, RoleLevel: 1,
}) })
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.CreateGroup(context.Background(), &reqPb) _, err := client.CreateGroup(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -176,10 +205,18 @@ func BanGroupChat(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.Status = constant.GroupBanChat reqPb.Status = constant.GroupBanChat
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.OperateGroupStatus(context.Background(), &reqPb) _, err := client.OperateGroupStatus(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -201,10 +238,17 @@ func BanPrivateChat(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.Status = constant.GroupBanPrivateChat reqPb.Status = constant.GroupBanPrivateChat
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.OperateGroupStatus(context.Background(), &reqPb) _, err := client.OperateGroupStatus(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -225,10 +269,17 @@ func OpenGroupChat(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.Status = constant.GroupOk reqPb.Status = constant.GroupOk
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.OperateGroupStatus(context.Background(), &reqPb) _, err := client.OperateGroupStatus(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -249,10 +300,18 @@ func OpenPrivateChat(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.Status = constant.GroupOk reqPb.Status = constant.GroupOk
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.OperateGroupStatus(context.Background(), &reqPb) _, err := client.OperateGroupStatus(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -274,14 +333,21 @@ func GetGroupMembers(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.Pagination = &commonPb.RequestPagination{ reqPb.Pagination = &commonPb.RequestPagination{
PageNumber: int32(req.PageNumber), PageNumber: int32(req.PageNumber),
ShowNumber: int32(req.ShowNumber), ShowNumber: int32(req.ShowNumber),
} }
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.UserName = req.UserName reqPb.UserName = req.UserName
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
respPb, err := client.GetGroupMembersCMS(context.Background(), &reqPb) respPb, err := client.GetGroupMembersCMS(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -317,10 +383,17 @@ func AddGroupMembers(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
reqPb.OperationId = utils.OperationIDGenerator()
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) log.NewInfo("", utils.GetSelfFuncName(), "req: ", req)
reqPb.UserIds = req.Members reqPb.UserIds = req.Members
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationId)
if etcdConn == nil {
errMsg := reqPb.OperationId + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationId, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
respPb, err := client.AddGroupMembersCMS(context.Background(), &reqPb) respPb, err := client.AddGroupMembersCMS(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -345,10 +418,17 @@ func RemoveGroupMembers(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.UserIds = req.Members reqPb.UserIds = req.Members
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
respPb, err := client.RemoveGroupMembersCMS(context.Background(), &reqPb) respPb, err := client.RemoveGroupMembersCMS(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -373,9 +453,16 @@ func DeleteGroup(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.DeleteGroup(context.Background(), &reqPb) _, err := client.DeleteGroup(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -397,11 +484,18 @@ func SetGroupMaster(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.UserId = req.UserId reqPb.UserId = req.UserId
reqPb.RoleLevel = constant.GroupOwner reqPb.RoleLevel = constant.GroupOwner
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.OperateUserRole(context.Background(), &reqPb) _, err := client.OperateUserRole(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -423,11 +517,18 @@ func SetGroupOrdinaryUsers(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.GroupId = req.GroupId reqPb.GroupId = req.GroupId
reqPb.UserId = req.UserId reqPb.UserId = req.UserId
reqPb.RoleLevel = constant.GroupOrdinaryUsers reqPb.RoleLevel = constant.GroupOrdinaryUsers
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.OperateUserRole(context.Background(), &reqPb) _, err := client.OperateUserRole(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -444,7 +545,8 @@ func AlterGroupInfo(c *gin.Context) {
_ cms_api_struct.SetGroupMasterResponse _ cms_api_struct.SetGroupMasterResponse
reqPb pbGroup.SetGroupInfoReq reqPb pbGroup.SetGroupInfoReq
) )
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
if err := c.BindJSON(&req); err != nil { if err := c.BindJSON(&req); err != nil {
log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error()) log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
@ -459,7 +561,13 @@ func AlterGroupInfo(c *gin.Context) {
FaceURL: req.ProfilePhoto, FaceURL: req.ProfilePhoto,
GroupType: int32(req.GroupType), GroupType: int32(req.GroupType),
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
_, err := client.SetGroupInfo(context.Background(), &reqPb) _, err := client.SetGroupInfo(context.Background(), &reqPb)
if err != nil { if err != nil {

View File

@ -10,6 +10,7 @@ import (
pbCommon "Open_IM/pkg/proto/sdk_ws" pbCommon "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"net/http"
"strings" "strings"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
@ -21,7 +22,14 @@ func BroadcastMessage(c *gin.Context) {
var ( var (
reqPb pbMessage.BoradcastMessageReq reqPb pbMessage.BoradcastMessageReq
) )
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName) reqPb.OperationID = utils.OperationIDGenerator()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbMessage.NewMessageCMSClient(etcdConn) client := pbMessage.NewMessageCMSClient(etcdConn)
_, err := client.BoradcastMessage(context.Background(), &reqPb) _, err := client.BoradcastMessage(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -36,7 +44,14 @@ func MassSendMassage(c *gin.Context) {
var ( var (
reqPb pbMessage.MassSendMessageReq reqPb pbMessage.MassSendMessageReq
) )
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName) reqPb.OperationID = utils.OperationIDGenerator()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbMessage.NewMessageCMSClient(etcdConn) client := pbMessage.NewMessageCMSClient(etcdConn)
_, err := client.MassSendMessage(context.Background(), &reqPb) _, err := client.MassSendMessage(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -51,7 +66,14 @@ func WithdrawMessage(c *gin.Context) {
var ( var (
reqPb pbMessage.WithdrawMessageReq reqPb pbMessage.WithdrawMessageReq
) )
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName) reqPb.OperationID = utils.OperationIDGenerator()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbMessage.NewMessageCMSClient(etcdConn) client := pbMessage.NewMessageCMSClient(etcdConn)
_, err := client.WithdrawMessage(context.Background(), &reqPb) _, err := client.WithdrawMessage(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -78,8 +100,14 @@ func GetChatLogs(c *gin.Context) {
ShowNumber: int32(req.ShowNumber), ShowNumber: int32(req.ShowNumber),
} }
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pbMessage.NewMessageCMSClient(etcdConn) client := pbMessage.NewMessageCMSClient(etcdConn)
respPb, err := client.GetChatLogs(context.Background(), &reqPb) respPb, err := client.GetChatLogs(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -106,6 +134,6 @@ func GetChatLogs(c *gin.Context) {
resp.ShowNumber = int(respPb.Pagination.ShowNumber) resp.ShowNumber = int(respPb.Pagination.ShowNumber)
resp.CurrentPage = int(respPb.Pagination.CurrentPage) resp.CurrentPage = int(respPb.Pagination.CurrentPage)
resp.ChatLogsNum = int(respPb.ChatLogsNum) resp.ChatLogsNum = int(respPb.ChatLogsNum)
log.NewInfo("", utils.GetSelfFuncName(), "resp", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }

View File

@ -10,6 +10,7 @@ import (
pb "Open_IM/pkg/proto/statistics" pb "Open_IM/pkg/proto/statistics"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"net/http"
"strings" "strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -27,9 +28,16 @@ func GetMessagesStatistics(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.StatisticsReq, &req) utils.CopyStructFields(&reqPb.StatisticsReq, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetMessageStatistics(context.Background(), &reqPb) respPb, err := client.GetMessageStatistics(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -58,7 +66,7 @@ func GetMessagesStatistics(c *gin.Context) {
MessageNum: int(v.Num), MessageNum: int(v.Num),
}) })
} }
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -74,13 +82,20 @@ func GetUserStatistics(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.StatisticsReq, &req) utils.CopyStructFields(&reqPb.StatisticsReq, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetUserStatistics(context.Background(), &reqPb) respPb, err := client.GetUserStatistics(context.Background(), &reqPb)
if err != nil { if err != nil {
log.NewError("0", utils.GetSelfFuncName(), "GetUserStatistics failed", err.Error()) log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "GetUserStatistics failed", err.Error())
openIMHttp.RespHttp200(c, err, nil) openIMHttp.RespHttp200(c, err, nil)
return return
} }
@ -115,7 +130,7 @@ func GetUserStatistics(c *gin.Context) {
TotalUserNum: int(v.Num), TotalUserNum: int(v.Num),
}) })
} }
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -131,9 +146,16 @@ func GetGroupStatistics(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.StatisticsReq, &req) utils.CopyStructFields(&reqPb.StatisticsReq, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetGroupStatistics(context.Background(), &reqPb) respPb, err := client.GetGroupStatistics(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -165,7 +187,7 @@ func GetGroupStatistics(c *gin.Context) {
}) })
} }
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -181,9 +203,16 @@ func GetActiveUser(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.StatisticsReq, req) utils.CopyStructFields(&reqPb.StatisticsReq, req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetActiveUser(context.Background(), &reqPb) respPb, err := client.GetActiveUser(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -192,7 +221,7 @@ func GetActiveUser(c *gin.Context) {
return return
} }
utils.CopyStructFields(&resp.ActiveUserList, respPb.Users) utils.CopyStructFields(&resp.ActiveUserList, respPb.Users)
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -208,13 +237,20 @@ func GetActiveGroup(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.StatisticsReq, req) utils.CopyStructFields(&reqPb.StatisticsReq, req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetActiveGroup(context.Background(), &reqPb) respPb, err := client.GetActiveGroup(context.Background(), &reqPb)
if err != nil { if err != nil {
log.NewError("0", utils.GetSelfFuncName(), "GetActiveGroup failed ", err.Error()) log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "GetActiveGroup failed ", err.Error())
openIMHttp.RespHttp200(c, err, nil) openIMHttp.RespHttp200(c, err, nil)
return return
} }
@ -229,6 +265,6 @@ func GetActiveGroup(c *gin.Context) {
MessageNum: int(group.MessageNum), MessageNum: int(group.MessageNum),
}) })
} }
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }

View File

@ -29,9 +29,17 @@ func GetUserById(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetUserById(context.Background(), &reqPb) respPb, err := client.GetUserById(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -44,7 +52,7 @@ func GetUserById(c *gin.Context) {
return return
} }
utils.CopyStructFields(&resp, respPb.User) utils.CopyStructFields(&resp, respPb.User)
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -54,7 +62,8 @@ func GetUsersByName(c *gin.Context) {
resp cms_api_struct.GetUsersByNameResponse resp cms_api_struct.GetUsersByNameResponse
reqPb pb.GetUsersByNameReq reqPb pb.GetUsersByNameReq
) )
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
if err := c.ShouldBindQuery(&req); err != nil { if err := c.ShouldBindQuery(&req); err != nil {
log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "ShouldBindQuery failed", err.Error()) log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "ShouldBindQuery failed", err.Error())
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
@ -65,7 +74,13 @@ func GetUsersByName(c *gin.Context) {
PageNumber: int32(req.PageNumber), PageNumber: int32(req.PageNumber),
ShowNumber: int32(req.ShowNumber), ShowNumber: int32(req.ShowNumber),
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetUsersByName(context.Background(), &reqPb) respPb, err := client.GetUsersByName(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -77,7 +92,7 @@ func GetUsersByName(c *gin.Context) {
resp.ShowNumber = int(respPb.Pagination.ShowNumber) resp.ShowNumber = int(respPb.Pagination.ShowNumber)
resp.CurrentPage = int(respPb.Pagination.CurrentPage) resp.CurrentPage = int(respPb.Pagination.CurrentPage)
resp.UserNums = respPb.UserNums resp.UserNums = respPb.UserNums
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -93,9 +108,16 @@ func GetUsers(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.Pagination, &req) utils.CopyStructFields(&reqPb.Pagination, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetUsers(context.Background(), &reqPb) respPb, err := client.GetUsers(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -106,7 +128,7 @@ func GetUsers(c *gin.Context) {
resp.ShowNumber = int(respPb.Pagination.ShowNumber) resp.ShowNumber = int(respPb.Pagination.ShowNumber)
resp.CurrentPage = int(respPb.Pagination.CurrentPage) resp.CurrentPage = int(respPb.Pagination.CurrentPage)
resp.UserNums = respPb.UserNums resp.UserNums = respPb.UserNums
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -122,15 +144,22 @@ func ResignUser(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
_, err := client.ResignUser(context.Background(), &reqPb) _, err := client.ResignUser(context.Background(), &reqPb)
if err != nil { if err != nil {
openIMHttp.RespHttp200(c, err, resp) openIMHttp.RespHttp200(c, err, resp)
} }
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -145,13 +174,20 @@ func AlterUser(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, resp) openIMHttp.RespHttp200(c, constant.ErrArgs, resp)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
_, err := client.AlterUser(context.Background(), &reqPb) _, err := client.AlterUser(context.Background(), &reqPb)
if err != nil { if err != nil {
log.NewError("0", "microserver failed ", err.Error()) log.NewError(reqPb.OperationID, "microserver failed ", err.Error())
openIMHttp.RespHttp200(c, err, nil) openIMHttp.RespHttp200(c, err, nil)
} }
openIMHttp.RespHttp200(c, constant.OK, nil) openIMHttp.RespHttp200(c, constant.OK, nil)
@ -167,9 +203,16 @@ func AddUser(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
_, err := client.AddUser(context.Background(), &reqPb) _, err := client.AddUser(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -191,9 +234,16 @@ func BlockUser(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, resp) openIMHttp.RespHttp200(c, constant.ErrArgs, resp)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
fmt.Println(reqPb) fmt.Println(reqPb)
_, err := client.BlockUser(context.Background(), &reqPb) _, err := client.BlockUser(context.Background(), &reqPb)
@ -215,16 +265,23 @@ func UnblockUser(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, resp) openIMHttp.RespHttp200(c, constant.ErrArgs, resp)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb, &req) utils.CopyStructFields(&reqPb, &req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
_, err := client.UnBlockUser(context.Background(), &reqPb) _, err := client.UnBlockUser(context.Background(), &reqPb)
if err != nil { if err != nil {
openIMHttp.RespHttp200(c, err, resp) openIMHttp.RespHttp200(c, err, resp)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -241,10 +298,17 @@ func GetBlockUsers(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, resp) openIMHttp.RespHttp200(c, constant.ErrArgs, resp)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
utils.CopyStructFields(&reqPb.Pagination, &req) utils.CopyStructFields(&reqPb.Pagination, &req)
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "blockUsers", reqPb.Pagination, req) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "blockUsers", reqPb.Pagination, req)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetBlockUsers(context.Background(), &reqPb) respPb, err := client.GetBlockUsers(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -268,7 +332,7 @@ func GetBlockUsers(c *gin.Context) {
resp.ShowNumber = int(respPb.Pagination.ShowNumber) resp.ShowNumber = int(respPb.Pagination.ShowNumber)
resp.CurrentPage = int(respPb.Pagination.CurrentPage) resp.CurrentPage = int(respPb.Pagination.CurrentPage)
resp.UserNums = respPb.UserNums resp.UserNums = respPb.UserNums
log.NewInfo("", utils.GetSelfFuncName(), "req: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -283,20 +347,27 @@ func GetBlockUserById(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.UserId = req.UserId reqPb.UserId = req.UserId
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
respPb, err := client.GetBlockUserById(context.Background(), &reqPb) respPb, err := client.GetBlockUserById(context.Background(), &reqPb)
if err != nil { if err != nil {
log.NewError("0", "GetBlockUserById rpc failed ", err.Error()) log.NewError(reqPb.OperationID, "GetBlockUserById rpc failed ", err.Error())
openIMHttp.RespHttp200(c, err, nil) openIMHttp.RespHttp200(c, err, nil)
return return
} }
resp.EndDisableTime = respPb.BlockUser.EndDisableTime resp.EndDisableTime = respPb.BlockUser.EndDisableTime
resp.BeginDisableTime = respPb.BlockUser.BeginDisableTime resp.BeginDisableTime = respPb.BlockUser.BeginDisableTime
utils.CopyStructFields(&resp, respPb.BlockUser.User) utils.CopyStructFields(&resp, respPb.BlockUser.User)
log.NewInfo("", utils.GetSelfFuncName(), "resp: ", resp) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
openIMHttp.RespHttp200(c, constant.OK, resp) openIMHttp.RespHttp200(c, constant.OK, resp)
} }
@ -310,13 +381,20 @@ func DeleteUser(c *gin.Context) {
openIMHttp.RespHttp200(c, constant.ErrArgs, nil) openIMHttp.RespHttp200(c, constant.ErrArgs, nil)
return return
} }
log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.OperationID = utils.OperationIDGenerator()
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
reqPb.UserId = req.UserId reqPb.UserId = req.UserId
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID)
if etcdConn == nil {
errMsg := reqPb.OperationID + "getcdv3.GetConn == nil"
log.NewError(reqPb.OperationID, errMsg)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
return
}
client := pb.NewUserClient(etcdConn) client := pb.NewUserClient(etcdConn)
_, err := client.DeleteUser(context.Background(), &reqPb) _, err := client.DeleteUser(context.Background(), &reqPb)
if err != nil { if err != nil {
log.NewError("0", "DeleteUser rpc failed ", err.Error()) log.NewError(reqPb.OperationID, "DeleteUser rpc failed ", err.Error())
openIMHttp.RespHttp200(c, err, nil) openIMHttp.RespHttp200(c, err, nil)
return return
} }

View File

@ -46,12 +46,18 @@ func Login(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"errCode": constant.PasswordErr, "errMsg": "password err"}) c.JSON(http.StatusOK, gin.H{"errCode": constant.PasswordErr, "errMsg": "password err"})
return return
} }
var userID string
if r.UserID != "" {
userID = r.UserID
} else {
userID = r.Account
}
url := fmt.Sprintf("http://%s:%d/auth/user_token", utils.ServerIP, config.Config.Api.GinPort[0]) url := fmt.Sprintf("http://%s:%d/auth/user_token", utils.ServerIP, config.Config.Api.GinPort[0])
openIMGetUserToken := api.UserTokenReq{} openIMGetUserToken := api.UserTokenReq{}
openIMGetUserToken.OperationID = params.OperationID openIMGetUserToken.OperationID = params.OperationID
openIMGetUserToken.Platform = params.Platform openIMGetUserToken.Platform = params.Platform
openIMGetUserToken.Secret = config.Config.Secret openIMGetUserToken.Secret = config.Config.Secret
openIMGetUserToken.UserID = account openIMGetUserToken.UserID = userID
openIMGetUserTokenResp := api.UserTokenResp{} openIMGetUserTokenResp := api.UserTokenResp{}
bMsg, err := http2.Post(url, openIMGetUserToken, 2) bMsg, err := http2.Post(url, openIMGetUserToken, 2)
if err != nil { if err != nil {

View File

@ -1,9 +1,11 @@
package register package register
import ( import (
"Open_IM/internal/api/manage"
"Open_IM/internal/rpc/msg" "Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
groupRpc "Open_IM/pkg/proto/group" groupRpc "Open_IM/pkg/proto/group"
@ -23,23 +25,37 @@ func onboardingProcess(operationID, userID, userName string) {
if err := createOrganizationUser(operationID, userID, userName); err != nil { if err := createOrganizationUser(operationID, userID, userName); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "createOrganizationUser failed", err.Error()) log.NewError(operationID, utils.GetSelfFuncName(), "createOrganizationUser failed", err.Error())
} }
departmentID := config.Config.Demo.TestDepartMentID departmentID, err := imdb.GetRandomDepartmentID()
if err := joinTestDepartment(operationID, userID, departmentID); err != nil { if err := joinTestDepartment(operationID, userID, departmentID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "joinTestDepartment failed", err.Error()) log.NewError(operationID, utils.GetSelfFuncName(), "joinTestDepartment failed", err.Error())
} }
log.NewInfo(operationID, utils.GetSelfFuncName(), "random departmentID", departmentID)
if err != nil {
log.NewError(utils.GetSelfFuncName(), "GetRandomDepartmentID failed", err.Error())
return
}
groupIDList, err := GetDepartmentGroupIDList(operationID, departmentID) groupIDList, err := GetDepartmentGroupIDList(operationID, departmentID)
if err != nil { if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error()) log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
} }
log.NewInfo(operationID, utils.GetSelfFuncName(), groupIDList)
joinGroups(operationID, userID, userName, groupIDList) joinGroups(operationID, userID, userName, groupIDList)
log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed") log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed")
oaNotification(operationID, userID)
} }
func createOrganizationUser(operationID, userID, userName string) error { func createOrganizationUser(operationID, userID, userName string) error {
defer func() { defer func() {
log.NewInfo(operationID, utils.GetSelfFuncName(), userID) log.NewInfo(operationID, utils.GetSelfFuncName(), userID)
}() }()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) log.NewInfo(operationID, utils.GetSelfFuncName(), "start createOrganizationUser")
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID)
if etcdConn == nil {
errMsg := operationID + "getcdv3.GetConn == nil"
log.NewError(operationID, errMsg)
return errors.New(errMsg)
}
client := organizationRpc.NewOrganizationClient(etcdConn) client := organizationRpc.NewOrganizationClient(etcdConn)
req := &organizationRpc.CreateOrganizationUserReq{ req := &organizationRpc.CreateOrganizationUserReq{
OrganizationUser: &commonPb.OrganizationUser{ OrganizationUser: &commonPb.OrganizationUser{
@ -50,7 +66,8 @@ func createOrganizationUser(operationID, userID, userName string) error {
CreateTime: uint32(time.Now().Unix()), CreateTime: uint32(time.Now().Unix()),
}, },
OperationID: operationID, OperationID: operationID,
OpUserID: userID, OpUserID: config.Config.Manager.AppManagerUid[0],
IsRegister: false,
} }
if strings.Contains("@", userID) { if strings.Contains("@", userID) {
req.OrganizationUser.Email = userID req.OrganizationUser.Email = userID
@ -73,7 +90,12 @@ func joinTestDepartment(operationID, userID, departmentID string) error {
defer func() { defer func() {
log.NewInfo(operationID, utils.GetSelfFuncName(), userID) log.NewInfo(operationID, utils.GetSelfFuncName(), userID)
}() }()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID)
if etcdConn == nil {
errMsg := operationID + "getcdv3.GetConn == nil"
log.NewError(operationID, errMsg)
return errors.New(errMsg)
}
client := organizationRpc.NewOrganizationClient(etcdConn) client := organizationRpc.NewOrganizationClient(etcdConn)
req := &organizationRpc.CreateDepartmentMemberReq{ req := &organizationRpc.CreateDepartmentMemberReq{
DepartmentMember: &commonPb.DepartmentMember{ DepartmentMember: &commonPb.DepartmentMember{
@ -97,7 +119,15 @@ func joinTestDepartment(operationID, userID, departmentID string) error {
} }
func GetDepartmentGroupIDList(operationID, departmentID string) ([]string, error) { func GetDepartmentGroupIDList(operationID, departmentID string) ([]string, error) {
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName) defer func() {
log.NewInfo(operationID, utils.GetSelfFuncName(), departmentID)
}()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID)
if etcdConn == nil {
errMsg := operationID + "getcdv3.GetConn == nil"
log.NewError(operationID, errMsg)
return nil, errors.New(errMsg)
}
client := organizationRpc.NewOrganizationClient(etcdConn) client := organizationRpc.NewOrganizationClient(etcdConn)
req := organizationRpc.GetDepartmentParentIDListReq{ req := organizationRpc.GetDepartmentParentIDListReq{
DepartmentID: departmentID, DepartmentID: departmentID,
@ -131,7 +161,12 @@ func joinGroups(operationID, userID, userName string, groupIDList []string) {
defer func() { defer func() {
log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupIDList) log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupIDList)
}() }()
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, operationID)
if etcdConn == nil {
errMsg := operationID + "getcdv3.GetConn == nil"
log.NewError(operationID, errMsg)
return
}
client := groupRpc.NewGroupClient(etcdConn) client := groupRpc.NewGroupClient(etcdConn)
for _, groupID := range groupIDList { for _, groupID := range groupIDList {
req := &groupRpc.InviteUserToGroupReq{ req := &groupRpc.InviteUserToGroupReq{
@ -139,7 +174,7 @@ func joinGroups(operationID, userID, userName string, groupIDList []string) {
GroupID: groupID, GroupID: groupID,
Reason: "register auto join", Reason: "register auto join",
InvitedUserIDList: []string{userID}, InvitedUserIDList: []string{userID},
OpUserID: userID, OpUserID: config.Config.Manager.AppManagerUid[1],
} }
resp, err := client.InviteUserToGroup(context.Background(), req) resp, err := client.InviteUserToGroup(context.Background(), req)
if err != nil { if err != nil {
@ -150,34 +185,71 @@ func joinGroups(operationID, userID, userName string, groupIDList []string) {
log.NewError(req.OperationID, utils.GetSelfFuncName(), resp) log.NewError(req.OperationID, utils.GetSelfFuncName(), resp)
continue continue
} }
onboardingProcessNotification(operationID, userID, groupID) onboardingProcessNotification(operationID, userID, groupID, userName)
} }
} }
// welcome user join department notification // welcome user join department notification
func onboardingProcessNotification(operationID, userID, groupID string) { func onboardingProcessNotification(operationID, userID, groupID, userName string) {
defer func() { defer func() {
log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupID) log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupID)
}() }()
var tips commonPb.TipsComm //var tips commonPb.TipsComm
tips.DefaultTips = config.Config.Notification.JoinDepartmentNotification.DefaultTips.Tips //tips.DefaultTips = config.Config.Notification.JoinDepartmentNotification.DefaultTips.Tips
tips.JsonDetail = "" //tips.JsonDetail = ""
content, err := proto.Marshal(&tips) //content, err := proto.Marshal(&tips)
if err != nil { //if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), "proto marshal failed") // log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), "proto marshal failed")
return // return
} //}
welcomeString := fmt.Sprintf("欢迎%s加入部门", userName)
notification := &msg.NotificationMsg{ notification := &msg.NotificationMsg{
SendID: userID, SendID: userID,
RecvID: groupID, RecvID: groupID,
Content: content, Content: []byte(welcomeString),
MsgFrom: constant.UserMsgType, MsgFrom: constant.UserMsgType,
ContentType: constant.Text, ContentType: constant.Text,
SessionType: constant.SingleChatType, SessionType: constant.GroupChatType,
OperationID: operationID, OperationID: operationID,
} }
// notification user join group // notification user join group
msg.Notification(notification) msg.Notification(notification)
}
func oaNotification(operationID, userID string) {
var err error
elem := manage.OANotificationElem{
NotificationName: "入职通知",
NotificationFaceURL: "",
NotificationType: 1,
Text: "欢迎你入职公司",
Url: "",
MixType: 0,
PictureElem: manage.PictureElem{},
SoundElem: manage.SoundElem{},
VideoElem: manage.VideoElem{},
FileElem: manage.FileElem{},
Ex: "",
}
sysNotification := &msg.NotificationMsg{
SendID: config.Config.Manager.AppManagerUid[0],
RecvID: userID,
MsgFrom: constant.SysMsgType,
ContentType: constant.OANotification,
SessionType: constant.NotificationChatType,
OperationID: operationID,
}
var tips commonPb.TipsComm
tips.JsonDetail = utils.StructToJsonString(elem)
sysNotification.Content, err = proto.Marshal(&tips)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "elem: ", elem, err.Error())
return
}
msg.Notification(sysNotification)
} }
func randomEnglishName() string { func randomEnglishName() string {
@ -185,14 +257,12 @@ func randomEnglishName() string {
"feudal", "adverse", "exploit", "occupy", "solve", "amazing", "fantasy", "orchid", "spiky", "approve", "flap"} "feudal", "adverse", "exploit", "occupy", "solve", "amazing", "fantasy", "orchid", "spiky", "approve", "flap"}
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
index := rand.Intn(len(l) - 1) index := rand.Intn(len(l) - 1)
fmt.Println(index)
return l[index] return l[index]
} }
func randomPosition() string { func randomPosition() string {
l := []string{"Golang工程师", "前端工程师", "后端工程师", "产品经理", "测试开发工程师", "运维开发工程师"} l := []string{"后端工程师", "前端工程师", "设计师"}
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
index := rand.Intn(len(l) - 1) index := rand.Intn(len(l) - 1)
fmt.Println(index)
return l[index] return l[index]
} }

View File

@ -44,7 +44,9 @@ func ResetPassword(c *gin.Context) {
} }
user, err := im_mysql_model.GetRegister(account) user, err := im_mysql_model.GetRegister(account)
if err != nil || user.Account == "" { if err != nil || user.Account == "" {
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "get register error", err.Error()) log.NewError(req.OperationID, utils.GetSelfFuncName(), "get register error", err.Error())
}
c.JSON(http.StatusOK, gin.H{"errCode": constant.NotRegistered, "errMsg": "user not register!"}) c.JSON(http.StatusOK, gin.H{"errCode": constant.NotRegistered, "errMsg": "user not register!"})
return return
} }

View File

@ -11,17 +11,21 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"encoding/json" "encoding/json"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"math/big"
"net/http" "net/http"
"strconv"
"time"
) )
type ParamsSetPassword struct { type ParamsSetPassword struct {
Email string `json:"email"` Email string `json:"email"`
Name string `json:"name"` Nickname string `json:"nickname"`
PhoneNumber string `json:"phoneNumber"` PhoneNumber string `json:"phoneNumber"`
Password string `json:"password"` Password string `json:"password" binding:"required"`
VerificationCode string `json:"verificationCode"` VerificationCode string `json:"verificationCode"`
Platform int32 `json:"platform" binding:"required,min=1,max=7"` Platform int32 `json:"platform" binding:"required,min=1,max=7"`
Ex string `json:"ex"` Ex string `json:"ex"`
FaceURL string `json:"faceURL"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
@ -38,8 +42,8 @@ func SetPassword(c *gin.Context) {
} else { } else {
account = params.PhoneNumber account = params.PhoneNumber
} }
if params.Name == "" { if params.Nickname == "" {
params.Name = account params.Nickname = account
} }
if params.VerificationCode != config.Config.Demo.SuperCode { if params.VerificationCode != config.Config.Demo.SuperCode {
accountKey := account + "_" + constant.VerificationCodeForRegisterSuffix accountKey := account + "_" + constant.VerificationCodeForRegisterSuffix
@ -52,13 +56,21 @@ func SetPassword(c *gin.Context) {
return return
} }
} }
//userID := utils.Base64Encode(account)
userID := utils.Md5(params.OperationID + strconv.FormatInt(time.Now().UnixNano(), 10))
bi := big.NewInt(0)
bi.SetString(userID[0:8], 16)
userID = bi.String()
url := config.Config.Demo.ImAPIURL + "/auth/user_register" url := config.Config.Demo.ImAPIURL + "/auth/user_register"
openIMRegisterReq := api.UserRegisterReq{} openIMRegisterReq := api.UserRegisterReq{}
openIMRegisterReq.OperationID = params.OperationID openIMRegisterReq.OperationID = params.OperationID
openIMRegisterReq.Platform = params.Platform openIMRegisterReq.Platform = params.Platform
openIMRegisterReq.UserID = account openIMRegisterReq.UserID = userID
openIMRegisterReq.Nickname = params.Name openIMRegisterReq.Nickname = params.Nickname
openIMRegisterReq.Secret = config.Config.Secret openIMRegisterReq.Secret = config.Config.Secret
openIMRegisterReq.FaceURL = params.FaceURL
openIMRegisterResp := api.UserRegisterResp{} openIMRegisterResp := api.UserRegisterResp{}
bMsg, err := http2.Post(url, openIMRegisterReq, 2) bMsg, err := http2.Post(url, openIMRegisterReq, 2)
if err != nil { if err != nil {
@ -76,7 +88,7 @@ func SetPassword(c *gin.Context) {
return return
} }
log.Info(params.OperationID, "begin store mysql", account, params.Password) log.Info(params.OperationID, "begin store mysql", account, params.Password)
err = im_mysql_model.SetPassword(account, params.Password, params.Ex) err = im_mysql_model.SetPassword(account, params.Password, params.Ex, userID)
if err != nil { if err != nil {
log.NewError(params.OperationID, "set phone number password error", account, "err", err.Error()) log.NewError(params.OperationID, "set phone number password error", account, "err", err.Error())
c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": err.Error()}) c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": err.Error()})
@ -84,7 +96,7 @@ func SetPassword(c *gin.Context) {
} }
log.Info(params.OperationID, "end setPassword", account, params.Password) log.Info(params.OperationID, "end setPassword", account, params.Password)
// demo onboarding // demo onboarding
onboardingProcess(params.OperationID, account, params.Name) onboardingProcess(params.OperationID, userID, params.Nickname)
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": openIMRegisterResp.UserToken}) c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": openIMRegisterResp.UserToken})
return return
} }

View File

@ -0,0 +1,117 @@
package gate
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/db"
"Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
pbChat "Open_IM/pkg/proto/chat"
sdk_ws "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"context"
"strings"
)
var MaxPullMsgNum = 100
func (r *RPCServer) GenPullSeqList(currentSeq uint32, operationID string, userID string) ([]uint32, error) {
maxSeq, err := db.DB.GetUserMaxSeq(userID)
if err != nil {
log.Error(operationID, "GetUserMaxSeq failed ", userID, err.Error())
return nil, utils.Wrap(err, "")
}
var seqList []uint32
num := 0
for i := currentSeq + 1; i < uint32(maxSeq); i++ {
seqList = append(seqList, i)
num++
if num == MaxPullMsgNum {
break
}
}
log.Info(operationID, "GenPullSeqList ", seqList, "current seq", currentSeq)
return seqList, nil
}
func (r *RPCServer) GetSingleUserMsgForPushPlatforms(operationID string, msgData *sdk_ws.MsgData, pushToUserID string, platformIDList []int) map[int]*sdk_ws.MsgDataList {
user2PushMsg := make(map[int]*sdk_ws.MsgDataList, 0)
for _, v := range platformIDList {
user2PushMsg[v] = r.GetSingleUserMsgForPush(operationID, msgData, pushToUserID, v)
//log.Info(operationID, "GetSingleUserMsgForPush", msgData.Seq, pushToUserID, v, "len:", len(user2PushMsg[v]))
}
return user2PushMsg
}
func (r *RPCServer) GetSingleUserMsgForPush(operationID string, msgData *sdk_ws.MsgData, pushToUserID string, platformID int) *sdk_ws.MsgDataList {
//msgData.MsgDataList = nil
return &sdk_ws.MsgDataList{MsgDataList: []*sdk_ws.MsgData{msgData}}
//userConn := ws.getUserConn(pushToUserID, platformID)
//if userConn == nil {
// log.Debug(operationID, "userConn == nil")
// return []*sdk_ws.MsgData{msgData}
//}
//
//if msgData.Seq <= userConn.PushedMaxSeq {
// log.Debug(operationID, "msgData.Seq <= userConn.PushedMaxSeq", msgData.Seq, userConn.PushedMaxSeq)
// return nil
//}
//
//msgList := r.GetSingleUserMsg(operationID, msgData.Seq, pushToUserID)
//if msgList == nil {
// log.Debug(operationID, "GetSingleUserMsg msgList == nil", msgData.Seq, userConn.PushedMaxSeq)
// userConn.PushedMaxSeq = msgData.Seq
// return []*sdk_ws.MsgData{msgData}
//}
//msgList = append(msgList, msgData)
//
//for _, v := range msgList {
// if v.Seq > userConn.PushedMaxSeq {
// userConn.PushedMaxSeq = v.Seq
// }
//}
//log.Debug(operationID, "GetSingleUserMsg msgList len ", len(msgList), userConn.PushedMaxSeq)
//return msgList
}
func (r *RPCServer) GetSingleUserMsg(operationID string, currentMsgSeq uint32, userID string) []*sdk_ws.MsgData {
seqList, err := r.GenPullSeqList(currentMsgSeq, operationID, userID)
if err != nil {
log.Error(operationID, "GenPullSeqList failed ", err.Error(), currentMsgSeq, userID)
return nil
}
if len(seqList) == 0 {
log.Error(operationID, "GenPullSeqList len == 0 ", currentMsgSeq, userID)
return nil
}
rpcReq := sdk_ws.PullMessageBySeqListReq{}
rpcReq.SeqList = seqList
rpcReq.UserID = userID
rpcReq.OperationID = operationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, rpcReq.OperationID)
if grpcConn == nil {
errMsg := "getcdv3.GetConn == nil"
log.NewError(rpcReq.OperationID, errMsg)
return nil
}
msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessageBySeqList(context.Background(), &rpcReq)
if err != nil {
log.Error(operationID, "PullMessageBySeqList failed ", err.Error(), rpcReq.String())
return nil
}
if len(reply.List) == 0 {
return nil
}
return reply.List
}
//func (r *RPCServer) GetBatchUserMsgForPush(operationID string, msgData *sdk_ws.MsgData, pushToUserIDList []string, platformID int) map[string][]*sdk_ws.MsgData {
// user2PushMsg := make(map[string][]*sdk_ws.MsgData, 0)
// for _, v := range pushToUserIDList {
// user2PushMsg[v] = r.GetSingleUserMsgForPush(operationID, msgData, v, platformID)
// }
// return user2PushMsg
//}

View File

@ -9,7 +9,7 @@ import (
"time" "time"
) )
func callbackUserOnline(operationID, userID string, platformID int32, token string) cbApi.CommonCallbackResp { func callbackUserOnline(operationID, userID string, platformID int, token string) cbApi.CommonCallbackResp {
callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
if !config.Config.Callback.CallbackUserOnline.Enable { if !config.Config.Callback.CallbackUserOnline.Enable {
return callbackResp return callbackResp
@ -20,7 +20,7 @@ func callbackUserOnline(operationID, userID string, platformID int32, token stri
CallbackCommand: constant.CallbackUserOnlineCommand, CallbackCommand: constant.CallbackUserOnlineCommand,
OperationID: operationID, OperationID: operationID,
UserID: userID, UserID: userID,
PlatformID: platformID, PlatformID: int32(platformID),
Platform: constant.PlatformIDToName(platformID), Platform: constant.PlatformIDToName(platformID),
}, },
Seq: time.Now().Nanosecond() / 1e6, Seq: time.Now().Nanosecond() / 1e6,
@ -33,7 +33,7 @@ func callbackUserOnline(operationID, userID string, platformID int32, token stri
return callbackResp return callbackResp
} }
func callbackUserOffline(operationID, userID string, platform string) cbApi.CommonCallbackResp { func callbackUserOffline(operationID, userID string, platformID int) cbApi.CommonCallbackResp {
callbackResp := cbApi.CommonCallbackResp{OperationID: operationID} callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
if !config.Config.Callback.CallbackUserOffline.Enable { if !config.Config.Callback.CallbackUserOffline.Enable {
return callbackResp return callbackResp
@ -43,8 +43,8 @@ func callbackUserOffline(operationID, userID string, platform string) cbApi.Comm
CallbackCommand: constant.CallbackUserOfflineCommand, CallbackCommand: constant.CallbackUserOfflineCommand,
OperationID: operationID, OperationID: operationID,
UserID: userID, UserID: userID,
PlatformID: constant.PlatformNameToID(platform), PlatformID: int32(platformID),
Platform: platform, Platform: constant.PlatformIDToName(platformID),
}, },
Seq: time.Now().Nanosecond() / 1e6, Seq: time.Now().Nanosecond() / 1e6,
} }

View File

@ -19,19 +19,12 @@ import (
) )
func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) { func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
//ws online debug data
//{"ReqIdentifier":1001,"Token":"123","SendID":"c4ca4238a0b923820dcc509a6f75849b","Time":"123","OperationID":"123","MsgIncr":0}
//{"ReqIdentifier":1002,"Token":"123","SendID":"c4ca4238a0b923820dcc509a6f75849b","Time":"123","OperationID":"123","MsgIncr":0,"SeqBegin":1,"SeqEnd":6}
//{"ReqIdentifier":1003,"Token":"123","SendID":"c4ca4238a0b923820dcc509a6f75849b",
//"RecvID":"a87ff679a2f3e71d9181a67b7542122c","ClientMsgID":"2343","Time":"147878787","OperationID":
//"123","MsgIncr":0,"SubMsgType":101,"MsgType":100,"MsgFrom":1,"Content":"sdfsdf"}
b := bytes.NewBuffer(binaryMsg) b := bytes.NewBuffer(binaryMsg)
m := Req{} m := Req{}
dec := gob.NewDecoder(b) dec := gob.NewDecoder(b)
err := dec.Decode(&m) err := dec.Decode(&m)
if err != nil { if err != nil {
log.NewError("", "ws Decode err", err.Error()) log.NewError("", "ws Decode err", err.Error())
ws.sendErrMsg(conn, 200, err.Error(), constant.WSDataError, "", "")
err = conn.Close() err = conn.Close()
if err != nil { if err != nil {
log.NewError("", "ws close err", err.Error()) log.NewError("", "ws close err", err.Error())
@ -43,49 +36,69 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
ws.sendErrMsg(conn, 201, err.Error(), m.ReqIdentifier, m.MsgIncr, m.OperationID) ws.sendErrMsg(conn, 201, err.Error(), m.ReqIdentifier, m.MsgIncr, m.OperationID)
return return
} }
//if !utils.VerifyToken(m.Token, m.SendID) { log.NewInfo(m.OperationID, "Basic Info Authentication Success", m.SendID, m.MsgIncr, m.ReqIdentifier)
// ws.sendErrMsg(conn, 202, "token validate err", m.ReqIdentifier, m.MsgIncr,m.OperationID)
// return
//}
log.NewInfo(m.OperationID, "Basic Info Authentication Success", m)
switch m.ReqIdentifier { switch m.ReqIdentifier {
case constant.WSGetNewestSeq: case constant.WSGetNewestSeq:
log.NewInfo(m.OperationID, "getSeqReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
ws.getSeqReq(conn, &m) ws.getSeqReq(conn, &m)
case constant.WSSendMsg: case constant.WSSendMsg:
log.NewInfo(m.OperationID, "sendMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
ws.sendMsgReq(conn, &m) ws.sendMsgReq(conn, &m)
case constant.WSSendSignalMsg: case constant.WSSendSignalMsg:
log.NewInfo(m.OperationID, "sendSignalMsgReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
ws.sendSignalMsgReq(conn, &m) ws.sendSignalMsgReq(conn, &m)
case constant.WSPullMsgBySeqList: case constant.WSPullMsgBySeqList:
log.NewInfo(m.OperationID, "pullMsgBySeqListReq ", m.SendID, m.MsgIncr, m.ReqIdentifier)
ws.pullMsgBySeqListReq(conn, &m) ws.pullMsgBySeqListReq(conn, &m)
default: default:
log.Error(m.OperationID, "ReqIdentifier failed ", m.SendID, m.MsgIncr, m.ReqIdentifier)
} }
log.NewInfo(m.OperationID, "goroutine num is ", runtime.NumGoroutine()) log.NewInfo(m.OperationID, "goroutine num is ", runtime.NumGoroutine())
} }
func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { func (ws *WServer) getSeqReq(conn *UserConn, m *Req) {
log.NewInfo(m.OperationID, "Ws call success to getNewSeq", m.MsgIncr, m.SendID, m.ReqIdentifier, m.Data) log.NewInfo(m.OperationID, "Ws call success to getNewSeq", m.MsgIncr, m.SendID, m.ReqIdentifier)
rpcReq := pbChat.GetMaxAndMinSeqReq{} nReply := new(sdk_ws.GetMaxAndMinSeqResp)
nReply := new(pbChat.GetMaxAndMinSeqResp) isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSGetNewestSeq, m.OperationID)
log.Info(m.OperationID, "argsValidate ", isPass, errCode, errMsg)
if isPass {
rpcReq := sdk_ws.GetMaxAndMinSeqReq{}
rpcReq.GroupIDList = data.(sdk_ws.GetMaxAndMinSeqReq).GroupIDList
rpcReq.UserID = m.SendID rpcReq.UserID = m.SendID
rpcReq.OperationID = m.OperationID rpcReq.OperationID = m.OperationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) log.Debug(m.OperationID, "Ws call success to getMaxAndMinSeq", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.GetMaxAndMinSeqReq).GroupIDList)
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, rpcReq.OperationID)
if grpcConn == nil {
errMsg := rpcReq.OperationID + "getcdv3.GetConn == nil"
nReply.ErrCode = 500
nReply.ErrMsg = errMsg
log.NewError(rpcReq.OperationID, errMsg)
ws.getSeqResp(conn, m, nReply)
return
}
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
rpcReply, err := msgClient.GetMaxAndMinSeq(context.Background(), &rpcReq) rpcReply, err := msgClient.GetMaxAndMinSeq(context.Background(), &rpcReq)
if err != nil { if err != nil {
log.Error(rpcReq.OperationID, "rpc call failed to getSeqReq", err, rpcReq.String())
nReply.ErrCode = 500 nReply.ErrCode = 500
nReply.ErrMsg = err.Error() nReply.ErrMsg = err.Error()
log.Error(rpcReq.OperationID, "rpc call failed to GetMaxAndMinSeq ", nReply.String())
ws.getSeqResp(conn, m, nReply) ws.getSeqResp(conn, m, nReply)
} else { } else {
log.NewInfo(rpcReq.OperationID, "rpc call success to getSeqReq", rpcReply.String()) log.NewInfo(rpcReq.OperationID, "rpc call success to getSeqReq", rpcReply.String())
ws.getSeqResp(conn, m, rpcReply) ws.getSeqResp(conn, m, rpcReply)
} }
} else {
nReply.ErrCode = errCode
nReply.ErrMsg = errMsg
log.Error(m.OperationID, "argsValidate failed send resp: ", nReply.String())
ws.getSeqResp(conn, m, nReply)
} }
func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeqResp) { }
var mReplyData sdk_ws.GetMaxAndMinSeqResp
mReplyData.MaxSeq = pb.GetMaxSeq() func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *sdk_ws.GetMaxAndMinSeqResp) {
mReplyData.MinSeq = pb.GetMinSeq()
b, _ := proto.Marshal(&mReplyData) b, _ := proto.Marshal(pb)
mReply := Resp{ mReply := Resp{
ReqIdentifier: m.ReqIdentifier, ReqIdentifier: m.ReqIdentifier,
MsgIncr: m.MsgIncr, MsgIncr: m.MsgIncr,
@ -94,20 +107,31 @@ func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeq
OperationID: m.OperationID, OperationID: m.OperationID,
Data: b, Data: b,
} }
log.Debug(m.OperationID, "getSeqResp come here req: ", pb.String(), "send resp: ",
mReply.ReqIdentifier, mReply.MsgIncr, mReply.ErrCode, mReply.ErrMsg)
ws.sendMsg(conn, mReply) ws.sendMsg(conn, mReply)
} }
func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) {
log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr, m.Data) log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr, string(m.Data))
nReply := new(sdk_ws.PullMessageBySeqListResp) nReply := new(sdk_ws.PullMessageBySeqListResp)
isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList) isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList, m.OperationID)
if isPass { if isPass {
rpcReq := sdk_ws.PullMessageBySeqListReq{} rpcReq := sdk_ws.PullMessageBySeqListReq{}
rpcReq.SeqList = data.(sdk_ws.PullMessageBySeqListReq).SeqList rpcReq.SeqList = data.(sdk_ws.PullMessageBySeqListReq).SeqList
rpcReq.UserID = m.SendID rpcReq.UserID = m.SendID
rpcReq.OperationID = m.OperationID rpcReq.OperationID = m.OperationID
rpcReq.GroupSeqList = data.(sdk_ws.PullMessageBySeqListReq).GroupSeqList
log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.PullMessageBySeqListReq).SeqList) log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.PullMessageBySeqListReq).SeqList)
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, m.OperationID)
if grpcConn == nil {
errMsg := rpcReq.OperationID + "getcdv3.GetConn == nil"
nReply.ErrCode = 500
nReply.ErrMsg = errMsg
log.NewError(rpcReq.OperationID, errMsg)
ws.pullMsgBySeqListResp(conn, m, nReply)
return
}
msgClient := pbChat.NewChatClient(grpcConn) msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessageBySeqList(context.Background(), &rpcReq) reply, err := msgClient.PullMessageBySeqList(context.Background(), &rpcReq)
if err != nil { if err != nil {
@ -149,7 +173,7 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, m.Data) log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, m.Data)
nReply := new(pbChat.SendMsgResp) nReply := new(pbChat.SendMsgResp)
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg, m.OperationID)
if isPass { if isPass {
data := pData.(sdk_ws.MsgData) data := pData.(sdk_ws.MsgData)
pbData := pbChat.SendMsgReq{ pbData := pbChat.SendMsgReq{
@ -158,7 +182,15 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
MsgData: &data, MsgData: &data,
} }
log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data) log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, m.OperationID)
if etcdConn == nil {
errMsg := m.OperationID + "getcdv3.GetConn == nil"
nReply.ErrCode = 500
nReply.ErrMsg = errMsg
log.NewError(m.OperationID, errMsg)
ws.sendMsgResp(conn, m, nReply)
return
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
reply, err := client.SendMsg(context.Background(), &pbData) reply, err := client.SendMsg(context.Background(), &pbData)
if err != nil { if err != nil {
@ -179,8 +211,6 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
} }
func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) { func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) {
// := make(map[string]interface{})
var mReplyData sdk_ws.UserSendMsgResp var mReplyData sdk_ws.UserSendMsgResp
mReplyData.ClientMsgID = pb.GetClientMsgID() mReplyData.ClientMsgID = pb.GetClientMsgID()
mReplyData.ServerMsgID = pb.GetServerMsgID() mReplyData.ServerMsgID = pb.GetServerMsgID()
@ -198,12 +228,18 @@ func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) {
} }
func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) { func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) {
log.NewInfo(m.OperationID, "Ws call success to sendSignalMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, string(m.Data), m.Token) log.NewInfo(m.OperationID, "Ws call success to sendSignalMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, string(m.Data))
nReply := new(pbChat.SendMsgResp) nReply := new(pbChat.SendMsgResp)
isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendSignalMsg) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendSignalMsg, m.OperationID)
if isPass { if isPass {
signalResp := pbRtc.SignalResp{} signalResp := pbRtc.SignalResp{}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRealTimeCommName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRealTimeCommName, m.OperationID)
if etcdConn == nil {
errMsg := m.OperationID + "getcdv3.GetConn == nil"
log.NewError(m.OperationID, errMsg)
ws.sendSignalMsgResp(conn, 204, errMsg, m, &signalResp)
return
}
rtcClient := pbRtc.NewRtcServiceClient(etcdConn) rtcClient := pbRtc.NewRtcServiceClient(etcdConn)
req := &pbRtc.SignalMessageAssembleReq{ req := &pbRtc.SignalMessageAssembleReq{
SignalReq: pData.(*pbRtc.SignalReq), SignalReq: pData.(*pbRtc.SignalReq),
@ -226,8 +262,14 @@ func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) {
MsgData: &msgData, MsgData: &msgData,
} }
log.NewInfo(m.OperationID, utils.GetSelfFuncName(), "pbData: ", pbData) log.NewInfo(m.OperationID, utils.GetSelfFuncName(), "pbData: ", pbData)
log.NewInfo(m.OperationID, "Ws call success to sendSignalMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, "session Type", msgData.SessionType) log.NewInfo(m.OperationID, "Ws call success to sendSignalMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, msgData)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, m.OperationID)
if etcdConn == nil {
errMsg := m.OperationID + "getcdv3.GetConn == nil"
log.NewError(m.OperationID, errMsg)
ws.sendSignalMsgResp(conn, 200, errMsg, m, &signalResp)
return
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
reply, err := client.SendMsg(context.Background(), &pbData) reply, err := client.SendMsg(context.Background(), &pbData)
if err != nil { if err != nil {
@ -250,7 +292,7 @@ func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) {
} }
func (ws *WServer) sendSignalMsgResp(conn *UserConn, errCode int32, errMsg string, m *Req, pb *pbRtc.SignalResp) { func (ws *WServer) sendSignalMsgResp(conn *UserConn, errCode int32, errMsg string, m *Req, pb *pbRtc.SignalResp) {
// := make(map[string]interface{}) // := make(map[string]interface{})
log.Debug(m.OperationID, "SignalMsgResp is", pb.String()) log.Debug(m.OperationID, "sendSignalMsgResp is", pb.String())
b, _ := proto.Marshal(pb) b, _ := proto.Marshal(pb)
mReply := Resp{ mReply := Resp{
ReqIdentifier: m.ReqIdentifier, ReqIdentifier: m.ReqIdentifier,
@ -267,14 +309,16 @@ func (ws *WServer) sendMsg(conn *UserConn, mReply interface{}) {
enc := gob.NewEncoder(&b) enc := gob.NewEncoder(&b)
err := enc.Encode(mReply) err := enc.Encode(mReply)
if err != nil { if err != nil {
uid, platform := ws.getUserUid(conn) // uid, platform := ws.getUserUid(conn)
log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), uid, platform, err.Error()) log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), err.Error())
return return
} }
err = ws.writeMsg(conn, websocket.BinaryMessage, b.Bytes()) err = ws.writeMsg(conn, websocket.BinaryMessage, b.Bytes())
if err != nil { if err != nil {
uid, platform := ws.getUserUid(conn) // uid, platform := ws.getUserUid(conn)
log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "WS WriteMsg error", conn.RemoteAddr().String(), uid, platform, err.Error()) log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "ws writeMsg error", conn.RemoteAddr().String(), err.Error())
} else {
log.Debug(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "ws write response success")
} }
} }
func (ws *WServer) sendErrMsg(conn *UserConn, errCode int32, errMsg string, reqIdentifier int32, msgIncr string, operationID string) { func (ws *WServer) sendErrMsg(conn *UserConn, errCode int32, errMsg string, reqIdentifier int32, msgIncr string, operationID string) {

View File

@ -7,6 +7,7 @@ import (
"Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbRelay "Open_IM/pkg/proto/relay" pbRelay "Open_IM/pkg/proto/relay"
sdk_ws "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"bytes" "bytes"
"context" "context"
@ -25,6 +26,8 @@ type RPCServer struct {
rpcRegisterName string rpcRegisterName string
etcdSchema string etcdSchema string
etcdAddr []string etcdAddr []string
platformList []int
pushTerminal []int
} }
func (r *RPCServer) onInit(rpcPort int) { func (r *RPCServer) onInit(rpcPort int) {
@ -32,6 +35,8 @@ func (r *RPCServer) onInit(rpcPort int) {
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImOnlineMessageRelayName r.rpcRegisterName = config.Config.RpcRegisterName.OpenImOnlineMessageRelayName
r.etcdSchema = config.Config.Etcd.EtcdSchema r.etcdSchema = config.Config.Etcd.EtcdSchema
r.etcdAddr = config.Config.Etcd.EtcdAddr r.etcdAddr = config.Config.Etcd.EtcdAddr
r.platformList = genPlatformArray()
r.pushTerminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID}
} }
func (r *RPCServer) run() { func (r *RPCServer) run() {
listenIP := "" listenIP := ""
@ -69,7 +74,7 @@ func (r *RPCServer) run() {
} }
func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgReq) (*pbRelay.OnlinePushMsgResp, error) { func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgReq) (*pbRelay.OnlinePushMsgResp, error) {
log.NewInfo(in.OperationID, "PushMsgToUser is arriving", in.String()) log.NewInfo(in.OperationID, "PushMsgToUser is arriving", in.String())
var resp []*pbRelay.SingleMsgToUser var resp []*pbRelay.SingleMsgToUserPlatform
msgBytes, _ := proto.Marshal(in.MsgData) msgBytes, _ := proto.Marshal(in.MsgData)
mReply := Resp{ mReply := Resp{
ReqIdentifier: constant.WSPushMsg, ReqIdentifier: constant.WSPushMsg,
@ -84,22 +89,21 @@ func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgRe
} }
var tag bool var tag bool
recvID := in.PushToUserID recvID := in.PushToUserID
platformList := genPlatformArray() for _, v := range r.platformList {
for _, v := range platformList {
if conn := ws.getUserConn(recvID, v); conn != nil { if conn := ws.getUserConn(recvID, v); conn != nil {
tag = true tag = true
resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, v, recvID) resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, v, recvID)
temp := &pbRelay.SingleMsgToUser{ temp := &pbRelay.SingleMsgToUserPlatform{
ResultCode: resultCode, ResultCode: resultCode,
RecvID: recvID, RecvID: recvID,
RecvPlatFormID: constant.PlatformNameToID(v), RecvPlatFormID: int32(v),
} }
resp = append(resp, temp) resp = append(resp, temp)
} else { } else {
temp := &pbRelay.SingleMsgToUser{ temp := &pbRelay.SingleMsgToUserPlatform{
ResultCode: -1, ResultCode: -1,
RecvID: recvID, RecvID: recvID,
RecvPlatFormID: constant.PlatformNameToID(v), RecvPlatFormID: int32(v),
} }
resp = append(resp, temp) resp = append(resp, temp)
} }
@ -119,19 +123,19 @@ func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUser
} }
var resp pbRelay.GetUsersOnlineStatusResp var resp pbRelay.GetUsersOnlineStatusResp
for _, userID := range req.UserIDList { for _, userID := range req.UserIDList {
platformList := genPlatformArray()
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult) temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
temp.UserID = userID temp.UserID = userID
for _, platform := range platformList { userConnMap := ws.getUserAllCons(userID)
if conn := ws.getUserConn(userID, platform); conn != nil { for platform, userConn := range userConnMap {
if userConn != nil {
ps := new(pbRelay.GetUsersOnlineStatusResp_SuccessDetail) ps := new(pbRelay.GetUsersOnlineStatusResp_SuccessDetail)
ps.Platform = platform ps.Platform = constant.PlatformIDToName(platform)
ps.Status = constant.OnlineStatus ps.Status = constant.OnlineStatus
temp.Status = constant.OnlineStatus temp.Status = constant.OnlineStatus
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps) temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps)
}
}
}
}
if temp.Status == constant.OnlineStatus { if temp.Status == constant.OnlineStatus {
resp.SuccessResult = append(resp.SuccessResult, temp) resp.SuccessResult = append(resp.SuccessResult, temp)
} }
@ -139,11 +143,165 @@ func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUser
log.NewInfo(req.OperationID, "GetUsersOnlineStatus rpc return ", resp.String()) log.NewInfo(req.OperationID, "GetUsersOnlineStatus rpc return ", resp.String())
return &resp, nil return &resp, nil
} }
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, RecvPlatForm, RecvID string) (ResultCode int64) {
func (r *RPCServer) SuperGroupOnlineBatchPushOneMsg(_ context.Context, req *pbRelay.OnlineBatchPushOneMsgReq) (*pbRelay.OnlineBatchPushOneMsgResp, error) {
log.NewInfo(req.OperationID, "BatchPushMsgToUser is arriving", req.String())
var singleUserResult []*pbRelay.SingelMsgToUserResultList
//r.GetBatchMsgForPush(req.OperationID,req.MsgData,req.PushToUserIDList,)
msgBytes, _ := proto.Marshal(req.MsgData)
mReply := Resp{
ReqIdentifier: constant.WSPushMsg,
OperationID: req.OperationID,
Data: msgBytes,
}
var replyBytes bytes.Buffer
enc := gob.NewEncoder(&replyBytes)
err := enc.Encode(mReply)
if err != nil {
log.NewError(req.OperationID, "data encode err", err.Error())
}
for _, v := range req.PushToUserIDList {
var resp []*pbRelay.SingleMsgToUserPlatform
tempT := &pbRelay.SingelMsgToUserResultList{
UserID: v,
}
userConnMap := ws.getUserAllCons(v)
for platform, userConn := range userConnMap {
if userConn != nil {
resultCode := sendMsgBatchToUser(userConn, replyBytes.Bytes(), req, platform, v)
if resultCode == 0 && utils.IsContainInt(platform, r.pushTerminal) {
tempT.OnlinePush = true
log.Info(req.OperationID, "PushSuperMsgToUser is success By Ws", "args", req.String(), "recvPlatForm", constant.PlatformIDToName(platform), "recvID", v)
temp := &pbRelay.SingleMsgToUserPlatform{
ResultCode: resultCode,
RecvID: v,
RecvPlatFormID: int32(platform),
}
resp = append(resp, temp)
}
}
}
tempT.Resp = resp
singleUserResult = append(singleUserResult, tempT)
}
return &pbRelay.OnlineBatchPushOneMsgResp{
SinglePushResult: singleUserResult,
}, nil
}
func (r *RPCServer) OnlineBatchPushOneMsg(_ context.Context, req *pbRelay.OnlineBatchPushOneMsgReq) (*pbRelay.OnlineBatchPushOneMsgResp, error) {
log.NewInfo(req.OperationID, "BatchPushMsgToUser is arriving", req.String())
var singleUserResult []*pbRelay.SingelMsgToUserResultList
for _, v := range req.PushToUserIDList {
var resp []*pbRelay.SingleMsgToUserPlatform
tempT := &pbRelay.SingelMsgToUserResultList{
UserID: v,
}
userConnMap := ws.getUserAllCons(v)
var platformList []int
for k, _ := range userConnMap {
platformList = append(platformList, k)
}
log.Debug(req.OperationID, "GetSingleUserMsgForPushPlatforms begin", req.MsgData.Seq, v, platformList, req.MsgData.String())
needPushMapList := r.GetSingleUserMsgForPushPlatforms(req.OperationID, req.MsgData, v, platformList)
log.Debug(req.OperationID, "GetSingleUserMsgForPushPlatforms end", req.MsgData.Seq, v, platformList, len(needPushMapList))
for platform, list := range needPushMapList {
if list != nil {
log.Debug(req.OperationID, "needPushMapList ", "userID: ", v, "platform: ", platform, "push msg num:")
//for _, v := range list {
// log.Debug(req.OperationID, "req.MsgData.MsgDataList begin", "len: ", len(req.MsgData.MsgDataList), v.String())
// req.MsgData.MsgDataList = append(req.MsgData.MsgDataList, v)
// log.Debug(req.OperationID, "req.MsgData.MsgDataList end", "len: ", len(req.MsgData.MsgDataList))
//}
msgBytes, err := proto.Marshal(list)
if err != nil {
log.Error(req.OperationID, "proto marshal err", err.Error())
continue
}
req.MsgData.MsgDataList = msgBytes
//req.MsgData.MsgDataList = append(req.MsgData.MsgDataList, v)
log.Debug(req.OperationID, "r.encodeWsData no string")
//log.Debug(req.OperationID, "r.encodeWsData data0 list ", req.MsgData.MsgDataList[0].String())
log.Debug(req.OperationID, "r.encodeWsData ", req.MsgData.String())
replyBytes, err := r.encodeWsData(req.MsgData, req.OperationID)
if err != nil {
log.Error(req.OperationID, "encodeWsData failed ", req.MsgData.String())
continue
}
log.Debug(req.OperationID, "encodeWsData", "len: ", replyBytes.Len())
resultCode := sendMsgBatchToUser(userConnMap[platform], replyBytes.Bytes(), req, platform, v)
if resultCode == 0 && utils.IsContainInt(platform, r.pushTerminal) {
tempT.OnlinePush = true
log.Info(req.OperationID, "PushSuperMsgToUser is success By Ws", "args", req.String(), "recv PlatForm", constant.PlatformIDToName(platform), "recvID", v)
temp := &pbRelay.SingleMsgToUserPlatform{
ResultCode: resultCode,
RecvID: v,
RecvPlatFormID: int32(platform),
}
resp = append(resp, temp)
}
} else {
if utils.IsContainInt(platform, r.pushTerminal) {
tempT.OnlinePush = true
temp := &pbRelay.SingleMsgToUserPlatform{
ResultCode: 0,
RecvID: v,
RecvPlatFormID: int32(platform),
}
resp = append(resp, temp)
}
}
}
tempT.Resp = resp
singleUserResult = append(singleUserResult, tempT)
}
return &pbRelay.OnlineBatchPushOneMsgResp{
SinglePushResult: singleUserResult,
}, nil
}
func (r *RPCServer) encodeWsData(wsData *sdk_ws.MsgData, operationID string) (bytes.Buffer, error) {
log.Debug(operationID, "encodeWsData begin", wsData.String())
msgBytes, err := proto.Marshal(wsData)
if err != nil {
log.NewError(operationID, "Marshal", err.Error())
return bytes.Buffer{}, utils.Wrap(err, "")
}
log.Debug(operationID, "encodeWsData begin", wsData.String())
mReply := Resp{
ReqIdentifier: constant.WSPushMsg,
OperationID: operationID,
Data: msgBytes,
}
var replyBytes bytes.Buffer
enc := gob.NewEncoder(&replyBytes)
err = enc.Encode(mReply)
if err != nil {
log.NewError(operationID, "data encode err", err.Error())
return bytes.Buffer{}, utils.Wrap(err, "")
}
return replyBytes, nil
}
func (r *RPCServer) KickUserOffline(_ context.Context, req *pbRelay.KickUserOfflineReq) (*pbRelay.KickUserOfflineResp, error) {
log.NewInfo(req.OperationID, "KickUserOffline is arriving", req.String())
for _, v := range req.KickUserIDList {
oldConnMap := ws.getUserAllCons(v)
if conn, ok := oldConnMap[int(req.PlatformID)]; ok { // user->map[platform->conn]
ws.sendKickMsg(conn, &UserConn{})
}
}
return &pbRelay.KickUserOfflineResp{}, nil
}
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, RecvPlatForm int, 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.NewError(in.OperationID, "PushMsgToUser is failed By Ws", "Addr", conn.RemoteAddr().String(), log.NewError(in.OperationID, "PushMsgToUser is failed By Ws", "Addr", conn.RemoteAddr().String(),
"error", err, "senderPlatform", constant.PlatformIDToName(in.MsgData.SenderPlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID) "error", err, "senderPlatform", constant.PlatformIDToName(int(in.MsgData.SenderPlatformID)), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
ResultCode = -2 ResultCode = -2
return ResultCode return ResultCode
} else { } else {
@ -153,9 +311,23 @@ func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, Re
} }
} }
func genPlatformArray() (array []string) { func sendMsgBatchToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlineBatchPushOneMsgReq, RecvPlatForm int, RecvID string) (ResultCode int64) {
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
if err != nil {
log.NewError(in.OperationID, "PushMsgToUser is failed By Ws", "Addr", conn.RemoteAddr().String(),
"error", err, "senderPlatform", constant.PlatformIDToName(int(in.MsgData.SenderPlatformID)), "recv Platform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
ResultCode = -2
return ResultCode
} else {
log.NewDebug(in.OperationID, "PushMsgToUser is success By Ws", "args", in.String(), "recv PlatForm", RecvPlatForm, "recvID", RecvID)
ResultCode = 0
return ResultCode
}
}
func genPlatformArray() (array []int) {
for i := 1; i <= constant.LinuxPlatformID; i++ { for i := 1; i <= constant.LinuxPlatformID; i++ {
array = append(array, constant.PlatformIDToName(int32(i))) array = append(array, i)
} }
return array return array
} }

View File

@ -57,16 +57,28 @@ type SeqListData struct {
SeqList []int64 `mapstructure:"seqList" validate:"required"` SeqList []int64 `mapstructure:"seqList" validate:"required"`
} }
func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, errMsg string, returnData interface{}) { func (ws *WServer) argsValidate(m *Req, r int32, operationID string) (isPass bool, errCode int32, errMsg string, returnData interface{}) {
switch r { switch r {
case constant.WSSendMsg: case constant.WSGetNewestSeq:
data := open_im_sdk.MsgData{} data := open_im_sdk.GetMaxAndMinSeqReq{}
if err := proto.Unmarshal(m.Data, &data); err != nil { if err := proto.Unmarshal(m.Data, &data); err != nil {
log.Error("", "Decode Data struct err", err.Error(), r) log.Error(operationID, "Decode Data struct err", err.Error(), r)
return false, 203, err.Error(), nil return false, 203, err.Error(), nil
} }
if err := validate.Struct(data); err != nil { if err := validate.Struct(data); err != nil {
log.Error("", "data args validate err", err.Error(), r) log.Error(operationID, "data args validate err", err.Error(), r)
return false, 204, err.Error(), nil
}
return true, 0, "", data
case constant.WSSendMsg:
data := open_im_sdk.MsgData{}
if err := proto.Unmarshal(m.Data, &data); err != nil {
log.Error(operationID, "Decode Data struct err", err.Error(), r)
return false, 203, err.Error(), nil
}
if err := validate.Struct(data); err != nil {
log.Error(operationID, "data args validate err", err.Error(), r)
return false, 204, err.Error(), nil return false, 204, err.Error(), nil
} }
@ -74,11 +86,11 @@ func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, er
case constant.WSSendSignalMsg: case constant.WSSendSignalMsg:
data := pbRtc.SignalReq{} data := pbRtc.SignalReq{}
if err := proto.Unmarshal(m.Data, &data); err != nil { if err := proto.Unmarshal(m.Data, &data); err != nil {
log.Error("", "Decode Data struct err", err.Error(), r) log.Error(operationID, "Decode Data struct err", err.Error(), r)
return false, 203, err.Error(), nil return false, 203, err.Error(), nil
} }
if err := validate.Struct(data); err != nil { if err := validate.Struct(data); err != nil {
log.Error("", "data args validate err", err.Error(), r) log.Error(operationID, "data args validate err", err.Error(), r)
return false, 204, err.Error(), nil return false, 204, err.Error(), nil
} }
@ -86,31 +98,16 @@ func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, er
case constant.WSPullMsgBySeqList: case constant.WSPullMsgBySeqList:
data := open_im_sdk.PullMessageBySeqListReq{} data := open_im_sdk.PullMessageBySeqListReq{}
if err := proto.Unmarshal(m.Data, &data); err != nil { if err := proto.Unmarshal(m.Data, &data); err != nil {
log.Error("", "Decode Data struct err", err.Error(), r) log.Error(operationID, "Decode Data struct err", err.Error(), r)
return false, 203, err.Error(), nil return false, 203, err.Error(), nil
} }
if err := validate.Struct(data); err != nil { if err := validate.Struct(data); err != nil {
log.Error("", "data args validate err", err.Error(), r) log.Error(operationID, "data args validate err", err.Error(), r)
return false, 204, err.Error(), nil return false, 204, err.Error(), nil
} }
return true, 0, "", data return true, 0, "", data
default: default:
} }
return false, 204, "args err", nil return false, 204, "args err", nil
//b := bytes.NewBuffer(m.Data)
//dec := gob.NewDecoder(b)
//err := dec.Decode(&data)
//if err != nil {
// log.ErrorByKv("Decode Data struct err", "", "err", err.Error(), "reqIdentifier", r)
// return false, 203, err.Error(), nil
//}
//if err := mapstructure.WeakDecode(m.Data, &data); err != nil {
// log.ErrorByKv("map to Data struct err", "", "err", err.Error(), "reqIdentifier", r)
// return false, 203, err.Error(), nil
//} else
} }

View File

@ -9,7 +9,7 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"bytes" "bytes"
"encoding/gob" "encoding/gob"
"github.com/garyburd/redigo/redis" go_redis "github.com/go-redis/redis/v8"
"net/http" "net/http"
"sync" "sync"
"time" "time"
@ -20,20 +20,21 @@ import (
type UserConn struct { type UserConn struct {
*websocket.Conn *websocket.Conn
w *sync.Mutex w *sync.Mutex
PushedMaxSeq uint32
} }
type WServer struct { type WServer struct {
wsAddr string wsAddr string
wsMaxConnNum int wsMaxConnNum int
wsUpGrader *websocket.Upgrader wsUpGrader *websocket.Upgrader
wsConnToUser map[*UserConn]map[string]string wsConnToUser map[*UserConn]map[int]string
wsUserToConn map[string]map[string]*UserConn wsUserToConn map[string]map[int]*UserConn
} }
func (ws *WServer) onInit(wsPort int) { func (ws *WServer) onInit(wsPort int) {
ws.wsAddr = ":" + utils.IntToString(wsPort) ws.wsAddr = ":" + utils.IntToString(wsPort)
ws.wsMaxConnNum = config.Config.LongConnSvr.WebsocketMaxConnNum ws.wsMaxConnNum = config.Config.LongConnSvr.WebsocketMaxConnNum
ws.wsConnToUser = make(map[*UserConn]map[string]string) ws.wsConnToUser = make(map[*UserConn]map[int]string)
ws.wsUserToConn = make(map[string]map[string]*UserConn) ws.wsUserToConn = make(map[string]map[int]*UserConn)
ws.wsUpGrader = &websocket.Upgrader{ ws.wsUpGrader = &websocket.Upgrader{
HandshakeTimeout: time.Duration(config.Config.LongConnSvr.WebsocketTimeOut) * time.Second, HandshakeTimeout: time.Duration(config.Config.LongConnSvr.WebsocketTimeOut) * time.Second,
ReadBufferSize: config.Config.LongConnSvr.WebsocketMaxMsgLen, ReadBufferSize: config.Config.LongConnSvr.WebsocketMaxMsgLen,
@ -50,21 +51,27 @@ func (ws *WServer) run() {
} }
func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) { func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
if ws.headerCheck(w, r) {
query := r.URL.Query() query := r.URL.Query()
operationID := ""
if len(query["operationID"]) != 0 {
operationID = query["operationID"][0]
} else {
operationID = utils.OperationIDGenerator()
}
log.Debug(operationID, utils.GetSelfFuncName(), " args: ", query)
if ws.headerCheck(w, r, operationID) {
conn, err := ws.wsUpGrader.Upgrade(w, r, nil) //Conn is obtained through the upgraded escalator conn, err := ws.wsUpGrader.Upgrade(w, r, nil) //Conn is obtained through the upgraded escalator
if err != nil { if err != nil {
log.Error("", "upgrade http conn err", err, query) log.Error(operationID, "upgrade http conn err", err.Error(), query)
return return
} else { } else {
//Connection mapping relationship, newConn := &UserConn{conn, new(sync.Mutex), 0}
//userID+" "+platformID->conn
//Initialize a lock for each user
newConn := &UserConn{conn, new(sync.Mutex)}
userCount++ userCount++
ws.addUserConn(query["sendID"][0], int32(utils.StringToInt64(query["platformID"][0])), newConn, query["token"][0]) ws.addUserConn(query["sendID"][0], utils.StringToInt(query["platformID"][0]), newConn, query["token"][0], operationID)
go ws.readMsg(newConn) go ws.readMsg(newConn)
} }
} else {
log.Error(operationID, "headerCheck failed ")
} }
} }
@ -75,18 +82,13 @@ func (ws *WServer) readMsg(conn *UserConn) {
log.NewInfo("", "this is a pingMessage") log.NewInfo("", "this is a pingMessage")
} }
if err != nil { if err != nil {
uid, platform := ws.getUserUid(conn) log.Error("", "WS ReadMsg error ", " userIP", conn.RemoteAddr().String(), "userUid", "platform", "error", err.Error())
log.Error("", "WS ReadMsg error", "userIP", conn.RemoteAddr().String(), "userUid", uid, "platform", platform, "error", err.Error())
userCount-- userCount--
ws.delUserConn(conn) ws.delUserConn(conn)
return return
} else {
//log.ErrorByKv("test", "", "msgType", msgType, "userIP", conn.RemoteAddr().String(), "userUid", ws.getUserUid(conn))
} }
ws.msgParse(conn, msg) ws.msgParse(conn, msg)
//ws.writeMsg(conn, 1, chat)
} }
} }
func (ws *WServer) SetWriteTimeout(conn *UserConn, timeout int) { func (ws *WServer) SetWriteTimeout(conn *UserConn, timeout int) {
@ -108,37 +110,37 @@ func (ws *WServer) SetWriteTimeoutWriteMsg(conn *UserConn, a int, msg []byte, ti
conn.SetWriteDeadline(time.Now().Add(time.Duration(timeout) * time.Second)) conn.SetWriteDeadline(time.Now().Add(time.Duration(timeout) * time.Second))
return conn.WriteMessage(a, msg) return conn.WriteMessage(a, msg)
} }
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn *UserConn, token string, operationID string) {
func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newConn *UserConn, token string, operationID string) {
switch config.Config.MultiLoginPolicy { switch config.Config.MultiLoginPolicy {
case constant.AllLoginButSameTermKick: case constant.AllLoginButSameTermKick:
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn] if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
if oldConn, ok := oldConnMap[constant.PlatformIDToName(platformID)]; ok { if oldConn, ok := oldConnMap[platformID]; ok {
log.NewWarn(operationID, uid, platformID, "kick old conn begin") log.NewDebug(operationID, uid, platformID, "kick old conn")
// ws.sendKickMsg(oldConn, newConn) // ws.sendKickMsg(oldConn, newConn)
log.NewWarn(operationID, uid, platformID, "kick old conn end")
m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID)) m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID))
if err != nil && err != redis.ErrNil { if err != nil && err != go_redis.Nil {
log.NewError(operationID, "get token from redis err", err.Error(), uid) log.NewError(operationID, "get token from redis err", err.Error(), uid, constant.PlatformIDToName(platformID))
return return
} }
if m == nil { if m == nil {
log.NewError(operationID, "get token from redis err", "m is nil") log.NewError(operationID, "get token from redis err", "m is nil", uid, constant.PlatformIDToName(platformID))
return return
} }
log.NewDebug(operationID, "get token map is ", m, uid, constant.PlatformIDToName(platformID))
for k, _ := range m { for k, _ := range m {
if k != token { if k != token {
m[k] = constant.KickedToken m[k] = constant.KickedToken
} }
} }
log.NewDebug(operationID, "get map is ", m) log.NewDebug(operationID, "set token map is ", m, uid, constant.PlatformIDToName(platformID))
err = db.DB.SetTokenMapByUidPid(uid, platformID, m) err = db.DB.SetTokenMapByUidPid(uid, platformID, m)
if err != nil { if err != nil {
log.NewError(operationID, "SetTokenMapByUidPid err", err.Error()) log.NewError(operationID, "SetTokenMapByUidPid err", err.Error(), uid, platformID, m)
return return
} }
err = oldConn.Close() err = oldConn.Close()
delete(oldConnMap, constant.PlatformIDToName(platformID)) delete(oldConnMap, platformID)
ws.wsUserToConn[uid] = oldConnMap ws.wsUserToConn[uid] = oldConnMap
if len(oldConnMap) == 0 { if len(oldConnMap) == 0 {
delete(ws.wsUserToConn, uid) delete(ws.wsUserToConn, uid)
@ -147,9 +149,8 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newCo
if err != nil { if err != nil {
log.NewError(operationID, "conn close err", err.Error(), uid, platformID) log.NewError(operationID, "conn close err", err.Error(), uid, platformID)
} }
} else { } else {
log.NewWarn(operationID, "abnormal uid-conn ", uid, platformID, oldConnMap[constant.PlatformIDToName(platformID)]) log.NewWarn(operationID, "abnormal uid-conn ", uid, platformID, oldConnMap[platformID])
} }
} else { } else {
@ -173,37 +174,37 @@ func (ws *WServer) sendKickMsg(oldConn, newConn *UserConn) {
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "Encode Msg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error()) log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "Encode Msg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
return return
} }
// ws.SetWriteTimeout(oldConn, 5)
err = ws.writeMsg(oldConn, websocket.BinaryMessage, b.Bytes()) err = ws.writeMsg(oldConn, websocket.BinaryMessage, b.Bytes())
if err != nil { if err != nil {
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "sendKickMsg WS WriteMsg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error()) log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "sendKickMsg WS WriteMsg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
} }
} }
func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) {
func (ws *WServer) addUserConn(uid string, platformID int, conn *UserConn, token string, operationID string) {
rwLock.Lock() rwLock.Lock()
defer rwLock.Unlock() defer rwLock.Unlock()
operationID := utils.OperationIDGenerator() log.Info(operationID, utils.GetSelfFuncName(), " args: ", uid, platformID, conn, token)
callbackResp := callbackUserOnline(operationID, uid, platformID, token) callbackResp := callbackUserOnline(operationID, uid, platformID, token)
if callbackResp.ErrCode != 0 { if callbackResp.ErrCode != 0 {
log.NewError(operationID, utils.GetSelfFuncName(), "callbackUserOnline resp:", callbackResp) log.NewError(operationID, utils.GetSelfFuncName(), "callbackUserOnline resp:", callbackResp)
} }
ws.MultiTerminalLoginChecker(uid, platformID, conn, token, operationID) ws.MultiTerminalLoginChecker(uid, platformID, conn, token, operationID)
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { if oldConnMap, ok := ws.wsUserToConn[uid]; ok {
oldConnMap[constant.PlatformIDToName(platformID)] = conn oldConnMap[platformID] = conn
ws.wsUserToConn[uid] = oldConnMap ws.wsUserToConn[uid] = oldConnMap
log.Debug(operationID, "user not first come in, add conn ", uid, platformID, conn, oldConnMap) log.Debug(operationID, "user not first come in, add conn ", uid, platformID, conn, oldConnMap)
} else { } else {
i := make(map[string]*UserConn) i := make(map[int]*UserConn)
i[constant.PlatformIDToName(platformID)] = conn i[platformID] = conn
ws.wsUserToConn[uid] = i ws.wsUserToConn[uid] = i
log.Debug(operationID, "user first come in, new user, conn", uid, platformID, conn, ws.wsUserToConn[uid]) log.Debug(operationID, "user first come in, new user, conn", uid, platformID, conn, ws.wsUserToConn[uid])
} }
if oldStringMap, ok := ws.wsConnToUser[conn]; ok { if oldStringMap, ok := ws.wsConnToUser[conn]; ok {
oldStringMap[constant.PlatformIDToName(platformID)] = uid oldStringMap[platformID] = uid
ws.wsConnToUser[conn] = oldStringMap ws.wsConnToUser[conn] = oldStringMap
} else { } else {
i := make(map[string]string) i := make(map[int]string)
i[constant.PlatformIDToName(platformID)] = uid i[platformID] = uid
ws.wsConnToUser[conn] = i ws.wsConnToUser[conn] = i
} }
count := 0 count := 0
@ -217,7 +218,8 @@ func (ws *WServer) delUserConn(conn *UserConn) {
rwLock.Lock() rwLock.Lock()
defer rwLock.Unlock() defer rwLock.Unlock()
operationID := utils.OperationIDGenerator() operationID := utils.OperationIDGenerator()
var platform, uid string var uid string
var platform int
if oldStringMap, ok := ws.wsConnToUser[conn]; ok { if oldStringMap, ok := ws.wsConnToUser[conn]; ok {
for k, v := range oldStringMap { for k, v := range oldStringMap {
platform = k platform = k
@ -250,7 +252,7 @@ func (ws *WServer) delUserConn(conn *UserConn) {
} }
} }
func (ws *WServer) getUserConn(uid string, platform string) *UserConn { func (ws *WServer) getUserConn(uid string, platform int) *UserConn {
rwLock.RLock() rwLock.RLock()
defer rwLock.RUnlock() defer rwLock.RUnlock()
if connMap, ok := ws.wsUserToConn[uid]; ok { if connMap, ok := ws.wsUserToConn[uid]; ok {
@ -260,7 +262,7 @@ func (ws *WServer) getUserConn(uid string, platform string) *UserConn {
} }
return nil return nil
} }
func (ws *WServer) getSingleUserAllConn(uid string) map[string]*UserConn { func (ws *WServer) getUserAllCons(uid string) map[int]*UserConn {
rwLock.RLock() rwLock.RLock()
defer rwLock.RUnlock() defer rwLock.RUnlock()
if connMap, ok := ws.wsUserToConn[uid]; ok { if connMap, ok := ws.wsUserToConn[uid]; ok {
@ -268,46 +270,40 @@ func (ws *WServer) getSingleUserAllConn(uid string) map[string]*UserConn {
} }
return nil return nil
} }
func (ws *WServer) getUserUid(conn *UserConn) (uid, platform string) {
rwLock.RLock()
defer rwLock.RUnlock()
if stringMap, ok := ws.wsConnToUser[conn]; ok { //func (ws *WServer) getUserUid(conn *UserConn) (uid string, platform int) {
for k, v := range stringMap { // rwLock.RLock()
platform = k // defer rwLock.RUnlock()
uid = v //
} // if stringMap, ok := ws.wsConnToUser[conn]; ok {
return uid, platform // for k, v := range stringMap {
} // platform = k
return "", "" // uid = v
} // }
func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool { // return uid, platform
// }
// return "", 0
//}
func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request, operationID string) bool {
status := http.StatusUnauthorized status := http.StatusUnauthorized
query := r.URL.Query() query := r.URL.Query()
operationID := ""
if len(query["operationID"]) != 0 {
operationID = query["operationID"][0]
}
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 ok, err, msg := token_verify.WsVerifyToken(query["token"][0], query["sendID"][0], query["platformID"][0], operationID); !ok { if ok, err, msg := token_verify.WsVerifyToken(query["token"][0], query["sendID"][0], query["platformID"][0], operationID); !ok {
// e := err.(*constant.ErrInfo)
log.Error(operationID, "Token verify failed ", "query ", query, msg, err.Error()) log.Error(operationID, "Token verify failed ", "query ", query, msg, err.Error())
w.Header().Set("Sec-Websocket-Version", "13") w.Header().Set("Sec-Websocket-Version", "13")
w.Header().Set("ws_err_msg", err.Error()) w.Header().Set("ws_err_msg", err.Error())
http.Error(w, err.Error(), status) http.Error(w, err.Error(), status)
return false return false
} else { } else {
log.Info(operationID, "Connection Authentication Success", "", "token", query["token"][0], "userID", query["sendID"][0]) log.Info(operationID, "Connection Authentication Success", "", "token ", query["token"][0], "userID ", query["sendID"][0], "platformID ", query["platformID"][0])
return true return true
} }
} else { } else {
log.Error(operationID, "Args err ", "query ", query) log.Error(operationID, "Args err ", "query ", query)
w.Header().Set("Sec-Websocket-Version", "13") w.Header().Set("Sec-Websocket-Version", "13")
w.Header().Set("ws_err_msg", "args err, need token, sendID, platformID") errMsg := "args err, need token, sendID, platformID"
http.Error(w, http.StatusText(status), status) w.Header().Set("ws_err_msg", errMsg)
http.Error(w, errMsg, status)
return false return false
} }
} }
func genMapKey(uid string, platformID int32) string {
return uid + " " + constant.PlatformIDToName(platformID)
}

View File

@ -4,7 +4,6 @@ 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/kafka" "Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log"
"Open_IM/pkg/statistics" "Open_IM/pkg/statistics"
"fmt" "fmt"
"sync" "sync"
@ -14,15 +13,16 @@ const OnlineTopicBusy = 1
const OnlineTopicVacancy = 0 const OnlineTopicVacancy = 0
const Msg = 2 const Msg = 2
const ConsumerMsgs = 3 const ConsumerMsgs = 3
const UserMessages = 4 const AggregationMessages = 4
const MongoMessages = 5 const MongoMessages = 5
const ChannelNum = 100 const ChannelNum = 100
var ( var (
persistentCH PersistentConsumerHandler persistentCH PersistentConsumerHandler
historyCH OnlineHistoryConsumerHandler historyCH OnlineHistoryRedisConsumerHandler
offlineHistoryCH OfflineHistoryConsumerHandler historyMongoCH OnlineHistoryMongoConsumerHandler
producer *kafka.Producer producer *kafka.Producer
producerToMongo *kafka.Producer
cmdCh chan Cmd2Value cmdCh chan Cmd2Value
onlineTopicStatus int onlineTopicStatus int
w *sync.Mutex w *sync.Mutex
@ -38,12 +38,13 @@ func Init() {
w = new(sync.Mutex) w = new(sync.Mutex)
persistentCH.Init() persistentCH.Init()
historyCH.Init(cmdCh) historyCH.Init(cmdCh)
historyMongoCH.Init()
onlineTopicStatus = OnlineTopicVacancy onlineTopicStatus = OnlineTopicVacancy
log.Debug("come msg transfer ts", config.Config.Kafka.ConsumerGroupID.MsgToMongoOffline, config.Config.Kafka.Ws2mschatOffline.Topic)
//offlineHistoryCH.Init(cmdCh) //offlineHistoryCH.Init(cmdCh)
statistics.NewStatistics(&singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval) statistics.NewStatistics(&singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
statistics.NewStatistics(&groupMsgCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second groupMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval) statistics.NewStatistics(&groupMsgCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second groupMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ms2pschat.Addr, config.Config.Kafka.Ms2pschat.Topic) producer = kafka.NewKafkaProducer(config.Config.Kafka.Ms2pschat.Addr, config.Config.Kafka.Ms2pschat.Topic)
producerToMongo = kafka.NewKafkaProducer(config.Config.Kafka.MsgToMongo.Addr, config.Config.Kafka.MsgToMongo.Topic)
} }
func Run() { func Run() {
//register mysqlConsumerHandler to //register mysqlConsumerHandler to
@ -53,6 +54,7 @@ func Run() {
fmt.Println("not start mysql consumer") fmt.Println("not start mysql consumer")
} }
go historyCH.historyConsumerGroup.RegisterHandleAndConsumer(&historyCH) go historyCH.historyConsumerGroup.RegisterHandleAndConsumer(&historyCH)
go historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(&historyMongoCH)
//go offlineHistoryCH.historyConsumerGroup.RegisterHandleAndConsumer(&offlineHistoryCH) //go offlineHistoryCH.historyConsumerGroup.RegisterHandleAndConsumer(&offlineHistoryCH)
} }
func SetOnlineTopicStatus(status int) { func SetOnlineTopicStatus(status int) {

View File

@ -1,313 +0,0 @@
package logic
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
kfk "Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log"
pbMsg "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils"
"github.com/Shopify/sarama"
"github.com/golang/protobuf/proto"
"time"
)
type OfflineHistoryConsumerHandler struct {
msgHandle map[string]fcb
historyConsumerGroup *kfk.MConsumerGroup
cmdCh chan Cmd2Value
msgCh chan Cmd2Value
chArrays [ChannelNum]chan Cmd2Value
msgDistributionCh chan Cmd2Value
}
func (mc *OfflineHistoryConsumerHandler) Init(cmdCh chan Cmd2Value) {
mc.msgHandle = make(map[string]fcb)
mc.msgDistributionCh = make(chan Cmd2Value) //no buffer channel
go mc.MessagesDistributionHandle()
mc.cmdCh = cmdCh
mc.msgCh = make(chan Cmd2Value, 1000)
for i := 0; i < ChannelNum; i++ {
mc.chArrays[i] = make(chan Cmd2Value, 1000)
go mc.Run(i)
}
if config.Config.ReliableStorage {
mc.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = mc.handleChatWs2Mongo
} else {
mc.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = mc.handleChatWs2MongoLowReliability
}
mc.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschatOffline.Topic},
config.Config.Kafka.Ws2mschatOffline.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongoOffline)
}
func (och *OfflineHistoryConsumerHandler) Run(channelID int) {
for {
select {
case cmd := <-och.chArrays[channelID]:
switch cmd.Cmd {
case UserMessages:
msgChannelValue := cmd.Value.(MsgChannelValue)
msgList := msgChannelValue.msgList
triggerID := msgChannelValue.triggerID
storageMsgList := make([]*pbMsg.MsgDataToMQ, 0, 80)
pushMsgList := make([]*pbMsg.MsgDataToMQ, 0, 80)
log.Debug(triggerID, "msg arrived channel", "channel id", channelID, msgList, msgChannelValue.userID, len(msgList))
for _, v := range msgList {
log.Debug(triggerID, "msg come to storage center", v.String())
isHistory := utils.GetSwitchFromOptions(v.MsgData.Options, constant.IsHistory)
isSenderSync := utils.GetSwitchFromOptions(v.MsgData.Options, constant.IsSenderSync)
if isHistory {
storageMsgList = append(storageMsgList, v)
}
if !(!isSenderSync && msgChannelValue.userID == v.MsgData.SendID) {
pushMsgList = append(pushMsgList, v)
}
}
//switch msgChannelValue.msg.MsgData.SessionType {
//case constant.SingleChatType:
//case constant.GroupChatType:
//case constant.NotificationChatType:
//default:
// log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String())
// return
//}
err, _ := saveUserChatList(msgChannelValue.userID, storageMsgList, triggerID)
if err != nil {
singleMsgFailedCount += uint64(len(storageMsgList))
log.NewError(triggerID, "single data insert to mongo err", err.Error(), storageMsgList)
} else {
singleMsgSuccessCountMutex.Lock()
singleMsgSuccessCount += uint64(len(storageMsgList))
singleMsgSuccessCountMutex.Unlock()
for _, v := range pushMsgList {
sendMessageToPush(v, msgChannelValue.userID)
}
}
}
}
}
}
func (och *OfflineHistoryConsumerHandler) MessagesDistributionHandle() {
UserAggregationMsgs := make(map[string][]*pbMsg.MsgDataToMQ, ChannelNum)
for {
select {
case cmd := <-och.msgDistributionCh:
switch cmd.Cmd {
case ConsumerMsgs:
triggerChannelValue := cmd.Value.(TriggerChannelValue)
triggerID := triggerChannelValue.triggerID
consumerMessages := triggerChannelValue.cmsgList
//Aggregation map[userid]message list
log.Debug(triggerID, "batch messages come to distribution center", len(consumerMessages))
for i := 0; i < len(consumerMessages); i++ {
msgFromMQ := pbMsg.MsgDataToMQ{}
err := proto.Unmarshal(consumerMessages[i].Value, &msgFromMQ)
if err != nil {
log.Error(triggerID, "msg_transfer Unmarshal msg err", "msg", string(consumerMessages[i].Value), "err", err.Error())
return
}
log.Debug(triggerID, "single msg come to distribution center", msgFromMQ.String())
if oldM, ok := UserAggregationMsgs[string(consumerMessages[i].Key)]; ok {
oldM = append(oldM, &msgFromMQ)
UserAggregationMsgs[string(consumerMessages[i].Key)] = oldM
} else {
m := make([]*pbMsg.MsgDataToMQ, 0, 100)
m = append(m, &msgFromMQ)
UserAggregationMsgs[string(consumerMessages[i].Key)] = m
}
}
log.Debug(triggerID, "generate map list users len", len(UserAggregationMsgs))
for userID, v := range UserAggregationMsgs {
if len(v) >= 0 {
channelID := getHashCode(userID) % ChannelNum
go func(cID uint32, userID string, messages []*pbMsg.MsgDataToMQ) {
och.chArrays[cID] <- Cmd2Value{Cmd: UserMessages, Value: MsgChannelValue{userID: userID, msgList: messages, triggerID: triggerID}}
}(channelID, userID, v)
}
}
}
}
}
}
func (mc *OfflineHistoryConsumerHandler) handleChatWs2Mongo(cMsg *sarama.ConsumerMessage, msgKey string, sess sarama.ConsumerGroupSession) {
msg := cMsg.Value
now := time.Now()
msgFromMQ := pbMsg.MsgDataToMQ{}
err := proto.Unmarshal(msg, &msgFromMQ)
if err != nil {
log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
return
}
operationID := msgFromMQ.OperationID
log.NewInfo(operationID, "msg come mongo!!!", "", "msg", string(msg))
//Control whether to store offline messages (mongo)
isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory)
//Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
isSenderSync := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync)
switch msgFromMQ.MsgData.SessionType {
case constant.SingleChatType:
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist)
if isHistory {
err := saveUserChat(msgKey, &msgFromMQ)
if err != nil {
singleMsgFailedCount++
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
return
}
singleMsgSuccessCountMutex.Lock()
singleMsgSuccessCount++
singleMsgSuccessCountMutex.Unlock()
log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", time.Since(now))
}
if !isSenderSync && msgKey == msgFromMQ.MsgData.SendID {
} else {
go sendMessageToPush(&msgFromMQ, msgKey)
}
log.NewDebug(operationID, "saveSingleMsg cost time ", time.Since(now))
case constant.GroupChatType:
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist)
if isHistory {
err := saveUserChat(msgFromMQ.MsgData.RecvID, &msgFromMQ)
if err != nil {
log.NewError(operationID, "group data insert to mongo err", msgFromMQ.String(), msgFromMQ.MsgData.RecvID, err.Error())
return
}
groupMsgCount++
}
go sendMessageToPush(&msgFromMQ, msgFromMQ.MsgData.RecvID)
log.NewDebug(operationID, "saveGroupMsg cost time ", time.Since(now))
case constant.NotificationChatType:
log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = NotificationChatType", isHistory, isPersist)
if isHistory {
err := saveUserChat(msgKey, &msgFromMQ)
if err != nil {
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
return
}
log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", time.Since(now))
}
if !isSenderSync && msgKey == msgFromMQ.MsgData.SendID {
} else {
go sendMessageToPush(&msgFromMQ, msgKey)
}
log.NewDebug(operationID, "saveUserChat cost time ", time.Since(now))
default:
log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String())
return
}
sess.MarkMessage(cMsg, "")
log.NewDebug(msgFromMQ.OperationID, "msg_transfer handle topic data to database success...", msgFromMQ.String())
}
func (mc *OfflineHistoryConsumerHandler) handleChatWs2MongoLowReliability(cMsg *sarama.ConsumerMessage, msgKey string, sess sarama.ConsumerGroupSession) {
msg := cMsg.Value
msgFromMQ := pbMsg.MsgDataToMQ{}
err := proto.Unmarshal(msg, &msgFromMQ)
if err != nil {
log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
return
}
operationID := msgFromMQ.OperationID
log.NewInfo(operationID, "msg come mongo!!!", "", "msg", string(msg))
//Control whether to store offline messages (mongo)
isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory)
isSenderSync := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync)
if isHistory {
seq, err := db.DB.IncrUserSeq(msgKey)
if err != nil {
log.NewError(operationID, "data insert to redis err", err.Error(), string(msg))
return
}
sess.MarkMessage(cMsg, "")
msgFromMQ.MsgData.Seq = uint32(seq)
log.Debug(operationID, "send ch msg is ", msgFromMQ.String())
//mc.msgCh <- Cmd2Value{Cmd: Msg, Value: MsgChannelValue{msgKey, msgFromMQ}}
//err := saveUserChat(msgKey, &msgFromMQ)
//if err != nil {
// singleMsgFailedCount++
// log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String())
// return
//}
//singleMsgSuccessCountMutex.Lock()
//singleMsgSuccessCount++
//singleMsgSuccessCountMutex.Unlock()
//log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", time.Since(now))
} else {
if !(!isSenderSync && msgKey == msgFromMQ.MsgData.SendID) {
go sendMessageToPush(&msgFromMQ, msgKey)
}
}
}
func (OfflineHistoryConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
func (OfflineHistoryConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
//func (mc *OfflineHistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
// claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
// //log.NewDebug("", "offline new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
// //for msg := range claim.Messages() {
// // log.NewDebug("", "kafka get info to delay mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "offline")
// // //mc.msgHandle[msg.Topic](msg.Value, string(msg.Key))
// //}
// for msg := range claim.Messages() {
// if GetOnlineTopicStatus() == OnlineTopicVacancy {
// log.NewDebug("", "vacancy offline kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
// mc.msgHandle[msg.Topic](msg, string(msg.Key), sess)
// } else {
// select {
// case <-mc.cmdCh:
// log.NewDebug("", "cmd offline kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
// case <-time.After(time.Millisecond * time.Duration(100)):
// log.NewDebug("", "timeout offline kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
// }
// mc.msgHandle[msg.Topic](msg, string(msg.Key), sess)
// }
// }
//
// return nil
//}
func (och *OfflineHistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
cMsg := make([]*sarama.ConsumerMessage, 0, 500)
t := time.NewTicker(time.Duration(500) * time.Millisecond)
var triggerID string
for msg := range claim.Messages() {
//och.TriggerCmd(OnlineTopicBusy)
cMsg = append(cMsg, msg)
select {
case <-t.C:
if len(cMsg) >= 0 {
triggerID = utils.OperationIDGenerator()
log.Debug(triggerID, "timer trigger msg consumer start", len(cMsg))
och.msgDistributionCh <- Cmd2Value{Cmd: ConsumerMsgs, Value: TriggerChannelValue{
triggerID: triggerID, cmsgList: cMsg}}
sess.MarkMessage(msg, "")
cMsg = cMsg[0:0]
log.Debug(triggerID, "timer trigger msg consumer end", len(cMsg))
}
default:
if len(cMsg) >= 500 {
triggerID = utils.OperationIDGenerator()
log.Debug(triggerID, "length trigger msg consumer start", len(cMsg))
och.msgDistributionCh <- Cmd2Value{Cmd: ConsumerMsgs, Value: TriggerChannelValue{
triggerID: triggerID, cmsgList: cMsg}}
sess.MarkMessage(msg, "")
cMsg = cMsg[0:0]
log.Debug(triggerID, "length trigger msg consumer end", len(cMsg))
}
}
log.NewDebug("", "online kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "online", msg.Offset, claim.HighWaterMarkOffset())
}
return nil
}

View File

@ -9,10 +9,8 @@ import (
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbMsg "Open_IM/pkg/proto/chat" pbMsg "Open_IM/pkg/proto/chat"
pbPush "Open_IM/pkg/proto/push" pbPush "Open_IM/pkg/proto/push"
server_api_params "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"errors"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"hash/crc32" "hash/crc32"
@ -22,7 +20,7 @@ import (
) )
type MsgChannelValue struct { type MsgChannelValue struct {
userID string aggregationID string //maybe userID or super groupID
triggerID string triggerID string
msgList []*pbMsg.MsgDataToMQ msgList []*pbMsg.MsgDataToMQ
lastSeq uint64 lastSeq uint64
@ -36,28 +34,21 @@ type Cmd2Value struct {
Cmd int Cmd int
Value interface{} Value interface{}
} }
type OnlineHistoryConsumerHandler struct { type OnlineHistoryRedisConsumerHandler struct {
msgHandle map[string]fcb msgHandle map[string]fcb
historyConsumerGroup *kfk.MConsumerGroup historyConsumerGroup *kfk.MConsumerGroup
cmdCh chan Cmd2Value
chArrays [ChannelNum]chan Cmd2Value chArrays [ChannelNum]chan Cmd2Value
chMongoArrays [ChannelNum]chan Cmd2Value
msgDistributionCh chan Cmd2Value msgDistributionCh chan Cmd2Value
} }
func (och *OnlineHistoryConsumerHandler) Init(cmdCh chan Cmd2Value) { func (och *OnlineHistoryRedisConsumerHandler) Init(cmdCh chan Cmd2Value) {
och.msgHandle = make(map[string]fcb) och.msgHandle = make(map[string]fcb)
och.msgDistributionCh = make(chan Cmd2Value) //no buffer channel och.msgDistributionCh = make(chan Cmd2Value) //no buffer channel
go och.MessagesDistributionHandle() go och.MessagesDistributionHandle()
och.cmdCh = cmdCh
for i := 0; i < ChannelNum; i++ { for i := 0; i < ChannelNum; i++ {
och.chArrays[i] = make(chan Cmd2Value, 50) och.chArrays[i] = make(chan Cmd2Value, 50)
go och.Run(i) go och.Run(i)
} }
for i := 0; i < ChannelNum; i++ {
och.chMongoArrays[i] = make(chan Cmd2Value, 10000)
go och.MongoMessageRun(i)
}
if config.Config.ReliableStorage { if config.Config.ReliableStorage {
och.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = och.handleChatWs2Mongo och.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = och.handleChatWs2Mongo
} else { } else {
@ -66,60 +57,33 @@ func (och *OnlineHistoryConsumerHandler) Init(cmdCh chan Cmd2Value) {
} }
och.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0, och.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic}, OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo) config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToRedis)
} }
func (och *OnlineHistoryConsumerHandler) TriggerCmd(status int) { func (och *OnlineHistoryRedisConsumerHandler) Run(channelID int) {
operationID := utils.OperationIDGenerator()
err := sendCmd(och.cmdCh, Cmd2Value{Cmd: status, Value: ""}, 1)
if err != nil {
log.Error(operationID, "TriggerCmd failed ", err.Error(), status)
return
}
log.Debug(operationID, "TriggerCmd success", status)
}
func sendCmd(ch chan Cmd2Value, value Cmd2Value, timeout int64) error {
var flag = 0
select {
case ch <- value:
flag = 1
case <-time.After(time.Second * time.Duration(timeout)):
flag = 2
}
if flag == 1 {
return nil
} else {
return errors.New("send cmd timeout")
}
}
func (och *OnlineHistoryConsumerHandler) Run(channelID int) {
for { for {
select { select {
case cmd := <-och.chArrays[channelID]: case cmd := <-och.chArrays[channelID]:
switch cmd.Cmd { switch cmd.Cmd {
case UserMessages: case AggregationMessages:
msgChannelValue := cmd.Value.(MsgChannelValue) msgChannelValue := cmd.Value.(MsgChannelValue)
msgList := msgChannelValue.msgList msgList := msgChannelValue.msgList
triggerID := msgChannelValue.triggerID triggerID := msgChannelValue.triggerID
storageMsgList := make([]*pbMsg.MsgDataToMQ, 0, 80) storageMsgList := make([]*pbMsg.MsgDataToMQ, 0, 80)
notStoragepushMsgList := make([]*pbMsg.MsgDataToMQ, 0, 80) notStoragePushMsgList := make([]*pbMsg.MsgDataToMQ, 0, 80)
log.Debug(triggerID, "msg arrived channel", "channel id", channelID, msgList, msgChannelValue.userID, len(msgList)) log.Debug(triggerID, "msg arrived channel", "channel id", channelID, msgList, msgChannelValue.aggregationID, len(msgList))
for _, v := range msgList { for _, v := range msgList {
log.Debug(triggerID, "msg come to storage center", v.String()) log.Debug(triggerID, "msg come to storage center", v.String())
if v.MsgData == nil {
log.NewWarn(triggerID, "msg come to storage center nil", v.String(), v.OperationID, msgChannelValue.userID)
continue
}
isHistory := utils.GetSwitchFromOptions(v.MsgData.Options, constant.IsHistory) isHistory := utils.GetSwitchFromOptions(v.MsgData.Options, constant.IsHistory)
isSenderSync := utils.GetSwitchFromOptions(v.MsgData.Options, constant.IsSenderSync) isSenderSync := utils.GetSwitchFromOptions(v.MsgData.Options, constant.IsSenderSync)
if isHistory { if isHistory {
storageMsgList = append(storageMsgList, v) storageMsgList = append(storageMsgList, v)
//log.NewWarn(triggerID, "storageMsgList to mongodb client msgID: ", v.MsgData.ClientMsgID) //log.NewWarn(triggerID, "storageMsgList to mongodb client msgID: ", v.MsgData.ClientMsgID)
} else { } else {
if !(!isSenderSync && msgChannelValue.userID == v.MsgData.SendID) { if !(!isSenderSync && msgChannelValue.aggregationID == v.MsgData.SendID) {
notStoragepushMsgList = append(notStoragepushMsgList, v) notStoragePushMsgList = append(notStoragePushMsgList, v)
} }
} }
} }
@ -132,8 +96,8 @@ func (och *OnlineHistoryConsumerHandler) Run(channelID int) {
// log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String()) // log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String())
// return // return
//} //}
log.Debug(triggerID, "msg storage length", len(storageMsgList), "push length", len(notStoragepushMsgList)) log.Debug(triggerID, "msg storage length", len(storageMsgList), "push length", len(notStoragePushMsgList))
err, lastSeq := saveUserChatList(msgChannelValue.userID, storageMsgList, triggerID) err, lastSeq := saveUserChatList(msgChannelValue.aggregationID, storageMsgList, triggerID)
if err != nil { if err != nil {
singleMsgFailedCount += uint64(len(storageMsgList)) singleMsgFailedCount += uint64(len(storageMsgList))
log.NewError(triggerID, "single data insert to redis err", err.Error(), storageMsgList) log.NewError(triggerID, "single data insert to redis err", err.Error(), storageMsgList)
@ -141,72 +105,79 @@ func (och *OnlineHistoryConsumerHandler) Run(channelID int) {
singleMsgSuccessCountMutex.Lock() singleMsgSuccessCountMutex.Lock()
singleMsgSuccessCount += uint64(len(storageMsgList)) singleMsgSuccessCount += uint64(len(storageMsgList))
singleMsgSuccessCountMutex.Unlock() singleMsgSuccessCountMutex.Unlock()
och.SendMessageToMongoCH(msgChannelValue.userID, triggerID, storageMsgList, lastSeq) och.SendMessageToMongoCH(msgChannelValue.aggregationID, triggerID, storageMsgList, lastSeq)
go func(push, storage []*pbMsg.MsgDataToMQ) { go func(push, storage []*pbMsg.MsgDataToMQ) {
for _, v := range storage { for _, v := range storage {
sendMessageToPush(v, msgChannelValue.userID) sendMessageToPush(v, msgChannelValue.aggregationID)
} }
for _, x := range push { for _, x := range push {
sendMessageToPush(x, msgChannelValue.userID) sendMessageToPush(x, msgChannelValue.aggregationID)
} }
}(notStoragepushMsgList, storageMsgList) }(notStoragePushMsgList, storageMsgList)
} }
} }
} }
} }
} }
func (och *OnlineHistoryConsumerHandler) SendMessageToMongoCH(userID string, triggerID string, messages []*pbMsg.MsgDataToMQ, lastSeq uint64) { func (och *OnlineHistoryRedisConsumerHandler) SendMessageToMongoCH(aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ, lastSeq uint64) {
hashCode := getHashCode(userID) pid, offset, err := producerToMongo.SendMessage(&pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, AggregationID: aggregationID, MessageList: messages, TriggerID: triggerID}, aggregationID, triggerID)
channelID := hashCode % ChannelNum if err != nil {
log.Debug(triggerID, "generate channelID", hashCode, channelID, userID) log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
//go func(cID uint32, userID string, messages []*pbMsg.MsgDataToMQ) { } else {
och.chMongoArrays[channelID] <- Cmd2Value{Cmd: MongoMessages, Value: MsgChannelValue{userID: userID, msgList: messages, triggerID: triggerID, lastSeq: lastSeq}} // log.NewWarn(m.OperationID, "sendMsgToKafka client msgID ", m.MsgData.ClientMsgID)
} }
func (och *OnlineHistoryConsumerHandler) MongoMessageRun(channelID int) { //hashCode := getHashCode(aggregationID)
//channelID := hashCode % ChannelNum
//log.Debug(triggerID, "generate channelID", hashCode, channelID, aggregationID)
////go func(cID uint32, userID string, messages []*pbMsg.MsgDataToMQ) {
//och.chMongoArrays[channelID] <- Cmd2Value{Cmd: MongoMessages, Value: MsgChannelValue{aggregationID: aggregationID, msgList: messages, triggerID: triggerID, lastSeq: lastSeq}}
}
//func (och *OnlineHistoryRedisConsumerHandler) MongoMessageRun(channelID int) {
// for {
// select {
// case cmd := <-och.chMongoArrays[channelID]:
// switch cmd.Cmd {
// case MongoMessages:
// msgChannelValue := cmd.Value.(MsgChannelValue)
// msgList := msgChannelValue.msgList
// triggerID := msgChannelValue.triggerID
// aggregationID := msgChannelValue.aggregationID
// lastSeq := msgChannelValue.lastSeq
// err := db.DB.BatchInsertChat2DB(aggregationID, msgList, triggerID, lastSeq)
// if err != nil {
// log.NewError(triggerID, "single data insert to mongo err", err.Error(), msgList)
// }
// for _, v := range msgList {
// if v.MsgData.ContentType == constant.DeleteMessageNotification {
// tips := server_api_params.TipsComm{}
// DeleteMessageTips := server_api_params.DeleteMessageTips{}
// err := proto.Unmarshal(v.MsgData.Content, &tips)
// if err != nil {
// log.NewError(triggerID, "tips unmarshal err:", err.Error(), v.String())
// continue
// }
// err = proto.Unmarshal(tips.Detail, &DeleteMessageTips)
// if err != nil {
// log.NewError(triggerID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
// continue
// }
// if unexistSeqList, err := db.DB.DelMsgBySeqList(DeleteMessageTips.UserID, DeleteMessageTips.SeqList, v.OperationID); err != nil {
// log.NewError(v.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqList args: ", DeleteMessageTips.UserID, DeleteMessageTips.SeqList, v.OperationID, err.Error(), unexistSeqList)
// }
//
// }
// }
// }
// }
// }
//}
func (och *OnlineHistoryRedisConsumerHandler) MessagesDistributionHandle() {
for { for {
select { aggregationMsgs := make(map[string][]*pbMsg.MsgDataToMQ, ChannelNum)
case cmd := <-och.chMongoArrays[channelID]:
switch cmd.Cmd {
case MongoMessages:
msgChannelValue := cmd.Value.(MsgChannelValue)
msgList := msgChannelValue.msgList
triggerID := msgChannelValue.triggerID
userID := msgChannelValue.userID
lastSeq := msgChannelValue.lastSeq
err := db.DB.BatchInsertChat2DB(userID, msgList, triggerID, lastSeq)
if err != nil {
log.NewError(triggerID, "single data insert to mongo err", err.Error(), msgList)
}
for _, v := range msgList {
if v.MsgData.ContentType == constant.DeleteMessageNotification {
tips := server_api_params.TipsComm{}
DeleteMessageTips := server_api_params.DeleteMessageTips{}
err := proto.Unmarshal(v.MsgData.Content, &tips)
if err != nil {
log.NewError(triggerID, "tips unmarshal err:", err.Error(), v.String())
continue
}
err = proto.Unmarshal(tips.Detail, &DeleteMessageTips)
if err != nil {
log.NewError(triggerID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
continue
}
if unexistSeqList, err := db.DB.DelMsgBySeqList(DeleteMessageTips.UserID, DeleteMessageTips.SeqList, v.OperationID); err != nil {
log.NewError(v.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqList args: ", DeleteMessageTips.UserID, DeleteMessageTips.SeqList, v.OperationID, err.Error(), unexistSeqList)
}
}
}
}
}
}
}
func (och *OnlineHistoryConsumerHandler) MessagesDistributionHandle() {
for {
UserAggregationMsgs := make(map[string][]*pbMsg.MsgDataToMQ, ChannelNum)
select { select {
case cmd := <-och.msgDistributionCh: case cmd := <-och.msgDistributionCh:
switch cmd.Cmd { switch cmd.Cmd {
@ -223,27 +194,24 @@ func (och *OnlineHistoryConsumerHandler) MessagesDistributionHandle() {
log.Error(triggerID, "msg_transfer Unmarshal msg err", "msg", string(consumerMessages[i].Value), "err", err.Error()) log.Error(triggerID, "msg_transfer Unmarshal msg err", "msg", string(consumerMessages[i].Value), "err", err.Error())
return return
} }
log.Debug(triggerID, "single msg come to distribution center", string(consumerMessages[i].Key)) log.Debug(triggerID, "single msg come to distribution center", msgFromMQ.String(), string(consumerMessages[i].Key))
if oldM, ok := UserAggregationMsgs[string(consumerMessages[i].Key)]; ok { if oldM, ok := aggregationMsgs[string(consumerMessages[i].Key)]; ok {
oldM = append(oldM, &msgFromMQ) oldM = append(oldM, &msgFromMQ)
UserAggregationMsgs[string(consumerMessages[i].Key)] = oldM aggregationMsgs[string(consumerMessages[i].Key)] = oldM
} else { } else {
m := make([]*pbMsg.MsgDataToMQ, 0, 100) m := make([]*pbMsg.MsgDataToMQ, 0, 100)
m = append(m, &msgFromMQ) m = append(m, &msgFromMQ)
UserAggregationMsgs[string(consumerMessages[i].Key)] = m aggregationMsgs[string(consumerMessages[i].Key)] = m
} }
} }
log.Debug(triggerID, "generate map list users len", len(UserAggregationMsgs), UserAggregationMsgs) log.Debug(triggerID, "generate map list users len", len(aggregationMsgs))
for userID, v := range UserAggregationMsgs { for aggregationID, v := range aggregationMsgs {
if len(v) >= 0 { if len(v) >= 0 {
hashCode := getHashCode(userID) hashCode := getHashCode(aggregationID)
channelID := hashCode % ChannelNum channelID := hashCode % ChannelNum
log.Debug(triggerID, "generate channelID", hashCode, channelID, userID, len(v)) log.Debug(triggerID, "generate channelID", hashCode, channelID, aggregationID)
for _, y := range v {
log.Debug(triggerID, "single user slice is ", y.String())
}
//go func(cID uint32, userID string, messages []*pbMsg.MsgDataToMQ) { //go func(cID uint32, userID string, messages []*pbMsg.MsgDataToMQ) {
och.chArrays[channelID] <- Cmd2Value{Cmd: UserMessages, Value: MsgChannelValue{userID: userID, msgList: v, triggerID: triggerID}} och.chArrays[channelID] <- Cmd2Value{Cmd: AggregationMessages, Value: MsgChannelValue{aggregationID: aggregationID, msgList: v, triggerID: triggerID}}
//}(channelID, userID, v) //}(channelID, userID, v)
} }
} }
@ -253,7 +221,7 @@ func (och *OnlineHistoryConsumerHandler) MessagesDistributionHandle() {
} }
} }
func (mc *OnlineHistoryConsumerHandler) handleChatWs2Mongo(cMsg *sarama.ConsumerMessage, msgKey string, sess sarama.ConsumerGroupSession) { func (mc *OnlineHistoryRedisConsumerHandler) handleChatWs2Mongo(cMsg *sarama.ConsumerMessage, msgKey string, sess sarama.ConsumerGroupSession) {
msg := cMsg.Value msg := cMsg.Value
now := time.Now() now := time.Now()
msgFromMQ := pbMsg.MsgDataToMQ{} msgFromMQ := pbMsg.MsgDataToMQ{}
@ -325,7 +293,7 @@ func (mc *OnlineHistoryConsumerHandler) handleChatWs2Mongo(cMsg *sarama.Consumer
log.NewDebug(msgFromMQ.OperationID, "msg_transfer handle topic data to database success...", msgFromMQ.String()) log.NewDebug(msgFromMQ.OperationID, "msg_transfer handle topic data to database success...", msgFromMQ.String())
} }
func (och *OnlineHistoryConsumerHandler) handleChatWs2MongoLowReliability(cMsg *sarama.ConsumerMessage, msgKey string, sess sarama.ConsumerGroupSession) { func (och *OnlineHistoryRedisConsumerHandler) handleChatWs2MongoLowReliability(cMsg *sarama.ConsumerMessage, msgKey string, sess sarama.ConsumerGroupSession) {
msg := cMsg.Value msg := cMsg.Value
msgFromMQ := pbMsg.MsgDataToMQ{} msgFromMQ := pbMsg.MsgDataToMQ{}
err := proto.Unmarshal(msg, &msgFromMQ) err := proto.Unmarshal(msg, &msgFromMQ)
@ -365,10 +333,10 @@ func (och *OnlineHistoryConsumerHandler) handleChatWs2MongoLowReliability(cMsg *
} }
} }
func (OnlineHistoryConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } func (OnlineHistoryRedisConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
func (OnlineHistoryConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil } func (OnlineHistoryRedisConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
//func (och *OnlineHistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, //func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
// claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group // claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
// log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition()) // log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
// for msg := range claim.Messages() { // for msg := range claim.Messages() {
@ -385,7 +353,7 @@ func (OnlineHistoryConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error
// return nil // return nil
//} //}
func (och *OnlineHistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
for { for {
@ -480,7 +448,7 @@ func (och *OnlineHistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupS
return nil return nil
} }
//func (och *OnlineHistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, //func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
// claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group // claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
// //
// for { // for {
@ -544,7 +512,7 @@ func sendMessageToPush(message *pbMsg.MsgDataToMQ, pushToUserID string) {
log.Info(message.OperationID, "msg_transfer send message to push", "message", message.String()) log.Info(message.OperationID, "msg_transfer send message to push", "message", message.String())
rpcPushMsg := pbPush.PushMsgReq{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID} rpcPushMsg := pbPush.PushMsgReq{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID}
mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID} mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID}
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName, message.OperationID)
if grpcConn == nil { if grpcConn == nil {
log.Error(rpcPushMsg.OperationID, "rpc dial failed", "push data", rpcPushMsg.String()) log.Error(rpcPushMsg.OperationID, "rpc dial failed", "push data", rpcPushMsg.String())
pid, offset, err := producer.SendMessage(&mqPushMsg, mqPushMsg.PushToUserID, rpcPushMsg.OperationID) pid, offset, err := producer.SendMessage(&mqPushMsg, mqPushMsg.PushToUserID, rpcPushMsg.OperationID)

View File

@ -0,0 +1,79 @@
package logic
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
kfk "Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log"
pbMsg "Open_IM/pkg/proto/chat"
server_api_params "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"github.com/Shopify/sarama"
"github.com/golang/protobuf/proto"
)
type OnlineHistoryMongoConsumerHandler struct {
msgHandle map[string]fcb
historyConsumerGroup *kfk.MConsumerGroup
}
func (och *OnlineHistoryMongoConsumerHandler) Init() {
och.msgHandle = make(map[string]fcb)
och.msgHandle[config.Config.Kafka.MsgToMongo.Topic] = och.handleChatWs2Mongo
och.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToMongo.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo)
}
func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
msg := cMsg.Value
msgFromMQ := pbMsg.MsgDataToMongoByMQ{}
err := proto.Unmarshal(msg, &msgFromMQ)
if err != nil {
log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
return
}
err = db.DB.BatchInsertChat2DB(msgFromMQ.AggregationID, msgFromMQ.MessageList, msgFromMQ.TriggerID, msgFromMQ.LastSeq)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "single data insert to mongo err", err.Error(), msgFromMQ.MessageList)
}
for _, v := range msgFromMQ.MessageList {
if v.MsgData.ContentType == constant.DeleteMessageNotification {
tips := server_api_params.TipsComm{}
DeleteMessageTips := server_api_params.DeleteMessageTips{}
err := proto.Unmarshal(v.MsgData.Content, &tips)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "tips unmarshal err:", err.Error(), v.String())
continue
}
err = proto.Unmarshal(tips.Detail, &DeleteMessageTips)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
continue
}
if unexistSeqList, err := db.DB.DelMsgBySeqList(DeleteMessageTips.UserID, DeleteMessageTips.SeqList, v.OperationID); err != nil {
log.NewError(v.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqList args: ", DeleteMessageTips.UserID, DeleteMessageTips.SeqList, v.OperationID, err.Error(), unexistSeqList)
}
}
}
}
func (OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
func (OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
func (och *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
for msg := range claim.Messages() {
log.NewDebug("", "kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
if len(msg.Value) != 0 {
och.msgHandle[msg.Topic](msg, string(msg.Key), sess)
} else {
log.Error("", "mongo msg get from kafka but is nil", msg.Key)
}
sess.MarkMessage(msg, "")
}
return nil
}

View File

@ -56,6 +56,8 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMes
if msgKey == msgFromMQ.MsgData.SendID { if msgKey == msgFromMQ.MsgData.SendID {
tag = true tag = true
} }
case constant.SuperGroupChatType:
tag = true
} }
if tag { if tag {
log.NewInfo(msgFromMQ.OperationID, "msg_transfer msg persisting", string(msg)) log.NewInfo(msgFromMQ.OperationID, "msg_transfer msg persisting", string(msg))

View File

@ -20,7 +20,7 @@ func callbackOfflinePush(operationID, userID string, msg *commonPb.MsgData) cbAp
OperationID: operationID, OperationID: operationID,
UserID: userID, UserID: userID,
PlatformID: msg.SenderPlatformID, PlatformID: msg.SenderPlatformID,
Platform: constant.PlatformIDToName(msg.SenderPlatformID), Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
}, },
OfflinePushInfo: msg.OfflinePushInfo, OfflinePushInfo: msg.OfflinePushInfo,
SendID: msg.SendID, SendID: msg.SendID,

View File

@ -2,6 +2,7 @@ package logic
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"
"Open_IM/pkg/proto/push" "Open_IM/pkg/proto/push"
@ -63,7 +64,12 @@ func (r *RPCServer) run() {
} }
func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPush.PushMsgResp, error) { func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPush.PushMsgResp, error) {
//Call push module to send message to the user //Call push module to send message to the user
switch pbData.MsgData.SessionType {
case constant.SuperGroupChatType:
MsgToSuperGroupUser(pbData)
default:
MsgToUser(pbData) MsgToUser(pbData)
}
return &pbPush.PushMsgResp{ return &pbPush.PushMsgResp{
ResultCode: 0, ResultCode: 0,
}, nil }, nil

View File

@ -39,7 +39,7 @@ type AtContent struct {
var grpcCons []*grpc.ClientConn var grpcCons []*grpc.ClientConn
func MsgToUser(pushMsg *pbPush.PushMsgReq) { func MsgToUser(pushMsg *pbPush.PushMsgReq) {
var wsResult []*pbRelay.SingleMsgToUser var wsResult []*pbRelay.SingelMsgToUserResultList
isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush)
log.Debug(pushMsg.OperationID, "Get msg from msg_transfer And push msg", pushMsg.String()) log.Debug(pushMsg.OperationID, "Get msg from msg_transfer And push msg", pushMsg.String())
if len(grpcCons) == 0 { if len(grpcCons) == 0 {
@ -47,39 +47,36 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
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.Debug("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String()) log.Debug(pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
for _, v := range grpcCons { for _, v := range grpcCons {
msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v) msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v)
reply, err := msgClient.OnlinePushMsg(context.Background(), &pbRelay.OnlinePushMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserID: pushMsg.PushToUserID}) reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserIDList: []string{pushMsg.PushToUserID}})
if err != nil { if err != nil {
log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err) log.NewError("SuperGroupOnlineBatchPushOneMsg push data to client rpc err", pushMsg.OperationID, "err", err)
continue continue
} }
if reply != nil && reply.Resp != nil { if reply != nil && reply.SinglePushResult != nil {
wsResult = append(wsResult, reply.Resp...) wsResult = append(wsResult, reply.SinglePushResult...)
} }
} }
log.NewInfo(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData) log.NewInfo(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData)
successCount++ successCount++
if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID { if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID {
// save invitation info for offline push // save invitation info for offline push
for _, v := range wsResult {
if v.OnlinePush {
return
}
}
if pushMsg.MsgData.ContentType == constant.SignalingNotification { if pushMsg.MsgData.ContentType == constant.SignalingNotification {
if err := db.DB.HandleSignalInfo(pushMsg.OperationID, pushMsg.MsgData); err != nil { if err := db.DB.HandleSignalInfo(pushMsg.OperationID, pushMsg.MsgData); err != nil {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), err.Error(), pushMsg.MsgData) log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), err.Error(), pushMsg.MsgData)
return return
} }
} }
for _, v := range wsResult {
if v.ResultCode == 0 {
if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) {
break
}
continue
}
if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) {
//Use offline push messaging //Use offline push messaging
var UIDList []string var UIDList []string
UIDList = append(UIDList, v.RecvID) UIDList = append(UIDList, pushMsg.PushToUserID)
customContent := OpenIMContent{ customContent := OpenIMContent{
SessionType: int(pushMsg.MsgData.SessionType), SessionType: int(pushMsg.MsgData.SessionType),
From: pushMsg.MsgData.SendID, From: pushMsg.MsgData.SendID,
@ -91,7 +88,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
var content string var content string
if pushMsg.MsgData.OfflinePushInfo != nil { if pushMsg.MsgData.OfflinePushInfo != nil {
content = pushMsg.MsgData.OfflinePushInfo.Title content = pushMsg.MsgData.OfflinePushInfo.Title
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "xxxx OfflinePushInfo", content)
} else { } else {
switch pushMsg.MsgData.ContentType { switch pushMsg.MsgData.ContentType {
case constant.Text: case constant.Text:
@ -107,7 +104,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
case constant.AtText: case constant.AtText:
a := AtContent{} a := AtContent{}
_ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a) _ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a)
if utils.IsContain(v.RecvID, a.AtUserList) { if utils.IsContain(pushMsg.PushToUserID, a.AtUserList) {
content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common] content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common]
} else { } else {
content = constant.ContentType2PushContent[constant.GroupMsg] content = constant.ContentType2PushContent[constant.GroupMsg]
@ -116,8 +113,10 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
content = constant.ContentType2PushContent[constant.SignalMsg] content = constant.ContentType2PushContent[constant.SignalMsg]
default: default:
content = constant.ContentType2PushContent[constant.Common] content = constant.ContentType2PushContent[constant.Common]
} }
} }
callbackResp := callbackOfflinePush(pushMsg.OperationID, UIDList[0], pushMsg.MsgData) callbackResp := callbackOfflinePush(pushMsg.OperationID, UIDList[0], pushMsg.MsgData)
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp") log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp")
if callbackResp.ErrCode != 0 { if callbackResp.ErrCode != 0 {
@ -125,29 +124,138 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
} }
if callbackResp.ActionCode != constant.ActionAllow { if callbackResp.ActionCode != constant.ActionAllow {
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop") log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop")
break return
} }
if offlinePusher == nil { if offlinePusher == nil {
break return
} }
opts, err := GetOfflinePushOpts(pushMsg) opts, err := GetOfflinePushOpts(pushMsg)
if err != nil { if err != nil {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error()) log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error())
} }
log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), UIDList, content, jsonCustomContent, "opts:", opts) log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), UIDList, content, jsonCustomContent, "opts:", opts)
pushResult, err := offlinePusher.Push(UIDList, content, jsonCustomContent, pushMsg.OperationID, opts) pushResult, err := offlinePusher.Push(UIDList, content, jsonCustomContent, pushMsg.OperationID, opts)
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline pushResult: ", pushResult)
if err != nil { if err != nil {
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error()) log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
} else { } else {
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData) log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
} }
break }
} }
func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) {
var wsResult []*pbRelay.SingelMsgToUserResultList
isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush)
log.Debug(pushMsg.OperationID, "Get super group msg from msg_transfer And push msg", pushMsg.String())
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: pushMsg.OperationID, GroupID: pushMsg.MsgData.GroupID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, pushMsg.OperationID)
if etcdConn == nil {
errMsg := pushMsg.OperationID + "getcdv3.GetConn == nil"
log.NewError(pushMsg.OperationID, errMsg)
return
}
client := pbCache.NewCacheClient(etcdConn)
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
if err != nil {
log.NewError(pushMsg.OperationID, "GetGroupMemberIDListFromCache rpc call failed ", err.Error())
return
}
if cacheResp.CommonResp.ErrCode != 0 {
log.NewError(pushMsg.OperationID, "GetGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
return
}
if len(grpcCons) == 0 {
log.NewWarn(pushMsg.OperationID, "first GetConn4Unique ")
grpcCons = getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
}
//Online push message
log.Debug("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
for _, v := range grpcCons {
msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v)
reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserIDList: cacheResp.UserIDList})
if err != nil {
log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err)
continue
}
if reply != nil && reply.SinglePushResult != nil {
wsResult = append(wsResult, reply.SinglePushResult...)
}
}
log.Debug(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData)
successCount++
if isOfflinePush {
var onlineSuccessUserIDList []string
onlineSuccessUserIDList = append(onlineSuccessUserIDList, pushMsg.MsgData.SendID)
for _, v := range wsResult {
if v.OnlinePush && v.UserID != pushMsg.MsgData.SendID {
onlineSuccessUserIDList = append(onlineSuccessUserIDList, v.UserID)
}
}
onlineFailedUserIDList := utils.DifferenceString(onlineSuccessUserIDList, cacheResp.UserIDList)
//Use offline push messaging
customContent := OpenIMContent{
SessionType: int(pushMsg.MsgData.SessionType),
From: pushMsg.MsgData.SendID,
To: pushMsg.MsgData.RecvID,
Seq: pushMsg.MsgData.Seq,
}
bCustomContent, _ := json.Marshal(customContent)
jsonCustomContent := string(bCustomContent)
var content string
if pushMsg.MsgData.OfflinePushInfo != nil {
content = pushMsg.MsgData.OfflinePushInfo.Title
} else {
switch pushMsg.MsgData.ContentType {
case constant.Text:
content = constant.ContentType2PushContent[constant.Text]
case constant.Picture:
content = constant.ContentType2PushContent[constant.Picture]
case constant.Voice:
content = constant.ContentType2PushContent[constant.Voice]
case constant.Video:
content = constant.ContentType2PushContent[constant.Video]
case constant.File:
content = constant.ContentType2PushContent[constant.File]
case constant.AtText:
a := AtContent{}
_ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a)
if utils.IsContain(pushMsg.PushToUserID, a.AtUserList) {
content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common]
} else {
content = constant.ContentType2PushContent[constant.GroupMsg]
}
case constant.SignalingNotification:
content = constant.ContentType2PushContent[constant.SignalMsg]
default:
content = constant.ContentType2PushContent[constant.Common]
}
} }
callbackResp := callbackOfflinePush(pushMsg.OperationID, onlineFailedUserIDList[0], pushMsg.MsgData)
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp")
if callbackResp.ErrCode != 0 {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp)
}
if callbackResp.ActionCode != constant.ActionAllow {
log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop")
return
}
if offlinePusher == nil {
return
}
opts, err := GetOfflinePushOpts(pushMsg)
if err != nil {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error())
}
log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), onlineFailedUserIDList, content, jsonCustomContent, "opts:", opts)
pushResult, err := offlinePusher.Push(onlineFailedUserIDList, content, jsonCustomContent, pushMsg.OperationID, opts)
if err != nil {
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
} else {
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
}
} }
} }

View File

@ -8,8 +8,10 @@ import (
"Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbAuth "Open_IM/pkg/proto/auth" pbAuth "Open_IM/pkg/proto/auth"
pbRelay "Open_IM/pkg/proto/relay"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"errors"
"net" "net"
"strconv" "strconv"
"strings" "strings"
@ -47,7 +49,7 @@ func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbA
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil
} }
tokens, expTime, err := token_verify.CreateToken(req.FromUserID, req.Platform) tokens, expTime, err := token_verify.CreateToken(req.FromUserID, int(req.Platform))
if err != nil { if err != nil {
errMsg := req.OperationID + " token_verify.CreateToken failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform) errMsg := req.OperationID + " token_verify.CreateToken failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform)
log.NewError(req.OperationID, errMsg) log.NewError(req.OperationID, errMsg)
@ -58,6 +60,41 @@ func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbA
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}, nil return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}, nil
} }
func (rpc *rpcAuth) ForceLogout(_ context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
if !token_verify.IsManagerUserID(req.OpUserID) {
errMsg := req.OperationID + " IsManagerUserID false " + req.OpUserID
log.NewError(req.OperationID, errMsg)
return &pbAuth.ForceLogoutResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
if err := token_verify.DeleteToken(req.FromUserID, int(req.Platform)); err != nil {
errMsg := req.OperationID + " DeleteToken failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform)
log.NewError(req.OperationID, errMsg)
return &pbAuth.ForceLogoutResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil
}
if err := rpc.forceKickOff(req.FromUserID, req.Platform, req.OperationID); err != nil {
errMsg := req.OperationID + " forceKickOff failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform)
log.NewError(req.OperationID, errMsg)
return &pbAuth.ForceLogoutResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc return ", pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}})
return &pbAuth.ForceLogoutResp{CommonResp: &pbAuth.CommonResp{}}, nil
}
func (rpc *rpcAuth) forceKickOff(userID string, platformID int32, operationID string) error {
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)
kickReq := &pbRelay.KickUserOfflineReq{OperationID: operationID, KickUserIDList: []string{userID}, PlatformID: platformID}
log.NewInfo(operationID, "KickUserOffline ", client, kickReq.String())
_, err := client.KickUserOffline(context.Background(), kickReq)
return utils.Wrap(err, "")
}
return errors.New("no rpc node ")
}
type rpcAuth struct { type rpcAuth struct {
rpcPort int rpcPort int
rpcRegisterName string rpcRegisterName string

View File

@ -63,7 +63,7 @@ func (s *friendServer) Run() {
defer srv.GracefulStop() defer srv.GracefulStop()
//User friend related services register to etcd //User friend related services register to etcd
pbFriend.RegisterFriendServer(srv, s) pbFriend.RegisterFriendServer(srv, s)
rpcRegisterIP := "" rpcRegisterIP := config.Config.RpcRegisterIP
if config.Config.RpcRegisterIP == "" { if config.Config.RpcRegisterIP == "" {
rpcRegisterIP, err = utils.GetLocalIP() rpcRegisterIP, err = utils.GetLocalIP()
if err != nil { if err != nil {
@ -99,7 +99,12 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl
} }
log.NewInfo(req.CommID.OperationID, "AddBlacklist rpc ok ", req.CommID.FromUserID, req.CommID.ToUserID) log.NewInfo(req.CommID.OperationID, "AddBlacklist rpc ok ", req.CommID.FromUserID, req.CommID.ToUserID)
reqAddBlackUserToCache := &pbCache.AddBlackUserToCacheReq{UserID: req.CommID.FromUserID, BlackUserID: req.CommID.ToUserID, OperationID: req.CommID.OperationID} reqAddBlackUserToCache := &pbCache.AddBlackUserToCacheReq{UserID: req.CommID.FromUserID, BlackUserID: req.CommID.ToUserID, OperationID: req.CommID.OperationID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
return &pbFriend.AddBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.AddBlackUserToCache(context.Background(), reqAddBlackUserToCache) cacheResp, err := cacheClient.AddBlackUserToCache(context.Background(), reqAddBlackUserToCache)
if err != nil { if err != nil {
@ -263,7 +268,12 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF
} }
// cache rpc // cache rpc
addFriendToCacheReq := &pbCache.AddFriendToCacheReq{OperationID: req.CommID.OperationID} addFriendToCacheReq := &pbCache.AddFriendToCacheReq{OperationID: req.CommID.OperationID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
client := pbCache.NewCacheClient(etcdConn) client := pbCache.NewCacheClient(etcdConn)
addFriendToCacheReq.UserID = req.CommID.ToUserID addFriendToCacheReq.UserID = req.CommID.ToUserID
addFriendToCacheReq.FriendID = req.CommID.FromUserID addFriendToCacheReq.FriendID = req.CommID.FromUserID
@ -318,7 +328,12 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFri
} }
log.NewInfo(req.CommID.OperationID, "DeleteFriend rpc ok") log.NewInfo(req.CommID.OperationID, "DeleteFriend rpc ok")
reduceFriendFromCache := &pbCache.ReduceFriendFromCacheReq{OperationID: req.CommID.OperationID, UserID: req.CommID.FromUserID, FriendID: req.CommID.ToUserID} reduceFriendFromCache := &pbCache.ReduceFriendFromCacheReq{OperationID: req.CommID.OperationID, UserID: req.CommID.FromUserID, FriendID: req.CommID.ToUserID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
client := pbCache.NewCacheClient(etcdConn) client := pbCache.NewCacheClient(etcdConn)
respPb, err := client.ReduceFriendFromCache(context.Background(), reduceFriendFromCache) respPb, err := client.ReduceFriendFromCache(context.Background(), reduceFriendFromCache)
if err != nil { if err != nil {
@ -399,7 +414,13 @@ func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.Remove
} }
log.NewInfo(req.CommID.OperationID, "rpc RemoveBlacklist ok ") log.NewInfo(req.CommID.OperationID, "rpc RemoveBlacklist ok ")
reqReduceBlackUserFromCache := &pbCache.ReduceBlackUserFromCacheReq{UserID: req.CommID.FromUserID, BlackUserID: req.CommID.ToUserID, OperationID: req.CommID.OperationID} reqReduceBlackUserFromCache := &pbCache.ReduceBlackUserFromCacheReq{UserID: req.CommID.FromUserID, BlackUserID: req.CommID.ToUserID, OperationID: req.CommID.OperationID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID)
if etcdConn == nil {
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.CommID.OperationID, errMsg)
return &pbFriend.RemoveBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.ReduceBlackUserFromCache(context.Background(), reqReduceBlackUserFromCache) cacheResp, err := cacheClient.ReduceBlackUserFromCache(context.Background(), reqReduceBlackUserFromCache)
if err != nil { if err != nil {

View File

@ -12,18 +12,18 @@ import (
cp "Open_IM/pkg/common/utils" cp "Open_IM/pkg/common/utils"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbCache "Open_IM/pkg/proto/cache" pbCache "Open_IM/pkg/proto/cache"
pbConversation "Open_IM/pkg/proto/conversation"
pbGroup "Open_IM/pkg/proto/group" pbGroup "Open_IM/pkg/proto/group"
open_im_sdk "Open_IM/pkg/proto/sdk_ws" open_im_sdk "Open_IM/pkg/proto/sdk_ws"
pbUser "Open_IM/pkg/proto/user" pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"google.golang.org/grpc"
"math/big" "math/big"
"net" "net"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"google.golang.org/grpc"
) )
type groupServer struct { type groupServer struct {
@ -93,12 +93,6 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.OwnerUserID) log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.OwnerUserID)
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil return &pbGroup.CreateGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
} }
canCreate, err := callbackBeforeCreateGroup(req)
if err != nil || !canCreate {
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "callbackBeforeCreateGroup failed")
}
}
groupId := req.GroupInfo.GroupID groupId := req.GroupInfo.GroupID
if groupId == "" { if groupId == "" {
@ -108,27 +102,25 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
groupId = bi.String() groupId = bi.String()
} }
//to group //to group
groupInfo := db.Group{} groupInfo := db.Group{}
utils.CopyStructFields(&groupInfo, req.GroupInfo) utils.CopyStructFields(&groupInfo, req.GroupInfo)
groupInfo.CreatorUserID = req.OpUserID groupInfo.CreatorUserID = req.OpUserID
groupInfo.GroupID = groupId groupInfo.GroupID = groupId
err = imdb.InsertIntoGroup(groupInfo) err := imdb.InsertIntoGroup(groupInfo)
if err != nil { if err != nil {
log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo) log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo)
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB) return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
} }
var okUserIDList []string
resp := &pbGroup.CreateGroupResp{GroupInfo: &open_im_sdk.GroupInfo{}}
groupMember := db.GroupMember{} groupMember := db.GroupMember{}
us := &db.User{} us := &db.User{}
if req.OwnerUserID == "" { if req.OwnerUserID != "" {
goto initMemberList
}
us, err = imdb.GetUserByUserID(req.OwnerUserID) us, err = imdb.GetUserByUserID(req.OwnerUserID)
if err != nil { if err != nil {
log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.OwnerUserID) log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.OwnerUserID)
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB) return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
} }
//to group member //to group member
groupMember = db.GroupMember{GroupID: groupId, RoleLevel: constant.GroupOwner, OperatorUserID: req.OpUserID} groupMember = db.GroupMember{GroupID: groupId, RoleLevel: constant.GroupOwner, OperatorUserID: req.OpUserID}
utils.CopyStructFields(&groupMember, us) utils.CopyStructFields(&groupMember, us)
@ -137,9 +129,8 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error(), groupMember) log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error(), groupMember)
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB) return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, http.WrapError(constant.ErrDB)
} }
}
initMemberList: if req.GroupInfo.GroupType != constant.SuperGroup {
var okUserIDList []string
//to group member //to group member
for _, user := range req.InitMemberList { for _, user := range req.InitMemberList {
us, err := imdb.GetUserByUserID(user.UserID) us, err := imdb.GetUserByUserID(user.UserID)
@ -160,7 +151,6 @@ initMemberList:
} }
okUserIDList = append(okUserIDList, user.UserID) okUserIDList = append(okUserIDList, user.UserID)
} }
resp := &pbGroup.CreateGroupResp{GroupInfo: &open_im_sdk.GroupInfo{}}
group, err := imdb.GetGroupInfoByGroupID(groupId) group, err := imdb.GetGroupInfoByGroupID(groupId)
if err != nil { if err != nil {
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupId) log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupId)
@ -180,6 +170,16 @@ initMemberList:
resp.GroupInfo.OwnerUserID = req.OwnerUserID resp.GroupInfo.OwnerUserID = req.OwnerUserID
okUserIDList = append(okUserIDList, req.OwnerUserID) okUserIDList = append(okUserIDList, req.OwnerUserID)
} }
} else {
for _, v := range req.InitMemberList {
okUserIDList = append(okUserIDList, v.UserID)
}
if err := db.DB.CreateSuperGroup(groupId, okUserIDList, len(okUserIDList)); err != nil {
log.NewError(req.OperationID, "GetGroupMemberNumByGroupID failed ", err.Error(), groupId)
resp.ErrCode = constant.ErrDB.ErrCode
resp.ErrMsg = err.Error() + ": CreateSuperGroup failed"
}
}
if len(okUserIDList) != 0 { if len(okUserIDList) != 0 {
addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{ addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{
@ -187,7 +187,12 @@ initMemberList:
GroupID: groupId, GroupID: groupId,
OperationID: req.OperationID, OperationID: req.OperationID,
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq) cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq)
if err != nil { if err != nil {
@ -200,7 +205,12 @@ initMemberList:
} }
log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String()) log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())
if req.GroupInfo.GroupType != constant.SuperGroup {
chat.GroupCreatedNotification(req.OperationID, req.OpUserID, groupId, okUserIDList) chat.GroupCreatedNotification(req.OperationID, req.OpUserID, groupId, okUserIDList)
} else {
chat.SuperGroupNotification(req.OperationID, req.OpUserID, groupId)
}
return resp, nil return resp, nil
} else { } else {
log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String()) log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())
@ -263,8 +273,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
// //
//from User: invite: applicant //from User: invite: applicant
//to user: invite: invited //to user: invite: invited
var resp pbGroup.InviteUserToGroupResp
var okUserIDList []string var okUserIDList []string
if groupInfo.GroupType != constant.SuperGroup {
var resp pbGroup.InviteUserToGroupResp
for _, v := range req.InvitedUserIDList { for _, v := range req.InvitedUserIDList {
var resultNode pbGroup.Id2Result var resultNode pbGroup.Id2Result
resultNode.UserID = v resultNode.UserID = v
@ -304,6 +315,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
} }
var haveConUserID []string var haveConUserID []string
conversations, err := imdb.GetConversationsByConversationIDMultipleOwner(okUserIDList, utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType)) conversations, err := imdb.GetConversationsByConversationIDMultipleOwner(okUserIDList, utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType))
if err != nil {
log.NewError(req.OperationID, "GetConversationsByConversationIDMultipleOwner failed ", err.Error(), req.GroupID, constant.GroupChatType)
}
for _, v := range conversations { for _, v := range conversations {
haveConUserID = append(haveConUserID, v.OwnerUserID) haveConUserID = append(haveConUserID, v.OwnerUserID)
} }
@ -323,7 +337,12 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
c.IsNotInGroup = false c.IsNotInGroup = false
c.Ex = v.Ex c.Ex = v.Ex
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -340,7 +359,12 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
c.GroupID = req.GroupID c.GroupID = req.GroupID
c.IsNotInGroup = false c.IsNotInGroup = false
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -349,13 +373,25 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String(), v) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String(), v)
} }
} }
} else {
okUserIDList = req.InvitedUserIDList
if err := db.DB.AddUserToSuperGroup(req.GroupID, req.InvitedUserIDList); err != nil {
log.NewError(req.OperationID, "AddUserToSuperGroup failed ", req.GroupID, err)
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: err.Error()}, nil
}
}
addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{ addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{
UserIDList: okUserIDList, UserIDList: okUserIDList,
GroupID: req.GroupID, GroupID: req.GroupID,
OperationID: req.OperationID, OperationID: req.OperationID,
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq) cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq)
if err != nil { if err != nil {
@ -367,15 +403,27 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil
} }
if groupInfo.GroupType != constant.SuperGroup {
chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList) chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList)
resp.ErrCode = 0 } else {
log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ", resp.String()) chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID)
return &resp, nil }
log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ")
return &pbGroup.InviteUserToGroupResp{}, nil
} }
func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) { func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) {
log.NewInfo(req.OperationID, "GetGroupAllMember, args ", req.String()) log.NewInfo(req.OperationID, "GetGroupAllMember, args ", req.String())
var resp pbGroup.GetGroupAllMemberResp var resp pbGroup.GetGroupAllMemberResp
groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
resp.ErrCode = constant.ErrDB.ErrCode
resp.ErrMsg = constant.ErrDB.ErrMsg
return &resp, nil
}
if groupInfo.GroupType != constant.SuperGroup {
memberList, err := imdb.GetGroupMemberListByGroupID(req.GroupID) memberList, err := imdb.GetGroupMemberListByGroupID(req.GroupID)
if err != nil { if err != nil {
resp.ErrCode = constant.ErrDB.ErrCode resp.ErrCode = constant.ErrDB.ErrCode
@ -392,6 +440,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
//log.Debug(req.OperationID, "cp value: ", node) //log.Debug(req.OperationID, "cp value: ", node)
resp.MemberList = append(resp.MemberList, &node) resp.MemberList = append(resp.MemberList, &node)
} }
}
log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", resp.String()) log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", resp.String())
return &resp, nil return &resp, nil
} }
@ -424,59 +473,84 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr
return &resp, nil return &resp, nil
} }
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) { func (s *groupServer) getGroupUserLevel(groupID, userID string) (int, error) {
log.NewInfo(req.OperationID, "KickGroupMember args ", req.String()) opFlag := 0
ownerList, err := imdb.GetOwnerManagerByGroupID(req.GroupID) if !token_verify.IsManagerUserID(userID) {
opInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID)
if err != nil { if err != nil {
log.NewError(req.OperationID, "GetOwnerManagerByGroupId failed ", err.Error(), req.GroupID) return opFlag, utils.Wrap(err, "")
}
if opInfo.RoleLevel == constant.GroupOrdinaryUsers {
opFlag = 0
} else if opInfo.RoleLevel == constant.GroupOwner {
opFlag = 2 //owner
} else {
opFlag = 3 //admin
}
} else {
opFlag = 1 //app manager
}
return opFlag, nil
}
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupInfoByGroupID", req.GroupID, err.Error())
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil
} }
var okUserIDList []string
var resp pbGroup.KickGroupMemberResp
if groupInfo.GroupType != constant.SuperGroup {
opFlag := 0
if !token_verify.IsManagerUserID(req.OpUserID) {
opInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.OpUserID)
if err != nil {
errMsg := req.OperationID + " GetGroupMemberInfoByGroupIDAndUserID failed " + err.Error() + req.GroupID + req.OpUserID
log.Error(req.OperationID, errMsg)
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
}
if opInfo.RoleLevel == constant.GroupOrdinaryUsers {
errMsg := req.OperationID + " opInfo.RoleLevel == constant.GroupOrdinaryUsers " + opInfo.UserID + opInfo.GroupID
log.Error(req.OperationID, errMsg)
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
} else if opInfo.RoleLevel == constant.GroupOwner {
opFlag = 2 //owner
} else {
opFlag = 3 //admin
}
} else {
opFlag = 1 //app manager
}
//op is group owner? //op is group owner?
var flag = 0
for _, v := range ownerList {
if v.UserID == req.OpUserID {
flag = 1
log.NewDebug(req.OperationID, "is group owner ", req.OpUserID, req.GroupID)
break
}
}
//op is app manager
if flag != 1 {
if token_verify.IsManagerUserID(req.OpUserID) {
flag = 1
log.NewDebug(req.OperationID, "is app manager ", req.OpUserID)
}
}
if flag != 1 {
log.NewError(req.OperationID, "failed, no access kick ", req.OpUserID)
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
}
if len(req.KickedUserIDList) == 0 { if len(req.KickedUserIDList) == 0 {
log.NewError(req.OperationID, "failed, kick list 0") log.NewError(req.OperationID, "failed, kick list 0")
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}, nil return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}, nil
} }
groupOwnerUserID := ""
for _, v := range ownerList {
if v.RoleLevel == constant.GroupOwner {
groupOwnerUserID = v.UserID
}
}
var okUserIDList []string
//remove //remove
var resp pbGroup.KickGroupMemberResp
for _, v := range req.KickedUserIDList { for _, v := range req.KickedUserIDList {
//owner cant kicked kickedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, v)
if v == groupOwnerUserID { if err != nil {
log.NewError(req.OperationID, "failed, can't kick owner ", v) log.NewError(req.OperationID, " GetGroupMemberInfoByGroupIDAndUserID failed ", req.GroupID, v, err.Error())
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
continue continue
} }
err := imdb.RemoveGroupMember(req.GroupID, v)
if kickedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 {
log.Error(req.OperationID, "is constant.GroupAdmin, can't kicked ", v)
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
continue
}
if kickedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 {
log.NewDebug(req.OperationID, "is constant.GroupOwner, can't kicked ", v)
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
continue
}
err = imdb.RemoveGroupMember(req.GroupID, v)
if err != nil { if err != nil {
log.NewError(req.OperationID, "RemoveGroupMember failed ", err.Error(), req.GroupID, v) log.NewError(req.OperationID, "RemoveGroupMember failed ", err.Error(), req.GroupID, v)
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
@ -485,11 +559,6 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: 0}) resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: 0})
okUserIDList = append(okUserIDList, v) okUserIDList = append(okUserIDList, v)
} }
//err = db.DB.DelGroupMember(req.GroupID, v)
//if err != nil {
// log.NewError(req.OperationID, "DelGroupMember failed ", err.Error(), req.GroupID, v)
//}
} }
var reqPb pbUser.SetConversationReq var reqPb pbUser.SetConversationReq
var c pbUser.Conversation var c pbUser.Conversation
@ -501,7 +570,14 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
c.GroupID = req.GroupID c.GroupID = req.GroupID
c.IsNotInGroup = true c.IsNotInGroup = true
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
resp.ErrCode = constant.ErrInternal.ErrCode
resp.ErrMsg = errMsg
return &resp, nil
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -510,13 +586,27 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String(), v) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String(), v)
} }
} }
} else {
okUserIDList = req.KickedUserIDList
if err := db.DB.RemoverUserFromSuperGroup(req.GroupID, okUserIDList); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), req.GroupID, req.KickedUserIDList, err.Error())
resp.ErrCode = constant.ErrDB.ErrCode
resp.ErrMsg = constant.ErrDB.ErrMsg
return &resp, nil
}
}
reduceGroupMemberFromCacheReq := &pbCache.ReduceGroupMemberFromCacheReq{ reduceGroupMemberFromCacheReq := &pbCache.ReduceGroupMemberFromCacheReq{
UserIDList: okUserIDList, UserIDList: okUserIDList,
GroupID: req.GroupID, GroupID: req.GroupID,
OperationID: req.OperationID, OperationID: req.OperationID,
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.ReduceGroupMemberFromCache(context.Background(), reduceGroupMemberFromCacheReq) cacheResp, err := cacheClient.ReduceGroupMemberFromCache(context.Background(), reduceGroupMemberFromCacheReq)
if err != nil { if err != nil {
@ -527,8 +617,11 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
log.NewError(req.OperationID, "ReduceGroupMemberFromCache rpc logic call failed ", cacheResp.String()) log.NewError(req.OperationID, "ReduceGroupMemberFromCache rpc logic call failed ", cacheResp.String())
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil
} }
if groupInfo.GroupType != constant.SuperGroup {
chat.MemberKickedNotification(req, okUserIDList) chat.MemberKickedNotification(req, okUserIDList)
} else {
chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.GroupID)
}
log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String()) log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String())
return &resp, nil return &resp, nil
} }
@ -670,7 +763,12 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G
c.Ex = conversation.Ex c.Ex = conversation.Ex
} }
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -679,7 +777,12 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String()) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String())
} }
addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{OperationID: req.OperationID, GroupID: req.GroupID, UserIDList: []string{req.FromUserID}} addGroupMemberToCacheReq := &pbCache.AddGroupMemberToCacheReq{OperationID: req.OperationID, GroupID: req.GroupID, UserIDList: []string{req.FromUserID}}
etcdCacheConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdCacheConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
cacheClient := pbCache.NewCacheClient(etcdCacheConn) cacheClient := pbCache.NewCacheClient(etcdCacheConn)
cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq) cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq)
if err != nil { if err != nil {
@ -773,7 +876,12 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
c.GroupID = req.GroupID c.GroupID = req.GroupID
c.IsNotInGroup = true c.IsNotInGroup = true
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -787,7 +895,12 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
GroupID: req.GroupID, GroupID: req.GroupID,
OperationID: req.OperationID, OperationID: req.OperationID,
} }
etcdConnCache := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConnCache := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
cacheClient := pbCache.NewCacheClient(etcdConnCache) cacheClient := pbCache.NewCacheClient(etcdConnCache)
cacheResp, err := cacheClient.ReduceGroupMemberFromCache(context.Background(), reduceGroupMemberFromCacheReq) cacheResp, err := cacheClient.ReduceGroupMemberFromCache(context.Background(), reduceGroupMemberFromCacheReq)
if err != nil { if err != nil {
@ -840,17 +953,25 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
////bitwise operators: 0001:groupName; 0010:Notification 0100:Introduction; 1000:FaceUrl; 10000:owner ////bitwise operators: 0001:groupName; 0010:Notification 0100:Introduction; 1000:FaceUrl; 10000:owner
var changedType int32 var changedType int32
groupName := ""
notification := ""
introduction := ""
faceURL := ""
if group.GroupName != req.GroupInfo.GroupName && req.GroupInfo.GroupName != "" { if group.GroupName != req.GroupInfo.GroupName && req.GroupInfo.GroupName != "" {
changedType = 1 changedType = 1
groupName = req.GroupInfo.GroupName
} }
if group.Notification != req.GroupInfo.Notification && req.GroupInfo.Notification != "" { if group.Notification != req.GroupInfo.Notification && req.GroupInfo.Notification != "" {
changedType = changedType | (1 << 1) changedType = changedType | (1 << 1)
notification = req.GroupInfo.Notification
} }
if group.Introduction != req.GroupInfo.Introduction && req.GroupInfo.Introduction != "" { if group.Introduction != req.GroupInfo.Introduction && req.GroupInfo.Introduction != "" {
changedType = changedType | (1 << 2) changedType = changedType | (1 << 2)
introduction = req.GroupInfo.Introduction
} }
if group.FaceURL != req.GroupInfo.FaceURL && req.GroupInfo.FaceURL != "" { if group.FaceURL != req.GroupInfo.FaceURL && req.GroupInfo.FaceURL != "" {
changedType = changedType | (1 << 3) changedType = changedType | (1 << 3)
faceURL = req.GroupInfo.FaceURL
} }
//only administrators can set group information //only administrators can set group information
var groupInfo db.Group var groupInfo db.Group
@ -862,7 +983,53 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
} }
log.NewInfo(req.OperationID, "SetGroupInfo rpc return ", pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}) log.NewInfo(req.OperationID, "SetGroupInfo rpc return ", pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}})
if changedType != 0 { if changedType != 0 {
chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfo.GroupID) chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfo.GroupID, groupName, notification, introduction, faceURL)
}
if req.GroupInfo.Notification != "" {
//get group member user id
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: req.OperationID, GroupID: req.GroupInfo.GroupID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, http.WrapError(constant.ErrInternal)
}
client := pbCache.NewCacheClient(etcdConn)
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
if err != nil {
log.NewError(req.OperationID, "GetGroupMemberIDListFromCache rpc call failed ", err.Error())
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil
}
if cacheResp.CommonResp.ErrCode != 0 {
log.NewError(req.OperationID, "GetGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil
}
var conversationReq pbConversation.ModifyConversationFieldReq
conversation := pbConversation.Conversation{
OwnerUserID: req.OpUserID,
ConversationID: utils.GetConversationIDBySessionType(req.GroupInfo.GroupID, constant.GroupChatType),
ConversationType: constant.GroupChatType,
GroupID: req.GroupInfo.GroupID,
}
conversationReq.Conversation = &conversation
conversationReq.OperationID = req.OperationID
conversationReq.FieldType = constant.FieldGroupAtType
conversation.GroupAtType = constant.GroupNotification
conversationReq.UserIDList = cacheResp.UserIDList
nEtcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, http.WrapError(constant.ErrInternal)
}
nClient := pbConversation.NewConversationClient(nEtcdConn)
conversationReply, err := nClient.ModifyConversationField(context.Background(), &conversationReq)
if err != nil {
log.NewError(conversationReq.OperationID, "ModifyConversationField rpc failed, ", conversationReq.String(), err.Error())
} else if conversationReply.CommonResp.ErrCode != 0 {
log.NewError(conversationReq.OperationID, "ModifyConversationField rpc failed, ", conversationReq.String(), conversationReply.String())
}
} }
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil
} }
@ -1051,7 +1218,12 @@ func (s *groupServer) OperateUserRole(_ context.Context, req *pbGroup.OperateUse
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster failed", err.Error()) log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster failed", err.Error())
return resp, http.WrapError(constant.ErrDB) return resp, http.WrapError(constant.ErrDB)
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return resp, http.WrapError(constant.ErrInternal)
}
client := pbGroup.NewGroupClient(etcdConn) client := pbGroup.NewGroupClient(etcdConn)
var reqPb pbGroup.TransferGroupOwnerReq var reqPb pbGroup.TransferGroupOwnerReq
reqPb.OperationID = req.OperationID reqPb.OperationID = req.OperationID
@ -1132,7 +1304,12 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo
c.GroupID = req.GroupId c.GroupID = req.GroupId
c.IsNotInGroup = true c.IsNotInGroup = true
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return resp, http.WrapError(constant.ErrInternal)
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -1147,7 +1324,12 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo
GroupID: req.GroupId, GroupID: req.GroupId,
OperationID: req.OperationID, OperationID: req.OperationID,
} }
etcdConnCache := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConnCache := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConnCache == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return resp, http.WrapError(constant.ErrInternal)
}
cacheClient := pbCache.NewCacheClient(etcdConnCache) cacheClient := pbCache.NewCacheClient(etcdConnCache)
cacheResp, err := cacheClient.ReduceGroupMemberFromCache(context.Background(), reduceGroupMemberFromCacheReq) cacheResp, err := cacheClient.ReduceGroupMemberFromCache(context.Background(), reduceGroupMemberFromCacheReq)
if err != nil { if err != nil {
@ -1203,7 +1385,12 @@ func (s *groupServer) AddGroupMembersCMS(_ context.Context, req *pbGroup.AddGrou
GroupID: req.GroupId, GroupID: req.GroupId,
OperationID: req.OperationId, OperationID: req.OperationId,
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationId)
if etcdConn == nil {
errMsg := req.OperationId + "getcdv3.GetConn == nil"
log.NewError(req.OperationId, errMsg)
return resp, http.WrapError(constant.ErrInternal)
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq) cacheResp, err := cacheClient.AddGroupMemberToCache(context.Background(), addGroupMemberToCacheReq)
if err != nil { if err != nil {
@ -1267,6 +1454,12 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
log.NewError(req.OperationID, "OperateGroupStatus failed ", req.GroupID, constant.GroupStatusDismissed) log.NewError(req.OperationID, "OperateGroupStatus failed ", req.GroupID, constant.GroupStatusDismissed)
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
} }
groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.GroupID)
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
if groupInfo.GroupType != constant.SuperGroup {
memberList, err := imdb.GetGroupMemberListByGroupID(req.GroupID) memberList, err := imdb.GetGroupMemberListByGroupID(req.GroupID)
if err != nil { if err != nil {
log.NewError(req.OperationID, "GetGroupMemberListByGroupID failed,", err.Error(), req.GroupID) log.NewError(req.OperationID, "GetGroupMemberListByGroupID failed,", err.Error(), req.GroupID)
@ -1282,7 +1475,12 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
c.GroupID = req.GroupID c.GroupID = req.GroupID
c.IsNotInGroup = true c.IsNotInGroup = true
reqPb.Conversation = &c reqPb.Conversation = &c
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
client := pbUser.NewUserClient(etcdConn) client := pbUser.NewUserClient(etcdConn)
respPb, err := client.SetConversation(context.Background(), &reqPb) respPb, err := client.SetConversation(context.Background(), &reqPb)
if err != nil { if err != nil {
@ -1291,14 +1489,20 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String(), v.UserID) log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String(), v.UserID)
} }
} }
chat.GroupDismissedNotification(req)
err = imdb.DeleteGroupMemberByGroupID(req.GroupID) err = imdb.DeleteGroupMemberByGroupID(req.GroupID)
if err != nil {
log.NewError(req.OperationID, "DeleteGroupMemberByGroupID failed ", req.GroupID)
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
chat.GroupDismissedNotification(req)
} else {
err = db.DB.DeleteSuperGroup(req.GroupID)
if err != nil { if err != nil {
log.NewError(req.OperationID, "DeleteGroupMemberByGroupID failed ", req.GroupID) log.NewError(req.OperationID, "DeleteGroupMemberByGroupID failed ", req.GroupID)
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
} }
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""})
return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil
} }
@ -1310,14 +1514,36 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou
func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) { func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsManagerUserID(req.OpUserID) { opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID)
log.Error(req.OperationID, "verify failed ", req.GroupID, req.UserID) if err != nil {
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil errMsg := req.OperationID + " getGroupUserLevel failed " + req.GroupID + req.OpUserID + err.Error()
log.Error(req.OperationID, errMsg)
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
} }
if opFlag == 0 {
errMsg := req.OperationID + "opFlag == 0 " + req.GroupID + req.OpUserID
log.Error(req.OperationID, errMsg)
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
mutedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.UserID)
if err != nil {
errMsg := req.OperationID + " GetGroupMemberInfoByGroupIDAndUserID failed " + req.GroupID + req.UserID + err.Error()
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
if mutedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 {
errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupOwner " + req.GroupID + req.UserID
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
if mutedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 {
errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupAdmin " + req.GroupID + req.UserID
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
groupMemberInfo := db.GroupMember{GroupID: req.GroupID, UserID: req.UserID} groupMemberInfo := db.GroupMember{GroupID: req.GroupID, UserID: req.UserID}
groupMemberInfo.MuteEndTime = time.Unix(int64(time.Now().Second())+int64(req.MutedSeconds), time.Now().UnixNano()) groupMemberInfo.MuteEndTime = time.Unix(int64(time.Now().Second())+int64(req.MutedSeconds), time.Now().UnixNano())
err := imdb.UpdateGroupMemberInfo(groupMemberInfo) err = imdb.UpdateGroupMemberInfo(groupMemberInfo)
if err != nil { if err != nil {
log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo) log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo)
return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
@ -1329,13 +1555,36 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou
func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) { func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsManagerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.OpUserID, req.GroupID) opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil if err != nil {
errMsg := req.OperationID + " getGroupUserLevel failed " + req.GroupID + req.OpUserID + err.Error()
log.Error(req.OperationID, errMsg)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
} }
if opFlag == 0 {
errMsg := req.OperationID + "opFlag == 0 " + req.GroupID + req.OpUserID
log.Error(req.OperationID, errMsg)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
mutedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.UserID)
if err != nil {
errMsg := req.OperationID + " GetGroupMemberInfoByGroupIDAndUserID failed " + req.GroupID + req.UserID + err.Error()
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
if mutedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 {
errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupOwner " + req.GroupID + req.UserID
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
if mutedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 {
errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupAdmin " + req.GroupID + req.UserID
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
groupMemberInfo := db.GroupMember{GroupID: req.GroupID, UserID: req.UserID} groupMemberInfo := db.GroupMember{GroupID: req.GroupID, UserID: req.UserID}
groupMemberInfo.MuteEndTime = time.Unix(0, 0) groupMemberInfo.MuteEndTime = time.Unix(0, 0)
err := imdb.UpdateGroupMemberInfo(groupMemberInfo) err = imdb.UpdateGroupMemberInfo(groupMemberInfo)
if err != nil { if err != nil {
log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo) log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo)
return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
@ -1347,11 +1596,34 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca
func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) (*pbGroup.MuteGroupResp, error) { func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) (*pbGroup.MuteGroupResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsManagerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.GroupID, req.GroupID) opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID)
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil if err != nil {
errMsg := req.OperationID + " getGroupUserLevel failed " + req.GroupID + req.OpUserID + err.Error()
log.Error(req.OperationID, errMsg)
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
} }
err := imdb.OperateGroupStatus(req.GroupID, constant.GroupStatusMuted) if opFlag == 0 {
errMsg := req.OperationID + "opFlag == 0 " + req.GroupID + req.OpUserID
log.Error(req.OperationID, errMsg)
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
//mutedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.UserID)
//if err != nil {
// errMsg := req.OperationID + " GetGroupMemberInfoByGroupIDAndUserID failed " + req.GroupID + req.OpUserID + err.Error()
// return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
//}
//if mutedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 {
// errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupOwner " + req.GroupID + req.OpUserID + err.Error()
// return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
//}
//if mutedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 {
// errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupAdmin " + req.GroupID + req.OpUserID + err.Error()
// return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
//}
err = imdb.OperateGroupStatus(req.GroupID, constant.GroupStatusMuted)
if err != nil { if err != nil {
log.Error(req.OperationID, "OperateGroupStatus failed ", err.Error(), req.GroupID, constant.GroupStatusMuted) log.Error(req.OperationID, "OperateGroupStatus failed ", err.Error(), req.GroupID, constant.GroupStatusMuted)
return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
@ -1363,12 +1635,34 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq)
func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMuteGroupReq) (*pbGroup.CancelMuteGroupResp, error) { func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMuteGroupReq) (*pbGroup.CancelMuteGroupResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String())
if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsManagerUserID(req.OpUserID) {
log.Error(req.OperationID, "verify failed ", req.OpUserID, req.GroupID) opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID)
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil if err != nil {
errMsg := req.OperationID + " getGroupUserLevel failed " + req.GroupID + req.OpUserID + err.Error()
log.Error(req.OperationID, errMsg)
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
}
if opFlag == 0 {
errMsg := req.OperationID + "opFlag == 0 " + req.GroupID + req.OpUserID
log.Error(req.OperationID, errMsg)
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
} }
err := imdb.UpdateGroupInfoDefaultZero(req.GroupID, map[string]interface{}{"status": constant.GroupOk}) //mutedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.)
//if err != nil {
// errMsg := req.OperationID + " GetGroupMemberInfoByGroupIDAndUserID failed " + req.GroupID + req.OpUserID + err.Error()
// return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
//}
//if mutedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 {
// errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupOwner " + req.GroupID + req.OpUserID + err.Error()
// return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
//}
//if mutedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 {
// errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupAdmin " + req.GroupID + req.OpUserID + err.Error()
// return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil
//}
log.Debug(req.OperationID, "UpdateGroupInfoDefaultZero ", req.GroupID, map[string]interface{}{"status": constant.GroupOk})
err = imdb.UpdateGroupInfoDefaultZero(req.GroupID, map[string]interface{}{"status": constant.GroupOk})
if err != nil { if err != nil {
log.Error(req.OperationID, "UpdateGroupInfoDefaultZero failed ", err.Error(), req.GroupID) log.Error(req.OperationID, "UpdateGroupInfoDefaultZero failed ", err.Error(), req.GroupID)
return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
@ -1438,7 +1732,18 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg + ":" + err.Error() resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg + ":" + err.Error()
return resp, nil return resp, nil
} }
if req.RoleLevel != nil {
switch req.RoleLevel.Value {
case constant.GroupOrdinaryUsers:
//chat.GroupMemberRoleLevelChangeNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, constant.GroupMemberSetToOrdinaryUserNotification)
chat.GroupMemberInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID) chat.GroupMemberInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID)
case constant.GroupAdmin, constant.GroupOwner:
//chat.GroupMemberRoleLevelChangeNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, constant.GroupMemberSetToAdminNotification)
chat.GroupMemberInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID)
}
} else {
chat.GroupMemberInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID)
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil return resp, nil
} }

View File

@ -0,0 +1,64 @@
package group
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
cp "Open_IM/pkg/common/utils"
pbGroup "Open_IM/pkg/proto/group"
commonPb "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"context"
)
func (s *groupServer) GetJoinedSuperGroupList(ctx context.Context, req *pbGroup.GetJoinedSuperGroupListReq) (*pbGroup.GetJoinedSuperGroupListResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp := &pbGroup.GetJoinedSuperGroupListResp{CommonResp: &pbGroup.CommonResp{}}
userToSuperGroup, err := db.DB.GetSuperGroupByUserID(req.UserID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetSuperGroupByUserID failed", err.Error())
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
return resp, nil
}
for _, groupID := range userToSuperGroup.GroupIDList {
groupInfoDB, err := imdb.GetGroupInfoByGroupID(groupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupInfoByGroupID failed", groupID, err.Error())
continue
}
groupInfo := &commonPb.GroupInfo{}
if err := utils.CopyStructFields(groupInfo, groupInfoDB); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
}
group, err := db.DB.GetSuperGroup(groupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetSuperGroup failed", groupID, err.Error())
continue
}
groupInfo.MemberCount = uint32(len(group.MemberIDList))
resp.GroupList = append(resp.GroupList, groupInfo)
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil
}
func (s *groupServer) GetSuperGroupsInfo(_ context.Context, req *pbGroup.GetSuperGroupsInfoReq) (resp *pbGroup.GetSuperGroupsInfoResp, err error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp = &pbGroup.GetSuperGroupsInfoResp{CommonResp: &pbGroup.CommonResp{}}
groupsInfoList := make([]*commonPb.GroupInfo, 0)
for _, groupID := range req.GroupIDList {
groupInfoFromMysql, err := imdb.GetGroupInfoByGroupID(groupID)
if err != nil {
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupID)
continue
}
var groupInfo commonPb.GroupInfo
cp.GroupDBCopyOpenIM(&groupInfo, groupInfoFromMysql)
groupsInfoList = append(groupsInfoList, &groupInfo)
}
resp.GroupInfoList = groupsInfoList
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil
}

38
internal/rpc/msg/chat.go Normal file
View File

@ -0,0 +1,38 @@
package msg
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils"
"context"
)
func (rpc *rpcChat) ClearMsg(_ context.Context, req *pbChat.ClearMsgReq) (*pbChat.ClearMsgResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc req: ", req.String())
if req.OpUserID != req.UserID && !token_verify.IsManagerUserID(req.UserID) {
errMsg := "No permission" + req.OpUserID + req.UserID
log.Error(req.OperationID, errMsg)
return &pbChat.ClearMsgResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
}
log.Debug(req.OperationID, "CleanUpOneUserAllMsgFromRedis args", req.UserID)
err := db.DB.CleanUpOneUserAllMsgFromRedis(req.UserID, req.OperationID)
if err != nil {
errMsg := "CleanUpOneUserAllMsgFromRedis failed " + err.Error() + req.OperationID + req.UserID
log.Error(req.OperationID, errMsg)
return &pbChat.ClearMsgResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
}
log.Debug(req.OperationID, "CleanUpUserMsgFromMongo args", req.UserID)
err = db.DB.CleanUpUserMsgFromMongo(req.UserID, req.OperationID)
if err != nil {
errMsg := "CleanUpUserMsgFromMongo failed " + err.Error() + req.OperationID + req.UserID
log.Error(req.OperationID, errMsg)
return &pbChat.ClearMsgResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
}
resp := pbChat.ClearMsgResp{ErrCode: 0}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return &resp, nil
}

View File

@ -49,12 +49,6 @@ func ConversationSetPrivateNotification(operationID, sendID, recvID string, isPr
} }
var tips open_im_sdk.TipsComm var tips open_im_sdk.TipsComm
var tipsMsg string var tipsMsg string
//var senderName string
//senderName, err := im_mysql_model.GetUserNameByUserID(sendID)
//if err != nil {
// log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
// senderName = sendID
//}
if isPrivateChat == true { if isPrivateChat == true {
tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.OpenTips tipsMsg = config.Config.Notification.ConversationSetPrivate.DefaultTips.OpenTips
} else { } else {

View File

@ -36,7 +36,6 @@ func setOpUserInfo(opUserID, groupID string, groupMemberInfo *open_im_sdk.GroupM
return utils.Wrap(err, "") return utils.Wrap(err, "")
} }
} }
user, err := imdb.GetUserByUserID(opUserID) user, err := imdb.GetUserByUserID(opUserID)
if err != nil { if err != nil {
return utils.Wrap(err, "") return utils.Wrap(err, "")
@ -101,7 +100,7 @@ func setPublicUserInfo(userID string, publicUserInfo *open_im_sdk.PublicUserInfo
} }
func groupNotification(contentType int32, m proto.Message, sendID, groupID, recvUserID, operationID string) { func groupNotification(contentType int32, m proto.Message, sendID, groupID, recvUserID, operationID string) {
log.Info(operationID, utils.GetSelfFuncName(), "args: ", contentType) log.Info(operationID, utils.GetSelfFuncName(), "args: ", contentType, sendID, groupID, recvUserID)
var err error var err error
var tips open_im_sdk.TipsComm var tips open_im_sdk.TipsComm
@ -117,19 +116,19 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv
} }
tips.JsonDetail, _ = marshaler.MarshalToString(m) tips.JsonDetail, _ = marshaler.MarshalToString(m)
var nickname string
from, err := imdb.GetUserByUserID(sendID) from, err := imdb.GetUserByUserID(sendID)
if err != nil { if err != nil {
log.Error(operationID, "GetUserByUserID failed ", err.Error(), sendID) log.Error(operationID, "GetUserByUserID failed ", err.Error(), sendID)
} }
nickname := ""
if from != nil { if from != nil {
nickname = from.Nickname nickname = from.Nickname
} }
to, err := imdb.GetUserByUserID(recvUserID) to, err := imdb.GetUserByUserID(recvUserID)
if err != nil { if err != nil {
log.Error(operationID, "GetUserByUserID failed ", err.Error(), recvUserID) log.NewWarn(operationID, "GetUserByUserID failed ", err.Error(), recvUserID)
} }
toNickname := "" toNickname := ""
if to != nil { if to != nil {
@ -170,7 +169,10 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv
tips.DefaultTips = toNickname + "" + cn.GroupMemberCancelMuted.DefaultTips.Tips tips.DefaultTips = toNickname + "" + cn.GroupMemberCancelMuted.DefaultTips.Tips
case constant.GroupMemberInfoSetNotification: case constant.GroupMemberInfoSetNotification:
tips.DefaultTips = toNickname + "" + cn.GroupMemberInfoSet.DefaultTips.Tips tips.DefaultTips = toNickname + "" + cn.GroupMemberInfoSet.DefaultTips.Tips
case constant.GroupMemberSetToAdminNotification:
tips.DefaultTips = toNickname + "" + cn.GroupMemberSetToAdmin.DefaultTips.Tips
case constant.GroupMemberSetToOrdinaryUserNotification:
tips.DefaultTips = toNickname + "" + cn.GroupMemberSetToOrdinary.DefaultTips.Tips
default: default:
log.Error(operationID, "contentType failed ", contentType) log.Error(operationID, "contentType failed ", contentType)
return return
@ -225,12 +227,20 @@ func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberL
} }
//群信息改变后掉用 //群信息改变后掉用
func GroupInfoSetNotification(operationID, opUserID, groupID string) { //groupName := ""
// notification := ""
// introduction := ""
// faceURL := ""
func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName, notification, introduction, faceURL string) {
GroupInfoChangedTips := open_im_sdk.GroupInfoSetTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}} GroupInfoChangedTips := open_im_sdk.GroupInfoSetTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil { if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return return
} }
GroupInfoChangedTips.Group.GroupName = groupName
GroupInfoChangedTips.Group.Notification = notification
GroupInfoChangedTips.Group.Introduction = introduction
GroupInfoChangedTips.Group.FaceURL = faceURL
if err := setOpUserInfo(opUserID, groupID, GroupInfoChangedTips.OpUser); err != nil { if err := setOpUserInfo(opUserID, groupID, GroupInfoChangedTips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
return return
@ -303,6 +313,28 @@ func GroupMemberInfoSetNotification(operationID, opUserID, groupID, groupMemberU
groupNotification(constant.GroupMemberInfoSetNotification, &tips, opUserID, groupID, "", operationID) groupNotification(constant.GroupMemberInfoSetNotification, &tips, opUserID, groupID, "", operationID)
} }
func GroupMemberRoleLevelChangeNotification(operationID, opUserID, groupID, groupMemberUserID string, notificationType int32) {
if notificationType != constant.GroupMemberSetToAdminNotification && notificationType != constant.GroupMemberSetToOrdinaryUserNotification {
log.NewError(operationID, utils.GetSelfFuncName(), "invalid notificationType: ", notificationType)
return
}
tips := open_im_sdk.GroupMemberInfoSetTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, ChangedUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
}
if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil {
log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID)
return
}
if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.ChangedUser); err != nil {
log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID)
return
}
groupNotification(notificationType, &tips, opUserID, groupID, "", operationID)
}
func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMemberUserID string) { func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMemberUserID string) {
tips := open_im_sdk.GroupMemberCancelMutedTips{Group: &open_im_sdk.GroupInfo{}, tips := open_im_sdk.GroupMemberCancelMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}} OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}}

View File

@ -2,47 +2,55 @@ package msg
import ( import (
"context" "context"
"github.com/garyburd/redigo/redis" go_redis "github.com/go-redis/redis/v8"
commonDB "Open_IM/pkg/common/db" commonDB "Open_IM/pkg/common/db"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
pbMsg "Open_IM/pkg/proto/chat"
open_im_sdk "Open_IM/pkg/proto/sdk_ws" open_im_sdk "Open_IM/pkg/proto/sdk_ws"
) )
func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeqReq) (*pbMsg.GetMaxAndMinSeqResp, error) { func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *open_im_sdk.GetMaxAndMinSeqReq) (*open_im_sdk.GetMaxAndMinSeqResp, error) {
log.NewInfo(in.OperationID, "rpc getMaxAndMinSeq is arriving", in.String()) log.NewInfo(in.OperationID, "rpc getMaxAndMinSeq is arriving", in.String())
resp := new(open_im_sdk.GetMaxAndMinSeqResp)
m := make(map[string]*open_im_sdk.MaxAndMinSeq)
//seq, err := model.GetBiggestSeqFromReceive(in.UserID) //seq, err := model.GetBiggestSeqFromReceive(in.UserID)
maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID) maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID)
minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID) //minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID)
resp := new(pbMsg.GetMaxAndMinSeqResp)
if err1 == nil { if err1 == nil {
resp.MaxSeq = uint32(maxSeq) resp.MaxSeq = uint32(maxSeq)
} else if err1 == redis.ErrNil { for _, v := range in.GroupIDList {
x := new(open_im_sdk.MaxAndMinSeq)
maxSeq, _ := commonDB.DB.GetUserMaxSeq(v)
x.MaxSeq = uint32(maxSeq)
m[v] = x
}
resp.GroupMaxAndMinSeq = m
} else if err1 == go_redis.Nil {
resp.MaxSeq = 0 resp.MaxSeq = 0
} else { } else {
log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err1.Error()) log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err1.Error())
resp.ErrCode = 200 resp.ErrCode = 200
resp.ErrMsg = "redis get err" resp.ErrMsg = "redis get err"
} }
if err2 == nil { //if err2 == nil {
resp.MinSeq = uint32(minSeq) // resp.MinSeq = uint32(minSeq)
} else if err2 == redis.ErrNil { //} else if err2 == redis.ErrNil {
resp.MinSeq = 0 // resp.MinSeq = 0
} else { //} else {
log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err2.Error()) // log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err2.Error())
resp.ErrCode = 201 // resp.ErrCode = 201
resp.ErrMsg = "redis get err" // resp.ErrMsg = "redis get err"
} //}
return resp, nil return resp, nil
} }
func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.PullMessageBySeqListReq) (*open_im_sdk.PullMessageBySeqListResp, error) { func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.PullMessageBySeqListReq) (*open_im_sdk.PullMessageBySeqListResp, error) {
log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String()) log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String())
resp := new(open_im_sdk.PullMessageBySeqListResp) resp := new(open_im_sdk.PullMessageBySeqListResp)
m := make(map[string]*open_im_sdk.MsgDataList)
//msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList, in.OperationID) //msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList, in.OperationID)
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(in.UserID, in.SeqList, in.OperationID) redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(in.UserID, in.SeqList, in.OperationID)
if err != nil { if err != nil {
if err != redis.ErrNil { if err != go_redis.Nil {
log.Error(in.OperationID, "get message from redis exception", err.Error(), failedSeqList) log.Error(in.OperationID, "get message from redis exception", err.Error(), failedSeqList)
} else { } else {
log.Debug(in.OperationID, "get message from redis is nil", failedSeqList) log.Debug(in.OperationID, "get message from redis is nil", failedSeqList)
@ -60,6 +68,32 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.Pull
} else { } else {
resp.List = redisMsgList resp.List = redisMsgList
} }
for k, v := range in.GroupSeqList {
x := new(open_im_sdk.MsgDataList)
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(k, v.SeqList, in.OperationID)
if err != nil {
if err != go_redis.Nil {
log.Error(in.OperationID, "get message from redis exception", err.Error(), failedSeqList)
} else {
log.Debug(in.OperationID, "get message from redis is nil", failedSeqList)
}
msgList, err1 := commonDB.DB.GetSuperGroupMsgBySeqListMongo(k, failedSeqList, in.OperationID)
if err1 != nil {
log.Error(in.OperationID, "PullMessageBySeqList data error", in.String(), err.Error())
resp.ErrCode = 201
resp.ErrMsg = err.Error()
return resp, nil
} else {
redisMsgList = append(redisMsgList, msgList...)
x.MsgDataList = redisMsgList
m[k] = x
}
} else {
x.MsgDataList = redisMsgList
m[k] = x
}
}
resp.GroupMsgDataList = m
//respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID) //respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID)
//respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat) //respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat)
return resp, nil return resp, nil

View File

@ -15,7 +15,7 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"errors" "errors"
"github.com/garyburd/redigo/redis" go_redis "github.com/go-redis/redis/v8"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"math/rand" "math/rand"
"strconv" "strconv"
@ -68,12 +68,22 @@ func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) {
} }
func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string) { func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string) {
if data.MsgData.SessionType == constant.GroupChatType { if data.MsgData.SessionType == constant.SingleChatType {
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
return true, 0, ""
}
if data.MsgData.ContentType <= constant.FriendApplicationNotification && data.MsgData.ContentType >= constant.FriendApplicationApprovedNotification {
return true, 0, "" return true, 0, ""
} }
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify) log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
if etcdConn == nil {
errMsg := data.OperationID + "getcdv3.GetConn == nil"
log.NewError(data.OperationID, errMsg)
return true, 0, ""
}
cacheClient := cacheRpc.NewCacheClient(etcdConn) cacheClient := cacheRpc.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.GetBlackIDListFromCache(context.Background(), reqGetBlackIDListFromCache) cacheResp, err := cacheClient.GetBlackIDListFromCache(context.Background(), reqGetBlackIDListFromCache)
if err != nil { if err != nil {
@ -90,7 +100,12 @@ func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string)
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify) log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
if config.Config.MessageVerify.FriendVerify { if config.Config.MessageVerify.FriendVerify {
reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
if etcdConn == nil {
errMsg := data.OperationID + "getcdv3.GetConn == nil"
log.NewError(data.OperationID, errMsg)
return true, 0, ""
}
cacheClient := cacheRpc.NewCacheClient(etcdConn) cacheClient := cacheRpc.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.GetFriendIDListFromCache(context.Background(), reqGetFriendIDListFromCache) cacheResp, err := cacheClient.GetFriendIDListFromCache(context.Background(), reqGetFriendIDListFromCache)
if err != nil { if err != nil {
@ -108,6 +123,10 @@ func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string)
} else { } else {
return true, 0, "" return true, 0, ""
} }
} else {
return true, 0, ""
}
} }
func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) { func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) {
msg.ServerMsgID = GetMsgID(msg.SendID) msg.ServerMsgID = GetMsgID(msg.SendID)
@ -155,30 +174,29 @@ func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) {
utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false)
utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false)
utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false)
} }
} }
func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, error) { func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, error) {
replay := pbChat.SendMsgResp{} replay := pbChat.SendMsgResp{}
newTime := db.GetCurrentTimestampByMill() newTime := db.GetCurrentTimestampByMill()
log.NewWarn(pb.OperationID, "rpc sendMsg come here", pb.String(), pb.MsgData.ClientMsgID) log.Info(pb.OperationID, "rpc sendMsg come here ", pb.String())
flag, errCode, errMsg := isMessageHasReadEnabled(pb) flag, errCode, errMsg := isMessageHasReadEnabled(pb)
log.Info(pb.OperationID, "isMessageHasReadEnabled ", flag)
if !flag { if !flag {
return returnMsg(&replay, pb, errCode, errMsg, "", 0) return returnMsg(&replay, pb, errCode, errMsg, "", 0)
} }
log.Debug(pb.OperationID, "flag ", flag, config.Config.SingleMessageHasReadReceiptEnable, config.Config.GroupMessageHasReadReceiptEnable)
flag, errCode, errMsg = userRelationshipVerification(pb) flag, errCode, errMsg = userRelationshipVerification(pb)
log.Info(pb.OperationID, "userRelationshipVerification ", flag)
if !flag { if !flag {
return returnMsg(&replay, pb, errCode, errMsg, "", 0) return returnMsg(&replay, pb, errCode, errMsg, "", 0)
} }
rpc.encapsulateMsgData(pb.MsgData) rpc.encapsulateMsgData(pb.MsgData)
log.Info("", "this is a test MsgData ", pb.MsgData)
msgToMQSingle := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData} msgToMQSingle := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData}
// callback // callback
callbackResp := callbackWordFilter(pb) callbackResp := callbackWordFilter(pb)
log.Info(pb.OperationID, "callbackWordFilter ", callbackResp)
if callbackResp.ErrCode != 0 { if callbackResp.ErrCode != 0 {
log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackWordFilter resp: ", callbackResp) log.Error(pb.OperationID, utils.GetSelfFuncName(), "callbackWordFilter resp: ", callbackResp)
} }
log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackResp: ", callbackResp) log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackResp: ", callbackResp)
if callbackResp.ActionCode != constant.ActionAllow { if callbackResp.ActionCode != constant.ActionAllow {
@ -208,7 +226,7 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
log.NewInfo(msgToMQSingle.OperationID, msgToMQSingle) log.NewInfo(msgToMQSingle.OperationID, msgToMQSingle)
err1 := rpc.sendMsgToKafka(&msgToMQSingle, msgToMQSingle.MsgData.RecvID, constant.OnlineStatus) err1 := rpc.sendMsgToKafka(&msgToMQSingle, msgToMQSingle.MsgData.RecvID, constant.OnlineStatus)
if err1 != nil { if err1 != nil {
log.NewError(msgToMQSingle.OperationID, "kafka send msg err:RecvID", msgToMQSingle.MsgData.RecvID, msgToMQSingle.String()) log.NewError(msgToMQSingle.OperationID, "kafka send msg err :RecvID", msgToMQSingle.MsgData.RecvID, msgToMQSingle.String(), err1.Error())
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
} }
} }
@ -239,7 +257,12 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0) return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0)
} }
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: pb.OperationID, GroupID: pb.MsgData.GroupID} getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: pb.OperationID, GroupID: pb.MsgData.GroupID}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, msgToMQSingle.OperationID)
if etcdConn == nil {
errMsg := msgToMQSingle.OperationID + "getcdv3.GetConn == nil"
log.NewError(msgToMQSingle.OperationID, errMsg)
return returnMsg(&replay, pb, 201, errMsg, "", 0)
}
client := pbCache.NewCacheClient(etcdConn) client := pbCache.NewCacheClient(etcdConn)
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq) cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
if err != nil { if err != nil {
@ -347,7 +370,12 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
conversationReq.UserIDList = pb.MsgData.AtUserIDList conversationReq.UserIDList = pb.MsgData.AtUserIDList
conversation.GroupAtType = constant.AtMe conversation.GroupAtType = constant.AtMe
} }
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID)
if etcdConn == nil {
errMsg := pb.OperationID + "getcdv3.GetConn == nil"
log.NewError(pb.OperationID, errMsg)
return
}
client := pbConversation.NewConversationClient(etcdConn) client := pbConversation.NewConversationClient(etcdConn)
conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq) conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq)
if err != nil { if err != nil {
@ -358,7 +386,12 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
if tag { if tag {
conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList) conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList)
conversation.GroupAtType = constant.AtAll conversation.GroupAtType = constant.AtAll
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID)
if etcdConn == nil {
errMsg := pb.OperationID + "getcdv3.GetConn == nil"
log.NewError(pb.OperationID, errMsg)
return
}
client := pbConversation.NewConversationClient(etcdConn) client := pbConversation.NewConversationClient(etcdConn)
conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq) conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq)
if err != nil { if err != nil {
@ -391,6 +424,34 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
log.Debug(pb.OperationID, "send msg cost time ", db.GetCurrentTimestampByMill()-newTime, pb.MsgData.ClientMsgID) log.Debug(pb.OperationID, "send msg cost time ", db.GetCurrentTimestampByMill()-newTime, pb.MsgData.ClientMsgID)
return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime) return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime)
case constant.SuperGroupChatType:
// callback
callbackResp := callbackBeforeSendSingleMsg(pb)
if callbackResp.ErrCode != 0 {
log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSuperGroupMsg resp: ", callbackResp)
}
if callbackResp.ActionCode != constant.ActionAllow {
if callbackResp.ErrCode == 0 {
callbackResp.ErrCode = 201
}
log.NewDebug(pb.OperationID, utils.GetSelfFuncName(), "callbackBeforeSendSuperGroupMsg result", "end rpc and return", callbackResp)
return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0)
}
msgToMQSingle.MsgData = pb.MsgData
log.NewInfo(msgToMQSingle.OperationID, msgToMQSingle)
err1 := rpc.sendMsgToKafka(&msgToMQSingle, msgToMQSingle.MsgData.GroupID, constant.OnlineStatus)
if err1 != nil {
log.NewError(msgToMQSingle.OperationID, "kafka send msg err:RecvID", msgToMQSingle.MsgData.RecvID, msgToMQSingle.String())
return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0)
}
// callback
callbackResp = callbackAfterSendSingleMsg(pb)
if callbackResp.ErrCode != 0 {
log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendSuperGroupMsg resp: ", callbackResp)
}
return returnMsg(&replay, pb, 0, "", msgToMQSingle.MsgData.ServerMsgID, msgToMQSingle.MsgData.SendTime)
default: default:
return returnMsg(&replay, pb, 203, "unknown sessionType", "", 0) return returnMsg(&replay, pb, 203, "unknown sessionType", "", 0)
} }
@ -430,13 +491,29 @@ func returnMsg(replay *pbChat.SendMsgResp, pb *pbChat.SendMsgReq, errCode int32,
} }
func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, pb *pbChat.SendMsgReq) bool { func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, pb *pbChat.SendMsgReq) bool {
conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) opt, err := db.DB.GetUserGlobalMsgRecvOpt(userID)
opt, err := db.DB.GetSingleConversationRecvMsgOpt(userID, conversationID) if err != nil {
if err != nil && err != redis.ErrNil { log.NewError(pb.OperationID, "GetUserGlobalMsgRecvOpt from redis err", userID, pb.String(), err.Error())
log.NewError(pb.OperationID, "GetSingleConversationMsgOpt from redis err", conversationID, pb.String(), err.Error())
return true
} }
switch opt { switch opt {
case constant.ReceiveMessage:
case constant.NotReceiveMessage:
return false
case constant.ReceiveNotNotifyMessage:
if pb.MsgData.Options == nil {
pb.MsgData.Options = make(map[string]bool, 10)
}
utils.SetSwitchFromOptions(pb.MsgData.Options, constant.IsOfflinePush, false)
return true
}
conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType)
singleOpt, sErr := db.DB.GetSingleConversationRecvMsgOpt(userID, conversationID)
if sErr != nil && sErr != go_redis.Nil {
log.NewError(pb.OperationID, "GetSingleConversationMsgOpt from redis err", conversationID, pb.String(), sErr.Error())
return true
}
switch singleOpt {
case constant.ReceiveMessage: case constant.ReceiveMessage:
return true return true
case constant.NotReceiveMessage: case constant.NotReceiveMessage:
@ -455,7 +532,7 @@ func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType i
func modifyMessageByUserMessageReceiveOptoptimization(userID, sourceID string, sessionType int, operationID string, options *map[string]bool) bool { func modifyMessageByUserMessageReceiveOptoptimization(userID, sourceID string, sessionType int, operationID string, options *map[string]bool) bool {
conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType)
opt, err := db.DB.GetSingleConversationRecvMsgOpt(userID, conversationID) opt, err := db.DB.GetSingleConversationRecvMsgOpt(userID, conversationID)
if err != nil && err != redis.ErrNil { if err != nil && err != go_redis.Nil {
log.NewError(operationID, "GetSingleConversationMsgOpt from redis err", userID, conversationID, err.Error()) log.NewError(operationID, "GetSingleConversationMsgOpt from redis err", userID, conversationID, err.Error())
return true return true
} }
@ -503,7 +580,7 @@ func Notification(n *NotificationMsg) {
msg.ClientMsgID = utils.GetMsgID(n.SendID) msg.ClientMsgID = utils.GetMsgID(n.SendID)
msg.Options = make(map[string]bool, 7) msg.Options = make(map[string]bool, 7)
switch n.SessionType { switch n.SessionType {
case constant.GroupChatType: case constant.GroupChatType, constant.SuperGroupChatType:
msg.RecvID = "" msg.RecvID = ""
msg.GroupID = n.RecvID msg.GroupID = n.RecvID
} }
@ -724,6 +801,8 @@ func Notification(n *NotificationMsg) {
unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount unReadCount = config.Config.Notification.ConversationSetPrivate.Conversation.UnreadCount
case constant.DeleteMessageNotification: case constant.DeleteMessageNotification:
reliabilityLevel = constant.ReliableNotificationNoMsg reliabilityLevel = constant.ReliableNotificationNoMsg
case constant.SuperGroupUpdateNotification:
reliabilityLevel = constant.UnreliableNotification
} }
switch reliabilityLevel { switch reliabilityLevel {
case constant.UnreliableNotification: case constant.UnreliableNotification:
@ -744,7 +823,13 @@ func Notification(n *NotificationMsg) {
offlineInfo.Ex = ex offlineInfo.Ex = ex
msg.OfflinePushInfo = &offlineInfo msg.OfflinePushInfo = &offlineInfo
req.MsgData = &msg req.MsgData = &msg
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
reply, err := client.SendMsg(context.Background(), &req) reply, err := client.SendMsg(context.Background(), &req)
if err != nil { if err != nil {

View File

@ -0,0 +1,37 @@
package msg
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
//sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
//"github.com/golang/protobuf/jsonpb"
//"github.com/golang/protobuf/proto"
)
func SuperGroupNotification(operationID, sendID, groupID string) {
//var tips sdk.TipsComm
//var err error
//marshaler := jsonpb.Marshaler{
// OrigName: true,
// EnumsAsInts: false,
// EmitDefaults: false,
//}
//tips.JsonDetail, _ = marshaler.MarshalToString(m)
n := &NotificationMsg{
SendID: sendID,
RecvID: groupID,
MsgFrom: constant.SysMsgType,
ContentType: constant.SuperGroupUpdateNotification,
SessionType: constant.SuperGroupChatType,
OperationID: operationID,
}
//n.Content, err = proto.Marshal(&tips)
//if err != nil {
// log.NewError(operationID, utils.GetSelfFuncName(), "proto.Marshal failed")
// return
//}
log.NewInfo(operationID, utils.GetSelfFuncName(), string(n.Content))
Notification(n)
}

View File

@ -33,7 +33,13 @@ func TagSendMessage(operationID string, user *db.User, recvID, content string, s
msgData.SenderPlatformID = senderPlatformID msgData.SenderPlatformID = senderPlatformID
req.MsgData = &msgData req.MsgData = &msgData
req.OperationID = operationID req.OperationID = operationID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, operationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return
}
client := pbChat.NewChatClient(etcdConn) client := pbChat.NewChatClient(etcdConn)
respPb, err := client.SendMsg(context.Background(), &req) respPb, err := client.SendMsg(context.Background(), &req)
if err != nil { if err != nil {

View File

@ -205,7 +205,15 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR
} }
var groupUserIDList []string var groupUserIDList []string
for _, groupID := range req.GroupList { for _, groupID := range req.GroupList {
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
resp.CommonResp.ErrCode = constant.ErrInternal.ErrCode
resp.CommonResp.ErrMsg = errMsg
return resp, nil
}
cacheClient := pbCache.NewCacheClient(etcdConn) cacheClient := pbCache.NewCacheClient(etcdConn)
req := pbCache.GetGroupMemberIDListFromCacheReq{ req := pbCache.GetGroupMemberIDListFromCacheReq{
OperationID: req.OperationID, OperationID: req.OperationID,

View File

@ -102,7 +102,7 @@ func (s *organizationServer) CreateDepartment(ctx context.Context, req *rpc.Crea
log.Error(req.OperationID, errMsg) log.Error(req.OperationID, errMsg)
return &rpc.CreateDepartmentResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil return &rpc.CreateDepartmentResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
} }
err, createdDepartment := imdb.GetDepartment(department.DepartmentID) createdDepartment, err := imdb.GetDepartment(department.DepartmentID)
if err != nil { if err != nil {
errMsg := req.OperationID + " " + "GetDepartment failed " + err.Error() + department.DepartmentID errMsg := req.OperationID + " " + "GetDepartment failed " + err.Error() + department.DepartmentID
log.Error(req.OperationID, errMsg) log.Error(req.OperationID, errMsg)
@ -114,19 +114,29 @@ func (s *organizationServer) CreateDepartment(ctx context.Context, req *rpc.Crea
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc return ", *resp) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc return ", *resp)
chat.OrganizationNotificationToAll(req.OpUserID, req.OperationID) chat.OrganizationNotificationToAll(req.OpUserID, req.OperationID)
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
resp.ErrCode = constant.ErrInternal.ErrCode
resp.ErrMsg = errMsg
return resp, nil
}
client := groupRpc.NewGroupClient(etcdConn) client := groupRpc.NewGroupClient(etcdConn)
createGroupReq := &groupRpc.CreateGroupReq{ createGroupReq := &groupRpc.CreateGroupReq{
InitMemberList: nil, InitMemberList: []*groupRpc.GroupAddMemberInfo{},
GroupInfo: &open_im_sdk.GroupInfo{ GroupInfo: &open_im_sdk.GroupInfo{
Introduction: req.DepartmentInfo.Name,
GroupName: req.DepartmentInfo.Name, GroupName: req.DepartmentInfo.Name,
FaceURL: req.DepartmentInfo.FaceURL, FaceURL: req.DepartmentInfo.FaceURL,
CreateTime: uint32(time.Now().Unix()), CreateTime: uint32(time.Now().Unix()),
CreatorUserID: req.OpUserID, CreatorUserID: req.OpUserID,
GroupType: constant.DepartmentGroup, GroupType: constant.NormalGroup,
OwnerUserID: req.OpUserID,
}, },
OperationID: req.OperationID, OperationID: req.OperationID,
OpUserID: req.OpUserID, OpUserID: req.OpUserID,
OwnerUserID: req.OpUserID,
} }
createGroupResp, err := client.CreateGroup(context.Background(), createGroupReq) createGroupResp, err := client.CreateGroup(context.Background(), createGroupReq)
if err != nil { if err != nil {
@ -141,6 +151,9 @@ func (s *organizationServer) CreateDepartment(ctx context.Context, req *rpc.Crea
resp.ErrMsg = constant.ErrDB.ErrMsg + " createGroup failed " + createGroupResp.ErrMsg resp.ErrMsg = constant.ErrDB.ErrMsg + " createGroup failed " + createGroupResp.ErrMsg
return resp, nil return resp, nil
} }
if err := imdb.SetDepartmentRelatedGroupID(createGroupResp.GroupInfo.GroupID, department.DepartmentID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetDepartmentRelatedGroupID failed", err.Error())
}
return resp, nil return resp, nil
} }
@ -221,9 +234,14 @@ func (s *organizationServer) CreateOrganizationUser(ctx context.Context, req *rp
authReq := &pbAuth.UserRegisterReq{UserInfo: &open_im_sdk.UserInfo{}} authReq := &pbAuth.UserRegisterReq{UserInfo: &open_im_sdk.UserInfo{}}
utils.CopyStructFields(authReq.UserInfo, req.OrganizationUser) utils.CopyStructFields(authReq.UserInfo, req.OrganizationUser)
authReq.OperationID = req.OperationID authReq.OperationID = req.OperationID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) if req.IsRegister {
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &rpc.CreateOrganizationUserResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
client := pbAuth.NewAuthClient(etcdConn) client := pbAuth.NewAuthClient(etcdConn)
reply, err := client.UserRegister(context.Background(), authReq) reply, err := client.UserRegister(context.Background(), authReq)
if err != nil { if err != nil {
errMsg := "UserRegister failed " + err.Error() errMsg := "UserRegister failed " + err.Error()
@ -235,7 +253,7 @@ func (s *organizationServer) CreateOrganizationUser(ctx context.Context, req *rp
log.NewError(req.OperationID, errMsg) log.NewError(req.OperationID, errMsg)
return &rpc.CreateOrganizationUserResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil return &rpc.CreateOrganizationUserResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
} }
}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
if !token_verify.IsManagerUserID(req.OpUserID) { if !token_verify.IsManagerUserID(req.OpUserID) {
errMsg := req.OperationID + " " + req.OpUserID + " is not app manager" errMsg := req.OperationID + " " + req.OpUserID + " is not app manager"
@ -246,7 +264,7 @@ func (s *organizationServer) CreateOrganizationUser(ctx context.Context, req *rp
utils.CopyStructFields(&organizationUser, req.OrganizationUser) utils.CopyStructFields(&organizationUser, req.OrganizationUser)
organizationUser.Birth = utils.UnixSecondToTime(int64(req.OrganizationUser.Birth)) organizationUser.Birth = utils.UnixSecondToTime(int64(req.OrganizationUser.Birth))
log.Debug(req.OperationID, "src ", *req.OrganizationUser, "dst ", organizationUser) log.Debug(req.OperationID, "src ", *req.OrganizationUser, "dst ", organizationUser)
err = imdb.CreateOrganizationUser(&organizationUser) err := imdb.CreateOrganizationUser(&organizationUser)
if err != nil { if err != nil {
errMsg := req.OperationID + " " + "CreateOrganizationUser failed " + err.Error() errMsg := req.OperationID + " " + "CreateOrganizationUser failed " + err.Error()
log.Error(req.OperationID, errMsg, organizationUser) log.Error(req.OperationID, errMsg, organizationUser)
@ -263,7 +281,12 @@ func (s *organizationServer) UpdateOrganizationUser(ctx context.Context, req *rp
authReq := &pbAuth.UserRegisterReq{UserInfo: &open_im_sdk.UserInfo{}} authReq := &pbAuth.UserRegisterReq{UserInfo: &open_im_sdk.UserInfo{}}
utils.CopyStructFields(authReq.UserInfo, req.OrganizationUser) utils.CopyStructFields(authReq.UserInfo, req.OrganizationUser)
authReq.OperationID = req.OperationID authReq.OperationID = req.OperationID
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &rpc.UpdateOrganizationUserResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil
}
client := pbAuth.NewAuthClient(etcdConn) client := pbAuth.NewAuthClient(etcdConn)
reply, err := client.UserRegister(context.Background(), authReq) reply, err := client.UserRegister(context.Background(), authReq)
@ -340,13 +363,14 @@ func (s *organizationServer) CreateDepartmentMember(ctx context.Context, req *rp
func (s *organizationServer) GetDepartmentParentIDList(_ context.Context, req *rpc.GetDepartmentParentIDListReq) (resp *rpc.GetDepartmentParentIDListResp, err error) { func (s *organizationServer) GetDepartmentParentIDList(_ context.Context, req *rpc.GetDepartmentParentIDListReq) (resp *rpc.GetDepartmentParentIDListResp, err error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req.String())
resp = &rpc.GetDepartmentParentIDListResp{} resp = &rpc.GetDepartmentParentIDListResp{}
resp.ParentIDList, err = imdb.GetDepartmentParentIDList(req.DepartmentID) parentIDList, err := imdb.GetDepartmentParentIDList(req.DepartmentID)
if err != nil { if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetDepartmentParentIDList failed", err.Error()) log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetDepartmentParentIDList failed", err.Error())
resp.ErrMsg = constant.ErrDB.ErrMsg + ": " + err.Error() resp.ErrMsg = constant.ErrDB.ErrMsg + ": " + err.Error()
resp.ErrCode = constant.ErrDB.ErrCode resp.ErrCode = constant.ErrDB.ErrCode
return resp, nil return resp, nil
} }
resp.ParentIDList = parentIDList
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp:", resp.String()) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp:", resp.String())
return resp, nil return resp, nil
} }

View File

@ -383,12 +383,19 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
if req.UserInfo.Birth != 0 { if req.UserInfo.Birth != 0 {
user.Birth = utils.UnixSecondToTime(int64(req.UserInfo.Birth)) user.Birth = utils.UnixSecondToTime(int64(req.UserInfo.Birth))
} }
err := imdb.UpdateUserInfo(user) err := imdb.UpdateUserInfo(user)
if err != nil { if err != nil {
log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user) log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user)
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.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, req.OperationID)
if etcdConn == nil {
errMsg := req.OperationID + "getcdv3.GetConn == nil"
log.NewError(req.OperationID, errMsg)
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil
}
client := pbFriend.NewFriendClient(etcdConn) client := pbFriend.NewFriendClient(etcdConn)
newReq := &pbFriend.GetFriendListReq{ newReq := &pbFriend.GetFriendListReq{
CommID: &pbFriend.CommID{OperationID: req.OperationID, FromUserID: req.UserInfo.UserID, OpUserID: req.OpUserID}, CommID: &pbFriend.CommID{OperationID: req.OperationID, FromUserID: req.UserInfo.UserID, OpUserID: req.OpUserID},
@ -426,7 +433,28 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
//} //}
return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{}}, nil return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{}}, nil
} }
func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbUser.SetGlobalRecvMessageOptReq) (*pbUser.SetGlobalRecvMessageOptResp, error) {
log.NewInfo(req.OperationID, "SetGlobalRecvMessageOpt args ", req.String())
var user db.User
user.UserID = req.UserID
m := make(map[string]interface{}, 1)
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), req.GlobalRecvMsgOpt, "set GlobalRecvMsgOpt")
m["global_recv_msg_opt"] = req.GlobalRecvMsgOpt
err := db.DB.SetUserGlobalMsgRecvOpt(user.UserID, req.GlobalRecvMsgOpt)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetGlobalRecvMessageOpt failed ", err.Error(), user)
return &pbUser.SetGlobalRecvMessageOptResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
err = imdb.UpdateUserInfoByMap(user, m)
if err != nil {
log.NewError(req.OperationID, "SetGlobalRecvMessageOpt failed ", err.Error(), user)
return &pbUser.SetGlobalRecvMessageOptResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
chat.UserInfoUpdatedNotification(req.OperationID, req.UserID, req.UserID)
return &pbUser.SetGlobalRecvMessageOptResp{CommonResp: &pbUser.CommonResp{}}, nil
}
func (s *userServer) SyncJoinedGroupMemberFaceURL(userID string, faceURL string, operationID string, opUserID string) { func (s *userServer) SyncJoinedGroupMemberFaceURL(userID string, faceURL string, operationID string, opUserID string) {
joinedGroupIDList, err := imdb.GetJoinedGroupIDListByUserID(userID) joinedGroupIDList, err := imdb.GetJoinedGroupIDListByUserID(userID)
if err != nil { if err != nil {

View File

@ -38,6 +38,16 @@ type UserTokenResp struct {
UserToken UserTokenInfo `json:"data"` UserToken UserTokenInfo `json:"data"`
} }
type ForceLogoutReq struct {
Platform int32 `json:"platform" binding:"required,min=1,max=8"`
FromUserID string `json:"fromUserID" binding:"required,min=1,max=64"`
OperationID string `json:"operationID" binding:"required"`
}
type ForceLogoutResp struct {
CommResp
}
type ParseTokenReq struct { type ParseTokenReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }

View File

@ -10,3 +10,12 @@ type DelMsgReq struct {
type DelMsgResp struct { type DelMsgResp struct {
CommResp CommResp
} }
type CleanUpMsgReq struct {
UserID string `json:"userID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type CleanUpMsgResp struct {
CommResp
}

View File

@ -0,0 +1,17 @@
package base_info
type GetJoinedSuperGroupListReq struct {
GetJoinedGroupListReq
}
type GetJoinedSuperGroupListResp struct {
GetJoinedGroupListResp
}
type GetSuperGroupsInfoReq struct {
GetGroupInfoReq
}
type GetSuperGroupsInfoResp struct {
GetGroupInfoResp
}

View File

@ -18,7 +18,13 @@ type UpdateSelfUserInfoReq struct {
ApiUserInfo ApiUserInfo
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
} }
type SetGlobalRecvMessageOptReq struct {
OperationID string `json:"operationID" binding:"required"`
GlobalRecvMsgOpt *int32 `json:"globalRecvMsgOpt" binding:"omitempty,oneof=0 1 2"`
}
type SetGlobalRecvMessageOptResp struct {
CommResp
}
type UpdateUserInfoResp struct { type UpdateUserInfoResp struct {
CommResp CommResp
} }

View File

@ -86,7 +86,7 @@ type config struct {
} }
Mongo struct { Mongo struct {
DBUri string `yaml:"dbUri"` DBUri string `yaml:"dbUri"`
DBAddress []string `yaml:"dbAddress"` DBAddress string `yaml:"dbAddress"`
DBDirect bool `yaml:"dbDirect"` DBDirect bool `yaml:"dbDirect"`
DBTimeout int `yaml:"dbTimeout"` DBTimeout int `yaml:"dbTimeout"`
DBDatabase string `yaml:"dbDatabase"` DBDatabase string `yaml:"dbDatabase"`
@ -97,11 +97,12 @@ type config struct {
DBRetainChatRecords int `yaml:"dbRetainChatRecords"` DBRetainChatRecords int `yaml:"dbRetainChatRecords"`
} }
Redis struct { Redis struct {
DBAddress string `yaml:"dbAddress"` DBAddress []string `yaml:"dbAddress"`
DBMaxIdle int `yaml:"dbMaxIdle"` DBMaxIdle int `yaml:"dbMaxIdle"`
DBMaxActive int `yaml:"dbMaxActive"` DBMaxActive int `yaml:"dbMaxActive"`
DBIdleTimeout int `yaml:"dbIdleTimeout"` DBIdleTimeout int `yaml:"dbIdleTimeout"`
DBPassWord string `yaml:"dbPassWord"` DBPassWord string `yaml:"dbPassWord"`
EnableCluster bool `yaml:"enableCluster"`
} }
RpcPort struct { RpcPort struct {
OpenImUserPort []int `yaml:"openImUserPort"` OpenImUserPort []int `yaml:"openImUserPort"`
@ -192,6 +193,7 @@ type config struct {
Manager struct { Manager struct {
AppManagerUid []string `yaml:"appManagerUid"` AppManagerUid []string `yaml:"appManagerUid"`
Secrets []string `yaml:"secrets"` Secrets []string `yaml:"secrets"`
AppSysNotificationName string `yaml:"appSysNotificationName"`
} }
Kafka struct { Kafka struct {
@ -203,13 +205,17 @@ type config struct {
Addr []string `yaml:"addr"` Addr []string `yaml:"addr"`
Topic string `yaml:"topic"` Topic string `yaml:"topic"`
} }
MsgToMongo struct {
Addr []string `yaml:"addr"`
Topic string `yaml:"topic"`
}
Ms2pschat struct { Ms2pschat struct {
Addr []string `yaml:"addr"` Addr []string `yaml:"addr"`
Topic string `yaml:"topic"` Topic string `yaml:"topic"`
} }
ConsumerGroupID struct { ConsumerGroupID struct {
MsgToRedis string `yaml:"msgToTransfer"`
MsgToMongo string `yaml:"msgToMongo"` MsgToMongo string `yaml:"msgToMongo"`
MsgToMongoOffline string `yaml:"msgToMongoOffline"`
MsgToMySql string `yaml:"msgToMySql"` MsgToMySql string `yaml:"msgToMySql"`
MsgToPush string `yaml:"msgToPush"` MsgToPush string `yaml:"msgToPush"`
} }
@ -221,6 +227,7 @@ type config struct {
MsgCacheTimeout int `yaml:"msgCacheTimeout"` MsgCacheTimeout int `yaml:"msgCacheTimeout"`
GroupMessageHasReadReceiptEnable bool `yaml:"groupMessageHasReadReceiptEnable"` GroupMessageHasReadReceiptEnable bool `yaml:"groupMessageHasReadReceiptEnable"`
SingleMessageHasReadReceiptEnable bool `yaml:"singleMessageHasReadReceiptEnable"` SingleMessageHasReadReceiptEnable bool `yaml:"singleMessageHasReadReceiptEnable"`
TokenPolicy struct { TokenPolicy struct {
AccessSecret string `yaml:"accessSecret"` AccessSecret string `yaml:"accessSecret"`
AccessExpire int64 `yaml:"accessExpire"` AccessExpire int64 `yaml:"accessExpire"`
@ -340,6 +347,16 @@ type config struct {
OfflinePush POfflinePush `yaml:"offlinePush"` OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"` DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupMemberInfoSet"` } `yaml:"groupMemberInfoSet"`
GroupMemberSetToAdmin struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupMemberSetToAdmin"`
GroupMemberSetToOrdinary struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupMemberSetToOrdinaryUser"`
OrganizationChanged struct { OrganizationChanged struct {
Conversation PConversation `yaml:"conversation"` Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"` OfflinePush POfflinePush `yaml:"offlinePush"`

View File

@ -84,10 +84,16 @@ const (
GroupMutedNotification = 1514 GroupMutedNotification = 1514
GroupCancelMutedNotification = 1515 GroupCancelMutedNotification = 1515
GroupMemberInfoSetNotification = 1516 GroupMemberInfoSetNotification = 1516
GroupMemberSetToAdminNotification = 1517
GroupMemberSetToOrdinaryUserNotification = 1518
SignalingNotificationBegin = 1600 SignalingNotificationBegin = 1600
SignalingNotification = 1601 SignalingNotification = 1601
SignalingNotificationEnd = 1699 SignalingNotificationEnd = 1649
SuperGroupNotificationBegin = 1650
SuperGroupUpdateNotification = 1651
SuperGroupNotificationEnd = 1699
ConversationPrivateChatNotification = 1701 ConversationPrivateChatNotification = 1701
@ -96,7 +102,7 @@ const (
WorkMomentNotificationBegin = 1900 WorkMomentNotificationBegin = 1900
WorkMomentNotification = 1901 WorkMomentNotification = 1901
NotificationEnd = 2000 NotificationEnd = 3000
//status //status
MsgNormal = 1 MsgNormal = 1
@ -109,7 +115,7 @@ const (
//SessionType //SessionType
SingleChatType = 1 SingleChatType = 1
GroupChatType = 2 GroupChatType = 2
SuperGroupChatType = 3
NotificationChatType = 4 NotificationChatType = 4
//token //token
NormalToken = 0 NormalToken = 0
@ -156,7 +162,8 @@ const (
//GroupType //GroupType
NormalGroup = 0 NormalGroup = 0
DepartmentGroup = 1 SuperGroup = 1
DepartmentGroup = 2
GroupBaned = 3 GroupBaned = 3
GroupBanPrivateChat = 4 GroupBanPrivateChat = 4
@ -211,6 +218,7 @@ const (
AtMe = 1 AtMe = 1
AtAll = 2 AtAll = 2
AtAllAtMe = 3 AtAllAtMe = 3
GroupNotification = 4
) )
var ContentType2PushContent = map[int64]string{ var ContentType2PushContent = map[int64]string{
@ -275,7 +283,7 @@ func GroupIsBanPrivateChat(status int32) bool {
return true return true
} }
const BigVersion = "v3" const BigVersion = "v2"
const LogFileName = "OpenIM.log" const LogFileName = "OpenIM.log"

View File

@ -56,6 +56,7 @@ var (
ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()} ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()}
ErrSendLimit = ErrInfo{ErrCode: 810, ErrMsg: "send msg limit, to many request, try again later"} ErrSendLimit = ErrInfo{ErrCode: 810, ErrMsg: "send msg limit, to many request, try again later"}
ErrMessageHasReadDisable = ErrInfo{ErrCode: 811, ErrMsg: "message has read disable"} ErrMessageHasReadDisable = ErrInfo{ErrCode: 811, ErrMsg: "message has read disable"}
ErrInternal = ErrInfo{ErrCode: 812, ErrMsg: "internal error"}
) )
var ( var (

View File

@ -27,7 +27,7 @@ const (
TerminalMobile = "Mobile" TerminalMobile = "Mobile"
) )
var PlatformID2Name = map[int32]string{ var PlatformID2Name = map[int]string{
IOSPlatformID: IOSPlatformStr, IOSPlatformID: IOSPlatformStr,
AndroidPlatformID: AndroidPlatformStr, AndroidPlatformID: AndroidPlatformStr,
WindowsPlatformID: WindowsPlatformStr, WindowsPlatformID: WindowsPlatformStr,
@ -36,7 +36,7 @@ var PlatformID2Name = map[int32]string{
MiniWebPlatformID: MiniWebPlatformStr, MiniWebPlatformID: MiniWebPlatformStr,
LinuxPlatformID: LinuxPlatformStr, LinuxPlatformID: LinuxPlatformStr,
} }
var PlatformName2ID = map[string]int32{ var PlatformName2ID = map[string]int{
IOSPlatformStr: IOSPlatformID, IOSPlatformStr: IOSPlatformID,
AndroidPlatformStr: AndroidPlatformID, AndroidPlatformStr: AndroidPlatformID,
WindowsPlatformStr: WindowsPlatformID, WindowsPlatformStr: WindowsPlatformID,
@ -55,10 +55,10 @@ var Platform2class = map[string]string{
LinuxPlatformStr: TerminalPC, LinuxPlatformStr: TerminalPC,
} }
func PlatformIDToName(num int32) string { func PlatformIDToName(num int) string {
return PlatformID2Name[num] return PlatformID2Name[num]
} }
func PlatformNameToID(name string) int32 { func PlatformNameToID(name string) int {
return PlatformName2ID[name] return PlatformName2ID[name]
} }
func PlatformNameToClass(name string) string { func PlatformNameToClass(name string) string {

View File

@ -7,7 +7,7 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"errors" "errors"
"github.com/garyburd/redigo/redis" go_redis "github.com/go-redis/redis/v8"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
@ -112,7 +112,7 @@ func (d *DataBases) BatchInsertChat2Cache(userID string, msgList []*pbMsg.MsgDat
currentMaxSeq, err := d.GetUserMaxSeq(userID) currentMaxSeq, err := d.GetUserMaxSeq(userID)
if err == nil { if err == nil {
} else if err == redis.ErrNil { } else if err == go_redis.Nil {
currentMaxSeq = 0 currentMaxSeq = 0
} else { } else {
return utils.Wrap(err, ""), 0 return utils.Wrap(err, ""), 0
@ -161,7 +161,7 @@ func (d *DataBases) BatchInsertChat(userID string, msgList []*pbMsg.MsgDataToMQ,
currentMaxSeq, err := d.GetUserMaxSeq(userID) currentMaxSeq, err := d.GetUserMaxSeq(userID)
if err == nil { if err == nil {
} else if err == redis.ErrNil { } else if err == go_redis.Nil {
isInit = true isInit = true
currentMaxSeq = 0 currentMaxSeq = 0
} else { } else {

View File

@ -11,9 +11,6 @@ import (
go_redis "github.com/go-redis/redis/v8" go_redis "github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
// "context"
// "fmt"
"github.com/garyburd/redigo/redis"
"gopkg.in/mgo.v2" "gopkg.in/mgo.v2"
"time" "time"
@ -29,9 +26,16 @@ var DB DataBases
type DataBases struct { type DataBases struct {
MysqlDB mysqlDB MysqlDB mysqlDB
mgoSession *mgo.Session mgoSession *mgo.Session
redisPool *redis.Pool //redisPool *redis.Pool
mongoClient *mongo.Client mongoClient *mongo.Client
rdb *go_redis.Client rdb go_redis.UniversalClient
}
type RedisClient struct {
client *go_redis.Client
cluster *go_redis.ClusterClient
go_redis.UniversalClient
enableCluster bool
} }
func key(dbAddress, dbName string) string { func key(dbAddress, dbName string) string {
@ -52,11 +56,11 @@ func init() {
uri = config.Config.Mongo.DBUri uri = config.Config.Mongo.DBUri
} else { } else {
if config.Config.Mongo.DBPassword != "" && config.Config.Mongo.DBUserName != "" { if config.Config.Mongo.DBPassword != "" && config.Config.Mongo.DBUserName != "" {
uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d", config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, config.Config.Mongo.DBAddress[0], uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d", config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, config.Config.Mongo.DBAddress,
config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize) config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize)
} else { } else {
uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d", uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d",
config.Config.Mongo.DBAddress[0], config.Config.Mongo.DBDatabase, config.Config.Mongo.DBAddress, config.Config.Mongo.DBDatabase,
config.Config.Mongo.DBMaxPoolSize) config.Config.Mongo.DBMaxPoolSize)
} }
} }
@ -99,28 +103,45 @@ func init() {
DB.mongoClient = mongoClient DB.mongoClient = mongoClient
// redis pool init // redis pool init
DB.redisPool = &redis.Pool{ //DB.redisPool = &redis.Pool{
MaxIdle: config.Config.Redis.DBMaxIdle, // MaxIdle: config.Config.Redis.DBMaxIdle,
MaxActive: config.Config.Redis.DBMaxActive, // MaxActive: config.Config.Redis.DBMaxActive,
IdleTimeout: time.Duration(config.Config.Redis.DBIdleTimeout) * time.Second, // IdleTimeout: time.Duration(config.Config.Redis.DBIdleTimeout) * time.Second,
Dial: func() (redis.Conn, error) { // Dial: func() (redis.Conn, error) {
return redis.Dial( // return redis.Dial(
"tcp", // "tcp",
config.Config.Redis.DBAddress, // config.Config.Redis.DBAddress,
redis.DialReadTimeout(time.Duration(1000)*time.Millisecond), // redis.DialReadTimeout(time.Duration(1000)*time.Millisecond),
redis.DialWriteTimeout(time.Duration(1000)*time.Millisecond), // redis.DialWriteTimeout(time.Duration(1000)*time.Millisecond),
redis.DialConnectTimeout(time.Duration(1000)*time.Millisecond), // redis.DialConnectTimeout(time.Duration(1000)*time.Millisecond),
redis.DialDatabase(0), // redis.DialDatabase(0),
redis.DialPassword(config.Config.Redis.DBPassWord), // redis.DialPassword(config.Config.Redis.DBPassWord),
) // )
}, // },
//}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if config.Config.Redis.EnableCluster {
DB.rdb = go_redis.NewClusterClient(&go_redis.ClusterOptions{
Addrs: config.Config.Redis.DBAddress,
PoolSize: 50,
})
_, err = DB.rdb.Ping(ctx).Result()
if err != nil {
panic(err.Error())
} }
} else {
DB.rdb = go_redis.NewClient(&go_redis.Options{ DB.rdb = go_redis.NewClient(&go_redis.Options{
Addr: config.Config.Redis.DBAddress, Addr: config.Config.Redis.DBAddress[0],
Password: config.Config.Redis.DBPassWord, // no password set Password: config.Config.Redis.DBPassWord, // no password set
DB: 0, // use default DB DB: 0, // use default DB
PoolSize: 100, // 连接池大小 PoolSize: 100, // 连接池大小
}) })
_, err = DB.rdb.Ping(ctx).Result()
if err != nil {
panic(err.Error())
}
}
} }
func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error { func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {

View File

@ -6,6 +6,7 @@ type Register struct {
Account string `gorm:"column:account;primary_key;type:char(255)" json:"account"` Account string `gorm:"column:account;primary_key;type:char(255)" json:"account"`
Password string `gorm:"column:password;type:varchar(255)" json:"password"` Password string `gorm:"column:password;type:varchar(255)" json:"password"`
Ex string `gorm:"column:ex;size:1024" json:"ex"` Ex string `gorm:"column:ex;size:1024" json:"ex"`
UserID string `gorm:"column:user_id;type:varchar(255)" json:"userID"`
} }
// //
@ -157,6 +158,7 @@ type User struct {
Ex string `gorm:"column:ex;size:1024"` Ex string `gorm:"column:ex;size:1024"`
CreateTime time.Time `gorm:"column:create_time"` CreateTime time.Time `gorm:"column:create_time"`
AppMangerLevel int32 `gorm:"column:app_manger_level"` AppMangerLevel int32 `gorm:"column:app_manger_level"`
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
} }
//message BlackInfo{ //message BlackInfo{

View File

@ -10,7 +10,9 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/go-redis/redis/v8"
"github.com/gogo/protobuf/sortkeys" "github.com/gogo/protobuf/sortkeys"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"math/rand" "math/rand"
"sync" "sync"
@ -29,6 +31,8 @@ const cTag = "tag"
const cSendLog = "send_log" const cSendLog = "send_log"
const cWorkMoment = "work_moment" const cWorkMoment = "work_moment"
const cCommentMsg = "comment_msg" const cCommentMsg = "comment_msg"
const cSuperGroup = "super_group"
const cUserToSuperGroup = "user_to_super_group"
const singleGocMsgNum = 5000 const singleGocMsgNum = 5000
func GetSingleGocMsgNum() int { func GetSingleGocMsgNum() int {
@ -305,6 +309,57 @@ func (d *DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operatio
} }
return seqMsg, nil return seqMsg, nil
} }
func (d *DataBases) GetSuperGroupMsgBySeqListMongo(groupID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) {
var hasSeqList []uint32
singleCount := 0
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
m := func(uid string, seqList []uint32) map[string][]uint32 {
t := make(map[string][]uint32)
for i := 0; i < len(seqList); i++ {
seqUid := getSeqUid(uid, seqList[i])
if value, ok := t[seqUid]; !ok {
var temp []uint32
t[seqUid] = append(temp, seqList[i])
} else {
t[seqUid] = append(value, seqList[i])
}
}
return t
}(groupID, seqList)
sChat := UserChat{}
for seqUid, value := range m {
if err = c.FindOne(ctx, bson.M{"uid": seqUid}).Decode(&sChat); err != nil {
log.NewError(operationID, "not find seqGroupID", seqUid, value, groupID, seqList, err.Error())
continue
}
singleCount = 0
for i := 0; i < len(sChat.Msg); i++ {
msg := new(open_im_sdk.MsgData)
if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil {
log.NewError(operationID, "Unmarshal err", seqUid, value, groupID, seqList, err.Error())
return nil, err
}
if isContainInt32(msg.Seq, value) {
seqMsg = append(seqMsg, msg)
hasSeqList = append(hasSeqList, msg.Seq)
singleCount++
if singleCount == len(value) {
break
}
}
}
}
if len(hasSeqList) != len(seqList) {
var diff []uint32
diff = utils.Difference(hasSeqList, seqList)
exceptionMSg := genExceptionSuperGroupMessageBySeqList(diff, groupID)
seqMsg = append(seqMsg, exceptionMSg...)
}
return seqMsg, nil
}
func (d *DataBases) GetMsgAndIndexBySeqListInOneMongo2(suffixUserID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, indexList []int, unexistSeqList []uint32, err error) { func (d *DataBases) GetMsgAndIndexBySeqListInOneMongo2(suffixUserID string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, indexList []int, unexistSeqList []uint32, err error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
@ -350,6 +405,17 @@ func genExceptionMessageBySeqList(seqList []uint32) (exceptionMsg []*open_im_sdk
return exceptionMsg return exceptionMsg
} }
func genExceptionSuperGroupMessageBySeqList(seqList []uint32, groupID string) (exceptionMsg []*open_im_sdk.MsgData) {
for _, v := range seqList {
msg := new(open_im_sdk.MsgData)
msg.Seq = v
msg.GroupID = groupID
msg.SessionType = constant.SuperGroupChatType
exceptionMsg = append(exceptionMsg, msg)
}
return exceptionMsg
}
func (d *DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { func (d *DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
@ -878,6 +944,171 @@ func (d *DataBases) GetUserFriendWorkMoments(showNumber, pageNumber int32, userI
return workMomentList, err return workMomentList, err
} }
type SuperGroup struct {
GroupID string `bson:"group_id"`
//MemberNumCount int `bson:"member_num_count"`
MemberIDList []string `bson:"member_id_list"`
}
type UserToSuperGroup struct {
UserID string `bson:"user_id"`
GroupIDList []string `bson:"group_id_list"`
}
func (d *DataBases) CreateSuperGroup(groupID string, initMemberIDList []string, memberNumCount int) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSuperGroup)
session, err := d.mongoClient.StartSession()
if err != nil {
return utils.Wrap(err, "start session failed")
}
defer session.EndSession(ctx)
sCtx := mongo.NewSessionContext(ctx, session)
superGroup := SuperGroup{
GroupID: groupID,
MemberIDList: initMemberIDList,
}
_, err = c.InsertOne(sCtx, superGroup)
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
var users []UserToSuperGroup
for _, v := range initMemberIDList {
users = append(users, UserToSuperGroup{
UserID: v,
})
}
upsert := true
opts := &options.UpdateOptions{
Upsert: &upsert,
}
c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
_, err = c.UpdateMany(sCtx, bson.M{"user_id": bson.M{"$in": initMemberIDList}}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts)
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
session.CommitTransaction(ctx)
return err
}
func (d *DataBases) GetSuperGroup(groupID string) (SuperGroup, error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSuperGroup)
superGroup := SuperGroup{}
err := c.FindOne(ctx, bson.M{"group_id": groupID}).Decode(&superGroup)
return superGroup, err
}
func (d *DataBases) AddUserToSuperGroup(groupID string, userIDList []string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSuperGroup)
session, err := d.mongoClient.StartSession()
if err != nil {
return utils.Wrap(err, "start session failed")
}
defer session.EndSession(ctx)
sCtx := mongo.NewSessionContext(ctx, session)
if err != nil {
return utils.Wrap(err, "start transaction failed")
}
_, err = c.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$addToSet": bson.M{"member_id_list": bson.M{"$each": userIDList}}})
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
var users []UserToSuperGroup
for _, v := range userIDList {
users = append(users, UserToSuperGroup{
UserID: v,
})
}
upsert := true
opts := &options.UpdateOptions{
Upsert: &upsert,
}
for _, userID := range userIDList {
_, err = c.UpdateOne(sCtx, bson.M{"user_id": userID}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts)
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
}
session.CommitTransaction(ctx)
return err
}
func (d *DataBases) RemoverUserFromSuperGroup(groupID string, userIDList []string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSuperGroup)
session, err := d.mongoClient.StartSession()
if err != nil {
return utils.Wrap(err, "start session failed")
}
defer session.EndSession(ctx)
sCtx := mongo.NewSessionContext(ctx, session)
_, err = c.UpdateOne(ctx, bson.M{"group_id": groupID}, bson.M{"$pull": bson.M{"member_id_list": bson.M{"$in": userIDList}}})
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
err = d.RemoveGroupFromUser(ctx, sCtx, groupID, userIDList)
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
session.CommitTransaction(ctx)
return err
}
func (d *DataBases) GetSuperGroupByUserID(userID string) (UserToSuperGroup, error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
var user UserToSuperGroup
return user, c.FindOne(ctx, bson.M{"user_id": userID}).Decode(&user)
}
func (d *DataBases) DeleteSuperGroup(groupID string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSuperGroup)
session, err := d.mongoClient.StartSession()
if err != nil {
return utils.Wrap(err, "start session failed")
}
defer session.EndSession(ctx)
sCtx := mongo.NewSessionContext(ctx, session)
superGroup := &SuperGroup{}
result := c.FindOneAndDelete(sCtx, bson.M{"group_id": groupID})
err = result.Decode(superGroup)
if err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
if err = d.RemoveGroupFromUser(ctx, sCtx, groupID, superGroup.MemberIDList); err != nil {
session.AbortTransaction(ctx)
return utils.Wrap(err, "transaction failed")
}
session.CommitTransaction(ctx)
return nil
}
func (d *DataBases) RemoveGroupFromUser(ctx, sCtx context.Context, groupID string, userIDList []string) error {
var users []UserToSuperGroup
for _, v := range userIDList {
users = append(users, UserToSuperGroup{
UserID: v,
})
}
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
_, err := c.UpdateOne(sCtx, bson.M{"user_id": bson.M{"$in": userIDList}}, bson.M{"$pull": bson.M{"group_id_list": groupID}})
if err != nil {
return utils.Wrap(err, "UpdateOne transaction failed")
}
return err
}
func generateTagID(tagName, userID string) string { func generateTagID(tagName, userID string) string {
return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String()) return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String())
} }
@ -902,6 +1133,21 @@ func getSeqUid(uid string, seq uint32) string {
return indexGen(uid, seqSuffix) return indexGen(uid, seqSuffix)
} }
func getSeqUserIDList(userID string, maxSeq uint32) []string {
seqMaxSuffix := maxSeq / singleGocMsgNum
var seqUserIDList []string
for i := 0; i <= int(seqMaxSuffix); i++ {
seqUserID := indexGen(userID, uint32(i))
seqUserIDList = append(seqUserIDList, seqUserID)
}
return seqUserIDList
}
func getSeqSuperGroupID(groupID string, seq uint32) string {
seqSuffix := seq / singleGocMsgNum
return superGroupIndexGen(groupID, seqSuffix)
}
func GetSeqUid(uid string, seq uint32) string { func GetSeqUid(uid string, seq uint32) string {
return getSeqUid(uid, seq) return getSeqUid(uid, seq)
} }
@ -938,3 +1184,26 @@ func isNotContainInt32(target uint32, List []uint32) bool {
func indexGen(uid string, seqSuffix uint32) string { func indexGen(uid string, seqSuffix uint32) string {
return uid + ":" + strconv.FormatInt(int64(seqSuffix), 10) return uid + ":" + strconv.FormatInt(int64(seqSuffix), 10)
} }
func superGroupIndexGen(groupID string, seqSuffix uint32) string {
return "super_group_" + groupID + ":" + strconv.FormatInt(int64(seqSuffix), 10)
}
func (d *DataBases) CleanUpUserMsgFromMongo(userID string, operationID string) error {
ctx := context.Background()
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
maxSeq, err := d.GetUserMaxSeq(userID)
if err == redis.Nil {
return nil
}
if err != nil {
return utils.Wrap(err, "")
}
seqUsers := getSeqUserIDList(userID, uint32(maxSeq))
log.Error(operationID, "getSeqUserIDList", seqUsers)
_, err = c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": seqUsers}})
if err == mongo.ErrNoDocuments {
return nil
}
return utils.Wrap(err, "")
}

View File

@ -53,7 +53,9 @@ func initMysqlDB() {
} }
fmt.Println("open db ok ", dsn) fmt.Println("open db ok ", dsn)
db.AutoMigrate(&Friend{}, db.AutoMigrate(
&Register{},
&Friend{},
&FriendRequest{}, &FriendRequest{},
&Group{}, &Group{},
&GroupMember{}, &GroupMember{},

View File

@ -15,11 +15,12 @@ func GetRegister(account string) (*db.Register, error) {
account).Take(&r).Error account).Take(&r).Error
} }
func SetPassword(account, password, ex string) error { func SetPassword(account, password, ex, userID string) error {
r := db.Register{ r := db.Register{
Account: account, Account: account,
Password: password, Password: password,
Ex: ex, Ex: ex,
UserID: userID,
} }
dbConn, err := db.DB.MysqlDB.DefaultGormDB() dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil { if err != nil {

View File

@ -16,14 +16,14 @@ func CreateDepartment(department *db.Department) error {
return dbConn.Table("departments").Create(department).Error return dbConn.Table("departments").Create(department).Error
} }
func GetDepartment(departmentID string) (error, *db.Department) { func GetDepartment(departmentID string) (*db.Department, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB() dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil { if err != nil {
return err, nil return nil, err
} }
var department db.Department var department db.Department
err = dbConn.Table("departments").Where("department_id=?", departmentID).Find(&department).Error err = dbConn.Table("departments").Where("department_id=?", departmentID).Find(&department).Error
return err, &department return &department, err
} }
func UpdateDepartment(department *db.Department, args map[string]interface{}) error { func UpdateDepartment(department *db.Department, args map[string]interface{}) error {
@ -237,6 +237,15 @@ func GetSubDepartmentNum(departmentID string) (error, uint32) {
return nil, number return nil, number
} }
func SetDepartmentRelatedGroupID(groupID, departmentID string) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return utils.Wrap(err, "DefaultGormDB failed")
}
department := &db.Department{RelatedGroupID: groupID}
return dbConn.Model(&department).Where("department_id=?", departmentID).Update(department).Error
}
func GetDepartmentRelatedGroupIDList(departmentIDList []string) ([]string, error) { func GetDepartmentRelatedGroupIDList(departmentIDList []string) ([]string, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB() dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil { if err != nil {
@ -249,12 +258,17 @@ func GetDepartmentRelatedGroupIDList(departmentIDList []string) ([]string, error
func getDepartmentParent(departmentID string, dbConn *gorm.DB) (*db.Department, error) { func getDepartmentParent(departmentID string, dbConn *gorm.DB) (*db.Department, error) {
var department db.Department var department db.Department
var parentDepartment db.Department
//var parentID string //var parentID string
dbConn.LogMode(true) dbConn.LogMode(true)
// select * from departments where department_id = (select parent_id from departments where department_id= zx234fd); err := dbConn.Model(&department).Where("department_id=?", departmentID).Select("parent_id").First(&department).Error
//dbConn.Table("departments").Where("department_id=?", departmentID).Pluck("parent_id", parentID).Error if err != nil {
err := dbConn.Table("departments").Where("department_id=?").Find(&department).Error return nil, utils.Wrap(err, "")
return &department, err }
if department.ParentID != "" {
err = dbConn.Model(&parentDepartment).Where("department_id = ?", department.ParentID).Find(&parentDepartment).Error
}
return &parentDepartment, utils.Wrap(err, "")
} }
func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList *[]string) error { func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList *[]string) error {
@ -262,9 +276,9 @@ func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList *[]s
if err != nil { if err != nil {
return err return err
} }
if department.ParentID != "" { if department.DepartmentID != "" {
*parentIDList = append(*parentIDList, department.ParentID) *parentIDList = append(*parentIDList, department.DepartmentID)
err = GetDepartmentParent(departmentID, dbConn, parentIDList) err = GetDepartmentParent(department.DepartmentID, dbConn, parentIDList)
if err != nil { if err != nil {
return err return err
} }
@ -281,3 +295,13 @@ func GetDepartmentParentIDList(departmentID string) ([]string, error) {
err = GetDepartmentParent(departmentID, dbConn, &parentIDList) err = GetDepartmentParent(departmentID, dbConn, &parentIDList)
return parentIDList, err return parentIDList, err
} }
func GetRandomDepartmentID() (string, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return "", err
}
department := &db.Department{}
err = dbConn.Model(department).Order("RAND()").Where("related_group_id != ? AND department_id != ?", "", "0").First(department).Error
return department.DepartmentID, err
}

View File

@ -22,7 +22,11 @@ func init() {
} }
var appMgr db.User var appMgr db.User
appMgr.UserID = v appMgr.UserID = v
if k == 0 {
appMgr.Nickname = config.Config.Manager.AppSysNotificationName
} else {
appMgr.Nickname = "AppManager" + utils.IntToString(k+1) appMgr.Nickname = "AppManager" + utils.IntToString(k+1)
}
appMgr.AppMangerLevel = constant.AppAdmin appMgr.AppMangerLevel = constant.AppAdmin
err = UserRegister(appMgr) err = UserRegister(appMgr)
if err != nil { if err != nil {
@ -103,6 +107,17 @@ func UpdateUserInfo(user db.User) error {
} }
dbConn.LogMode(false) dbConn.LogMode(false)
err = dbConn.Table("users").Where("user_id=?", user.UserID).Update(&user).Error err = dbConn.Table("users").Where("user_id=?", user.UserID).Update(&user).Error
return err
}
func UpdateUserInfoByMap(user db.User, m map[string]interface{}) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
dbConn.LogMode(false)
err = dbConn.Table("users").Where("user_id=?", user.UserID).Updates(m).Error
return err return err
} }

View File

@ -26,7 +26,7 @@ func InsertMessageToChatLog(msg pbMsg.MsgDataToMQ) error {
chatLog := new(db.ChatLog) chatLog := new(db.ChatLog)
copier.Copy(chatLog, msg.MsgData) copier.Copy(chatLog, msg.MsgData)
switch msg.MsgData.SessionType { switch msg.MsgData.SessionType {
case constant.GroupChatType: case constant.GroupChatType, constant.SuperGroupChatType:
chatLog.RecvID = msg.MsgData.GroupID chatLog.RecvID = msg.MsgData.GroupID
case constant.SingleChatType: case constant.SingleChatType:
chatLog.RecvID = msg.MsgData.RecvID chatLog.RecvID = msg.MsgData.RecvID

View File

@ -2,23 +2,21 @@ package db
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"
pbChat "Open_IM/pkg/proto/chat" pbChat "Open_IM/pkg/proto/chat"
pbRtc "Open_IM/pkg/proto/rtc" pbRtc "Open_IM/pkg/proto/rtc"
pbCommon "Open_IM/pkg/proto/sdk_ws" pbCommon "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
go_redis "github.com/go-redis/redis/v8"
"github.com/garyburd/redigo/redis" "github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
//goRedis "github.com/go-redis/redis/v8"
"strconv" "strconv"
"time" "time"
"github.com/golang/protobuf/proto"
"github.com/mitchellh/mapstructure"
) )
//func (d * DataBases)pubMessage(channel, msg string) { //func (d * DataBases)pubMessage(channel, msg string) {
@ -27,68 +25,158 @@ import (
//func (d * DataBases)pubMessage(channel, msg string) { //func (d * DataBases)pubMessage(channel, msg string) {
// d.rdb.Publish(context.Background(),channel,msg) // d.rdb.Publish(context.Background(),channel,msg)
//} //}
func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
key := accountTempCode + account
n, err := d.rdb.Exists(context.Background(), key).Result()
if n > 0 {
return true, err
} else {
return false, err
}
}
func (d *DataBases) SetAccountCode(account string, code, ttl int) (err error) {
key := accountTempCode + account
return d.rdb.Set(context.Background(), key, code, time.Duration(ttl)*time.Second).Err()
}
func (d *DataBases) GetAccountCode(account string) (string, error) {
key := accountTempCode + account
return d.rdb.Get(context.Background(), key).Result()
}
func (d *DataBases) NewGetMessageListBySeq(userID string, seqList []uint32, operationID string) (seqMsg []*pbCommon.MsgData, failedSeqList []uint32, errResult error) { //Perform seq auto-increment operation of user messages
func (d *DataBases) IncrUserSeq(uid string) (uint64, error) {
key := userIncrSeq + uid
seq, err := d.rdb.Incr(context.Background(), key).Result()
return uint64(seq), err
}
//Get the largest Seq
func (d *DataBases) GetUserMaxSeq(uid string) (uint64, error) {
key := userIncrSeq + uid
seq, err := d.rdb.Get(context.Background(), key).Result()
return uint64(utils.StringToInt(seq)), err
}
//set the largest Seq
func (d *DataBases) SetUserMaxSeq(uid string, maxSeq uint64) error {
key := userIncrSeq + uid
return d.rdb.Set(context.Background(), key, maxSeq, 0).Err()
}
//Set the user's minimum seq
func (d *DataBases) SetUserMinSeq(uid string, minSeq uint32) (err error) {
key := userMinSeq + uid
return d.rdb.Set(context.Background(), key, minSeq, 0).Err()
}
//Get the smallest Seq
func (d *DataBases) GetUserMinSeq(uid string) (uint64, error) {
key := userMinSeq + uid
seq, err := d.rdb.Get(context.Background(), key).Result()
return uint64(utils.StringToInt(seq)), err
}
//Store userid and platform class to redis
func (d *DataBases) AddTokenFlag(userID string, platformID int, token string, flag int) error {
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
log2.NewDebug("", "add token key is ", key)
return d.rdb.HSet(context.Background(), key, token, flag).Err()
}
func (d *DataBases) GetTokenMapByUidPid(userID, platformID string) (map[string]int, error) {
key := uidPidToken + userID + ":" + platformID
log2.NewDebug("", "get token key is ", key)
m, err := d.rdb.HGetAll(context.Background(), key).Result()
mm := make(map[string]int)
for k, v := range m {
mm[k] = utils.StringToInt(v)
}
return mm, err
}
func (d *DataBases) SetTokenMapByUidPid(userID string, platformID int, m map[string]int) error {
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
return d.rdb.HMSet(context.Background(), key, m).Err()
}
func (d *DataBases) DeleteTokenByUidPid(userID string, platformID int, fields []string) error {
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
return d.rdb.HDel(context.Background(), key, fields...).Err()
}
func (d *DataBases) SetSingleConversationRecvMsgOpt(userID, conversationID string, opt int32) error {
key := conversationReceiveMessageOpt + userID
return d.rdb.HSet(context.Background(), key, conversationID, opt).Err()
}
func (d *DataBases) GetSingleConversationRecvMsgOpt(userID, conversationID string) (int, error) {
key := conversationReceiveMessageOpt + userID
result, err := d.rdb.HGet(context.Background(), key, conversationID).Result()
return utils.StringToInt(result), err
}
func (d *DataBases) SetUserGlobalMsgRecvOpt(userID string, opt int32) error {
key := conversationReceiveMessageOpt + userID
return d.rdb.HSet(context.Background(), key, GlobalMsgRecvOpt, opt).Err()
}
func (d *DataBases) GetUserGlobalMsgRecvOpt(userID string) (int, error) {
key := conversationReceiveMessageOpt + userID
result, err := d.rdb.HGet(context.Background(), key, GlobalMsgRecvOpt).Result()
if err != nil {
if err == go_redis.Nil {
return 0, nil
} else {
return 0, err
}
}
return utils.StringToInt(result), err
}
func (d *DataBases) GetMessageListBySeq(userID string, seqList []uint32, operationID string) (seqMsg []*pbCommon.MsgData, failedSeqList []uint32, errResult error) {
for _, v := range seqList { for _, v := range seqList {
//MESSAGE_CACHE:169.254.225.224_reliability1653387820_0_1 //MESSAGE_CACHE:169.254.225.224_reliability1653387820_0_1
key := messageCache + userID + "_" + strconv.Itoa(int(v)) key := messageCache + userID + "_" + strconv.Itoa(int(v))
result, err := d.rdb.HGetAll(context.Background(), key).Result() result, err := d.rdb.Get(context.Background(), key).Result()
if err != nil { if err != nil {
errResult = err errResult = err
failedSeqList = append(failedSeqList, v) failedSeqList = append(failedSeqList, v)
log2.NewWarn(operationID, "redis get message error:", err.Error(), v) log2.NewWarn(operationID, "redis get message error:", err.Error(), v)
} else { } else {
msg, err := Map2Pb(result) msg := pbCommon.MsgData{}
//msg := pbCommon.MsgData{} err = jsonpb.UnmarshalString(result, &msg)
//err = jsonpb.UnmarshalString(result, &msg)
if err != nil { if err != nil {
errResult = err errResult = err
failedSeqList = append(failedSeqList, v) failedSeqList = append(failedSeqList, v)
log2.NewWarn(operationID, "Unmarshal err", result, err.Error()) log2.NewWarn(operationID, "Unmarshal err", result, err.Error())
} else { } else {
log2.NewDebug(operationID, "redis get msg is ", msg.String()) log2.NewDebug(operationID, "redis get msg is ", msg.String())
seqMsg = append(seqMsg, msg) seqMsg = append(seqMsg, &msg)
} }
} }
} }
return seqMsg, failedSeqList, errResult return seqMsg, failedSeqList, errResult
} }
func Map2Pb(m map[string]string) (*pbCommon.MsgData, error) { func (d *DataBases) SetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid string, operationID string) error {
var data pbCommon.MsgData
err := mapstructure.Decode(m, &data)
if err != nil {
return nil, err
}
return &data, nil
}
func (d *DataBases) NewSetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid string, operationID string) error {
ctx := context.Background() ctx := context.Background()
pipe := d.rdb.Pipeline()
var failedList []pbChat.MsgDataToMQ var failedList []pbChat.MsgDataToMQ
for _, msg := range msgList { for _, msg := range msgList {
key := messageCache + uid + "_" + strconv.Itoa(int(msg.MsgData.Seq)) key := messageCache + uid + "_" + strconv.Itoa(int(msg.MsgData.Seq))
s, err := utils.Pb2Map(msg.MsgData) s, err := utils.Pb2String(msg.MsgData)
if err != nil { if err != nil {
log2.NewWarn(operationID, utils.GetSelfFuncName(), "Pb2Map failed", msg.MsgData.String(), uid, err.Error()) log2.NewWarn(operationID, utils.GetSelfFuncName(), "Pb2String failed", msg.MsgData.String(), uid, err.Error())
continue continue
} }
log2.NewDebug(operationID, "convert map is ", s) log2.NewDebug(operationID, "convert string is ", s)
fmt.Println("ts", s) err = pipe.Set(ctx, key, s, time.Duration(config.Config.MsgCacheTimeout)*time.Second).Err()
err = d.rdb.HMSet(context.Background(), key, s).Err()
//err = d.rdb.HMSet(context.Background(), "12", map[string]interface{}{"1": 2, "343": false}).Err() //err = d.rdb.HMSet(context.Background(), "12", map[string]interface{}{"1": 2, "343": false}).Err()
if err != nil { if err != nil {
return err
log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, *msg, uid, s, err.Error()) log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, *msg, uid, s, err.Error())
failedList = append(failedList, *msg) failedList = append(failedList, *msg)
} }
d.rdb.Expire(ctx, key, time.Second*time.Duration(config.Config.MsgCacheTimeout))
} }
if len(failedList) != 0 { if len(failedList) != 0 {
return errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, operationID)) return errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, operationID))
} }
return nil _, err := pipe.Exec(ctx)
return err
} }
func (d *DataBases) CleanUpOneUserAllMsgFromRedis(userID string, operationID string) error { func (d *DataBases) CleanUpOneUserAllMsgFromRedis(userID string, operationID string) error {
@ -96,7 +184,7 @@ func (d *DataBases) CleanUpOneUserAllMsgFromRedis(userID string, operationID str
key := messageCache + userID + "_" + "*" key := messageCache + userID + "_" + "*"
vals, err := d.rdb.Keys(ctx, key).Result() vals, err := d.rdb.Keys(ctx, key).Result()
log2.Debug(operationID, "vals: ", vals) log2.Debug(operationID, "vals: ", vals)
if err == redis.ErrNil { if err == go_redis.Nil {
return nil return nil
} }
if err != nil { if err != nil {
@ -205,3 +293,114 @@ func (d *DataBases) DelUserSignalList(userID string) error {
err := d.rdb.Del(context.Background(), keyList).Err() err := d.rdb.Del(context.Background(), keyList).Err()
return err return err
} }
func (d *DataBases) DelMsgFromCache(uid string, seqList []uint32, operationID string) {
for _, seq := range seqList {
key := messageCache + uid + "_" + strconv.Itoa(int(seq))
result := d.rdb.Get(context.Background(), key).String()
var msg pbCommon.MsgData
if err := utils.String2Pb(result, &msg); err != nil {
log2.Error(operationID, utils.GetSelfFuncName(), "String2Pb failed", msg, err.Error())
continue
}
msg.Status = constant.MsgDeleted
s, err := utils.Pb2String(&msg)
if err != nil {
log2.Error(operationID, utils.GetSelfFuncName(), "Pb2String failed", msg, err.Error())
continue
}
if err := d.rdb.Set(context.Background(), key, s, time.Duration(config.Config.MsgCacheTimeout)*time.Second).Err(); err != nil {
log2.Error(operationID, utils.GetSelfFuncName(), "Set failed", err.Error())
}
}
}
func (d *DataBases) SetGetuiToken(token string, expireTime int64) error {
return d.rdb.Set(context.Background(), getuiToken, token, time.Duration(expireTime)*time.Second).Err()
}
func (d *DataBases) GetGetuiToken() (string, error) {
result := d.rdb.Get(context.Background(), getuiToken)
return result.String(), result.Err()
}
func (d *DataBases) AddFriendToCache(userID string, friendIDList ...string) error {
var IDList []interface{}
for _, id := range friendIDList {
IDList = append(IDList, id)
}
return d.rdb.SAdd(context.Background(), friendRelationCache+userID, IDList...).Err()
}
func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...string) error {
var IDList []interface{}
for _, id := range friendIDList {
IDList = append(IDList, id)
}
return d.rdb.SRem(context.Background(), friendRelationCache+userID, IDList...).Err()
}
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
result := d.rdb.SMembers(context.Background(), friendRelationCache+userID)
return result.Result()
}
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...string) error {
var IDList []interface{}
for _, id := range blackList {
IDList = append(IDList, id)
}
return d.rdb.SAdd(context.Background(), blackListCache+userID, IDList...).Err()
}
func (d *DataBases) ReduceBlackUserFromCache(userID string, blackList ...string) error {
var IDList []interface{}
for _, id := range blackList {
IDList = append(IDList, id)
}
return d.rdb.SRem(context.Background(), blackListCache+userID, IDList...).Err()
}
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
result := d.rdb.SMembers(context.Background(), blackListCache+userID)
return result.Result()
}
func (d *DataBases) AddGroupMemberToCache(groupID string, userIDList ...string) error {
var IDList []interface{}
for _, id := range userIDList {
IDList = append(IDList, id)
}
return d.rdb.SAdd(context.Background(), groupCache+groupID, IDList...).Err()
}
func (d *DataBases) ReduceGroupMemberFromCache(groupID string, userIDList ...string) error {
var IDList []interface{}
for _, id := range userIDList {
IDList = append(IDList, id)
}
return d.rdb.SRem(context.Background(), groupCache+groupID, IDList...).Err()
}
func (d *DataBases) GetGroupMemberIDListFromCache(groupID string) ([]string, error) {
result := d.rdb.SMembers(context.Background(), groupCache+groupID)
return result.Result()
}
func (d *DataBases) SetUserInfoToCache(userID string, m map[string]interface{}) error {
return d.rdb.HSet(context.Background(), userInfoCache+userID, m).Err()
}
func (d *DataBases) GetUserInfoFromCache(userID string) (*pbCommon.UserInfo, error) {
result, err := d.rdb.HGetAll(context.Background(), userInfoCache+userID).Result()
bytes, err := json.Marshal(result)
if err != nil {
return nil, err
}
userInfo := &pbCommon.UserInfo{}
if err := proto.Unmarshal(bytes, userInfo); err != nil {
return nil, err
}
err = json.Unmarshal(bytes, userInfo)
return userInfo, err
}

View File

@ -1,25 +1,5 @@
package db package db
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
log2 "Open_IM/pkg/common/log"
pbChat "Open_IM/pkg/proto/chat"
pbRtc "Open_IM/pkg/proto/rtc"
pbCommon "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"encoding/json"
"errors"
"fmt"
"github.com/garyburd/redigo/redis"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
//osconfig "google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha"
"strconv"
)
const ( const (
accountTempCode = "ACCOUNT_TEMP_CODE" accountTempCode = "ACCOUNT_TEMP_CODE"
resetPwdTempCode = "RESET_PWD_TEMP_CODE" resetPwdTempCode = "RESET_PWD_TEMP_CODE"
@ -28,7 +8,7 @@ const (
userMinSeq = "REDIS_USER_MIN_SEQ:" userMinSeq = "REDIS_USER_MIN_SEQ:"
uidPidToken = "UID_PID_TOKEN_STATUS:" uidPidToken = "UID_PID_TOKEN_STATUS:"
conversationReceiveMessageOpt = "CON_RECV_MSG_OPT:" conversationReceiveMessageOpt = "CON_RECV_MSG_OPT:"
getuiToken = "GETUI" getuiToken = "GETUI_TOKEN"
userInfoCache = "USER_INFO_CACHE:" userInfoCache = "USER_INFO_CACHE:"
friendRelationCache = "FRIEND_RELATION_CACHE:" friendRelationCache = "FRIEND_RELATION_CACHE:"
blackListCache = "BLACK_LIST_CACHE:" blackListCache = "BLACK_LIST_CACHE:"
@ -36,338 +16,319 @@ const (
messageCache = "MESSAGE_CACHE:" messageCache = "MESSAGE_CACHE:"
SignalCache = "SIGNAL_CACHE:" SignalCache = "SIGNAL_CACHE:"
SignalListCache = "SIGNAL_LIST_CACHE:" SignalListCache = "SIGNAL_LIST_CACHE:"
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_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) {
con := d.redisPool.Get() // con := d.redisPool.Get()
if err := con.Err(); err != nil { // if err := con.Err(); err != nil {
log2.Error("", "", "redis cmd = %v, err = %v", cmd, err) // log2.Error("", "", "redis cmd = %v, err = %v", cmd, err)
return nil, err // return nil, err
} // }
defer con.Close() // defer con.Close()
//
// params := make([]interface{}, 0)
// params = append(params, key)
//
// if len(args) > 0 {
// for _, v := range args {
// params = append(params, v)
// }
// }
//
// return con.Do(cmd, params...)
//}
params := make([]interface{}, 0) //func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
params = append(params, key) // key := accountTempCode + account
// return redis.Bool(d.Exec("EXISTS", key))
//}
//func (d *DataBases) SetAccountCode(account string, code, ttl int) (err error) {
// key := accountTempCode + account
// _, err = d.Exec("SET", key, code, "ex", ttl)
// return err
//}
//func (d *DataBases) GetAccountCode(account string) (string, error) {
// key := accountTempCode + account
// return redis.String(d.Exec("GET", key))
//}
//
////Perform seq auto-increment operation of user messages
//func (d *DataBases) IncrUserSeq(uid string) (uint64, error) {
// key := userIncrSeq + uid
// return redis.Uint64(d.Exec("INCR", key))
//}
//
////Get the largest Seq
//func (d *DataBases) GetUserMaxSeq(uid string) (uint64, error) {
// key := userIncrSeq + uid
// return redis.Uint64(d.Exec("GET", key))
//}
//
////set the largest Seq
//func (d *DataBases) SetUserMaxSeq(uid string, maxSeq uint64) error {
// key := userIncrSeq + uid
// _, err := d.Exec("SET", key, maxSeq)
// return err
//}
//
////Set the user's minimum seq
//func (d *DataBases) SetUserMinSeq(uid string, minSeq uint32) (err error) {
// key := userMinSeq + uid
// _, err = d.Exec("SET", key, minSeq)
// return err
//}
//
////Get the smallest Seq
//func (d *DataBases) GetUserMinSeq(uid string) (uint64, error) {
// key := userMinSeq + uid
// return redis.Uint64(d.Exec("GET", key))
//}
//
//
////Store userid and platform class to redis
//func (d *DataBases) AddTokenFlag(userID string, platformID int, token string, flag int) error {
// key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
// 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 int, m map[string]int) error {
// key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
// _, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...)
// return err
//}
//func (d *DataBases) DeleteTokenByUidPid(userID string, platformID int, fields []string) error {
// key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
// _, err := d.Exec("HDEL", key, redis.Args{}.Add().AddFlat(fields)...)
// return err
//}
//
//func (d *DataBases) SetSingleConversationRecvMsgOpt(userID, conversationID string, opt int32) error {
// key := conversationReceiveMessageOpt + userID
// _, err := d.Exec("HSet", key, conversationID, opt)
// return err
//}
//
//func (d *DataBases) GetSingleConversationRecvMsgOpt(userID, conversationID string) (int, error) {
// key := conversationReceiveMessageOpt + userID
// return redis.Int(d.Exec("HGet", key, conversationID))
//}
//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
//
//}
if len(args) > 0 { //func (d *DataBases) SetGetuiToken(token string, expireTime int64) error {
for _, v := range args { // _, err := d.Exec("SET", getuiToken, token, "ex", expireTime)
params = append(params, v) // return err
} //}
} //
//func (d *DataBases) GetGetuiToken() (string, error) {
return con.Do(cmd, params...) // result, err := redis.String(d.Exec("GET", getuiToken))
} // return result, err
func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) { //}
key := accountTempCode + account
return redis.Bool(d.Exec("EXISTS", key))
}
func (d *DataBases) SetAccountCode(account string, code, ttl int) (err error) {
key := accountTempCode + account
_, err = d.Exec("SET", key, code, "ex", ttl)
return err
}
func (d *DataBases) GetAccountCode(account string) (string, error) {
key := accountTempCode + account
return redis.String(d.Exec("GET", key))
}
//Perform seq auto-increment operation of user messages
func (d *DataBases) IncrUserSeq(uid string) (uint64, error) {
key := userIncrSeq + uid
return redis.Uint64(d.Exec("INCR", key))
}
//Get the largest Seq
func (d *DataBases) GetUserMaxSeq(uid string) (uint64, error) {
key := userIncrSeq + uid
return redis.Uint64(d.Exec("GET", key))
}
//set the largest Seq
func (d *DataBases) SetUserMaxSeq(uid string, maxSeq uint64) error {
key := userIncrSeq + uid
_, err := d.Exec("SET", key, maxSeq)
return err
}
//Set the user's minimum seq
func (d *DataBases) SetUserMinSeq(uid string, minSeq uint32) (err error) {
key := userMinSeq + uid
_, err = d.Exec("SET", key, minSeq)
return err
}
//Get the smallest Seq
func (d *DataBases) GetUserMinSeq(uid string) (uint64, error) {
key := userMinSeq + uid
return redis.Uint64(d.Exec("GET", key))
}
//Store Apple's device token to redis
func (d *DataBases) SetAppleDeviceToken(accountAddress, value string) (err error) {
key := appleDeviceToken + accountAddress
_, err = d.Exec("SET", key, value)
return err
}
//Delete Apple device token
func (d *DataBases) DelAppleDeviceToken(accountAddress string) (err error) {
key := appleDeviceToken + accountAddress
_, err = d.Exec("DEL", key)
return err
}
//Store userid and platform class to redis
func (d *DataBases) AddTokenFlag(userID string, platformID int32, token string, flag int) error {
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
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
}
func (d *DataBases) DeleteTokenByUidPid(userID string, platformID int32, fields []string) error {
key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID)
_, err := d.Exec("HDEL", key, redis.Args{}.Add().AddFlat(fields)...)
return err
}
func (d *DataBases) SetSingleConversationRecvMsgOpt(userID, conversationID string, opt int32) error {
key := conversationReceiveMessageOpt + userID
_, err := d.Exec("HSet", key, conversationID, opt)
return err
}
func (d *DataBases) GetSingleConversationRecvMsgOpt(userID, conversationID string) (int, error) {
key := conversationReceiveMessageOpt + userID
return redis.Int(d.Exec("HGet", key, conversationID))
}
func (d *DataBases) GetAllConversationMsgOpt(userID string) (map[string]int, error) {
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
}
func (d *DataBases) SetGetuiToken(token string, expireTime int64) error {
_, err := d.Exec("SET", getuiToken, token, "ex", expireTime)
return err
}
func (d *DataBases) GetGetuiToken() (string, error) {
result, err := redis.String(d.Exec("GET", getuiToken))
return result, err
}
func (d *DataBases) SearchContentType() { func (d *DataBases) SearchContentType() {
} }
func (d *DataBases) SetUserInfoToCache(userID string, m map[string]interface{}) error { //func (d *DataBases) SetUserInfoToCache(userID string, m map[string]interface{}) error {
_, err := d.Exec("hmset", userInfoCache+userID, redis.Args{}.Add().AddFlat(m)...) // _, err := d.Exec("hmset", userInfoCache+userID, redis.Args{}.Add().AddFlat(m)...)
return err // return err
} //}
//
//func (d *DataBases) GetUserInfoFromCache(userID string) (*pbCommon.UserInfo, error) {
// result, err := redis.String(d.Exec("hgetall", userInfoCache+userID))
// log2.NewInfo("", result)
// if err != nil {
// return nil, err
// }
// userInfo := &pbCommon.UserInfo{}
// err = json.Unmarshal([]byte(result), userInfo)
// return userInfo, err
//}
func (d *DataBases) GetUserInfoFromCache(userID string) (*pbCommon.UserInfo, error) { //func (d *DataBases) AddFriendToCache(userID string, friendIDList ...string) error {
result, err := redis.String(d.Exec("hgetall", userInfoCache+userID)) // var IDList []interface{}
log2.NewInfo("", result) // for _, id := range friendIDList {
if err != nil { // IDList = append(IDList, id)
return nil, err // }
} // _, err := d.Exec("SADD", friendRelationCache+userID, IDList...)
userInfo := &pbCommon.UserInfo{} // return err
err = json.Unmarshal([]byte(result), userInfo) //}
return userInfo, err
}
func (d *DataBases) AddFriendToCache(userID string, friendIDList ...string) error { //func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...string) error {
var IDList []interface{} // var IDList []interface{}
for _, id := range friendIDList { // for _, id := range friendIDList {
IDList = append(IDList, id) // IDList = append(IDList, id)
} // }
_, err := d.Exec("SADD", friendRelationCache+userID, IDList...) // _, err := d.Exec("SREM", friendRelationCache+userID, IDList...)
return err // return err
} //}
func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...string) error { //func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
var IDList []interface{} // result, err := redis.Strings(d.Exec("SMEMBERS", friendRelationCache+userID))
for _, id := range friendIDList { // return result, err
IDList = append(IDList, id) //}
} //
_, err := d.Exec("SREM", friendRelationCache+userID, IDList...) //func (d *DataBases) AddBlackUserToCache(userID string, blackList ...string) error {
return err // var IDList []interface{}
} // for _, id := range blackList {
// IDList = append(IDList, id)
// }
// _, err := d.Exec("SADD", blackListCache+userID, IDList...)
// return err
//}
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) { //func (d *DataBases) ReduceBlackUserFromCache(userID string, blackList ...string) error {
result, err := redis.Strings(d.Exec("SMEMBERS", friendRelationCache+userID)) // var IDList []interface{}
return result, err // for _, id := range blackList {
} // IDList = append(IDList, id)
// }
// _, err := d.Exec("SREM", blackListCache+userID, IDList...)
// return err
//}
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...string) error { //func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
var IDList []interface{} // result, err := redis.Strings(d.Exec("SMEMBERS", blackListCache+userID))
for _, id := range blackList { // return result, err
IDList = append(IDList, id) //}
}
_, err := d.Exec("SADD", blackListCache+userID, IDList...)
return err
}
func (d *DataBases) ReduceBlackUserFromCache(userID string, blackList ...string) error { //func (d *DataBases) AddGroupMemberToCache(groupID string, userIDList ...string) error {
var IDList []interface{} // var IDList []interface{}
for _, id := range blackList { // for _, id := range userIDList {
IDList = append(IDList, id) // IDList = append(IDList, id)
} // }
_, err := d.Exec("SREM", blackListCache+userID, IDList...) // _, err := d.Exec("SADD", groupCache+groupID, IDList...)
return err // return err
} //}
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) { //func (d *DataBases) ReduceGroupMemberFromCache(groupID string, userIDList ...string) error {
result, err := redis.Strings(d.Exec("SMEMBERS", blackListCache+userID)) // var IDList []interface{}
return result, err // for _, id := range userIDList {
} // IDList = append(IDList, id)
// }
// _, err := d.Exec("SREM", groupCache+groupID, IDList...)
// return err
//}
func (d *DataBases) AddGroupMemberToCache(groupID string, userIDList ...string) error { //func (d *DataBases) GetGroupMemberIDListFromCache(groupID string) ([]string, error) {
var IDList []interface{} // result, err := redis.Strings(d.Exec("SMEMBERS", groupCache+groupID))
for _, id := range userIDList { // return result, err
IDList = append(IDList, id) //}
}
_, err := d.Exec("SADD", groupCache+groupID, IDList...)
return err
}
func (d *DataBases) ReduceGroupMemberFromCache(groupID string, userIDList ...string) error { //func (d *DataBases) GetMessageListBySeq(userID string, seqList []uint32, operationID string) (seqMsg []*pbCommon.MsgData, failedSeqList []uint32, errResult error) {
var IDList []interface{} // for _, v := range seqList {
for _, id := range userIDList { // //MESSAGE_CACHE:169.254.225.224_reliability1653387820_0_1
IDList = append(IDList, id) // key := messageCache + userID + "_" + strconv.Itoa(int(v))
} //
_, err := d.Exec("SREM", groupCache+groupID, IDList...) // result, err := redis.String(d.Exec("GET", key))
return err // if err != nil {
} // errResult = err
// failedSeqList = append(failedSeqList, v)
// log2.NewWarn(operationID, "redis get message error:", err.Error(), v)
// } else {
// msg := pbCommon.MsgData{}
// err = jsonpb.UnmarshalString(result, &msg)
// if err != nil {
// errResult = err
// failedSeqList = append(failedSeqList, v)
// log2.NewWarn(operationID, "Unmarshal err", result, err.Error())
// } else {
// log2.NewDebug(operationID, "redis get msg is ", msg.String())
// seqMsg = append(seqMsg, &msg)
// }
//
// }
// }
// return seqMsg, failedSeqList, errResult
//}
func (d *DataBases) GetGroupMemberIDListFromCache(groupID string) ([]string, error) { //func (d *DataBases) SetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid string, operationID string) error {
result, err := redis.Strings(d.Exec("SMEMBERS", groupCache+groupID)) // var failedList []pbChat.MsgDataToMQ
return result, err // for _, msg := range msgList {
} // key := messageCache + uid + "_" + strconv.Itoa(int(msg.MsgData.Seq))
func (d *DataBases) GetMessageListBySeq(userID string, seqList []uint32, operationID string) (seqMsg []*pbCommon.MsgData, failedSeqList []uint32, errResult error) { // s, err := utils.Pb2String(msg.MsgData)
for _, v := range seqList { // if err != nil {
//MESSAGE_CACHE:169.254.225.224_reliability1653387820_0_1 // log2.NewWarn(operationID, utils.GetSelfFuncName(), "Pb2String failed", msg.MsgData.String(), uid, err.Error())
key := messageCache + userID + "_" + strconv.Itoa(int(v)) // continue
// }
// log2.NewDebug(operationID, "convert string is ", s)
// _, err = d.Exec("SET", key, s, "ex", config.Config.MsgCacheTimeout)
// if err != nil {
// log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, *msg, uid, s)
// failedList = append(failedList, *msg)
// }
// }
// if len(failedList) != 0 {
// return errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q", failedList))
// }
// return nil
//}
result, err := redis.String(d.Exec("GET", key)) //func (d *DataBases) DelMsgFromCache(uid string, seqList []uint32, operationID string) {
if err != nil { // for _, seq := range seqList {
errResult = err // key := messageCache + uid + "_" + strconv.Itoa(int(seq))
failedSeqList = append(failedSeqList, v) // result, err := redis.String(d.Exec("GET", key))
log2.NewWarn(operationID, "redis get message error:", err.Error(), v) // if err != nil {
} else { // log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key)
msg := pbCommon.MsgData{} // continue
err = jsonpb.UnmarshalString(result, &msg) // }
if err != nil { // log2.Debug(operationID, utils.GetSelfFuncName(), "del result", result)
errResult = err // var msg pbCommon.MsgData
failedSeqList = append(failedSeqList, v) // err = utils.String2Pb(result, &msg)
log2.NewWarn(operationID, "Unmarshal err", result, err.Error()) // log2.NewDebug(operationID, utils.GetSelfFuncName(), "msg", msg)
} else { // if err != nil {
log2.NewDebug(operationID, "redis get msg is ", msg.String()) // log2.NewWarn(operationID, utils.GetSelfFuncName(), "string2Pb failed", msg, err.Error())
seqMsg = append(seqMsg, &msg) // continue
} // }
// msg.Status = constant.MsgDeleted
// s, err := utils.Pb2String(&msg)
// if err != nil {
// log2.NewWarn(operationID, utils.GetSelfFuncName(), "Pb2String failed", msg, err.Error())
// continue
// }
// _, err = d.Exec("SET", key, s)
// if err != nil {
// log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, msg, s)
// }
// }
//}
} //func (d *DataBases) CacheSignalInfo(msg *pbCommon.MsgData) error {
} // key := SignalCache + msg.ClientMsgID
return seqMsg, failedSeqList, errResult // _, err := d.Exec("SET", key, msg.Content, "ex", config.Config.Rtc.SignalTimeout)
} // return err
//}
func (d *DataBases) SetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid string, operationID string) error { //
var failedList []pbChat.MsgDataToMQ //func (d *DataBases) GetSignalInfoFromCache(clientMsgID string) (invitationInfo *pbRtc.SignalInviteReq, err error) {
for _, msg := range msgList { // key := SignalCache + clientMsgID
key := messageCache + uid + "_" + strconv.Itoa(int(msg.MsgData.Seq)) // result, err := redis.Bytes(d.Exec("GET", key))
s, err := utils.Pb2String(msg.MsgData) // log2.NewDebug("", utils.GetSelfFuncName(), clientMsgID, result, string(result))
if err != nil { // if err != nil {
log2.NewWarn(operationID, utils.GetSelfFuncName(), "Pb2String failed", msg.MsgData.String(), uid, err.Error()) // return nil, err
continue // }
} // req := &pbRtc.SignalReq{}
log2.NewDebug(operationID, "convert string is ", s) // if err = proto.Unmarshal(result, req); err != nil {
_, err = d.Exec("SET", key, s, "ex", config.Config.MsgCacheTimeout) // return nil, err
if err != nil { // }
log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, *msg, uid, s) // req2 := req.Payload.(*pbRtc.SignalReq_Invite)
failedList = append(failedList, *msg) // invitationInfo = req2.Invite
} // return invitationInfo, err
} //}
if len(failedList) != 0 {
return errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %s", failedList))
}
return nil
}
func (d *DataBases) DelMsgFromCache(uid string, seqList []uint32, operationID string) {
for _, seq := range seqList {
key := messageCache + uid + "_" + strconv.Itoa(int(seq))
result, err := redis.String(d.Exec("GET", key))
if err != nil {
log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key)
continue
}
log2.Debug(operationID, utils.GetSelfFuncName(), "del result", result)
var msg pbCommon.MsgData
err = utils.String2Pb(result, &msg)
log2.NewDebug(operationID, utils.GetSelfFuncName(), "msg", msg)
if err != nil {
log2.NewWarn(operationID, utils.GetSelfFuncName(), "string2Pb failed", msg, err.Error())
continue
}
msg.Status = constant.MsgDeleted
s, err := utils.Pb2String(&msg)
if err != nil {
log2.NewWarn(operationID, utils.GetSelfFuncName(), "Pb2String failed", msg, err.Error())
continue
}
_, err = d.Exec("SET", key, s)
if err != nil {
log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, msg, s)
}
}
}
func (d *DataBases) CacheSignalInfo(msg *pbCommon.MsgData) error {
key := SignalCache + msg.ClientMsgID
_, err := d.Exec("SET", key, msg.Content, "ex", config.Config.Rtc.SignalTimeout)
return err
}
func (d *DataBases) GetSignalInfoFromCache(clientMsgID string) (invitationInfo *pbRtc.SignalInviteReq, err error) {
key := SignalCache + clientMsgID
result, err := redis.Bytes(d.Exec("GET", key))
log2.NewDebug("", utils.GetSelfFuncName(), clientMsgID, result, string(result))
if err != nil {
return nil, err
}
req := &pbRtc.SignalReq{}
if err = proto.Unmarshal(result, req); err != nil {
return nil, err
}
req2 := req.Payload.(*pbRtc.SignalReq_Invite)
invitationInfo = req2.Invite
return invitationInfo, err
}

View File

@ -1,6 +1,11 @@
package db package db
import ( import (
"Open_IM/pkg/common/constant"
pbChat "Open_IM/pkg/proto/chat"
server_api_params "Open_IM/pkg/proto/sdk_ws"
"context"
"flag"
"fmt" "fmt"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing" "testing"
@ -20,8 +25,96 @@ func Test_GetTokenMapByUidPid(t *testing.T) {
fmt.Println(m) fmt.Println(m)
} }
func TestDataBases_GetMultiConversationMsgOpt(t *testing.T) { //func TestDataBases_GetMultiConversationMsgOpt(t *testing.T) {
m, err := DB.GetMultiConversationMsgOpt("fg", []string{"user", "age", "color"}) // m, err := DB.GetMultiConversationMsgOpt("fg", []string{"user", "age", "color"})
// assert.Nil(t, err)
// fmt.Println(m)
//}
func Test_GetKeyTTL(t *testing.T) {
ctx := context.Background()
key := flag.String("key", "key", "key value")
flag.Parse()
ttl, err := DB.rdb.TTL(ctx, *key).Result()
assert.Nil(t, err) assert.Nil(t, err)
fmt.Println(m) fmt.Println(ttl)
}
func Test_HGetAll(t *testing.T) {
ctx := context.Background()
key := flag.String("key", "key", "key value")
flag.Parse()
ttl, err := DB.rdb.TTL(ctx, *key).Result()
assert.Nil(t, err)
fmt.Println(ttl)
}
func Test_NewSetMessageToCache(t *testing.T) {
var msg pbChat.MsgDataToMQ
m := make(map[string]bool)
var offlinePush server_api_params.OfflinePushInfo
offlinePush.Title = "3"
offlinePush.Ex = "34"
offlinePush.IOSPushSound = "+1"
offlinePush.IOSBadgeCount = true
m[constant.IsPersistent] = true
m[constant.IsHistory] = true
var data server_api_params.MsgData
uid := "test_uid"
data.Seq = 11
data.ClientMsgID = "23jwhjsdf"
data.SendID = "111"
data.RecvID = "222"
data.Content = []byte{1, 2, 3, 4, 5, 6, 7}
data.Seq = 1212
data.Options = m
data.OfflinePushInfo = &offlinePush
data.AtUserIDList = []string{"1212", "23232"}
msg.MsgData = &data
messageList := []*pbChat.MsgDataToMQ{&msg}
err := DB.SetMessageToCache(messageList, uid, "cacheTest")
assert.Nil(t, err)
}
func Test_NewGetMessageListBySeq(t *testing.T) {
var msg pbChat.MsgDataToMQ
var data server_api_params.MsgData
uid := "test_uid"
data.Seq = 11
data.ClientMsgID = "23jwhjsdf"
msg.MsgData = &data
seqMsg, failedSeqList, err := DB.GetMessageListBySeq(uid, []uint32{1212}, "cacheTest")
assert.Nil(t, err)
fmt.Println(seqMsg, failedSeqList)
}
func Test_SetUserGlobalMsgRecvOpt(t *testing.T) {
var opt int32
uid := "test_uid"
opt = 1
err := DB.SetUserGlobalMsgRecvOpt(uid, opt)
assert.Nil(t, err)
}
func Test_GetUserGlobalMsgRecvOpt(t *testing.T) {
uid := "test_uid"
opt, err := DB.GetUserGlobalMsgRecvOpt(uid)
assert.Nil(t, err)
fmt.Println("get opt", opt)
}
func Test_JudgeAccountEXISTS(t *testing.T) {
uid := "test_uid"
b, err := DB.JudgeAccountEXISTS(uid)
assert.Nil(t, err)
fmt.Println(b)
}
func Test_SetAccountCode(t *testing.T) {
uid := "test_uid"
code := 666666
err := DB.SetAccountCode(uid, code, 100)
assert.Nil(t, err)
}
func Test_GetAccountCode(t *testing.T) {
uid := "test_uid"
code, err := DB.GetAccountCode(uid)
assert.Nil(t, err)
fmt.Println(code)
} }

View File

@ -2,6 +2,7 @@ package kafka
import ( import (
log2 "Open_IM/pkg/common/log" log2 "Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"errors" "errors"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
@ -18,6 +19,7 @@ func NewKafkaProducer(addr []string, topic string) *Producer {
p := Producer{} p := Producer{}
p.config = sarama.NewConfig() //Instantiate a sarama Config p.config = sarama.NewConfig() //Instantiate a sarama Config
p.config.Producer.Return.Successes = true //Whether to enable the successes channel to be notified after the message is sent successfully p.config.Producer.Return.Successes = true //Whether to enable the successes channel to be notified after the message is sent successfully
p.config.Producer.Return.Errors = true
p.config.Producer.RequiredAcks = sarama.WaitForAll //Set producer Message Reply level 0 1 all p.config.Producer.RequiredAcks = sarama.WaitForAll //Set producer Message Reply level 0 1 all
p.config.Producer.Partitioner = sarama.NewHashPartitioner //Set the hash-key automatic hash partition. When sending a message, you must specify the key value of the message. If there is no key, the partition will be selected randomly p.config.Producer.Partitioner = sarama.NewHashPartitioner //Set the hash-key automatic hash partition. When sending a message, you must specify the key value of the message. If there is no key, the partition will be selected randomly
@ -44,11 +46,16 @@ func (p *Producer) SendMessage(m proto.Message, key string, operationID string)
return -1, -1, err return -1, -1, err
} }
if len(bMsg) == 0 { if len(bMsg) == 0 {
return 0, 0, errors.New("msg content is nil") log2.Error(operationID, "len(bMsg) == 0 ")
return 0, 0, errors.New("len(bMsg) == 0 ")
} }
kMsg.Value = sarama.ByteEncoder(bMsg) kMsg.Value = sarama.ByteEncoder(bMsg)
log2.Info(operationID, "ByteEncoder SendMessage begin", "key ", kMsg, p.producer) log2.Info(operationID, "ByteEncoder SendMessage begin", "key ", kMsg, p.producer, "len: ", kMsg.Key.Length(), kMsg.Value.Length())
a, b, c := p.producer.SendMessage(kMsg) if kMsg.Key.Length() == 0 || kMsg.Value.Length() == 0 {
log2.Info(operationID, "ByteEncoder SendMessage end", "key ", kMsg, p.producer) log2.Error(operationID, "kMsg.Key.Length() == 0 || kMsg.Value.Length() == 0 ", kMsg)
return a, b, c return -1, -1, errors.New("key or value == 0")
}
a, b, c := p.producer.SendMessage(kMsg)
log2.Info(operationID, "ByteEncoder SendMessage end", "key ", kMsg.Key.Length(), kMsg.Value.Length(), p.producer)
return a, b, utils.Wrap(c, "")
} }

View File

@ -6,7 +6,7 @@ import (
commonDB "Open_IM/pkg/common/db" commonDB "Open_IM/pkg/common/db"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"github.com/garyburd/redigo/redis" go_redis "github.com/go-redis/redis/v8"
"github.com/golang-jwt/jwt/v4" "github.com/golang-jwt/jwt/v4"
"time" "time"
) )
@ -37,7 +37,26 @@ func BuildClaims(uid, platform string, ttl int64) Claims {
}} }}
} }
func CreateToken(userID string, platformID int32) (string, int64, error) { func DeleteToken(userID string, platformID int) error {
m, err := commonDB.DB.GetTokenMapByUidPid(userID, constant.PlatformIDToName(platformID))
if err != nil && err != go_redis.Nil {
return utils.Wrap(err, "")
}
var deleteTokenKey []string
for k, v := range m {
_, err = GetClaimFromToken(k)
if err != nil || v != constant.NormalToken {
deleteTokenKey = append(deleteTokenKey, k)
}
}
if len(deleteTokenKey) != 0 {
err = commonDB.DB.DeleteTokenByUidPid(userID, platformID, deleteTokenKey)
return utils.Wrap(err, "")
}
return nil
}
func CreateToken(userID string, platformID int) (string, int64, error) {
claims := BuildClaims(userID, constant.PlatformIDToName(platformID), config.Config.TokenPolicy.AccessExpire) claims := BuildClaims(userID, constant.PlatformIDToName(platformID), config.Config.TokenPolicy.AccessExpire)
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
tokenString, err := token.SignedString([]byte(config.Config.TokenPolicy.AccessSecret)) tokenString, err := token.SignedString([]byte(config.Config.TokenPolicy.AccessSecret))
@ -46,7 +65,7 @@ func CreateToken(userID string, platformID int32) (string, int64, error) {
} }
//remove Invalid token //remove Invalid token
m, err := commonDB.DB.GetTokenMapByUidPid(userID, constant.PlatformIDToName(platformID)) m, err := commonDB.DB.GetTokenMapByUidPid(userID, constant.PlatformIDToName(platformID))
if err != nil && err != redis.ErrNil { if err != nil && err != go_redis.Nil {
return "", 0, err return "", 0, err
} }
var deleteTokenKey []string var deleteTokenKey []string
@ -226,15 +245,19 @@ func VerifyToken(token, uid string) (bool, error) {
return true, nil return true, nil
} }
func WsVerifyToken(token, uid string, platformID string, operationID string) (bool, error, string) { func WsVerifyToken(token, uid string, platformID string, operationID string) (bool, error, string) {
argMsg := "token: " + token + " operationID: " + operationID + " userID: " + uid + " platformID: " + platformID
claims, err := ParseToken(token, operationID) claims, err := ParseToken(token, operationID)
if err != nil { if err != nil {
return false, utils.Wrap(err, "parse token err"), "parse token err" errMsg := "parse token err " + argMsg
return false, utils.Wrap(err, errMsg), errMsg
} }
if claims.UID != uid { if claims.UID != uid {
return false, utils.Wrap(&constant.ErrTokenUnknown, "uid is not same to token uid"), "uid is not same to token uid" errMsg := " uid is not same to token uid " + " claims.UID " + claims.UID + argMsg
return false, utils.Wrap(&constant.ErrTokenUnknown, errMsg), errMsg
} }
if claims.Platform != constant.PlatformIDToName(utils.StringToInt32(platformID)) { if claims.Platform != constant.PlatformIDToName(utils.StringToInt(platformID)) {
return false, utils.Wrap(&constant.ErrTokenUnknown, "platform is not same to token platform"), "platform is not same to token platform" errMsg := " platform is not same to token platform " + argMsg + "claims platformID " + claims.Platform
return false, utils.Wrap(&constant.ErrTokenUnknown, errMsg), errMsg
} }
log.NewDebug(operationID, utils.GetSelfFuncName(), " check ok ", claims.UID, uid, claims.Platform) log.NewDebug(operationID, utils.GetSelfFuncName(), " check ok ", claims.UID, uid, claims.Platform)
return true, nil, "" return true, nil, ""

View File

@ -2,6 +2,7 @@ package getcdv3
import ( import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"context" "context"
"fmt" "fmt"
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
@ -38,12 +39,15 @@ func RegisterEtcd4Unique(schema, etcdAddr, myHost string, myPort int, serviceNam
//etcdAddr separated by commas //etcdAddr separated by commas
func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName string, ttl int) error { func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName string, ttl int) error {
operationID := utils.OperationIDGenerator()
args := schema + " " + etcdAddr + " " + myHost + " " + serviceName + " " + utils.Int32ToString(int32(myPort))
ttl = ttl * 3 ttl = ttl * 3
cli, err := clientv3.New(clientv3.Config{ cli, err := clientv3.New(clientv3.Config{
Endpoints: strings.Split(etcdAddr, ","), DialTimeout: 5 * time.Second}) Endpoints: strings.Split(etcdAddr, ","), DialTimeout: 5 * time.Second})
log.Info("", "RegisterEtcd, ", schema, etcdAddr, myHost, myPort, serviceName, ttl) log.Info(operationID, "RegisterEtcd args: ", args, ttl)
if err != nil { if err != nil {
log.Error(operationID, "clientv3.New failed ", args, ttl, err.Error())
return fmt.Errorf("create etcd clientv3 client failed, errmsg:%v, etcd addr:%s", err, etcdAddr) return fmt.Errorf("create etcd clientv3 client failed, errmsg:%v, etcd addr:%s", err, etcdAddr)
} }
@ -51,8 +55,10 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
resp, err := cli.Grant(ctx, int64(ttl)) resp, err := cli.Grant(ctx, int64(ttl))
if err != nil { if err != nil {
log.Error(operationID, "Grant failed ", err.Error(), ctx, ttl)
return fmt.Errorf("grant failed") return fmt.Errorf("grant failed")
} }
log.Info(operationID, "Grant ok, resp ID ", resp.ID)
// schema:///serviceName/ip:port ->ip:port // schema:///serviceName/ip:port ->ip:port
serviceValue := net.JoinHostPort(myHost, strconv.Itoa(myPort)) serviceValue := net.JoinHostPort(myHost, strconv.Itoa(myPort))
@ -60,24 +66,26 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
//set key->value //set key->value
if _, err := cli.Put(ctx, serviceKey, serviceValue, clientv3.WithLease(resp.ID)); err != nil { if _, err := cli.Put(ctx, serviceKey, serviceValue, clientv3.WithLease(resp.ID)); err != nil {
log.Error(operationID, "cli.Put failed ", err.Error(), ctx, args, resp.ID)
return fmt.Errorf("put failed, errmsg:%v key:%s, value:%s", err, serviceKey, serviceValue) return fmt.Errorf("put failed, errmsg:%v key:%s, value:%s", err, serviceKey, serviceValue)
} }
//keepalive //keepalive
kresp, err := cli.KeepAlive(ctx, resp.ID) kresp, err := cli.KeepAlive(ctx, resp.ID)
if err != nil { if err != nil {
log.Error(operationID, "KeepAlive failed ", err.Error(), args, resp.ID)
return fmt.Errorf("keepalive failed, errmsg:%v, lease id:%d", err, resp.ID) return fmt.Errorf("keepalive failed, errmsg:%v, lease id:%d", err, resp.ID)
} }
//log.Info("", "RegisterEtcd ok ") log.Info(operationID, "RegisterEtcd ok ", args)
go func() { go func() {
for { for {
select { select {
case pv, ok := <-kresp: case pv, ok := <-kresp:
if ok == true { if ok == true {
log.Debug("", "KeepAlive kresp ok", pv) log.Debug(operationID, "KeepAlive kresp ok", pv, args)
} else { } else {
log.Error("", "KeepAlive kresp failed", pv) log.Error(operationID, "KeepAlive kresp failed ", pv, args)
t := time.NewTicker(time.Duration(ttl/2) * time.Second) t := time.NewTicker(time.Duration(ttl/2) * time.Second)
for { for {
select { select {
@ -86,17 +94,16 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
ctx, _ := context.WithCancel(context.Background()) ctx, _ := context.WithCancel(context.Background())
resp, err := cli.Grant(ctx, int64(ttl)) resp, err := cli.Grant(ctx, int64(ttl))
if err != nil { if err != nil {
log.Error("", "Grant failed ", err.Error()) log.Error(operationID, "Grant failed ", err.Error(), args)
continue continue
} }
if _, err := cli.Put(ctx, serviceKey, serviceValue, clientv3.WithLease(resp.ID)); err != nil { if _, err := cli.Put(ctx, serviceKey, serviceValue, clientv3.WithLease(resp.ID)); err != nil {
log.Error("", "etcd Put failed ", err.Error(), serviceKey, serviceValue, resp.ID) log.Error(operationID, "etcd Put failed ", err.Error(), args, " resp ID: ", resp.ID)
continue continue
} else { } else {
log.Info("", "etcd Put ok", serviceKey, serviceValue, resp.ID) log.Info(operationID, "etcd Put ok ", args, " resp ID: ", resp.ID)
} }
} }
} }
} }

View File

@ -2,6 +2,7 @@ package getcdv3
import ( import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"context" "context"
"fmt" "fmt"
"go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/mvccpb"
@ -32,12 +33,13 @@ var (
rwNameResolverMutex sync.RWMutex rwNameResolverMutex sync.RWMutex
) )
func NewResolver(schema, etcdAddr, serviceName string) (*Resolver, error) { func NewResolver(schema, etcdAddr, serviceName string, operationID string) (*Resolver, error) {
etcdCli, err := clientv3.New(clientv3.Config{ etcdCli, err := clientv3.New(clientv3.Config{
Endpoints: strings.Split(etcdAddr, ","), Endpoints: strings.Split(etcdAddr, ","),
}) })
if err != nil { if err != nil {
return nil, err log.Error(operationID, "etcd client v3 failed")
return nil, utils.Wrap(err, "")
} }
var r Resolver var r Resolver
@ -51,18 +53,11 @@ func NewResolver(schema, etcdAddr, serviceName string) (*Resolver, error) {
conn, err := grpc.DialContext(ctx, GetPrefix(schema, serviceName), conn, err := grpc.DialContext(ctx, GetPrefix(schema, serviceName),
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)), grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)),
grpc.WithInsecure()) grpc.WithInsecure())
log.Debug("", "etcd key ", GetPrefix(schema, serviceName)) log.Debug(operationID, "etcd key ", GetPrefix(schema, serviceName))
//conn, err := grpc.Dial(
// GetPrefix(schema, serviceName),
// grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)),
// grpc.WithInsecure(),
// grpc.WithTimeout(time.Duration(5)*time.Second),
//)
if err == nil { if err == nil {
r.grpcClientConn = conn r.grpcClientConn = conn
} }
return &r, err return &r, utils.Wrap(err, "")
} }
func (r1 *Resolver) ResolveNow(rn resolver.ResolveNowOptions) { func (r1 *Resolver) ResolveNow(rn resolver.ResolveNowOptions) {
@ -71,12 +66,12 @@ func (r1 *Resolver) ResolveNow(rn resolver.ResolveNowOptions) {
func (r1 *Resolver) Close() { func (r1 *Resolver) Close() {
} }
func GetConn(schema, etcdaddr, serviceName string) *grpc.ClientConn { func GetConn(schema, etcdaddr, serviceName string, operationID string) *grpc.ClientConn {
rwNameResolverMutex.RLock() rwNameResolverMutex.RLock()
r, ok := nameResolver[schema+serviceName] r, ok := nameResolver[schema+serviceName]
rwNameResolverMutex.RUnlock() rwNameResolverMutex.RUnlock()
if ok { if ok {
log.Debug("", "etcd key ", schema+serviceName, "value ", *r.grpcClientConn, *r) log.Debug(operationID, "etcd key ", schema+serviceName, "value ", *r.grpcClientConn, *r)
return r.grpcClientConn return r.grpcClientConn
} }
@ -84,18 +79,18 @@ func GetConn(schema, etcdaddr, serviceName string) *grpc.ClientConn {
r, ok = nameResolver[schema+serviceName] r, ok = nameResolver[schema+serviceName]
if ok { if ok {
rwNameResolverMutex.Unlock() rwNameResolverMutex.Unlock()
log.Debug("", "etcd key ", schema+serviceName, "value ", *r.grpcClientConn, *r) log.Debug(operationID, "etcd key ", schema+serviceName, "value ", *r.grpcClientConn, *r)
return r.grpcClientConn return r.grpcClientConn
} }
r, err := NewResolver(schema, etcdaddr, serviceName) r, err := NewResolver(schema, etcdaddr, serviceName, operationID)
if err != nil { if err != nil {
log.Error("", "etcd failed ", schema, etcdaddr, serviceName) log.Error(operationID, "etcd failed ", schema, etcdaddr, serviceName, err.Error())
rwNameResolverMutex.Unlock() rwNameResolverMutex.Unlock()
return nil return nil
} }
log.Debug("", "etcd key ", schema+serviceName, "value ", *r.grpcClientConn, *r) log.Debug(operationID, "etcd key ", schema+serviceName, "value ", *r.grpcClientConn, *r)
nameResolver[schema+serviceName] = r nameResolver[schema+serviceName] = r
rwNameResolverMutex.Unlock() rwNameResolverMutex.Unlock()
return r.grpcClientConn return r.grpcClientConn
@ -220,7 +215,7 @@ func GetConn4Unique(schema, etcdaddr, servicename string) []*grpc.ClientConn {
allConn := make([]*grpc.ClientConn, 0) allConn := make([]*grpc.ClientConn, 0)
for _, v := range allService { for _, v := range allService {
r := GetConn(schema, etcdaddr, v) r := GetConn(schema, etcdaddr, v, "0")
allConn = append(allConn, r) allConn = append(allConn, r)
} }
@ -233,7 +228,7 @@ var (
) )
func GetconnFactory(schema, etcdaddr, servicename string) (*grpc.ClientConn, error) { func GetconnFactory(schema, etcdaddr, servicename string) (*grpc.ClientConn, error) {
c := GetConn(schema, etcdaddr, servicename) c := GetConn(schema, etcdaddr, servicename, "0")
if c != nil { if c != nil {
return c, nil return c, nil
} else { } else {

View File

@ -36,7 +36,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_auth_88965eda3ab7f34d, []int{0} return fileDescriptor_auth_68293efd650e0000, []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)
@ -82,7 +82,7 @@ func (m *UserRegisterReq) Reset() { *m = UserRegisterReq{} }
func (m *UserRegisterReq) String() string { return proto.CompactTextString(m) } func (m *UserRegisterReq) String() string { return proto.CompactTextString(m) }
func (*UserRegisterReq) ProtoMessage() {} func (*UserRegisterReq) ProtoMessage() {}
func (*UserRegisterReq) Descriptor() ([]byte, []int) { func (*UserRegisterReq) Descriptor() ([]byte, []int) {
return fileDescriptor_auth_88965eda3ab7f34d, []int{1} return fileDescriptor_auth_68293efd650e0000, []int{1}
} }
func (m *UserRegisterReq) XXX_Unmarshal(b []byte) error { func (m *UserRegisterReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserRegisterReq.Unmarshal(m, b) return xxx_messageInfo_UserRegisterReq.Unmarshal(m, b)
@ -127,7 +127,7 @@ func (m *UserRegisterResp) Reset() { *m = UserRegisterResp{} }
func (m *UserRegisterResp) String() string { return proto.CompactTextString(m) } func (m *UserRegisterResp) String() string { return proto.CompactTextString(m) }
func (*UserRegisterResp) ProtoMessage() {} func (*UserRegisterResp) ProtoMessage() {}
func (*UserRegisterResp) Descriptor() ([]byte, []int) { func (*UserRegisterResp) Descriptor() ([]byte, []int) {
return fileDescriptor_auth_88965eda3ab7f34d, []int{2} return fileDescriptor_auth_68293efd650e0000, []int{2}
} }
func (m *UserRegisterResp) XXX_Unmarshal(b []byte) error { func (m *UserRegisterResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserRegisterResp.Unmarshal(m, b) return xxx_messageInfo_UserRegisterResp.Unmarshal(m, b)
@ -168,7 +168,7 @@ func (m *UserTokenReq) Reset() { *m = UserTokenReq{} }
func (m *UserTokenReq) String() string { return proto.CompactTextString(m) } func (m *UserTokenReq) String() string { return proto.CompactTextString(m) }
func (*UserTokenReq) ProtoMessage() {} func (*UserTokenReq) ProtoMessage() {}
func (*UserTokenReq) Descriptor() ([]byte, []int) { func (*UserTokenReq) Descriptor() ([]byte, []int) {
return fileDescriptor_auth_88965eda3ab7f34d, []int{3} return fileDescriptor_auth_68293efd650e0000, []int{3}
} }
func (m *UserTokenReq) XXX_Unmarshal(b []byte) error { func (m *UserTokenReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserTokenReq.Unmarshal(m, b) return xxx_messageInfo_UserTokenReq.Unmarshal(m, b)
@ -229,7 +229,7 @@ func (m *UserTokenResp) Reset() { *m = UserTokenResp{} }
func (m *UserTokenResp) String() string { return proto.CompactTextString(m) } func (m *UserTokenResp) String() string { return proto.CompactTextString(m) }
func (*UserTokenResp) ProtoMessage() {} func (*UserTokenResp) ProtoMessage() {}
func (*UserTokenResp) Descriptor() ([]byte, []int) { func (*UserTokenResp) Descriptor() ([]byte, []int) {
return fileDescriptor_auth_88965eda3ab7f34d, []int{4} return fileDescriptor_auth_68293efd650e0000, []int{4}
} }
func (m *UserTokenResp) XXX_Unmarshal(b []byte) error { func (m *UserTokenResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserTokenResp.Unmarshal(m, b) return xxx_messageInfo_UserTokenResp.Unmarshal(m, b)
@ -270,12 +270,114 @@ func (m *UserTokenResp) GetExpiredTime() int64 {
return 0 return 0
} }
type ForceLogoutReq struct {
Platform int32 `protobuf:"varint,1,opt,name=Platform" json:"Platform,omitempty"`
FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"`
OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,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 *ForceLogoutReq) Reset() { *m = ForceLogoutReq{} }
func (m *ForceLogoutReq) String() string { return proto.CompactTextString(m) }
func (*ForceLogoutReq) ProtoMessage() {}
func (*ForceLogoutReq) Descriptor() ([]byte, []int) {
return fileDescriptor_auth_68293efd650e0000, []int{5}
}
func (m *ForceLogoutReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ForceLogoutReq.Unmarshal(m, b)
}
func (m *ForceLogoutReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ForceLogoutReq.Marshal(b, m, deterministic)
}
func (dst *ForceLogoutReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_ForceLogoutReq.Merge(dst, src)
}
func (m *ForceLogoutReq) XXX_Size() int {
return xxx_messageInfo_ForceLogoutReq.Size(m)
}
func (m *ForceLogoutReq) XXX_DiscardUnknown() {
xxx_messageInfo_ForceLogoutReq.DiscardUnknown(m)
}
var xxx_messageInfo_ForceLogoutReq proto.InternalMessageInfo
func (m *ForceLogoutReq) GetPlatform() int32 {
if m != nil {
return m.Platform
}
return 0
}
func (m *ForceLogoutReq) GetFromUserID() string {
if m != nil {
return m.FromUserID
}
return ""
}
func (m *ForceLogoutReq) GetOpUserID() string {
if m != nil {
return m.OpUserID
}
return ""
}
func (m *ForceLogoutReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
type ForceLogoutResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ForceLogoutResp) Reset() { *m = ForceLogoutResp{} }
func (m *ForceLogoutResp) String() string { return proto.CompactTextString(m) }
func (*ForceLogoutResp) ProtoMessage() {}
func (*ForceLogoutResp) Descriptor() ([]byte, []int) {
return fileDescriptor_auth_68293efd650e0000, []int{6}
}
func (m *ForceLogoutResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ForceLogoutResp.Unmarshal(m, b)
}
func (m *ForceLogoutResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ForceLogoutResp.Marshal(b, m, deterministic)
}
func (dst *ForceLogoutResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_ForceLogoutResp.Merge(dst, src)
}
func (m *ForceLogoutResp) XXX_Size() int {
return xxx_messageInfo_ForceLogoutResp.Size(m)
}
func (m *ForceLogoutResp) XXX_DiscardUnknown() {
xxx_messageInfo_ForceLogoutResp.DiscardUnknown(m)
}
var xxx_messageInfo_ForceLogoutResp proto.InternalMessageInfo
func (m *ForceLogoutResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
func init() { func init() {
proto.RegisterType((*CommonResp)(nil), "pbAuth.CommonResp") proto.RegisterType((*CommonResp)(nil), "pbAuth.CommonResp")
proto.RegisterType((*UserRegisterReq)(nil), "pbAuth.UserRegisterReq") proto.RegisterType((*UserRegisterReq)(nil), "pbAuth.UserRegisterReq")
proto.RegisterType((*UserRegisterResp)(nil), "pbAuth.UserRegisterResp") proto.RegisterType((*UserRegisterResp)(nil), "pbAuth.UserRegisterResp")
proto.RegisterType((*UserTokenReq)(nil), "pbAuth.UserTokenReq") proto.RegisterType((*UserTokenReq)(nil), "pbAuth.UserTokenReq")
proto.RegisterType((*UserTokenResp)(nil), "pbAuth.UserTokenResp") proto.RegisterType((*UserTokenResp)(nil), "pbAuth.UserTokenResp")
proto.RegisterType((*ForceLogoutReq)(nil), "pbAuth.ForceLogoutReq")
proto.RegisterType((*ForceLogoutResp)(nil), "pbAuth.ForceLogoutResp")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -291,6 +393,7 @@ const _ = grpc.SupportPackageIsVersion4
type AuthClient interface { type AuthClient interface {
UserRegister(ctx context.Context, in *UserRegisterReq, opts ...grpc.CallOption) (*UserRegisterResp, error) UserRegister(ctx context.Context, in *UserRegisterReq, opts ...grpc.CallOption) (*UserRegisterResp, error)
UserToken(ctx context.Context, in *UserTokenReq, opts ...grpc.CallOption) (*UserTokenResp, error) UserToken(ctx context.Context, in *UserTokenReq, opts ...grpc.CallOption) (*UserTokenResp, error)
ForceLogout(ctx context.Context, in *ForceLogoutReq, opts ...grpc.CallOption) (*ForceLogoutResp, error)
} }
type authClient struct { type authClient struct {
@ -319,11 +422,21 @@ func (c *authClient) UserToken(ctx context.Context, in *UserTokenReq, opts ...gr
return out, nil return out, nil
} }
func (c *authClient) ForceLogout(ctx context.Context, in *ForceLogoutReq, opts ...grpc.CallOption) (*ForceLogoutResp, error) {
out := new(ForceLogoutResp)
err := grpc.Invoke(ctx, "/pbAuth.Auth/ForceLogout", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Auth service // Server API for Auth service
type AuthServer interface { type AuthServer interface {
UserRegister(context.Context, *UserRegisterReq) (*UserRegisterResp, error) UserRegister(context.Context, *UserRegisterReq) (*UserRegisterResp, error)
UserToken(context.Context, *UserTokenReq) (*UserTokenResp, error) UserToken(context.Context, *UserTokenReq) (*UserTokenResp, error)
ForceLogout(context.Context, *ForceLogoutReq) (*ForceLogoutResp, error)
} }
func RegisterAuthServer(s *grpc.Server, srv AuthServer) { func RegisterAuthServer(s *grpc.Server, srv AuthServer) {
@ -366,6 +479,24 @@ func _Auth_UserToken_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Auth_ForceLogout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ForceLogoutReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).ForceLogout(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbAuth.Auth/ForceLogout",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).ForceLogout(ctx, req.(*ForceLogoutReq))
}
return interceptor(ctx, in, info, handler)
}
var _Auth_serviceDesc = grpc.ServiceDesc{ var _Auth_serviceDesc = grpc.ServiceDesc{
ServiceName: "pbAuth.Auth", ServiceName: "pbAuth.Auth",
HandlerType: (*AuthServer)(nil), HandlerType: (*AuthServer)(nil),
@ -378,37 +509,44 @@ var _Auth_serviceDesc = grpc.ServiceDesc{
MethodName: "UserToken", MethodName: "UserToken",
Handler: _Auth_UserToken_Handler, Handler: _Auth_UserToken_Handler,
}, },
{
MethodName: "ForceLogout",
Handler: _Auth_ForceLogout_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "auth/auth.proto", Metadata: "auth/auth.proto",
} }
func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_88965eda3ab7f34d) } func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_68293efd650e0000) }
var fileDescriptor_auth_88965eda3ab7f34d = []byte{ var fileDescriptor_auth_68293efd650e0000 = []byte{
// 369 bytes of a gzipped FileDescriptorProto // 417 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x4b, 0xc3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x53, 0x5d, 0x8b, 0xda, 0x40,
0x10, 0x25, 0xf6, 0xc3, 0x76, 0x6a, 0xa9, 0x2c, 0x55, 0x43, 0x04, 0xa9, 0x39, 0xf5, 0x94, 0x40, 0x14, 0x25, 0xf5, 0xa3, 0x7a, 0xad, 0x4d, 0x19, 0xac, 0x86, 0x14, 0x8a, 0xcd, 0x93, 0x4f, 0x09,
0x3d, 0x28, 0x08, 0x42, 0xad, 0x16, 0x7a, 0x28, 0x95, 0xa5, 0x5e, 0xbc, 0x84, 0x94, 0x6e, 0xdb, 0xd8, 0x87, 0x16, 0x0a, 0x82, 0xb5, 0x0a, 0x42, 0xc5, 0x12, 0xec, 0xcb, 0xbe, 0x84, 0xb8, 0x8e,
0x90, 0x26, 0xbb, 0xee, 0xa6, 0x56, 0xf0, 0xe8, 0xc5, 0x9f, 0x2d, 0xbb, 0xf9, 0x70, 0xad, 0x3d, 0x31, 0x68, 0x32, 0xb3, 0x33, 0x71, 0x5d, 0xd8, 0x3f, 0xb0, 0xec, 0xdf, 0xda, 0x3f, 0xb6, 0xcc,
0x79, 0x49, 0x98, 0x79, 0x2f, 0xf3, 0xde, 0x9b, 0x0c, 0xb4, 0xfc, 0x4d, 0xb2, 0x72, 0xe5, 0xc3, 0xe4, 0x63, 0x47, 0xd7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, 0x4f, 0x2e,
0xea, 0x36, 0xaf, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x20, 0x74, 0x9f, 0xd9, 0x02, 0x00, 0xac, 0x69, 0x9c, 0x27, 0x38, 0x45, 0x3f, 0xa1, 0x5e, 0x1c, 0x0e, 0x6a, 0xa9, 0xb2, 0xfc, 0xe6,
0x98, 0x9f, 0xcf, 0xa0, 0x9c, 0xa2, 0x01, 0x34, 0x94, 0x30, 0xa8, 0x9d, 0xab, 0x8e, 0xa7, 0x6d,
0x76, 0xce, 0xe2, 0x9c, 0xfe, 0xd6, 0xaf, 0x9a, 0xb6, 0x7c, 0xd2, 0xbf, 0x52, 0xc1, 0xb2, 0x2a,
0xdf, 0xeb, 0xf7, 0xe7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xed, 0x61, 0xac, 0x2b, 0xed, 0x03, 0x00,
0x00, 0x00,
} }

View File

@ -30,7 +30,23 @@ message UserTokenResp {
} }
message ForceLogoutReq {
int32 Platform = 1;
string FromUserID = 2;
string OpUserID = 3;
string OperationID = 4;
}
message ForceLogoutResp {
CommonResp CommonResp = 1;
}
service Auth { service Auth {
rpc UserRegister(UserRegisterReq) returns(UserRegisterResp); rpc UserRegister(UserRegisterReq) returns(UserRegisterResp);
rpc UserToken(UserTokenReq) returns(UserTokenResp); rpc UserToken(UserTokenReq) returns(UserTokenResp);
rpc ForceLogout(ForceLogoutReq) returns(ForceLogoutResp);
} }

View File

@ -4,6 +4,7 @@ source ./proto_dir.cfg
for ((i = 0; i < ${#all_proto[*]}; i++)); do for ((i = 0; i < ${#all_proto[*]}; i++)); do
proto=${all_proto[$i]} proto=${all_proto[$i]}
protoc -I ../../../ -I ./ --go_out=plugins=grpc:. $proto protoc -I ../../../ -I ./ --go_out=plugins=grpc:. $proto
s=`echo $proto | sed 's/ //g'` s=`echo $proto | sed 's/ //g'`
v=${s//proto/pb.go} v=${s//proto/pb.go}
@ -11,3 +12,6 @@ for ((i = 0; i < ${#all_proto[*]}; i++)); do
echo "protoc --go_out=plugins=grpc:." $proto echo "protoc --go_out=plugins=grpc:." $proto
done done
echo "proto file generate success..." echo "proto file generate success..."
find ./ -type f -path "*.pb.go"|xargs sed -i 's/\".\/sdk_ws\"/\"Open_IM\/pkg\/proto\/sdk_ws\"/g'

View File

@ -37,7 +37,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} }
func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) } func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) }
func (*MsgDataToMQ) ProtoMessage() {} func (*MsgDataToMQ) ProtoMessage() {}
func (*MsgDataToMQ) Descriptor() ([]byte, []int) { func (*MsgDataToMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_83f286704599d5b1, []int{0} return fileDescriptor_chat_64077d68a66b2cfd, []int{0}
} }
func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error { func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b) return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b)
@ -90,7 +90,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} }
func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) } func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) }
func (*MsgDataToDB) ProtoMessage() {} func (*MsgDataToDB) ProtoMessage() {}
func (*MsgDataToDB) Descriptor() ([]byte, []int) { func (*MsgDataToDB) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_83f286704599d5b1, []int{1} return fileDescriptor_chat_64077d68a66b2cfd, []int{1}
} }
func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error { func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b) return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b)
@ -137,7 +137,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} }
func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) } func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) }
func (*PushMsgDataToMQ) ProtoMessage() {} func (*PushMsgDataToMQ) ProtoMessage() {}
func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) { func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_83f286704599d5b1, []int{2} return fileDescriptor_chat_64077d68a66b2cfd, []int{2}
} }
func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error { func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b) return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b)
@ -178,6 +178,68 @@ func (m *PushMsgDataToMQ) GetPushToUserID() string {
return "" return ""
} }
type MsgDataToMongoByMQ struct {
LastSeq uint64 `protobuf:"varint,1,opt,name=lastSeq" json:"lastSeq,omitempty"`
AggregationID string `protobuf:"bytes,2,opt,name=aggregationID" json:"aggregationID,omitempty"`
MessageList []*MsgDataToMQ `protobuf:"bytes,3,rep,name=messageList" json:"messageList,omitempty"`
TriggerID string `protobuf:"bytes,4,opt,name=triggerID" json:"triggerID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MsgDataToMongoByMQ) Reset() { *m = MsgDataToMongoByMQ{} }
func (m *MsgDataToMongoByMQ) String() string { return proto.CompactTextString(m) }
func (*MsgDataToMongoByMQ) ProtoMessage() {}
func (*MsgDataToMongoByMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_64077d68a66b2cfd, []int{3}
}
func (m *MsgDataToMongoByMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToMongoByMQ.Unmarshal(m, b)
}
func (m *MsgDataToMongoByMQ) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MsgDataToMongoByMQ.Marshal(b, m, deterministic)
}
func (dst *MsgDataToMongoByMQ) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgDataToMongoByMQ.Merge(dst, src)
}
func (m *MsgDataToMongoByMQ) XXX_Size() int {
return xxx_messageInfo_MsgDataToMongoByMQ.Size(m)
}
func (m *MsgDataToMongoByMQ) XXX_DiscardUnknown() {
xxx_messageInfo_MsgDataToMongoByMQ.DiscardUnknown(m)
}
var xxx_messageInfo_MsgDataToMongoByMQ proto.InternalMessageInfo
func (m *MsgDataToMongoByMQ) GetLastSeq() uint64 {
if m != nil {
return m.LastSeq
}
return 0
}
func (m *MsgDataToMongoByMQ) GetAggregationID() string {
if m != nil {
return m.AggregationID
}
return ""
}
func (m *MsgDataToMongoByMQ) GetMessageList() []*MsgDataToMQ {
if m != nil {
return m.MessageList
}
return nil
}
func (m *MsgDataToMongoByMQ) GetTriggerID() string {
if m != nil {
return m.TriggerID
}
return ""
}
// message PullMessageReq { // message PullMessageReq {
// string UserID = 1; // string UserID = 1;
// int64 SeqBegin = 2; // int64 SeqBegin = 2;
@ -210,7 +272,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_83f286704599d5b1, []int{3} return fileDescriptor_chat_64077d68a66b2cfd, []int{4}
} }
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
@ -258,7 +320,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_83f286704599d5b1, []int{4} return fileDescriptor_chat_64077d68a66b2cfd, []int{5}
} }
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
@ -319,7 +381,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} }
func (m *SendMsgReq) String() string { return proto.CompactTextString(m) } func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
func (*SendMsgReq) ProtoMessage() {} func (*SendMsgReq) ProtoMessage() {}
func (*SendMsgReq) Descriptor() ([]byte, []int) { func (*SendMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_83f286704599d5b1, []int{5} return fileDescriptor_chat_64077d68a66b2cfd, []int{6}
} }
func (m *SendMsgReq) XXX_Unmarshal(b []byte) error { func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsgReq.Unmarshal(m, b) return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
@ -375,7 +437,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} }
func (m *SendMsgResp) String() string { return proto.CompactTextString(m) } func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
func (*SendMsgResp) ProtoMessage() {} func (*SendMsgResp) ProtoMessage() {}
func (*SendMsgResp) Descriptor() ([]byte, []int) { func (*SendMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_83f286704599d5b1, []int{6} return fileDescriptor_chat_64077d68a66b2cfd, []int{7}
} }
func (m *SendMsgResp) XXX_Unmarshal(b []byte) error { func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsgResp.Unmarshal(m, b) return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
@ -430,14 +492,117 @@ func (m *SendMsgResp) GetSendTime() int64 {
return 0 return 0
} }
type ClearMsgReq struct {
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
OpUserID string `protobuf:"bytes,2,opt,name=opUserID" json:"opUserID,omitempty"`
OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ClearMsgReq) Reset() { *m = ClearMsgReq{} }
func (m *ClearMsgReq) String() string { return proto.CompactTextString(m) }
func (*ClearMsgReq) ProtoMessage() {}
func (*ClearMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_64077d68a66b2cfd, []int{8}
}
func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b)
}
func (m *ClearMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ClearMsgReq.Marshal(b, m, deterministic)
}
func (dst *ClearMsgReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_ClearMsgReq.Merge(dst, src)
}
func (m *ClearMsgReq) XXX_Size() int {
return xxx_messageInfo_ClearMsgReq.Size(m)
}
func (m *ClearMsgReq) XXX_DiscardUnknown() {
xxx_messageInfo_ClearMsgReq.DiscardUnknown(m)
}
var xxx_messageInfo_ClearMsgReq proto.InternalMessageInfo
func (m *ClearMsgReq) GetUserID() string {
if m != nil {
return m.UserID
}
return ""
}
func (m *ClearMsgReq) GetOpUserID() string {
if m != nil {
return m.OpUserID
}
return ""
}
func (m *ClearMsgReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
type ClearMsgResp struct {
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ClearMsgResp) Reset() { *m = ClearMsgResp{} }
func (m *ClearMsgResp) String() string { return proto.CompactTextString(m) }
func (*ClearMsgResp) ProtoMessage() {}
func (*ClearMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_64077d68a66b2cfd, []int{9}
}
func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b)
}
func (m *ClearMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ClearMsgResp.Marshal(b, m, deterministic)
}
func (dst *ClearMsgResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_ClearMsgResp.Merge(dst, src)
}
func (m *ClearMsgResp) XXX_Size() int {
return xxx_messageInfo_ClearMsgResp.Size(m)
}
func (m *ClearMsgResp) XXX_DiscardUnknown() {
xxx_messageInfo_ClearMsgResp.DiscardUnknown(m)
}
var xxx_messageInfo_ClearMsgResp proto.InternalMessageInfo
func (m *ClearMsgResp) GetErrCode() int32 {
if m != nil {
return m.ErrCode
}
return 0
}
func (m *ClearMsgResp) GetErrMsg() string {
if m != nil {
return m.ErrMsg
}
return ""
}
func init() { func init() {
proto.RegisterType((*MsgDataToMQ)(nil), "pbChat.MsgDataToMQ") proto.RegisterType((*MsgDataToMQ)(nil), "pbChat.MsgDataToMQ")
proto.RegisterType((*MsgDataToDB)(nil), "pbChat.MsgDataToDB") proto.RegisterType((*MsgDataToDB)(nil), "pbChat.MsgDataToDB")
proto.RegisterType((*PushMsgDataToMQ)(nil), "pbChat.PushMsgDataToMQ") proto.RegisterType((*PushMsgDataToMQ)(nil), "pbChat.PushMsgDataToMQ")
proto.RegisterType((*MsgDataToMongoByMQ)(nil), "pbChat.MsgDataToMongoByMQ")
proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "pbChat.GetMaxAndMinSeqReq") proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "pbChat.GetMaxAndMinSeqReq")
proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "pbChat.GetMaxAndMinSeqResp") proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "pbChat.GetMaxAndMinSeqResp")
proto.RegisterType((*SendMsgReq)(nil), "pbChat.SendMsgReq") proto.RegisterType((*SendMsgReq)(nil), "pbChat.SendMsgReq")
proto.RegisterType((*SendMsgResp)(nil), "pbChat.SendMsgResp") proto.RegisterType((*SendMsgResp)(nil), "pbChat.SendMsgResp")
proto.RegisterType((*ClearMsgReq)(nil), "pbChat.ClearMsgReq")
proto.RegisterType((*ClearMsgResp)(nil), "pbChat.ClearMsgResp")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -451,10 +616,11 @@ const _ = grpc.SupportPackageIsVersion4
// Client API for Chat service // Client API for Chat service
type ChatClient interface { type ChatClient interface {
GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*GetMaxAndMinSeqResp, error) GetMaxAndMinSeq(ctx context.Context, in *sdk_ws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdk_ws.GetMaxAndMinSeqResp, error)
PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error) PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error)
SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error)
DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error) DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error)
ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc.CallOption) (*ClearMsgResp, error)
} }
type chatClient struct { type chatClient struct {
@ -465,8 +631,8 @@ func NewChatClient(cc *grpc.ClientConn) ChatClient {
return &chatClient{cc} return &chatClient{cc}
} }
func (c *chatClient) GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*GetMaxAndMinSeqResp, error) { func (c *chatClient) GetMaxAndMinSeq(ctx context.Context, in *sdk_ws.GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*sdk_ws.GetMaxAndMinSeqResp, error) {
out := new(GetMaxAndMinSeqResp) out := new(sdk_ws.GetMaxAndMinSeqResp)
err := grpc.Invoke(ctx, "/pbChat.Chat/GetMaxAndMinSeq", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/pbChat.Chat/GetMaxAndMinSeq", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -501,13 +667,23 @@ func (c *chatClient) DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, o
return out, nil return out, nil
} }
func (c *chatClient) ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc.CallOption) (*ClearMsgResp, error) {
out := new(ClearMsgResp)
err := grpc.Invoke(ctx, "/pbChat.Chat/ClearMsg", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Chat service // Server API for Chat service
type ChatServer interface { type ChatServer interface {
GetMaxAndMinSeq(context.Context, *GetMaxAndMinSeqReq) (*GetMaxAndMinSeqResp, error) GetMaxAndMinSeq(context.Context, *sdk_ws.GetMaxAndMinSeqReq) (*sdk_ws.GetMaxAndMinSeqResp, error)
PullMessageBySeqList(context.Context, *sdk_ws.PullMessageBySeqListReq) (*sdk_ws.PullMessageBySeqListResp, error) PullMessageBySeqList(context.Context, *sdk_ws.PullMessageBySeqListReq) (*sdk_ws.PullMessageBySeqListResp, error)
SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error)
DelMsgList(context.Context, *sdk_ws.DelMsgListReq) (*sdk_ws.DelMsgListResp, error) DelMsgList(context.Context, *sdk_ws.DelMsgListReq) (*sdk_ws.DelMsgListResp, error)
ClearMsg(context.Context, *ClearMsgReq) (*ClearMsgResp, error)
} }
func RegisterChatServer(s *grpc.Server, srv ChatServer) { func RegisterChatServer(s *grpc.Server, srv ChatServer) {
@ -515,7 +691,7 @@ func RegisterChatServer(s *grpc.Server, srv ChatServer) {
} }
func _Chat_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Chat_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMaxAndMinSeqReq) in := new(sdk_ws.GetMaxAndMinSeqReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -527,7 +703,7 @@ func _Chat_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec fun
FullMethod: "/pbChat.Chat/GetMaxAndMinSeq", FullMethod: "/pbChat.Chat/GetMaxAndMinSeq",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).GetMaxAndMinSeq(ctx, req.(*GetMaxAndMinSeqReq)) return srv.(ChatServer).GetMaxAndMinSeq(ctx, req.(*sdk_ws.GetMaxAndMinSeqReq))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -586,6 +762,24 @@ func _Chat_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Chat_ClearMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClearMsgReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServer).ClearMsg(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbChat.Chat/ClearMsg",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).ClearMsg(ctx, req.(*ClearMsgReq))
}
return interceptor(ctx, in, info, handler)
}
var _Chat_serviceDesc = grpc.ServiceDesc{ var _Chat_serviceDesc = grpc.ServiceDesc{
ServiceName: "pbChat.Chat", ServiceName: "pbChat.Chat",
HandlerType: (*ChatServer)(nil), HandlerType: (*ChatServer)(nil),
@ -606,45 +800,57 @@ var _Chat_serviceDesc = grpc.ServiceDesc{
MethodName: "DelMsgList", MethodName: "DelMsgList",
Handler: _Chat_DelMsgList_Handler, Handler: _Chat_DelMsgList_Handler,
}, },
{
MethodName: "ClearMsg",
Handler: _Chat_ClearMsg_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "chat/chat.proto", Metadata: "chat/chat.proto",
} }
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_83f286704599d5b1) } func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_64077d68a66b2cfd) }
var fileDescriptor_chat_83f286704599d5b1 = []byte{ var fileDescriptor_chat_64077d68a66b2cfd = []byte{
// 507 bytes of a gzipped FileDescriptorProto // 636 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xcd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, 0xe6, 0x13, 0xf4, 0xc6, 0x9e, 0xde, 0x94, 0xcd, 0xf7, 0xe5, 0xd5, 0x9f, 0x00,
0x00, 0x00, 0xff, 0xff, 0x88, 0x55, 0xa7, 0xa7, 0x9d, 0x06, 0x00, 0x00,
} }

View File

@ -22,6 +22,14 @@ message PushMsgDataToMQ{
server_api_params.MsgData msgData = 2; server_api_params.MsgData msgData = 2;
string pushToUserID = 3; string pushToUserID = 3;
} }
message MsgDataToMongoByMQ{
uint64 lastSeq =1;
string aggregationID = 2;
repeated MsgDataToMQ messageList = 3;
string triggerID = 4;
}
//message PullMessageReq { //message PullMessageReq {
// string UserID = 1; // string UserID = 1;
@ -69,14 +77,25 @@ message SendMsgResp {
string serverMsgID = 4; string serverMsgID = 4;
string clientMsgID = 5; string clientMsgID = 5;
int64 sendTime = 6; int64 sendTime = 6;
} }
message ClearMsgReq{
string userID = 1;
string opUserID = 2;
string operationID = 3;
}
message ClearMsgResp{
int32 errCode = 1;
string errMsg = 2;
}
service Chat { service Chat {
rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp); rpc GetMaxAndMinSeq(server_api_params.GetMaxAndMinSeqReq) returns(server_api_params.GetMaxAndMinSeqResp);
rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp); rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp);
rpc SendMsg(SendMsgReq) returns(SendMsgResp); rpc SendMsg(SendMsgReq) returns(SendMsgResp);
rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp); rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp);
rpc ClearMsg(ClearMsgReq) returns(ClearMsgResp);
} }

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@ message GroupAddMemberInfo{
int32 RoleLevel = 2; int32 RoleLevel = 2;
} }
message CreateGroupReq{ message CreateGroupReq{
repeated GroupAddMemberInfo InitMemberList = 1; repeated GroupAddMemberInfo InitMemberList = 1;
server_api_params.GroupInfo GroupInfo = 2; server_api_params.GroupInfo GroupInfo = 2;
@ -392,6 +391,28 @@ message SetGroupMemberNicknameResp{
CommonResp CommonResp = 1; CommonResp CommonResp = 1;
} }
message GetJoinedSuperGroupListReq {
string operationID = 1;
string userID = 2;
string opUserID = 3;
}
message GetJoinedSuperGroupListResp {
CommonResp commonResp = 1;
repeated server_api_params.GroupInfo GroupList = 3;
}
message GetSuperGroupsInfoReq {
repeated string GroupIDList = 1;
string OperationID = 2;
string OpUserID = 3; //No verification permission
}
message GetSuperGroupsInfoResp {
CommonResp commonResp = 1;
repeated server_api_params.GroupInfo GroupInfoList = 3;
}
message SetGroupMemberInfoReq{ message SetGroupMemberInfoReq{
string groupID = 1; string groupID = 1;
string userID = 2; string userID = 2;
@ -441,7 +462,11 @@ service group{
rpc CancelMuteGroup(CancelMuteGroupReq) returns(CancelMuteGroupResp); rpc CancelMuteGroup(CancelMuteGroupReq) returns(CancelMuteGroupResp);
rpc SetGroupMemberNickname(SetGroupMemberNicknameReq) returns (SetGroupMemberNicknameResp); rpc SetGroupMemberNickname(SetGroupMemberNicknameReq) returns (SetGroupMemberNicknameResp);
rpc GetJoinedSuperGroupList(GetJoinedSuperGroupListReq) returns (GetJoinedSuperGroupListResp);
rpc GetSuperGroupsInfo(GetSuperGroupsInfoReq) returns (GetSuperGroupsInfoResp);
rpc SetGroupMemberInfo(SetGroupMemberInfoReq) returns (SetGroupMemberInfoResp); rpc SetGroupMemberInfo(SetGroupMemberInfoReq) returns (SetGroupMemberInfoResp);
} }

View File

@ -37,7 +37,7 @@ func (m *CreateDepartmentReq) Reset() { *m = CreateDepartmentReq{} }
func (m *CreateDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *CreateDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*CreateDepartmentReq) ProtoMessage() {} func (*CreateDepartmentReq) ProtoMessage() {}
func (*CreateDepartmentReq) Descriptor() ([]byte, []int) { func (*CreateDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{0} return fileDescriptor_organization_2845c40b2de0bcf0, []int{0}
} }
func (m *CreateDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *CreateDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_CreateDepartmentReq.Unmarshal(m, b)
@ -91,7 +91,7 @@ func (m *CreateDepartmentResp) Reset() { *m = CreateDepartmentResp{} }
func (m *CreateDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *CreateDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*CreateDepartmentResp) ProtoMessage() {} func (*CreateDepartmentResp) ProtoMessage() {}
func (*CreateDepartmentResp) Descriptor() ([]byte, []int) { func (*CreateDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{1} return fileDescriptor_organization_2845c40b2de0bcf0, []int{1}
} }
func (m *CreateDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *CreateDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_CreateDepartmentResp.Unmarshal(m, b)
@ -145,7 +145,7 @@ func (m *UpdateDepartmentReq) Reset() { *m = UpdateDepartmentReq{} }
func (m *UpdateDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *UpdateDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*UpdateDepartmentReq) ProtoMessage() {} func (*UpdateDepartmentReq) ProtoMessage() {}
func (*UpdateDepartmentReq) Descriptor() ([]byte, []int) { func (*UpdateDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{2} return fileDescriptor_organization_2845c40b2de0bcf0, []int{2}
} }
func (m *UpdateDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *UpdateDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_UpdateDepartmentReq.Unmarshal(m, b)
@ -198,7 +198,7 @@ func (m *UpdateDepartmentResp) Reset() { *m = UpdateDepartmentResp{} }
func (m *UpdateDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *UpdateDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*UpdateDepartmentResp) ProtoMessage() {} func (*UpdateDepartmentResp) ProtoMessage() {}
func (*UpdateDepartmentResp) Descriptor() ([]byte, []int) { func (*UpdateDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{3} return fileDescriptor_organization_2845c40b2de0bcf0, []int{3}
} }
func (m *UpdateDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *UpdateDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_UpdateDepartmentResp.Unmarshal(m, b)
@ -245,7 +245,7 @@ func (m *GetSubDepartmentReq) Reset() { *m = GetSubDepartmentReq{} }
func (m *GetSubDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *GetSubDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*GetSubDepartmentReq) ProtoMessage() {} func (*GetSubDepartmentReq) ProtoMessage() {}
func (*GetSubDepartmentReq) Descriptor() ([]byte, []int) { func (*GetSubDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{4} return fileDescriptor_organization_2845c40b2de0bcf0, []int{4}
} }
func (m *GetSubDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *GetSubDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSubDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_GetSubDepartmentReq.Unmarshal(m, b)
@ -299,7 +299,7 @@ func (m *GetSubDepartmentResp) Reset() { *m = GetSubDepartmentResp{} }
func (m *GetSubDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *GetSubDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*GetSubDepartmentResp) ProtoMessage() {} func (*GetSubDepartmentResp) ProtoMessage() {}
func (*GetSubDepartmentResp) Descriptor() ([]byte, []int) { func (*GetSubDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{5} return fileDescriptor_organization_2845c40b2de0bcf0, []int{5}
} }
func (m *GetSubDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *GetSubDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSubDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_GetSubDepartmentResp.Unmarshal(m, b)
@ -353,7 +353,7 @@ func (m *DeleteDepartmentReq) Reset() { *m = DeleteDepartmentReq{} }
func (m *DeleteDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *DeleteDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*DeleteDepartmentReq) ProtoMessage() {} func (*DeleteDepartmentReq) ProtoMessage() {}
func (*DeleteDepartmentReq) Descriptor() ([]byte, []int) { func (*DeleteDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{6} return fileDescriptor_organization_2845c40b2de0bcf0, []int{6}
} }
func (m *DeleteDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *DeleteDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_DeleteDepartmentReq.Unmarshal(m, b)
@ -406,7 +406,7 @@ func (m *DeleteDepartmentResp) Reset() { *m = DeleteDepartmentResp{} }
func (m *DeleteDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *DeleteDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*DeleteDepartmentResp) ProtoMessage() {} func (*DeleteDepartmentResp) ProtoMessage() {}
func (*DeleteDepartmentResp) Descriptor() ([]byte, []int) { func (*DeleteDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{7} return fileDescriptor_organization_2845c40b2de0bcf0, []int{7}
} }
func (m *DeleteDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *DeleteDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_DeleteDepartmentResp.Unmarshal(m, b)
@ -452,7 +452,7 @@ func (m *GetDepartmentParentIDListReq) Reset() { *m = GetDepartmentParen
func (m *GetDepartmentParentIDListReq) String() string { return proto.CompactTextString(m) } func (m *GetDepartmentParentIDListReq) String() string { return proto.CompactTextString(m) }
func (*GetDepartmentParentIDListReq) ProtoMessage() {} func (*GetDepartmentParentIDListReq) ProtoMessage() {}
func (*GetDepartmentParentIDListReq) Descriptor() ([]byte, []int) { func (*GetDepartmentParentIDListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{8} return fileDescriptor_organization_2845c40b2de0bcf0, []int{8}
} }
func (m *GetDepartmentParentIDListReq) XXX_Unmarshal(b []byte) error { func (m *GetDepartmentParentIDListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetDepartmentParentIDListReq.Unmarshal(m, b) return xxx_messageInfo_GetDepartmentParentIDListReq.Unmarshal(m, b)
@ -499,7 +499,7 @@ func (m *GetDepartmentParentIDListResp) Reset() { *m = GetDepartmentPare
func (m *GetDepartmentParentIDListResp) String() string { return proto.CompactTextString(m) } func (m *GetDepartmentParentIDListResp) String() string { return proto.CompactTextString(m) }
func (*GetDepartmentParentIDListResp) ProtoMessage() {} func (*GetDepartmentParentIDListResp) ProtoMessage() {}
func (*GetDepartmentParentIDListResp) Descriptor() ([]byte, []int) { func (*GetDepartmentParentIDListResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{9} return fileDescriptor_organization_2845c40b2de0bcf0, []int{9}
} }
func (m *GetDepartmentParentIDListResp) XXX_Unmarshal(b []byte) error { func (m *GetDepartmentParentIDListResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetDepartmentParentIDListResp.Unmarshal(m, b) return xxx_messageInfo_GetDepartmentParentIDListResp.Unmarshal(m, b)
@ -544,6 +544,7 @@ type CreateOrganizationUserReq struct {
OrganizationUser *sdk_ws.OrganizationUser `protobuf:"bytes,1,opt,name=organizationUser" json:"organizationUser,omitempty"` OrganizationUser *sdk_ws.OrganizationUser `protobuf:"bytes,1,opt,name=organizationUser" json:"organizationUser,omitempty"`
OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
OpUserID string `protobuf:"bytes,3,opt,name=opUserID" json:"opUserID,omitempty"` OpUserID string `protobuf:"bytes,3,opt,name=opUserID" json:"opUserID,omitempty"`
IsRegister bool `protobuf:"varint,4,opt,name=IsRegister" json:"IsRegister,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -553,7 +554,7 @@ func (m *CreateOrganizationUserReq) Reset() { *m = CreateOrganizationUse
func (m *CreateOrganizationUserReq) String() string { return proto.CompactTextString(m) } func (m *CreateOrganizationUserReq) String() string { return proto.CompactTextString(m) }
func (*CreateOrganizationUserReq) ProtoMessage() {} func (*CreateOrganizationUserReq) ProtoMessage() {}
func (*CreateOrganizationUserReq) Descriptor() ([]byte, []int) { func (*CreateOrganizationUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{10} return fileDescriptor_organization_2845c40b2de0bcf0, []int{10}
} }
func (m *CreateOrganizationUserReq) XXX_Unmarshal(b []byte) error { func (m *CreateOrganizationUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrganizationUserReq.Unmarshal(m, b) return xxx_messageInfo_CreateOrganizationUserReq.Unmarshal(m, b)
@ -594,6 +595,13 @@ func (m *CreateOrganizationUserReq) GetOpUserID() string {
return "" return ""
} }
func (m *CreateOrganizationUserReq) GetIsRegister() bool {
if m != nil {
return m.IsRegister
}
return false
}
type CreateOrganizationUserResp struct { type CreateOrganizationUserResp struct {
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
@ -606,7 +614,7 @@ func (m *CreateOrganizationUserResp) Reset() { *m = CreateOrganizationUs
func (m *CreateOrganizationUserResp) String() string { return proto.CompactTextString(m) } func (m *CreateOrganizationUserResp) String() string { return proto.CompactTextString(m) }
func (*CreateOrganizationUserResp) ProtoMessage() {} func (*CreateOrganizationUserResp) ProtoMessage() {}
func (*CreateOrganizationUserResp) Descriptor() ([]byte, []int) { func (*CreateOrganizationUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{11} return fileDescriptor_organization_2845c40b2de0bcf0, []int{11}
} }
func (m *CreateOrganizationUserResp) XXX_Unmarshal(b []byte) error { func (m *CreateOrganizationUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrganizationUserResp.Unmarshal(m, b) return xxx_messageInfo_CreateOrganizationUserResp.Unmarshal(m, b)
@ -653,7 +661,7 @@ func (m *UpdateOrganizationUserReq) Reset() { *m = UpdateOrganizationUse
func (m *UpdateOrganizationUserReq) String() string { return proto.CompactTextString(m) } func (m *UpdateOrganizationUserReq) String() string { return proto.CompactTextString(m) }
func (*UpdateOrganizationUserReq) ProtoMessage() {} func (*UpdateOrganizationUserReq) ProtoMessage() {}
func (*UpdateOrganizationUserReq) Descriptor() ([]byte, []int) { func (*UpdateOrganizationUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{12} return fileDescriptor_organization_2845c40b2de0bcf0, []int{12}
} }
func (m *UpdateOrganizationUserReq) XXX_Unmarshal(b []byte) error { func (m *UpdateOrganizationUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateOrganizationUserReq.Unmarshal(m, b) return xxx_messageInfo_UpdateOrganizationUserReq.Unmarshal(m, b)
@ -706,7 +714,7 @@ func (m *UpdateOrganizationUserResp) Reset() { *m = UpdateOrganizationUs
func (m *UpdateOrganizationUserResp) String() string { return proto.CompactTextString(m) } func (m *UpdateOrganizationUserResp) String() string { return proto.CompactTextString(m) }
func (*UpdateOrganizationUserResp) ProtoMessage() {} func (*UpdateOrganizationUserResp) ProtoMessage() {}
func (*UpdateOrganizationUserResp) Descriptor() ([]byte, []int) { func (*UpdateOrganizationUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{13} return fileDescriptor_organization_2845c40b2de0bcf0, []int{13}
} }
func (m *UpdateOrganizationUserResp) XXX_Unmarshal(b []byte) error { func (m *UpdateOrganizationUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateOrganizationUserResp.Unmarshal(m, b) return xxx_messageInfo_UpdateOrganizationUserResp.Unmarshal(m, b)
@ -753,7 +761,7 @@ func (m *CreateDepartmentMemberReq) Reset() { *m = CreateDepartmentMembe
func (m *CreateDepartmentMemberReq) String() string { return proto.CompactTextString(m) } func (m *CreateDepartmentMemberReq) String() string { return proto.CompactTextString(m) }
func (*CreateDepartmentMemberReq) ProtoMessage() {} func (*CreateDepartmentMemberReq) ProtoMessage() {}
func (*CreateDepartmentMemberReq) Descriptor() ([]byte, []int) { func (*CreateDepartmentMemberReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{14} return fileDescriptor_organization_2845c40b2de0bcf0, []int{14}
} }
func (m *CreateDepartmentMemberReq) XXX_Unmarshal(b []byte) error { func (m *CreateDepartmentMemberReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateDepartmentMemberReq.Unmarshal(m, b) return xxx_messageInfo_CreateDepartmentMemberReq.Unmarshal(m, b)
@ -806,7 +814,7 @@ func (m *CreateDepartmentMemberResp) Reset() { *m = CreateDepartmentMemb
func (m *CreateDepartmentMemberResp) String() string { return proto.CompactTextString(m) } func (m *CreateDepartmentMemberResp) String() string { return proto.CompactTextString(m) }
func (*CreateDepartmentMemberResp) ProtoMessage() {} func (*CreateDepartmentMemberResp) ProtoMessage() {}
func (*CreateDepartmentMemberResp) Descriptor() ([]byte, []int) { func (*CreateDepartmentMemberResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{15} return fileDescriptor_organization_2845c40b2de0bcf0, []int{15}
} }
func (m *CreateDepartmentMemberResp) XXX_Unmarshal(b []byte) error { func (m *CreateDepartmentMemberResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateDepartmentMemberResp.Unmarshal(m, b) return xxx_messageInfo_CreateDepartmentMemberResp.Unmarshal(m, b)
@ -853,7 +861,7 @@ func (m *GetUserInDepartmentReq) Reset() { *m = GetUserInDepartmentReq{}
func (m *GetUserInDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *GetUserInDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*GetUserInDepartmentReq) ProtoMessage() {} func (*GetUserInDepartmentReq) ProtoMessage() {}
func (*GetUserInDepartmentReq) Descriptor() ([]byte, []int) { func (*GetUserInDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{16} return fileDescriptor_organization_2845c40b2de0bcf0, []int{16}
} }
func (m *GetUserInDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *GetUserInDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserInDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_GetUserInDepartmentReq.Unmarshal(m, b)
@ -907,7 +915,7 @@ func (m *GetUserInDepartmentResp) Reset() { *m = GetUserInDepartmentResp
func (m *GetUserInDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *GetUserInDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*GetUserInDepartmentResp) ProtoMessage() {} func (*GetUserInDepartmentResp) ProtoMessage() {}
func (*GetUserInDepartmentResp) Descriptor() ([]byte, []int) { func (*GetUserInDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{17} return fileDescriptor_organization_2845c40b2de0bcf0, []int{17}
} }
func (m *GetUserInDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *GetUserInDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserInDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_GetUserInDepartmentResp.Unmarshal(m, b)
@ -961,7 +969,7 @@ func (m *UpdateUserInDepartmentReq) Reset() { *m = UpdateUserInDepartmen
func (m *UpdateUserInDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *UpdateUserInDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*UpdateUserInDepartmentReq) ProtoMessage() {} func (*UpdateUserInDepartmentReq) ProtoMessage() {}
func (*UpdateUserInDepartmentReq) Descriptor() ([]byte, []int) { func (*UpdateUserInDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{18} return fileDescriptor_organization_2845c40b2de0bcf0, []int{18}
} }
func (m *UpdateUserInDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *UpdateUserInDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateUserInDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_UpdateUserInDepartmentReq.Unmarshal(m, b)
@ -1014,7 +1022,7 @@ func (m *UpdateUserInDepartmentResp) Reset() { *m = UpdateUserInDepartme
func (m *UpdateUserInDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *UpdateUserInDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*UpdateUserInDepartmentResp) ProtoMessage() {} func (*UpdateUserInDepartmentResp) ProtoMessage() {}
func (*UpdateUserInDepartmentResp) Descriptor() ([]byte, []int) { func (*UpdateUserInDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{19} return fileDescriptor_organization_2845c40b2de0bcf0, []int{19}
} }
func (m *UpdateUserInDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *UpdateUserInDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateUserInDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_UpdateUserInDepartmentResp.Unmarshal(m, b)
@ -1062,7 +1070,7 @@ func (m *DeleteUserInDepartmentReq) Reset() { *m = DeleteUserInDepartmen
func (m *DeleteUserInDepartmentReq) String() string { return proto.CompactTextString(m) } func (m *DeleteUserInDepartmentReq) String() string { return proto.CompactTextString(m) }
func (*DeleteUserInDepartmentReq) ProtoMessage() {} func (*DeleteUserInDepartmentReq) ProtoMessage() {}
func (*DeleteUserInDepartmentReq) Descriptor() ([]byte, []int) { func (*DeleteUserInDepartmentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{20} return fileDescriptor_organization_2845c40b2de0bcf0, []int{20}
} }
func (m *DeleteUserInDepartmentReq) XXX_Unmarshal(b []byte) error { func (m *DeleteUserInDepartmentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteUserInDepartmentReq.Unmarshal(m, b) return xxx_messageInfo_DeleteUserInDepartmentReq.Unmarshal(m, b)
@ -1122,7 +1130,7 @@ func (m *DeleteUserInDepartmentResp) Reset() { *m = DeleteUserInDepartme
func (m *DeleteUserInDepartmentResp) String() string { return proto.CompactTextString(m) } func (m *DeleteUserInDepartmentResp) String() string { return proto.CompactTextString(m) }
func (*DeleteUserInDepartmentResp) ProtoMessage() {} func (*DeleteUserInDepartmentResp) ProtoMessage() {}
func (*DeleteUserInDepartmentResp) Descriptor() ([]byte, []int) { func (*DeleteUserInDepartmentResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{21} return fileDescriptor_organization_2845c40b2de0bcf0, []int{21}
} }
func (m *DeleteUserInDepartmentResp) XXX_Unmarshal(b []byte) error { func (m *DeleteUserInDepartmentResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteUserInDepartmentResp.Unmarshal(m, b) return xxx_messageInfo_DeleteUserInDepartmentResp.Unmarshal(m, b)
@ -1169,7 +1177,7 @@ func (m *DeleteOrganizationUserReq) Reset() { *m = DeleteOrganizationUse
func (m *DeleteOrganizationUserReq) String() string { return proto.CompactTextString(m) } func (m *DeleteOrganizationUserReq) String() string { return proto.CompactTextString(m) }
func (*DeleteOrganizationUserReq) ProtoMessage() {} func (*DeleteOrganizationUserReq) ProtoMessage() {}
func (*DeleteOrganizationUserReq) Descriptor() ([]byte, []int) { func (*DeleteOrganizationUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{22} return fileDescriptor_organization_2845c40b2de0bcf0, []int{22}
} }
func (m *DeleteOrganizationUserReq) XXX_Unmarshal(b []byte) error { func (m *DeleteOrganizationUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteOrganizationUserReq.Unmarshal(m, b) return xxx_messageInfo_DeleteOrganizationUserReq.Unmarshal(m, b)
@ -1222,7 +1230,7 @@ func (m *DeleteOrganizationUserResp) Reset() { *m = DeleteOrganizationUs
func (m *DeleteOrganizationUserResp) String() string { return proto.CompactTextString(m) } func (m *DeleteOrganizationUserResp) String() string { return proto.CompactTextString(m) }
func (*DeleteOrganizationUserResp) ProtoMessage() {} func (*DeleteOrganizationUserResp) ProtoMessage() {}
func (*DeleteOrganizationUserResp) Descriptor() ([]byte, []int) { func (*DeleteOrganizationUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{23} return fileDescriptor_organization_2845c40b2de0bcf0, []int{23}
} }
func (m *DeleteOrganizationUserResp) XXX_Unmarshal(b []byte) error { func (m *DeleteOrganizationUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteOrganizationUserResp.Unmarshal(m, b) return xxx_messageInfo_DeleteOrganizationUserResp.Unmarshal(m, b)
@ -1269,7 +1277,7 @@ func (m *GetDepartmentMemberReq) Reset() { *m = GetDepartmentMemberReq{}
func (m *GetDepartmentMemberReq) String() string { return proto.CompactTextString(m) } func (m *GetDepartmentMemberReq) String() string { return proto.CompactTextString(m) }
func (*GetDepartmentMemberReq) ProtoMessage() {} func (*GetDepartmentMemberReq) ProtoMessage() {}
func (*GetDepartmentMemberReq) Descriptor() ([]byte, []int) { func (*GetDepartmentMemberReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{24} return fileDescriptor_organization_2845c40b2de0bcf0, []int{24}
} }
func (m *GetDepartmentMemberReq) XXX_Unmarshal(b []byte) error { func (m *GetDepartmentMemberReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetDepartmentMemberReq.Unmarshal(m, b) return xxx_messageInfo_GetDepartmentMemberReq.Unmarshal(m, b)
@ -1323,7 +1331,7 @@ func (m *GetDepartmentMemberResp) Reset() { *m = GetDepartmentMemberResp
func (m *GetDepartmentMemberResp) String() string { return proto.CompactTextString(m) } func (m *GetDepartmentMemberResp) String() string { return proto.CompactTextString(m) }
func (*GetDepartmentMemberResp) ProtoMessage() {} func (*GetDepartmentMemberResp) ProtoMessage() {}
func (*GetDepartmentMemberResp) Descriptor() ([]byte, []int) { func (*GetDepartmentMemberResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{25} return fileDescriptor_organization_2845c40b2de0bcf0, []int{25}
} }
func (m *GetDepartmentMemberResp) XXX_Unmarshal(b []byte) error { func (m *GetDepartmentMemberResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetDepartmentMemberResp.Unmarshal(m, b) return xxx_messageInfo_GetDepartmentMemberResp.Unmarshal(m, b)
@ -1376,7 +1384,7 @@ func (m *GetDepartmentRelatedGroupIDListReq) Reset() { *m = GetDepartmen
func (m *GetDepartmentRelatedGroupIDListReq) String() string { return proto.CompactTextString(m) } func (m *GetDepartmentRelatedGroupIDListReq) String() string { return proto.CompactTextString(m) }
func (*GetDepartmentRelatedGroupIDListReq) ProtoMessage() {} func (*GetDepartmentRelatedGroupIDListReq) ProtoMessage() {}
func (*GetDepartmentRelatedGroupIDListReq) Descriptor() ([]byte, []int) { func (*GetDepartmentRelatedGroupIDListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{26} return fileDescriptor_organization_2845c40b2de0bcf0, []int{26}
} }
func (m *GetDepartmentRelatedGroupIDListReq) XXX_Unmarshal(b []byte) error { func (m *GetDepartmentRelatedGroupIDListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetDepartmentRelatedGroupIDListReq.Unmarshal(m, b) return xxx_messageInfo_GetDepartmentRelatedGroupIDListReq.Unmarshal(m, b)
@ -1423,7 +1431,7 @@ func (m *GetDepartmentRelatedGroupIDListResp) Reset() { *m = GetDepartme
func (m *GetDepartmentRelatedGroupIDListResp) String() string { return proto.CompactTextString(m) } func (m *GetDepartmentRelatedGroupIDListResp) String() string { return proto.CompactTextString(m) }
func (*GetDepartmentRelatedGroupIDListResp) ProtoMessage() {} func (*GetDepartmentRelatedGroupIDListResp) ProtoMessage() {}
func (*GetDepartmentRelatedGroupIDListResp) Descriptor() ([]byte, []int) { func (*GetDepartmentRelatedGroupIDListResp) Descriptor() ([]byte, []int) {
return fileDescriptor_organization_6d9a9b5829486353, []int{27} return fileDescriptor_organization_2845c40b2de0bcf0, []int{27}
} }
func (m *GetDepartmentRelatedGroupIDListResp) XXX_Unmarshal(b []byte) error { func (m *GetDepartmentRelatedGroupIDListResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetDepartmentRelatedGroupIDListResp.Unmarshal(m, b) return xxx_messageInfo_GetDepartmentRelatedGroupIDListResp.Unmarshal(m, b)
@ -1997,62 +2005,64 @@ var _Organization_serviceDesc = grpc.ServiceDesc{
} }
func init() { func init() {
proto.RegisterFile("organization/organization.proto", fileDescriptor_organization_6d9a9b5829486353) proto.RegisterFile("organization/organization.proto", fileDescriptor_organization_2845c40b2de0bcf0)
} }
var fileDescriptor_organization_6d9a9b5829486353 = []byte{ var fileDescriptor_organization_2845c40b2de0bcf0 = []byte{
// 846 bytes of a gzipped FileDescriptorProto // 869 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcf, 0x6e, 0xd3, 0x4c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4f, 0x4f, 0x13, 0x41,
0x10, 0x97, 0x9b, 0xef, 0x2b, 0x74, 0x52, 0xa1, 0x68, 0x5b, 0x85, 0xd4, 0x50, 0x35, 0x75, 0x5b, 0x14, 0xcf, 0x52, 0x44, 0x78, 0x25, 0xa6, 0x19, 0x48, 0x6d, 0x57, 0x91, 0xb2, 0x40, 0x68, 0x30,
0x35, 0x2a, 0x52, 0x02, 0xe5, 0xc8, 0x8d, 0x06, 0xa5, 0x91, 0x28, 0x41, 0x41, 0x3d, 0x94, 0x4b, 0x69, 0x15, 0x8f, 0xde, 0xa4, 0xa6, 0x34, 0x11, 0x6b, 0xd6, 0x70, 0xc0, 0x4b, 0xb3, 0xb5, 0x63,
0xe4, 0xe0, 0x25, 0x8a, 0xd2, 0xda, 0xdb, 0xb5, 0x43, 0x45, 0x1f, 0x80, 0x2b, 0x27, 0x2e, 0x88, 0xd3, 0x14, 0xba, 0xc3, 0xcc, 0x56, 0x22, 0x1f, 0xc0, 0xab, 0x27, 0x2f, 0xc6, 0x4f, 0xe0, 0xc9,
0x27, 0xe0, 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 0x09, 0x50, 0xe8, 0x9c, 0x31, 0x9f, 0x5d, 0xf3, 0x86, 0xcf, 0x5e, 0xf0, 0x7b, 0x81, 0x2a, 0x0b, 0xd9, 0xd3, 0xe2, 0xb4, 0x33, 0xe6, 0xd5, 0x8c, 0x82, 0xb4, 0x3b,
0xae, 0xbf, 0x7f, 0x54, 0x4d, 0xfc, 0x4f, 0xf7, 0x42, 0xfe, 0xe8, 0x2e, 0x8a, 0x3f, 0xe1, 0x9e, 0xc5, 0x2e, 0xc1, 0xc8, 0x57, 0x03, 0x36, 0x27, 0x24, 0x71, 0xf2, 0x6c, 0x0c, 0x14, 0x5a, 0x67,
0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xfc, 0xb9, 0x33, 0xd8, 0x13, 0x00, 0x00, 0xcc, 0xe7, 0x37, 0x3c, 0x21, 0xd8, 0xab, 0x8d, 0x0f, 0x8f, 0x4a, 0x91, 0xff, 0x78, 0x2f, 0xe5,
0x45, 0x73, 0x29, 0xf8, 0x49, 0xf7, 0xe2, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xff, 0x09,
0x1d, 0xf8, 0x13, 0x00, 0x00,
} }

View File

@ -67,6 +67,7 @@ message CreateOrganizationUserReq{
server_api_params.OrganizationUser organizationUser = 1; server_api_params.OrganizationUser organizationUser = 1;
string operationID = 2; string operationID = 2;
string opUserID = 3; string opUserID = 3;
bool IsRegister = 4;
} }

View File

@ -37,7 +37,7 @@ func (m *OnlinePushMsgReq) Reset() { *m = OnlinePushMsgReq{} }
func (m *OnlinePushMsgReq) String() string { return proto.CompactTextString(m) } func (m *OnlinePushMsgReq) String() string { return proto.CompactTextString(m) }
func (*OnlinePushMsgReq) ProtoMessage() {} func (*OnlinePushMsgReq) ProtoMessage() {}
func (*OnlinePushMsgReq) Descriptor() ([]byte, []int) { func (*OnlinePushMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{0} return fileDescriptor_relay_eb517eee82ca0aca, []int{0}
} }
func (m *OnlinePushMsgReq) XXX_Unmarshal(b []byte) error { func (m *OnlinePushMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OnlinePushMsgReq.Unmarshal(m, b) return xxx_messageInfo_OnlinePushMsgReq.Unmarshal(m, b)
@ -79,7 +79,7 @@ func (m *OnlinePushMsgReq) GetPushToUserID() string {
} }
type OnlinePushMsgResp struct { type OnlinePushMsgResp struct {
Resp []*SingleMsgToUser `protobuf:"bytes,1,rep,name=resp" json:"resp,omitempty"` Resp []*SingleMsgToUserPlatform `protobuf:"bytes,1,rep,name=resp" json:"resp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -89,7 +89,7 @@ func (m *OnlinePushMsgResp) Reset() { *m = OnlinePushMsgResp{} }
func (m *OnlinePushMsgResp) String() string { return proto.CompactTextString(m) } func (m *OnlinePushMsgResp) String() string { return proto.CompactTextString(m) }
func (*OnlinePushMsgResp) ProtoMessage() {} func (*OnlinePushMsgResp) ProtoMessage() {}
func (*OnlinePushMsgResp) Descriptor() ([]byte, []int) { func (*OnlinePushMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{1} return fileDescriptor_relay_eb517eee82ca0aca, []int{1}
} }
func (m *OnlinePushMsgResp) XXX_Unmarshal(b []byte) error { func (m *OnlinePushMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OnlinePushMsgResp.Unmarshal(m, b) return xxx_messageInfo_OnlinePushMsgResp.Unmarshal(m, b)
@ -109,14 +109,160 @@ func (m *OnlinePushMsgResp) XXX_DiscardUnknown() {
var xxx_messageInfo_OnlinePushMsgResp proto.InternalMessageInfo var xxx_messageInfo_OnlinePushMsgResp proto.InternalMessageInfo
func (m *OnlinePushMsgResp) GetResp() []*SingleMsgToUser { func (m *OnlinePushMsgResp) GetResp() []*SingleMsgToUserPlatform {
if m != nil { if m != nil {
return m.Resp return m.Resp
} }
return nil return nil
} }
type SingleMsgToUser struct { type SingelMsgToUserResultList struct {
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
Resp []*SingleMsgToUserPlatform `protobuf:"bytes,2,rep,name=resp" json:"resp,omitempty"`
OnlinePush bool `protobuf:"varint,3,opt,name=onlinePush" json:"onlinePush,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SingelMsgToUserResultList) Reset() { *m = SingelMsgToUserResultList{} }
func (m *SingelMsgToUserResultList) String() string { return proto.CompactTextString(m) }
func (*SingelMsgToUserResultList) ProtoMessage() {}
func (*SingelMsgToUserResultList) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_eb517eee82ca0aca, []int{2}
}
func (m *SingelMsgToUserResultList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SingelMsgToUserResultList.Unmarshal(m, b)
}
func (m *SingelMsgToUserResultList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SingelMsgToUserResultList.Marshal(b, m, deterministic)
}
func (dst *SingelMsgToUserResultList) XXX_Merge(src proto.Message) {
xxx_messageInfo_SingelMsgToUserResultList.Merge(dst, src)
}
func (m *SingelMsgToUserResultList) XXX_Size() int {
return xxx_messageInfo_SingelMsgToUserResultList.Size(m)
}
func (m *SingelMsgToUserResultList) XXX_DiscardUnknown() {
xxx_messageInfo_SingelMsgToUserResultList.DiscardUnknown(m)
}
var xxx_messageInfo_SingelMsgToUserResultList proto.InternalMessageInfo
func (m *SingelMsgToUserResultList) GetUserID() string {
if m != nil {
return m.UserID
}
return ""
}
func (m *SingelMsgToUserResultList) GetResp() []*SingleMsgToUserPlatform {
if m != nil {
return m.Resp
}
return nil
}
func (m *SingelMsgToUserResultList) GetOnlinePush() bool {
if m != nil {
return m.OnlinePush
}
return false
}
type OnlineBatchPushOneMsgReq struct {
OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"`
MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"`
PushToUserIDList []string `protobuf:"bytes,3,rep,name=pushToUserIDList" json:"pushToUserIDList,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *OnlineBatchPushOneMsgReq) Reset() { *m = OnlineBatchPushOneMsgReq{} }
func (m *OnlineBatchPushOneMsgReq) String() string { return proto.CompactTextString(m) }
func (*OnlineBatchPushOneMsgReq) ProtoMessage() {}
func (*OnlineBatchPushOneMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_eb517eee82ca0aca, []int{3}
}
func (m *OnlineBatchPushOneMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OnlineBatchPushOneMsgReq.Unmarshal(m, b)
}
func (m *OnlineBatchPushOneMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_OnlineBatchPushOneMsgReq.Marshal(b, m, deterministic)
}
func (dst *OnlineBatchPushOneMsgReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_OnlineBatchPushOneMsgReq.Merge(dst, src)
}
func (m *OnlineBatchPushOneMsgReq) XXX_Size() int {
return xxx_messageInfo_OnlineBatchPushOneMsgReq.Size(m)
}
func (m *OnlineBatchPushOneMsgReq) XXX_DiscardUnknown() {
xxx_messageInfo_OnlineBatchPushOneMsgReq.DiscardUnknown(m)
}
var xxx_messageInfo_OnlineBatchPushOneMsgReq proto.InternalMessageInfo
func (m *OnlineBatchPushOneMsgReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
func (m *OnlineBatchPushOneMsgReq) GetMsgData() *sdk_ws.MsgData {
if m != nil {
return m.MsgData
}
return nil
}
func (m *OnlineBatchPushOneMsgReq) GetPushToUserIDList() []string {
if m != nil {
return m.PushToUserIDList
}
return nil
}
type OnlineBatchPushOneMsgResp struct {
SinglePushResult []*SingelMsgToUserResultList `protobuf:"bytes,1,rep,name=singlePushResult" json:"singlePushResult,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *OnlineBatchPushOneMsgResp) Reset() { *m = OnlineBatchPushOneMsgResp{} }
func (m *OnlineBatchPushOneMsgResp) String() string { return proto.CompactTextString(m) }
func (*OnlineBatchPushOneMsgResp) ProtoMessage() {}
func (*OnlineBatchPushOneMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_eb517eee82ca0aca, []int{4}
}
func (m *OnlineBatchPushOneMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OnlineBatchPushOneMsgResp.Unmarshal(m, b)
}
func (m *OnlineBatchPushOneMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_OnlineBatchPushOneMsgResp.Marshal(b, m, deterministic)
}
func (dst *OnlineBatchPushOneMsgResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_OnlineBatchPushOneMsgResp.Merge(dst, src)
}
func (m *OnlineBatchPushOneMsgResp) XXX_Size() int {
return xxx_messageInfo_OnlineBatchPushOneMsgResp.Size(m)
}
func (m *OnlineBatchPushOneMsgResp) XXX_DiscardUnknown() {
xxx_messageInfo_OnlineBatchPushOneMsgResp.DiscardUnknown(m)
}
var xxx_messageInfo_OnlineBatchPushOneMsgResp proto.InternalMessageInfo
func (m *OnlineBatchPushOneMsgResp) GetSinglePushResult() []*SingelMsgToUserResultList {
if m != nil {
return m.SinglePushResult
}
return nil
}
type SingleMsgToUserPlatform struct {
ResultCode int64 `protobuf:"varint,1,opt,name=ResultCode" json:"ResultCode,omitempty"` ResultCode int64 `protobuf:"varint,1,opt,name=ResultCode" json:"ResultCode,omitempty"`
RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"`
RecvPlatFormID int32 `protobuf:"varint,3,opt,name=RecvPlatFormID" json:"RecvPlatFormID,omitempty"` RecvPlatFormID int32 `protobuf:"varint,3,opt,name=RecvPlatFormID" json:"RecvPlatFormID,omitempty"`
@ -125,45 +271,45 @@ type SingleMsgToUser struct {
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *SingleMsgToUser) Reset() { *m = SingleMsgToUser{} } func (m *SingleMsgToUserPlatform) Reset() { *m = SingleMsgToUserPlatform{} }
func (m *SingleMsgToUser) String() string { return proto.CompactTextString(m) } func (m *SingleMsgToUserPlatform) String() string { return proto.CompactTextString(m) }
func (*SingleMsgToUser) ProtoMessage() {} func (*SingleMsgToUserPlatform) ProtoMessage() {}
func (*SingleMsgToUser) Descriptor() ([]byte, []int) { func (*SingleMsgToUserPlatform) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{2} return fileDescriptor_relay_eb517eee82ca0aca, []int{5}
} }
func (m *SingleMsgToUser) XXX_Unmarshal(b []byte) error { func (m *SingleMsgToUserPlatform) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SingleMsgToUser.Unmarshal(m, b) return xxx_messageInfo_SingleMsgToUserPlatform.Unmarshal(m, b)
} }
func (m *SingleMsgToUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SingleMsgToUserPlatform) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SingleMsgToUser.Marshal(b, m, deterministic) return xxx_messageInfo_SingleMsgToUserPlatform.Marshal(b, m, deterministic)
} }
func (dst *SingleMsgToUser) XXX_Merge(src proto.Message) { func (dst *SingleMsgToUserPlatform) XXX_Merge(src proto.Message) {
xxx_messageInfo_SingleMsgToUser.Merge(dst, src) xxx_messageInfo_SingleMsgToUserPlatform.Merge(dst, src)
} }
func (m *SingleMsgToUser) XXX_Size() int { func (m *SingleMsgToUserPlatform) XXX_Size() int {
return xxx_messageInfo_SingleMsgToUser.Size(m) return xxx_messageInfo_SingleMsgToUserPlatform.Size(m)
} }
func (m *SingleMsgToUser) XXX_DiscardUnknown() { func (m *SingleMsgToUserPlatform) XXX_DiscardUnknown() {
xxx_messageInfo_SingleMsgToUser.DiscardUnknown(m) xxx_messageInfo_SingleMsgToUserPlatform.DiscardUnknown(m)
} }
var xxx_messageInfo_SingleMsgToUser proto.InternalMessageInfo var xxx_messageInfo_SingleMsgToUserPlatform proto.InternalMessageInfo
func (m *SingleMsgToUser) GetResultCode() int64 { func (m *SingleMsgToUserPlatform) GetResultCode() int64 {
if m != nil { if m != nil {
return m.ResultCode return m.ResultCode
} }
return 0 return 0
} }
func (m *SingleMsgToUser) GetRecvID() string { func (m *SingleMsgToUserPlatform) GetRecvID() string {
if m != nil { if m != nil {
return m.RecvID return m.RecvID
} }
return "" return ""
} }
func (m *SingleMsgToUser) GetRecvPlatFormID() int32 { func (m *SingleMsgToUserPlatform) GetRecvPlatFormID() int32 {
if m != nil { if m != nil {
return m.RecvPlatFormID return m.RecvPlatFormID
} }
@ -183,7 +329,7 @@ func (m *GetUsersOnlineStatusReq) Reset() { *m = GetUsersOnlineStatusReq
func (m *GetUsersOnlineStatusReq) String() string { return proto.CompactTextString(m) } func (m *GetUsersOnlineStatusReq) String() string { return proto.CompactTextString(m) }
func (*GetUsersOnlineStatusReq) ProtoMessage() {} func (*GetUsersOnlineStatusReq) ProtoMessage() {}
func (*GetUsersOnlineStatusReq) Descriptor() ([]byte, []int) { func (*GetUsersOnlineStatusReq) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{3} return fileDescriptor_relay_eb517eee82ca0aca, []int{6}
} }
func (m *GetUsersOnlineStatusReq) XXX_Unmarshal(b []byte) error { func (m *GetUsersOnlineStatusReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersOnlineStatusReq.Unmarshal(m, b) return xxx_messageInfo_GetUsersOnlineStatusReq.Unmarshal(m, b)
@ -238,7 +384,7 @@ func (m *GetUsersOnlineStatusResp) Reset() { *m = GetUsersOnlineStatusRe
func (m *GetUsersOnlineStatusResp) String() string { return proto.CompactTextString(m) } func (m *GetUsersOnlineStatusResp) String() string { return proto.CompactTextString(m) }
func (*GetUsersOnlineStatusResp) ProtoMessage() {} func (*GetUsersOnlineStatusResp) ProtoMessage() {}
func (*GetUsersOnlineStatusResp) Descriptor() ([]byte, []int) { func (*GetUsersOnlineStatusResp) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{4} return fileDescriptor_relay_eb517eee82ca0aca, []int{7}
} }
func (m *GetUsersOnlineStatusResp) XXX_Unmarshal(b []byte) error { func (m *GetUsersOnlineStatusResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersOnlineStatusResp.Unmarshal(m, b) return xxx_messageInfo_GetUsersOnlineStatusResp.Unmarshal(m, b)
@ -300,7 +446,7 @@ func (m *GetUsersOnlineStatusResp_SuccessDetail) Reset() {
func (m *GetUsersOnlineStatusResp_SuccessDetail) String() string { return proto.CompactTextString(m) } func (m *GetUsersOnlineStatusResp_SuccessDetail) String() string { return proto.CompactTextString(m) }
func (*GetUsersOnlineStatusResp_SuccessDetail) ProtoMessage() {} func (*GetUsersOnlineStatusResp_SuccessDetail) ProtoMessage() {}
func (*GetUsersOnlineStatusResp_SuccessDetail) Descriptor() ([]byte, []int) { func (*GetUsersOnlineStatusResp_SuccessDetail) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{4, 0} return fileDescriptor_relay_eb517eee82ca0aca, []int{7, 0}
} }
func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Unmarshal(b []byte) error { func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Unmarshal(m, b) return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Unmarshal(m, b)
@ -347,7 +493,7 @@ func (m *GetUsersOnlineStatusResp_FailedDetail) Reset() { *m = GetUsersO
func (m *GetUsersOnlineStatusResp_FailedDetail) String() string { return proto.CompactTextString(m) } func (m *GetUsersOnlineStatusResp_FailedDetail) String() string { return proto.CompactTextString(m) }
func (*GetUsersOnlineStatusResp_FailedDetail) ProtoMessage() {} func (*GetUsersOnlineStatusResp_FailedDetail) ProtoMessage() {}
func (*GetUsersOnlineStatusResp_FailedDetail) Descriptor() ([]byte, []int) { func (*GetUsersOnlineStatusResp_FailedDetail) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{4, 1} return fileDescriptor_relay_eb517eee82ca0aca, []int{7, 1}
} }
func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Unmarshal(b []byte) error { func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Unmarshal(m, b) return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Unmarshal(m, b)
@ -403,7 +549,7 @@ func (m *GetUsersOnlineStatusResp_SuccessResult) Reset() {
func (m *GetUsersOnlineStatusResp_SuccessResult) String() string { return proto.CompactTextString(m) } func (m *GetUsersOnlineStatusResp_SuccessResult) String() string { return proto.CompactTextString(m) }
func (*GetUsersOnlineStatusResp_SuccessResult) ProtoMessage() {} func (*GetUsersOnlineStatusResp_SuccessResult) ProtoMessage() {}
func (*GetUsersOnlineStatusResp_SuccessResult) Descriptor() ([]byte, []int) { func (*GetUsersOnlineStatusResp_SuccessResult) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_34094e5333f6005a, []int{4, 2} return fileDescriptor_relay_eb517eee82ca0aca, []int{7, 2}
} }
func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Unmarshal(b []byte) error { func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Unmarshal(m, b) return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Unmarshal(m, b)
@ -444,15 +590,104 @@ func (m *GetUsersOnlineStatusResp_SuccessResult) GetDetailPlatformStatus() []*Ge
return nil return nil
} }
type KickUserOfflineReq struct {
OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"`
PlatformID int32 `protobuf:"varint,2,opt,name=platformID" json:"platformID,omitempty"`
KickUserIDList []string `protobuf:"bytes,3,rep,name=kickUserIDList" json:"kickUserIDList,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *KickUserOfflineReq) Reset() { *m = KickUserOfflineReq{} }
func (m *KickUserOfflineReq) String() string { return proto.CompactTextString(m) }
func (*KickUserOfflineReq) ProtoMessage() {}
func (*KickUserOfflineReq) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_eb517eee82ca0aca, []int{8}
}
func (m *KickUserOfflineReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_KickUserOfflineReq.Unmarshal(m, b)
}
func (m *KickUserOfflineReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_KickUserOfflineReq.Marshal(b, m, deterministic)
}
func (dst *KickUserOfflineReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_KickUserOfflineReq.Merge(dst, src)
}
func (m *KickUserOfflineReq) XXX_Size() int {
return xxx_messageInfo_KickUserOfflineReq.Size(m)
}
func (m *KickUserOfflineReq) XXX_DiscardUnknown() {
xxx_messageInfo_KickUserOfflineReq.DiscardUnknown(m)
}
var xxx_messageInfo_KickUserOfflineReq proto.InternalMessageInfo
func (m *KickUserOfflineReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
func (m *KickUserOfflineReq) GetPlatformID() int32 {
if m != nil {
return m.PlatformID
}
return 0
}
func (m *KickUserOfflineReq) GetKickUserIDList() []string {
if m != nil {
return m.KickUserIDList
}
return nil
}
type KickUserOfflineResp struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *KickUserOfflineResp) Reset() { *m = KickUserOfflineResp{} }
func (m *KickUserOfflineResp) String() string { return proto.CompactTextString(m) }
func (*KickUserOfflineResp) ProtoMessage() {}
func (*KickUserOfflineResp) Descriptor() ([]byte, []int) {
return fileDescriptor_relay_eb517eee82ca0aca, []int{9}
}
func (m *KickUserOfflineResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_KickUserOfflineResp.Unmarshal(m, b)
}
func (m *KickUserOfflineResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_KickUserOfflineResp.Marshal(b, m, deterministic)
}
func (dst *KickUserOfflineResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_KickUserOfflineResp.Merge(dst, src)
}
func (m *KickUserOfflineResp) XXX_Size() int {
return xxx_messageInfo_KickUserOfflineResp.Size(m)
}
func (m *KickUserOfflineResp) XXX_DiscardUnknown() {
xxx_messageInfo_KickUserOfflineResp.DiscardUnknown(m)
}
var xxx_messageInfo_KickUserOfflineResp proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*OnlinePushMsgReq)(nil), "relay.OnlinePushMsgReq") proto.RegisterType((*OnlinePushMsgReq)(nil), "relay.OnlinePushMsgReq")
proto.RegisterType((*OnlinePushMsgResp)(nil), "relay.OnlinePushMsgResp") proto.RegisterType((*OnlinePushMsgResp)(nil), "relay.OnlinePushMsgResp")
proto.RegisterType((*SingleMsgToUser)(nil), "relay.SingleMsgToUser") proto.RegisterType((*SingelMsgToUserResultList)(nil), "relay.SingelMsgToUserResultList")
proto.RegisterType((*OnlineBatchPushOneMsgReq)(nil), "relay.OnlineBatchPushOneMsgReq")
proto.RegisterType((*OnlineBatchPushOneMsgResp)(nil), "relay.OnlineBatchPushOneMsgResp")
proto.RegisterType((*SingleMsgToUserPlatform)(nil), "relay.SingleMsgToUserPlatform")
proto.RegisterType((*GetUsersOnlineStatusReq)(nil), "relay.GetUsersOnlineStatusReq") proto.RegisterType((*GetUsersOnlineStatusReq)(nil), "relay.GetUsersOnlineStatusReq")
proto.RegisterType((*GetUsersOnlineStatusResp)(nil), "relay.GetUsersOnlineStatusResp") proto.RegisterType((*GetUsersOnlineStatusResp)(nil), "relay.GetUsersOnlineStatusResp")
proto.RegisterType((*GetUsersOnlineStatusResp_SuccessDetail)(nil), "relay.GetUsersOnlineStatusResp.SuccessDetail") proto.RegisterType((*GetUsersOnlineStatusResp_SuccessDetail)(nil), "relay.GetUsersOnlineStatusResp.SuccessDetail")
proto.RegisterType((*GetUsersOnlineStatusResp_FailedDetail)(nil), "relay.GetUsersOnlineStatusResp.FailedDetail") proto.RegisterType((*GetUsersOnlineStatusResp_FailedDetail)(nil), "relay.GetUsersOnlineStatusResp.FailedDetail")
proto.RegisterType((*GetUsersOnlineStatusResp_SuccessResult)(nil), "relay.GetUsersOnlineStatusResp.SuccessResult") proto.RegisterType((*GetUsersOnlineStatusResp_SuccessResult)(nil), "relay.GetUsersOnlineStatusResp.SuccessResult")
proto.RegisterType((*KickUserOfflineReq)(nil), "relay.KickUserOfflineReq")
proto.RegisterType((*KickUserOfflineResp)(nil), "relay.KickUserOfflineResp")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -468,6 +703,9 @@ const _ = grpc.SupportPackageIsVersion4
type OnlineMessageRelayServiceClient interface { type OnlineMessageRelayServiceClient interface {
OnlinePushMsg(ctx context.Context, in *OnlinePushMsgReq, opts ...grpc.CallOption) (*OnlinePushMsgResp, error) OnlinePushMsg(ctx context.Context, in *OnlinePushMsgReq, opts ...grpc.CallOption) (*OnlinePushMsgResp, error)
GetUsersOnlineStatus(ctx context.Context, in *GetUsersOnlineStatusReq, opts ...grpc.CallOption) (*GetUsersOnlineStatusResp, error) GetUsersOnlineStatus(ctx context.Context, in *GetUsersOnlineStatusReq, opts ...grpc.CallOption) (*GetUsersOnlineStatusResp, error)
OnlineBatchPushOneMsg(ctx context.Context, in *OnlineBatchPushOneMsgReq, opts ...grpc.CallOption) (*OnlineBatchPushOneMsgResp, error)
SuperGroupOnlineBatchPushOneMsg(ctx context.Context, in *OnlineBatchPushOneMsgReq, opts ...grpc.CallOption) (*OnlineBatchPushOneMsgResp, error)
KickUserOffline(ctx context.Context, in *KickUserOfflineReq, opts ...grpc.CallOption) (*KickUserOfflineResp, error)
} }
type onlineMessageRelayServiceClient struct { type onlineMessageRelayServiceClient struct {
@ -496,11 +734,41 @@ func (c *onlineMessageRelayServiceClient) GetUsersOnlineStatus(ctx context.Conte
return out, nil return out, nil
} }
func (c *onlineMessageRelayServiceClient) OnlineBatchPushOneMsg(ctx context.Context, in *OnlineBatchPushOneMsgReq, opts ...grpc.CallOption) (*OnlineBatchPushOneMsgResp, error) {
out := new(OnlineBatchPushOneMsgResp)
err := grpc.Invoke(ctx, "/relay.OnlineMessageRelayService/OnlineBatchPushOneMsg", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *onlineMessageRelayServiceClient) SuperGroupOnlineBatchPushOneMsg(ctx context.Context, in *OnlineBatchPushOneMsgReq, opts ...grpc.CallOption) (*OnlineBatchPushOneMsgResp, error) {
out := new(OnlineBatchPushOneMsgResp)
err := grpc.Invoke(ctx, "/relay.OnlineMessageRelayService/SuperGroupOnlineBatchPushOneMsg", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *onlineMessageRelayServiceClient) KickUserOffline(ctx context.Context, in *KickUserOfflineReq, opts ...grpc.CallOption) (*KickUserOfflineResp, error) {
out := new(KickUserOfflineResp)
err := grpc.Invoke(ctx, "/relay.OnlineMessageRelayService/KickUserOffline", 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 {
OnlinePushMsg(context.Context, *OnlinePushMsgReq) (*OnlinePushMsgResp, error) OnlinePushMsg(context.Context, *OnlinePushMsgReq) (*OnlinePushMsgResp, error)
GetUsersOnlineStatus(context.Context, *GetUsersOnlineStatusReq) (*GetUsersOnlineStatusResp, error) GetUsersOnlineStatus(context.Context, *GetUsersOnlineStatusReq) (*GetUsersOnlineStatusResp, error)
OnlineBatchPushOneMsg(context.Context, *OnlineBatchPushOneMsgReq) (*OnlineBatchPushOneMsgResp, error)
SuperGroupOnlineBatchPushOneMsg(context.Context, *OnlineBatchPushOneMsgReq) (*OnlineBatchPushOneMsgResp, error)
KickUserOffline(context.Context, *KickUserOfflineReq) (*KickUserOfflineResp, error)
} }
func RegisterOnlineMessageRelayServiceServer(s *grpc.Server, srv OnlineMessageRelayServiceServer) { func RegisterOnlineMessageRelayServiceServer(s *grpc.Server, srv OnlineMessageRelayServiceServer) {
@ -543,6 +811,60 @@ func _OnlineMessageRelayService_GetUsersOnlineStatus_Handler(srv interface{}, ct
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _OnlineMessageRelayService_OnlineBatchPushOneMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(OnlineBatchPushOneMsgReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OnlineMessageRelayServiceServer).OnlineBatchPushOneMsg(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/relay.OnlineMessageRelayService/OnlineBatchPushOneMsg",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OnlineMessageRelayServiceServer).OnlineBatchPushOneMsg(ctx, req.(*OnlineBatchPushOneMsgReq))
}
return interceptor(ctx, in, info, handler)
}
func _OnlineMessageRelayService_SuperGroupOnlineBatchPushOneMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(OnlineBatchPushOneMsgReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OnlineMessageRelayServiceServer).SuperGroupOnlineBatchPushOneMsg(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/relay.OnlineMessageRelayService/SuperGroupOnlineBatchPushOneMsg",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OnlineMessageRelayServiceServer).SuperGroupOnlineBatchPushOneMsg(ctx, req.(*OnlineBatchPushOneMsgReq))
}
return interceptor(ctx, in, info, handler)
}
func _OnlineMessageRelayService_KickUserOffline_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(KickUserOfflineReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OnlineMessageRelayServiceServer).KickUserOffline(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/relay.OnlineMessageRelayService/KickUserOffline",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OnlineMessageRelayServiceServer).KickUserOffline(ctx, req.(*KickUserOfflineReq))
}
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),
@ -555,48 +877,72 @@ var _OnlineMessageRelayService_serviceDesc = grpc.ServiceDesc{
MethodName: "GetUsersOnlineStatus", MethodName: "GetUsersOnlineStatus",
Handler: _OnlineMessageRelayService_GetUsersOnlineStatus_Handler, Handler: _OnlineMessageRelayService_GetUsersOnlineStatus_Handler,
}, },
{
MethodName: "OnlineBatchPushOneMsg",
Handler: _OnlineMessageRelayService_OnlineBatchPushOneMsg_Handler,
},
{
MethodName: "SuperGroupOnlineBatchPushOneMsg",
Handler: _OnlineMessageRelayService_SuperGroupOnlineBatchPushOneMsg_Handler,
},
{
MethodName: "KickUserOffline",
Handler: _OnlineMessageRelayService_KickUserOffline_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "relay/relay.proto", Metadata: "relay/relay.proto",
} }
func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_34094e5333f6005a) } func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_eb517eee82ca0aca) }
var fileDescriptor_relay_34094e5333f6005a = []byte{ var fileDescriptor_relay_eb517eee82ca0aca = []byte{
// 554 bytes of a gzipped FileDescriptorProto // 749 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5d, 0x8f, 0xd2, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x4e, 0xdb, 0x5a,
0x14, 0x4d, 0x65, 0x3f, 0xdc, 0x0b, 0xb8, 0x32, 0xd9, 0xec, 0xd6, 0x3e, 0x20, 0xf6, 0xc1, 0x10, 0x10, 0x96, 0x31, 0xe1, 0x67, 0x80, 0x0b, 0x9c, 0x0b, 0x17, 0xe3, 0x45, 0xc8, 0xf5, 0xe2, 0x2a,
0xa3, 0x25, 0x41, 0xdf, 0x7c, 0x30, 0xd9, 0x25, 0x6b, 0x48, 0x6c, 0x20, 0x83, 0x46, 0xe3, 0x0b, 0xba, 0x6a, 0x13, 0x29, 0xed, 0xae, 0x3b, 0x88, 0xa0, 0x51, 0x89, 0x82, 0x4e, 0x5a, 0xb5, 0x62,
0x99, 0x85, 0xbb, 0xdd, 0x66, 0x0b, 0x1d, 0xe6, 0x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 0x47, 0x1c, 0x29, 0x3e, 0xc8, 0xea, 0x8d, 0x7b, 0xf4, 0x08, 0xeb,
0xe4, 0x12, 0xf6, 0xe7, 0xae, 0x3a, 0x72, 0x94, 0xeb, 0x65, 0x76, 0x51, 0xbb, 0xa5, 0x87, 0x03,
0x90, 0x93, 0x1e, 0x1c, 0xb5, 0x13, 0xce, 0xc4, 0x99, 0x88, 0x12, 0xfe, 0x6c, 0x55, 0xde, 0xc2,
0xf6, 0x94, 0x26, 0xe4, 0xd0, 0x5c, 0x9a, 0x9d, 0x15, 0xd7, 0x5d, 0x74, 0x84, 0xfc, 0x78, 0xf7,
0x72, 0xbb, 0xa2, 0x3f, 0x1b, 0xde, 0xf0, 0x2b, 0x25, 0xe1, 0xd5, 0x8a, 0xfa, 0x2a, 0x78, 0xf5,
0x2b, 0x00, 0x00, 0xff, 0xff, 0x01, 0x6a, 0x94, 0x1f, 0x54, 0x08, 0x00, 0x00,
} }

View File

@ -9,8 +9,23 @@ message OnlinePushMsgReq {
string pushToUserID = 3; string pushToUserID = 3;
} }
message OnlinePushMsgResp{ message OnlinePushMsgResp{
repeated SingleMsgToUser resp = 1; repeated SingleMsgToUserPlatform resp = 1;
}//message SendMsgByWSReq{ }
message SingelMsgToUserResultList{
string userID =1;
repeated SingleMsgToUserPlatform resp = 2;
bool onlinePush = 3;
}
message OnlineBatchPushOneMsgReq{
string OperationID = 1;
server_api_params.MsgData msgData = 2;
repeated string pushToUserIDList = 3;
}
message OnlineBatchPushOneMsgResp{
repeated SingelMsgToUserResultList singlePushResult= 1;
}
//message SendMsgByWSReq{
// string SendID = 1; // string SendID = 1;
// string RecvID = 2; // string RecvID = 2;
// string Content = 3; // string Content = 3;
@ -22,7 +37,7 @@ repeated SingleMsgToUser resp = 1;
// int64 PlatformID = 9; // int64 PlatformID = 9;
//} //}
message SingleMsgToUser{ message SingleMsgToUserPlatform{
int64 ResultCode = 1; int64 ResultCode = 1;
string RecvID = 2; string RecvID = 2;
int32 RecvPlatFormID = 3; int32 RecvPlatFormID = 3;
@ -52,10 +67,21 @@ message GetUsersOnlineStatusResp{
repeated SuccessDetail detailPlatformStatus = 3; repeated SuccessDetail detailPlatformStatus = 3;
} }
}
message KickUserOfflineReq{
string operationID = 1;
int32 platformID = 2;
repeated string kickUserIDList = 3;
}
message KickUserOfflineResp{
} }
service OnlineMessageRelayService { service OnlineMessageRelayService {
rpc OnlinePushMsg(OnlinePushMsgReq) returns(OnlinePushMsgResp); rpc OnlinePushMsg(OnlinePushMsgReq) returns(OnlinePushMsgResp);
rpc GetUsersOnlineStatus(GetUsersOnlineStatusReq)returns(GetUsersOnlineStatusResp); rpc GetUsersOnlineStatus(GetUsersOnlineStatusReq)returns(GetUsersOnlineStatusResp);
rpc OnlineBatchPushOneMsg(OnlineBatchPushOneMsgReq) returns(OnlineBatchPushOneMsgResp);
rpc SuperGroupOnlineBatchPushOneMsg(OnlineBatchPushOneMsgReq) returns(OnlineBatchPushOneMsgResp);
rpc KickUserOffline(KickUserOfflineReq) returns(KickUserOfflineResp);
// rpc SendMsgByWS(SendMsgByWSReq) returns(MsgToUserResp); // rpc SendMsgByWS(SendMsgByWSReq) returns(MsgToUserResp);
} }

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,7 @@ message UserInfo{
string ex = 8; string ex = 8;
uint32 createTime = 9; uint32 createTime = 9;
int32 appMangerLevel = 10; int32 appMangerLevel = 10;
int32 globalRecvMsgOpt = 11;
} }
message FriendInfo{ message FriendInfo{
@ -170,30 +171,54 @@ message UserInDepartment {
///////////////////////////////////base end///////////////////////////////////// ///////////////////////////////////base end/////////////////////////////////////
message PullMessageBySeqListReq{
string userID = 1;
string operationID = 2;
repeated uint32 seqList = 3;
map <string, seqList>groupSeqList = 4;
}
message seqList {
repeated uint32 seqList = 1;
}
message MsgDataList {
repeated MsgData msgDataList = 1;
}
message PullMessageBySeqListResp { message PullMessageBySeqListResp {
int32 errCode = 1; int32 errCode = 1;
string errMsg = 2; string errMsg = 2;
repeated MsgData list = 3; repeated MsgData list = 3;
map<string, MsgDataList> groupMsgDataList = 4;
} }
message PullMessageBySeqListReq{
string userID = 1;
string operationID = 2;
repeated uint32 seqList = 3;
}
message GetMaxAndMinSeqReq { message GetMaxAndMinSeqReq {
repeated string groupIDList = 1;
string userID = 2;
string operationID =3;
}
message MaxAndMinSeq{
uint32 maxSeq = 1;
uint32 minSeq = 2;
} }
message GetMaxAndMinSeqResp { message GetMaxAndMinSeqResp {
uint32 maxSeq = 1; uint32 maxSeq = 1;
uint32 minSeq = 2; uint32 minSeq = 2;
int32 errCode = 3;
string errMsg = 4;
map<string, MaxAndMinSeq> groupMaxAndMinSeq = 5;
} }
message UserSendMsgResp { message UserSendMsgResp {
string serverMsgID = 1; string serverMsgID = 1;
string clientMsgID = 2; string clientMsgID = 2;
int64 sendTime = 3; int64 sendTime = 3;
} }
message MsgData { message MsgData {
string sendID = 1; string sendID = 1;
string recvID = 2; string recvID = 2;
@ -214,6 +239,7 @@ message MsgData {
map<string, bool> options = 18; map<string, bool> options = 18;
OfflinePushInfo offlinePushInfo = 19; OfflinePushInfo offlinePushInfo = 19;
repeated string atUserIDList = 20; repeated string atUserIDList = 20;
bytes msgDataList = 21;
} }
message OfflinePushInfo{ message OfflinePushInfo{

View File

@ -36,7 +36,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_e11c6a5241e13fcd, []int{0} return fileDescriptor_user_f1112695e0d68005, []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)
@ -83,7 +83,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_e11c6a5241e13fcd, []int{1} return fileDescriptor_user_f1112695e0d68005, []int{1}
} }
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)
@ -136,7 +136,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_e11c6a5241e13fcd, []int{2} return fileDescriptor_user_f1112695e0d68005, []int{2}
} }
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)
@ -182,7 +182,7 @@ func (m *GetAllUserIDReq) Reset() { *m = GetAllUserIDReq{} }
func (m *GetAllUserIDReq) String() string { return proto.CompactTextString(m) } func (m *GetAllUserIDReq) String() string { return proto.CompactTextString(m) }
func (*GetAllUserIDReq) ProtoMessage() {} func (*GetAllUserIDReq) ProtoMessage() {}
func (*GetAllUserIDReq) Descriptor() ([]byte, []int) { func (*GetAllUserIDReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{3} return fileDescriptor_user_f1112695e0d68005, []int{3}
} }
func (m *GetAllUserIDReq) XXX_Unmarshal(b []byte) error { func (m *GetAllUserIDReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetAllUserIDReq.Unmarshal(m, b) return xxx_messageInfo_GetAllUserIDReq.Unmarshal(m, b)
@ -228,7 +228,7 @@ func (m *GetAllUserIDResp) Reset() { *m = GetAllUserIDResp{} }
func (m *GetAllUserIDResp) String() string { return proto.CompactTextString(m) } func (m *GetAllUserIDResp) String() string { return proto.CompactTextString(m) }
func (*GetAllUserIDResp) ProtoMessage() {} func (*GetAllUserIDResp) ProtoMessage() {}
func (*GetAllUserIDResp) Descriptor() ([]byte, []int) { func (*GetAllUserIDResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{4} return fileDescriptor_user_f1112695e0d68005, []int{4}
} }
func (m *GetAllUserIDResp) XXX_Unmarshal(b []byte) error { func (m *GetAllUserIDResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetAllUserIDResp.Unmarshal(m, b) return xxx_messageInfo_GetAllUserIDResp.Unmarshal(m, b)
@ -275,7 +275,7 @@ func (m *AccountCheckReq) Reset() { *m = AccountCheckReq{} }
func (m *AccountCheckReq) String() string { return proto.CompactTextString(m) } func (m *AccountCheckReq) String() string { return proto.CompactTextString(m) }
func (*AccountCheckReq) ProtoMessage() {} func (*AccountCheckReq) ProtoMessage() {}
func (*AccountCheckReq) Descriptor() ([]byte, []int) { func (*AccountCheckReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{5} return fileDescriptor_user_f1112695e0d68005, []int{5}
} }
func (m *AccountCheckReq) XXX_Unmarshal(b []byte) error { func (m *AccountCheckReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AccountCheckReq.Unmarshal(m, b) return xxx_messageInfo_AccountCheckReq.Unmarshal(m, b)
@ -328,7 +328,7 @@ func (m *AccountCheckResp) Reset() { *m = AccountCheckResp{} }
func (m *AccountCheckResp) String() string { return proto.CompactTextString(m) } func (m *AccountCheckResp) String() string { return proto.CompactTextString(m) }
func (*AccountCheckResp) ProtoMessage() {} func (*AccountCheckResp) ProtoMessage() {}
func (*AccountCheckResp) Descriptor() ([]byte, []int) { func (*AccountCheckResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{6} return fileDescriptor_user_f1112695e0d68005, []int{6}
} }
func (m *AccountCheckResp) XXX_Unmarshal(b []byte) error { func (m *AccountCheckResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AccountCheckResp.Unmarshal(m, b) return xxx_messageInfo_AccountCheckResp.Unmarshal(m, b)
@ -374,7 +374,7 @@ func (m *AccountCheckResp_SingleUserStatus) Reset() { *m = AccountCheckR
func (m *AccountCheckResp_SingleUserStatus) String() string { return proto.CompactTextString(m) } func (m *AccountCheckResp_SingleUserStatus) String() string { return proto.CompactTextString(m) }
func (*AccountCheckResp_SingleUserStatus) ProtoMessage() {} func (*AccountCheckResp_SingleUserStatus) ProtoMessage() {}
func (*AccountCheckResp_SingleUserStatus) Descriptor() ([]byte, []int) { func (*AccountCheckResp_SingleUserStatus) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{6, 0} return fileDescriptor_user_f1112695e0d68005, []int{6, 0}
} }
func (m *AccountCheckResp_SingleUserStatus) XXX_Unmarshal(b []byte) error { func (m *AccountCheckResp_SingleUserStatus) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AccountCheckResp_SingleUserStatus.Unmarshal(m, b) return xxx_messageInfo_AccountCheckResp_SingleUserStatus.Unmarshal(m, b)
@ -421,7 +421,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_e11c6a5241e13fcd, []int{7} return fileDescriptor_user_f1112695e0d68005, []int{7}
} }
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)
@ -474,7 +474,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_e11c6a5241e13fcd, []int{8} return fileDescriptor_user_f1112695e0d68005, []int{8}
} }
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)
@ -521,7 +521,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_e11c6a5241e13fcd, []int{9} return fileDescriptor_user_f1112695e0d68005, []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)
@ -573,7 +573,7 @@ func (m *UpdateUserInfoResp) Reset() { *m = UpdateUserInfoResp{} }
func (m *UpdateUserInfoResp) String() string { return proto.CompactTextString(m) } func (m *UpdateUserInfoResp) String() string { return proto.CompactTextString(m) }
func (*UpdateUserInfoResp) ProtoMessage() {} func (*UpdateUserInfoResp) ProtoMessage() {}
func (*UpdateUserInfoResp) Descriptor() ([]byte, []int) { func (*UpdateUserInfoResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{10} return fileDescriptor_user_f1112695e0d68005, []int{10}
} }
func (m *UpdateUserInfoResp) XXX_Unmarshal(b []byte) error { func (m *UpdateUserInfoResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateUserInfoResp.Unmarshal(m, b) return xxx_messageInfo_UpdateUserInfoResp.Unmarshal(m, b)
@ -600,6 +600,98 @@ func (m *UpdateUserInfoResp) GetCommonResp() *CommonResp {
return nil return nil
} }
type SetGlobalRecvMessageOptReq struct {
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
GlobalRecvMsgOpt int32 `protobuf:"varint,3,opt,name=globalRecvMsgOpt" json:"globalRecvMsgOpt,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SetGlobalRecvMessageOptReq) Reset() { *m = SetGlobalRecvMessageOptReq{} }
func (m *SetGlobalRecvMessageOptReq) String() string { return proto.CompactTextString(m) }
func (*SetGlobalRecvMessageOptReq) ProtoMessage() {}
func (*SetGlobalRecvMessageOptReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_f1112695e0d68005, []int{11}
}
func (m *SetGlobalRecvMessageOptReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetGlobalRecvMessageOptReq.Unmarshal(m, b)
}
func (m *SetGlobalRecvMessageOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SetGlobalRecvMessageOptReq.Marshal(b, m, deterministic)
}
func (dst *SetGlobalRecvMessageOptReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_SetGlobalRecvMessageOptReq.Merge(dst, src)
}
func (m *SetGlobalRecvMessageOptReq) XXX_Size() int {
return xxx_messageInfo_SetGlobalRecvMessageOptReq.Size(m)
}
func (m *SetGlobalRecvMessageOptReq) XXX_DiscardUnknown() {
xxx_messageInfo_SetGlobalRecvMessageOptReq.DiscardUnknown(m)
}
var xxx_messageInfo_SetGlobalRecvMessageOptReq proto.InternalMessageInfo
func (m *SetGlobalRecvMessageOptReq) GetUserID() string {
if m != nil {
return m.UserID
}
return ""
}
func (m *SetGlobalRecvMessageOptReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
func (m *SetGlobalRecvMessageOptReq) GetGlobalRecvMsgOpt() int32 {
if m != nil {
return m.GlobalRecvMsgOpt
}
return 0
}
type SetGlobalRecvMessageOptResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SetGlobalRecvMessageOptResp) Reset() { *m = SetGlobalRecvMessageOptResp{} }
func (m *SetGlobalRecvMessageOptResp) String() string { return proto.CompactTextString(m) }
func (*SetGlobalRecvMessageOptResp) ProtoMessage() {}
func (*SetGlobalRecvMessageOptResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_f1112695e0d68005, []int{12}
}
func (m *SetGlobalRecvMessageOptResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetGlobalRecvMessageOptResp.Unmarshal(m, b)
}
func (m *SetGlobalRecvMessageOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SetGlobalRecvMessageOptResp.Marshal(b, m, deterministic)
}
func (dst *SetGlobalRecvMessageOptResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_SetGlobalRecvMessageOptResp.Merge(dst, src)
}
func (m *SetGlobalRecvMessageOptResp) XXX_Size() int {
return xxx_messageInfo_SetGlobalRecvMessageOptResp.Size(m)
}
func (m *SetGlobalRecvMessageOptResp) XXX_DiscardUnknown() {
xxx_messageInfo_SetGlobalRecvMessageOptResp.DiscardUnknown(m)
}
var xxx_messageInfo_SetGlobalRecvMessageOptResp proto.InternalMessageInfo
func (m *SetGlobalRecvMessageOptResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
type Conversation struct { type Conversation struct {
OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"` OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"`
ConversationID string `protobuf:"bytes,2,opt,name=ConversationID" json:"ConversationID,omitempty"` ConversationID string `protobuf:"bytes,2,opt,name=ConversationID" json:"ConversationID,omitempty"`
@ -624,7 +716,7 @@ func (m *Conversation) Reset() { *m = Conversation{} }
func (m *Conversation) String() string { return proto.CompactTextString(m) } func (m *Conversation) String() string { return proto.CompactTextString(m) }
func (*Conversation) ProtoMessage() {} func (*Conversation) ProtoMessage() {}
func (*Conversation) Descriptor() ([]byte, []int) { func (*Conversation) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{11} return fileDescriptor_user_f1112695e0d68005, []int{13}
} }
func (m *Conversation) XXX_Unmarshal(b []byte) error { func (m *Conversation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Conversation.Unmarshal(m, b) return xxx_messageInfo_Conversation.Unmarshal(m, b)
@ -755,7 +847,7 @@ func (m *SetConversationReq) Reset() { *m = SetConversationReq{} }
func (m *SetConversationReq) String() string { return proto.CompactTextString(m) } func (m *SetConversationReq) String() string { return proto.CompactTextString(m) }
func (*SetConversationReq) ProtoMessage() {} func (*SetConversationReq) ProtoMessage() {}
func (*SetConversationReq) Descriptor() ([]byte, []int) { func (*SetConversationReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{12} return fileDescriptor_user_f1112695e0d68005, []int{14}
} }
func (m *SetConversationReq) XXX_Unmarshal(b []byte) error { func (m *SetConversationReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetConversationReq.Unmarshal(m, b) return xxx_messageInfo_SetConversationReq.Unmarshal(m, b)
@ -807,7 +899,7 @@ func (m *SetConversationResp) Reset() { *m = SetConversationResp{} }
func (m *SetConversationResp) String() string { return proto.CompactTextString(m) } func (m *SetConversationResp) String() string { return proto.CompactTextString(m) }
func (*SetConversationResp) ProtoMessage() {} func (*SetConversationResp) ProtoMessage() {}
func (*SetConversationResp) Descriptor() ([]byte, []int) { func (*SetConversationResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{13} return fileDescriptor_user_f1112695e0d68005, []int{15}
} }
func (m *SetConversationResp) XXX_Unmarshal(b []byte) error { func (m *SetConversationResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetConversationResp.Unmarshal(m, b) return xxx_messageInfo_SetConversationResp.Unmarshal(m, b)
@ -849,7 +941,7 @@ func (m *SetRecvMsgOptReq) Reset() { *m = SetRecvMsgOptReq{} }
func (m *SetRecvMsgOptReq) String() string { return proto.CompactTextString(m) } func (m *SetRecvMsgOptReq) String() string { return proto.CompactTextString(m) }
func (*SetRecvMsgOptReq) ProtoMessage() {} func (*SetRecvMsgOptReq) ProtoMessage() {}
func (*SetRecvMsgOptReq) Descriptor() ([]byte, []int) { func (*SetRecvMsgOptReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{14} return fileDescriptor_user_f1112695e0d68005, []int{16}
} }
func (m *SetRecvMsgOptReq) XXX_Unmarshal(b []byte) error { func (m *SetRecvMsgOptReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetRecvMsgOptReq.Unmarshal(m, b) return xxx_messageInfo_SetRecvMsgOptReq.Unmarshal(m, b)
@ -915,7 +1007,7 @@ func (m *SetRecvMsgOptResp) Reset() { *m = SetRecvMsgOptResp{} }
func (m *SetRecvMsgOptResp) String() string { return proto.CompactTextString(m) } func (m *SetRecvMsgOptResp) String() string { return proto.CompactTextString(m) }
func (*SetRecvMsgOptResp) ProtoMessage() {} func (*SetRecvMsgOptResp) ProtoMessage() {}
func (*SetRecvMsgOptResp) Descriptor() ([]byte, []int) { func (*SetRecvMsgOptResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{15} return fileDescriptor_user_f1112695e0d68005, []int{17}
} }
func (m *SetRecvMsgOptResp) XXX_Unmarshal(b []byte) error { func (m *SetRecvMsgOptResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetRecvMsgOptResp.Unmarshal(m, b) return xxx_messageInfo_SetRecvMsgOptResp.Unmarshal(m, b)
@ -955,7 +1047,7 @@ func (m *GetConversationReq) Reset() { *m = GetConversationReq{} }
func (m *GetConversationReq) String() string { return proto.CompactTextString(m) } func (m *GetConversationReq) String() string { return proto.CompactTextString(m) }
func (*GetConversationReq) ProtoMessage() {} func (*GetConversationReq) ProtoMessage() {}
func (*GetConversationReq) Descriptor() ([]byte, []int) { func (*GetConversationReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{16} return fileDescriptor_user_f1112695e0d68005, []int{18}
} }
func (m *GetConversationReq) XXX_Unmarshal(b []byte) error { func (m *GetConversationReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetConversationReq.Unmarshal(m, b) return xxx_messageInfo_GetConversationReq.Unmarshal(m, b)
@ -1008,7 +1100,7 @@ func (m *GetConversationResp) Reset() { *m = GetConversationResp{} }
func (m *GetConversationResp) String() string { return proto.CompactTextString(m) } func (m *GetConversationResp) String() string { return proto.CompactTextString(m) }
func (*GetConversationResp) ProtoMessage() {} func (*GetConversationResp) ProtoMessage() {}
func (*GetConversationResp) Descriptor() ([]byte, []int) { func (*GetConversationResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{17} return fileDescriptor_user_f1112695e0d68005, []int{19}
} }
func (m *GetConversationResp) XXX_Unmarshal(b []byte) error { func (m *GetConversationResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetConversationResp.Unmarshal(m, b) return xxx_messageInfo_GetConversationResp.Unmarshal(m, b)
@ -1055,7 +1147,7 @@ func (m *GetConversationsReq) Reset() { *m = GetConversationsReq{} }
func (m *GetConversationsReq) String() string { return proto.CompactTextString(m) } func (m *GetConversationsReq) String() string { return proto.CompactTextString(m) }
func (*GetConversationsReq) ProtoMessage() {} func (*GetConversationsReq) ProtoMessage() {}
func (*GetConversationsReq) Descriptor() ([]byte, []int) { func (*GetConversationsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{18} return fileDescriptor_user_f1112695e0d68005, []int{20}
} }
func (m *GetConversationsReq) XXX_Unmarshal(b []byte) error { func (m *GetConversationsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetConversationsReq.Unmarshal(m, b) return xxx_messageInfo_GetConversationsReq.Unmarshal(m, b)
@ -1108,7 +1200,7 @@ func (m *GetConversationsResp) Reset() { *m = GetConversationsResp{} }
func (m *GetConversationsResp) String() string { return proto.CompactTextString(m) } func (m *GetConversationsResp) String() string { return proto.CompactTextString(m) }
func (*GetConversationsResp) ProtoMessage() {} func (*GetConversationsResp) ProtoMessage() {}
func (*GetConversationsResp) Descriptor() ([]byte, []int) { func (*GetConversationsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{19} return fileDescriptor_user_f1112695e0d68005, []int{21}
} }
func (m *GetConversationsResp) XXX_Unmarshal(b []byte) error { func (m *GetConversationsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetConversationsResp.Unmarshal(m, b) return xxx_messageInfo_GetConversationsResp.Unmarshal(m, b)
@ -1154,7 +1246,7 @@ func (m *GetAllConversationsReq) Reset() { *m = GetAllConversationsReq{}
func (m *GetAllConversationsReq) String() string { return proto.CompactTextString(m) } func (m *GetAllConversationsReq) String() string { return proto.CompactTextString(m) }
func (*GetAllConversationsReq) ProtoMessage() {} func (*GetAllConversationsReq) ProtoMessage() {}
func (*GetAllConversationsReq) Descriptor() ([]byte, []int) { func (*GetAllConversationsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{20} return fileDescriptor_user_f1112695e0d68005, []int{22}
} }
func (m *GetAllConversationsReq) XXX_Unmarshal(b []byte) error { func (m *GetAllConversationsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetAllConversationsReq.Unmarshal(m, b) return xxx_messageInfo_GetAllConversationsReq.Unmarshal(m, b)
@ -1200,7 +1292,7 @@ func (m *GetAllConversationsResp) Reset() { *m = GetAllConversationsResp
func (m *GetAllConversationsResp) String() string { return proto.CompactTextString(m) } func (m *GetAllConversationsResp) String() string { return proto.CompactTextString(m) }
func (*GetAllConversationsResp) ProtoMessage() {} func (*GetAllConversationsResp) ProtoMessage() {}
func (*GetAllConversationsResp) Descriptor() ([]byte, []int) { func (*GetAllConversationsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{21} return fileDescriptor_user_f1112695e0d68005, []int{23}
} }
func (m *GetAllConversationsResp) XXX_Unmarshal(b []byte) error { func (m *GetAllConversationsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetAllConversationsResp.Unmarshal(m, b) return xxx_messageInfo_GetAllConversationsResp.Unmarshal(m, b)
@ -1248,7 +1340,7 @@ func (m *BatchSetConversationsReq) Reset() { *m = BatchSetConversationsR
func (m *BatchSetConversationsReq) String() string { return proto.CompactTextString(m) } func (m *BatchSetConversationsReq) String() string { return proto.CompactTextString(m) }
func (*BatchSetConversationsReq) ProtoMessage() {} func (*BatchSetConversationsReq) ProtoMessage() {}
func (*BatchSetConversationsReq) Descriptor() ([]byte, []int) { func (*BatchSetConversationsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{22} return fileDescriptor_user_f1112695e0d68005, []int{24}
} }
func (m *BatchSetConversationsReq) XXX_Unmarshal(b []byte) error { func (m *BatchSetConversationsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BatchSetConversationsReq.Unmarshal(m, b) return xxx_messageInfo_BatchSetConversationsReq.Unmarshal(m, b)
@ -1309,7 +1401,7 @@ func (m *BatchSetConversationsResp) Reset() { *m = BatchSetConversations
func (m *BatchSetConversationsResp) String() string { return proto.CompactTextString(m) } func (m *BatchSetConversationsResp) String() string { return proto.CompactTextString(m) }
func (*BatchSetConversationsResp) ProtoMessage() {} func (*BatchSetConversationsResp) ProtoMessage() {}
func (*BatchSetConversationsResp) Descriptor() ([]byte, []int) { func (*BatchSetConversationsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{23} return fileDescriptor_user_f1112695e0d68005, []int{25}
} }
func (m *BatchSetConversationsResp) XXX_Unmarshal(b []byte) error { func (m *BatchSetConversationsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BatchSetConversationsResp.Unmarshal(m, b) return xxx_messageInfo_BatchSetConversationsResp.Unmarshal(m, b)
@ -1362,7 +1454,7 @@ func (m *ResignUserReq) Reset() { *m = ResignUserReq{} }
func (m *ResignUserReq) String() string { return proto.CompactTextString(m) } func (m *ResignUserReq) String() string { return proto.CompactTextString(m) }
func (*ResignUserReq) ProtoMessage() {} func (*ResignUserReq) ProtoMessage() {}
func (*ResignUserReq) Descriptor() ([]byte, []int) { func (*ResignUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{24} return fileDescriptor_user_f1112695e0d68005, []int{26}
} }
func (m *ResignUserReq) XXX_Unmarshal(b []byte) error { func (m *ResignUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResignUserReq.Unmarshal(m, b) return xxx_messageInfo_ResignUserReq.Unmarshal(m, b)
@ -1407,7 +1499,7 @@ func (m *ResignUserResp) Reset() { *m = ResignUserResp{} }
func (m *ResignUserResp) String() string { return proto.CompactTextString(m) } func (m *ResignUserResp) String() string { return proto.CompactTextString(m) }
func (*ResignUserResp) ProtoMessage() {} func (*ResignUserResp) ProtoMessage() {}
func (*ResignUserResp) Descriptor() ([]byte, []int) { func (*ResignUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{25} return fileDescriptor_user_f1112695e0d68005, []int{27}
} }
func (m *ResignUserResp) XXX_Unmarshal(b []byte) error { func (m *ResignUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResignUserResp.Unmarshal(m, b) return xxx_messageInfo_ResignUserResp.Unmarshal(m, b)
@ -1446,7 +1538,7 @@ func (m *GetUserByIdReq) Reset() { *m = GetUserByIdReq{} }
func (m *GetUserByIdReq) String() string { return proto.CompactTextString(m) } func (m *GetUserByIdReq) String() string { return proto.CompactTextString(m) }
func (*GetUserByIdReq) ProtoMessage() {} func (*GetUserByIdReq) ProtoMessage() {}
func (*GetUserByIdReq) Descriptor() ([]byte, []int) { func (*GetUserByIdReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{26} return fileDescriptor_user_f1112695e0d68005, []int{28}
} }
func (m *GetUserByIdReq) XXX_Unmarshal(b []byte) error { func (m *GetUserByIdReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserByIdReq.Unmarshal(m, b) return xxx_messageInfo_GetUserByIdReq.Unmarshal(m, b)
@ -1495,7 +1587,7 @@ func (m *User) Reset() { *m = User{} }
func (m *User) String() string { return proto.CompactTextString(m) } func (m *User) String() string { return proto.CompactTextString(m) }
func (*User) ProtoMessage() {} func (*User) ProtoMessage() {}
func (*User) Descriptor() ([]byte, []int) { func (*User) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{27} return fileDescriptor_user_f1112695e0d68005, []int{29}
} }
func (m *User) XXX_Unmarshal(b []byte) error { func (m *User) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_User.Unmarshal(m, b) return xxx_messageInfo_User.Unmarshal(m, b)
@ -1562,7 +1654,7 @@ func (m *GetUserByIdResp) Reset() { *m = GetUserByIdResp{} }
func (m *GetUserByIdResp) String() string { return proto.CompactTextString(m) } func (m *GetUserByIdResp) String() string { return proto.CompactTextString(m) }
func (*GetUserByIdResp) ProtoMessage() {} func (*GetUserByIdResp) ProtoMessage() {}
func (*GetUserByIdResp) Descriptor() ([]byte, []int) { func (*GetUserByIdResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{28} return fileDescriptor_user_f1112695e0d68005, []int{30}
} }
func (m *GetUserByIdResp) XXX_Unmarshal(b []byte) error { func (m *GetUserByIdResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserByIdResp.Unmarshal(m, b) return xxx_messageInfo_GetUserByIdResp.Unmarshal(m, b)
@ -1609,7 +1701,7 @@ func (m *GetUsersByNameReq) Reset() { *m = GetUsersByNameReq{} }
func (m *GetUsersByNameReq) String() string { return proto.CompactTextString(m) } func (m *GetUsersByNameReq) String() string { return proto.CompactTextString(m) }
func (*GetUsersByNameReq) ProtoMessage() {} func (*GetUsersByNameReq) ProtoMessage() {}
func (*GetUsersByNameReq) Descriptor() ([]byte, []int) { func (*GetUsersByNameReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{29} return fileDescriptor_user_f1112695e0d68005, []int{31}
} }
func (m *GetUsersByNameReq) XXX_Unmarshal(b []byte) error { func (m *GetUsersByNameReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersByNameReq.Unmarshal(m, b) return xxx_messageInfo_GetUsersByNameReq.Unmarshal(m, b)
@ -1663,7 +1755,7 @@ func (m *GetUsersByNameResp) Reset() { *m = GetUsersByNameResp{} }
func (m *GetUsersByNameResp) String() string { return proto.CompactTextString(m) } func (m *GetUsersByNameResp) String() string { return proto.CompactTextString(m) }
func (*GetUsersByNameResp) ProtoMessage() {} func (*GetUsersByNameResp) ProtoMessage() {}
func (*GetUsersByNameResp) Descriptor() ([]byte, []int) { func (*GetUsersByNameResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{30} return fileDescriptor_user_f1112695e0d68005, []int{32}
} }
func (m *GetUsersByNameResp) XXX_Unmarshal(b []byte) error { func (m *GetUsersByNameResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersByNameResp.Unmarshal(m, b) return xxx_messageInfo_GetUsersByNameResp.Unmarshal(m, b)
@ -1720,7 +1812,7 @@ func (m *AlterUserReq) Reset() { *m = AlterUserReq{} }
func (m *AlterUserReq) String() string { return proto.CompactTextString(m) } func (m *AlterUserReq) String() string { return proto.CompactTextString(m) }
func (*AlterUserReq) ProtoMessage() {} func (*AlterUserReq) ProtoMessage() {}
func (*AlterUserReq) Descriptor() ([]byte, []int) { func (*AlterUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{31} return fileDescriptor_user_f1112695e0d68005, []int{33}
} }
func (m *AlterUserReq) XXX_Unmarshal(b []byte) error { func (m *AlterUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AlterUserReq.Unmarshal(m, b) return xxx_messageInfo_AlterUserReq.Unmarshal(m, b)
@ -1793,7 +1885,7 @@ func (m *AlterUserResp) Reset() { *m = AlterUserResp{} }
func (m *AlterUserResp) String() string { return proto.CompactTextString(m) } func (m *AlterUserResp) String() string { return proto.CompactTextString(m) }
func (*AlterUserResp) ProtoMessage() {} func (*AlterUserResp) ProtoMessage() {}
func (*AlterUserResp) Descriptor() ([]byte, []int) { func (*AlterUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{32} return fileDescriptor_user_f1112695e0d68005, []int{34}
} }
func (m *AlterUserResp) XXX_Unmarshal(b []byte) error { func (m *AlterUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AlterUserResp.Unmarshal(m, b) return xxx_messageInfo_AlterUserResp.Unmarshal(m, b)
@ -1833,7 +1925,7 @@ func (m *GetUsersReq) Reset() { *m = GetUsersReq{} }
func (m *GetUsersReq) String() string { return proto.CompactTextString(m) } func (m *GetUsersReq) String() string { return proto.CompactTextString(m) }
func (*GetUsersReq) ProtoMessage() {} func (*GetUsersReq) ProtoMessage() {}
func (*GetUsersReq) Descriptor() ([]byte, []int) { func (*GetUsersReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{33} return fileDescriptor_user_f1112695e0d68005, []int{35}
} }
func (m *GetUsersReq) XXX_Unmarshal(b []byte) error { func (m *GetUsersReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersReq.Unmarshal(m, b) return xxx_messageInfo_GetUsersReq.Unmarshal(m, b)
@ -1888,7 +1980,7 @@ func (m *GetUsersResp) Reset() { *m = GetUsersResp{} }
func (m *GetUsersResp) String() string { return proto.CompactTextString(m) } func (m *GetUsersResp) String() string { return proto.CompactTextString(m) }
func (*GetUsersResp) ProtoMessage() {} func (*GetUsersResp) ProtoMessage() {}
func (*GetUsersResp) Descriptor() ([]byte, []int) { func (*GetUsersResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{34} return fileDescriptor_user_f1112695e0d68005, []int{36}
} }
func (m *GetUsersResp) XXX_Unmarshal(b []byte) error { func (m *GetUsersResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUsersResp.Unmarshal(m, b) return xxx_messageInfo_GetUsersResp.Unmarshal(m, b)
@ -1951,7 +2043,7 @@ func (m *AddUserReq) Reset() { *m = AddUserReq{} }
func (m *AddUserReq) String() string { return proto.CompactTextString(m) } func (m *AddUserReq) String() string { return proto.CompactTextString(m) }
func (*AddUserReq) ProtoMessage() {} func (*AddUserReq) ProtoMessage() {}
func (*AddUserReq) Descriptor() ([]byte, []int) { func (*AddUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{35} return fileDescriptor_user_f1112695e0d68005, []int{37}
} }
func (m *AddUserReq) XXX_Unmarshal(b []byte) error { func (m *AddUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddUserReq.Unmarshal(m, b) return xxx_messageInfo_AddUserReq.Unmarshal(m, b)
@ -2017,7 +2109,7 @@ func (m *AddUserResp) Reset() { *m = AddUserResp{} }
func (m *AddUserResp) String() string { return proto.CompactTextString(m) } func (m *AddUserResp) String() string { return proto.CompactTextString(m) }
func (*AddUserResp) ProtoMessage() {} func (*AddUserResp) ProtoMessage() {}
func (*AddUserResp) Descriptor() ([]byte, []int) { func (*AddUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{36} return fileDescriptor_user_f1112695e0d68005, []int{38}
} }
func (m *AddUserResp) XXX_Unmarshal(b []byte) error { func (m *AddUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddUserResp.Unmarshal(m, b) return xxx_messageInfo_AddUserResp.Unmarshal(m, b)
@ -2058,7 +2150,7 @@ func (m *BlockUserReq) Reset() { *m = BlockUserReq{} }
func (m *BlockUserReq) String() string { return proto.CompactTextString(m) } func (m *BlockUserReq) String() string { return proto.CompactTextString(m) }
func (*BlockUserReq) ProtoMessage() {} func (*BlockUserReq) ProtoMessage() {}
func (*BlockUserReq) Descriptor() ([]byte, []int) { func (*BlockUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{37} return fileDescriptor_user_f1112695e0d68005, []int{39}
} }
func (m *BlockUserReq) XXX_Unmarshal(b []byte) error { func (m *BlockUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockUserReq.Unmarshal(m, b) return xxx_messageInfo_BlockUserReq.Unmarshal(m, b)
@ -2117,7 +2209,7 @@ func (m *BlockUserResp) Reset() { *m = BlockUserResp{} }
func (m *BlockUserResp) String() string { return proto.CompactTextString(m) } func (m *BlockUserResp) String() string { return proto.CompactTextString(m) }
func (*BlockUserResp) ProtoMessage() {} func (*BlockUserResp) ProtoMessage() {}
func (*BlockUserResp) Descriptor() ([]byte, []int) { func (*BlockUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{38} return fileDescriptor_user_f1112695e0d68005, []int{40}
} }
func (m *BlockUserResp) XXX_Unmarshal(b []byte) error { func (m *BlockUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockUserResp.Unmarshal(m, b) return xxx_messageInfo_BlockUserResp.Unmarshal(m, b)
@ -2157,7 +2249,7 @@ func (m *UnBlockUserReq) Reset() { *m = UnBlockUserReq{} }
func (m *UnBlockUserReq) String() string { return proto.CompactTextString(m) } func (m *UnBlockUserReq) String() string { return proto.CompactTextString(m) }
func (*UnBlockUserReq) ProtoMessage() {} func (*UnBlockUserReq) ProtoMessage() {}
func (*UnBlockUserReq) Descriptor() ([]byte, []int) { func (*UnBlockUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{39} return fileDescriptor_user_f1112695e0d68005, []int{41}
} }
func (m *UnBlockUserReq) XXX_Unmarshal(b []byte) error { func (m *UnBlockUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UnBlockUserReq.Unmarshal(m, b) return xxx_messageInfo_UnBlockUserReq.Unmarshal(m, b)
@ -2209,7 +2301,7 @@ func (m *UnBlockUserResp) Reset() { *m = UnBlockUserResp{} }
func (m *UnBlockUserResp) String() string { return proto.CompactTextString(m) } func (m *UnBlockUserResp) String() string { return proto.CompactTextString(m) }
func (*UnBlockUserResp) ProtoMessage() {} func (*UnBlockUserResp) ProtoMessage() {}
func (*UnBlockUserResp) Descriptor() ([]byte, []int) { func (*UnBlockUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{40} return fileDescriptor_user_f1112695e0d68005, []int{42}
} }
func (m *UnBlockUserResp) XXX_Unmarshal(b []byte) error { func (m *UnBlockUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UnBlockUserResp.Unmarshal(m, b) return xxx_messageInfo_UnBlockUserResp.Unmarshal(m, b)
@ -2249,7 +2341,7 @@ func (m *GetBlockUsersReq) Reset() { *m = GetBlockUsersReq{} }
func (m *GetBlockUsersReq) String() string { return proto.CompactTextString(m) } func (m *GetBlockUsersReq) String() string { return proto.CompactTextString(m) }
func (*GetBlockUsersReq) ProtoMessage() {} func (*GetBlockUsersReq) ProtoMessage() {}
func (*GetBlockUsersReq) Descriptor() ([]byte, []int) { func (*GetBlockUsersReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{41} return fileDescriptor_user_f1112695e0d68005, []int{43}
} }
func (m *GetBlockUsersReq) XXX_Unmarshal(b []byte) error { func (m *GetBlockUsersReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlockUsersReq.Unmarshal(m, b) return xxx_messageInfo_GetBlockUsersReq.Unmarshal(m, b)
@ -2303,7 +2395,7 @@ func (m *BlockUser) Reset() { *m = BlockUser{} }
func (m *BlockUser) String() string { return proto.CompactTextString(m) } func (m *BlockUser) String() string { return proto.CompactTextString(m) }
func (*BlockUser) ProtoMessage() {} func (*BlockUser) ProtoMessage() {}
func (*BlockUser) Descriptor() ([]byte, []int) { func (*BlockUser) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{42} return fileDescriptor_user_f1112695e0d68005, []int{44}
} }
func (m *BlockUser) XXX_Unmarshal(b []byte) error { func (m *BlockUser) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockUser.Unmarshal(m, b) return xxx_messageInfo_BlockUser.Unmarshal(m, b)
@ -2358,7 +2450,7 @@ func (m *GetBlockUsersResp) Reset() { *m = GetBlockUsersResp{} }
func (m *GetBlockUsersResp) String() string { return proto.CompactTextString(m) } func (m *GetBlockUsersResp) String() string { return proto.CompactTextString(m) }
func (*GetBlockUsersResp) ProtoMessage() {} func (*GetBlockUsersResp) ProtoMessage() {}
func (*GetBlockUsersResp) Descriptor() ([]byte, []int) { func (*GetBlockUsersResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{43} return fileDescriptor_user_f1112695e0d68005, []int{45}
} }
func (m *GetBlockUsersResp) XXX_Unmarshal(b []byte) error { func (m *GetBlockUsersResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlockUsersResp.Unmarshal(m, b) return xxx_messageInfo_GetBlockUsersResp.Unmarshal(m, b)
@ -2418,7 +2510,7 @@ func (m *GetBlockUserByIdReq) Reset() { *m = GetBlockUserByIdReq{} }
func (m *GetBlockUserByIdReq) String() string { return proto.CompactTextString(m) } func (m *GetBlockUserByIdReq) String() string { return proto.CompactTextString(m) }
func (*GetBlockUserByIdReq) ProtoMessage() {} func (*GetBlockUserByIdReq) ProtoMessage() {}
func (*GetBlockUserByIdReq) Descriptor() ([]byte, []int) { func (*GetBlockUserByIdReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{44} return fileDescriptor_user_f1112695e0d68005, []int{46}
} }
func (m *GetBlockUserByIdReq) XXX_Unmarshal(b []byte) error { func (m *GetBlockUserByIdReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlockUserByIdReq.Unmarshal(m, b) return xxx_messageInfo_GetBlockUserByIdReq.Unmarshal(m, b)
@ -2463,7 +2555,7 @@ func (m *GetBlockUserByIdResp) Reset() { *m = GetBlockUserByIdResp{} }
func (m *GetBlockUserByIdResp) String() string { return proto.CompactTextString(m) } func (m *GetBlockUserByIdResp) String() string { return proto.CompactTextString(m) }
func (*GetBlockUserByIdResp) ProtoMessage() {} func (*GetBlockUserByIdResp) ProtoMessage() {}
func (*GetBlockUserByIdResp) Descriptor() ([]byte, []int) { func (*GetBlockUserByIdResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{45} return fileDescriptor_user_f1112695e0d68005, []int{47}
} }
func (m *GetBlockUserByIdResp) XXX_Unmarshal(b []byte) error { func (m *GetBlockUserByIdResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlockUserByIdResp.Unmarshal(m, b) return xxx_messageInfo_GetBlockUserByIdResp.Unmarshal(m, b)
@ -2503,7 +2595,7 @@ func (m *DeleteUserReq) Reset() { *m = DeleteUserReq{} }
func (m *DeleteUserReq) String() string { return proto.CompactTextString(m) } func (m *DeleteUserReq) String() string { return proto.CompactTextString(m) }
func (*DeleteUserReq) ProtoMessage() {} func (*DeleteUserReq) ProtoMessage() {}
func (*DeleteUserReq) Descriptor() ([]byte, []int) { func (*DeleteUserReq) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{46} return fileDescriptor_user_f1112695e0d68005, []int{48}
} }
func (m *DeleteUserReq) XXX_Unmarshal(b []byte) error { func (m *DeleteUserReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteUserReq.Unmarshal(m, b) return xxx_messageInfo_DeleteUserReq.Unmarshal(m, b)
@ -2555,7 +2647,7 @@ func (m *DeleteUserResp) Reset() { *m = DeleteUserResp{} }
func (m *DeleteUserResp) String() string { return proto.CompactTextString(m) } func (m *DeleteUserResp) String() string { return proto.CompactTextString(m) }
func (*DeleteUserResp) ProtoMessage() {} func (*DeleteUserResp) ProtoMessage() {}
func (*DeleteUserResp) Descriptor() ([]byte, []int) { func (*DeleteUserResp) Descriptor() ([]byte, []int) {
return fileDescriptor_user_e11c6a5241e13fcd, []int{47} return fileDescriptor_user_f1112695e0d68005, []int{49}
} }
func (m *DeleteUserResp) XXX_Unmarshal(b []byte) error { func (m *DeleteUserResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteUserResp.Unmarshal(m, b) return xxx_messageInfo_DeleteUserResp.Unmarshal(m, b)
@ -2595,6 +2687,8 @@ func init() {
proto.RegisterType((*GetUserInfoResp)(nil), "user.GetUserInfoResp") proto.RegisterType((*GetUserInfoResp)(nil), "user.GetUserInfoResp")
proto.RegisterType((*UpdateUserInfoReq)(nil), "user.UpdateUserInfoReq") proto.RegisterType((*UpdateUserInfoReq)(nil), "user.UpdateUserInfoReq")
proto.RegisterType((*UpdateUserInfoResp)(nil), "user.UpdateUserInfoResp") proto.RegisterType((*UpdateUserInfoResp)(nil), "user.UpdateUserInfoResp")
proto.RegisterType((*SetGlobalRecvMessageOptReq)(nil), "user.SetGlobalRecvMessageOptReq")
proto.RegisterType((*SetGlobalRecvMessageOptResp)(nil), "user.SetGlobalRecvMessageOptResp")
proto.RegisterType((*Conversation)(nil), "user.Conversation") proto.RegisterType((*Conversation)(nil), "user.Conversation")
proto.RegisterType((*SetConversationReq)(nil), "user.SetConversationReq") proto.RegisterType((*SetConversationReq)(nil), "user.SetConversationReq")
proto.RegisterType((*SetConversationResp)(nil), "user.SetConversationResp") proto.RegisterType((*SetConversationResp)(nil), "user.SetConversationResp")
@ -2647,6 +2741,7 @@ const _ = grpc.SupportPackageIsVersion4
type UserClient interface { type UserClient interface {
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error)
SetGlobalRecvMessageOpt(ctx context.Context, in *SetGlobalRecvMessageOptReq, opts ...grpc.CallOption) (*SetGlobalRecvMessageOptResp, error)
DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error) DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error)
GetAllUserID(ctx context.Context, in *GetAllUserIDReq, opts ...grpc.CallOption) (*GetAllUserIDResp, error) GetAllUserID(ctx context.Context, in *GetAllUserIDReq, opts ...grpc.CallOption) (*GetAllUserIDResp, error)
AccountCheck(ctx context.Context, in *AccountCheckReq, opts ...grpc.CallOption) (*AccountCheckResp, error) AccountCheck(ctx context.Context, in *AccountCheckReq, opts ...grpc.CallOption) (*AccountCheckResp, error)
@ -2695,6 +2790,15 @@ func (c *userClient) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq,
return out, nil return out, nil
} }
func (c *userClient) SetGlobalRecvMessageOpt(ctx context.Context, in *SetGlobalRecvMessageOptReq, opts ...grpc.CallOption) (*SetGlobalRecvMessageOptResp, error) {
out := new(SetGlobalRecvMessageOptResp)
err := grpc.Invoke(ctx, "/user.user/SetGlobalRecvMessageOpt", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userClient) DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error) { func (c *userClient) DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error) {
out := new(DeleteUsersResp) out := new(DeleteUsersResp)
err := grpc.Invoke(ctx, "/user.user/DeleteUsers", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/user.user/DeleteUsers", in, out, c.cc, opts...)
@ -2880,6 +2984,7 @@ func (c *userClient) DeleteUser(ctx context.Context, in *DeleteUserReq, opts ...
type UserServer interface { type UserServer interface {
GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error)
UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*UpdateUserInfoResp, error) UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*UpdateUserInfoResp, error)
SetGlobalRecvMessageOpt(context.Context, *SetGlobalRecvMessageOptReq) (*SetGlobalRecvMessageOptResp, error)
DeleteUsers(context.Context, *DeleteUsersReq) (*DeleteUsersResp, error) DeleteUsers(context.Context, *DeleteUsersReq) (*DeleteUsersResp, error)
GetAllUserID(context.Context, *GetAllUserIDReq) (*GetAllUserIDResp, error) GetAllUserID(context.Context, *GetAllUserIDReq) (*GetAllUserIDResp, error)
AccountCheck(context.Context, *AccountCheckReq) (*AccountCheckResp, error) AccountCheck(context.Context, *AccountCheckReq) (*AccountCheckResp, error)
@ -2942,6 +3047,24 @@ func _User_UpdateUserInfo_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _User_SetGlobalRecvMessageOpt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetGlobalRecvMessageOptReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServer).SetGlobalRecvMessageOpt(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/user.user/SetGlobalRecvMessageOpt",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServer).SetGlobalRecvMessageOpt(ctx, req.(*SetGlobalRecvMessageOptReq))
}
return interceptor(ctx, in, info, handler)
}
func _User_DeleteUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _User_DeleteUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteUsersReq) in := new(DeleteUsersReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -3314,6 +3437,10 @@ var _User_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateUserInfo", MethodName: "UpdateUserInfo",
Handler: _User_UpdateUserInfo_Handler, Handler: _User_UpdateUserInfo_Handler,
}, },
{
MethodName: "SetGlobalRecvMessageOpt",
Handler: _User_SetGlobalRecvMessageOpt_Handler,
},
{ {
MethodName: "DeleteUsers", MethodName: "DeleteUsers",
Handler: _User_DeleteUsers_Handler, Handler: _User_DeleteUsers_Handler,
@ -3399,125 +3526,129 @@ var _User_serviceDesc = grpc.ServiceDesc{
Metadata: "user/user.proto", Metadata: "user/user.proto",
} }
func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_e11c6a5241e13fcd) } func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_f1112695e0d68005) }
var fileDescriptor_user_e11c6a5241e13fcd = []byte{ var fileDescriptor_user_f1112695e0d68005 = []byte{
// 1857 bytes of a gzipped FileDescriptorProto // 1923 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xdd, 0x4f, 0x24, 0x4b, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xcd, 0x6f, 0x23, 0x49,
0x15, 0x4f, 0xcf, 0xc7, 0x02, 0x67, 0x98, 0x61, 0x28, 0xb8, 0xd0, 0xb7, 0x55, 0xc4, 0xce, 0xf5, 0x15, 0x57, 0xfb, 0x63, 0x92, 0x3c, 0xc7, 0x8e, 0x53, 0x93, 0x9d, 0xf4, 0xf6, 0xc2, 0xe0, 0x6d,
0x4a, 0x48, 0x04, 0x5d, 0x8d, 0x6b, 0xd6, 0xe8, 0x2e, 0x33, 0xb0, 0x64, 0x8c, 0x0b, 0x93, 0x9e, 0x2d, 0x4b, 0x34, 0x12, 0x09, 0x0c, 0x88, 0x41, 0x8b, 0x60, 0x37, 0x76, 0x32, 0x96, 0x11, 0x93,
0x25, 0x31, 0xc6, 0x84,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x09, 0xd1, 0x77, 0x61, 0x33, 0x51, 0x02, 0xed, 0xaa, 0x4a, 0xd1, 0x39, 0x48, 0x17, 0x91,
0x9a, 0xfc, 0xd9, 0xf1, 0x04, 0x20, 0xcb, 0x56, 0x89, 0x43, 0x95, 0xe3, 0xc1, 0x5a, 0xcd, 0x0b, 0x10, 0x1d, 0xc2, 0x86, 0x28, 0xca, 0x90, 0x48, 0x5d, 0x59, 0xf5, 0x68, 0xed, 0x6a, 0x12, 0xae,
0x49, 0xd8, 0x69, 0xfe, 0xaa, 0xb1, 0xc3, 0x3e, 0xfd, 0xfe, 0x84, 0xfe, 0x79, 0xfd, 0x88, 0x7d, 0x58, 0xb6, 0xc7, 0x22, 0x3d, 0x2d, 0x67, 0x8a, 0xa9, 0xc5, 0xc6, 0x27, 0xd0, 0x90, 0xea, 0x8f,
0xd7, 0xfd, 0xc1, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x34, 0x9a, 0x78, 0xde, 0x13, 0x1e, 0x00, 0xc4, 0x11, 0x6a, 0xe9, 0x93, 0x38, 0x42, 0x2f, 0x54, 0x3e, 0x83, 0xa6, 0xb2, 0xa7, 0xa2, 0x2c,
0x00, 0xee, 0x95, 0x52, 0xc4, 0xda, 0x2f, 0x94, 0xa7, 0x51, 0xa3, 0x6c, 0x34, 0x52, 0xd4, 0xe8, 0x5b,
0x9a, 0x14, 0x35, 0xf9, 0xbd, 0xe9, 0x11, 0x40, 0x96, 0xad, 0x12, 0x87, 0x2a, 0xdb, 0x8f, 0xb5,
0x97, 0x17, 0x92, 0xb0, 0xdb, 0xfc, 0x45, 0xe3, 0x90, 0x3d, 0x98, 0xff, 0x88, 0xfe, 0x79, 0x7e,
0x87, 0xbd, 0x86, 0x7f, 0xef, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x32, 0x71, 0xc8, 0xa6, 0x49,
0x1f, 0x00, 0x00,
} }

View File

@ -66,6 +66,14 @@ message UpdateUserInfoReq{
message UpdateUserInfoResp{ message UpdateUserInfoResp{
CommonResp commonResp = 1; CommonResp commonResp = 1;
} }
message SetGlobalRecvMessageOptReq{
string userID = 1;
string operationID = 2;
int32 globalRecvMsgOpt = 3;
}
message SetGlobalRecvMessageOptResp{
CommonResp commonResp = 1;
}
message Conversation{ message Conversation{
string OwnerUserID = 1; string OwnerUserID = 1;
@ -293,6 +301,7 @@ message DeleteUserResp {
service user { service user {
rpc GetUserInfo(GetUserInfoReq) returns(GetUserInfoResp); rpc GetUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp); rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
rpc SetGlobalRecvMessageOpt(SetGlobalRecvMessageOptReq) returns(SetGlobalRecvMessageOptResp);
rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp); rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp);
rpc GetAllUserID(GetAllUserIDReq)returns(GetAllUserIDResp); rpc GetAllUserID(GetAllUserIDReq)returns(GetAllUserIDResp);
@ -315,8 +324,4 @@ service user {
rpc GetBlockUsers(GetBlockUsersReq) returns (GetBlockUsersResp); rpc GetBlockUsers(GetBlockUsersReq) returns (GetBlockUsersResp);
rpc GetBlockUserById(GetBlockUserByIdReq) returns (GetBlockUserByIdResp); rpc GetBlockUserById(GetBlockUserByIdReq) returns (GetBlockUserByIdResp);
rpc DeleteUser(DeleteUserReq) returns (DeleteUserResp); rpc DeleteUser(DeleteUserReq) returns (DeleteUserResp);
rpc GetUserInfoFromCache(GetUserInfoReq) returns(GetUserInfoResp);
} }

12
pkg/utils/base64.go Normal file
View File

@ -0,0 +1,12 @@
package utils
import "encoding/base64"
func Base64Encode(data string) string {
return base64.StdEncoding.EncodeToString([]byte(data))
}
func Base64Decode(data string) string {
decodedByte, _ := base64.StdEncoding.DecodeString(data)
return string(decodedByte)
}

64
pkg/utils/encryption .go Normal file
View File

@ -0,0 +1,64 @@
package utils
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"encoding/hex"
"errors"
)
func Md5(s string, salt ...string) string {
h := md5.New()
h.Write([]byte(s))
if len(salt) > 0 {
h.Write([]byte(salt[0]))
}
cipher := h.Sum(nil)
return hex.EncodeToString(cipher)
}
func AesEncrypt(data []byte, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
blockSize := block.BlockSize()
encryptBytes := pkcs7Padding(data, blockSize)
crypted := make([]byte, len(encryptBytes))
blockMode := cipher.NewCBCEncrypter(block, key[:blockSize])
blockMode.CryptBlocks(crypted, encryptBytes)
return crypted, nil
}
func AesDecrypt(data []byte, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
blockSize := block.BlockSize()
blockMode := cipher.NewCBCDecrypter(block, key[:blockSize])
crypted := make([]byte, len(data))
blockMode.CryptBlocks(crypted, data)
crypted, err = pkcs7UnPadding(crypted)
if err != nil {
return nil, err
}
return crypted, nil
}
func pkcs7Padding(data []byte, blockSize int) []byte {
padding := blockSize - len(data)%blockSize
padText := bytes.Repeat([]byte{byte(padding)}, padding)
return append(data, padText...)
}
func pkcs7UnPadding(data []byte) ([]byte, error) {
length := len(data)
if length == 0 {
return nil, errors.New("encrypt error")
}
unPadding := int(data[length-1])
return data[:(length - unPadding)], nil
}

View File

@ -1,13 +0,0 @@
package utils
import (
"crypto/md5"
"encoding/hex"
)
func Md5(s string) string {
h := md5.New()
h.Write([]byte(s))
cipher := h.Sum(nil)
return hex.EncodeToString(cipher)
}

Some files were not shown because too many files have changed in this diff Show More