Commit cadd900e by giaogiao

login单元测试

parent a974a9de
...@@ -59,45 +59,48 @@ public class LoginTest { ...@@ -59,45 +59,48 @@ public class LoginTest {
if (mySign.equals(sign)) { if (mySign.equals(sign)) {
System.out.println("一致" + mySign); System.out.println("一致" + mySign);
// return null; // return null;
// } else {
// } System.out.println("不一致" + mySign);
// return null;
// // 判断client是否存在
// ImClient client = imClientService.getOne(new QueryWrapper<ImClient>().lambda() }
// .eq(ImClient::getFkAppid, imApplication.getId())
// .eq(ImClient::getClientId, clientId)); // 判断client是否存在
// ImClient client = imClientService.getOne(new QueryWrapper<ImClient>().lambda()
// if (client == null) { .eq(ImClient::getFkAppid, imApplication.getId())
// System.out.println("不存在"); .eq(ImClient::getClientId, clientId));
//
// ImClient imClient = new ImClient(); if (client == null) {
// imClient.setId(new Snowflake(1L, 1L).nextId()); System.out.println("不存在");
// imClient.setFkAppid(imApplication.getId());
// imClient.setClientId(clientId); ImClient imClient = new ImClient();
// imClientService.save(imClient); imClient.setId(new Snowflake(1L, 1L).nextId());
// imClient.setFkAppid(imApplication.getId());
// } else { imClient.setClientId(clientId);
// System.out.println("存在"); imClientService.save(imClient);
// }
// } else {
// // 生成token System.out.println("存在");
// String generateToken = JwtUtil.generateToken(clientId, appKey, imApplication.getAppSecret(), Duration.ofDays(99999)); }
//
// // 保存redis // 生成token
// redisTemplate.opsForValue().set("client:" + imApplication.getAppKey() + ":" + clientId, generateToken); String generateToken = JwtUtil.generateToken(clientId, appKey, imApplication.getAppSecret(), Duration.ofDays(99999));
// return generateToken;
// } // 保存redis
// redisTemplate.opsForValue().set("client:" + imApplication.getAppKey() + ":" + clientId, generateToken);
// @Test return generateToken;
// public void test() throws Exception { }
// // 时间戳
// String timestamp = "1629274899016"; @Test
// String clientId = "aaaaa2"; public void test() throws Exception {
// String sign = "a404fe25d383eb154b3b527f7213b35a"; // 时间戳
// String timestamp = "1629274899016";
// String clientId = "aaaaa2";
// String appKey = "QNtP3EjtLw26ekt0"; String sign = "a404fe25d383eb154b3b527f7213b35a";
// String token = getToken(timestamp, clientId, appKey, sign);
// System.out.println("token:\n" + token);
// } String appKey = "QNtP3EjtLw26ekt0";
//} String token = getToken(timestamp, clientId, appKey, sign);
System.out.println("token:\n" + token);
}
}
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