Skip to content

Commit 499b248

Browse files
author
liyi
committed
2.8.30
2 parents 646afc7 + bc44ef1 commit 499b248

7 files changed

Lines changed: 114 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ weixin-popular 已支持的微信平台
2626
<dependency>
2727
<groupId>com.github.liyiorg</groupId>
2828
<artifactId>weixin-popular</artifactId>
29-
<version>2.8.29</version>
29+
<version>2.8.30</version>
3030
</dependency>
3131
```
3232
* [升级注意事项](https://github.com/liyiorg/weixin-popular/wiki/jar_update)

‎changelog.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ WEIXIN-POPULAR CHANGELOG
22
===========================
33
https://github.com/liyiorg/weixin-popular
44

5+
Changes in version 2.8.30 (2019-12-11)
6+
-------------------------------------
7+
* #210 SecapiPayProfitsharingfinishResult 缺少JAXB注解
8+
# #220 WxaAPI 新增接口, 小程序审核撤回、小程序版本回退、生成临时小程序码接口
9+
510
Changes in version 2.8.29 (2019-10-29)
611
-------------------------------------
712
* #215 添加HttpClient 代理配置

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.github.liyiorg</groupId>
66
<artifactId>weixin-popular</artifactId>
7-
<version>2.8.29</version>
7+
<version>2.8.30</version>
88

99
<name>weixin-popular</name>
1010
<description>The weixin-popular is a JAVA SDK for weixin. Weixin web url is https://mp.weixin.qq.com.</description>

‎src/main/java/weixin/popular/Version.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
public interface Version {
44

5-
String VERSION = "2.8.29";
5+
String VERSION = "2.8.30";
66
}

‎src/main/java/weixin/popular/api/WxaAPI.java‎

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.io.IOException;
77
import java.io.InputStream;
88
import java.nio.charset.Charset;
9+
import java.nio.charset.StandardCharsets;
910

1011
import javax.imageio.ImageIO;
1112

@@ -273,6 +274,38 @@ public static BaseResult release(String access_token){
273274
.build();
274275
return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class);
275276
}
277+
278+
/**
279+
* 代码管理<br>
280+
* 小程序审核撤回(仅供第三方代小程序调用)
281+
* @since 2.8.30
282+
* @param access_token access_token
283+
* @return result
284+
*/
285+
public static BaseResult undocodeaudit(String access_token) {
286+
HttpUriRequest httpUriRequest = RequestBuilder.get()
287+
.setHeader(jsonHeader)
288+
.setUri(BASE_URI + "/wxa/undocodeaudit")
289+
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
290+
.build();
291+
return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class);
292+
}
293+
294+
/**
295+
* 代码管理<br>
296+
* 小程序版本回退(仅供第三方代小程序调用)
297+
* @since 2.8.30
298+
* @param access_token access_token
299+
* @return result
300+
*/
301+
public static BaseResult revertcoderelease(String access_token) {
302+
HttpUriRequest httpUriRequest = RequestBuilder.get()
303+
.setHeader(jsonHeader)
304+
.setUri(BASE_URI + "/wxa/revertcoderelease")
305+
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
306+
.build();
307+
return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class);
308+
}
276309

277310
/**
278311
* 代码管理<br>
@@ -364,7 +397,55 @@ public static BufferedImage getwxacodeunlimit(String access_token,Getwxacodeunli
364397
}
365398
return null;
366399
}
367-
400+
401+
/**
402+
* 获取小程序码 B<br>
403+
* 适用于需要的码数量极多,或仅临时使用的业务场景<br>
404+
* 注意:通过该接口生成的小程序码,永久有效,数量暂无限制。用户扫描该码进入小程序后,将统一打开首页,开发者需在首页根据获取的码中 scene 字段的值,再做处理逻辑。
405+
* @since 2.8.30
406+
* @param access_token access_token
407+
* @param getwxacodeunlimit getwxacodeunlimit
408+
* @return WxaCodeResult WxaCodeResult
409+
*/
410+
public static WxaCodeResult getwxacodeunlimitresult(String access_token,Getwxacodeunlimit getwxacodeunlimit){
411+
String json = JsonUtil.toJSONString(getwxacodeunlimit);
412+
HttpUriRequest httpUriRequest = RequestBuilder.post()
413+
.setHeader(jsonHeader)
414+
.setUri(BASE_URI + "/wxa/getwxacodeunlimit")
415+
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
416+
.setEntity(new StringEntity(json,Charset.forName("utf-8")))
417+
.build();
418+
CloseableHttpResponse httpResponse = LocalHttpClient.execute(httpUriRequest);
419+
try {
420+
int status = httpResponse.getStatusLine().getStatusCode();
421+
WxaCodeResult wxaCodeResult;
422+
byte[] bytes = null;
423+
if (status == 200) {
424+
bytes = EntityUtils.toByteArray(httpResponse.getEntity());
425+
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(bytes));
426+
if(bufferedImage != null) {
427+
wxaCodeResult = new WxaCodeResult();
428+
wxaCodeResult.setBufferedImage(bufferedImage);
429+
return wxaCodeResult;
430+
}
431+
}
432+
if (status >= 200 && status < 300 && bytes != null) {
433+
String str = new String(bytes, StandardCharsets.UTF_8);
434+
wxaCodeResult = JsonUtil.parseObject(str, WxaCodeResult.class);
435+
return wxaCodeResult;
436+
}
437+
} catch (IOException e) {
438+
logger.error("", e);
439+
} finally {
440+
try {
441+
httpResponse.close();
442+
} catch (IOException e) {
443+
logger.error("", e);
444+
}
445+
}
446+
return null;
447+
}
448+
368449
/**
369450
* 附近 添加地点
370451
* @since 2.8.18

‎src/main/java/weixin/popular/bean/paymch/SecapiPayProfitsharingfinishResult.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package weixin.popular.bean.paymch;
22

3+
import javax.xml.bind.annotation.XmlAccessType;
4+
import javax.xml.bind.annotation.XmlAccessorType;
5+
import javax.xml.bind.annotation.XmlRootElement;
6+
7+
@XmlRootElement(name = "xml")
8+
@XmlAccessorType(XmlAccessType.FIELD)
39
public class SecapiPayProfitsharingfinishResult extends MchBase {
410

511
private String transaction_id;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package weixin.popular.bean.wxa;
2+
3+
import weixin.popular.bean.BaseResult;
4+
5+
import java.awt.image.BufferedImage;
6+
7+
public class WxaCodeResult extends BaseResult {
8+
9+
private BufferedImage bufferedImage;
10+
11+
public BufferedImage getBufferedImage() {
12+
return bufferedImage;
13+
}
14+
15+
public void setBufferedImage(BufferedImage bufferedImage) {
16+
this.bufferedImage = bufferedImage;
17+
}
18+
}

0 commit comments

Comments
 (0)