Commit 60209023 by hweeeeeei

System.currentTimeMillis() 替代new Date().getTime()

parent 6eb22920
...@@ -6,8 +6,6 @@ import com.fasterxml.jackson.databind.json.JsonMapper; ...@@ -6,8 +6,6 @@ import com.fasterxml.jackson.databind.json.JsonMapper;
import com.wecloud.im.ws.model.request.ReceiveModel; import com.wecloud.im.ws.model.request.ReceiveModel;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import java.util.Date;
/** /**
* 客户方签名字符串生成 单元测试 * 客户方签名字符串生成 单元测试
*/ */
...@@ -38,7 +36,7 @@ public class SignTest { ...@@ -38,7 +36,7 @@ public class SignTest {
String clientId = "client_333"; String clientId = "client_333";
String appKey = "elLwpel1gWCHDqZy"; String appKey = "elLwpel1gWCHDqZy";
String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737"; String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737";
String timestamp = String.valueOf(new Date().getTime()); String timestamp = String.valueOf(System.currentTimeMillis());
getSign(timestamp, clientId, appKey, appSecret); getSign(timestamp, clientId, appKey, appSecret);
} }
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<script type="text/javascript"> <script type="text/javascript">
function changeImage() { function changeImage() {
document.getElementById('imageCode').src = "http://localhost:8888/api/verificationCode/getImage?time=" + new Date().getTime(); document.getElementById('imageCode').src = "http://localhost:8888/api/verificationCode/getImage?time=" + System.currentTimeMillis();
} }
var url = "http://localhost:8888/api/verificationCode/getBase64Image"; var url = "http://localhost:8888/api/verificationCode/getBase64Image";
......
...@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -64,7 +63,7 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService { ...@@ -64,7 +63,7 @@ public class MangerRtcCacheServiceImpl implements MangerRtcCacheService {
//当前房主 //当前房主
rtcChannelInfo.setOwner(clientId); rtcChannelInfo.setOwner(clientId);
//创建时间 //创建时间
rtcChannelInfo.setCreateTimestamp(new Date().getTime()); rtcChannelInfo.setCreateTimestamp(System.currentTimeMillis());
String rtcChannelInfoJson = new JsonMapper().writeValueAsString(rtcChannelInfo); String rtcChannelInfoJson = new JsonMapper().writeValueAsString(rtcChannelInfo);
......
...@@ -100,7 +100,7 @@ public class RtcServiceImpl implements RtcService { ...@@ -100,7 +100,7 @@ public class RtcServiceImpl implements RtcService {
// rtcCallResponse.setConversationId(createRtcChannelParam.getConversationId()); // rtcCallResponse.setConversationId(createRtcChannelParam.getConversationId());
rtcCallResponse.setChannelId(rtcChannelId); rtcCallResponse.setChannelId(rtcChannelId);
rtcCallResponse.setClientId(client.getClientId()); rtcCallResponse.setClientId(client.getClientId());
rtcCallResponse.setTimestamp(new Date().getTime()); rtcCallResponse.setTimestamp(System.currentTimeMillis());
wsRtcWrite.rtcCall(rtcCallResponse, imApplication.getAppKey(), createRtcChannelParam.getToClient()); wsRtcWrite.rtcCall(rtcCallResponse, imApplication.getAppKey(), createRtcChannelParam.getToClient());
// TODO 待开发 下发安卓和ios系统推送 // TODO 待开发 下发安卓和ios系统推送
...@@ -133,7 +133,7 @@ public class RtcServiceImpl implements RtcService { ...@@ -133,7 +133,7 @@ public class RtcServiceImpl implements RtcService {
rtcSdpForwardResponse.setChannelId(joinRtcChannelParam.getChannelId()); rtcSdpForwardResponse.setChannelId(joinRtcChannelParam.getChannelId());
rtcSdpForwardResponse.setClientId(client.getClientId()); rtcSdpForwardResponse.setClientId(client.getClientId());
rtcSdpForwardResponse.setTimestamp(new Date().getTime()); rtcSdpForwardResponse.setTimestamp(System.currentTimeMillis());
wsRtcWrite.clientJoin(rtcSdpForwardResponse, imApplication.getAppKey(), toClientId); wsRtcWrite.clientJoin(rtcSdpForwardResponse, imApplication.getAppKey(), toClientId);
} }
...@@ -159,7 +159,7 @@ public class RtcServiceImpl implements RtcService { ...@@ -159,7 +159,7 @@ public class RtcServiceImpl implements RtcService {
rtcClientRejectResponse.setChannelId(rejectRtcChannelParam.getChannelId()); rtcClientRejectResponse.setChannelId(rejectRtcChannelParam.getChannelId());
rtcClientRejectResponse.setClientId(client.getClientId()); rtcClientRejectResponse.setClientId(client.getClientId());
rtcClientRejectResponse.setTimestamp(new Date().getTime()); rtcClientRejectResponse.setTimestamp(System.currentTimeMillis());
wsRtcWrite.clientReject(rtcClientRejectResponse, imApplication.getAppKey(), toClientId); wsRtcWrite.clientReject(rtcClientRejectResponse, imApplication.getAppKey(), toClientId);
} }
return ApiResult.ok(true); return ApiResult.ok(true);
...@@ -193,7 +193,7 @@ public class RtcServiceImpl implements RtcService { ...@@ -193,7 +193,7 @@ public class RtcServiceImpl implements RtcService {
rtcClientLeaveResponse.setChannelId(leaveRtcChannelParam.getChannelId()); rtcClientLeaveResponse.setChannelId(leaveRtcChannelParam.getChannelId());
rtcClientLeaveResponse.setClientId(client.getClientId()); rtcClientLeaveResponse.setClientId(client.getClientId());
rtcClientLeaveResponse.setTimestamp(new Date().getTime()); rtcClientLeaveResponse.setTimestamp(System.currentTimeMillis());
wsRtcWrite.clientLeave(rtcClientLeaveResponse, imApplication.getAppKey(), toClientId); wsRtcWrite.clientLeave(rtcClientLeaveResponse, imApplication.getAppKey(), toClientId);
} }
...@@ -237,7 +237,7 @@ public class RtcServiceImpl implements RtcService { ...@@ -237,7 +237,7 @@ public class RtcServiceImpl implements RtcService {
rtcSdpForwardResponse.setChannelId(rtcChannelId); rtcSdpForwardResponse.setChannelId(rtcChannelId);
rtcSdpForwardResponse.setClientId(client.getClientId()); rtcSdpForwardResponse.setClientId(client.getClientId());
rtcSdpForwardResponse.setTimestamp(new Date().getTime()); rtcSdpForwardResponse.setTimestamp(System.currentTimeMillis());
wsRtcWrite.sdpForward(rtcSdpForwardResponse, imApplication.getAppKey(), toClientId); wsRtcWrite.sdpForward(rtcSdpForwardResponse, imApplication.getAppKey(), toClientId);
} }
...@@ -278,7 +278,7 @@ public class RtcServiceImpl implements RtcService { ...@@ -278,7 +278,7 @@ public class RtcServiceImpl implements RtcService {
rtcCandidateForwardResponse.setChannelId(rtcChannelId); rtcCandidateForwardResponse.setChannelId(rtcChannelId);
rtcCandidateForwardResponse.setClientId(client.getClientId()); rtcCandidateForwardResponse.setClientId(client.getClientId());
rtcCandidateForwardResponse.setTimestamp(new Date().getTime()); rtcCandidateForwardResponse.setTimestamp(System.currentTimeMillis());
wsRtcWrite.candidateForward(rtcCandidateForwardResponse, imApplication.getAppKey(), toClientId); wsRtcWrite.candidateForward(rtcCandidateForwardResponse, imApplication.getAppKey(), toClientId);
} }
......
# wecloud-im 前端Websocket对接文档 # wecloud-im 前端Websocket对接文档
...@@ -114,7 +114,7 @@ public static void main(String[] args) { ...@@ -114,7 +114,7 @@ public static void main(String[] args) {
String clientId = "client_123123"; String clientId = "client_123123";
String appKey = "elLwpel1gWCHDqZy"; String appKey = "elLwpel1gWCHDqZy";
String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737"; String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737";
String timestamp = String.valueOf(new Date().getTime()); String timestamp = String.valueOf(System.currentTimeMillis());
getSign(timestamp, clientId, appKey, appSecret); getSign(timestamp, clientId, appKey, appSecret);
} }
``` ```
......
# wecloud-im 即时通讯云对接文档 # wecloud-im 即时通讯云对接文档
...@@ -160,7 +160,7 @@ public static void main(String[] args) { ...@@ -160,7 +160,7 @@ public static void main(String[] args) {
String clientId = "client_123123"; String clientId = "client_123123";
String appKey = "elLwpel1gWCHDqZy"; String appKey = "elLwpel1gWCHDqZy";
String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737"; String appSecret = "68809bb5a9077a83631aeb0b17b5965d6b2302faf2ab3737";
String timestamp = String.valueOf(new Date().getTime()); String timestamp = String.valueOf(System.currentTimeMillis());
getSign(timestamp, clientId, appKey, appSecret); getSign(timestamp, clientId, appKey, appSecret);
} }
``` ```
......
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 to comment