@Test(dataProvider = "sceneIds") public void testQrCodeCreateLastTicket(int sceneId) throws WxErrorException { WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(sceneId); Assert.assertNotNull(ticket.getUrl()); Assert.assertNotNull(ticket.getTicket()); Assert.assertTrue(ticket.getExpireSeconds() == -1); System.out.println(ticket); }
@Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.builder().errorCode(-1) .errorMsg("永久二维码的场景值目前只支持1--100000！") .build()); } String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); json.addProperty("action_name", "QR_LIMIT_SCENE"); JsonObject actionInfo = new JsonObject(); JsonObject scene = new JsonObject(); scene.addProperty("scene_id", sceneId); actionInfo.add("scene", scene); json.add("action_info", actionInfo); String responseContent = this.wxMpService.post(url, json.toString()); return WxMpQrCodeTicket.fromJson(responseContent); }
WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.builder().errorCode(-1) .errorMsg("永久二维码的场景值目前只支持1--100000！") .build()); } String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); json.addProperty("action_name", "QR_LIMIT_SCENE"); JsonObject actionInfo = new JsonObject(); JsonObject scene = new JsonObject(); scene.addProperty("scene_id", sceneId); actionInfo.add("scene", scene); json.add("action_info", actionInfo); String responseContent = this.wxMpService.post(url, json.toString()); return WxMpQrCodeTicket.fromJson(responseContent); } }
WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.builder().errorCode(-1) .errorMsg("永久二维码的场景值目前只支持1--100000！") .build()); } String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); json.addProperty("action_name", "QR_LIMIT_SCENE"); JsonObject actionInfo = new JsonObject(); JsonObject scene = new JsonObject(); scene.addProperty("scene_id", sceneId); actionInfo.add("scene", scene); json.add("action_info", actionInfo); String responseContent = this.wxMpService.post(url, json.toString()); return WxMpQrCodeTicket.fromJson(responseContent); } WxMpQrcodeServiceImpl(WxMpService wxMpService); }
WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.builder().errorCode(-1) .errorMsg("永久二维码的场景值目前只支持1--100000！") .build()); } String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); json.addProperty("action_name", "QR_LIMIT_SCENE"); JsonObject actionInfo = new JsonObject(); JsonObject scene = new JsonObject(); scene.addProperty("scene_id", sceneId); actionInfo.add("scene", scene); json.add("action_info", actionInfo); String responseContent = this.wxMpService.post(url, json.toString()); return WxMpQrCodeTicket.fromJson(responseContent); } WxMpQrcodeServiceImpl(WxMpService wxMpService); @Override WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds); @Override WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds); @Override WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId); @Override WxMpQrCodeTicket qrCodeCreateLastTicket(String sceneStr); @Override File qrCodePicture(WxMpQrCodeTicket ticket); @Override String qrCodePictureUrl(String ticket, boolean needShortUrl); @Override String qrCodePictureUrl(String ticket); }
WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.builder().errorCode(-1) .errorMsg("永久二维码的场景值目前只支持1--100000！") .build()); } String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); json.addProperty("action_name", "QR_LIMIT_SCENE"); JsonObject actionInfo = new JsonObject(); JsonObject scene = new JsonObject(); scene.addProperty("scene_id", sceneId); actionInfo.add("scene", scene); json.add("action_info", actionInfo); String responseContent = this.wxMpService.post(url, json.toString()); return WxMpQrCodeTicket.fromJson(responseContent); } WxMpQrcodeServiceImpl(WxMpService wxMpService); @Override WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds); @Override WxMpQrCodeTicket qrCodeCreateTmpTicket(String sceneStr, Integer expireSeconds); @Override WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId); @Override WxMpQrCodeTicket qrCodeCreateLastTicket(String sceneStr); @Override File qrCodePicture(WxMpQrCodeTicket ticket); @Override String qrCodePictureUrl(String ticket, boolean needShortUrl); @Override String qrCodePictureUrl(String ticket);  }