|
@@ -129,19 +129,28 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public String getWxQrCode(Integer roomId) {
|
|
|
+ public String getWxQrCode(Integer roomId,String type) {
|
|
|
Room room = this.getById(roomId);
|
|
|
if(room == null){
|
|
|
throw new BusinessException(ResultCode.ROOM_MISS);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(room.getRoomQrCode())){
|
|
|
- if(uploadToOssUtil.existKey(room.getRoomQrCode())){
|
|
|
- return room.getRoomQrCode();
|
|
|
+ if(type.equals("follower") && StringUtils.isNotBlank(room.getRoomShareCode())){ //普通用户二维码
|
|
|
+ if(uploadToOssUtil.existKey(room.getRoomShareCode())){
|
|
|
+ return room.getRoomShareCode();
|
|
|
}
|
|
|
}
|
|
|
- String localPath = String.format(FilePath.LOCAL_QRCODE_PATH, roomId);
|
|
|
- String ossPath = String.format(FilePath.OSS_QRCODE_PATH, roomId);
|
|
|
- wxService.getWxQRCode("roomId="+roomId,localPath,0);
|
|
|
+
|
|
|
+ if(type.equals("leader") && StringUtils.isNotBlank(room.getRoomHostCode())){ //主持人二维码
|
|
|
+ if(uploadToOssUtil.existKey(room.getRoomHostCode())){
|
|
|
+ return room.getRoomHostCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String localPath = String.format(FilePath.LOCAL_QRCODE_PATH, type,roomId);
|
|
|
+ String ossPath = String.format(FilePath.OSS_QRCODE_PATH,type, roomId);
|
|
|
+ String path = "roomId="+roomId+"&role=%s";
|
|
|
+ path = String.format(path,type);
|
|
|
+ wxService.getWxQRCode(path,localPath,0);
|
|
|
if(!new File(localPath).exists()){
|
|
|
throw new BusinessException(ResultCode.QRCODE_MISS);
|
|
|
}
|
|
@@ -150,7 +159,11 @@ public class RoomServiceImpl extends ServiceImpl<IRoomMapper, Room> implements I
|
|
|
FileUtil.del(localPath);
|
|
|
throw new BusinessException(ResultCode.QRCODE_MISS);
|
|
|
}
|
|
|
- room.setRoomQrCode(queryPath + ossPath);
|
|
|
+ if(type.equals("leader")){
|
|
|
+ room.setRoomHostCode(queryPath + ossPath);
|
|
|
+ }else {
|
|
|
+ room.setRoomShareCode(queryPath + ossPath);
|
|
|
+ }
|
|
|
this.updateById(room);
|
|
|
FileUtil.del(localPath);
|
|
|
return queryPath + ossPath;
|