package cn.huge.module.wechat.miniapp.handler;
|
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
import cn.binarywang.wx.miniapp.bean.WxMaMessage;
|
import cn.binarywang.wx.miniapp.bean.WxMaTemplateData;
|
import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage;
|
import com.google.common.collect.Lists;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.session.WxSessionManager;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Map;
|
|
/**
|
* @title: 模板消息处理
|
* @description: 模板消息处理
|
* @company: hugeinfo
|
* @author: liyj
|
* @time: 2021/02/02
|
* @version: 1.0.0
|
**/
|
@Component
|
public class TemplateMsgMaHandler extends AbstractHandler {
|
@Override
|
public void handle(WxMaMessage wxMaMessage, Map<String, Object> map, WxMaService wxMaService, WxSessionManager wxSessionManager) throws WxErrorException {
|
wxMaService.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder()
|
.templateId("此处更换为自己的模板id")
|
.formId("自己替换可用的formid")
|
.data(Lists.newArrayList(
|
new WxMaTemplateData("keyword1", "339208499", "#173177")))
|
.toUser(wxMaMessage.getFromUser())
|
.build());
|
}
|
}
|
/**
|
* -------------------_ooOoo_-------------------
|
* ------------------o8888888o------------------
|
* ------------------88" . "88------------------
|
* ------------------(| -_- |)------------------
|
* ------------------O\ = /O------------------
|
* ---------------____/`---'\____---------------
|
* -------------.' \\| |// `.-------------
|
* ------------/ \\||| : |||// \------------
|
* -----------/ _||||| -:- |||||- \-----------
|
* -----------| | \\\ - /// | |-----------
|
* -----------| \_| ''\---/'' | |-----------
|
* -----------\ .-\__ `-` ___/-. /-----------
|
* ---------___`. .' /--.--\ `. . __----------
|
* ------."" '< `.___\_<|>_/___.' >'"".-------
|
* -----| | : `- \`.;`\ _ /`;.`/ - ` : | |-----
|
* -----\ \ `-. \_ __\ /__ _/ .-` / /-----
|
* ======`-.____`-.___\_____/___.-`____.-'======
|
* -------------------`=---='
|
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
* ---------佛祖保佑---hugeinfo---永无BUG----------
|
*/
|