Commit 2fa88c49 authored by hujiebin's avatar hujiebin

feat:回流量到声网

parent 4c74e62a
...@@ -599,3 +599,11 @@ func DeleteTRTC(model *domain.Model, imGroupId string) error { ...@@ -599,3 +599,11 @@ func DeleteTRTC(model *domain.Model, imGroupId string) error {
} }
return nil return nil
} }
func CountTRTC(model *domain.Model) int64 {
var total int64
if err := model.DB().Model(GroupTrtc{}).Count(&total).Error; err != nil {
model.Log.Errorf("CountTRTC fail:%v", err)
}
return total
}
...@@ -1761,11 +1761,17 @@ func GroupIn(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1761,11 +1761,17 @@ func GroupIn(c *gin.Context) (*mycontext.MyContext, error) {
provider := group_e.GroupProvider_SW provider := group_e.GroupProvider_SW
if group_m.IsUseTRTC(model, groupId) { if group_m.IsUseTRTC(model, groupId) {
roomUser, err := group_m.GetRoomOnlineUser(myContext, groupId) provider = group_e.GroupProvider_TRTC
if err == nil && roomUser.Total == 0 { total := int64(2000)
_ = group_m.DeleteTRTC(model, groupId) if !config.AppIsRelease() {
} else { total = 0
provider = group_e.GroupProvider_TRTC }
if group_m.CountTRTC(model) > total {
roomUser, err := group_m.GetRoomOnlineUser(myContext, groupId)
if err == nil && roomUser.Total == 0 {
_ = group_m.DeleteTRTC(model, groupId)
provider = group_e.GroupProvider_SW
}
} }
} else { } else {
//dayMaxCovertNum := int64(20) //dayMaxCovertNum := int64(20)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment