Commit 2fa88c49 authored by hujiebin's avatar hujiebin

feat:回流量到声网

parent 4c74e62a
......@@ -599,3 +599,11 @@ func DeleteTRTC(model *domain.Model, imGroupId string) error {
}
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) {
provider := group_e.GroupProvider_SW
if group_m.IsUseTRTC(model, groupId) {
roomUser, err := group_m.GetRoomOnlineUser(myContext, groupId)
if err == nil && roomUser.Total == 0 {
_ = group_m.DeleteTRTC(model, groupId)
} else {
provider = group_e.GroupProvider_TRTC
provider = group_e.GroupProvider_TRTC
total := int64(2000)
if !config.AppIsRelease() {
total = 0
}
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 {
//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