Commit c60328ab by huangjy

fix:声网token

parent 30068236
......@@ -80,14 +80,14 @@ public class PlatAlarmRecordController {
@ApiOperation("呼叫设备rtm")
@PostMapping("callingDeviceAuthRtm")
@AuthIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthRtm(@RequestBody BaseIdDTO baseIdDTO) {
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthRtm(@RequestBody BaseIdDTO baseIdDTO) throws Exception {
return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId()));
}
@ApiOperation("呼叫设备rtm")
@PostMapping("callingDeviceAuthIgnoreRtm")
@AuthIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthIgnoreRtm(@RequestBody BaseIdDTO baseIdDTO) {
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthIgnoreRtm(@RequestBody BaseIdDTO baseIdDTO) throws Exception {
return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId()));
}
......
......@@ -71,5 +71,5 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> {
PlatAlarmCallDeviceVO callingDevice();
PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id);
PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) throws Exception;
}
......@@ -42,6 +42,7 @@ import com.makeit.service.platform.space.PlatRoomBedDeviceService;
import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.saas.PlatTenantService;
import com.makeit.shengwang.agora.media.RtcTokenBuilder2;
import com.makeit.shengwang.agora.rtm.RtmTokenBuilder;
import com.makeit.shengwang.agora.rtm.RtmTokenBuilder2;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil;
......@@ -589,16 +590,16 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
}
@Override
public PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) {
public PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) throws Exception {
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.setAccessToken(result);
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
String format = now.format(dateTimeFormatter);
platAlarmCallDeviceVO.setAccessToken(result);
platAlarmCallDeviceVO.setAccessToken(result2);
platAlarmCallDeviceVO.setChannelName(format);
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