Skip to content

Commit 0d5b317

Browse files
黄志东黄志东
authored andcommitted
[bugfix]设备授权接口没有传入产品编号
1 parent d86866d commit 0d5b317

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/api_device.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ exports.createDeviceQRCode = function* (deviceIds) {
4242
return yield this.request(url, postJSON(info));
4343
};
4444

45-
exports.authorizeDevices = function* (devices, optype) {
45+
/**
46+
* 设备授权接口
47+
* 详情请见:<http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5>
48+
* @param {Number} productID 产品编号
49+
* ```
50+
*/
51+
exports.authorizeDevices = function* (devices, optype, productID) {
4652
var token = yield this.ensureAccessToken();
4753
// https://api.weixin.qq.com/device/authorize_device?access_token=ACCESS_TOKEN
4854
var url = 'https://api.weixin.qq.com/device/authorize_device?access_token=' + token.accessToken;
@@ -51,6 +57,9 @@ exports.authorizeDevices = function* (devices, optype) {
5157
'device_list': devices,
5258
'op_type': optype
5359
};
60+
if(productID){
61+
data.product_id = productID;
62+
}
5463
return yield this.request(url, postJSON(data));
5564
};
5665

0 commit comments

Comments
 (0)