mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #1267 小程序模块增加多账号切换功能支持
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package cn.binarywang.wx.miniapp.util;
|
||||
|
||||
/**
|
||||
* 小程序存储值存放类.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2020-08-16
|
||||
*/
|
||||
public class WxMaConfigHolder {
|
||||
private final static ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<String>() {
|
||||
@Override
|
||||
protected String initialValue() {
|
||||
return "default";
|
||||
}
|
||||
};
|
||||
|
||||
public static String get() {
|
||||
return THREAD_LOCAL.get();
|
||||
}
|
||||
|
||||
public static void set(String label) {
|
||||
THREAD_LOCAL.set(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此方法需要用户根据自己程序代码,在适当位置手动触发调用,本SDK里无法判断调用时机
|
||||
*/
|
||||
public static void remove() {
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user