trtc.go 600 Bytes
Newer Older
chenweijian's avatar
chenweijian committed
1 2 3 4
package trtc

import (
	"fmt"
chenweijian's avatar
chenweijian committed
5
	"git.hilo.cn/hilo-common/mylogrus"
chenweijian's avatar
chenweijian committed
6
	"git.hilo.cn/hilo-common/resource/config"
chenweijian's avatar
chenweijian committed
7 8 9
)

//创建群组的TRTC通道,token有效时长:一个星期
chenweijian's avatar
chenweijian committed
10
func CreateGroupTRTCUserSig(uid uint64, config config.TRTCConfig) string {
chenweijian's avatar
chenweijian committed
11
	expireTimeInSeconds := 60 * 60 * 24 * 7 //一个星期
chenweijian's avatar
chenweijian committed
12

chenweijian's avatar
chenweijian committed
13
	sig, err := GenUserSig(config.APP_ID, config.APP_CERTIFICATE, fmt.Sprintf("%d", uid), expireTimeInSeconds)
chenweijian's avatar
chenweijian committed
14 15 16 17 18 19
	if err != nil {
		mylogrus.MyLog.Errorf("CreateGroupTRTCUserSig uid:%d, err:%v", uid, err)
	}
	mylogrus.MyLog.Infof("CreateGroupTRTCUserSig uid:%d, token:%s", uid, sig)

	return sig
chenweijian's avatar
chenweijian committed
20
}