|
@@ -1,4 +1,6 @@
|
|
|
import * as LibGenerateTestUserSig from './lib-generate-test-usersig.min.js'
|
|
|
+import { getSignatureInfo } from "../../src/api";
|
|
|
+// import store from '@/store';
|
|
|
|
|
|
/**
|
|
|
* 腾讯云 SDKAppId,需要替换为您自己账号下的 SDKAppId。
|
|
@@ -6,7 +8,7 @@ import * as LibGenerateTestUserSig from './lib-generate-test-usersig.min.js'
|
|
|
* 进入腾讯云实时音视频[控制台](https://console.cloud.tencent.com/rav ) 创建应用,即可看到 SDKAppId,
|
|
|
* 它是腾讯云用于区分客户的唯一标识。
|
|
|
*/
|
|
|
-const SDKAPPID = 1400594521
|
|
|
+const SDKAPPID = 1400601414
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -15,7 +17,7 @@ const SDKAPPID = 1400594521
|
|
|
* 时间单位:秒
|
|
|
* 默认时间:7 x 24 x 60 x 60 = 604800 = 7 天
|
|
|
*/
|
|
|
-const EXPIRETIME = 604800
|
|
|
+const EXPIRETIME = 86400
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -28,7 +30,7 @@ const EXPIRETIME = 604800
|
|
|
* 注意:该方案仅适用于调试Demo,正式上线前请将 UserSig 计算代码和密钥迁移到您的后台服务器上,以避免加密密钥泄露导致的流量盗用。
|
|
|
* 文档:https://cloud.tencent.com/document/product/647/17275#Server
|
|
|
*/
|
|
|
-const SECRETKEY = 'd643bc248fd0c49a041ef7551962fe639abfbb9db660dd1c6d7e868f8193f704'
|
|
|
+const SECRETKEY = '6d065252f0779d8a4a45020630b3507ac1c8f946669fc240b9818ed243e40547'
|
|
|
|
|
|
/*
|
|
|
* Module: GenerateTestUserSig
|
|
@@ -47,15 +49,56 @@ const SECRETKEY = 'd643bc248fd0c49a041ef7551962fe639abfbb9db660dd1c6d7e868f8193f
|
|
|
*
|
|
|
* Reference:https://cloud.tencent.com/document/product/647/17275#Server
|
|
|
*/
|
|
|
-export function genTestUserSig(userID) {
|
|
|
+export function genTestUserSig(userID) {
|
|
|
// console.log("LibGenerateTestUserSig",LibGenerateTestUserSig.default)
|
|
|
// console.log("typeof LibGenerateTestUserSig",typeof LibGenerateTestUserSig.default)
|
|
|
const generator = new LibGenerateTestUserSig.default(SDKAPPID, SECRETKEY, EXPIRETIME)
|
|
|
const userSig = generator.genTestUserSig(userID)
|
|
|
|
|
|
+ // return {
|
|
|
+ // sdkAppID: SDKAPPID,
|
|
|
+ // userSig: userSig,
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//接口获取签名
|
|
|
+ let inviterId = sessionStorage.getItem('inviterId');
|
|
|
+ if(!userID){userID=inviterId}
|
|
|
+ console.log('inviterId',inviterId);
|
|
|
+ let type = null;
|
|
|
+ let from = sessionStorage.getItem('from');
|
|
|
+ console.log('from',from);
|
|
|
+ console.log('userID',userID);
|
|
|
+ // console.log('userSig',userSig);
|
|
|
+ if(from=='company'){
|
|
|
+ type = 3
|
|
|
+ }else if(from=='veterans'){
|
|
|
+ type = 1
|
|
|
+ }else if(from=='teacher'){
|
|
|
+ type = 2
|
|
|
+ }
|
|
|
+
|
|
|
+ let inviterInfo={};
|
|
|
+ getSignatureInfo({id:userID,type:type}).then(res=>{
|
|
|
+ console.log('getSignatureInfo',res.data);
|
|
|
+ inviterInfo = res.data.data;
|
|
|
+ inviterInfo.sdkAppID = SDKAPPID;
|
|
|
+ inviterInfo.userSig = res.data.data.signature;
|
|
|
+ sessionStorage.setItem('inviterInfo', JSON.stringify(inviterInfo));
|
|
|
+ console.log('inviterInfo',inviterInfo);
|
|
|
+ // return inviterInfo;
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('getSignatureInfo',err);
|
|
|
+ })
|
|
|
+
|
|
|
+ // return inviterInfo
|
|
|
+
|
|
|
return {
|
|
|
sdkAppID: SDKAPPID,
|
|
|
userSig: userSig,
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|