mp:优化前端消息发送的缓存逻辑

This commit is contained in:
YunaiV
2023-01-12 20:25:00 +08:00
parent 7ba6a2e385
commit 858b4e81a5
4 changed files with 59 additions and 36 deletions

View File

@ -34,6 +34,9 @@ public interface ErrorCodeConstants {
// ========== 公众号素材 1006004000============
ErrorCode MATERIAL_UPLOAD_FAIL = new ErrorCode(1006004000, "上传素材失败,原因:{}");
// ========== 公众号素材 1006005000============
ErrorCode MESSAGE_SEND_FAIL = new ErrorCode(1006005000, "发送消息失败,原因:{}");
// TODO 要处理下
ErrorCode MENU_NOT_EXISTS = new ErrorCode(1006001002, "菜单不存在");

View File

@ -31,6 +31,9 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import javax.validation.Validator;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.mp.enums.ErrorCodeConstants.MESSAGE_SEND_FAIL;
/**
* 粉丝消息表 Service 实现类
*
@ -115,7 +118,7 @@ public class MpMessageServiceImpl implements MpMessageService {
try {
mpService.getKefuService().sendKefuMessageWithResponse(wxMessage);
} catch (WxErrorException e) {
throw new RuntimeException(e);
throw exception(MESSAGE_SEND_FAIL, e.getError().getErrorMsg());
}
// 记录消息