mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-11-01 03:25:35 +08:00 
			
		
		
		
	添加删除门店的接口, for issue #17
This commit is contained in:
		| @ -36,11 +36,22 @@ public interface WxMpStoreService { | ||||
|    * 注:扩展字段为公共编辑信息(大家都可修改),修改将会审核,并决定是否对修改建议进行采纳,但不会影响该门店的生效可用状态。 | ||||
|    * 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | ||||
|    * </pre> | ||||
|    * @param poiId  门店poiId | ||||
|    * @param poiId  门店Id | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   WxMpStoreBaseInfo get(String poiId) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * <pre> | ||||
|    * 删除门店 | ||||
|    * 商户可以通过该接口,删除已经成功创建的门店。请商户慎重调用该接口。 | ||||
|    * 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | ||||
|    * </pre> | ||||
|    * @param poiId  门店Id | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   void delete(String poiId) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * <pre> | ||||
|    * 查询门店列表(指定查询起始位置和个数) | ||||
|  | ||||
| @ -57,6 +57,18 @@ public class WxMpStoreServiceImpl implements WxMpStoreService { | ||||
|         .get("business").getAsJsonObject().get("base_info").toString()); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public void delete(String poiId) throws WxErrorException { | ||||
|     String url = API_BASE_URL + "/delpoi"; | ||||
|     JsonObject paramObject = new JsonObject(); | ||||
|     paramObject.addProperty("poi_id",poiId); | ||||
|     String response = this.wxMpService.post(url, paramObject.toString()); | ||||
|     WxError wxError = WxError.fromJson(response); | ||||
|     if (wxError.getErrorCode() != 0) { | ||||
|       throw new WxErrorException(wxError); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   private void checkParameters(WxMpStoreBaseInfo request) { | ||||
|     List<String> nullFields = Lists.newArrayList(); | ||||
|     for (Entry<String, Reflect> entry : Reflect.on(request).fields() | ||||
|  | ||||
| @ -52,6 +52,10 @@ public class WxMpStoreServiceImplTest { | ||||
|     System.err.println(result); | ||||
|   } | ||||
|  | ||||
|   public void testDelete() throws WxErrorException { | ||||
|     this.wxMpService.getStoreService().delete("463558057"); | ||||
|   } | ||||
|  | ||||
|   public void testList() throws WxErrorException { | ||||
|     WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10); | ||||
|     assertNotNull(result); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 BinaryWang
					BinaryWang