Skip to content

Commit 6f3dfc7

Browse files
committed
Merge branch 'develop'
2 parents e84ca8d + 669552e commit 6f3dfc7

File tree

10 files changed

+40
-13
lines changed

10 files changed

+40
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ weixin-java-tools
1717
<dependency>
1818
<groupId>me.chanjar</groupId>
1919
<artifactId>weixin-java-mp</artifactId>
20-
<version>1.1.3</version>
20+
<version>1.1.4</version>
2121
</dependency>
2222
```
2323

@@ -27,7 +27,7 @@ weixin-java-tools
2727
<dependency>
2828
<groupId>me.chanjar</groupId>
2929
<artifactId>weixin-java-cp</artifactId>
30-
<version>1.1.3</version>
30+
<version>1.1.4</version>
3131
</dependency>
3232
```
3333

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>me.chanjar</groupId>
77
<artifactId>weixin-java-parent</artifactId>
8-
<version>1.1.3</version>
8+
<version>1.1.4</version>
99
<packaging>pom</packaging>
1010
<name>WeiXin Java Tools - Parent</name>
1111
<description>微信公众号、企业号上级POM</description>

weixin-java-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>me.chanjar</groupId>
88
<artifactId>weixin-java-parent</artifactId>
9-
<version>1.1.3</version>
9+
<version>1.1.4</version>
1010
</parent>
1111

1212
<artifactId>weixin-java-common</artifactId>

weixin-java-cp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>me.chanjar</groupId>
88
<artifactId>weixin-java-parent</artifactId>
9-
<version>1.1.3</version>
9+
<version>1.1.4</version>
1010
</parent>
1111

1212
<artifactId>weixin-java-cp</artifactId>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.google.gson.internal.Streams;
88
import com.google.gson.reflect.TypeToken;
99
import com.google.gson.stream.JsonReader;
10+
import com.sun.media.sound.SoftTuning;
1011
import me.chanjar.weixin.common.bean.WxAccessToken;
1112
import me.chanjar.weixin.common.bean.WxJsapiSignature;
1213
import me.chanjar.weixin.common.bean.WxMenu;
@@ -46,6 +47,7 @@
4647
import java.io.IOException;
4748
import java.io.InputStream;
4849
import java.io.StringReader;
50+
import java.math.BigDecimal;
4951
import java.security.NoSuchAlgorithmException;
5052
import java.util.List;
5153
import java.util.UUID;
@@ -445,7 +447,7 @@ public String oauth2buildAuthorizationUrl(String redirectUri, String state) {
445447

446448
@Override
447449
public String[] oauth2getUserInfo(String code) throws WxErrorException {
448-
return oauth2getUserInfo(code, wxCpConfigStorage.getAgentId());
450+
return oauth2getUserInfo(wxCpConfigStorage.getAgentId(), code);
449451
}
450452

451453
@Override
@@ -626,4 +628,12 @@ public void setSessionManager(WxSessionManager sessionManager) {
626628
this.sessionManager = sessionManager;
627629
}
628630

631+
public static void main(String[] args) {
632+
Float a = 3.1f;
633+
System.out.println(3.1d);
634+
System.out.println(new BigDecimal(3.1d));
635+
System.out.println(new BigDecimal(a));
636+
System.out.println(a.toString());
637+
System.out.println(a.doubleValue());
638+
}
629639
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/util/json/WxCpMessageGsonAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public JsonElement serialize(WxCpMessage message, Type typeOfSrc, JsonSerializat
3434
messageJson.addProperty("toparty", message.getToParty());
3535
}
3636
if (StringUtils.isNotBlank(message.getToTag())) {
37-
messageJson.addProperty("totag", message.getToUser());
37+
messageJson.addProperty("totag", message.getToTag());
3838
}
3939
if (WxConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
4040
JsonObject text = new JsonObject();

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/util/json/WxCpTagGsonAdapter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
*/
2020
public class WxCpTagGsonAdapter implements JsonSerializer<WxCpTag>, JsonDeserializer<WxCpTag> {
2121

22-
public JsonElement serialize(WxCpTag group, Type typeOfSrc, JsonSerializationContext context) {
22+
public JsonElement serialize(WxCpTag tag, Type typeOfSrc, JsonSerializationContext context) {
2323
JsonObject o = new JsonObject();
24-
o.addProperty("tagid", group.getId());
25-
o.addProperty("tagname", group.getName());
24+
o.addProperty("tagid", tag.getId());
25+
o.addProperty("tagname", tag.getName());
2626
return o;
2727
}
2828

2929
public WxCpTag deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
3030
throws JsonParseException {
3131
JsonObject jsonObject = json.getAsJsonObject();
32-
return new WxCpTag(GsonHelper.getString(jsonObject, "tagid"), GsonHelper.getString(jsonObject, "name"));
32+
return new WxCpTag(GsonHelper.getString(jsonObject, "tagid"), GsonHelper.getString(jsonObject, "tagname"));
3333
}
3434

3535
}

weixin-java-mp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>me.chanjar</groupId>
88
<artifactId>weixin-java-parent</artifactId>
9-
<version>1.1.3</version>
9+
<version>1.1.4</version>
1010
</parent>
1111
<artifactId>weixin-java-mp</artifactId>
1212
<name>WeiXin Java Tools - MP</name>

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,18 @@ public interface WxMpService {
387387
*/
388388
public String oauth2buildAuthorizationUrl(String scope, String state);
389389

390+
/**
391+
* <pre>
392+
* 构造oauth2授权的url连接
393+
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
394+
* </pre>
395+
* @param redirectURI
396+
* 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encode
397+
* @param scope
398+
* @param state
399+
* @return code
400+
*/
401+
public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state);
390402
/**
391403
* <pre>
392404
* 用code换取oauth2的access token

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpServiceImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,14 @@ public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) th
363363

364364
@Override
365365
public String oauth2buildAuthorizationUrl(String scope, String state) {
366+
return this.oauth2buildAuthorizationUrl(wxMpConfigStorage.getOauth2redirectUri(), scope, state);
367+
}
368+
369+
@Override
370+
public String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state) {
366371
String url = "https://open.weixin.qq.com/connect/oauth2/authorize?" ;
367372
url += "appid=" + wxMpConfigStorage.getAppId();
368-
url += "&redirect_uri=" + URIUtil.encodeURIComponent(wxMpConfigStorage.getOauth2redirectUri());
373+
url += "&redirect_uri=" + URIUtil.encodeURIComponent(redirectURI);
369374
url += "&response_type=code";
370375
url += "&scope=" + scope;
371376
if (state != null) {

0 commit comments

Comments
 (0)