|
@@ -1,6 +1,7 @@
|
|
|
package com.fdkankan.tk.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.tk.common.ResultCode;
|
|
|
import com.fdkankan.tk.common.util.RedisKeyUtil;
|
|
@@ -36,7 +37,7 @@ public class TencentYunServiceImpl extends ServiceImpl<ITencentYunMapper, Tencen
|
|
|
public JSONObject getSign(String userId) {
|
|
|
String redisKey = RedisKeyUtil.TENCENT_YUN_KEY + userId;
|
|
|
if (!redisUtil.hasKey(redisKey)) {
|
|
|
- List<TencentYun> list = this.list();
|
|
|
+ List<TencentYun> list = this.getByType(0);
|
|
|
if(list == null || list.size() <=0){
|
|
|
throw new BusinessException(ResultCode.TENCENT_YUN_EMPTY);
|
|
|
}
|
|
@@ -62,6 +63,12 @@ public class TencentYunServiceImpl extends ServiceImpl<ITencentYunMapper, Tencen
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
+ private List<TencentYun> getByType(Integer type) {
|
|
|
+ LambdaQueryWrapper<TencentYun> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(TencentYun::getOperatorType,type);
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
static int tokenExpirationInSeconds = 3600;
|
|
|
static int privilegeExpirationInSeconds = 3600;
|
|
|
|
|
@@ -83,7 +90,7 @@ public class TencentYunServiceImpl extends ServiceImpl<ITencentYunMapper, Tencen
|
|
|
}
|
|
|
String redisKey = String.format(RedisKeyUtil.AGORA_KEY ,channelName,roleId,userId);
|
|
|
if (!redisUtil.hasKey(redisKey)) {
|
|
|
- List<TencentYun> list = this.list();
|
|
|
+ List<TencentYun> list = this.getByType(1);
|
|
|
if(list == null || list.size() <=0){
|
|
|
throw new BusinessException(ResultCode.TENCENT_YUN_EMPTY);
|
|
|
}
|