Skip to content

Commit 091aefe

Browse files
committed
添加门店服务信息修改的接口, for issue #17
1 parent 6889e3d commit 091aefe

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public interface WxMpStoreService {
2727
*/
2828
void add(WxMpStoreBaseInfo request) throws WxErrorException;
2929

30-
3130
/**
3231
* <pre>
3332
* 查询门店信息
@@ -63,4 +62,15 @@ public interface WxMpStoreService {
6362
* @throws WxErrorException
6463
*/
6564
List<WxMpStoreInfo> listAll() throws WxErrorException;
65+
66+
/**
67+
* <pre>
68+
* 修改门店服务信息
69+
* 商户可以通过该接口,修改门店的服务信息,包括:sid、图片列表、营业时间、推荐、特色服务、简介、人均价格、电话8个字段(名称、坐标、地址等不可修改)修改后需要人工审核。
70+
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
71+
* </pre>
72+
* @throws WxErrorException
73+
*/
74+
void update(WxMpStoreBaseInfo info) throws WxErrorException;
75+
6676
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,14 @@ public List<WxMpStoreInfo> listAll() throws WxErrorException {
117117
return stores;
118118
}
119119

120+
@Override
121+
public void update(WxMpStoreBaseInfo request) throws WxErrorException {
122+
String url = API_BASE_URL + "/updatepoi";
123+
String response = this.wxMpService.post(url, request.toJson());
124+
WxError wxError = WxError.fromJson(response);
125+
if (wxError.getErrorCode() != 0) {
126+
throw new WxErrorException(wxError);
127+
}
128+
}
129+
120130
}

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import static org.junit.Assert.assertNotNull;
1616

1717
/**
18-
* @author 王彬 (Binary Wang)
18+
* @author binarywang(https://github.com/binarywang)
19+
* Created by Binary Wang on 2016-09-23.
1920
*
2021
*/
2122
@Test
@@ -37,6 +38,14 @@ public void testAdd() throws WxErrorException {
3738
.build());
3839
}
3940

41+
public void testUpdate() throws WxErrorException {
42+
this.wxMpService.getStoreService()
43+
.update(WxMpStoreBaseInfo.builder().poiId("291503654").telephone("020-12345678")
44+
.sid("aaa").avgPrice(35).openTime("8:00-20:00").special("免费wifi,外卖服务")
45+
.introduction("麦当劳是全球大型跨国连锁餐厅,1940 年创立于美国,在世界上大约拥有3 万间分店。主要售卖汉堡包,以及薯条、炸鸡、汽水、冰品、沙拉、水果等快餐食品").offsetType(1)
46+
.build());
47+
}
48+
4049
public void testGet() throws WxErrorException {
4150
WxMpStoreBaseInfo result = this.wxMpService.getStoreService().get("291503654");
4251
assertNotNull(result);

0 commit comments

Comments
 (0)