예제 #1
0
  public static void DoXinqiu(WeixinRequest wr) {
    final String url = wr.getUrl();
    final String openId = wr.getOpenId();
    AsynTaskQueue.shared()
        .addTask(
            new Runnable() {
              @Override
              public void run() {
                try {
                  ArrayList<Article> articles = new ArrayList<Article>();

                  Article article = new Article();
                  article.setTitle("你是猫奴还是汪奴?");
                  article.setDescription("点击大图可以创建新的奴星球");
                  article.setPicUrl(url.replace(":80", "") + "/images/gou.jpg");
                  article.setUrl(url + "/CreateServlet?openId=" + openId);
                  articles.add(article);

                  // 点击奴星球
                  IGokitdogService service = new GokitdogServiceImpl();
                  ResponseList<Groups> list = service.getGroup(openId);

                  List<Groups> groups = list.getSuccess();

                  for (int i = 0; i < groups.size(); i++) {
                    String title = (i + 1) + "、" + groups.get(i).getGroupName() + "   点击查看大家的窝窝";

                    Article article1 = new Article();
                    article1.setTitle(title);
                    article1.setDescription(title);
                    article1.setPicUrl(url.replace(":80", "") + "/images/headPic.png");
                    article1.setUrl(
                        url
                            + "/XingqiuServlet?groupId="
                            + groups.get(i).getGroupId()
                            + "&openId="
                            + openId);
                    articles.add(article1);
                  }

                  SendCustomArticlesMsg(openId, articles);
                } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
            });
  }
예제 #2
0
  public static void DoQrCodeSan(WeixinRequest wr, BindingCallback listener) {
    IGokitdogService gokitSevice = new GokitdogServiceImpl();
    String qrCode = wr.getBody().get("xml.EventKey");
    if (qrCode.contains("qrscene")) {
      qrCode = qrCode.split("_")[1];
    }

    logger.info("qrCode is " + qrCode);

    UserBindingDevice data = new UserBindingDevice();
    data.setOpenId(wr.getOpenId());
    data.setQrCode(qrCode);

    data.setIsUsed(true);

    AsynTaskQueue.shared().addTask(new BindingThread(data, listener, wr));
  }