Skip to content

Commit 64aee56

Browse files
committed
add temp qrcode api with string scene_str support
1 parent c8938a6 commit 64aee56

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/api_qrcode.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ var postJSON = util.postJSON;
2323
* "expire_seconds":1800
2424
* }
2525
* ```
26-
* @param {Number} sceneId 场景ID
27-
* @param {Number} expire 过期时间,单位秒。最大不超过604800(即7天
26+
* @param {Number|String} sceneId 场景ID。字符串ID长度限制为1到64
27+
* @param {Number} expire 过期时间,单位秒。最大不超过2592000(即30天
2828
* @param {Function} callback 回调函数
2929
*/
3030
exports.createTmpQRCode = function (sceneId, expire, callback) {
@@ -41,6 +41,11 @@ exports._createTmpQRCode = function (sceneId, expire, callback) {
4141
'action_name': 'QR_SCENE',
4242
'action_info': {'scene': {'scene_id': sceneId}}
4343
};
44+
// 字符串支持
45+
if (typeof sceneId === 'string') {
46+
data.action_name = 'QR_STR_SCENE';
47+
data.action_info = {'scene': {'scene_str': sceneId}};
48+
}
4449
this.request(url, postJSON(data), wrapper(callback));
4550
};
4651

0 commit comments

Comments
 (0)