拼多多地址

This commit is contained in:
Leo
2025-04-07 10:38:02 +08:00
parent 4e058fd816
commit 109f1b382d
3 changed files with 177 additions and 143 deletions

View File

@@ -50,6 +50,7 @@ import java.util.stream.Stream;
import static cn.van.business.util.JDUtil.UserInteractionState.GiftMoneyStep.*; import static cn.van.business.util.JDUtil.UserInteractionState.GiftMoneyStep.*;
import static cn.van.business.util.JDUtil.UserInteractionState.ProcessState.INIT; import static cn.van.business.util.JDUtil.UserInteractionState.ProcessState.INIT;
import static cn.van.business.util.WXUtil.chatRoom_BY;
import static cn.van.business.util.WXUtil.super_admins; import static cn.van.business.util.WXUtil.super_admins;
/** /**
@@ -186,6 +187,36 @@ public class JDUtil {
// 具体逻辑 // 具体逻辑
} }
public void cjwlm(String message) {
logger.info("执行 cjwlm 方法order: {}", message);
if (message.contains("https://u.jd")) {
// 2. 生成推广内容
HashMap<String, List<String>> contentResult = generatePromotionContent(message);
// 3. 发送文本内容
for (String text : contentResult.get("text")) {
wxUtil.sendTextMessage(chatRoom_BY, text, 1, chatRoom_BY, true);
}
// 4. 发送图片(如果有)
List<String> images = contentResult.get("images");
if (images != null) {
try {
Thread.sleep(6000);
} catch (InterruptedException ignored) {
}
for (String imageUrl : images) {
if (imageUrl != null) {
wxUtil.sendImageMessage(chatRoom_BY, imageUrl);
}
}
}
}
// 具体逻辑
}
private OrderStats calculateStats(List<OrderRow> orders) { private OrderStats calculateStats(List<OrderRow> orders) {
long paid = orders.stream().filter(o -> o.getValidCode() == 16).count(); long paid = orders.stream().filter(o -> o.getValidCode() == 16).count();
long pending = orders.stream().filter(o -> o.getValidCode() == 15).count(); long pending = orders.stream().filter(o -> o.getValidCode() == 15).count();

View File

@@ -36,6 +36,10 @@ public class WXUtil {
public static Map<String, SuperAdmin> super_admins = new HashMap<>(); public static Map<String, SuperAdmin> super_admins = new HashMap<>();
public static Map<String, String> jdidToWxidMap = new HashMap<>(); public static Map<String, String> jdidToWxidMap = new HashMap<>();
public static List<String> chatRoomList = new ArrayList<>(); public static List<String> chatRoomList = new ArrayList<>();
//玩乐买
public static String chatRoom_WLM = "23143922156@chatroom";
//搬运群
public static String chatRoom_BY = "50400969285@chatroom";
/** /**
* url http://127.0.0.1:7777/DaenWxHook/httpapi/ * url http://127.0.0.1:7777/DaenWxHook/httpapi/
* 获取微信列表 (X0000) * 获取微信列表 (X0000)
@@ -189,7 +193,8 @@ public class WXUtil {
} }
} }
public void sendImageMessage(String wxid, String imagePath){
public void sendImageMessage(String wxid, String imagePath) {
WxReqDate wxReqDate = createWxReqData(WXReqType.SEND_IMAGE); WxReqDate wxReqDate = createWxReqData(WXReqType.SEND_IMAGE);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("wxid", wxid); data.put("wxid", wxid);

View File

@@ -3,14 +3,11 @@ package cn.van.business.util;
import cn.van.business.enums.FromType; import cn.van.business.enums.FromType;
import cn.van.business.model.wx.WxMessage; import cn.van.business.model.wx.WxMessage;
import cn.van.business.model.wx.WxMessageDataForChat;
import cn.van.business.model.wx.WxUser;
import cn.van.business.repository.SettingRepository; import cn.van.business.repository.SettingRepository;
import cn.van.business.repository.WxMessageDataForChatRepository; import cn.van.business.repository.WxMessageDataForChatRepository;
import cn.van.business.repository.WxUserRepository; import cn.van.business.repository.WxUserRepository;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -19,15 +16,11 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static cn.van.business.util.WXUtil.chatRoomList; import static cn.van.business.util.WXUtil.*;
import static cn.van.business.util.WXUtil.super_admins;
/** /**
@@ -195,8 +188,6 @@ public class WxMessageConsumer {
// wxUtil.sendTextMessage(wxid, result, msgType, null); // wxUtil.sendTextMessage(wxid, result, msgType, null);
// //
//} //}
@Async("threadPoolTaskExecutor") @Async("threadPoolTaskExecutor")
public void consume(WxMessage wxMessage) throws Exception { public void consume(WxMessage wxMessage) throws Exception {
//logger.info("接收到消息 : {}", wxMessage); //logger.info("接收到消息 : {}", wxMessage);
@@ -227,7 +218,7 @@ public class WxMessageConsumer {
* *
* @param wxMessage * @param wxMessage
*/ */
private void handlePrivateMessage(WxMessage wxMessage) throws Exception { private void handlePrivateMessage(WxMessage wxMessage) throws Exception {
logger.info("处理私聊消息: {}", JSON.toJSONString(wxMessage)); logger.info("处理私聊消息: {}", JSON.toJSONString(wxMessage));
WxMessage.DataSection data = wxMessage.getData(); WxMessage.DataSection data = wxMessage.getData();
@@ -261,8 +252,9 @@ private void handlePrivateMessage(WxMessage wxMessage) throws Exception {
} }
logger.info("未命中前置指令,开始命中 Default 流程"); logger.info("未命中前置指令,开始命中 Default 流程");
jdUtils.sendOrderToWxByOrderDefault(msg, fromWxid); jdUtils.sendOrderToWxByOrderDefault(msg, fromWxid);
} }
private void handleGroupMessage (WxMessage wxMessage) {
private void handleGroupMessage(WxMessage wxMessage) {
logger.info("处理群聊消息: {}", JSON.toJSONString(wxMessage)); logger.info("处理群聊消息: {}", JSON.toJSONString(wxMessage));
WxMessage.DataSection data = wxMessage.getData(); WxMessage.DataSection data = wxMessage.getData();
@@ -275,12 +267,18 @@ private void handlePrivateMessage(WxMessage wxMessage) throws Exception {
} }
String fromWxid = innerData.getFromWxid(); String fromWxid = innerData.getFromWxid();
if ( !chatRoomList.contains(fromWxid)) { String msg = innerData.getMsg();
if (chatRoom_WLM.equals(fromWxid)) {
logger.info("玩了买线报群消息");
jdUtils.cjwlm(msg);
return;
}
if (!chatRoomList.contains(fromWxid)) {
logger.info("不是白名单群聊,不处理"); logger.info("不是白名单群聊,不处理");
return; return;
} }
String msg = innerData.getMsg();
if (msg.startsWith("")) { if (msg.startsWith("")) {
logger.info("消息以拼开头,处理拼多多指令消息"); logger.info("消息以拼开头,处理拼多多指令消息");
jdUtils.sendOrderToWxByOrderPDD(msg.replace("", ""), fromWxid); jdUtils.sendOrderToWxByOrderPDD(msg.replace("", ""), fromWxid);