|
@@ -2,6 +2,7 @@ package com.hy.modules.bz.webapi.service.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.hy.common.tools.EncodeUtils;
|
|
import com.hy.common.tools.EncodeUtils;
|
|
|
|
|
+import com.hy.modules.bz.domain.BzAnchorStudio;
|
|
|
import com.hy.modules.bz.domain.BzPlayer;
|
|
import com.hy.modules.bz.domain.BzPlayer;
|
|
|
import com.hy.modules.bz.service.IBzAnchorStudioService;
|
|
import com.hy.modules.bz.service.IBzAnchorStudioService;
|
|
|
import com.hy.modules.bz.service.IBzPlayerService;
|
|
import com.hy.modules.bz.service.IBzPlayerService;
|
|
@@ -63,18 +64,23 @@ public class WebApiServiceImpl implements WebApiService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void logout(LogoutDto logoutDto) {
|
|
public void logout(LogoutDto logoutDto) {
|
|
|
- QueryWrapper<BzPlayer> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
- queryWrapper.eq("card_no",logoutDto.getCardNo())
|
|
|
|
|
- .eq("status","normal");
|
|
|
|
|
- BzPlayer player = playerService.getOne(queryWrapper,false);
|
|
|
|
|
- Assert.notNull(player,"No player found");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ BzAnchorStudio anchorStudio = anchorStudioService.stopStudio(logoutDto.getToken());
|
|
|
|
|
+ String carNo = null;
|
|
|
|
|
+ if(null != anchorStudio){
|
|
|
|
|
+ carNo = anchorStudio.getAnchorName();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ carNo = logoutDto.getCardNo();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
String token = stringRedisTemplate.opsForValue().get(TOKEN_PRIFIX.concat(logoutDto.getCardNo()));
|
|
String token = stringRedisTemplate.opsForValue().get(TOKEN_PRIFIX.concat(logoutDto.getCardNo()));
|
|
|
|
|
+
|
|
|
if(null!=token){
|
|
if(null!=token){
|
|
|
if(!token.equals(logoutDto.getToken())){
|
|
if(!token.equals(logoutDto.getToken())){
|
|
|
throw new RuntimeException("Illegal request for user: " + logoutDto.getCardNo());
|
|
throw new RuntimeException("Illegal request for user: " + logoutDto.getCardNo());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
stringRedisTemplate.delete(TOKEN_PRIFIX.concat(logoutDto.getCardNo()));
|
|
stringRedisTemplate.delete(TOKEN_PRIFIX.concat(logoutDto.getCardNo()));
|
|
|
}
|
|
}
|
|
|
|
|
|