国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

wx-tools 消息相關(guān)API

2023-03-22 17:20 更新

包括如下接口:
- sendAllByTag - 群發(fā)-通過(guò)標(biāo)簽
- sendAllByOpenid - 群發(fā)-通過(guò)openid
- sendAllPreview - 群發(fā)預(yù)覽
- sendAllDelete - 刪除群發(fā)
- sendAllGetStatus - 查詢?nèi)喊l(fā)狀態(tài)
- templateSetIndustry - 設(shè)置模板行業(yè)
- templateGetIndustry - 查詢模板行業(yè)
- templateGetId - 獲取模板ID
- templateGetList - 獲取模板列表
- templateDelete - 刪除模板
- templateSend - 發(fā)送模板

3.4.1 sendAllByTag 通過(guò)用戶標(biāo)簽來(lái)群發(fā)

    WxTagSender sender = new WxTagSender();
    //設(shè)置哪些組需要接受群發(fā)
    sender.setFilter(new SenderFilter(true, 1));
    //群發(fā)文本內(nèi)容
    sender.setText(new Text("文本內(nèi)容"));
    try {
        SenderResult result = iService.sendAllByTag(sender);
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

如果發(fā)其他類(lèi)型的消息:

    //群發(fā)圖片,以此類(lèi)推
    sender.setImage(new Media("media_id"));

3.4.2 sendAllByOpenid 針對(duì)某群人的openid群發(fā)

    WxOpenidSender sender = new WxOpenidSender();
    List<String> openidList = new ArrayList<>();
    openidList.add("openid1");
    openidList.add("openid2");
    sender.setTouser(openidList);
    //群發(fā)文本內(nèi)容
    sender.setText(new Text("文本內(nèi)容"));
    try {
        SenderResult result = iService.sendAllByOpenid(sender);
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.3 sendAllPreview 群發(fā)預(yù)覽

    PreviewSender sender = new PreviewSender();
    //設(shè)置openid或者微信號(hào),優(yōu)先級(jí)為wxname高
    sender.setTouser("openid");
    sender.setTowxname("微信號(hào)");
    //群發(fā)文本內(nèi)容
    sender.setText(new Text("文本內(nèi)容"));
    try {
        SenderResult result = iService.sendAllPreview(sender);
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.4 sendAllDelete 刪除群發(fā)

    try {
        //msg_id參數(shù)在群發(fā)接口中返回
        SenderResult result = iService.sendAllDelete("msg_id");
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.5 sendAllGetStatus 獲取群發(fā)狀態(tài)

    try {
        SenderResult result = iService.sendAllGetStatus("msg_id");
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.6 templateSetIndustry 設(shè)置模板消息的行業(yè)

    //行業(yè)代碼參考官方文檔。
    try {
        iService.templateSetIndustry("1", "4");
    } catch (WxErrorException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

3.4.7 templateGetIndustry獲取模板消息的行業(yè)設(shè)置

    try {
        IndustryResult result = iService.templateGetIndustry();
        System.out.println(result.getPrimary_industry());
        System.out.println(result.getSecondary_industry());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.8 templateGetId通過(guò)短ID獲取模板ID

    //模板庫(kù)中模板的編號(hào),有“TM**”和“OPENTMTM**”等形式
    try {
        TemplateResult result = iService.templateGetId("template_id_short");
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.9 templateGetList 獲取模板列表

    try {
        TemplateListResult result = iService.templateGetList();
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.10 templateDelete 刪除模板

    try {
        iService.templateDelete("template_id");
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

3.4.11 templateSend 模板消息發(fā)送

    TemplateSender sender = new TemplateSender();
    sender.setTouser("openid");
    sender.setTemplate_id("templateId");
    sender.setData("Object:與模板內(nèi)容對(duì)應(yīng)的對(duì)象");
    sender.setUrl("url");
    try {
        TemplateSenderResult result = iService.templateSend(sender);
        System.out.println(result.toString());
    } catch (WxErrorException e) {
        e.printStackTrace();
    }

參數(shù)說(shuō)明:

  • openid需要發(fā)送給哪個(gè)用戶
  • templateId 模板ID
  • Data: 假設(shè)模板格式中有三個(gè)字段,分別為:

    • first.DATA
    • keyword1.DATA
    • remark.DATA

    那么就需要?jiǎng)?chuàng)建一個(gè)類(lèi), 里面包含三個(gè)成員變量.如:

    public class Template{
    private String first;
    private String keyword1;
    private String remark;
    }

  • Url 點(diǎn)擊模板消息時(shí)跳轉(zhuǎn)的頁(yè)面.
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)