|
@@ -8,6 +8,7 @@ import com.zanxiang.game.module.manage.enums.CpSendRoleResultEnum;
|
|
|
import com.zanxiang.game.module.manage.pojo.dto.CpSendMsgResultDTO;
|
|
|
import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
|
|
|
import com.zanxiang.game.module.manage.service.*;
|
|
|
+import com.zanxiang.game.module.manage.utils.SignUtil;
|
|
|
import com.zanxiang.game.module.mybatis.entity.CpSendMsgLog;
|
|
|
import com.zanxiang.game.module.mybatis.entity.CpSendMsgResult;
|
|
|
import com.zanxiang.game.module.mybatis.entity.GameSupper;
|
|
@@ -25,8 +26,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.support.TransactionTemplate;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
-import java.security.MessageDigest;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -40,8 +39,6 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class CpSendMsgLogServiceImpl extends ServiceImpl<CpSendMsgLogMapper, CpSendMsgLog> implements ICpSendMsgLogService {
|
|
|
|
|
|
- private static final String SIGN_MD5 = "MD5";
|
|
|
-
|
|
|
@Autowired
|
|
|
private TransactionTemplate transactionTemplate;
|
|
|
|
|
@@ -149,14 +146,13 @@ public class CpSendMsgLogServiceImpl extends ServiceImpl<CpSendMsgLogMapper, CpS
|
|
|
.build();
|
|
|
}
|
|
|
|
|
|
- private CpSendMsgResultDTO cpSendMsgApi(GameSupper gameSupper, String msgId, String serverId, String text,
|
|
|
- List<String> roleIdList) throws Exception {
|
|
|
+ private CpSendMsgResultDTO cpSendMsgApi(GameSupper gameSupper, String msgId, String serverId, String text, List<String> roleIdList) {
|
|
|
long time = System.currentTimeMillis() / 1000;
|
|
|
Map<String, Object> param = new HashMap<>(8);
|
|
|
param.put("msgId", msgId);
|
|
|
param.put("strRan", msgId);
|
|
|
param.put("time", time);
|
|
|
- param.put("sign", this.MD5("key=" + gameSupper.getCpSendMsgKey() + "&msgId=" + msgId + "&strRan=" + msgId + "&time=" + time));
|
|
|
+ param.put("sign", SignUtil.md5("key=" + gameSupper.getCpSendMsgKey() + "&msgId=" + msgId + "&strRan=" + msgId + "&time=" + time));
|
|
|
param.put("pushType", 1);
|
|
|
param.put("serverid", serverId);
|
|
|
param.put("roleIds", roleIdList);
|
|
@@ -180,14 +176,4 @@ public class CpSendMsgLogServiceImpl extends ServiceImpl<CpSendMsgLogMapper, CpS
|
|
|
}
|
|
|
return JsonUtil.toObj(result, CpSendMsgResultDTO.class);
|
|
|
}
|
|
|
-
|
|
|
- private String MD5(String data) throws Exception {
|
|
|
- java.security.MessageDigest md = MessageDigest.getInstance(SIGN_MD5);
|
|
|
- byte[] array = md.digest(data.getBytes(StandardCharsets.UTF_8));
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- for (byte item : array) {
|
|
|
- sb.append(Integer.toHexString((item & 0xFF) | 0x100), 1, 3);
|
|
|
- }
|
|
|
- return sb.toString();
|
|
|
- }
|
|
|
}
|