重构评论
This commit is contained in:
@@ -1646,15 +1646,6 @@ public class JDUtil {
|
||||
logger.info("loadOrCreateState - 用户: {}, 状态: {}", fromWxid, state);
|
||||
|
||||
try {
|
||||
// 设置当前状态为生成评论流程
|
||||
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
||||
state.setCurrentField("commentTypeSelection");
|
||||
// 提示用户选择评论类型
|
||||
getProductTypeMap();
|
||||
if (productTypeMap == null) {
|
||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||
return;
|
||||
}
|
||||
StringBuilder productTypeStr = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : productTypeMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
@@ -1672,6 +1663,15 @@ public class JDUtil {
|
||||
saveState(key, state);
|
||||
}
|
||||
} else {
|
||||
// 初始化用户交互状态
|
||||
String key = INTERACTION_STATE_PREFIX + fromWxid;
|
||||
state = loadOrCreateState(key);
|
||||
logger.info("loadOrCreateState - 用户: {}, 状态: {}", fromWxid, state);
|
||||
// 设置当前状态为生成评论流程
|
||||
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
||||
state.setCurrentField("commentTypeSelection");
|
||||
saveState(key, state);
|
||||
|
||||
// 如果未命中“评”指令,检查是否在生成评论流程中
|
||||
handleCommentInteraction(fromWxid, order, state);
|
||||
}
|
||||
@@ -1700,9 +1700,9 @@ public class JDUtil {
|
||||
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {}, 状态: {},message: {}", fromWxid, state, message);
|
||||
try {
|
||||
// 检查当前状态是否为生成评论流程
|
||||
if (!"commentTypeSelection".equals(state.getCurrentField())) {
|
||||
return;
|
||||
}
|
||||
//if (!"commentTypeSelection".equals(state.getCurrentField())) {
|
||||
// return;
|
||||
//}
|
||||
getProductTypeMap();
|
||||
if (productTypeMap == null) {
|
||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||
|
||||
Reference in New Issue
Block a user