You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package com.ynxbd.wx.wxfactory;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.ynxbd.common.helper.common.JsonHelper;
|
|
|
|
|
import com.ynxbd.common.helper.http.OkHttpHelper;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class WxMiniHelper {
|
|
|
|
|
|
|
|
|
|
public static JSONObject auth(String miniAppId, String miniAppSecret, String jsCode) {
|
|
|
|
|
String respJson = OkHttpHelper.get("https://api.weixin.qq.com/sns/jscode2session", params -> {
|
|
|
|
|
params.put("appid", miniAppId);
|
|
|
|
|
params.put("secret", miniAppSecret);
|
|
|
|
|
params.put("js_code", jsCode);
|
|
|
|
|
params.put("grant_type", "authorization_code");
|
|
|
|
|
});
|
|
|
|
|
log.info("[微信-小程序]认证响应: {}", respJson);
|
|
|
|
|
return JsonHelper.parseObject(respJson);
|
|
|
|
|
}
|
|
|
|
|
}
|