| @@ -27,7 +27,6 @@ public interface WxMpStoreService { | |||||
| */ | */ | ||||
| void add(WxMpStoreBaseInfo request) throws WxErrorException; | void add(WxMpStoreBaseInfo request) throws WxErrorException; | ||||
| /** | /** | ||||
| * <pre> | * <pre> | ||||
| * 查询门店信息 | * 查询门店信息 | ||||
| @@ -63,4 +62,15 @@ public interface WxMpStoreService { | |||||
| * @throws WxErrorException | * @throws WxErrorException | ||||
| */ | */ | ||||
| List<WxMpStoreInfo> listAll() throws WxErrorException; | List<WxMpStoreInfo> listAll() throws WxErrorException; | ||||
| /** | |||||
| * <pre> | |||||
| * 修改门店服务信息 | |||||
| * 商户可以通过该接口,修改门店的服务信息,包括:sid、图片列表、营业时间、推荐、特色服务、简介、人均价格、电话8个字段(名称、坐标、地址等不可修改)修改后需要人工审核。 | |||||
| * 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | |||||
| * </pre> | |||||
| * @throws WxErrorException | |||||
| */ | |||||
| void update(WxMpStoreBaseInfo info) throws WxErrorException; | |||||
| } | } | ||||
| @@ -117,4 +117,14 @@ public class WxMpStoreServiceImpl implements WxMpStoreService { | |||||
| return stores; | return stores; | ||||
| } | } | ||||
| @Override | |||||
| public void update(WxMpStoreBaseInfo request) throws WxErrorException { | |||||
| String url = API_BASE_URL + "/updatepoi"; | |||||
| String response = this.wxMpService.post(url, request.toJson()); | |||||
| WxError wxError = WxError.fromJson(response); | |||||
| if (wxError.getErrorCode() != 0) { | |||||
| throw new WxErrorException(wxError); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -15,7 +15,8 @@ import java.util.List; | |||||
| import static org.junit.Assert.assertNotNull; | import static org.junit.Assert.assertNotNull; | ||||
| /** | /** | ||||
| * @author 王彬 (Binary Wang) | |||||
| * @author binarywang(https://github.com/binarywang) | |||||
| * Created by Binary Wang on 2016-09-23. | |||||
| * | * | ||||
| */ | */ | ||||
| @Test | @Test | ||||
| @@ -37,6 +38,14 @@ public class WxMpStoreServiceImplTest { | |||||
| .build()); | .build()); | ||||
| } | } | ||||
| public void testUpdate() throws WxErrorException { | |||||
| this.wxMpService.getStoreService() | |||||
| .update(WxMpStoreBaseInfo.builder().poiId("291503654").telephone("020-12345678") | |||||
| .sid("aaa").avgPrice(35).openTime("8:00-20:00").special("免费wifi,外卖服务") | |||||
| .introduction("麦当劳是全球大型跨国连锁餐厅,1940 年创立于美国,在世界上大约拥有3 万间分店。主要售卖汉堡包,以及薯条、炸鸡、汽水、冰品、沙拉、水果等快餐食品").offsetType(1) | |||||
| .build()); | |||||
| } | |||||
| public void testGet() throws WxErrorException { | public void testGet() throws WxErrorException { | ||||
| WxMpStoreBaseInfo result = this.wxMpService.getStoreService().get("291503654"); | WxMpStoreBaseInfo result = this.wxMpService.getStoreService().get("291503654"); | ||||
| assertNotNull(result); | assertNotNull(result); | ||||