|
@@ -31,12 +31,13 @@ public class WechatService {
|
|
|
|
|
|
|
|
|
//水查查小程序
|
|
|
+ @Value("${wechat.mp.app-secret}")
|
|
|
+ private String APP_SECRET="a01d7f75f15e1a6b7fa28a317f97ef1b";
|
|
|
+ @Value("${wechat.mp.appid}")
|
|
|
+ private String APP_ID ;
|
|
|
|
|
|
- private static String APP_SECRET="a01d7f75f15e1a6b7fa28a317f97ef1b";
|
|
|
|
|
|
- private static String APP_ID="wx27f831675081e293" ;
|
|
|
-
|
|
|
- public static String getSessionkey(String code) {
|
|
|
+ public String getSessionkey(String code) {
|
|
|
JSONObject oppidObj=getWechatAuthInfo(code);
|
|
|
Integer errcode = (Integer) oppidObj.get("errcode");
|
|
|
if(errcode == null){
|
|
@@ -49,7 +50,7 @@ public class WechatService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- private static JSONObject getWechatAuthInfo(String code){
|
|
|
+ private JSONObject getWechatAuthInfo(String code){
|
|
|
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + APP_ID + "&secret="
|
|
|
+ APP_SECRET + "&js_code=" + code + "&grant_type=authorization_code";
|
|
|
String reusult = null;
|
|
@@ -62,7 +63,7 @@ public class WechatService {
|
|
|
JSONObject oppidObj = JSONObject.parseObject(reusult);
|
|
|
return oppidObj;
|
|
|
}
|
|
|
- public static String getOpenid(String code,String customerId) {
|
|
|
+ public String getOpenid(String code,String customerId) {
|
|
|
JSONObject oppidObj=getWechatAuthInfo(code);
|
|
|
Integer errcode = (Integer) oppidObj.get("errcode");
|
|
|
if(errcode == null){
|