Java Code Examples for cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage#setToUser()

The following examples show how to use cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage#setToUser() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxTemplateSender.java    From BigDataPlatform with GNU General Public License v3.0 6 votes vote down vote up
private void sendMsg(String touser, String templatId, String[] parms, String page, String color,
                     String emphasisKeyword) {
    LitemallUserFormid userFormid = formIdService.queryByOpenId(touser);
    if (userFormid == null)
        return;


    WxMaTemplateMessage msg = new WxMaTemplateMessage();
    msg.setTemplateId(templatId);
    msg.setToUser(touser);
    msg.setFormId(userFormid.getFormid());
    msg.setPage(page);
    msg.setColor(color);
    msg.setEmphasisKeyword(emphasisKeyword);
    msg.setData(createMsgData(parms));

    try {
        wxMaService.getMsgService().sendTemplateMsg(msg);
        if (formIdService.updateUserFormId(userFormid) == 0) {
            logger.warn("更新数据已失效");
        }
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}
 
Example 2
Source File: WxTemplateSender.java    From dts-shop with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void sendMsg(String touser, String templatId, String[] parms, String page, String color,
		String emphasisKeyword) {
	DtsUserFormid userFormid = formIdService.queryByOpenId(touser);
	if (userFormid == null)
		return;

	WxMaTemplateMessage msg = new WxMaTemplateMessage();
	msg.setTemplateId(templatId);
	msg.setToUser(touser);
	msg.setFormId(userFormid.getFormid());
	msg.setPage(page);
	msg.setColor(color);
	msg.setEmphasisKeyword(emphasisKeyword);
	msg.setData(createMsgData(parms));

	try {
		wxMaService.getMsgService().sendTemplateMsg(msg);
		if (formIdService.updateUserFormId(userFormid) == 0) {
			logger.warn("更新数据已失效");
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 3
Source File: WxTemplateSender.java    From mall with MIT License 6 votes vote down vote up
private void sendMsg(String touser, String templatId, String[] parms, String page, String color, String emphasisKeyword) {
    LitemallUserFormid userFormid = formIdService.queryByOpenId(touser);
    if (userFormid == null)
        return;


    WxMaTemplateMessage msg = new WxMaTemplateMessage();
    msg.setTemplateId(templatId);
    msg.setToUser(touser);
    msg.setFormId(userFormid.getFormid());
    msg.setPage(page);
    msg.setColor(color);
    msg.setEmphasisKeyword(emphasisKeyword);
    msg.setData(createMsgData(parms));

    try {
        wxMaService.getMsgService().sendTemplateMsg(msg);
        if (formIdService.updateUserFormId(userFormid) == 0) {
            logger.warn("更新数据已失效");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}