update 全网报块定时任务修复

This commit is contained in:
yyb 2025-08-13 13:36:41 +08:00
parent 94899a4baa
commit 7258909381
4 changed files with 27 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package com.m2pool.chat.service.impl; package com.m2pool.chat.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -151,6 +152,15 @@ public class ChatRoomServiceImpl extends ServiceImpl<ChatRoomMapper, ChatRoom> i
.userTwoEmail(email) .userTwoEmail(email)
.build(); .build();
try{ try{
ChatRoom chatRoom = chatRoomMapper.selectOne(new LambdaQueryWrapper<ChatRoom>()
.eq(ChatRoom::getUserOneEmail, userEmail).eq(ChatRoom::getUserTwoEmail, email));
if (chatRoom != null){
return R.success(ChatRoomDto.builder()
.id(chatRoom.getId())
.selfEmail(userEmail)
.customerIsOnline(customerIsOnline)
.userEmail(chatRoom.getUserTwoEmail()).build());
}
int insert = chatRoomMapper.insert(build); int insert = chatRoomMapper.insert(build);
if (insert > 0){ if (insert > 0){
return R.success(ChatRoomDto.builder() return R.success(ChatRoomDto.builder()

View File

@ -73,9 +73,18 @@ public class TranslateUtils {
return doc.html(); return doc.html();
} }
/**
* 获取元素下所有文本节点
* @param element
* @param textNodes
*/
private static void collectTextNodes(Element element, List<TextNode> textNodes) { private static void collectTextNodes(Element element, List<TextNode> textNodes) {
for (Node child : element.childNodes()) { for (Node child : element.childNodes()) {
if (child instanceof TextNode) { if (child instanceof TextNode) {
TextNode textNode = (TextNode) child;
// 获取原文本内容并在首尾添加空格
String newText = " " + textNode.text() + " ";
textNode.text(newText);
textNodes.add((TextNode) child); textNodes.add((TextNode) child);
} else if (child instanceof Element) { } else if (child instanceof Element) {
collectTextNodes((Element) child, textNodes); collectTextNodes((Element) child, textNodes);

View File

@ -591,7 +591,7 @@ public class NodeTask {
} catch (Exception e) { } catch (Exception e) {
retryCount++; retryCount++;
if (retryCount >= maxRetries) { if (retryCount >= maxRetries) {
log.error("插入区块 alph 数据失败,重试 {} 次后仍失败", maxRetries, e); log.error("插入区块 alph 数据失败,重试 {} 次后仍失败,失败原因{}", maxRetries, e.getMessage());
break; break;
} }
try { try {
@ -641,13 +641,15 @@ public class NodeTask {
*/ */
private void insertBlockWithDgbSeries(int maxRetries) { private void insertBlockWithDgbSeries(int maxRetries) {
int retryCount = 0; int retryCount = 0;
System.out.println("dgb 总高度执行");
while (retryCount < maxRetries) { while (retryCount < maxRetries) {
try { try {
//这里随便填一个dgb 的算法类型 dgb 共用一个高度 //这里随便填一个dgb 的算法类型 dgb 共用一个高度
String height = NodeRpc.getHeight("dgbq"); String height = NodeRpc.getHeight("dgbq");
System.out.println("dgb 总高度:"+height);
//需要记录每次的dgb 总的高度方便下次循环遍历 //需要记录每次的dgb 总的高度方便下次循环遍历
Integer lastHeight = poolMapper.getDgbTotalHeight(); Integer lastHeight = poolMapper.getDgbTotalHeight();
System.out.println("dgb 总高度lastHeight:"+lastHeight);
if (lastHeight != null){ if (lastHeight != null){
// 从数据库获取dgb系列的币种的最新高度(因为这是新接口是从0开始计算的高度) // 从数据库获取dgb系列的币种的最新高度(因为这是新接口是从0开始计算的高度)
@ -661,8 +663,9 @@ public class NodeTask {
//总高度 - 上次的总高度 然后循环遍历这些块高度来判断该块的算法类型, //总高度 - 上次的总高度 然后循环遍历这些块高度来判断该块的算法类型,
for (int i = Integer.parseInt(height) ; i > lastHeight ; i--){ for (int i = Integer.parseInt(height) ; i > lastHeight ; i--){
String hashBlock = NodeRpc.getBlockHash("dgbq", i); String hashBlock = NodeRpc.getBlockHash("dgbq", i);
System.out.println("dgb 总高度hashBlock:"+hashBlock);
String dgbType = NodeRpc.getBlockInfoByHash("dgbq", hashBlock); String dgbType = NodeRpc.getBlockInfoByHash("dgbq", hashBlock);
System.out.println("dgb 总高度dgbType:"+dgbType);
if("qubit".equals(dgbType)){ if("qubit".equals(dgbType)){
dgbqIncrement++; dgbqIncrement++;
}else if ("odo".equals(dgbType)){ }else if ("odo".equals(dgbType)){
@ -713,5 +716,6 @@ public class NodeTask {
} }
} }
} }
} }
} }

View File

@ -257,7 +257,7 @@ public class NodeRpc{
*/ */
public static String getBlockInfoByHash(String coin,String hash){ public static String getBlockInfoByHash(String coin,String hash){
String[] params = {hash}; String[] params = {hash};
String result = getResult(coin, "getblock",params); String result = getResultTest(coin, "getblock",params);
if(StringUtils.isBlank(result)){ if(StringUtils.isBlank(result)){
System.out.println("查询哈希块详细信息结果为空"+result); System.out.println("查询哈希块详细信息结果为空"+result);
return result; return result;