Commit c60328ab by huangjy

fix:声网token

parent 30068236
...@@ -80,14 +80,14 @@ public class PlatAlarmRecordController { ...@@ -80,14 +80,14 @@ public class PlatAlarmRecordController {
@ApiOperation("呼叫设备rtm") @ApiOperation("呼叫设备rtm")
@PostMapping("callingDeviceAuthRtm") @PostMapping("callingDeviceAuthRtm")
@AuthIgnore @AuthIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthRtm(@RequestBody BaseIdDTO baseIdDTO) { public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthRtm(@RequestBody BaseIdDTO baseIdDTO) throws Exception {
return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId())); return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId()));
} }
@ApiOperation("呼叫设备rtm") @ApiOperation("呼叫设备rtm")
@PostMapping("callingDeviceAuthIgnoreRtm") @PostMapping("callingDeviceAuthIgnoreRtm")
@AuthIgnore @AuthIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthIgnoreRtm(@RequestBody BaseIdDTO baseIdDTO) { public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthIgnoreRtm(@RequestBody BaseIdDTO baseIdDTO) throws Exception {
return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId())); return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId()));
} }
......
...@@ -71,5 +71,5 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> { ...@@ -71,5 +71,5 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> {
PlatAlarmCallDeviceVO callingDevice(); PlatAlarmCallDeviceVO callingDevice();
PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id); PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) throws Exception;
} }
...@@ -42,6 +42,7 @@ import com.makeit.service.platform.space.PlatRoomBedDeviceService; ...@@ -42,6 +42,7 @@ import com.makeit.service.platform.space.PlatRoomBedDeviceService;
import com.makeit.service.platform.space.PlatRoomService; import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.saas.PlatTenantService; import com.makeit.service.saas.PlatTenantService;
import com.makeit.shengwang.agora.media.RtcTokenBuilder2; import com.makeit.shengwang.agora.media.RtcTokenBuilder2;
import com.makeit.shengwang.agora.rtm.RtmTokenBuilder;
import com.makeit.shengwang.agora.rtm.RtmTokenBuilder2; import com.makeit.shengwang.agora.rtm.RtmTokenBuilder2;
import com.makeit.utils.data.convert.BeanDtoVoUtils; import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil; import com.makeit.utils.data.convert.PageUtil;
...@@ -589,16 +590,16 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe ...@@ -589,16 +590,16 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
} }
@Override @Override
public PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) { public PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) throws Exception {
RtmTokenBuilder2 token = new RtmTokenBuilder2(); RtmTokenBuilder2 token = new RtmTokenBuilder2();
String result = token.buildToken(shengwangProperties.getAppId(), shengwangProperties.getAppCertificate(), id, shengwangProperties.getTokenExpirationInSeconds()); RtmTokenBuilder token2 = new RtmTokenBuilder();
String result2 = token2.buildToken(shengwangProperties.getAppId(), shengwangProperties.getAppCertificate(), "0", RtmTokenBuilder.Role.Rtm_User, shengwangProperties.getTokenExpirationInSeconds());
//String result = token.buildToken(shengwangProperties.getAppId(), shengwangProperties.getAppCertificate(), id, shengwangProperties.getTokenExpirationInSeconds());
PlatAlarmCallDeviceVO platAlarmCallDeviceVO = new PlatAlarmCallDeviceVO(); PlatAlarmCallDeviceVO platAlarmCallDeviceVO = new PlatAlarmCallDeviceVO();
platAlarmCallDeviceVO.setAccessToken(result);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
String format = now.format(dateTimeFormatter); String format = now.format(dateTimeFormatter);
platAlarmCallDeviceVO.setAccessToken(result); platAlarmCallDeviceVO.setAccessToken(result2);
platAlarmCallDeviceVO.setChannelName(format); platAlarmCallDeviceVO.setChannelName(format);
return platAlarmCallDeviceVO; return platAlarmCallDeviceVO;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment