mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
pull request (#163)
* 新增两个接口:获取设备绑定的用户、获取用户绑定的设备 * update * 申请设备二维码接口的返回格式有变动,做出相应更改。
This commit is contained in:
@@ -76,5 +76,24 @@ public interface WxMpDeviceService {
|
||||
*/
|
||||
WxDeviceBindResult compelUnbind(WxDeviceBind wxDeviceBind) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 通过device type和device id 获取设备主人的openid
|
||||
* 详情请见:http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-11
|
||||
* </pre>
|
||||
* @param deviceType 设备类型,目前为"公众账号原始ID"
|
||||
* @param deviceId 设备ID
|
||||
* @return WxDeviceOpenIdResult
|
||||
*/
|
||||
WxDeviceOpenIdResult getOpenId(String deviceType,String deviceId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 通过openid获取用户在当前devicetype下绑定的deviceid列表`
|
||||
* 详情请见:http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-12
|
||||
* </pre>
|
||||
* @param openId 要查询的用户的openid
|
||||
* @return WxDeviceBindDeviceResult
|
||||
*/
|
||||
WxDeviceBindDeviceResult getBindDevice(String openId) throws WxErrorException;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class WxMpDeviceServiceImpl implements WxMpDeviceService {
|
||||
@Override
|
||||
public TransMsgResp transMsg(WxDeviceMsg msg) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/transmsg";
|
||||
String response = this.wxMpService.post(url,msg.toJson());
|
||||
String response = this.wxMpService.post(url, msg.toJson());
|
||||
return TransMsgResp.fromJson(response);
|
||||
}
|
||||
|
||||
@@ -37,21 +37,21 @@ public class WxMpDeviceServiceImpl implements WxMpDeviceService {
|
||||
@Override
|
||||
public WxDeviceAuthorizeResult authorize(WxDeviceAuthorize wxDeviceAuthorize) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/authorize_device";
|
||||
String response = this.wxMpService.post(url,wxDeviceAuthorize.toJson());
|
||||
String response = this.wxMpService.post(url, wxDeviceAuthorize.toJson());
|
||||
return WxDeviceAuthorizeResult.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxDeviceBindResult bind(WxDeviceBind wxDeviceBind) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/bind";
|
||||
String response = this.wxMpService.post(url,wxDeviceBind.toJson());
|
||||
String response = this.wxMpService.post(url, wxDeviceBind.toJson());
|
||||
return WxDeviceBindResult.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxDeviceBindResult compelBind(WxDeviceBind wxDeviceBind) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/compel_bind";
|
||||
String response = this.wxMpService.post(url,wxDeviceBind.toJson());
|
||||
String response = this.wxMpService.post(url, wxDeviceBind.toJson());
|
||||
return WxDeviceBindResult.fromJson(response);
|
||||
}
|
||||
|
||||
@@ -68,5 +68,19 @@ public class WxMpDeviceServiceImpl implements WxMpDeviceService {
|
||||
String response = this.wxMpService.post(url, wxDeviceBind.toJson());
|
||||
return WxDeviceBindResult.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxDeviceOpenIdResult getOpenId(String deviceType, String deviceId) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/get_openid";
|
||||
String response = this.wxMpService.get(url, "device_type=" + deviceType + "&device_id=" + deviceId);
|
||||
return WxDeviceOpenIdResult.fromJson(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxDeviceBindDeviceResult getBindDevice(String openId) throws WxErrorException {
|
||||
String url = API_URL_PREFIX+"/get_bind_device";
|
||||
String response = this.wxMpService.get(url,"openid="+openId);
|
||||
return WxDeviceBindDeviceResult.fromJson(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user