| | |
| | | import com.hx.util.OSSUtil; |
| | | import com.hx.util.SimpleTool; |
| | | import com.hx.util.StringUtils; |
| | | import com.hz.util.http.HttpHzUtil; |
| | | import com.hz.util.http.dto.HttpHzResponse; |
| | | import net.sf.json.JSONException; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.codec.binary.Base64; |
| | |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.MessageFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | |
| | | private static final String JSCODE2SESSION_URL = "https://api.weixin.qq.com/sns/jscode2session?"; |
| | | /**发送订阅消息通知链接*/ |
| | | private static final String SEND_SUBSCRIBE_MESSAGE = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="; |
| | | //生成小程序二维码地址(方形) |
| | | /**生成小程序二维码地址(方形)*/ |
| | | public static final String MAKE_TWOCODE_SQUARE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="; |
| | | //生成小程序二维码地址(圆形) |
| | | /**生成小程序二维码地址(圆形)*/ |
| | | public static final String MAKE_TWOCODE_ROUND_URL = "https://api.weixin.qq.com/wxa/getwxacode?access_token={0}"; |
| | | //生成无限二维码 |
| | | /**生成无限二维码*/ |
| | | public static final String URL_UNLIMIT_SQUARE = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}"; |
| | | /**获取小程序订阅个人模板列表*/ |
| | | private static final String GET_APP_TEMPLATE = "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token="; |
| | | /**获取公众号模板列表*/ |
| | | private static final String GET_GZH_TEMPLATE = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token="; |
| | | ////////////////////////////////////////////////// |
| | | |
| | | /** (小程序)通过code换取网页授权access_token/如果是snsapi_base模式的授权,这里就可以拿到openId了 ***/ |
| | |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | | * 获取小程序订阅模板 |
| | | * @param accessToken token |
| | | * **/ |
| | | public static HttpHzResponse appTemplateList(String accessToken) { |
| | | return HttpHzUtil.HttpURLUtilJson(GET_APP_TEMPLATE + accessToken, null,null,null,"GET",null); |
| | | } |
| | | |
| | | /** |
| | | * 公众号订阅模板 |
| | | * @param accessToken token |
| | | * **/ |
| | | public static HttpHzResponse gzhTemplateList(String accessToken) { |
| | | return HttpHzUtil.HttpURLUtilJson(GET_GZH_TEMPLATE+accessToken, null,null,null,"GET",null); |
| | | } |
| | | |
| | | } |