11package me .chanjar .weixin .mp .api ;
22
3- import com .google .gson .Gson ;
43import com .google .gson .JsonArray ;
54import com .google .gson .JsonElement ;
65import com .google .gson .JsonObject ;
2423import me .chanjar .weixin .common .util .fs .FileUtils ;
2524import me .chanjar .weixin .common .util .http .*;
2625import me .chanjar .weixin .common .util .json .GsonHelper ;
26+ import me .chanjar .weixin .common .util .json .WxGsonBuilder ;
2727import me .chanjar .weixin .common .util .xml .XStreamInitializer ;
2828import me .chanjar .weixin .mp .bean .*;
2929import me .chanjar .weixin .mp .bean .result .*;
@@ -275,11 +275,11 @@ public WxMpMaterialCountResult materialCount() throws WxErrorException {
275275
276276 public WxMpMaterialNewsBatchGetResult materialNewsBatchGet (int offset , int count ) throws WxErrorException {
277277 String url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material" ;
278- Map <String , Object > params = new HashMap <String , Object >();
278+ Map <String , Object > params = new HashMap <>();
279279 params .put ("type" , WxConsts .MATERIAL_NEWS );
280280 params .put ("offset" , offset );
281281 params .put ("count" , count );
282- String responseText = post (url , new Gson ().toJson (params ));
282+ String responseText = post (url , WxGsonBuilder . create ().toJson (params ));
283283 WxError wxError = WxError .fromJson (responseText );
284284 if (wxError .getErrorCode () == 0 ) {
285285 return WxMpGsonBuilder .create ().fromJson (responseText , WxMpMaterialNewsBatchGetResult .class );
@@ -290,11 +290,11 @@ public WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count
290290
291291 public WxMpMaterialFileBatchGetResult materialFileBatchGet (String type , int offset , int count ) throws WxErrorException {
292292 String url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material" ;
293- Map <String , Object > params = new HashMap <String , Object >();
293+ Map <String , Object > params = new HashMap <>();
294294 params .put ("type" , type );
295295 params .put ("offset" , offset );
296296 params .put ("count" , count );
297- String responseText = post (url , new Gson ().toJson (params ));
297+ String responseText = post (url , WxGsonBuilder . create ().toJson (params ));
298298 WxError wxError = WxError .fromJson (responseText );
299299 if (wxError .getErrorCode () == 0 ) {
300300 return WxMpGsonBuilder .create ().fromJson (responseText , WxMpMaterialFileBatchGetResult .class );
0 commit comments