@@ -74,8 +74,7 @@ public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
7474 }
7575
7676 if (this .getWxMpService ().getWxMpConfigStorage ().isCardApiTicketExpired ()) {
77- String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=wx_card" ;
78- String responseContent = this .wxMpService .execute (SimpleGetRequestExecutor .create (this .getWxMpService ().getRequestHttp ()), url , null );
77+ String responseContent = this .wxMpService .execute (SimpleGetRequestExecutor .create (this .getWxMpService ().getRequestHttp ()), CARD_GET_TICKET , null );
7978 JsonElement tmpJsonElement = new JsonParser ().parse (responseContent );
8079 JsonObject tmpJsonObject = tmpJsonElement .getAsJsonObject ();
8180 String cardApiTicket = tmpJsonObject .get ("ticket" ).getAsString ();
@@ -129,10 +128,9 @@ public WxCardApiSignature createCardApiSignature(String... optionalSignParam) th
129128 */
130129 @ Override
131130 public String decryptCardCode (String encryptCode ) throws WxErrorException {
132- String url = "https://api.weixin.qq.com/card/code/decrypt" ;
133131 JsonObject param = new JsonObject ();
134132 param .addProperty ("encrypt_code" , encryptCode );
135- String responseContent = this .wxMpService .post (url , param .toString ());
133+ String responseContent = this .wxMpService .post (CARD_CODE_DECRYPT , param .toString ());
136134 JsonElement tmpJsonElement = new JsonParser ().parse (responseContent );
137135 JsonObject tmpJsonObject = tmpJsonElement .getAsJsonObject ();
138136 JsonPrimitive jsonPrimitive = tmpJsonObject .getAsJsonPrimitive ("code" );
@@ -149,12 +147,11 @@ public String decryptCardCode(String encryptCode) throws WxErrorException {
149147 */
150148 @ Override
151149 public WxMpCardResult queryCardCode (String cardId , String code , boolean checkConsume ) throws WxErrorException {
152- String url = "https://api.weixin.qq.com/card/code/get" ;
153150 JsonObject param = new JsonObject ();
154151 param .addProperty ("card_id" , cardId );
155152 param .addProperty ("code" , code );
156153 param .addProperty ("check_consume" , checkConsume );
157- String responseContent = this .wxMpService .post (url , param .toString ());
154+ String responseContent = this .wxMpService .post (CARD_CODE_GET , param .toString ());
158155 JsonElement tmpJsonElement = new JsonParser ().parse (responseContent );
159156 return WxMpGsonBuilder .INSTANCE .create ().fromJson (tmpJsonElement ,
160157 new TypeToken <WxMpCardResult >() {
@@ -183,15 +180,14 @@ public String consumeCardCode(String code) throws WxErrorException {
183180 */
184181 @ Override
185182 public String consumeCardCode (String code , String cardId ) throws WxErrorException {
186- String url = "https://api.weixin.qq.com/card/code/consume" ;
187183 JsonObject param = new JsonObject ();
188184 param .addProperty ("code" , code );
189185
190186 if (cardId != null && !"" .equals (cardId )) {
191187 param .addProperty ("card_id" , cardId );
192188 }
193189
194- return this .wxMpService .post (url , param .toString ());
190+ return this .wxMpService .post (CARD_CODE_CONSUME , param .toString ());
195191 }
196192
197193 /**
@@ -207,13 +203,12 @@ public String consumeCardCode(String code, String cardId) throws WxErrorExceptio
207203 @ Override
208204 public void markCardCode (String code , String cardId , String openId , boolean isMark ) throws
209205 WxErrorException {
210- String url = "https://api.weixin.qq.com/card/code/mark" ;
211206 JsonObject param = new JsonObject ();
212207 param .addProperty ("code" , code );
213208 param .addProperty ("card_id" , cardId );
214209 param .addProperty ("openid" , openId );
215210 param .addProperty ("is_mark" , isMark );
216- String responseContent = this .getWxMpService ().post (url , param .toString ());
211+ String responseContent = this .getWxMpService ().post (CARD_CODE_MARK , param .toString ());
217212 JsonElement tmpJsonElement = new JsonParser ().parse (responseContent );
218213 WxMpCardResult cardResult = WxMpGsonBuilder .INSTANCE .create ().fromJson (tmpJsonElement ,
219214 new TypeToken <WxMpCardResult >() {
@@ -225,10 +220,9 @@ public void markCardCode(String code, String cardId, String openId, boolean isMa
225220
226221 @ Override
227222 public String getCardDetail (String cardId ) throws WxErrorException {
228- String url = "https://api.weixin.qq.com/card/get" ;
229223 JsonObject param = new JsonObject ();
230224 param .addProperty ("card_id" , cardId );
231- String responseContent = this .wxMpService .post (url , param .toString ());
225+ String responseContent = this .wxMpService .post (CARD_GET , param .toString ());
232226
233227 // 判断返回值
234228 JsonObject json = (new JsonParser ()).parse (responseContent ).getAsJsonObject ();
0 commit comments