提交 bf9467ba authored 作者: xinjunguo's avatar xinjunguo

--no commit message

上级 991ab3db
......@@ -4,9 +4,6 @@
*/
package com.zrqx.third.wechatlogin;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
......@@ -15,11 +12,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
......@@ -31,7 +26,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
......@@ -48,6 +42,9 @@ import com.zrqx.third.util.HttpsUtils;
import com.zrqx.third.wechatlogin.config.WXCore;
import com.zrqx.third.wechatlogin.config.WeChatLoginXcxConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 微信登录
*
......@@ -122,18 +119,19 @@ public class WeChatLoginXcxController {
@ApiOperation(value = "获取分享二维码", notes = "获取分享二维码")
@GetMapping(RequestPath.QR)
public CallBack<String> getQr(String scene,String page) throws Exception {
public CallBack<String> getQr(String scene,String page) {
String appid = "appid=" + WeChatLoginXcxConfig.APPID;
String secret = "&secret=" + WeChatLoginXcxConfig.SECRET;
String param = appid + secret + "&grant_type=client_credential";
String result = HttpsUtils.sendGet(WeChatLoginXcxConfig.ACCESSTOKEN, param);
String path = "";
JSONObject object = (JSONObject) JSON.parse(result);
// 判断接口是否调用成功
if (object.containsKey("errcode")) {
throw new BaseException(ResponseCodeEnum.EXCEPTION.getCode(), object.get("errcode").toString());
}
String access_token = object.get("access_token").toString();
String path = getminiqrQr(access_token,scene,page);
path = getminiqrQr(access_token,scene,page);
return CallBack.success(path);
}
......@@ -180,7 +178,7 @@ public class WeChatLoginXcxController {
} catch (Exception e) {
// LOG.error("调用小程序生成微信永久小程序码URL接口异常",e);
System.out.println("调用小程序生成微信永久小程序码URL接口异常");
//throw new BaseException("调用小程序生成微信永久小程序码URL接口异常");
throw new BaseException("调用小程序生成微信永久小程序码URL接口异常");
} finally {
if (inputStream != null) {
try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论