临时二维码支持字符型

This commit is contained in:
jinyu 2017-08-13 21:42:59 +08:00
parent af879a9d32
commit b92f53aaa7
2 changed files with 24 additions and 1 deletions

View File

@ -72,7 +72,7 @@ public class QRParameter implements Serializable {
}
/**
* 创建临时二维码
* 创建临时二维码(场景值为int)
*
* @param expireSeconds
* 二维码有效时间以秒为单位 最大不超过2592000即30天
@ -89,6 +89,25 @@ public class QRParameter implements Serializable {
return new QRParameter(QRType.QR_SCENE, expireSeconds,
Long.toString(sceneValue), sceneContent);
}
/**
* 创建临时二维码(场景值为string)
*
* @param expireSeconds
* 二维码有效时间以秒为单位 最大不超过2592000即30天
* @param sceneValue
* 二维码的场景值
* @return 二维码参数
*/
public static QRParameter createTemporaryQR(int expireSeconds,
String sceneValue) {
JSONObject sceneContent = new JSONObject();
JSONObject scene = new JSONObject();
scene.put("scene_id", sceneValue);
sceneContent.put("scene", scene);
return new QRParameter(QRType.QR_STR_SCENE, expireSeconds,
sceneValue, sceneContent);
}
/**
* 创建永久二维码(场景值为int)

View File

@ -26,6 +26,10 @@ public enum QRType {
* 卡券二维码单个卡券
*/
QR_CARD,
/**
* 临时的字符串参数值
*/
QR_STR_SCENE,
/**
* 卡券二维码多个卡券
*/