添加门店服务信息修改的接口, for issue #17

This commit is contained in:
BinaryWang 2016-09-28 19:53:35 +08:00
parent 6889e3d95e
commit 091aefe4e1
3 changed files with 31 additions and 2 deletions

View File

@ -27,7 +27,6 @@ public interface WxMpStoreService {
*/
void add(WxMpStoreBaseInfo request) throws WxErrorException;
/**
* <pre>
* 查询门店信息
@ -63,4 +62,15 @@ public interface WxMpStoreService {
* @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;
}

View File

@ -117,4 +117,14 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
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);
}
}
}

View File

@ -15,7 +15,8 @@ import java.util.List;
import static org.junit.Assert.assertNotNull;
/**
* @author 王彬 (Binary Wang)
* @author binarywang(https://github.com/binarywang)
* Created by Binary Wang on 2016-09-23.
*
*/
@Test
@ -37,6 +38,14 @@ public class WxMpStoreServiceImplTest {
.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 {
WxMpStoreBaseInfo result = this.wxMpService.getStoreService().get("291503654");
assertNotNull(result);