Commit 55f05c88 authored by chenweijian's avatar chenweijian

trtc

parent fa66af14
......@@ -156,3 +156,11 @@ var GROUP_NOBLE4_JOIN_LIMIT uint = 1000
var GROUP_ROLE_PERSONAL_VIEW_LIMIT = 5
var GROUP_MANAGER_LIMIT uint = 30
var GROUP_ADMIN_LIMIT uint = 50
type GroupProvider = uint8
const (
// 群组声音供应商
GroupProvider_SW GroupProvider = 1 // 声网
GroupProvider_TRTC GroupProvider = 2 // 腾讯trtc
)
......@@ -221,6 +221,7 @@ type GroupChannelId struct {
Token string `json:"token"`
AgoraId uint32 `json:"agoraId"`
MicNumType uint8 `json:"micNumType"`
Provider uint8 `json:"provider"` // 供应商 1.声网 2.腾讯trtc
}
//国籍视图
......
......@@ -11,6 +11,7 @@ import (
"git.hilo.cn/hilo-common/rpc"
"git.hilo.cn/hilo-common/sdk/agora"
"git.hilo.cn/hilo-common/sdk/tencentyun"
"git.hilo.cn/hilo-common/sdk/trtc"
"git.hilo.cn/hilo-common/utils"
"gorm.io/gorm"
"hilo-group/_const/enum/group_e"
......@@ -115,7 +116,7 @@ func (s *GroupService) LeaveGroupMember(model *domain.Model, groupId string, use
}
//进入房间, 返回channelId, err
func (s *GroupService) GroupIn(userId uint64, externalId string, groupUuid string, password, imei, ip string) (string, string, error) {
func (s *GroupService) GroupIn(userId uint64, externalId string, groupUuid string, password, imei, ip string, provider group_e.GroupProvider) (string, string, error) {
var channelId string
var token string
err := s.svc.Transactional(func() error {
......@@ -171,7 +172,11 @@ func (s *GroupService) GroupIn(userId uint64, externalId string, groupUuid strin
if err != nil {
return err
}
channelId, token, err = agora.CreateGroupAgora(groupInfo.ChannelId, uint32(userId))
if provider == group_e.GroupProvider_TRTC {
token = trtc.CreateGroupTRTCUserSig(userId)
} else {
channelId, token, err = agora.CreateGroupAgora(groupInfo.ChannelId, uint32(userId))
}
if err != nil {
return err
} else {
......
......@@ -1751,7 +1751,12 @@ func GroupIn(c *gin.Context) (*mycontext.MyContext, error) {
}
model.Log.Infof("GroupIn ip userId:%v,imGroupId:%v,ip:%v,imei:%v", userId, groupId, ip, imei)
if channelId, token, err := group_s.NewGroupService(myContext).GroupIn(userId, externalId, groupId, password, imei, ip); err != nil {
provider := group_e.GroupProvider_SW
if gi.Code == "70740667" {
provider = group_e.GroupProvider_TRTC
}
if channelId, token, err := group_s.NewGroupService(myContext).GroupIn(userId, externalId, groupId, password, imei, ip, provider); err != nil {
return myContext, err
} else {
// 加入房间缓存
......@@ -1767,6 +1772,7 @@ func GroupIn(c *gin.Context) (*mycontext.MyContext, error) {
Token: token,
AgoraId: uint32(userId),
MicNumType: gi.MicNumType,
Provider: provider,
})
// v2.26及以后,客户端自己加TIM群,不再由服务器代加
......
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