mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-04 12:47:46 +08:00
#516 实现修改门店网络WiFi信息的接口
This commit is contained in:
parent
7ac670b287
commit
37f5e59fbd
@ -45,4 +45,22 @@ public interface WxMpWifiService {
|
||||
* @throws WxErrorException 异常
|
||||
*/
|
||||
WxMpWifiShopDataResult getShopWifiInfo(int shopId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 修改门店网络信息.
|
||||
* 通过此接口修改门店的网络信息,包括网络名称(ssid)或密码。需注意:
|
||||
* 只有门店下已添加Wi-Fi网络信息,才能调用此接口修改网络信息;添加方式请参考“添加密码型设备”和"添加portal型设备”接口文档。
|
||||
* 网络信息修改后,密码型设备需同步修改所有设备的ssid或密码;portal型设备需修改所有设备的ssid,并按照《硬件鉴权协议接口》修改“第二步:改造移动端portal页面”中的ssid参数,否则将无法正常连网。
|
||||
* 文档地址:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1457435413
|
||||
* </pre>
|
||||
*
|
||||
* @param shopId 门店ID
|
||||
* @param oldSsid 旧的ssid
|
||||
* @param ssid 无线网络设备的ssid。32个字符以内;ssid支持中文,但可能因设备兼容性问题导致显示乱码,或无法连接等问题,相关风险自行承担! 当门店下是portal型设备时,ssid必填;当门店下是密码型设备时,ssid选填,且ssid和密码必须有一个以大写字母“WX”开头
|
||||
* @param password 无线网络设备的密码。8-24个字符;不能包含中文字符; 当门店下是密码型设备时,才可填写password,且ssid和密码必须有一个以大写字母“WX”开头
|
||||
* @return 是否更新成功
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
boolean updateShopWifiInfo(int shopId, String oldSsid, String ssid, String password) throws WxErrorException;
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ import me.chanjar.weixin.mp.api.WxMpWifiService;
|
||||
import me.chanjar.weixin.mp.bean.wifi.WxMpWifiShopDataResult;
|
||||
import me.chanjar.weixin.mp.bean.wifi.WxMpWifiShopListResult;
|
||||
|
||||
import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Wifi.BIZWIFI_SHOP_GET;
|
||||
import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Wifi.BIZWIFI_SHOP_LIST;
|
||||
import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Wifi.*;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -37,4 +36,21 @@ public class WxMpWifiServiceImpl implements WxMpWifiService {
|
||||
json.addProperty("shop_id", shopId);
|
||||
return WxMpWifiShopDataResult.fromJson(this.wxMpService.post(BIZWIFI_SHOP_GET, json.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateShopWifiInfo(int shopId, String oldSsid, String ssid, String password) throws WxErrorException {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("shop_id", shopId);
|
||||
json.addProperty("old_ssid", oldSsid);
|
||||
json.addProperty("ssid", ssid);
|
||||
if (password != null) {
|
||||
json.addProperty("password", password);
|
||||
}
|
||||
try {
|
||||
this.wxMpService.post(BIZWIFI_SHOP_UPDATE, json.toString());
|
||||
return true;
|
||||
} catch (WxErrorException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +391,12 @@ public interface WxMpApiUrl {
|
||||
/**
|
||||
* get.
|
||||
*/
|
||||
BIZWIFI_SHOP_GET(API_DEFAULT_HOST_URL, "/bizwifi/shop/get");
|
||||
BIZWIFI_SHOP_GET(API_DEFAULT_HOST_URL, "/bizwifi/shop/get"),
|
||||
|
||||
/**
|
||||
* upadte.
|
||||
*/
|
||||
BIZWIFI_SHOP_UPDATE(API_DEFAULT_HOST_URL, "/bizwifi/shop/update");
|
||||
|
||||
private String prefix;
|
||||
private String path;
|
||||
|
@ -43,6 +43,13 @@ public class WxMpWifiServiceImplTest {
|
||||
System.out.println(wifiInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateShopWifiInfo() throws WxErrorException {
|
||||
final boolean result = this.wxService.getWifiService()
|
||||
.updateShopWifiInfo(123, "123", "345", null);
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
public static class MockTest {
|
||||
private WxMpService wxService = mock(WxMpService.class);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user