|
|
|
@@ -4,6 +4,8 @@ import cn.binarywang.wx.miniapp.api.WxMaUserService; |
|
|
|
import cn.binarywang.wx.miniapp.api.impl.WxMaUserServiceImpl; |
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
|
|
|
import cn.binarywang.wx.miniapp.config.WxMaConfig; |
|
|
|
import com.aliyun.openservices.shade.com.alibaba.fastjson.JSON; |
|
|
|
import com.aliyun.openservices.shade.com.alibaba.fastjson.JSONObject; |
|
|
|
import com.google.common.base.Joiner; |
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.google.gson.JsonParser; |
|
|
|
@@ -208,6 +210,13 @@ public class TtMaServiceImpl implements TtMaService, RequestHttp<CloseableHttpCl |
|
|
|
throw new RuntimeException("微信服务端异常,超出重试次数"); |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
String str = "123"; |
|
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(str); |
|
|
|
jsonObject.put("access_token","456"); |
|
|
|
System.out.println(jsonObject.toJSONString()); |
|
|
|
} |
|
|
|
|
|
|
|
private <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException { |
|
|
|
E dataForLog = DataUtils.handleDataWithSecret(data); |
|
|
|
|
|
|
|
@@ -216,7 +225,18 @@ public class TtMaServiceImpl implements TtMaService, RequestHttp<CloseableHttpCl |
|
|
|
} |
|
|
|
String accessToken = getAccessToken(false); |
|
|
|
|
|
|
|
String uriWithAccessToken = uri + (uri.contains("?") ? "&" : "?") + "access_token=" + accessToken; |
|
|
|
try { |
|
|
|
if(!(data instanceof String)){ |
|
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(data); |
|
|
|
jsonObject.put("access_token",accessToken); |
|
|
|
data = (E)jsonObject; |
|
|
|
} |
|
|
|
} catch (Exception e){ |
|
|
|
log.error("\n【请求参数+access_token】:{}\n【错误信息】:{}", dataForLog, e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
// String uriWithAccessToken = uri + (uri.contains("?") ? "&" : "?") + "access_token=" + accessToken; |
|
|
|
String uriWithAccessToken = uri; |
|
|
|
|
|
|
|
try { |
|
|
|
T result = executor.execute(uriWithAccessToken, data, WxType.MiniApp); |
|
|
|
|