只保留开通礼金的流程
This commit is contained in:
@@ -894,36 +894,41 @@ public class JDUtil {
|
||||
*/
|
||||
private void handleGiftMoneyConfirmation(String wxid, String message, UserInteractionState state) {
|
||||
try {
|
||||
String cachedData = cacheMap.get("productData" + wxid);
|
||||
JSONArray jsonObjectArr = JSON.parseArray(cachedData);
|
||||
|
||||
if ("1".equals(message)) {
|
||||
// 用户选择开通礼金
|
||||
state.setCurrentState(UserInteractionState.ProcessState.GIFT_MONEY_FLOW);
|
||||
state.setCurrentStep(UserInteractionState.GiftMoneyStep.STEP_AMOUNT);
|
||||
state.getCollectedFields().clear();
|
||||
|
||||
wxUtil.sendTextMessage(wxid, "当前选择" + state.getSelectedSkuIds().size() + "个商品\n" + "请输入开通金额(1-50元,支持小数点后两位):\n" + "示例:20.50", 1, wxid, false);
|
||||
wxUtil.sendTextMessage(wxid, "当前选择" + jsonObjectArr.size() + "个商品\n" + "请输入开通金额(1-50元,支持小数点后两位):\n" + "示例:20.50", 1, wxid, false);
|
||||
} else if ("2".equals(message)) {
|
||||
// 用户选择不开通礼金
|
||||
String cachedData = cacheMap.get("productData" + wxid);
|
||||
if (cachedData != null) {
|
||||
JSONObject productInfo = JSON.parseObject(cachedData);
|
||||
String skuUrl = productInfo.getString("materialUrl");
|
||||
String transferUrl = transfer(skuUrl, null);
|
||||
String finalWenAn = cacheMap.get("finalWenAn" + wxid);
|
||||
|
||||
finalWenAn = (finalWenAn.replace(productInfo.getString("url"), transferUrl));
|
||||
wxUtil.sendTextMessage(wxid, "不开礼金,只转链的方案:\n", 1, wxid, false);
|
||||
wxUtil.sendTextMessage(wxid, finalWenAn, 1, wxid, true);
|
||||
} else {
|
||||
wxUtil.sendTextMessage(wxid, "未找到商品信息,请重新开始流程", 1, wxid, false);
|
||||
}
|
||||
//if (cachedData != null) {
|
||||
// JSONObject productInfo = JSON.parseObject(cachedData);
|
||||
// String skuUrl = productInfo.getString("materialUrl");
|
||||
// String transferUrl = transfer(skuUrl, null);
|
||||
// String finalWenAn = cacheMap.get("finalWenAn" + wxid);
|
||||
//
|
||||
// finalWenAn = (finalWenAn.replace(productInfo.getString("url"), transferUrl));
|
||||
// wxUtil.sendTextMessage(wxid, "不开礼金,只转链的方案:\n", 1, wxid, false);
|
||||
// wxUtil.sendTextMessage(wxid, finalWenAn, 1, wxid, true);
|
||||
//} else {
|
||||
// wxUtil.sendTextMessage(wxid, "未找到商品信息,请重新开始流程", 1, wxid, false);
|
||||
//}
|
||||
state.reset();
|
||||
cacheMap.remove("productData" + wxid);
|
||||
cacheMap.remove("finalWenAn" + wxid);
|
||||
wxUtil.sendTextMessage(wxid, "已清除商品信息缓存,可输入新的文案", 1, wxid, false);
|
||||
// 进入输入方案流程
|
||||
state.setCurrentState(UserInteractionState.ProcessState.INIT);
|
||||
state.setCurrentField("content");
|
||||
|
||||
|
||||
} else {
|
||||
// 无效输入
|
||||
wxUtil.sendTextMessage(wxid, "请输入有效选项:\n" + "回复 1 - 开通礼金\n" + "回复 2 - 直接转链", 1, wxid, false);
|
||||
wxUtil.sendTextMessage(wxid, "处理请求时发生异常,请重试", 1, wxid, false);
|
||||
state.reset();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("处理礼金确认异常 - 用户: {}", wxid, e);
|
||||
|
||||
Reference in New Issue
Block a user