录单
This commit is contained in:
@@ -1687,6 +1687,25 @@ public class JDUtil {
|
||||
|
||||
public void sendOrderToWxByOrderD(String order, String fromWxid) {
|
||||
|
||||
if (order.equals("单-1")) {
|
||||
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd "));
|
||||
String redisKey = "order_count:" + today;
|
||||
int count;
|
||||
|
||||
try {
|
||||
// 从 Redis 获取当前日期的订单计数器
|
||||
String s = redisTemplate.opsForValue().get(redisKey);
|
||||
count = s != null ? Integer.parseInt(s) : 0;
|
||||
if (count > 0) {
|
||||
redisTemplate.opsForValue().set(redisKey, String.valueOf(count - 1), 1, TimeUnit.DAYS);
|
||||
}
|
||||
wxUtil.sendTextMessage(fromWxid, "今日剩余单数:" + count, 1, fromWxid, false);
|
||||
} catch (Exception e) {
|
||||
logger.error("Redis操作失败: {}", e.getMessage(), e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (order == null || order.trim().isEmpty()) {
|
||||
wxUtil.sendTextMessage(fromWxid, "输入格式为:\n 单\n分销标记\n型号\n转链链接\n数量\n地址", 1, fromWxid, false);
|
||||
return;
|
||||
@@ -2223,7 +2242,7 @@ public class JDUtil {
|
||||
String modelNumber = parts[0].replace("\n", ""); // 型号
|
||||
String quantityStr = parts[1]; // 数量
|
||||
String address = "";
|
||||
for (int i = 2; i < parts.length; i++){
|
||||
for (int i = 2; i < parts.length; i++) {
|
||||
address += parts[i];
|
||||
}
|
||||
// 使用正则表达式提取中文字符
|
||||
|
||||
Reference in New Issue
Block a user