| | |
| | | import java.util.Map; |
| | | |
| | | public class WxacodeUtil { |
| | | /** |
| | | * 小程序秘钥 |
| | | */ |
| | | private static final String XCX_SECRET = "xcx_secret"; |
| | | /** |
| | | * 小程序appid |
| | | */ |
| | | private static final String XCX_APPID = "xcx_appid"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * token获取地址 |
| | | */ |
| | |
| | | */ |
| | | private static final String GET_WXACODE ="https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="; |
| | | |
| | | public static String getWxacode(String scene,String page,String fileName) throws Exception { |
| | | public static String getWxacode(String scene,String page,String fileName,String appid,String secret) throws Exception { |
| | | LogUtil.debug("scene={},page={},fileName={}",scene,page,fileName); |
| | | //获取token |
| | | String appid = PropertiesUtil.getString(XCX_APPID); |
| | | String secret = PropertiesUtil.getString(XCX_SECRET); |
| | | String result1 = get(TOKEN_URL.replace("APPID", appid).replace("SECRET", secret)); |
| | | String access_token = JSONObject.parseObject(result1).getString("access_token"); |
| | | if(StringUtils.isNotBlank(access_token)) { |