超时退出
This commit is contained in:
@@ -919,23 +919,42 @@ public class JDUtil {
|
|||||||
} else if ("2".equals(message)) {
|
} else if ("2".equals(message)) {
|
||||||
// 用户选择不开通礼金
|
// 用户选择不开通礼金
|
||||||
if (cachedData != null) {
|
if (cachedData != null) {
|
||||||
JSONObject productInfo = JSON.parseObject(cachedData);
|
try {
|
||||||
String skuUrl = productInfo.getString("materialUrl");
|
JSONArray dataArray = JSON.parseArray(cachedData); // 支持多个商品
|
||||||
String transferUrl = transfer(skuUrl, null);
|
String finalWenAn = cacheMap.get("finalWenAn" + wxid);
|
||||||
String finalWenAn = cacheMap.get("finalWenAn" + wxid);
|
if (finalWenAn == null) {
|
||||||
|
wxUtil.sendTextMessage(wxid, "文案内容为空,请检查缓存数据", 1, wxid, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
finalWenAn = (finalWenAn.replace(productInfo.getString("url"), transferUrl));
|
StringBuilder allTransferUrls = new StringBuilder();
|
||||||
wxUtil.sendTextMessage(wxid, "不开礼金,只转链的方案:\n", 1, wxid, false);
|
for (Object obj : dataArray) {
|
||||||
wxUtil.sendTextMessage(wxid, finalWenAn, 1, wxid, true);
|
JSONObject productInfo = (JSONObject) obj;
|
||||||
|
String skuUrl = productInfo.getString("materialUrl");
|
||||||
|
String originalUrl = productInfo.getString("url");
|
||||||
|
|
||||||
|
String transferUrl = transfer(skuUrl, null);
|
||||||
|
if (transferUrl != null) {
|
||||||
|
finalWenAn = finalWenAn.replace(originalUrl, transferUrl);
|
||||||
|
allTransferUrls.append(transferUrl).append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxUtil.sendTextMessage(wxid, "不开礼金,只转链的方案:\n", 1, wxid, false);
|
||||||
|
wxUtil.sendTextMessage(wxid, finalWenAn, 1, wxid, true);
|
||||||
|
|
||||||
|
// 清理缓存和状态
|
||||||
|
resetState(wxid, state);
|
||||||
|
cacheMap.remove("productData" + wxid);
|
||||||
|
cacheMap.remove("finalWenAn" + wxid);
|
||||||
|
wxUtil.sendTextMessage(wxid, "已清除商品信息缓存,可输入新的文案", 1, wxid, false);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("处理不开礼金转链失败 - 用户: {}", wxid, e);
|
||||||
|
wxUtil.sendTextMessage(wxid, "处理失败:" + e.getMessage(), 1, wxid, false);
|
||||||
|
resetState(wxid, state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
state.reset();
|
|
||||||
cacheMap.remove("productData" + wxid);
|
|
||||||
cacheMap.remove("finalWenAn" + wxid);
|
|
||||||
wxUtil.sendTextMessage(wxid, "已清除商品信息缓存,可输入新的文案", 1, wxid, false);
|
|
||||||
// 进入输入方案流程
|
|
||||||
state.setCurrentState(INIT);
|
|
||||||
state.setCurrentField("content");
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wxUtil.sendTextMessage(wxid, "处理请求时发生异常,请重试", 1, wxid, false);
|
wxUtil.sendTextMessage(wxid, "处理请求时发生异常,请重试", 1, wxid, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user