录单
This commit is contained in:
@@ -1687,6 +1687,25 @@ public class JDUtil {
|
|||||||
|
|
||||||
public void sendOrderToWxByOrderD(String order, String fromWxid) {
|
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()) {
|
if (order == null || order.trim().isEmpty()) {
|
||||||
wxUtil.sendTextMessage(fromWxid, "输入格式为:\n 单\n分销标记\n型号\n转链链接\n数量\n地址", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "输入格式为:\n 单\n分销标记\n型号\n转链链接\n数量\n地址", 1, fromWxid, false);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user