记得上下班打卡 | git大法好,push需谨慎

Commit af4d4646 authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev_20211205' into dev_20211205

parents b9d767e7 06d38534
package com.liquidnet.service.sweet.config; package com.liquidnet.service.sweet.config;
import com.liquidnet.service.sweet.handler.StrawberryPosterHandler; import com.liquidnet.service.sweet.handler.*;
import com.liquidnet.service.sweet.handler.SubscribeHandler;
import com.liquidnet.service.sweet.handler.TextMsgHandler;
import com.liquidnet.service.sweet.handler.UnsubscribeHandler;
import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker; import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps; import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
...@@ -70,6 +67,8 @@ public class WechatMpConfigure { ...@@ -70,6 +67,8 @@ public class WechatMpConfigure {
private StrawberryPosterHandler posterHandler; private StrawberryPosterHandler posterHandler;
@Autowired @Autowired
private TextMsgHandler textMsgHandler; private TextMsgHandler textMsgHandler;
@Autowired
private TestMsgHandler testMsgHandler;
@PostConstruct @PostConstruct
public void init() { public void init() {
...@@ -153,6 +152,12 @@ public class WechatMpConfigure { ...@@ -153,6 +152,12 @@ public class WechatMpConfigure {
.handler(textMsgHandler) .handler(textMsgHandler)
.end(); .end();
// 测试
router.rule().async(false).msgType(WxConsts.XmlMsgType.TEXT)
.content("112233")
.handler(testMsgHandler)
.end();
return router; return router;
} }
} }
package com.liquidnet.service.sweet.handler;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* <p>
* 文本消息测试
* </p>
*
* @author jiangxiulong
* @since 2021-12-02
*/
@Component
@Slf4j
public class TestMsgHandler implements WxMpMessageHandler {
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService,
WxSessionManager sessionManager) throws WxErrorException {
return WxMpXmlOutMessage.TEXT().content("这是个测试啦啦啦")
.fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.build();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment