Skip to content

Commit 424a835

Browse files
committed
🎨 移除多余TicketType,移到common模块进行共享使用
1 parent 42d92c0 commit 424a835

File tree

16 files changed

+31
-64
lines changed

16 files changed

+31
-64
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/TicketType.java renamed to weixin-java-common/src/main/java/me/chanjar/weixin/common/enums/TicketType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cn.binarywang.wx.miniapp.constant;
1+
package me.chanjar.weixin.common.enums;
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
@@ -18,10 +18,15 @@ public enum TicketType {
1818
* jsapi
1919
*/
2020
JSAPI("jsapi"),
21+
/**
22+
* sdk
23+
*/
24+
SDK("2"),
2125
/**
2226
* 微信卡券
2327
*/
2428
WX_CARD("wx_card");
29+
2530
/**
2631
* type代码
2732
*/

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpServiceJoddHttpImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import jodd.http.HttpConnectionProvider;
44
import jodd.http.HttpRequest;
55
import jodd.http.HttpResponse;
6-
import jodd.http.JoddHttp;
76
import jodd.http.ProxyInfo;
7+
import jodd.http.net.SocketHttpConnectionProvider;
88
import me.chanjar.weixin.common.WxType;
99
import me.chanjar.weixin.common.bean.WxAccessToken;
1010
import me.chanjar.weixin.common.error.WxError;
@@ -68,7 +68,7 @@ public void initHttp() {
6868
configStorage.getHttpProxyPort(), configStorage.getHttpProxyUsername(), configStorage.getHttpProxyPassword());
6969
}
7070

71-
httpClient = JoddHttp.httpConnectionProvider;
71+
httpClient = new SocketHttpConnectionProvider();
7272
}
7373

7474
@Override

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpTpServiceImplTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void testGetPermanentCode() throws WxErrorException {
133133
assertThat(tpCorp.getPermanentCode()).isEqualTo("xxxx");
134134

135135
final WxCpTpPermanentCodeInfo tpPermanentCodeInfo = tpService.getPermanentCodeInfo(authCode);
136-
assertThat(tpPermanentCodeInfo.getAuthInfo().getAgent().get(0).getAgentid()).isEqualTo(1);
136+
assertThat(tpPermanentCodeInfo.getAuthInfo().getAgents().get(0).getAgentId()).isEqualTo(1);
137137

138138
}
139139

@@ -193,8 +193,8 @@ public void testGetPermanentCodeInfo() throws WxErrorException{
193193
jsonObject.addProperty("auth_code", authCode);
194194
doReturn(returnJson).when(tpService).post(configStorage.getApiUrl(GET_PERMANENT_CODE), jsonObject.toString());
195195
final WxCpTpPermanentCodeInfo tpPermanentCodeInfo = tpService.getPermanentCodeInfo(authCode);
196-
assertThat(tpPermanentCodeInfo.getAuthInfo().getAgent().get(0).getAgentid()).isEqualTo(1000012);
197-
assertNotNull(tpPermanentCodeInfo.getAuthInfo().getAgent().get(0).getSquareLogoUrl());
196+
assertThat(tpPermanentCodeInfo.getAuthInfo().getAgents().get(0).getAgentId()).isEqualTo(1000012);
197+
assertNotNull(tpPermanentCodeInfo.getAuthInfo().getAgents().get(0).getSquareLogoUrl());
198198
assertNotNull(tpPermanentCodeInfo.getAuthCorpInfo().getCorpSquareLogoUrl());
199199
}
200200

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/WxCpXmlMessageTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ public void testFromXml() {
7070
assertEquals(wxMessage.getMediaId(), "media_id");
7171
assertEquals(wxMessage.getFormat(), "Format");
7272
assertEquals(wxMessage.getThumbMediaId(), "thumb_media_id");
73-
assertEquals(wxMessage.getLocationX(), 23.134521d);
74-
assertEquals(wxMessage.getLocationY(), 113.358803d);
75-
assertEquals(wxMessage.getScale(), 20d);
73+
assertEquals(wxMessage.getLocationX().doubleValue(), 23.134521d);
74+
assertEquals(wxMessage.getLocationY().doubleValue(), 113.358803d);
75+
assertEquals(wxMessage.getScale().doubleValue(), 20d);
7676
assertEquals(wxMessage.getLabel(), "位置信息");
7777
assertEquals(wxMessage.getDescription(), "公众平台官网链接");
7878
assertEquals(wxMessage.getUrl(), "url");
7979
assertEquals(wxMessage.getTitle(), "公众平台官网链接");
8080
assertEquals(wxMessage.getEvent(), "subscribe");
8181
assertEquals(wxMessage.getEventKey(), "qrscene_123123");
8282
assertEquals(wxMessage.getTicket(), "TICKET");
83-
assertEquals(wxMessage.getLatitude(), 23.137466);
84-
assertEquals(wxMessage.getLongitude(), 113.352425);
85-
assertEquals(wxMessage.getPrecision(), 119.385040);
83+
assertEquals(wxMessage.getLatitude().doubleValue(), 23.137466);
84+
assertEquals(wxMessage.getLongitude().doubleValue(), 113.352425);
85+
assertEquals(wxMessage.getPrecision().doubleValue(), 119.385040);
8686
assertEquals(wxMessage.getScanCodeInfo().getScanType(), "qrcode");
8787
assertEquals(wxMessage.getScanCodeInfo().getScanResult(), "1");
8888
assertEquals(wxMessage.getSendPicsInfo().getCount(), new Long(1));

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisBetterConfigImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package cn.binarywang.wx.miniapp.config.impl;
22

3-
import cn.binarywang.wx.miniapp.constant.TicketType;
3+
import me.chanjar.weixin.common.enums.TicketType;
44
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
55
import me.chanjar.weixin.common.redis.WxRedisOps;
66
import redis.clients.jedis.JedisPool;

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedisConnectionConfigImpl.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.binarywang.wx.miniapp.config.impl;
22

3+
import lombok.RequiredArgsConstructor;
34
import redis.clients.jedis.Jedis;
45

56
/**
@@ -9,13 +10,9 @@
910
* 需要引入依赖<a href="https://github.com/abelaska/jedis-lock">jedis-lock</a>,才能使用该类。
1011
* </pre>
1112
*/
13+
@RequiredArgsConstructor
1214
public class WxMaRedisConnectionConfigImpl extends AbstractWxMaRedisConfig {
13-
14-
public WxMaRedisConnectionConfigImpl(Jedis jedis) {
15-
this.jedis = jedis;
16-
}
17-
18-
private Jedis jedis;
15+
private final Jedis jedis;
1916

2017
@Override
2118
protected Jedis getJedis() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
1414
import me.chanjar.weixin.mp.bean.result.WxMpUser;
1515
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
16-
import me.chanjar.weixin.mp.enums.TicketType;
16+
import me.chanjar.weixin.common.enums.TicketType;
1717
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
1818

1919
import java.util.Map;

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
2727
import me.chanjar.weixin.mp.bean.result.WxMpUser;
2828
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
29-
import me.chanjar.weixin.mp.enums.TicketType;
29+
import me.chanjar.weixin.common.enums.TicketType;
3030
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
3131
import me.chanjar.weixin.mp.util.WxMpConfigStorageHolder;
3232
import org.apache.commons.lang3.StringUtils;

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpCardServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import me.chanjar.weixin.mp.api.WxMpCardService;
1414
import me.chanjar.weixin.mp.api.WxMpService;
1515
import me.chanjar.weixin.mp.bean.card.*;
16-
import me.chanjar.weixin.mp.enums.TicketType;
16+
import me.chanjar.weixin.common.enums.TicketType;
1717
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
1818
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
1919
import org.apache.commons.codec.digest.DigestUtils;

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/config/WxMpConfigStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import me.chanjar.weixin.common.bean.WxAccessToken;
44
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
55
import me.chanjar.weixin.mp.bean.WxMpHostConfig;
6-
import me.chanjar.weixin.mp.enums.TicketType;
6+
import me.chanjar.weixin.common.enums.TicketType;
77

88
import java.io.File;
99
import java.util.concurrent.locks.Lock;

0 commit comments

Comments
 (0)