| 123456789101112131415161718192021222324252627282930313233 |
- package utils
- import (
- SysConfig "mtp2_if/config"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
- faceid "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/faceid/v20180301"
- )
- var TencenCloudFaceIdClient *faceid.Client
- // InitTencentCloudClient 初始化Client
- func InitTencentCloudClient() (err error) {
- secretId := SysConfig.SerCfg.TencentCloudCfg.SecretId
- secretKey := SysConfig.SerCfg.TencentCloudCfg.SecretKey
- // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
- // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
- credential := common.NewCredential(
- secretId,
- secretKey,
- )
- // 实例化一个client选项,可选的,没有特殊需求可以跳过
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.Endpoint = SysConfig.SerCfg.TencentCloudCfg.FaceIdEndPoint
- TencenCloudFaceIdClient, err = faceid.NewClient(credential, "", cpf)
- if err != nil {
- return
- }
- return
- }
|