Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-group
Commits
ced44799
Commit
ced44799
authored
Sep 02, 2023
by
JiebinHu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/mic_change_redis' into test
parents
d35998f9
7a4d8e86
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
redisPrefix.go
_const/redis_key/redisPrefix.go
+2
-0
userRoomVisit.go
domain/cache/room_c/userRoomVisit.go
+0
-3
micData.go
domain/model/group_m/micData.go
+7
-7
group_op.go
route/group_r/group_op.go
+3
-3
No files found.
_const/redis_key/redisPrefix.go
View file @
ced44799
...
@@ -766,6 +766,8 @@ func GetPrefixGroupInUserDuration(groupUuid string) string {
...
@@ -766,6 +766,8 @@ func GetPrefixGroupInUserDuration(groupUuid string) string {
return
strings
.
Replace
(
groupInUserDuration
,
"{groupUuid}"
,
groupUuid
,
-
1
)
return
strings
.
Replace
(
groupInUserDuration
,
"{groupUuid}"
,
groupUuid
,
-
1
)
}
}
// Deprecated: 用户进房时间
// 可用 uer:u:${user_id}代替
func
GetUserEnterRoomKey
(
userId
uint64
)
string
{
func
GetUserEnterRoomKey
(
userId
uint64
)
string
{
return
strings
.
Replace
(
userEnterRoom
,
"{userId}"
,
strconv
.
FormatUint
(
userId
,
10
),
-
1
)
return
strings
.
Replace
(
userEnterRoom
,
"{userId}"
,
strconv
.
FormatUint
(
userId
,
10
),
-
1
)
}
}
...
...
domain/cache/room_c/userRoomVisit.go
View file @
ced44799
...
@@ -6,7 +6,6 @@ import (
...
@@ -6,7 +6,6 @@ import (
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/resource/redisCli"
"git.hilo.cn/hilo-common/resource/redisCli"
"github.com/bluele/gcache"
redis2
"github.com/go-redis/redis/v8"
redis2
"github.com/go-redis/redis/v8"
"github.com/spf13/cast"
"github.com/spf13/cast"
"hilo-group/_const/redis_key"
"hilo-group/_const/redis_key"
...
@@ -78,8 +77,6 @@ func GetUserRoomVisit(userId uint64) (map[string]int64, error) {
...
@@ -78,8 +77,6 @@ func GetUserRoomVisit(userId uint64) (map[string]int64, error) {
return
result
,
nil
return
result
,
nil
}
}
var
roomVisitCntCache
=
gcache
.
New
(
50000
)
.
LRU
()
.
Build
()
// 批量获取房间访问人数
// 批量获取房间访问人数
// 带上lru
// 带上lru
func
MGetRoomVisitCount
(
groupIds
[]
string
)
(
map
[
string
]
string
,
error
)
{
func
MGetRoomVisitCount
(
groupIds
[]
string
)
(
map
[
string
]
string
,
error
)
{
...
...
domain/model/group_m/micData.go
View file @
ced44799
...
@@ -96,7 +96,7 @@ func MicGroupKickOutRPush(model *domain.Model, groupUid string, userExternalId s
...
@@ -96,7 +96,7 @@ func MicGroupKickOutRPush(model *domain.Model, groupUid string, userExternalId s
}
}
// socket通知被拉黑者退房
// socket通知被拉黑者退房
rpc
.
SendQuitRoom
(
beKickuserId
,
2
,
txGroupId
)
rpc
.
SendQuitRoom
(
beKickuserId
,
2
,
txGroupId
)
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicGroupKickOutRPush err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicGroupKickOutRPush err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
return
return
}
else
{
}
else
{
...
@@ -130,7 +130,7 @@ func MicSocketMicOutRPush(model *domain.Model, groupUid string, userExternalId s
...
@@ -130,7 +130,7 @@ func MicSocketMicOutRPush(model *domain.Model, groupUid string, userExternalId s
model
.
Log
.
Errorf
(
"MicChangeRPush MicSocketMicOutRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicSocketMicOutRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
return
return
}
}
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicSocketMicOutRPush err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicSocketMicOutRPush err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
return
return
}
else
{
}
else
{
...
@@ -165,7 +165,7 @@ func MicNumChangeRPush(model *domain.Model, groupUid string, micNumType group_e.
...
@@ -165,7 +165,7 @@ func MicNumChangeRPush(model *domain.Model, groupUid string, micNumType group_e.
model
.
Log
.
Errorf
(
"MicChangeRPush MicNumChangeRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicNumChangeRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
return
return
}
}
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicNumChangeRPush err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicNumChangeRPush err:%+v, groupUuid:%v, micContent:%+v"
,
err
,
groupUid
,
string
(
str
))
return
return
}
else
{
}
else
{
...
@@ -206,7 +206,7 @@ func MicEmptyRPush(model *domain.Model, groupUid string, i int) {
...
@@ -206,7 +206,7 @@ func MicEmptyRPush(model *domain.Model, groupUid string, i int) {
model
.
Log
.
Errorf
(
"MicChangeRPush MicEmptyRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContent
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicEmptyRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContent
))
return
return
}
}
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicEmptyRPush err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContent
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicEmptyRPush err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContent
))
return
return
}
else
{
}
else
{
...
@@ -243,7 +243,7 @@ func MicChangeRPush(model *domain.Model, groupUid string, i int) {
...
@@ -243,7 +243,7 @@ func MicChangeRPush(model *domain.Model, groupUid string, i int) {
model
.
Log
.
Errorf
(
"MicChangeRPush MicChangeRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContentStr
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicChangeRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContentStr
))
return
return
}
}
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicChangeRPush err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContentStr
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicChangeRPush err:%+v, groupUuid:%v, i:%v, micContent:%+v"
,
err
,
groupUid
,
i
,
string
(
micContentStr
))
return
return
}
else
{
}
else
{
...
@@ -288,7 +288,7 @@ func MicAllRPush(model *domain.Model, groupUid string, externalId string) error
...
@@ -288,7 +288,7 @@ func MicAllRPush(model *domain.Model, groupUid string, externalId string) error
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, externalId:%v, micContent:%+v"
,
err
,
groupUid
,
externalId
,
string
(
micContentStr
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush Marshal MicSystemMsg err:%+v, groupUuid:%v, externalId:%v, micContent:%+v"
,
err
,
groupUid
,
externalId
,
string
(
micContentStr
))
continue
continue
}
}
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush err:%+v, groupUuid:%v, externalId:%v, micContent:%+v"
,
err
,
groupUid
,
externalId
,
string
(
micContentStr
))
model
.
Log
.
Errorf
(
"MicChangeRPush MicAllRPush err:%+v, groupUuid:%v, externalId:%v, micContent:%+v"
,
err
,
groupUid
,
externalId
,
string
(
micContentStr
))
continue
continue
}
else
{
}
else
{
...
@@ -312,7 +312,7 @@ func MicRPush(model *domain.Model, txGroupId string, msg GroupSystemMsg) error {
...
@@ -312,7 +312,7 @@ func MicRPush(model *domain.Model, txGroupId string, msg GroupSystemMsg) error {
model
.
Log
.
Errorf
(
"MicRPush Marshal MicSystemMsg err:%+v, txGroupId:%v, micContent:%+v"
,
err
,
txGroupId
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicRPush Marshal MicSystemMsg err:%+v, txGroupId:%v, micContent:%+v"
,
err
,
txGroupId
,
string
(
str
))
return
err
return
err
}
}
if
n
,
err
:=
redisCli
.
GetRedis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
if
n
,
err
:=
redisCli
.
Get
Cluster
Redis
()
.
RPush
(
context
.
Background
(),
redis_key
.
GetMicInfoChange
(),
string
(
str
))
.
Result
();
err
!=
nil
||
n
==
0
{
model
.
Log
.
Errorf
(
"MicRPush err:%+v, txGroupId:%v, micContent:%+v"
,
err
,
txGroupId
,
string
(
str
))
model
.
Log
.
Errorf
(
"MicRPush err:%+v, txGroupId:%v, micContent:%+v"
,
err
,
txGroupId
,
string
(
str
))
return
err
return
err
}
}
...
...
route/group_r/group_op.go
View file @
ced44799
...
@@ -1871,9 +1871,9 @@ func GroupIn(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1871,9 +1871,9 @@ func GroupIn(c *gin.Context) (*mycontext.MyContext, error) {
myContext
.
Log
.
Infof
(
"GroupIn, ProcessRoomVisit err: %s"
,
err
.
Error
())
myContext
.
Log
.
Infof
(
"GroupIn, ProcessRoomVisit err: %s"
,
err
.
Error
())
}
}
// 更新用户进入房间缓存记录
// 更新用户进入房间缓存记录
if
err
=
room_c
.
ProcessUserRoomVisit
(
userId
,
groupId
);
err
!=
nil
{
//
if err = room_c.ProcessUserRoomVisit(userId, groupId); err != nil {
myContext
.
Log
.
Infof
(
"GroupIn, ProcessUserRoomVisit err: %s"
,
err
.
Error
())
//
myContext.Log.Infof("GroupIn, ProcessUserRoomVisit err: %s", err.Error())
}
//
}
resp
.
ResponseOk
(
c
,
group_cv
.
GroupChannelId
{
resp
.
ResponseOk
(
c
,
group_cv
.
GroupChannelId
{
ChannelId
:
channelId
,
ChannelId
:
channelId
,
Token
:
token
,
Token
:
token
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment